From 96c952108964d32278dfe458f85a9031e5b1ae27 Mon Sep 17 00:00:00 2001 From: Ave Date: Thu, 17 Jan 2019 19:00:12 +0100 Subject: [PATCH] added changes --- appasar/canary/app_bootstrap/Constants.js | 31 + appasar/canary/app_bootstrap/GPUSettings.js | 38 + appasar/canary/app_bootstrap/appSettings.js | 29 + appasar/canary/app_bootstrap/appUpdater.js | 40 + .../canary/app_bootstrap/autoStart/darwin.js | 24 + .../canary/app_bootstrap/autoStart/index.js | 3 + .../canary/app_bootstrap/autoStart/linux.js | 78 + .../canary/app_bootstrap/autoStart/win32.js | 69 + appasar/canary/app_bootstrap/bootstrap.js | 145 + appasar/canary/app_bootstrap/buildInfo.js | 16 + .../app_bootstrap/data/quotes_copy.json | 15 + appasar/canary/app_bootstrap/errorHandler.js | 38 + appasar/canary/app_bootstrap/hostUpdater.js | 236 + .../app_bootstrap/images/img_lucky_dice.png | Bin 0 -> 6378 bytes appasar/canary/app_bootstrap/index.js | 23 + .../canary/app_bootstrap/installDevTools.js | 18 + appasar/canary/app_bootstrap/ipcMain.js | 17 + appasar/canary/app_bootstrap/request.js | 131 + appasar/canary/app_bootstrap/requireNative.js | 5 + .../canary/app_bootstrap/singleInstance.js | 131 + .../a934ab008c7f6a2274ec441f6be0696a.woff | Bin 0 -> 15488 bytes .../abddffb32a4a35627c3857a06c751424.png | Bin 0 -> 6378 bytes .../d153359b5d87601d2b9c708b7ae2db02.woff | Bin 0 -> 23456 bytes .../canary/app_bootstrap/splash/index.html | 11 + appasar/canary/app_bootstrap/splash/index.js | 25745 ++++++++++++++++ .../app_bootstrap/splash/variables.json | 6 + appasar/canary/app_bootstrap/splashScreen.js | 318 + .../canary/app_bootstrap/squirrelUpdate.js | 224 + .../app_bootstrap/startupMenu/darwin.js | 19 + .../canary/app_bootstrap/startupMenu/index.js | 12 + .../canary/app_bootstrap/startupMenu/linux.js | 19 + .../canary/app_bootstrap/startupMenu/win32.js | 19 + .../app_bootstrap/videos/connecting.webm | Bin 0 -> 44980 bytes appasar/canary/app_bootstrap/windowsUtils.js | 89 + appasar/canary/common/Backoff.js | 127 + appasar/canary/common/FeatureFlags.js | 44 + appasar/canary/common/Settings.js | 88 + appasar/canary/common/moduleUpdater.js | 944 + appasar/canary/common/paths.js | 100 + appasar/canary/node_modules/.bin/mkdirp | 1 + appasar/canary/node_modules/.bin/rimraf | 1 + appasar/canary/node_modules/.bin/sshpk-conv | 1 + appasar/canary/node_modules/.bin/sshpk-sign | 1 + appasar/canary/node_modules/.bin/sshpk-verify | 1 + appasar/canary/node_modules/.bin/uuid | 1 + appasar/canary/node_modules/.yarn-integrity | 101 + .../canary/node_modules/ajv/.tonic_example.js | 20 + appasar/canary/node_modules/ajv/LICENSE | 22 + appasar/canary/node_modules/ajv/README.md | 1327 + .../node_modules/ajv/dist/ajv.bundle.js | 7345 +++++ .../canary/node_modules/ajv/dist/ajv.min.js | 3 + .../node_modules/ajv/dist/ajv.min.js.map | 1 + .../node_modules/ajv/dist/nodent.min.js | 2 + .../node_modules/ajv/dist/regenerator.min.js | 2 + appasar/canary/node_modules/ajv/lib/$data.js | 49 + appasar/canary/node_modules/ajv/lib/ajv.d.ts | 358 + appasar/canary/node_modules/ajv/lib/ajv.js | 502 + appasar/canary/node_modules/ajv/lib/cache.js | 26 + .../node_modules/ajv/lib/compile/_rules.js | 31 + .../node_modules/ajv/lib/compile/async.js | 90 + .../node_modules/ajv/lib/compile/equal.js | 3 + .../ajv/lib/compile/error_classes.js | 34 + .../node_modules/ajv/lib/compile/formats.js | 135 + .../node_modules/ajv/lib/compile/index.js | 380 + .../node_modules/ajv/lib/compile/resolve.js | 271 + .../node_modules/ajv/lib/compile/rules.js | 58 + .../ajv/lib/compile/schema_obj.js | 9 + .../ajv/lib/compile/ucs2length.js | 20 + .../node_modules/ajv/lib/compile/util.js | 267 + .../node_modules/ajv/lib/dot/_limit.jst | 96 + .../node_modules/ajv/lib/dot/_limitItems.jst | 10 + .../node_modules/ajv/lib/dot/_limitLength.jst | 10 + .../ajv/lib/dot/_limitProperties.jst | 10 + .../canary/node_modules/ajv/lib/dot/allOf.jst | 34 + .../canary/node_modules/ajv/lib/dot/anyOf.jst | 48 + .../node_modules/ajv/lib/dot/coerce.def | 61 + .../canary/node_modules/ajv/lib/dot/const.jst | 11 + .../node_modules/ajv/lib/dot/contains.jst | 57 + .../node_modules/ajv/lib/dot/custom.jst | 191 + .../node_modules/ajv/lib/dot/defaults.def | 32 + .../node_modules/ajv/lib/dot/definitions.def | 199 + .../node_modules/ajv/lib/dot/dependencies.jst | 80 + .../canary/node_modules/ajv/lib/dot/enum.jst | 30 + .../node_modules/ajv/lib/dot/errors.def | 194 + .../node_modules/ajv/lib/dot/format.jst | 106 + .../canary/node_modules/ajv/lib/dot/items.jst | 100 + .../node_modules/ajv/lib/dot/missing.def | 39 + .../node_modules/ajv/lib/dot/multipleOf.jst | 20 + .../canary/node_modules/ajv/lib/dot/not.jst | 43 + .../canary/node_modules/ajv/lib/dot/oneOf.jst | 44 + .../node_modules/ajv/lib/dot/pattern.jst | 14 + .../node_modules/ajv/lib/dot/properties.jst | 327 + .../ajv/lib/dot/propertyNames.jst | 54 + .../canary/node_modules/ajv/lib/dot/ref.jst | 85 + .../node_modules/ajv/lib/dot/required.jst | 108 + .../node_modules/ajv/lib/dot/uniqueItems.jst | 38 + .../node_modules/ajv/lib/dot/validate.jst | 272 + .../node_modules/ajv/lib/dotjs/README.md | 3 + .../node_modules/ajv/lib/dotjs/_limit.js | 149 + .../node_modules/ajv/lib/dotjs/_limitItems.js | 76 + .../ajv/lib/dotjs/_limitLength.js | 81 + .../ajv/lib/dotjs/_limitProperties.js | 76 + .../node_modules/ajv/lib/dotjs/allOf.js | 43 + .../node_modules/ajv/lib/dotjs/anyOf.js | 73 + .../node_modules/ajv/lib/dotjs/const.js | 55 + .../node_modules/ajv/lib/dotjs/contains.js | 81 + .../node_modules/ajv/lib/dotjs/custom.js | 226 + .../ajv/lib/dotjs/dependencies.js | 167 + .../canary/node_modules/ajv/lib/dotjs/enum.js | 65 + .../node_modules/ajv/lib/dotjs/format.js | 149 + .../node_modules/ajv/lib/dotjs/items.js | 140 + .../node_modules/ajv/lib/dotjs/multipleOf.js | 76 + .../canary/node_modules/ajv/lib/dotjs/not.js | 83 + .../node_modules/ajv/lib/dotjs/oneOf.js | 70 + .../node_modules/ajv/lib/dotjs/pattern.js | 74 + .../node_modules/ajv/lib/dotjs/properties.js | 468 + .../ajv/lib/dotjs/propertyNames.js | 81 + .../canary/node_modules/ajv/lib/dotjs/ref.js | 123 + .../node_modules/ajv/lib/dotjs/required.js | 268 + .../node_modules/ajv/lib/dotjs/uniqueItems.js | 71 + .../node_modules/ajv/lib/dotjs/validate.js | 458 + .../canary/node_modules/ajv/lib/keyword.js | 135 + .../node_modules/ajv/lib/patternGroups.js | 36 + .../node_modules/ajv/lib/refs/$data.json | 17 + .../ajv/lib/refs/json-schema-draft-04.json | 150 + .../ajv/lib/refs/json-schema-draft-06.json | 154 + .../ajv/lib/refs/json-schema-v5.json | 250 + appasar/canary/node_modules/ajv/package.json | 103 + .../node_modules/ajv/scripts/.eslintrc.yml | 3 + .../canary/node_modules/ajv/scripts/bundle.js | 61 + .../node_modules/ajv/scripts/compile-dots.js | 73 + appasar/canary/node_modules/ajv/scripts/info | 10 + .../node_modules/ajv/scripts/prepare-tests | 9 + .../node_modules/ajv/scripts/travis-gh-pages | 23 + appasar/canary/node_modules/asn1/.npmignore | 2 + appasar/canary/node_modules/asn1/.travis.yml | 4 + appasar/canary/node_modules/asn1/LICENSE | 19 + appasar/canary/node_modules/asn1/README.md | 50 + .../node_modules/asn1/lib/ber/errors.js | 13 + .../canary/node_modules/asn1/lib/ber/index.js | 27 + .../node_modules/asn1/lib/ber/reader.js | 261 + .../canary/node_modules/asn1/lib/ber/types.js | 36 + .../node_modules/asn1/lib/ber/writer.js | 316 + appasar/canary/node_modules/asn1/lib/index.js | 20 + appasar/canary/node_modules/asn1/package.json | 24 + .../node_modules/asn1/tst/ber/reader.test.js | 208 + .../node_modules/asn1/tst/ber/writer.test.js | 370 + .../canary/node_modules/assert-plus/AUTHORS | 6 + .../node_modules/assert-plus/CHANGES.md | 14 + .../canary/node_modules/assert-plus/README.md | 162 + .../canary/node_modules/assert-plus/assert.js | 211 + .../node_modules/assert-plus/package.json | 23 + appasar/canary/node_modules/asynckit/LICENSE | 21 + .../canary/node_modules/asynckit/README.md | 233 + appasar/canary/node_modules/asynckit/bench.js | 76 + appasar/canary/node_modules/asynckit/index.js | 6 + .../canary/node_modules/asynckit/lib/abort.js | 29 + .../canary/node_modules/asynckit/lib/async.js | 34 + .../canary/node_modules/asynckit/lib/defer.js | 26 + .../node_modules/asynckit/lib/iterate.js | 75 + .../asynckit/lib/readable_asynckit.js | 91 + .../asynckit/lib/readable_parallel.js | 25 + .../asynckit/lib/readable_serial.js | 25 + .../asynckit/lib/readable_serial_ordered.js | 29 + .../canary/node_modules/asynckit/lib/state.js | 37 + .../node_modules/asynckit/lib/streamify.js | 141 + .../node_modules/asynckit/lib/terminator.js | 29 + .../canary/node_modules/asynckit/package.json | 63 + .../canary/node_modules/asynckit/parallel.js | 43 + .../canary/node_modules/asynckit/serial.js | 17 + .../node_modules/asynckit/serialOrdered.js | 75 + .../canary/node_modules/asynckit/stream.js | 21 + appasar/canary/node_modules/aws-sign2/LICENSE | 55 + .../canary/node_modules/aws-sign2/README.md | 4 + .../canary/node_modules/aws-sign2/index.js | 212 + .../node_modules/aws-sign2/package.json | 17 + appasar/canary/node_modules/aws4/.npmignore | 4 + appasar/canary/node_modules/aws4/.tern-port | 1 + appasar/canary/node_modules/aws4/.travis.yml | 5 + appasar/canary/node_modules/aws4/LICENSE | 19 + appasar/canary/node_modules/aws4/README.md | 523 + appasar/canary/node_modules/aws4/aws4.js | 332 + appasar/canary/node_modules/aws4/lru.js | 96 + appasar/canary/node_modules/aws4/package.json | 71 + .../node_modules/balanced-match/.npmignore | 5 + .../node_modules/balanced-match/LICENSE.md | 21 + .../node_modules/balanced-match/README.md | 91 + .../node_modules/balanced-match/index.js | 59 + .../node_modules/balanced-match/package.json | 49 + .../node_modules/bcrypt-pbkdf/README.md | 39 + .../canary/node_modules/bcrypt-pbkdf/index.js | 556 + .../node_modules/bcrypt-pbkdf/package.json | 11 + appasar/canary/node_modules/boom/LICENSE | 29 + appasar/canary/node_modules/boom/README.md | 760 + appasar/canary/node_modules/boom/lib/index.js | 433 + appasar/canary/node_modules/boom/package.json | 29 + .../node_modules/brace-expansion/README.md | 123 + .../node_modules/brace-expansion/index.js | 201 + .../node_modules/brace-expansion/package.json | 47 + .../canary/node_modules/buffer-crc32/LICENSE | 19 + .../node_modules/buffer-crc32/README.md | 47 + .../canary/node_modules/buffer-crc32/index.js | 111 + .../node_modules/buffer-crc32/package.json | 39 + appasar/canary/node_modules/caseless/LICENSE | 28 + .../canary/node_modules/caseless/README.md | 45 + appasar/canary/node_modules/caseless/index.js | 67 + .../canary/node_modules/caseless/package.json | 27 + appasar/canary/node_modules/caseless/test.js | 67 + appasar/canary/node_modules/co/History.md | 172 + appasar/canary/node_modules/co/LICENSE | 22 + appasar/canary/node_modules/co/Readme.md | 212 + appasar/canary/node_modules/co/index.js | 237 + appasar/canary/node_modules/co/package.json | 34 + .../node_modules/combined-stream/License | 19 + .../node_modules/combined-stream/Readme.md | 138 + .../combined-stream/lib/combined_stream.js | 188 + .../node_modules/combined-stream/package.json | 25 + .../node_modules/concat-map/.travis.yml | 4 + .../canary/node_modules/concat-map/LICENSE | 18 + .../node_modules/concat-map/README.markdown | 62 + .../node_modules/concat-map/example/map.js | 6 + .../canary/node_modules/concat-map/index.js | 13 + .../node_modules/concat-map/package.json | 43 + .../node_modules/concat-map/test/map.js | 39 + .../canary/node_modules/core-util-is/LICENSE | 19 + .../node_modules/core-util-is/README.md | 3 + .../node_modules/core-util-is/float.patch | 604 + .../node_modules/core-util-is/lib/util.js | 107 + .../node_modules/core-util-is/package.json | 32 + .../canary/node_modules/core-util-is/test.js | 68 + .../canary/node_modules/cryptiles/.npmignore | 3 + appasar/canary/node_modules/cryptiles/LICENSE | 28 + .../canary/node_modules/cryptiles/README.md | 19 + .../node_modules/cryptiles/lib/index.js | 88 + .../cryptiles/node_modules/boom/LICENSE | 29 + .../cryptiles/node_modules/boom/README.md | 784 + .../cryptiles/node_modules/boom/lib/index.js | 457 + .../cryptiles/node_modules/boom/package.json | 29 + .../node_modules/cryptiles/package.json | 27 + .../canary/node_modules/dashdash/CHANGES.md | 364 + .../canary/node_modules/dashdash/LICENSE.txt | 24 + .../canary/node_modules/dashdash/README.md | 574 + .../dashdash/etc/dashdash.bash_completion.in | 389 + .../node_modules/dashdash/lib/dashdash.js | 1055 + .../canary/node_modules/dashdash/package.json | 26 + .../node_modules/delayed-stream/.npmignore | 1 + .../node_modules/delayed-stream/License | 19 + .../node_modules/delayed-stream/Makefile | 7 + .../node_modules/delayed-stream/Readme.md | 141 + .../delayed-stream/lib/delayed_stream.js | 107 + .../node_modules/delayed-stream/package.json | 27 + .../canary/node_modules/ecc-jsbn/.npmignore | 15 + appasar/canary/node_modules/ecc-jsbn/LICENSE | 21 + .../canary/node_modules/ecc-jsbn/README.md | 8 + appasar/canary/node_modules/ecc-jsbn/index.js | 57 + .../node_modules/ecc-jsbn/lib/LICENSE-jsbn | 40 + .../canary/node_modules/ecc-jsbn/lib/ec.js | 561 + .../canary/node_modules/ecc-jsbn/lib/sec.js | 170 + .../canary/node_modules/ecc-jsbn/package.json | 39 + appasar/canary/node_modules/ecc-jsbn/test.js | 14 + appasar/canary/node_modules/extend/.eslintrc | 17 + appasar/canary/node_modules/extend/.jscs.json | 175 + appasar/canary/node_modules/extend/.npmignore | 1 + .../canary/node_modules/extend/.travis.yml | 179 + .../canary/node_modules/extend/CHANGELOG.md | 77 + appasar/canary/node_modules/extend/LICENSE | 23 + appasar/canary/node_modules/extend/README.md | 81 + .../canary/node_modules/extend/component.json | 32 + appasar/canary/node_modules/extend/index.js | 86 + .../canary/node_modules/extend/package.json | 43 + .../node_modules/extsprintf/.gitmodules | 0 .../canary/node_modules/extsprintf/.npmignore | 2 + .../canary/node_modules/extsprintf/LICENSE | 19 + .../canary/node_modules/extsprintf/Makefile | 24 + .../node_modules/extsprintf/Makefile.targ | 285 + .../canary/node_modules/extsprintf/README.md | 46 + .../node_modules/extsprintf/jsl.node.conf | 137 + .../node_modules/extsprintf/lib/extsprintf.js | 183 + .../node_modules/extsprintf/package.json | 14 + .../node_modules/fast-deep-equal/LICENSE | 21 + .../node_modules/fast-deep-equal/README.md | 55 + .../node_modules/fast-deep-equal/index.d.ts | 4 + .../node_modules/fast-deep-equal/index.js | 55 + .../node_modules/fast-deep-equal/package.json | 58 + .../fast-json-stable-stringify/.eslintrc.yml | 26 + .../fast-json-stable-stringify/.npmignore | 4 + .../fast-json-stable-stringify/.travis.yml | 8 + .../fast-json-stable-stringify/LICENSE | 18 + .../fast-json-stable-stringify/README.md | 119 + .../benchmark/index.js | 31 + .../benchmark/test.json | 137 + .../example/key_cmp.js | 7 + .../example/nested.js | 3 + .../fast-json-stable-stringify/example/str.js | 3 + .../example/value_cmp.js | 7 + .../fast-json-stable-stringify/index.js | 59 + .../fast-json-stable-stringify/package.json | 50 + .../fast-json-stable-stringify/test/cmp.js | 13 + .../fast-json-stable-stringify/test/nested.js | 44 + .../fast-json-stable-stringify/test/str.js | 46 + .../test/to-json.js | 22 + .../canary/node_modules/fd-slicer/.npmignore | 2 + .../canary/node_modules/fd-slicer/.travis.yml | 7 + .../node_modules/fd-slicer/CHANGELOG.md | 49 + appasar/canary/node_modules/fd-slicer/LICENSE | 21 + .../canary/node_modules/fd-slicer/README.md | 189 + .../canary/node_modules/fd-slicer/index.js | 277 + .../node_modules/fd-slicer/package.json | 36 + .../node_modules/fd-slicer/test/test.js | 350 + .../canary/node_modules/forever-agent/LICENSE | 55 + .../node_modules/forever-agent/README.md | 4 + .../node_modules/forever-agent/index.js | 138 + .../node_modules/forever-agent/package.json | 17 + appasar/canary/node_modules/form-data/License | 19 + .../canary/node_modules/form-data/README.md | 234 + .../node_modules/form-data/README.md.bak | 234 + .../node_modules/form-data/lib/browser.js | 2 + .../node_modules/form-data/lib/form_data.js | 457 + .../node_modules/form-data/lib/populate.js | 10 + .../node_modules/combined-stream/License | 19 + .../node_modules/combined-stream/Readme.md | 138 + .../combined-stream/lib/combined_stream.js | 189 + .../node_modules/combined-stream/lib/defer.js | 26 + .../node_modules/combined-stream/package.json | 25 + .../node_modules/form-data/package.json | 65 + .../canary/node_modules/fs.realpath/LICENSE | 43 + .../canary/node_modules/fs.realpath/README.md | 33 + .../canary/node_modules/fs.realpath/index.js | 66 + .../canary/node_modules/fs.realpath/old.js | 303 + .../node_modules/fs.realpath/package.json | 26 + .../canary/node_modules/getpass/.npmignore | 8 + .../canary/node_modules/getpass/.travis.yml | 9 + appasar/canary/node_modules/getpass/LICENSE | 18 + appasar/canary/node_modules/getpass/README.md | 32 + .../canary/node_modules/getpass/lib/index.js | 123 + .../canary/node_modules/getpass/package.json | 18 + appasar/canary/node_modules/glob/LICENSE | 15 + appasar/canary/node_modules/glob/README.md | 368 + appasar/canary/node_modules/glob/changelog.md | 67 + appasar/canary/node_modules/glob/common.js | 240 + appasar/canary/node_modules/glob/glob.js | 790 + appasar/canary/node_modules/glob/package.json | 43 + appasar/canary/node_modules/glob/sync.js | 486 + .../canary/node_modules/har-schema/LICENSE | 13 + .../canary/node_modules/har-schema/README.md | 49 + .../har-schema/lib/afterRequest.json | 30 + .../har-schema/lib/beforeRequest.json | 30 + .../node_modules/har-schema/lib/browser.json | 20 + .../node_modules/har-schema/lib/cache.json | 21 + .../node_modules/har-schema/lib/content.json | 29 + .../node_modules/har-schema/lib/cookie.json | 36 + .../node_modules/har-schema/lib/creator.json | 20 + .../node_modules/har-schema/lib/entry.json | 53 + .../node_modules/har-schema/lib/har.json | 13 + .../node_modules/har-schema/lib/header.json | 20 + .../node_modules/har-schema/lib/index.js | 22 + .../node_modules/har-schema/lib/log.json | 36 + .../node_modules/har-schema/lib/page.json | 32 + .../har-schema/lib/pageTimings.json | 18 + .../node_modules/har-schema/lib/postData.json | 43 + .../node_modules/har-schema/lib/query.json | 20 + .../node_modules/har-schema/lib/request.json | 57 + .../node_modules/har-schema/lib/response.json | 54 + .../node_modules/har-schema/lib/timings.json | 42 + .../node_modules/har-schema/package.json | 54 + .../canary/node_modules/har-validator/LICENSE | 13 + .../node_modules/har-validator/README.md | 54 + .../node_modules/har-validator/lib/async.js | 98 + .../node_modules/har-validator/lib/error.js | 17 + .../node_modules/har-validator/lib/promise.js | 95 + .../node_modules/har-validator/package.json | 46 + appasar/canary/node_modules/hawk/.npmignore | 5 + appasar/canary/node_modules/hawk/LICENSE | 28 + appasar/canary/node_modules/hawk/README.md | 637 + appasar/canary/node_modules/hawk/client.js | 3 + .../canary/node_modules/hawk/dist/browser.js | 793 + .../canary/node_modules/hawk/lib/browser.js | 653 + .../canary/node_modules/hawk/lib/client.js | 394 + .../canary/node_modules/hawk/lib/crypto.js | 128 + appasar/canary/node_modules/hawk/lib/index.js | 17 + .../canary/node_modules/hawk/lib/server.js | 550 + appasar/canary/node_modules/hawk/lib/utils.js | 186 + appasar/canary/node_modules/hawk/package.json | 42 + appasar/canary/node_modules/hoek/.npmignore | 3 + appasar/canary/node_modules/hoek/LICENSE | 32 + appasar/canary/node_modules/hoek/README.md | 30 + .../canary/node_modules/hoek/lib/escape.js | 168 + appasar/canary/node_modules/hoek/lib/index.js | 978 + appasar/canary/node_modules/hoek/package.json | 23 + .../http-signature/.dir-locals.el | 6 + .../node_modules/http-signature/.npmignore | 7 + .../node_modules/http-signature/CHANGES.md | 46 + .../node_modules/http-signature/LICENSE | 18 + .../node_modules/http-signature/README.md | 79 + .../http-signature/http_signing.md | 363 + .../node_modules/http-signature/lib/index.js | 29 + .../node_modules/http-signature/lib/parser.js | 315 + .../node_modules/http-signature/lib/signer.js | 401 + .../node_modules/http-signature/lib/utils.js | 112 + .../node_modules/http-signature/lib/verify.js | 88 + .../node_modules/.bin/sshpk-conv | 1 + .../node_modules/.bin/sshpk-sign | 1 + .../node_modules/.bin/sshpk-verify | 1 + .../node_modules/http-signature/package.json | 39 + appasar/canary/node_modules/inflight/LICENSE | 15 + .../canary/node_modules/inflight/README.md | 37 + .../canary/node_modules/inflight/inflight.js | 54 + .../canary/node_modules/inflight/package.json | 29 + appasar/canary/node_modules/inherits/LICENSE | 16 + .../canary/node_modules/inherits/README.md | 42 + .../canary/node_modules/inherits/inherits.js | 7 + .../node_modules/inherits/inherits_browser.js | 23 + .../canary/node_modules/inherits/package.json | 29 + .../node_modules/is-typedarray/LICENSE.md | 18 + .../node_modules/is-typedarray/README.md | 16 + .../node_modules/is-typedarray/index.js | 41 + .../node_modules/is-typedarray/package.json | 30 + .../canary/node_modules/is-typedarray/test.js | 34 + .../canary/node_modules/isstream/.jshintrc | 59 + .../canary/node_modules/isstream/.npmignore | 1 + .../canary/node_modules/isstream/.travis.yml | 12 + .../canary/node_modules/isstream/LICENSE.md | 11 + .../canary/node_modules/isstream/README.md | 66 + .../canary/node_modules/isstream/isstream.js | 27 + .../canary/node_modules/isstream/package.json | 33 + appasar/canary/node_modules/isstream/test.js | 168 + appasar/canary/node_modules/jsbn/.npmignore | 2 + appasar/canary/node_modules/jsbn/LICENSE | 40 + appasar/canary/node_modules/jsbn/README.md | 175 + appasar/canary/node_modules/jsbn/example.html | 12 + appasar/canary/node_modules/jsbn/example.js | 3 + appasar/canary/node_modules/jsbn/index.js | 1357 + appasar/canary/node_modules/jsbn/package.json | 21 + .../json-schema-traverse/.eslintrc.yml | 27 + .../json-schema-traverse/.npmignore | 60 + .../json-schema-traverse/.travis.yml | 8 + .../node_modules/json-schema-traverse/LICENSE | 21 + .../json-schema-traverse/README.md | 69 + .../json-schema-traverse/index.js | 81 + .../json-schema-traverse/package.json | 43 + .../json-schema-traverse/spec/.eslintrc.yml | 6 + .../spec/fixtures/schema.js | 125 + .../json-schema-traverse/spec/index.spec.js | 102 + .../canary/node_modules/json-schema/README.md | 5 + .../json-schema/draft-00/hyper-schema | 68 + .../json-schema/draft-00/json-ref | 26 + .../node_modules/json-schema/draft-00/links | 33 + .../node_modules/json-schema/draft-00/schema | 155 + .../json-schema/draft-01/hyper-schema | 68 + .../json-schema/draft-01/json-ref | 26 + .../node_modules/json-schema/draft-01/links | 33 + .../node_modules/json-schema/draft-01/schema | 155 + .../json-schema/draft-02/hyper-schema | 68 + .../json-schema/draft-02/json-ref | 26 + .../node_modules/json-schema/draft-02/links | 35 + .../node_modules/json-schema/draft-02/schema | 166 + .../json-schema/draft-03/examples/address | 20 + .../json-schema/draft-03/examples/calendar | 53 + .../json-schema/draft-03/examples/card | 105 + .../json-schema/draft-03/examples/geo | 8 + .../json-schema/draft-03/examples/interfaces | 23 + .../json-schema/draft-03/hyper-schema | 60 + .../json-schema/draft-03/json-ref | 26 + .../node_modules/json-schema/draft-03/links | 35 + .../node_modules/json-schema/draft-03/schema | 174 + .../json-schema/draft-04/hyper-schema | 60 + .../node_modules/json-schema/draft-04/links | 41 + .../node_modules/json-schema/draft-04/schema | 189 + .../json-schema/draft-zyp-json-schema-03.xml | 1120 + .../json-schema/draft-zyp-json-schema-04.xml | 1072 + .../node_modules/json-schema/lib/links.js | 66 + .../node_modules/json-schema/lib/validate.js | 273 + .../node_modules/json-schema/package.json | 31 + .../node_modules/json-schema/test/tests.js | 95 + .../json-stringify-safe/.npmignore | 1 + .../json-stringify-safe/CHANGELOG.md | 14 + .../node_modules/json-stringify-safe/LICENSE | 15 + .../node_modules/json-stringify-safe/Makefile | 35 + .../json-stringify-safe/README.md | 52 + .../json-stringify-safe/package.json | 31 + .../json-stringify-safe/stringify.js | 27 + .../json-stringify-safe/test/mocha.opts | 2 + .../test/stringify_test.js | 246 + appasar/canary/node_modules/jsprim/CHANGES.md | 49 + .../node_modules/jsprim/CONTRIBUTING.md | 19 + appasar/canary/node_modules/jsprim/LICENSE | 19 + appasar/canary/node_modules/jsprim/README.md | 287 + .../canary/node_modules/jsprim/lib/jsprim.js | 735 + .../canary/node_modules/jsprim/package.json | 20 + .../canary/node_modules/mime-db/HISTORY.md | 368 + appasar/canary/node_modules/mime-db/LICENSE | 22 + appasar/canary/node_modules/mime-db/README.md | 94 + appasar/canary/node_modules/mime-db/db.json | 7088 +++++ appasar/canary/node_modules/mime-db/index.js | 11 + .../canary/node_modules/mime-db/package.json | 57 + .../canary/node_modules/mime-types/HISTORY.md | 260 + .../canary/node_modules/mime-types/LICENSE | 23 + .../canary/node_modules/mime-types/README.md | 108 + .../canary/node_modules/mime-types/index.js | 188 + .../node_modules/mime-types/package.json | 43 + appasar/canary/node_modules/minimatch/LICENSE | 15 + .../canary/node_modules/minimatch/README.md | 209 + .../node_modules/minimatch/minimatch.js | 923 + .../node_modules/minimatch/package.json | 30 + .../canary/node_modules/minimist/.travis.yml | 4 + appasar/canary/node_modules/minimist/LICENSE | 18 + .../node_modules/minimist/example/parse.js | 2 + appasar/canary/node_modules/minimist/index.js | 187 + .../canary/node_modules/minimist/package.json | 40 + .../node_modules/minimist/readme.markdown | 73 + .../canary/node_modules/minimist/test/dash.js | 24 + .../minimist/test/default_bool.js | 20 + .../node_modules/minimist/test/dotted.js | 16 + .../canary/node_modules/minimist/test/long.js | 31 + .../node_modules/minimist/test/parse.js | 318 + .../minimist/test/parse_modified.js | 9 + .../node_modules/minimist/test/short.js | 67 + .../node_modules/minimist/test/whitespace.js | 8 + .../canary/node_modules/mkdirp/.travis.yml | 8 + appasar/canary/node_modules/mkdirp/LICENSE | 21 + appasar/canary/node_modules/mkdirp/bin/cmd.js | 33 + .../canary/node_modules/mkdirp/bin/usage.txt | 12 + .../node_modules/mkdirp/examples/pow.js | 6 + appasar/canary/node_modules/mkdirp/index.js | 98 + .../canary/node_modules/mkdirp/package.json | 27 + .../node_modules/mkdirp/readme.markdown | 100 + .../canary/node_modules/mkdirp/test/chmod.js | 41 + .../node_modules/mkdirp/test/clobber.js | 38 + .../canary/node_modules/mkdirp/test/mkdirp.js | 28 + .../node_modules/mkdirp/test/opts_fs.js | 29 + .../node_modules/mkdirp/test/opts_fs_sync.js | 27 + .../canary/node_modules/mkdirp/test/perm.js | 32 + .../node_modules/mkdirp/test/perm_sync.js | 36 + .../canary/node_modules/mkdirp/test/race.js | 37 + .../canary/node_modules/mkdirp/test/rel.js | 32 + .../canary/node_modules/mkdirp/test/return.js | 25 + .../node_modules/mkdirp/test/return_sync.js | 24 + .../canary/node_modules/mkdirp/test/root.js | 19 + .../canary/node_modules/mkdirp/test/sync.js | 32 + .../canary/node_modules/mkdirp/test/umask.js | 28 + .../node_modules/mkdirp/test/umask_sync.js | 32 + .../canary/node_modules/oauth-sign/LICENSE | 55 + .../canary/node_modules/oauth-sign/README.md | 4 + .../canary/node_modules/oauth-sign/index.js | 136 + .../node_modules/oauth-sign/package.json | 23 + appasar/canary/node_modules/once/LICENSE | 15 + appasar/canary/node_modules/once/README.md | 79 + appasar/canary/node_modules/once/once.js | 42 + appasar/canary/node_modules/once/package.json | 33 + .../node_modules/path-is-absolute/index.js | 20 + .../node_modules/path-is-absolute/license | 21 + .../path-is-absolute/package.json | 43 + .../node_modules/path-is-absolute/readme.md | 59 + appasar/canary/node_modules/pend/LICENSE | 23 + appasar/canary/node_modules/pend/README.md | 41 + appasar/canary/node_modules/pend/index.js | 55 + appasar/canary/node_modules/pend/package.json | 18 + appasar/canary/node_modules/pend/test.js | 137 + .../node_modules/performance-now/.npmignore | 1 + .../performance-now/.tm_properties | 7 + .../node_modules/performance-now/.travis.yml | 6 + .../node_modules/performance-now/README.md | 30 + .../performance-now/lib/performance-now.js | 36 + .../lib/performance-now.js.map | 10 + .../node_modules/performance-now/license.txt | 7 + .../node_modules/performance-now/package.json | 35 + .../performance-now/src/index.d.ts | 8 + .../src/performance-now.coffee | 17 + .../performance-now/test/mocha.opts | 3 + .../test/performance-now.coffee | 43 + .../performance-now/test/scripts.coffee | 27 + .../test/scripts/delayed-call.coffee | 11 + .../test/scripts/delayed-require.coffee | 12 + .../test/scripts/difference.coffee | 6 + .../test/scripts/initial-value.coffee | 10 + .../node_modules/punycode/LICENSE-MIT.txt | 20 + .../canary/node_modules/punycode/README.md | 176 + .../canary/node_modules/punycode/package.json | 60 + .../canary/node_modules/punycode/punycode.js | 533 + appasar/canary/node_modules/qs/.editorconfig | 30 + appasar/canary/node_modules/qs/.eslintignore | 1 + appasar/canary/node_modules/qs/.eslintrc | 19 + appasar/canary/node_modules/qs/CHANGELOG.md | 221 + appasar/canary/node_modules/qs/LICENSE | 28 + appasar/canary/node_modules/qs/README.md | 475 + appasar/canary/node_modules/qs/dist/qs.js | 627 + appasar/canary/node_modules/qs/lib/formats.js | 18 + appasar/canary/node_modules/qs/lib/index.js | 11 + appasar/canary/node_modules/qs/lib/parse.js | 174 + .../canary/node_modules/qs/lib/stringify.js | 210 + appasar/canary/node_modules/qs/lib/utils.js | 202 + appasar/canary/node_modules/qs/package.json | 51 + appasar/canary/node_modules/qs/test/.eslintrc | 15 + appasar/canary/node_modules/qs/test/index.js | 7 + appasar/canary/node_modules/qs/test/parse.js | 573 + .../canary/node_modules/qs/test/stringify.js | 596 + appasar/canary/node_modules/qs/test/utils.js | 34 + .../canary/node_modules/request/CHANGELOG.md | 674 + appasar/canary/node_modules/request/LICENSE | 55 + appasar/canary/node_modules/request/README.md | 1097 + appasar/canary/node_modules/request/index.js | 155 + .../canary/node_modules/request/lib/auth.js | 167 + .../node_modules/request/lib/cookies.js | 38 + .../request/lib/getProxyFromURI.js | 79 + .../canary/node_modules/request/lib/har.js | 205 + .../node_modules/request/lib/helpers.js | 66 + .../node_modules/request/lib/multipart.js | 112 + .../canary/node_modules/request/lib/oauth.js | 148 + .../node_modules/request/lib/querystring.js | 50 + .../node_modules/request/lib/redirect.js | 154 + .../canary/node_modules/request/lib/tunnel.js | 175 + .../request/node_modules/.bin/uuid | 1 + .../canary/node_modules/request/package.json | 88 + .../canary/node_modules/request/request.js | 1552 + appasar/canary/node_modules/rimraf/LICENSE | 15 + appasar/canary/node_modules/rimraf/README.md | 101 + appasar/canary/node_modules/rimraf/bin.js | 50 + .../canary/node_modules/rimraf/package.json | 26 + appasar/canary/node_modules/rimraf/rimraf.js | 364 + .../node_modules/safe-buffer/.travis.yml | 7 + .../canary/node_modules/safe-buffer/LICENSE | 21 + .../canary/node_modules/safe-buffer/README.md | 584 + .../canary/node_modules/safe-buffer/index.js | 62 + .../node_modules/safe-buffer/package.json | 37 + .../canary/node_modules/safe-buffer/test.js | 101 + appasar/canary/node_modules/sntp/.npmignore | 3 + appasar/canary/node_modules/sntp/LICENSE | 28 + appasar/canary/node_modules/sntp/README.md | 68 + appasar/canary/node_modules/sntp/lib/index.js | 412 + appasar/canary/node_modules/sntp/package.json | 31 + appasar/canary/node_modules/sshpk/.npmignore | 9 + appasar/canary/node_modules/sshpk/.travis.yml | 11 + appasar/canary/node_modules/sshpk/LICENSE | 18 + appasar/canary/node_modules/sshpk/README.md | 698 + .../canary/node_modules/sshpk/bin/sshpk-conv | 201 + .../canary/node_modules/sshpk/bin/sshpk-sign | 191 + .../node_modules/sshpk/bin/sshpk-verify | 166 + appasar/canary/node_modules/sshpk/lib/algs.js | 168 + .../node_modules/sshpk/lib/certificate.js | 377 + appasar/canary/node_modules/sshpk/lib/dhe.js | 411 + .../node_modules/sshpk/lib/ed-compat.js | 96 + .../canary/node_modules/sshpk/lib/errors.js | 84 + .../node_modules/sshpk/lib/fingerprint.js | 161 + .../node_modules/sshpk/lib/formats/auto.js | 73 + .../sshpk/lib/formats/openssh-cert.js | 322 + .../node_modules/sshpk/lib/formats/pem.js | 186 + .../node_modules/sshpk/lib/formats/pkcs1.js | 320 + .../node_modules/sshpk/lib/formats/pkcs8.js | 505 + .../node_modules/sshpk/lib/formats/rfc4253.js | 146 + .../sshpk/lib/formats/ssh-private.js | 261 + .../node_modules/sshpk/lib/formats/ssh.js | 114 + .../sshpk/lib/formats/x509-pem.js | 77 + .../node_modules/sshpk/lib/formats/x509.js | 726 + .../canary/node_modules/sshpk/lib/identity.js | 277 + .../canary/node_modules/sshpk/lib/index.js | 39 + appasar/canary/node_modules/sshpk/lib/key.js | 274 + .../node_modules/sshpk/lib/private-key.js | 254 + .../node_modules/sshpk/lib/signature.js | 313 + .../node_modules/sshpk/lib/ssh-buffer.js | 148 + .../canary/node_modules/sshpk/lib/utils.js | 288 + .../node_modules/sshpk/man/man1/sshpk-conv.1 | 135 + .../node_modules/sshpk/man/man1/sshpk-sign.1 | 81 + .../sshpk/man/man1/sshpk-verify.1 | 68 + .../canary/node_modules/sshpk/package.json | 59 + .../node_modules/stringstream/.npmignore | 15 + .../node_modules/stringstream/.travis.yml | 4 + .../node_modules/stringstream/LICENSE.txt | 22 + .../node_modules/stringstream/README.md | 38 + .../node_modules/stringstream/example.js | 27 + .../node_modules/stringstream/package.json | 18 + .../node_modules/stringstream/stringstream.js | 102 + .../canary/node_modules/tough-cookie/LICENSE | 27 + .../node_modules/tough-cookie/README.md | 509 + .../node_modules/tough-cookie/lib/cookie.js | 1426 + .../node_modules/tough-cookie/lib/memstore.js | 170 + .../tough-cookie/lib/pathMatch.js | 61 + .../tough-cookie/lib/permuteDomain.js | 56 + .../tough-cookie/lib/pubsuffix.js | 98 + .../node_modules/tough-cookie/lib/store.js | 71 + .../node_modules/tough-cookie/package.json | 74 + .../canary/node_modules/tunnel-agent/LICENSE | 55 + .../node_modules/tunnel-agent/README.md | 4 + .../canary/node_modules/tunnel-agent/index.js | 244 + .../node_modules/tunnel-agent/package.json | 22 + .../canary/node_modules/tweetnacl/.npmignore | 4 + .../canary/node_modules/tweetnacl/AUTHORS.md | 28 + .../node_modules/tweetnacl/CHANGELOG.md | 221 + appasar/canary/node_modules/tweetnacl/LICENSE | 24 + .../tweetnacl/PULL_REQUEST_TEMPLATE.md | 20 + .../canary/node_modules/tweetnacl/README.md | 459 + .../node_modules/tweetnacl/nacl-fast.js | 2388 ++ .../node_modules/tweetnacl/nacl-fast.min.js | 2 + .../canary/node_modules/tweetnacl/nacl.d.ts | 98 + appasar/canary/node_modules/tweetnacl/nacl.js | 1175 + .../canary/node_modules/tweetnacl/nacl.min.js | 1 + .../node_modules/tweetnacl/package.json | 58 + .../canary/node_modules/uuid/.eslintrc.json | 47 + appasar/canary/node_modules/uuid/AUTHORS | 5 + appasar/canary/node_modules/uuid/CHANGELOG.md | 57 + appasar/canary/node_modules/uuid/LICENSE.md | 21 + appasar/canary/node_modules/uuid/README.md | 293 + appasar/canary/node_modules/uuid/README_js.md | 280 + appasar/canary/node_modules/uuid/bin/uuid | 65 + appasar/canary/node_modules/uuid/index.js | 8 + .../node_modules/uuid/lib/bytesToUuid.js | 23 + .../node_modules/uuid/lib/md5-browser.js | 216 + appasar/canary/node_modules/uuid/lib/md5.js | 25 + .../node_modules/uuid/lib/rng-browser.js | 32 + appasar/canary/node_modules/uuid/lib/rng.js | 8 + .../node_modules/uuid/lib/sha1-browser.js | 89 + appasar/canary/node_modules/uuid/lib/sha1.js | 25 + appasar/canary/node_modules/uuid/lib/v35.js | 53 + appasar/canary/node_modules/uuid/package.json | 36 + appasar/canary/node_modules/uuid/v1.js | 109 + appasar/canary/node_modules/uuid/v3.js | 4 + appasar/canary/node_modules/uuid/v4.js | 29 + appasar/canary/node_modules/uuid/v5.js | 3 + appasar/canary/node_modules/verror/.npmignore | 9 + appasar/canary/node_modules/verror/CHANGES.md | 28 + .../node_modules/verror/CONTRIBUTING.md | 19 + appasar/canary/node_modules/verror/LICENSE | 19 + appasar/canary/node_modules/verror/README.md | 528 + .../canary/node_modules/verror/lib/verror.js | 451 + .../node_modules/extsprintf/.gitmodules | 3 + .../verror/node_modules/extsprintf/.npmignore | 2 + .../verror/node_modules/extsprintf/CHANGES.md | 10 + .../node_modules/extsprintf/CONTRIBUTING.md | 20 + .../verror/node_modules/extsprintf/LICENSE | 19 + .../verror/node_modules/extsprintf/Makefile | 30 + .../node_modules/extsprintf/Makefile.targ | 285 + .../verror/node_modules/extsprintf/README.md | 46 + .../node_modules/extsprintf/jsl.node.conf | 137 + .../node_modules/extsprintf/lib/extsprintf.js | 225 + .../node_modules/extsprintf/package.json | 14 + .../node_modules/extsprintf/test/tst.basic.js | 118 + .../extsprintf/test/tst.invalid.js | 78 + .../canary/node_modules/verror/package.json | 22 + appasar/canary/node_modules/wrappy/LICENSE | 15 + appasar/canary/node_modules/wrappy/README.md | 36 + .../canary/node_modules/wrappy/package.json | 29 + appasar/canary/node_modules/wrappy/wrappy.js | 33 + appasar/canary/node_modules/yauzl/LICENSE | 21 + appasar/canary/node_modules/yauzl/README.md | 633 + appasar/canary/node_modules/yauzl/index.js | 775 + .../canary/node_modules/yauzl/package.json | 40 + appasar/canary/package.json | 15 + electronasar/canary/browser/api/app.js | 117 + .../canary/browser/api/auto-updater.js | 7 + .../api/auto-updater/auto-updater-native.js | 10 + .../api/auto-updater/auto-updater-win.js | 74 + .../api/auto-updater/squirrel-update-win.js | 119 + .../canary/browser/api/browser-view.js | 16 + .../canary/browser/api/browser-window.js | 256 + .../canary/browser/api/content-tracing.js | 3 + .../canary/browser/api/crash-reporter.js | 14 + electronasar/canary/browser/api/dialog.js | 311 + .../canary/browser/api/exports/electron.js | 15 + .../canary/browser/api/global-shortcut.js | 3 + .../canary/browser/api/in-app-purchase.js | 20 + electronasar/canary/browser/api/ipc-main.js | 10 + .../canary/browser/api/menu-item-roles.js | 296 + electronasar/canary/browser/api/menu-item.js | 85 + electronasar/canary/browser/api/menu-utils.js | 176 + electronasar/canary/browser/api/menu.js | 258 + .../canary/browser/api/module-list.js | 46 + .../browser/api/navigation-controller.js | 171 + electronasar/canary/browser/api/net-log.js | 28 + electronasar/canary/browser/api/net.js | 372 + .../canary/browser/api/notification.js | 10 + .../canary/browser/api/power-monitor.js | 25 + .../canary/browser/api/power-save-blocker.js | 3 + electronasar/canary/browser/api/protocol.js | 29 + electronasar/canary/browser/api/screen.js | 10 + electronasar/canary/browser/api/session.js | 24 + .../canary/browser/api/system-preferences.js | 10 + .../canary/browser/api/top-level-window.js | 24 + electronasar/canary/browser/api/touch-bar.js | 343 + electronasar/canary/browser/api/tray.js | 8 + electronasar/canary/browser/api/view.js | 11 + .../canary/browser/api/web-contents-view.js | 15 + .../canary/browser/api/web-contents.js | 420 + .../canary/browser/chrome-extension.js | 435 + .../canary/browser/desktop-capturer.js | 73 + .../canary/browser/guest-view-manager.js | 420 + .../canary/browser/guest-window-manager.js | 353 + electronasar/canary/browser/init.js | 188 + .../canary/browser/ipc-main-internal.js | 10 + .../canary/browser/objects-registry.js | 116 + electronasar/canary/browser/rpc-server.js | 512 + electronasar/canary/common/api/clipboard.js | 31 + electronasar/canary/common/api/deprecate.js | 95 + .../canary/common/api/deprecations.js | 11 + .../canary/common/api/exports/electron.js | 31 + electronasar/canary/common/api/is-promise.js | 14 + electronasar/canary/common/api/module-list.js | 12 + .../canary/common/api/native-image.js | 3 + electronasar/canary/common/api/shell.js | 3 + .../canary/common/atom-binding-setup.js | 15 + electronasar/canary/common/buffer-utils.js | 66 + electronasar/canary/common/crash-reporter.js | 123 + electronasar/canary/common/error-utils.js | 39 + electronasar/canary/common/init.js | 53 + .../canary/common/parse-features-string.js | 21 + .../canary/common/reset-search-paths.js | 45 + .../canary/renderer/api/crash-reporter.js | 12 + .../canary/renderer/api/desktop-capturer.js | 48 + .../canary/renderer/api/exports/electron.js | 23 + .../canary/renderer/api/ipc-renderer.js | 30 + .../canary/renderer/api/module-list.js | 21 + electronasar/canary/renderer/api/remote.js | 355 + electronasar/canary/renderer/api/screen.js | 4 + electronasar/canary/renderer/api/web-frame.js | 13 + .../canary/renderer/callbacks-registry.js | 59 + electronasar/canary/renderer/chrome-api.js | 194 + .../renderer/content-scripts-injector.js | 101 + .../canary/renderer/extensions/event.js | 26 + .../canary/renderer/extensions/i18n.js | 88 + .../canary/renderer/extensions/storage.js | 138 + .../renderer/extensions/web-navigation.js | 23 + electronasar/canary/renderer/init.js | 176 + electronasar/canary/renderer/inspector.js | 138 + .../canary/renderer/ipc-renderer-internal.js | 26 + electronasar/canary/renderer/override.js | 18 + electronasar/canary/renderer/remote.js | 10 + .../canary/renderer/security-warnings.js | 336 + .../canary/renderer/web-frame-init.js | 24 + .../renderer/web-view/guest-view-internal.js | 108 + .../renderer/web-view/web-view-attributes.js | 281 + .../renderer/web-view/web-view-constants.js | 28 + .../canary/renderer/web-view/web-view.js | 381 + electronasar/canary/renderer/window-setup.js | 201 + electronasar/canary/worker/init.js | 37 + 832 files changed, 135836 insertions(+) create mode 100644 appasar/canary/app_bootstrap/Constants.js create mode 100644 appasar/canary/app_bootstrap/GPUSettings.js create mode 100644 appasar/canary/app_bootstrap/appSettings.js create mode 100644 appasar/canary/app_bootstrap/appUpdater.js create mode 100644 appasar/canary/app_bootstrap/autoStart/darwin.js create mode 100644 appasar/canary/app_bootstrap/autoStart/index.js create mode 100644 appasar/canary/app_bootstrap/autoStart/linux.js create mode 100644 appasar/canary/app_bootstrap/autoStart/win32.js create mode 100644 appasar/canary/app_bootstrap/bootstrap.js create mode 100644 appasar/canary/app_bootstrap/buildInfo.js create mode 100644 appasar/canary/app_bootstrap/data/quotes_copy.json create mode 100644 appasar/canary/app_bootstrap/errorHandler.js create mode 100644 appasar/canary/app_bootstrap/hostUpdater.js create mode 100644 appasar/canary/app_bootstrap/images/img_lucky_dice.png create mode 100644 appasar/canary/app_bootstrap/index.js create mode 100644 appasar/canary/app_bootstrap/installDevTools.js create mode 100644 appasar/canary/app_bootstrap/ipcMain.js create mode 100644 appasar/canary/app_bootstrap/request.js create mode 100644 appasar/canary/app_bootstrap/requireNative.js create mode 100644 appasar/canary/app_bootstrap/singleInstance.js create mode 100644 appasar/canary/app_bootstrap/splash/a934ab008c7f6a2274ec441f6be0696a.woff create mode 100644 appasar/canary/app_bootstrap/splash/abddffb32a4a35627c3857a06c751424.png create mode 100644 appasar/canary/app_bootstrap/splash/d153359b5d87601d2b9c708b7ae2db02.woff create mode 100644 appasar/canary/app_bootstrap/splash/index.html create mode 100644 appasar/canary/app_bootstrap/splash/index.js create mode 100644 appasar/canary/app_bootstrap/splash/variables.json create mode 100644 appasar/canary/app_bootstrap/splashScreen.js create mode 100644 appasar/canary/app_bootstrap/squirrelUpdate.js create mode 100644 appasar/canary/app_bootstrap/startupMenu/darwin.js create mode 100644 appasar/canary/app_bootstrap/startupMenu/index.js create mode 100644 appasar/canary/app_bootstrap/startupMenu/linux.js create mode 100644 appasar/canary/app_bootstrap/startupMenu/win32.js create mode 100644 appasar/canary/app_bootstrap/videos/connecting.webm create mode 100644 appasar/canary/app_bootstrap/windowsUtils.js create mode 100644 appasar/canary/common/Backoff.js create mode 100644 appasar/canary/common/FeatureFlags.js create mode 100644 appasar/canary/common/Settings.js create mode 100644 appasar/canary/common/moduleUpdater.js create mode 100644 appasar/canary/common/paths.js create mode 120000 appasar/canary/node_modules/.bin/mkdirp create mode 120000 appasar/canary/node_modules/.bin/rimraf create mode 120000 appasar/canary/node_modules/.bin/sshpk-conv create mode 120000 appasar/canary/node_modules/.bin/sshpk-sign create mode 120000 appasar/canary/node_modules/.bin/sshpk-verify create mode 120000 appasar/canary/node_modules/.bin/uuid create mode 100644 appasar/canary/node_modules/.yarn-integrity create mode 100644 appasar/canary/node_modules/ajv/.tonic_example.js create mode 100644 appasar/canary/node_modules/ajv/LICENSE create mode 100644 appasar/canary/node_modules/ajv/README.md create mode 100644 appasar/canary/node_modules/ajv/dist/ajv.bundle.js create mode 100644 appasar/canary/node_modules/ajv/dist/ajv.min.js create mode 100644 appasar/canary/node_modules/ajv/dist/ajv.min.js.map create mode 100644 appasar/canary/node_modules/ajv/dist/nodent.min.js create mode 100644 appasar/canary/node_modules/ajv/dist/regenerator.min.js create mode 100644 appasar/canary/node_modules/ajv/lib/$data.js create mode 100644 appasar/canary/node_modules/ajv/lib/ajv.d.ts create mode 100644 appasar/canary/node_modules/ajv/lib/ajv.js create mode 100644 appasar/canary/node_modules/ajv/lib/cache.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/_rules.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/async.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/equal.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/error_classes.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/formats.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/index.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/resolve.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/rules.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/schema_obj.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/ucs2length.js create mode 100644 appasar/canary/node_modules/ajv/lib/compile/util.js create mode 100644 appasar/canary/node_modules/ajv/lib/dot/_limit.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/_limitItems.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/_limitLength.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/_limitProperties.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/allOf.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/anyOf.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/coerce.def create mode 100644 appasar/canary/node_modules/ajv/lib/dot/const.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/contains.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/custom.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/defaults.def create mode 100644 appasar/canary/node_modules/ajv/lib/dot/definitions.def create mode 100644 appasar/canary/node_modules/ajv/lib/dot/dependencies.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/enum.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/errors.def create mode 100644 appasar/canary/node_modules/ajv/lib/dot/format.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/items.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/missing.def create mode 100644 appasar/canary/node_modules/ajv/lib/dot/multipleOf.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/not.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/oneOf.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/pattern.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/properties.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/propertyNames.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/ref.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/required.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/uniqueItems.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dot/validate.jst create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/README.md create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/_limit.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/_limitItems.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/_limitLength.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/_limitProperties.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/allOf.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/anyOf.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/const.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/contains.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/custom.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/dependencies.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/enum.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/format.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/items.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/multipleOf.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/not.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/oneOf.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/pattern.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/properties.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/propertyNames.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/ref.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/required.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/uniqueItems.js create mode 100644 appasar/canary/node_modules/ajv/lib/dotjs/validate.js create mode 100644 appasar/canary/node_modules/ajv/lib/keyword.js create mode 100644 appasar/canary/node_modules/ajv/lib/patternGroups.js create mode 100644 appasar/canary/node_modules/ajv/lib/refs/$data.json create mode 100644 appasar/canary/node_modules/ajv/lib/refs/json-schema-draft-04.json create mode 100644 appasar/canary/node_modules/ajv/lib/refs/json-schema-draft-06.json create mode 100644 appasar/canary/node_modules/ajv/lib/refs/json-schema-v5.json create mode 100644 appasar/canary/node_modules/ajv/package.json create mode 100644 appasar/canary/node_modules/ajv/scripts/.eslintrc.yml create mode 100644 appasar/canary/node_modules/ajv/scripts/bundle.js create mode 100644 appasar/canary/node_modules/ajv/scripts/compile-dots.js create mode 100644 appasar/canary/node_modules/ajv/scripts/info create mode 100644 appasar/canary/node_modules/ajv/scripts/prepare-tests create mode 100644 appasar/canary/node_modules/ajv/scripts/travis-gh-pages create mode 100644 appasar/canary/node_modules/asn1/.npmignore create mode 100644 appasar/canary/node_modules/asn1/.travis.yml create mode 100644 appasar/canary/node_modules/asn1/LICENSE create mode 100644 appasar/canary/node_modules/asn1/README.md create mode 100644 appasar/canary/node_modules/asn1/lib/ber/errors.js create mode 100644 appasar/canary/node_modules/asn1/lib/ber/index.js create mode 100644 appasar/canary/node_modules/asn1/lib/ber/reader.js create mode 100644 appasar/canary/node_modules/asn1/lib/ber/types.js create mode 100644 appasar/canary/node_modules/asn1/lib/ber/writer.js create mode 100644 appasar/canary/node_modules/asn1/lib/index.js create mode 100644 appasar/canary/node_modules/asn1/package.json create mode 100644 appasar/canary/node_modules/asn1/tst/ber/reader.test.js create mode 100644 appasar/canary/node_modules/asn1/tst/ber/writer.test.js create mode 100644 appasar/canary/node_modules/assert-plus/AUTHORS create mode 100644 appasar/canary/node_modules/assert-plus/CHANGES.md create mode 100644 appasar/canary/node_modules/assert-plus/README.md create mode 100644 appasar/canary/node_modules/assert-plus/assert.js create mode 100644 appasar/canary/node_modules/assert-plus/package.json create mode 100644 appasar/canary/node_modules/asynckit/LICENSE create mode 100644 appasar/canary/node_modules/asynckit/README.md create mode 100644 appasar/canary/node_modules/asynckit/bench.js create mode 100644 appasar/canary/node_modules/asynckit/index.js create mode 100644 appasar/canary/node_modules/asynckit/lib/abort.js create mode 100644 appasar/canary/node_modules/asynckit/lib/async.js create mode 100644 appasar/canary/node_modules/asynckit/lib/defer.js create mode 100644 appasar/canary/node_modules/asynckit/lib/iterate.js create mode 100644 appasar/canary/node_modules/asynckit/lib/readable_asynckit.js create mode 100644 appasar/canary/node_modules/asynckit/lib/readable_parallel.js create mode 100644 appasar/canary/node_modules/asynckit/lib/readable_serial.js create mode 100644 appasar/canary/node_modules/asynckit/lib/readable_serial_ordered.js create mode 100644 appasar/canary/node_modules/asynckit/lib/state.js create mode 100644 appasar/canary/node_modules/asynckit/lib/streamify.js create mode 100644 appasar/canary/node_modules/asynckit/lib/terminator.js create mode 100644 appasar/canary/node_modules/asynckit/package.json create mode 100644 appasar/canary/node_modules/asynckit/parallel.js create mode 100644 appasar/canary/node_modules/asynckit/serial.js create mode 100644 appasar/canary/node_modules/asynckit/serialOrdered.js create mode 100644 appasar/canary/node_modules/asynckit/stream.js create mode 100644 appasar/canary/node_modules/aws-sign2/LICENSE create mode 100644 appasar/canary/node_modules/aws-sign2/README.md create mode 100644 appasar/canary/node_modules/aws-sign2/index.js create mode 100644 appasar/canary/node_modules/aws-sign2/package.json create mode 100644 appasar/canary/node_modules/aws4/.npmignore create mode 100644 appasar/canary/node_modules/aws4/.tern-port create mode 100644 appasar/canary/node_modules/aws4/.travis.yml create mode 100644 appasar/canary/node_modules/aws4/LICENSE create mode 100644 appasar/canary/node_modules/aws4/README.md create mode 100644 appasar/canary/node_modules/aws4/aws4.js create mode 100644 appasar/canary/node_modules/aws4/lru.js create mode 100644 appasar/canary/node_modules/aws4/package.json create mode 100644 appasar/canary/node_modules/balanced-match/.npmignore create mode 100644 appasar/canary/node_modules/balanced-match/LICENSE.md create mode 100644 appasar/canary/node_modules/balanced-match/README.md create mode 100644 appasar/canary/node_modules/balanced-match/index.js create mode 100644 appasar/canary/node_modules/balanced-match/package.json create mode 100644 appasar/canary/node_modules/bcrypt-pbkdf/README.md create mode 100644 appasar/canary/node_modules/bcrypt-pbkdf/index.js create mode 100644 appasar/canary/node_modules/bcrypt-pbkdf/package.json create mode 100644 appasar/canary/node_modules/boom/LICENSE create mode 100644 appasar/canary/node_modules/boom/README.md create mode 100644 appasar/canary/node_modules/boom/lib/index.js create mode 100644 appasar/canary/node_modules/boom/package.json create mode 100644 appasar/canary/node_modules/brace-expansion/README.md create mode 100644 appasar/canary/node_modules/brace-expansion/index.js create mode 100644 appasar/canary/node_modules/brace-expansion/package.json create mode 100644 appasar/canary/node_modules/buffer-crc32/LICENSE create mode 100644 appasar/canary/node_modules/buffer-crc32/README.md create mode 100644 appasar/canary/node_modules/buffer-crc32/index.js create mode 100644 appasar/canary/node_modules/buffer-crc32/package.json create mode 100644 appasar/canary/node_modules/caseless/LICENSE create mode 100644 appasar/canary/node_modules/caseless/README.md create mode 100644 appasar/canary/node_modules/caseless/index.js create mode 100644 appasar/canary/node_modules/caseless/package.json create mode 100644 appasar/canary/node_modules/caseless/test.js create mode 100644 appasar/canary/node_modules/co/History.md create mode 100644 appasar/canary/node_modules/co/LICENSE create mode 100644 appasar/canary/node_modules/co/Readme.md create mode 100644 appasar/canary/node_modules/co/index.js create mode 100644 appasar/canary/node_modules/co/package.json create mode 100644 appasar/canary/node_modules/combined-stream/License create mode 100644 appasar/canary/node_modules/combined-stream/Readme.md create mode 100644 appasar/canary/node_modules/combined-stream/lib/combined_stream.js create mode 100644 appasar/canary/node_modules/combined-stream/package.json create mode 100644 appasar/canary/node_modules/concat-map/.travis.yml create mode 100644 appasar/canary/node_modules/concat-map/LICENSE create mode 100644 appasar/canary/node_modules/concat-map/README.markdown create mode 100644 appasar/canary/node_modules/concat-map/example/map.js create mode 100644 appasar/canary/node_modules/concat-map/index.js create mode 100644 appasar/canary/node_modules/concat-map/package.json create mode 100644 appasar/canary/node_modules/concat-map/test/map.js create mode 100644 appasar/canary/node_modules/core-util-is/LICENSE create mode 100644 appasar/canary/node_modules/core-util-is/README.md create mode 100644 appasar/canary/node_modules/core-util-is/float.patch create mode 100644 appasar/canary/node_modules/core-util-is/lib/util.js create mode 100644 appasar/canary/node_modules/core-util-is/package.json create mode 100644 appasar/canary/node_modules/core-util-is/test.js create mode 100644 appasar/canary/node_modules/cryptiles/.npmignore create mode 100644 appasar/canary/node_modules/cryptiles/LICENSE create mode 100644 appasar/canary/node_modules/cryptiles/README.md create mode 100644 appasar/canary/node_modules/cryptiles/lib/index.js create mode 100644 appasar/canary/node_modules/cryptiles/node_modules/boom/LICENSE create mode 100644 appasar/canary/node_modules/cryptiles/node_modules/boom/README.md create mode 100644 appasar/canary/node_modules/cryptiles/node_modules/boom/lib/index.js create mode 100644 appasar/canary/node_modules/cryptiles/node_modules/boom/package.json create mode 100644 appasar/canary/node_modules/cryptiles/package.json create mode 100644 appasar/canary/node_modules/dashdash/CHANGES.md create mode 100644 appasar/canary/node_modules/dashdash/LICENSE.txt create mode 100644 appasar/canary/node_modules/dashdash/README.md create mode 100644 appasar/canary/node_modules/dashdash/etc/dashdash.bash_completion.in create mode 100644 appasar/canary/node_modules/dashdash/lib/dashdash.js create mode 100644 appasar/canary/node_modules/dashdash/package.json create mode 100644 appasar/canary/node_modules/delayed-stream/.npmignore create mode 100644 appasar/canary/node_modules/delayed-stream/License create mode 100644 appasar/canary/node_modules/delayed-stream/Makefile create mode 100644 appasar/canary/node_modules/delayed-stream/Readme.md create mode 100644 appasar/canary/node_modules/delayed-stream/lib/delayed_stream.js create mode 100644 appasar/canary/node_modules/delayed-stream/package.json create mode 100644 appasar/canary/node_modules/ecc-jsbn/.npmignore create mode 100644 appasar/canary/node_modules/ecc-jsbn/LICENSE create mode 100644 appasar/canary/node_modules/ecc-jsbn/README.md create mode 100644 appasar/canary/node_modules/ecc-jsbn/index.js create mode 100644 appasar/canary/node_modules/ecc-jsbn/lib/LICENSE-jsbn create mode 100644 appasar/canary/node_modules/ecc-jsbn/lib/ec.js create mode 100644 appasar/canary/node_modules/ecc-jsbn/lib/sec.js create mode 100644 appasar/canary/node_modules/ecc-jsbn/package.json create mode 100644 appasar/canary/node_modules/ecc-jsbn/test.js create mode 100644 appasar/canary/node_modules/extend/.eslintrc create mode 100644 appasar/canary/node_modules/extend/.jscs.json create mode 100644 appasar/canary/node_modules/extend/.npmignore create mode 100644 appasar/canary/node_modules/extend/.travis.yml create mode 100644 appasar/canary/node_modules/extend/CHANGELOG.md create mode 100644 appasar/canary/node_modules/extend/LICENSE create mode 100644 appasar/canary/node_modules/extend/README.md create mode 100644 appasar/canary/node_modules/extend/component.json create mode 100644 appasar/canary/node_modules/extend/index.js create mode 100644 appasar/canary/node_modules/extend/package.json create mode 100644 appasar/canary/node_modules/extsprintf/.gitmodules create mode 100644 appasar/canary/node_modules/extsprintf/.npmignore create mode 100644 appasar/canary/node_modules/extsprintf/LICENSE create mode 100644 appasar/canary/node_modules/extsprintf/Makefile create mode 100644 appasar/canary/node_modules/extsprintf/Makefile.targ create mode 100644 appasar/canary/node_modules/extsprintf/README.md create mode 100644 appasar/canary/node_modules/extsprintf/jsl.node.conf create mode 100644 appasar/canary/node_modules/extsprintf/lib/extsprintf.js create mode 100644 appasar/canary/node_modules/extsprintf/package.json create mode 100644 appasar/canary/node_modules/fast-deep-equal/LICENSE create mode 100644 appasar/canary/node_modules/fast-deep-equal/README.md create mode 100644 appasar/canary/node_modules/fast-deep-equal/index.d.ts create mode 100644 appasar/canary/node_modules/fast-deep-equal/index.js create mode 100644 appasar/canary/node_modules/fast-deep-equal/package.json create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/.eslintrc.yml create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/.npmignore create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/.travis.yml create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/LICENSE create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/README.md create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/benchmark/index.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/benchmark/test.json create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/example/key_cmp.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/example/nested.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/example/str.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/example/value_cmp.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/index.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/package.json create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/test/cmp.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/test/nested.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/test/str.js create mode 100644 appasar/canary/node_modules/fast-json-stable-stringify/test/to-json.js create mode 100644 appasar/canary/node_modules/fd-slicer/.npmignore create mode 100644 appasar/canary/node_modules/fd-slicer/.travis.yml create mode 100644 appasar/canary/node_modules/fd-slicer/CHANGELOG.md create mode 100644 appasar/canary/node_modules/fd-slicer/LICENSE create mode 100644 appasar/canary/node_modules/fd-slicer/README.md create mode 100644 appasar/canary/node_modules/fd-slicer/index.js create mode 100644 appasar/canary/node_modules/fd-slicer/package.json create mode 100644 appasar/canary/node_modules/fd-slicer/test/test.js create mode 100644 appasar/canary/node_modules/forever-agent/LICENSE create mode 100644 appasar/canary/node_modules/forever-agent/README.md create mode 100644 appasar/canary/node_modules/forever-agent/index.js create mode 100644 appasar/canary/node_modules/forever-agent/package.json create mode 100644 appasar/canary/node_modules/form-data/License create mode 100644 appasar/canary/node_modules/form-data/README.md create mode 100644 appasar/canary/node_modules/form-data/README.md.bak create mode 100644 appasar/canary/node_modules/form-data/lib/browser.js create mode 100644 appasar/canary/node_modules/form-data/lib/form_data.js create mode 100644 appasar/canary/node_modules/form-data/lib/populate.js create mode 100644 appasar/canary/node_modules/form-data/node_modules/combined-stream/License create mode 100644 appasar/canary/node_modules/form-data/node_modules/combined-stream/Readme.md create mode 100644 appasar/canary/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js create mode 100644 appasar/canary/node_modules/form-data/node_modules/combined-stream/lib/defer.js create mode 100644 appasar/canary/node_modules/form-data/node_modules/combined-stream/package.json create mode 100644 appasar/canary/node_modules/form-data/package.json create mode 100644 appasar/canary/node_modules/fs.realpath/LICENSE create mode 100644 appasar/canary/node_modules/fs.realpath/README.md create mode 100644 appasar/canary/node_modules/fs.realpath/index.js create mode 100644 appasar/canary/node_modules/fs.realpath/old.js create mode 100644 appasar/canary/node_modules/fs.realpath/package.json create mode 100644 appasar/canary/node_modules/getpass/.npmignore create mode 100644 appasar/canary/node_modules/getpass/.travis.yml create mode 100644 appasar/canary/node_modules/getpass/LICENSE create mode 100644 appasar/canary/node_modules/getpass/README.md create mode 100644 appasar/canary/node_modules/getpass/lib/index.js create mode 100644 appasar/canary/node_modules/getpass/package.json create mode 100644 appasar/canary/node_modules/glob/LICENSE create mode 100644 appasar/canary/node_modules/glob/README.md create mode 100644 appasar/canary/node_modules/glob/changelog.md create mode 100644 appasar/canary/node_modules/glob/common.js create mode 100644 appasar/canary/node_modules/glob/glob.js create mode 100644 appasar/canary/node_modules/glob/package.json create mode 100644 appasar/canary/node_modules/glob/sync.js create mode 100644 appasar/canary/node_modules/har-schema/LICENSE create mode 100644 appasar/canary/node_modules/har-schema/README.md create mode 100644 appasar/canary/node_modules/har-schema/lib/afterRequest.json create mode 100644 appasar/canary/node_modules/har-schema/lib/beforeRequest.json create mode 100644 appasar/canary/node_modules/har-schema/lib/browser.json create mode 100644 appasar/canary/node_modules/har-schema/lib/cache.json create mode 100644 appasar/canary/node_modules/har-schema/lib/content.json create mode 100644 appasar/canary/node_modules/har-schema/lib/cookie.json create mode 100644 appasar/canary/node_modules/har-schema/lib/creator.json create mode 100644 appasar/canary/node_modules/har-schema/lib/entry.json create mode 100644 appasar/canary/node_modules/har-schema/lib/har.json create mode 100644 appasar/canary/node_modules/har-schema/lib/header.json create mode 100644 appasar/canary/node_modules/har-schema/lib/index.js create mode 100644 appasar/canary/node_modules/har-schema/lib/log.json create mode 100644 appasar/canary/node_modules/har-schema/lib/page.json create mode 100644 appasar/canary/node_modules/har-schema/lib/pageTimings.json create mode 100644 appasar/canary/node_modules/har-schema/lib/postData.json create mode 100644 appasar/canary/node_modules/har-schema/lib/query.json create mode 100644 appasar/canary/node_modules/har-schema/lib/request.json create mode 100644 appasar/canary/node_modules/har-schema/lib/response.json create mode 100644 appasar/canary/node_modules/har-schema/lib/timings.json create mode 100644 appasar/canary/node_modules/har-schema/package.json create mode 100644 appasar/canary/node_modules/har-validator/LICENSE create mode 100644 appasar/canary/node_modules/har-validator/README.md create mode 100644 appasar/canary/node_modules/har-validator/lib/async.js create mode 100644 appasar/canary/node_modules/har-validator/lib/error.js create mode 100644 appasar/canary/node_modules/har-validator/lib/promise.js create mode 100644 appasar/canary/node_modules/har-validator/package.json create mode 100644 appasar/canary/node_modules/hawk/.npmignore create mode 100644 appasar/canary/node_modules/hawk/LICENSE create mode 100644 appasar/canary/node_modules/hawk/README.md create mode 100644 appasar/canary/node_modules/hawk/client.js create mode 100644 appasar/canary/node_modules/hawk/dist/browser.js create mode 100644 appasar/canary/node_modules/hawk/lib/browser.js create mode 100644 appasar/canary/node_modules/hawk/lib/client.js create mode 100644 appasar/canary/node_modules/hawk/lib/crypto.js create mode 100644 appasar/canary/node_modules/hawk/lib/index.js create mode 100644 appasar/canary/node_modules/hawk/lib/server.js create mode 100644 appasar/canary/node_modules/hawk/lib/utils.js create mode 100644 appasar/canary/node_modules/hawk/package.json create mode 100644 appasar/canary/node_modules/hoek/.npmignore create mode 100644 appasar/canary/node_modules/hoek/LICENSE create mode 100644 appasar/canary/node_modules/hoek/README.md create mode 100644 appasar/canary/node_modules/hoek/lib/escape.js create mode 100644 appasar/canary/node_modules/hoek/lib/index.js create mode 100644 appasar/canary/node_modules/hoek/package.json create mode 100644 appasar/canary/node_modules/http-signature/.dir-locals.el create mode 100644 appasar/canary/node_modules/http-signature/.npmignore create mode 100644 appasar/canary/node_modules/http-signature/CHANGES.md create mode 100644 appasar/canary/node_modules/http-signature/LICENSE create mode 100644 appasar/canary/node_modules/http-signature/README.md create mode 100644 appasar/canary/node_modules/http-signature/http_signing.md create mode 100644 appasar/canary/node_modules/http-signature/lib/index.js create mode 100644 appasar/canary/node_modules/http-signature/lib/parser.js create mode 100644 appasar/canary/node_modules/http-signature/lib/signer.js create mode 100644 appasar/canary/node_modules/http-signature/lib/utils.js create mode 100644 appasar/canary/node_modules/http-signature/lib/verify.js create mode 120000 appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-conv create mode 120000 appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-sign create mode 120000 appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-verify create mode 100644 appasar/canary/node_modules/http-signature/package.json create mode 100644 appasar/canary/node_modules/inflight/LICENSE create mode 100644 appasar/canary/node_modules/inflight/README.md create mode 100644 appasar/canary/node_modules/inflight/inflight.js create mode 100644 appasar/canary/node_modules/inflight/package.json create mode 100644 appasar/canary/node_modules/inherits/LICENSE create mode 100644 appasar/canary/node_modules/inherits/README.md create mode 100644 appasar/canary/node_modules/inherits/inherits.js create mode 100644 appasar/canary/node_modules/inherits/inherits_browser.js create mode 100644 appasar/canary/node_modules/inherits/package.json create mode 100644 appasar/canary/node_modules/is-typedarray/LICENSE.md create mode 100644 appasar/canary/node_modules/is-typedarray/README.md create mode 100644 appasar/canary/node_modules/is-typedarray/index.js create mode 100644 appasar/canary/node_modules/is-typedarray/package.json create mode 100644 appasar/canary/node_modules/is-typedarray/test.js create mode 100644 appasar/canary/node_modules/isstream/.jshintrc create mode 100644 appasar/canary/node_modules/isstream/.npmignore create mode 100644 appasar/canary/node_modules/isstream/.travis.yml create mode 100644 appasar/canary/node_modules/isstream/LICENSE.md create mode 100644 appasar/canary/node_modules/isstream/README.md create mode 100644 appasar/canary/node_modules/isstream/isstream.js create mode 100644 appasar/canary/node_modules/isstream/package.json create mode 100644 appasar/canary/node_modules/isstream/test.js create mode 100644 appasar/canary/node_modules/jsbn/.npmignore create mode 100644 appasar/canary/node_modules/jsbn/LICENSE create mode 100644 appasar/canary/node_modules/jsbn/README.md create mode 100644 appasar/canary/node_modules/jsbn/example.html create mode 100644 appasar/canary/node_modules/jsbn/example.js create mode 100644 appasar/canary/node_modules/jsbn/index.js create mode 100644 appasar/canary/node_modules/jsbn/package.json create mode 100644 appasar/canary/node_modules/json-schema-traverse/.eslintrc.yml create mode 100644 appasar/canary/node_modules/json-schema-traverse/.npmignore create mode 100644 appasar/canary/node_modules/json-schema-traverse/.travis.yml create mode 100644 appasar/canary/node_modules/json-schema-traverse/LICENSE create mode 100644 appasar/canary/node_modules/json-schema-traverse/README.md create mode 100644 appasar/canary/node_modules/json-schema-traverse/index.js create mode 100644 appasar/canary/node_modules/json-schema-traverse/package.json create mode 100644 appasar/canary/node_modules/json-schema-traverse/spec/.eslintrc.yml create mode 100644 appasar/canary/node_modules/json-schema-traverse/spec/fixtures/schema.js create mode 100644 appasar/canary/node_modules/json-schema-traverse/spec/index.spec.js create mode 100644 appasar/canary/node_modules/json-schema/README.md create mode 100644 appasar/canary/node_modules/json-schema/draft-00/hyper-schema create mode 100644 appasar/canary/node_modules/json-schema/draft-00/json-ref create mode 100644 appasar/canary/node_modules/json-schema/draft-00/links create mode 100644 appasar/canary/node_modules/json-schema/draft-00/schema create mode 100644 appasar/canary/node_modules/json-schema/draft-01/hyper-schema create mode 100644 appasar/canary/node_modules/json-schema/draft-01/json-ref create mode 100644 appasar/canary/node_modules/json-schema/draft-01/links create mode 100644 appasar/canary/node_modules/json-schema/draft-01/schema create mode 100644 appasar/canary/node_modules/json-schema/draft-02/hyper-schema create mode 100644 appasar/canary/node_modules/json-schema/draft-02/json-ref create mode 100644 appasar/canary/node_modules/json-schema/draft-02/links create mode 100644 appasar/canary/node_modules/json-schema/draft-02/schema create mode 100644 appasar/canary/node_modules/json-schema/draft-03/examples/address create mode 100644 appasar/canary/node_modules/json-schema/draft-03/examples/calendar create mode 100644 appasar/canary/node_modules/json-schema/draft-03/examples/card create mode 100644 appasar/canary/node_modules/json-schema/draft-03/examples/geo create mode 100644 appasar/canary/node_modules/json-schema/draft-03/examples/interfaces create mode 100644 appasar/canary/node_modules/json-schema/draft-03/hyper-schema create mode 100644 appasar/canary/node_modules/json-schema/draft-03/json-ref create mode 100644 appasar/canary/node_modules/json-schema/draft-03/links create mode 100644 appasar/canary/node_modules/json-schema/draft-03/schema create mode 100644 appasar/canary/node_modules/json-schema/draft-04/hyper-schema create mode 100644 appasar/canary/node_modules/json-schema/draft-04/links create mode 100644 appasar/canary/node_modules/json-schema/draft-04/schema create mode 100644 appasar/canary/node_modules/json-schema/draft-zyp-json-schema-03.xml create mode 100644 appasar/canary/node_modules/json-schema/draft-zyp-json-schema-04.xml create mode 100644 appasar/canary/node_modules/json-schema/lib/links.js create mode 100644 appasar/canary/node_modules/json-schema/lib/validate.js create mode 100644 appasar/canary/node_modules/json-schema/package.json create mode 100644 appasar/canary/node_modules/json-schema/test/tests.js create mode 100644 appasar/canary/node_modules/json-stringify-safe/.npmignore create mode 100644 appasar/canary/node_modules/json-stringify-safe/CHANGELOG.md create mode 100644 appasar/canary/node_modules/json-stringify-safe/LICENSE create mode 100644 appasar/canary/node_modules/json-stringify-safe/Makefile create mode 100644 appasar/canary/node_modules/json-stringify-safe/README.md create mode 100644 appasar/canary/node_modules/json-stringify-safe/package.json create mode 100644 appasar/canary/node_modules/json-stringify-safe/stringify.js create mode 100644 appasar/canary/node_modules/json-stringify-safe/test/mocha.opts create mode 100644 appasar/canary/node_modules/json-stringify-safe/test/stringify_test.js create mode 100644 appasar/canary/node_modules/jsprim/CHANGES.md create mode 100644 appasar/canary/node_modules/jsprim/CONTRIBUTING.md create mode 100644 appasar/canary/node_modules/jsprim/LICENSE create mode 100644 appasar/canary/node_modules/jsprim/README.md create mode 100644 appasar/canary/node_modules/jsprim/lib/jsprim.js create mode 100644 appasar/canary/node_modules/jsprim/package.json create mode 100644 appasar/canary/node_modules/mime-db/HISTORY.md create mode 100644 appasar/canary/node_modules/mime-db/LICENSE create mode 100644 appasar/canary/node_modules/mime-db/README.md create mode 100644 appasar/canary/node_modules/mime-db/db.json create mode 100644 appasar/canary/node_modules/mime-db/index.js create mode 100644 appasar/canary/node_modules/mime-db/package.json create mode 100644 appasar/canary/node_modules/mime-types/HISTORY.md create mode 100644 appasar/canary/node_modules/mime-types/LICENSE create mode 100644 appasar/canary/node_modules/mime-types/README.md create mode 100644 appasar/canary/node_modules/mime-types/index.js create mode 100644 appasar/canary/node_modules/mime-types/package.json create mode 100644 appasar/canary/node_modules/minimatch/LICENSE create mode 100644 appasar/canary/node_modules/minimatch/README.md create mode 100644 appasar/canary/node_modules/minimatch/minimatch.js create mode 100644 appasar/canary/node_modules/minimatch/package.json create mode 100644 appasar/canary/node_modules/minimist/.travis.yml create mode 100644 appasar/canary/node_modules/minimist/LICENSE create mode 100644 appasar/canary/node_modules/minimist/example/parse.js create mode 100644 appasar/canary/node_modules/minimist/index.js create mode 100644 appasar/canary/node_modules/minimist/package.json create mode 100644 appasar/canary/node_modules/minimist/readme.markdown create mode 100644 appasar/canary/node_modules/minimist/test/dash.js create mode 100644 appasar/canary/node_modules/minimist/test/default_bool.js create mode 100644 appasar/canary/node_modules/minimist/test/dotted.js create mode 100644 appasar/canary/node_modules/minimist/test/long.js create mode 100644 appasar/canary/node_modules/minimist/test/parse.js create mode 100644 appasar/canary/node_modules/minimist/test/parse_modified.js create mode 100644 appasar/canary/node_modules/minimist/test/short.js create mode 100644 appasar/canary/node_modules/minimist/test/whitespace.js create mode 100644 appasar/canary/node_modules/mkdirp/.travis.yml create mode 100644 appasar/canary/node_modules/mkdirp/LICENSE create mode 100644 appasar/canary/node_modules/mkdirp/bin/cmd.js create mode 100644 appasar/canary/node_modules/mkdirp/bin/usage.txt create mode 100644 appasar/canary/node_modules/mkdirp/examples/pow.js create mode 100644 appasar/canary/node_modules/mkdirp/index.js create mode 100644 appasar/canary/node_modules/mkdirp/package.json create mode 100644 appasar/canary/node_modules/mkdirp/readme.markdown create mode 100644 appasar/canary/node_modules/mkdirp/test/chmod.js create mode 100644 appasar/canary/node_modules/mkdirp/test/clobber.js create mode 100644 appasar/canary/node_modules/mkdirp/test/mkdirp.js create mode 100644 appasar/canary/node_modules/mkdirp/test/opts_fs.js create mode 100644 appasar/canary/node_modules/mkdirp/test/opts_fs_sync.js create mode 100644 appasar/canary/node_modules/mkdirp/test/perm.js create mode 100644 appasar/canary/node_modules/mkdirp/test/perm_sync.js create mode 100644 appasar/canary/node_modules/mkdirp/test/race.js create mode 100644 appasar/canary/node_modules/mkdirp/test/rel.js create mode 100644 appasar/canary/node_modules/mkdirp/test/return.js create mode 100644 appasar/canary/node_modules/mkdirp/test/return_sync.js create mode 100644 appasar/canary/node_modules/mkdirp/test/root.js create mode 100644 appasar/canary/node_modules/mkdirp/test/sync.js create mode 100644 appasar/canary/node_modules/mkdirp/test/umask.js create mode 100644 appasar/canary/node_modules/mkdirp/test/umask_sync.js create mode 100644 appasar/canary/node_modules/oauth-sign/LICENSE create mode 100644 appasar/canary/node_modules/oauth-sign/README.md create mode 100644 appasar/canary/node_modules/oauth-sign/index.js create mode 100644 appasar/canary/node_modules/oauth-sign/package.json create mode 100644 appasar/canary/node_modules/once/LICENSE create mode 100644 appasar/canary/node_modules/once/README.md create mode 100644 appasar/canary/node_modules/once/once.js create mode 100644 appasar/canary/node_modules/once/package.json create mode 100644 appasar/canary/node_modules/path-is-absolute/index.js create mode 100644 appasar/canary/node_modules/path-is-absolute/license create mode 100644 appasar/canary/node_modules/path-is-absolute/package.json create mode 100644 appasar/canary/node_modules/path-is-absolute/readme.md create mode 100644 appasar/canary/node_modules/pend/LICENSE create mode 100644 appasar/canary/node_modules/pend/README.md create mode 100644 appasar/canary/node_modules/pend/index.js create mode 100644 appasar/canary/node_modules/pend/package.json create mode 100644 appasar/canary/node_modules/pend/test.js create mode 100644 appasar/canary/node_modules/performance-now/.npmignore create mode 100644 appasar/canary/node_modules/performance-now/.tm_properties create mode 100644 appasar/canary/node_modules/performance-now/.travis.yml create mode 100644 appasar/canary/node_modules/performance-now/README.md create mode 100644 appasar/canary/node_modules/performance-now/lib/performance-now.js create mode 100644 appasar/canary/node_modules/performance-now/lib/performance-now.js.map create mode 100644 appasar/canary/node_modules/performance-now/license.txt create mode 100644 appasar/canary/node_modules/performance-now/package.json create mode 100644 appasar/canary/node_modules/performance-now/src/index.d.ts create mode 100644 appasar/canary/node_modules/performance-now/src/performance-now.coffee create mode 100644 appasar/canary/node_modules/performance-now/test/mocha.opts create mode 100644 appasar/canary/node_modules/performance-now/test/performance-now.coffee create mode 100644 appasar/canary/node_modules/performance-now/test/scripts.coffee create mode 100644 appasar/canary/node_modules/performance-now/test/scripts/delayed-call.coffee create mode 100644 appasar/canary/node_modules/performance-now/test/scripts/delayed-require.coffee create mode 100644 appasar/canary/node_modules/performance-now/test/scripts/difference.coffee create mode 100644 appasar/canary/node_modules/performance-now/test/scripts/initial-value.coffee create mode 100644 appasar/canary/node_modules/punycode/LICENSE-MIT.txt create mode 100644 appasar/canary/node_modules/punycode/README.md create mode 100644 appasar/canary/node_modules/punycode/package.json create mode 100644 appasar/canary/node_modules/punycode/punycode.js create mode 100644 appasar/canary/node_modules/qs/.editorconfig create mode 100644 appasar/canary/node_modules/qs/.eslintignore create mode 100644 appasar/canary/node_modules/qs/.eslintrc create mode 100644 appasar/canary/node_modules/qs/CHANGELOG.md create mode 100644 appasar/canary/node_modules/qs/LICENSE create mode 100644 appasar/canary/node_modules/qs/README.md create mode 100644 appasar/canary/node_modules/qs/dist/qs.js create mode 100644 appasar/canary/node_modules/qs/lib/formats.js create mode 100644 appasar/canary/node_modules/qs/lib/index.js create mode 100644 appasar/canary/node_modules/qs/lib/parse.js create mode 100644 appasar/canary/node_modules/qs/lib/stringify.js create mode 100644 appasar/canary/node_modules/qs/lib/utils.js create mode 100644 appasar/canary/node_modules/qs/package.json create mode 100644 appasar/canary/node_modules/qs/test/.eslintrc create mode 100644 appasar/canary/node_modules/qs/test/index.js create mode 100644 appasar/canary/node_modules/qs/test/parse.js create mode 100644 appasar/canary/node_modules/qs/test/stringify.js create mode 100644 appasar/canary/node_modules/qs/test/utils.js create mode 100644 appasar/canary/node_modules/request/CHANGELOG.md create mode 100644 appasar/canary/node_modules/request/LICENSE create mode 100644 appasar/canary/node_modules/request/README.md create mode 100644 appasar/canary/node_modules/request/index.js create mode 100644 appasar/canary/node_modules/request/lib/auth.js create mode 100644 appasar/canary/node_modules/request/lib/cookies.js create mode 100644 appasar/canary/node_modules/request/lib/getProxyFromURI.js create mode 100644 appasar/canary/node_modules/request/lib/har.js create mode 100644 appasar/canary/node_modules/request/lib/helpers.js create mode 100644 appasar/canary/node_modules/request/lib/multipart.js create mode 100644 appasar/canary/node_modules/request/lib/oauth.js create mode 100644 appasar/canary/node_modules/request/lib/querystring.js create mode 100644 appasar/canary/node_modules/request/lib/redirect.js create mode 100644 appasar/canary/node_modules/request/lib/tunnel.js create mode 120000 appasar/canary/node_modules/request/node_modules/.bin/uuid create mode 100644 appasar/canary/node_modules/request/package.json create mode 100644 appasar/canary/node_modules/request/request.js create mode 100644 appasar/canary/node_modules/rimraf/LICENSE create mode 100644 appasar/canary/node_modules/rimraf/README.md create mode 100644 appasar/canary/node_modules/rimraf/bin.js create mode 100644 appasar/canary/node_modules/rimraf/package.json create mode 100644 appasar/canary/node_modules/rimraf/rimraf.js create mode 100644 appasar/canary/node_modules/safe-buffer/.travis.yml create mode 100644 appasar/canary/node_modules/safe-buffer/LICENSE create mode 100644 appasar/canary/node_modules/safe-buffer/README.md create mode 100644 appasar/canary/node_modules/safe-buffer/index.js create mode 100644 appasar/canary/node_modules/safe-buffer/package.json create mode 100644 appasar/canary/node_modules/safe-buffer/test.js create mode 100644 appasar/canary/node_modules/sntp/.npmignore create mode 100644 appasar/canary/node_modules/sntp/LICENSE create mode 100644 appasar/canary/node_modules/sntp/README.md create mode 100644 appasar/canary/node_modules/sntp/lib/index.js create mode 100644 appasar/canary/node_modules/sntp/package.json create mode 100644 appasar/canary/node_modules/sshpk/.npmignore create mode 100644 appasar/canary/node_modules/sshpk/.travis.yml create mode 100644 appasar/canary/node_modules/sshpk/LICENSE create mode 100644 appasar/canary/node_modules/sshpk/README.md create mode 100644 appasar/canary/node_modules/sshpk/bin/sshpk-conv create mode 100644 appasar/canary/node_modules/sshpk/bin/sshpk-sign create mode 100644 appasar/canary/node_modules/sshpk/bin/sshpk-verify create mode 100644 appasar/canary/node_modules/sshpk/lib/algs.js create mode 100644 appasar/canary/node_modules/sshpk/lib/certificate.js create mode 100644 appasar/canary/node_modules/sshpk/lib/dhe.js create mode 100644 appasar/canary/node_modules/sshpk/lib/ed-compat.js create mode 100644 appasar/canary/node_modules/sshpk/lib/errors.js create mode 100644 appasar/canary/node_modules/sshpk/lib/fingerprint.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/auto.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/openssh-cert.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/pem.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/pkcs1.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/pkcs8.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/rfc4253.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/ssh-private.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/ssh.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/x509-pem.js create mode 100644 appasar/canary/node_modules/sshpk/lib/formats/x509.js create mode 100644 appasar/canary/node_modules/sshpk/lib/identity.js create mode 100644 appasar/canary/node_modules/sshpk/lib/index.js create mode 100644 appasar/canary/node_modules/sshpk/lib/key.js create mode 100644 appasar/canary/node_modules/sshpk/lib/private-key.js create mode 100644 appasar/canary/node_modules/sshpk/lib/signature.js create mode 100644 appasar/canary/node_modules/sshpk/lib/ssh-buffer.js create mode 100644 appasar/canary/node_modules/sshpk/lib/utils.js create mode 100644 appasar/canary/node_modules/sshpk/man/man1/sshpk-conv.1 create mode 100644 appasar/canary/node_modules/sshpk/man/man1/sshpk-sign.1 create mode 100644 appasar/canary/node_modules/sshpk/man/man1/sshpk-verify.1 create mode 100644 appasar/canary/node_modules/sshpk/package.json create mode 100644 appasar/canary/node_modules/stringstream/.npmignore create mode 100644 appasar/canary/node_modules/stringstream/.travis.yml create mode 100644 appasar/canary/node_modules/stringstream/LICENSE.txt create mode 100644 appasar/canary/node_modules/stringstream/README.md create mode 100644 appasar/canary/node_modules/stringstream/example.js create mode 100644 appasar/canary/node_modules/stringstream/package.json create mode 100644 appasar/canary/node_modules/stringstream/stringstream.js create mode 100644 appasar/canary/node_modules/tough-cookie/LICENSE create mode 100644 appasar/canary/node_modules/tough-cookie/README.md create mode 100644 appasar/canary/node_modules/tough-cookie/lib/cookie.js create mode 100644 appasar/canary/node_modules/tough-cookie/lib/memstore.js create mode 100644 appasar/canary/node_modules/tough-cookie/lib/pathMatch.js create mode 100644 appasar/canary/node_modules/tough-cookie/lib/permuteDomain.js create mode 100644 appasar/canary/node_modules/tough-cookie/lib/pubsuffix.js create mode 100644 appasar/canary/node_modules/tough-cookie/lib/store.js create mode 100644 appasar/canary/node_modules/tough-cookie/package.json create mode 100644 appasar/canary/node_modules/tunnel-agent/LICENSE create mode 100644 appasar/canary/node_modules/tunnel-agent/README.md create mode 100644 appasar/canary/node_modules/tunnel-agent/index.js create mode 100644 appasar/canary/node_modules/tunnel-agent/package.json create mode 100644 appasar/canary/node_modules/tweetnacl/.npmignore create mode 100644 appasar/canary/node_modules/tweetnacl/AUTHORS.md create mode 100644 appasar/canary/node_modules/tweetnacl/CHANGELOG.md create mode 100644 appasar/canary/node_modules/tweetnacl/LICENSE create mode 100644 appasar/canary/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md create mode 100644 appasar/canary/node_modules/tweetnacl/README.md create mode 100644 appasar/canary/node_modules/tweetnacl/nacl-fast.js create mode 100644 appasar/canary/node_modules/tweetnacl/nacl-fast.min.js create mode 100644 appasar/canary/node_modules/tweetnacl/nacl.d.ts create mode 100644 appasar/canary/node_modules/tweetnacl/nacl.js create mode 100644 appasar/canary/node_modules/tweetnacl/nacl.min.js create mode 100644 appasar/canary/node_modules/tweetnacl/package.json create mode 100644 appasar/canary/node_modules/uuid/.eslintrc.json create mode 100644 appasar/canary/node_modules/uuid/AUTHORS create mode 100644 appasar/canary/node_modules/uuid/CHANGELOG.md create mode 100644 appasar/canary/node_modules/uuid/LICENSE.md create mode 100644 appasar/canary/node_modules/uuid/README.md create mode 100644 appasar/canary/node_modules/uuid/README_js.md create mode 100644 appasar/canary/node_modules/uuid/bin/uuid create mode 100644 appasar/canary/node_modules/uuid/index.js create mode 100644 appasar/canary/node_modules/uuid/lib/bytesToUuid.js create mode 100644 appasar/canary/node_modules/uuid/lib/md5-browser.js create mode 100644 appasar/canary/node_modules/uuid/lib/md5.js create mode 100644 appasar/canary/node_modules/uuid/lib/rng-browser.js create mode 100644 appasar/canary/node_modules/uuid/lib/rng.js create mode 100644 appasar/canary/node_modules/uuid/lib/sha1-browser.js create mode 100644 appasar/canary/node_modules/uuid/lib/sha1.js create mode 100644 appasar/canary/node_modules/uuid/lib/v35.js create mode 100644 appasar/canary/node_modules/uuid/package.json create mode 100644 appasar/canary/node_modules/uuid/v1.js create mode 100644 appasar/canary/node_modules/uuid/v3.js create mode 100644 appasar/canary/node_modules/uuid/v4.js create mode 100644 appasar/canary/node_modules/uuid/v5.js create mode 100644 appasar/canary/node_modules/verror/.npmignore create mode 100644 appasar/canary/node_modules/verror/CHANGES.md create mode 100644 appasar/canary/node_modules/verror/CONTRIBUTING.md create mode 100644 appasar/canary/node_modules/verror/LICENSE create mode 100644 appasar/canary/node_modules/verror/README.md create mode 100644 appasar/canary/node_modules/verror/lib/verror.js create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/.gitmodules create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/.npmignore create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/CHANGES.md create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/CONTRIBUTING.md create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/LICENSE create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/Makefile create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/Makefile.targ create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/README.md create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/jsl.node.conf create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/lib/extsprintf.js create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/package.json create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/test/tst.basic.js create mode 100644 appasar/canary/node_modules/verror/node_modules/extsprintf/test/tst.invalid.js create mode 100644 appasar/canary/node_modules/verror/package.json create mode 100644 appasar/canary/node_modules/wrappy/LICENSE create mode 100644 appasar/canary/node_modules/wrappy/README.md create mode 100644 appasar/canary/node_modules/wrappy/package.json create mode 100644 appasar/canary/node_modules/wrappy/wrappy.js create mode 100644 appasar/canary/node_modules/yauzl/LICENSE create mode 100644 appasar/canary/node_modules/yauzl/README.md create mode 100644 appasar/canary/node_modules/yauzl/index.js create mode 100644 appasar/canary/node_modules/yauzl/package.json create mode 100644 appasar/canary/package.json create mode 100644 electronasar/canary/browser/api/app.js create mode 100644 electronasar/canary/browser/api/auto-updater.js create mode 100644 electronasar/canary/browser/api/auto-updater/auto-updater-native.js create mode 100644 electronasar/canary/browser/api/auto-updater/auto-updater-win.js create mode 100644 electronasar/canary/browser/api/auto-updater/squirrel-update-win.js create mode 100644 electronasar/canary/browser/api/browser-view.js create mode 100644 electronasar/canary/browser/api/browser-window.js create mode 100644 electronasar/canary/browser/api/content-tracing.js create mode 100644 electronasar/canary/browser/api/crash-reporter.js create mode 100644 electronasar/canary/browser/api/dialog.js create mode 100644 electronasar/canary/browser/api/exports/electron.js create mode 100644 electronasar/canary/browser/api/global-shortcut.js create mode 100644 electronasar/canary/browser/api/in-app-purchase.js create mode 100644 electronasar/canary/browser/api/ipc-main.js create mode 100644 electronasar/canary/browser/api/menu-item-roles.js create mode 100644 electronasar/canary/browser/api/menu-item.js create mode 100644 electronasar/canary/browser/api/menu-utils.js create mode 100644 electronasar/canary/browser/api/menu.js create mode 100644 electronasar/canary/browser/api/module-list.js create mode 100644 electronasar/canary/browser/api/navigation-controller.js create mode 100644 electronasar/canary/browser/api/net-log.js create mode 100644 electronasar/canary/browser/api/net.js create mode 100644 electronasar/canary/browser/api/notification.js create mode 100644 electronasar/canary/browser/api/power-monitor.js create mode 100644 electronasar/canary/browser/api/power-save-blocker.js create mode 100644 electronasar/canary/browser/api/protocol.js create mode 100644 electronasar/canary/browser/api/screen.js create mode 100644 electronasar/canary/browser/api/session.js create mode 100644 electronasar/canary/browser/api/system-preferences.js create mode 100644 electronasar/canary/browser/api/top-level-window.js create mode 100644 electronasar/canary/browser/api/touch-bar.js create mode 100644 electronasar/canary/browser/api/tray.js create mode 100644 electronasar/canary/browser/api/view.js create mode 100644 electronasar/canary/browser/api/web-contents-view.js create mode 100644 electronasar/canary/browser/api/web-contents.js create mode 100644 electronasar/canary/browser/chrome-extension.js create mode 100644 electronasar/canary/browser/desktop-capturer.js create mode 100644 electronasar/canary/browser/guest-view-manager.js create mode 100644 electronasar/canary/browser/guest-window-manager.js create mode 100644 electronasar/canary/browser/init.js create mode 100644 electronasar/canary/browser/ipc-main-internal.js create mode 100644 electronasar/canary/browser/objects-registry.js create mode 100644 electronasar/canary/browser/rpc-server.js create mode 100644 electronasar/canary/common/api/clipboard.js create mode 100644 electronasar/canary/common/api/deprecate.js create mode 100644 electronasar/canary/common/api/deprecations.js create mode 100644 electronasar/canary/common/api/exports/electron.js create mode 100644 electronasar/canary/common/api/is-promise.js create mode 100644 electronasar/canary/common/api/module-list.js create mode 100644 electronasar/canary/common/api/native-image.js create mode 100644 electronasar/canary/common/api/shell.js create mode 100644 electronasar/canary/common/atom-binding-setup.js create mode 100644 electronasar/canary/common/buffer-utils.js create mode 100644 electronasar/canary/common/crash-reporter.js create mode 100644 electronasar/canary/common/error-utils.js create mode 100644 electronasar/canary/common/init.js create mode 100644 electronasar/canary/common/parse-features-string.js create mode 100644 electronasar/canary/common/reset-search-paths.js create mode 100644 electronasar/canary/renderer/api/crash-reporter.js create mode 100644 electronasar/canary/renderer/api/desktop-capturer.js create mode 100644 electronasar/canary/renderer/api/exports/electron.js create mode 100644 electronasar/canary/renderer/api/ipc-renderer.js create mode 100644 electronasar/canary/renderer/api/module-list.js create mode 100644 electronasar/canary/renderer/api/remote.js create mode 100644 electronasar/canary/renderer/api/screen.js create mode 100644 electronasar/canary/renderer/api/web-frame.js create mode 100644 electronasar/canary/renderer/callbacks-registry.js create mode 100644 electronasar/canary/renderer/chrome-api.js create mode 100644 electronasar/canary/renderer/content-scripts-injector.js create mode 100644 electronasar/canary/renderer/extensions/event.js create mode 100644 electronasar/canary/renderer/extensions/i18n.js create mode 100644 electronasar/canary/renderer/extensions/storage.js create mode 100644 electronasar/canary/renderer/extensions/web-navigation.js create mode 100644 electronasar/canary/renderer/init.js create mode 100644 electronasar/canary/renderer/inspector.js create mode 100644 electronasar/canary/renderer/ipc-renderer-internal.js create mode 100644 electronasar/canary/renderer/override.js create mode 100644 electronasar/canary/renderer/remote.js create mode 100644 electronasar/canary/renderer/security-warnings.js create mode 100644 electronasar/canary/renderer/web-frame-init.js create mode 100644 electronasar/canary/renderer/web-view/guest-view-internal.js create mode 100644 electronasar/canary/renderer/web-view/web-view-attributes.js create mode 100644 electronasar/canary/renderer/web-view/web-view-constants.js create mode 100644 electronasar/canary/renderer/web-view/web-view.js create mode 100644 electronasar/canary/renderer/window-setup.js create mode 100644 electronasar/canary/worker/init.js diff --git a/appasar/canary/app_bootstrap/Constants.js b/appasar/canary/app_bootstrap/Constants.js new file mode 100644 index 0000000..9b3de49 --- /dev/null +++ b/appasar/canary/app_bootstrap/Constants.js @@ -0,0 +1,31 @@ +'use strict'; + +// bootstrap constants +// after startup, these constants will be merged into core module constants +// since they are used in both locations (see app/Constants.js) + +var _require = require('./buildInfo'), + releaseChannel = _require.releaseChannel; + +var _require2 = require('./appSettings'), + getSettings = _require2.getSettings; + +var settings = getSettings(); + +function capitalizeFirstLetter(s) { + return s.charAt(0).toUpperCase() + s.slice(1); +} + +var APP_NAME = 'Discord' + (releaseChannel === 'stable' ? '' : capitalizeFirstLetter(releaseChannel)); +var APP_ID_BASE = 'com.squirrel'; +var APP_ID = APP_ID_BASE + '.' + APP_NAME + '.' + APP_NAME; + +var API_ENDPOINT = settings.get('API_ENDPOINT') || 'https://discordapp.com/api'; +var UPDATE_ENDPOINT = settings.get('UPDATE_ENDPOINT') || API_ENDPOINT; + +module.exports = { + APP_NAME: APP_NAME, + APP_ID: APP_ID, + API_ENDPOINT: API_ENDPOINT, + UPDATE_ENDPOINT: UPDATE_ENDPOINT +}; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/GPUSettings.js b/appasar/canary/app_bootstrap/GPUSettings.js new file mode 100644 index 0000000..a6090a9 --- /dev/null +++ b/appasar/canary/app_bootstrap/GPUSettings.js @@ -0,0 +1,38 @@ +"use strict"; + +// this file is here for two reasons: +// 1. web requires ./GPUSettings file from electron app (bad!), and requires are +// relative to process.main (bootstrap's index.js) +// 2. GPUSettings has been refactored into GPUSettings, and because we want to +// be able to update GPUSettings OTA, we will have the core module provide +// us with the GPUSettings +// so tl;dr this is core module's GPUSettings, providing compat for web + +exports.replace = function (GPUSettings) { + // replacing module.exports directly would have no effect, since requires are cached + // so we mutate the existing object + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = Object.keys(GPUSettings)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var name = _step.value; + + exports[name] = GPUSettings[name]; + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } +}; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/appSettings.js b/appasar/canary/app_bootstrap/appSettings.js new file mode 100644 index 0000000..476a94c --- /dev/null +++ b/appasar/canary/app_bootstrap/appSettings.js @@ -0,0 +1,29 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.init = init; +exports.getSettings = getSettings; + +var _Settings = require('../common/Settings'); + +var _Settings2 = _interopRequireDefault(_Settings); + +var _paths = require('../common/paths'); + +var paths = _interopRequireWildcard(_paths); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var settings = void 0; + +function init() { + settings = new _Settings2.default(paths.getUserData()); +} + +function getSettings() { + return settings; +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/appUpdater.js b/appasar/canary/app_bootstrap/appUpdater.js new file mode 100644 index 0000000..1a3734d --- /dev/null +++ b/appasar/canary/app_bootstrap/appUpdater.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.update = update; +exports.focusSplash = focusSplash; + +var _moduleUpdater = require('../common/moduleUpdater'); + +var moduleUpdater = _interopRequireWildcard(_moduleUpdater); + +var _splashScreen = require('./splashScreen'); + +var splashScreen = _interopRequireWildcard(_splashScreen); + +var _appSettings = require('./appSettings'); + +var _Constants = require('./Constants'); + +var _buildInfo = require('./buildInfo'); + +var _buildInfo2 = _interopRequireDefault(_buildInfo); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function update(startMinimized, doneCallback, showCallback) { + var settings = (0, _appSettings.getSettings)(); + moduleUpdater.init(_Constants.UPDATE_ENDPOINT, settings, _buildInfo2.default); + + splashScreen.initSplash(startMinimized); + splashScreen.events.once(splashScreen.APP_SHOULD_LAUNCH, doneCallback); + splashScreen.events.once(splashScreen.APP_SHOULD_SHOW, showCallback); +} + +function focusSplash() { + splashScreen.focusWindow(); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/autoStart/darwin.js b/appasar/canary/app_bootstrap/autoStart/darwin.js new file mode 100644 index 0000000..954818c --- /dev/null +++ b/appasar/canary/app_bootstrap/autoStart/darwin.js @@ -0,0 +1,24 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.install = install; +exports.update = update; +exports.isInstalled = isInstalled; +exports.uninstall = uninstall; +function install(callback) { + return callback(); +} + +function update(callback) { + return callback(); +} + +function isInstalled(callback) { + return callback(false); +} + +function uninstall(callback) { + return callback(); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/autoStart/index.js b/appasar/canary/app_bootstrap/autoStart/index.js new file mode 100644 index 0000000..012f895 --- /dev/null +++ b/appasar/canary/app_bootstrap/autoStart/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./' + process.platform); \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/autoStart/linux.js b/appasar/canary/app_bootstrap/autoStart/linux.js new file mode 100644 index 0000000..4ed6a3a --- /dev/null +++ b/appasar/canary/app_bootstrap/autoStart/linux.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.install = install; +exports.update = update; +exports.isInstalled = isInstalled; +exports.uninstall = uninstall; + +var _fs = require('fs'); + +var _fs2 = _interopRequireDefault(_fs); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _electron = require('electron'); + +var _buildInfo = require('../buildInfo'); + +var _buildInfo2 = _interopRequireDefault(_buildInfo); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// TODO: We should use Constant's APP_NAME, but only once +// we set up backwards compat with this. +var appName = _path2.default.basename(process.execPath, '.exe'); +var exePath = _electron.app.getPath('exe'); +var exeDir = _path2.default.dirname(exePath); +var iconPath = _path2.default.join(exeDir, 'discord.png'); +var autostartDir = _path2.default.join(_electron.app.getPath('appData'), 'autostart'); +var autostartFileName = _path2.default.join(autostartDir, _electron.app.getName() + '-' + _buildInfo2.default.releaseChannel + '.desktop'); +var desktopFile = '[Desktop Entry]\nType=Application\nExec=' + exePath + '\nHidden=false\nNoDisplay=false\nName=' + appName + '\nIcon=' + iconPath + '\nComment=Text and voice chat for gamers.\nX-GNOME-Autostart-enabled=true\n'; + +function ensureDir() { + try { + _fs2.default.mkdirSync(autostartDir); + return true; + } catch (e) { + // catch for when it already exists. + } + return false; +} + +function install(callback) { + // TODO: This could fail. We should read its return value + ensureDir(); + try { + return _fs2.default.writeFile(autostartFileName, desktopFile, callback); + } catch (e) { + // I guess we don't autostart then + return callback(); + } +} + +function update(callback) { + // TODO: We might need to implement this later on + return callback(); +} + +function isInstalled(callback) { + try { + _fs2.default.stat(autostartFileName, function (err, stats) { + if (err) { + return callback(false); + } + return callback(stats.isFile()); + }); + } catch (e) { + return callback(false); + } +} + +function uninstall(callback) { + return _fs2.default.unlink(autostartFileName, callback); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/autoStart/win32.js b/appasar/canary/app_bootstrap/autoStart/win32.js new file mode 100644 index 0000000..90c325b --- /dev/null +++ b/appasar/canary/app_bootstrap/autoStart/win32.js @@ -0,0 +1,69 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.install = install; +exports.update = update; +exports.isInstalled = isInstalled; +exports.uninstall = uninstall; + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _windowsUtils = require('../windowsUtils'); + +var windowsUtils = _interopRequireWildcard(_windowsUtils); + +var _appSettings = require('../appSettings'); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var settings = (0, _appSettings.getSettings)(); + +// TODO: We should use Constant's APP_NAME, but only once +// we set up backwards compat with this. +var appName = _path2.default.basename(process.execPath, '.exe'); + +function install(callback) { + var startMinimized = settings.get('START_MINIMIZED', false); + var _process = process, + execPath = _process.execPath; + + if (startMinimized) { + execPath = execPath + ' --start-minimized'; + } + var queue = [['HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName, '/d', execPath]]; + + windowsUtils.addToRegistry(queue, callback); +} + +function update(callback) { + isInstalled(function (installed) { + if (installed) { + install(callback); + } else { + callback(); + } + }); +} + +function isInstalled(callback) { + var queryValue = ['HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName]; + queryValue.unshift('query'); + windowsUtils.spawnReg(queryValue, function (error, stdout) { + var doesOldKeyExist = stdout.indexOf(appName) >= 0; + callback(doesOldKeyExist); + }); +} + +function uninstall(callback) { + var queryValue = ['HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName, '/f']; + queryValue.unshift('delete'); + windowsUtils.spawnReg(queryValue, function (error, stdout) { + callback(); + }); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/bootstrap.js b/appasar/canary/app_bootstrap/bootstrap.js new file mode 100644 index 0000000..59f4f94 --- /dev/null +++ b/appasar/canary/app_bootstrap/bootstrap.js @@ -0,0 +1,145 @@ +'use strict'; + +// bootstrap, or what runs before the rest of desktop does +// responsible for handling updates and updating modules before continuing startup + +if (process.platform === 'linux') { + // Some people are reporting audio problems on Linux that are fixed by setting + // an environment variable PULSE_LATENCY_MSEC=30 -- the "real" fix is to see + // what conditions require this and set this then (also to set it directly in + // our webrtc setup code rather than here) but this should fix the bug for now. + if (process.env.PULSE_LATENCY_MSEC === undefined) { + process.env.PULSE_LATENCY_MSEC = 30; + } +} + +var _require = require('electron'), + app = _require.app, + Menu = _require.Menu; + +var buildInfo = require('./buildInfo'); +app.setVersion(buildInfo.version); + +// expose releaseChannel to a global, since it's used by splash screen +global.releaseChannel = buildInfo.releaseChannel; + +var errorHandler = require('./errorHandler'); +errorHandler.init(); + +var paths = require('../common/paths'); +paths.init(buildInfo); + +global.modulePath = paths.getModulePath(); + +var appSettings = require('./appSettings'); +appSettings.init(); + +var Constants = require('./Constants'); +var GPUSettings = require('./GPUSettings'); + +var settings = appSettings.getSettings(); +// TODO: this is a copy of gpuSettings.getEnableHardwareAcceleration +if (!settings.get('enableHardwareAcceleration', true)) { + app.disableHardwareAcceleration(); +} + +// [adill] disables color correction based on monitor's color profile +app.commandLine.appendSwitch('force-color-profile', 'srgb'); + +// [adill] work around chrome 66 disabling autoplay by default +app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required'); + +function hasArgvFlag(flag) { + return (process.argv || []).slice(1).includes(flag); +} + +console.log(Constants.APP_NAME + ' ' + app.getVersion()); + +var preventStartup = false; +if (process.platform === 'win32') { + // this tells Windows (in particular Windows 10) which icon to associate your app with, important for correctly + // pinning app to task bar. + app.setAppUserModelId(Constants.APP_ID); + + var _require2 = require('./squirrelUpdate'), + handleStartupEvent = _require2.handleStartupEvent; + // TODO: Isn't using argv[1] fragile? + + + var squirrelCommand = process.argv[1]; + // TODO: Should `Discord` be a constant in this case? It's a protocol. + // TODO: Is protocol case sensitive? + if (handleStartupEvent('Discord', app, squirrelCommand)) { + preventStartup = true; + } +} + +var singleInstance = require('./singleInstance'); +var appUpdater = require('./appUpdater'); +var moduleUpdater = require('../common/moduleUpdater'); +var splashScreen = require('./splashScreen'); +var autoStart = require('./autoStart'); +var requireNative = require('./requireNative'); +var coreModule = void 0; + +function startUpdate() { + var startMinimized = hasArgvFlag('--start-minimized'); + + appUpdater.update(startMinimized, function () { + try { + coreModule = requireNative('discord_desktop_core'); + coreModule.startup({ + paths: paths, + splashScreen: splashScreen, + moduleUpdater: moduleUpdater, + autoStart: autoStart, + buildInfo: buildInfo, + appSettings: appSettings, + Constants: Constants, + GPUSettings: GPUSettings + }); + } catch (err) { + return errorHandler.fatal(err); + } + }, function () { + coreModule.setMainWindowVisible(!startMinimized); + }); +} + +function startApp() { + paths.cleanOldVersions(buildInfo); + var startupMenu = require('./startupMenu'); + Menu.setApplicationMenu(startupMenu); + + var multiInstance = hasArgvFlag('--multi-instance'); + + if (multiInstance) { + startUpdate(); + } else { + singleInstance.create(startUpdate, function (args) { + // TODO: isn't relying on index 0 awfully fragile? + if (args != null && args.length > 0 && args[0] === '--squirrel-uninstall') { + app.quit(); + return; + } + + if (coreModule) { + coreModule.handleSingleInstance(args); + } else { + appUpdater.focusSplash(); + } + }); + } +} + +if (preventStartup) { + console.log('Startup prevented.'); + // TODO: shouldn't we exit out? +} else { + console.log('Starting updater.'); + if (app.isReady()) { + startApp(); + } else { + app.once('ready', startApp); + } +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/buildInfo.js b/appasar/canary/app_bootstrap/buildInfo.js new file mode 100644 index 0000000..6da8c09 --- /dev/null +++ b/appasar/canary/app_bootstrap/buildInfo.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var buildInfo = require(_path2.default.join(process.resourcesPath, 'build_info.json')); + +exports.default = buildInfo; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/data/quotes_copy.json b/appasar/canary/app_bootstrap/data/quotes_copy.json new file mode 100644 index 0000000..a8fb7fa --- /dev/null +++ b/appasar/canary/app_bootstrap/data/quotes_copy.json @@ -0,0 +1,15 @@ +[ + "Leeeeeeroy jenkins!", + "Readying the felines.", + "Ensuring dankest memes.", + "Recruiting robot hamsters.", + "Getting dunked.", + "Summoning unnecessarily dramatic encounters.", + "Procedurally generating buttons.", + "Preparing for a team fight.", + "Buffing before the raid.", + "Top decking lethal.", + "Reloading the R8.", + "Constructing additional pylons.", + "Unbenching the Kench." +] diff --git a/appasar/canary/app_bootstrap/errorHandler.js b/appasar/canary/app_bootstrap/errorHandler.js new file mode 100644 index 0000000..c135992 --- /dev/null +++ b/appasar/canary/app_bootstrap/errorHandler.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.init = init; +exports.fatal = fatal; + +var _electron = require('electron'); + +function isErrorSafeToSuppress(error) { + return (/attempting to call a function in a renderer window/i.test(error.message) + ); +} + +function init() { + process.on('uncaughtException', function (error) { + var stack = error.stack ? error.stack : String(error); + var message = 'Uncaught exception:\n ' + stack; + console.warn(message); + + if (!isErrorSafeToSuppress(error)) { + _electron.dialog.showErrorBox('A JavaScript error occurred in the main process', message); + } + }); +} + +// show a similar error message to the error handler, except exit out the app +// after the error message has been closed +function fatal(err) { + _electron.dialog.showMessageBox({ + type: 'error', + message: 'A fatal Javascript error occured', + detail: err && err.stack ? err.stack : String(err) + }, function () { + _electron.app.quit(); + }); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/hostUpdater.js b/appasar/canary/app_bootstrap/hostUpdater.js new file mode 100644 index 0000000..3392ccf --- /dev/null +++ b/appasar/canary/app_bootstrap/hostUpdater.js @@ -0,0 +1,236 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _events = require('events'); + +var _squirrelUpdate = require('./squirrelUpdate'); + +var squirrelUpdate = _interopRequireWildcard(_squirrelUpdate); + +var _electron = require('electron'); + +var _request = require('./request'); + +var _request2 = _interopRequireDefault(_request); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function versionParse(verString) { + return verString.split('.').map(function (i) { + return parseInt(i); + }); +} + +function versionNewer(verA, verB) { + var i = 0; + while (true) { + var a = verA[i]; + var b = verB[i]; + i++; + if (a === undefined) { + return false; + } else { + if (b === undefined || a > b) { + return true; + } + if (a < b) { + return false; + } + } + } +} + +var AutoUpdaterWin32 = function (_EventEmitter) { + _inherits(AutoUpdaterWin32, _EventEmitter); + + function AutoUpdaterWin32() { + _classCallCheck(this, AutoUpdaterWin32); + + var _this = _possibleConstructorReturn(this, (AutoUpdaterWin32.__proto__ || Object.getPrototypeOf(AutoUpdaterWin32)).call(this)); + + _this.updateUrl = null; + _this.updateVersion = null; + return _this; + } + + _createClass(AutoUpdaterWin32, [{ + key: 'setFeedURL', + value: function setFeedURL(updateUrl) { + this.updateUrl = updateUrl; + } + }, { + key: 'quitAndInstall', + value: function quitAndInstall() { + if (squirrelUpdate.updateExistsSync()) { + squirrelUpdate.restart(_electron.app, this.updateVersion || _electron.app.getVersion()); + } else { + require('auto-updater').quitAndInstall(); + } + } + }, { + key: 'downloadAndInstallUpdate', + value: function downloadAndInstallUpdate(callback) { + var _this2 = this; + + squirrelUpdate.spawnUpdateInstall(this.updateUrl, function (progress) { + _this2.emit('update-progress', progress); + }).catch(function (err) { + return callback(err); + }).then(function () { + return callback(); + }); + } + }, { + key: 'checkForUpdates', + value: function checkForUpdates() { + var _this3 = this; + + if (this.updateUrl == null) { + throw new Error('Update URL is not set'); + } + + this.emit('checking-for-update'); + + if (!squirrelUpdate.updateExistsSync()) { + this.emit('update-not-available'); + return; + } + + squirrelUpdate.spawnUpdate(['--check', this.updateUrl], function (error, stdout) { + if (error != null) { + _this3.emit('error', error); + return; + } + + try { + // Last line of the output is JSON details about the releases + var json = stdout.trim().split('\n').pop(); + var releasesFound = JSON.parse(json).releasesToApply; + if (releasesFound == null || releasesFound.length == 0) { + _this3.emit('update-not-available'); + return; + } + + var update = releasesFound.pop(); + _this3.emit('update-available'); + _this3.downloadAndInstallUpdate(function (error) { + if (error != null) { + _this3.emit('error', error); + return; + } + + _this3.updateVersion = update.version; + + _this3.emit('update-downloaded', {}, update.release, update.version, new Date(), _this3.updateUrl, _this3.quitAndInstall.bind(_this3)); + }); + } catch (error) { + error.stdout = stdout; + _this3.emit('error', error); + } + }); + } + }]); + + return AutoUpdaterWin32; +}(_events.EventEmitter); + +// todo + + +var AutoUpdaterLinux = function (_EventEmitter2) { + _inherits(AutoUpdaterLinux, _EventEmitter2); + + function AutoUpdaterLinux() { + _classCallCheck(this, AutoUpdaterLinux); + + var _this4 = _possibleConstructorReturn(this, (AutoUpdaterLinux.__proto__ || Object.getPrototypeOf(AutoUpdaterLinux)).call(this)); + + _this4.updateUrl = null; + return _this4; + } + + _createClass(AutoUpdaterLinux, [{ + key: 'setFeedURL', + value: function setFeedURL(url) { + this.updateUrl = url; + } + }, { + key: 'checkForUpdates', + value: function checkForUpdates() { + var _this5 = this; + + var currVersion = versionParse(_electron.app.getVersion()); + this.emit('checking-for-update'); + + _request2.default.get({ url: this.updateUrl, encoding: null }, function (error, response, body) { + if (error) { + console.error('[Updates] Error fetching ' + _this5.updateUrl + ': ' + error); + _this5.emit('error', error); + return; + } + + if (response.statusCode === 204) { + // you are up to date + _this5.emit('update-not-available'); + } else if (response.statusCode === 200) { + var latestVerStr = ''; + var latestVersion = []; + try { + var latestMetadata = JSON.parse(body); + latestVerStr = latestMetadata.name; + latestVersion = versionParse(latestVerStr); + } catch (e) {} + + if (versionNewer(latestVersion, currVersion)) { + console.log('[Updates] You are out of date!'); + // you need to update + _this5.emit('update-manually', latestVerStr); + } else { + console.log('[Updates] You are living in the future!'); + _this5.emit('update-not-available'); + } + } else { + // something is wrong + console.error('[Updates] Error: fetch returned: ' + response.statusCode); + _this5.emit('update-not-available'); + } + }); + } + }]); + + return AutoUpdaterLinux; +}(_events.EventEmitter); + +var autoUpdater = void 0; + +// TODO +// events: checking-for-update, update-available, update-not-available, update-manually, update-downloaded, error +// also, checkForUpdates, setFeedURL, quitAndInstall +// also, see electron.autoUpdater, and its API +switch (process.platform) { + case 'darwin': + autoUpdater = require('electron').autoUpdater; + break; + case 'win32': + autoUpdater = new AutoUpdaterWin32(); + break; + case 'linux': + autoUpdater = new AutoUpdaterLinux(); + break; +} + +exports.default = autoUpdater; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/images/img_lucky_dice.png b/appasar/canary/app_bootstrap/images/img_lucky_dice.png new file mode 100644 index 0000000000000000000000000000000000000000..909b7290936c50e51226b0661d686d21c207b749 GIT binary patch literal 6378 zcmXX~byySL_a3DvpmYpIj}REr-J_+XrBh&l!cY|H4r!25gDMOD{{o{@!tnbq2>zz&uyD*Fg;vazvg8NmcZl>UbSvaq{(2h;yQ zKWju>fq_l5y{n&*nUjQ!Dnvs4KN!f|?VYhxl7%fyL)Yw|=Rf?PMOPQ!Y+LuYmd;Uf zO4=tFCwypkwf1d#^<(P*J##-12?Zsn0UZ+yK12^>3y#V@!8ktii&8W6d1PdxsBWd# zl_)A_q-z-hMTE&fZRr?6Cs-%!VRrgk9%-)``=@Ov1XxjDr;k791#Hyr$3 zcGWTV_KjVF$1daX^gz(*yvvLDWpzX}p1=Rwjek(GkhmINS3`v31y2G+L=1krp=Sg^ zkr6tb3EceRKCj|V=A3+Dm+%05d#4zuGpv(O%o6mU`7iN5#R;E_58+SWxMh3~>c|Mc zfVX(Ff97Ur_C`k460hU4{sCf_@Pg067s8JNZ3|a#jfA3O{|6qJ`InMZ_%xFRNN>*zufWei_;=ur;}8u74WOwwRDV{VHV&#K8|_B4MNh%6JBz%HDz@CRf^<26~aPWWx9rGZ)$98gxS^=SH7B(;$HCt&pwf7aB zp&8S~RXvrhtA+JTS(WpRpEeOe)|>d%ke5^r~FOX{4 ze(&}BWA#4+GICEhLlo&ri3!6#GfO+z+R?{)UFS-`0-BT`(X^-ohX{K(+b5f!Eq5BX zsBcdre|geBoPm!3`7OZk=I>C8ZbH|9aVsv8pwOtWpo`<;G^>e914FN#EqcMUsG_xN z6jcQ@ql%lj38xNP7b4jql|l3l@M7rvslo%a9>tKXbytwo$g+Qsi=gLOpdHi zz?;Ub@OUv1O~FZa>|>g(TD< z%=)`?&{_RudJjVga5idScC&81uAR_Y%FwFa#^n40YtAJg1#Ujj?5O;H*af@S^ad13 zHh6CLjZ$^n@yl`(1F=lV?oa^fucY5yo1i+%(D*OQI?B=|eCD>oM3@7&+c$FhlPF|# z1@}?2V>|nTk+?Zh&Eo8(zzuT~f!4dvk!5un(@qNllbTbr&rfi3HZh!Ip2_Ktm+^X6}G36A5?T zAasIg*Y>Tk5kJ7a2UCqpEhI~DBqY{jdIBlu!oO*NsUfNwmNy?zz!YF^3wCC z&aJJ+YNCWgIXUNs>K;x@2c-Z6Uqxp-F6&gS*_h(BGP;%cs4#cJdF_%XR4l%I#tw9* z%Z6Jq3E2X$o8R4(%1HpYeUVWjSZQ%|Ik_J*dTeW!x5?j10LoeZ7P{FMY#LH)@%K7H zPFcOfvl2L)gbnTZVs{rzWVrvG|M*GV#$SH#c`E>usdfv&a84I(x%t~G>uDW%LdJF_ zoFV~VsgCw}k^A^%8SN(wVzo>#RBfa%aPbjCqNd%ezvXo7C5x2AW!ff)l^MYIYL=sx*6$rDy}4JUlje~! zZ|9}FnGYB_O8E^qTv zY{x#R>JnJ1%vzv5cD2gf!FhI;e6BwACjDyg+roCpBO&9Ca?s{|5J4HH=Y`+cV%2BZ zUV(IP<=SyagLdL?L0a5}itR-U`480CH=uxIWM5_SyC2hB01^`#l0X{VW9K|~vG1T; z&&?Y*MiS?KOtS{?e#|e^&<;o&;SH;g^)vutI~U{i8v80Uzl}Y6Jl0a7dK_FNz&Xz& zzbh7M6E8ITBfSlDUb@cS-hrH;x$fSk9I61FVw%Z_3|fJHy$$$tKd13q{6(r z5_0`iJjdI|Yuz@?RZ!FiPxlyS2!p62nDl+zNfUMX5W@#?feT;Dlbf(5;B)o~x>PSR z*5bB6{zjE(1IpPhEY&_gv=v;vc}a<*FGfD>t3-TY%zD1R>rU#ggtO__{vbI+NP?=C zXT?QxTCrB=vSdBST`-Xf1EXu|B7kaK&u*gvoMDFMNxIUlLO1H9zgkb0b?lCwn$2uR zD4QpHQizWD-1#ZVdLhBWT(lq;I{vV`?cUs%70Y7xm*^)io2IBGuo5qwN~XLE(7_o)V@f{-(W0p z^pR-MR>-_IdxN`4B5jR&fALLX!?(R!$#inREU^5 z|K&q3ou|~e>l=0I)IA4p_Cc^Uy3QPHxQ$eK_u`KNIa*7QxAD6K;0ZEj7tXD&4xZe)7Q$XQ_6=T3|yD+Z8;nwcFs02fd>sA#*EI#{Rfd_md6sM0HP#%_lg=dl<}<<0 z)0PII`}EQ^iEIvC-|!CzOIe%jwg&)Jv6(*4##;TzxAoE)h!!2IU7Q7E*s|JKIwN*} zxQb?X`8|=)b5}S_6X3EEEA&z%td&?$@hl*&&`XyJRx^hp%G*=>eC{wc&M0)(IX98h zJ5R5-Dx2f4Cc@{ArReW_j+KW^-nsGz%qY&Lt1o&(K5>ZhHynMa=iMVKiNupp;c_()_XfcA zLvllGred$n8t_g^+_mQ~S+&yG@P>^v<8+G#dvnUhvn6$Pb*j(tAZSAvUsX}Ky-Mw$ zKBadrp51?;_Q*GY$HTL6kQ%l-u=GZ-@$z`-4La$~{N`dk>UJ>uI+T(}>Q~Tmpx9BB z3wm(>EErU$@{p@Ng3{sk)Ms*=m{OU2E5yPcHP;u3SWCK(%|&4n?!Jo?FT63oTXmI_ z&6+eK=JI`Qh$%d^r^&kVq9I)_HF9q4Sa3a`TxQw@*Fa{m+mfy_Kr4OzUknyURD`J$ z*P{7G2}y}x3cqz)#&0;=Kgsg*U0tUQ=b}l(Iv+3+raK{TM7wiW8sP4WnRwxhDVYa% zXXyP{*cD9^_qn5mcP~!#TOni#!o0Fb`9aw0E%fA%usZDsnUTAin2?P1rsAEUrWvFz zxyTf|Kc?8DUPTZLCm{$;AJg|2s<&wMAPIb;5MXxy%ZXhc3y)Q6H$u0=NDq^zF*ui+ z_s*_$qZW0N)U}TV2T@&Afh#@Z9hAC zd(AbSP1B%zzgcK{y@f|?cOJa1@6ewi!4E3ay=%LNXd@dTl?P0%EB8)L)N&{ZfklAH zHJYN_r%bPVH4>oHp#Jk_sY4nk$5A}hhNf;34&IyC_kVu8RoDt#>B2x6Fs zY_h{fwX@PAMZ>JD*l6Rv_|Nybfte7sL1H$@gpS&-iTmXo>j6=kH!Nl1#Rk=mXi5G{ z@zg8hHxy~SRQaO*ztf0=S=1rY{#I>cjQQMzBNBBT->W?Ax`Apx<7tB^f$P~&LyYy- z9};g9TJ`)u_$T7$dVGwg!UU_do{|R{#oF)W)V#2S^Q=JFQZyM^-?LV!V#cuUxWHby>#*i; zDki#-zL6LH?(f+N)0hM2>#k>mEDNseN3bhF-Z4@=U0}(O7;TBHg?$>01u8pLk?3o-QL#VD{&ol0Qdt;I-Sbor zb6FIs33O=CuR~IpBuqS;nlqs;m%znY(WnHMJCbyf0w^4l4ASD?CKod4wrMGnBzq|+ zcNvu=nc1tHv`pL9zj%}os){irjFWL}*&xr!S{A@mQu9Ig4r`!Bq*567xKN{yk-?>CXN*c%DY+!|`80WXSC@QspER-T_PHjaJ26_HD>vqda*sSl;n%qTg2fw#xb+Dg z4Oz|GiUQ^fwi_2AIv69aID5IL_is_|ePP)>h9(Cu()U*S9Q{m&`&c^G3ucG5FVLl@ z$RN+i>U2KPjohzA+nmc?r@mkC^JP`g$ns*iRwNM-6pdUMtK;z=O@oWdIUCHH4%Ba`Rq4O(f_pi}vTN|n-#5Y-O{H+v!7O|Ie1xffPhGxX9p5QfJsR3yJ4f|J*|?KNN;s^k=)&qMX$rWy{o(qvTB*{G**uT zE+l^?=Dc1=k6b4kdfCjrQ*1tAztt<_r?2j5Q0?V2gt2_| z>;q>mth~lFR7;Lni7vACK-L>(W%v{gdtT>XO}TR$>@T2C=D^?oJOU^o$aat8sGqvn!@ zh(wENDD!aW)H9)YD&0xMh9Q;sjgqplSrpodkQms+XqI!;i`PD8T6ZIUTQFw7!7&td=(v6 zEP$VACtuElUaW!~L~}dwr%rR`8J*UcWKW(zdron}6!;>aIkRfMvj?rnv4cjDvG<{$ zbucoaPA2YWEt>n*lOGGi>kZgNN``p6_H2WALV+mrV-%F0G9^liA9dpV=j2WkHJ63) zrcuT$Gis(vFElb29`|r1%CZn3;wb%duTrujZ>!(#AJDI!B5j|@;!HGC` zHe8+}74B8N<_;{i+OiEXO$DO*TnZpPYUA4_>kA``xRX1STxQLB$Gxml9mRQUeH~vu z^`yX0cWCZ5HIp^H>~&mu^vm`}BN~FEwzW3SHJ)chSQG;2_TU8FDX(6MW$X7YPvg?q zDIW!npF8BF&0Iv*IBnWFm{azADN7Mm*u1QD9FG!s3LcfoKzXs4q> z5vRgu!fS;jzPkO3Fv+`OIA0n>QKEhg21>zCJ#n3>_}Y2+8soFP4YO2Zur~FQ%0eS?5kLOP&im0d0y5?~5=2#X zT%kcsH-RBA!OVqmQk!tiFxg-gU`C+F4r$RGQC_GM>)2tRbQPDfz^nCS)s{~PV_8=< zDU$8eBtYE?xpK=VPYfsdqBWCWoPab`n}!Q(y8vfPFD65MzB9KUMl}fQ!6qLFm+bkB z(jPt^d{LnrAQNwZJk_YAK{t z4{Yj9i?QV&Iqq$jY8mh<^_K~Suf@9ShQVWGf5krYaZ|ir@~{Imq%XPDt@bymGooUi zqoAF>I9wuJ#fWTqVYMVnn2=c3%+K9C-vSY<a@8hlpI7L>-N!Et2mvzCP6QNZSfpeXH-! z{Q%)W{smths(JhCI~zCA^1c)5ohV0f3;Ci8XBPLfIFWyw0lY;+W*q`CohGb5-M%h? zzAx|hE9f({ZIDScyB4*ma!d}H^u+l0<_ijq4lcv;r|CZn=nxT literal 0 HcmV?d00001 diff --git a/appasar/canary/app_bootstrap/index.js b/appasar/canary/app_bootstrap/index.js new file mode 100644 index 0000000..95de9c4 --- /dev/null +++ b/appasar/canary/app_bootstrap/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var buildInfo = require('./buildInfo'); +var paths = require('../common/paths'); +paths.init(buildInfo); +var moduleUpdater = require('../common/moduleUpdater'); +moduleUpdater.initPathsOnly(buildInfo); +var requireNative = require('./requireNative'); + +function getAppMode() { + if (process.argv && process.argv.includes('--overlay-host')) { + return 'overlay-host'; + } + + return 'app'; +} + +var mode = getAppMode(); +if (mode === 'app') { + require('./bootstrap'); +} else if (mode === 'overlay-host') { + requireNative('discord_overlay2/standalone_host.js'); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/installDevTools.js b/appasar/canary/app_bootstrap/installDevTools.js new file mode 100644 index 0000000..2eac121 --- /dev/null +++ b/appasar/canary/app_bootstrap/installDevTools.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +// used in devtools to hook in additional dev tools +// require('electron').remote.require('./installDevTools')() + +function installDevTools() { + console.log('Installing Devtron'); + var devtron = require('devtron'); + devtron.uninstall(); + devtron.install(); + console.log('Installed Devtron'); +} + +exports.default = installDevTools; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/ipcMain.js b/appasar/canary/app_bootstrap/ipcMain.js new file mode 100644 index 0000000..f63ca5e --- /dev/null +++ b/appasar/canary/app_bootstrap/ipcMain.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _electron = require('electron'); + +exports.default = { + on: function on(event, callback) { + return _electron.ipcMain.on('DISCORD_' + event, callback); + }, + removeListener: function removeListener(event, callback) { + return _electron.ipcMain.removeListener('DISCORD_' + event, callback); + } +}; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/request.js b/appasar/canary/app_bootstrap/request.js new file mode 100644 index 0000000..81fee0b --- /dev/null +++ b/appasar/canary/app_bootstrap/request.js @@ -0,0 +1,131 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _electron = require('electron'); + +var _querystring = require('querystring'); + +var _querystring2 = _interopRequireDefault(_querystring); + +var _request = require('request'); + +var _request2 = _interopRequireDefault(_request); + +var _events = require('events'); + +var _events2 = _interopRequireDefault(_events); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _log(_msg) { + // console.log('[Request] ' + _msg); +} + +function requestWithMethod(method, origOpts, origCallback) { + var _this = this; + + if (typeof origOpts == 'string') { + origOpts = { url: origOpts }; + } + + var opts = _extends({}, origOpts, { method: method }); + + var callback = void 0; + if (origCallback || opts.callback) { + var origOptsCallback = opts.callback; + delete opts.callback; + callback = function callback() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (origCallback) { + origCallback.apply(_this, args); + } + if (origOptsCallback) { + origOptsCallback.apply(_this, args); + } + }; + } + + var strictOpts = _extends({}, opts, { strictSSL: true }); + var laxOpts = _extends({}, opts, { strictSSL: false }); + + var rv = new _events2.default(); + + if (callback) { + _log('have callback, so wrapping'); + rv.on('response', function (response) { + var chunks = []; + response.on('data', function (chunk) { + return chunks.push(chunk); + }); + response.on('end', function () { + callback(null, response, Buffer.concat(chunks)); + }); + }); + rv.on('error', function (error) { + return callback(error); + }); + } + + var requestTypes = [{ + factory: function factory() { + return (0, _request2.default)(strictOpts); + }, + method: 'node_request_strict' + }, { + factory: function factory() { + var qs = _querystring2.default.stringify(strictOpts.qs); + var nr = _electron.net.request(_extends({}, strictOpts, { url: strictOpts.url + '?' + qs })); + nr.end(); + return nr; + }, + method: 'electron_net_request_strict' + }, { + factory: function factory() { + return (0, _request2.default)(laxOpts); + }, + method: 'node_request_lax' + }]; + + function attempt(index) { + var _requestTypes$index = requestTypes[index], + factory = _requestTypes$index.factory, + method = _requestTypes$index.method; + + _log('Attempt #' + (index + 1) + ': ' + method); + factory().on('response', function (response) { + _log(method + ' success! emitting response ' + response); + rv.emit('response', response); + }).on('error', function (error) { + if (index + 1 < requestTypes.length) { + _log(method + ' failure, trying next option'); + attempt(index + 1); + } else { + _log(method + ' failure, out of options'); + rv.emit('error', error); + } + }); + } + + attempt(0); + + return rv; +} + +// only supports get for now, since retrying is non-idempotent and +// we'd want to grovel the errors to make sure it's safe to retry +var _arr = ['get']; +for (var _i = 0; _i < _arr.length; _i++) { + var method = _arr[_i]; + requestWithMethod[method] = requestWithMethod.bind(null, method); +} + +exports.default = requestWithMethod; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/requireNative.js b/appasar/canary/app_bootstrap/requireNative.js new file mode 100644 index 0000000..c18c0c0 --- /dev/null +++ b/appasar/canary/app_bootstrap/requireNative.js @@ -0,0 +1,5 @@ +"use strict"; + +// require(), with paths specialized for requiring only native modules. +module.paths = []; +module.exports = require; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/singleInstance.js b/appasar/canary/app_bootstrap/singleInstance.js new file mode 100644 index 0000000..4bc064d --- /dev/null +++ b/appasar/canary/app_bootstrap/singleInstance.js @@ -0,0 +1,131 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.create = create; +exports.pipeCommandLineArgs = pipeCommandLineArgs; + +var _electron = require('electron'); + +var _net = require('net'); + +var _net2 = _interopRequireDefault(_net); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _fs = require('fs'); + +var _fs2 = _interopRequireDefault(_fs); + +var _os = require('os'); + +var _os2 = _interopRequireDefault(_os); + +var _buildInfo = require('./buildInfo'); + +var _buildInfo2 = _interopRequireDefault(_buildInfo); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function deleteSocketFile(socketPath) { + if (process.platform === 'win32') { + return; + } + + if (_fs2.default.existsSync(socketPath)) { + try { + _fs2.default.unlinkSync(socketPath); + } catch (error) { + // Ignore ENOENT errors in case the file was deleted between the exists + // check and the call to unlink sync. This occurred occasionally on CI + // which is why this check is here. + if (error.code !== 'ENOENT') { + throw error; + } + } + } +} + +/** + * Creates server to listen for additional atom application launches. + * + * You can run the command multiple times, but after the first launch + * the other launches will just pass their information to this server and then + * close immediately. + */ +function listenForArgumentsFromNewProcess(socketPath, callback) { + deleteSocketFile(socketPath); + + var server = _net2.default.createServer(function (connection) { + connection.on('data', function (data) { + var args = JSON.parse(data); + callback(args); + }); + }); + server.listen(socketPath); + server.on('error', function (error) { + return console.error('Application server failed', error); + }); + return server; +} + +function tryStart(socketPath, callback, otherAppFound) { + // FIXME: Sometimes when socketPath doesn't exist, net.connect would strangely + // take a few seconds to trigger 'error' event, it could be a bug of node + // or atom-shell, before it's fixed we check the existence of socketPath to + // speedup startup. + if (process.platform !== 'win32' && !_fs2.default.existsSync(socketPath)) { + callback(); + return; + } + + var client = _net2.default.connect({ path: socketPath }, function () { + client.write(JSON.stringify(process.argv.slice(1)), function () { + client.end(); + otherAppFound(); + }); + }); + client.on('error', callback); +} + +function makeSocketPath() { + var name = _electron.app.getName(); + if (_buildInfo2.default.releaseChannel !== 'stable') { + name = _electron.app.getName() + _buildInfo2.default.releaseChannel; + } + + if (process.platform === 'win32') { + return '\\\\.\\pipe\\' + name + '-sock'; + } else { + return _path2.default.join(_os2.default.tmpdir(), name + '.sock'); + } +} + +function create(startCallback, newProcessCallback) { + var socketPath = makeSocketPath(); + + tryStart(socketPath, function () { + var server = listenForArgumentsFromNewProcess(socketPath, newProcessCallback); + + _electron.app.on('will-quit', function () { + server.close(); + deleteSocketFile(socketPath); + }); + + _electron.app.on('will-exit', function () { + server.close(); + deleteSocketFile(socketPath); + }); + + startCallback(); + }, function () { + _electron.app.exit(0); + }); +} + +function pipeCommandLineArgs(noOtherAppFoundCallback, otherAppFound) { + tryStart(makeSocketPath(), noOtherAppFoundCallback, otherAppFound); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/splash/a934ab008c7f6a2274ec441f6be0696a.woff b/appasar/canary/app_bootstrap/splash/a934ab008c7f6a2274ec441f6be0696a.woff new file mode 100644 index 0000000000000000000000000000000000000000..98aa23958fa0ca00f03fd2d00400d0307ed12e43 GIT binary patch literal 15488 zcmY*=18^=~&}N+6BsaEiY}+<&Y}>YdgEzKq+qP}nHaFkDyS24F^~{-mPWPOesxw`E z~1QBfrsARu719~SEeII;>XIby;hqCcF|kB;{P z0$>s#FtNXKia%Te5D@eb5D==FXQ3jJn4+>E5D=`^e>VTYD%L4lPLYoBhx7W;Wq+W@ zB+m|GXsvJe!%h77UjPAtXnY)w2b=0U{%~+DKQ>VR;rkm1)YQt|-Ss2m)Q>q1jK^yqvQX87*Y&$)y&$-?T4fPdA~Lg5a`a^ zD($V6t>KRyTg*?pw?DWmkx5>&)_419mm}!^_!0n10u9;dTO0py1wS@=KmM@_vmFO^ zwvIpF&jt3wdHisAs*%mYZW)GpdU{4c0r8oyAp~!KCF?jMA%J*-!GA3Ot25Hm+W|HB z1%aSvpa<4>%|8Kh#PIVy$H0{T)ilLBXI6ASU!*Q+Z|-qa}$xm zu_=imx?NlbN5npcmGZ-^<|}qW-5tcfNrVr^Lc0BjA&`J}tnV4-nFpPDK#`^lKAZQN zQ#Z$KN9!x#DEBCvMO8z`Hq}O^0Z%tktx0;ytu>~C-qH2bZtv?2``otjTeXbEnUW>tjr~#C zgPbQdMSR*Ai>ca(Gu_5G%EV_qZNw{SVO75VkTVdb!fDn@51 ziorFbR(FnZgni(h-U+x33Sc*casRxcsAqLFAR$XRhNv?9(kaCFv4()Ulad6OA?;d6 z3a(?hJ3uufyKc|5F~fKA(+3l)mwfTm2wXYdKuPG>hKG9=~UL7uK&4n_Fe5> zsHGd;RqSoWHN4Ts3}{qVD6k?^A7`(;uns_odd0jkRge_nE zVg#l8y0^Xuvz&Oel!AQn>bLkRBF%^>w>{OhbzN2>oC#Yk-I7j^dK9;j51NIMF8BI? zO|PUb6eRK+6E$J!U&^pAG7TO7G9@$S@!JsZ_V%rPRoA5G6E7XXT64n%d3OEb7XLHa~S~!T6 z5Tqq&uJq}APnE?{seTCf2u>h0_XSK>?!=gT=-pm)|Ft;fJaj7rA{E=8v78Htv` zHT5=aNXLw*&j_RYh)9klv~k~Fij^{N5olDJmWhK}IFAr1F?K|RF#a=K{9q*gZ?pmQ z?ZMxwJKiE497zzZKP`fG!8_0_7KYeCSdBtu&+MQ&D%zn~mD|aS9VB6oC<#O1>#?Sg z3t>s^HD)Ya>9DP?>Pb;7XkwO#QT29CJM0ld+k5i0qOz(;aIfisw9|7@oj;h54g z9I|dfQs@MeS3Fa1q0fhes@5mCds`K67#DMT(r%&9ErcRO9c?DDBgvFHcj`oS;<_m& zdHt6F3`42{_%5yL+U4p+nh16T`;~-VKo_vc`btBphgXWvp8`ZqHz-G@#mfM)$Rqc2Oy?eK?c7- z@+{kAp}S?FLr)xH2L80+JWkQYiD#0i=}dbgd-51L9Yg=#;% zwN`GC$l7uA_KQi=QtXmdz1=8_D*AQ@Uhz!QNr>3i*+$LVlrLX~UF})tZdx1EMJBfr z&;@RQyQ|CY#LCpH7ivRdFZCsrsEnw8Bmq+`gC4;uM2bgDnwFn*oY^^mWK z_9lU^lV_>VrFq9SD(+l`ZY`~44$7+6L>m-Sztpc#L}b>v+5O@&j%AM+P$$L{*`sD1 z&r7#w>?NM_{U?@OvtIIeChwFert0p*A}gA*P&K8RjvMxs&v^ooU!ON;V`>A5Vi;+; zt{{iB%s%fs=q&*>#HBake+!4Z4Der)v;+5Q_8&^Hm+`R6;E9HS*>R2 zj(=}aoeE3>nAklAg+H!YJlq*~30B;MKMryfRvelj6<7k1xaciWC$3rsoZ4?-pdUA) z00;@5_*LV|eJsP$(QnkJYpo#Oo(#%GXmf_Q?G!titEK=@uNeLAh)%}4x%8BEF+lHqI3l)D+WDxh^Vo4-eb9r=2 zc#b+QipU&IV*KRQ^<-6O8qXt3csgD@TVy((07Gm#{^XTZ94AIPzzB_Fe}2w|dMWe-fxVR2hPBvp_<8Wz!Z1)mw`WahR=a*5w0FCr9S~yIOK> zAs|uaszc}8J~GlUfxQ|GV?|ANjkxg$gP1)XH;?NxPIbwR2a~mPT&KtT!v#^HYFK8;y9BOc+H(QOS#XkaZ#<*N;i4VKCK143l;X~a~xdN z=rR_uvJ9l-3k_(nw^N#1O|l#T)037}m`yyvrws|Iq0vZZ5#owwWRm>;WEsI}d{k3cq+h5ZI8%ff(HQCxl z&Ah@_ys%S5D~IIna|aiNAG>QChBnS_58>a+xIM%00-?9}EwqOXXqgdb*CDw}IW13M zFAu*e6>>X&wX@cZrOBt)3Tb?EHHp}six7@2r18x1l`z2AsS6K@r1Krk95FR;h<%y$ z(!!WI!&UMU)y3WUFNNAWh(}ERaeR?QM>RNAIkvNKAFQkjrQ65etk^nvbHiWIOmD6A zuJRs3aa>GSBWf%R7W;SHsHTT2$An~*a!vqW^@r;MVij*ys=;L(`;O)`R>xf?YFy$K zFZG({)gN|5?jZDzRxbJ@<9PTECQGMv$WdC^Ud~3U|yP1`Y;_4-x_Ew3kVBH3djmb2*~vE_e%DP$V-Gt zgy~9%OGrw{N@$J>Q3y~dKQ2Uncc*@RL#CDX)cEP+&QOaD5e$Lls5kQ0M=@;rrIAz+ z`s48R^Lh8tTdlYpcr(T%61dZLQ4>9`4Q#Z?De}P>{d?A;JDWBEtMULxcT2 zWF${yXs3)oH1E z-iB!}&4*h>kJSiOy6VpH(ylfyQz3_~^!aN{2TME>mL_Q~hle)+m#gj8+U;vkm?^AW zme1!?&fZh!@Z_cpPp0=LvPZG>C!_mQhC1Z57A3pum*C-Hgefr0$YADA2Lk@-M<73A zB~M5%CFQ3ZuIE_kwFx6e8ej#|c%wPc)Cp;i>rUyhAo|l^aR}x}1>q<#IUsE(v}j=3 z;9!G&;Z@A4-2c^nB&uIcSB)cjIHv^tA>MX(6|QR2=?l!PF7c@4;vU zDg;=7()b_jock2ts%l{~y&+=~gtl^Mkq@sLkzxllV#=7LtD7{P8k!u zF1BX7r=7D_sspa0q=`=557WYr5RO5|DrjEj=aK%gz{F@JJf1TT$g5Z}_5wl|C+v@i zjD5lu_Nhpe(}z0p_+nPD2CQjz{tS82blGef2LeQDiY3^ZQ+LNY5|Xh2?0%j`tW3PM z`Tc{i(p{L#{=ls>EoGTBU4dV>3hr*y6*{XF&*S(H9khSebyH&#V`QJ+%`P1eeIbP` z)upZ}2V-piZ5|Xe!($M^vXB6*QO9Dda!-_a3Q~}z@0~Ir(fQtpwxy#8n!Px1(fbAo zOqsKG7%lULPzJdFwiIMV;SR%8Mw#d3=AU~ z$cXlZJ970JPk9pckirN;xjb>#Awq50LY`Thm8sIhk&lB#c#Z!qogeAC?1kS=$R>7q z+7}yY8XMUgNQh<3Cn2C(M0l0C+4mHoEfO_>A92H#Y}i4jZrE8Qqy*CH_Y&ki5+GvNM^^DAa9sq2?0S;^*@McD& zSNWqC&_HI~C83e;7`$?*Y8hoH_xK@_IViWa3A84GXf;5bW8+K=~o|E>$f02 zrRGeR*}w{azf~w;p!5^d81pY~RA7n!TB_109Q3Tz!oMY6bqmMAXcUDBuN$mjL7rAz zEWSZU(s9fE2u5cYUC)?p+#uSZ-=s=>6GNMn!|OVE#(&C8e23f1P4GbvqbK<43%*XH zfWKJ>-QzL&_~3VCQ)b8Twsk_@9Yua{v`s+ogPCo-f#YzxwMNAcG_@FFk|BY&-^zeq zexE0L9PWp`iH3fDSSE>I$W*OZYjs>iy-&Y3Gj9d;LBQjBWmn>*4e~pl%IurwqLAV2 zaEtTgkc(o%P!_Mnx*1MGgON#*ZJAc8=5V$C zol<2$m;rNG3i@g=G+q&IUjma_PbC#VnNi*)7;WsUPeLy|H&=#mf{-qXZbdcTH;)ajzWfd zg`%M4rDIv4^l{v+7fOq+FSI&MZNw?AG9xb-2AbhZ)f#x_c+&&z>Jwk+=M=n-rY>jp#7rgC!4Ij!yG76Qw2lbu5AIzIe9yp^rY%?_SS6HIh`oxtjL zq;*RmlIq9dcLC?Zo+|&A-*+kwn*UlVy|h(B`sUcG(ZkKN2$Vz&Z!VX}cSS!w+>|6Z zEncS@fFuts_D2_F-7x`E$7*o&L<{0^(`>+PK3=1DZ99Gc38|0dlHlHz8vVwkhCuE5 zSNs>qw}|e=yYj|^rjP32Ox_lg`=*9K9A0UY`$W`DuAdva>eU-M`fSnCEZ#Yi4GUZz zDITECluUZFAl-pxG%5Qen>?IgdYsDDe#kSvp2QQmrH+`%!Y8;*(=CRYmX)GcWl437 zvC21b(I=@Rp^~F5E*93*s%E9=NA9(-74hV)g>_@u>2?Kd=m7nlg3Y+B#lu%iPC1N` z-B`-d&hDh*R?_$q^}D&leRxsz!R@Jf{e5Ox?1_6tJzMSOLO$DnNI}_4$!02CGvJHS z(?$FxuIjSc%jcnJ^PcDkx9bvY!ozNQ?9zVk72MFPCX_oo<3ayxgn%hP{SwA#I)HOG z|IFntdp#X~oaL4WfSZyUINwes!8B5J2QpIigZ(%9!~+YQQrskcF3Id((E^419{x@L z63g?4y_x!R5sT*d9gLLFS$UZS)tS!KCCM-smWQDX{PQP`494UHN3zIaPe`3cz;UiX zOV)lx9*zMlAqkAiCFk2tRiTTB)O+6UuE^%)Qo!-m+P9a6SZ`LgEBdVWA8#YlT-9)p4C>z$+$u6W})*-U((_14)6V?So~^}Hks#Vh^=cW>&mel z7BdFvIjo)EyB2B`UawJmicmzu={i<#8Q7Y>NXwpzVFi}TqKUw=(0mw|7jopPUe4Pz^-(l?qg+i;0Zm&0MiHobQW4-GdH`FNEQzztW zBpWC`c@hIs5F(tjwipQInAIkXCn#|2nKd)NR{QEP_L`YtZfnVD^OE13DauOvuPpXE$?$5nB7`ET#@bh$lGYx@x){4nf1aJ6iT^) z%!*PYZ~Z;XQEkDN?}k;`#YB%Lw}Bs0bb_)ITsi&-!@=hm(K`Y}-GCGRhRCOz(QR~x zOL+}gYH^j?0$A5pdc9ww5<48=BJteeZ9Os8I@oaE6g@L&_&MYVudG>x=9(Ze-(k{z z1-s>F{oUe=>`2ZfDd^&aZN(4S#XIz7bbl$i`HIa)&|&x(ySbsdiMUy~FaGoG{^#YG z$J1wvXcRTW^c^prDxX|kdSUmYDbaWeS?GMtwodgMuImgRg_mp?-T8O6X-hK0hR?)$ z{^8;{VZIW@50R& zET76`xXC0=Mg>!Hb;87~39L@(8Ak~zCkOuu&_W=0!4T1-;nxMvMZeE&?O1W0*?W)AG@q;nRyw?Q`E|Me)uC{6 z3RaOsM|7=1HF5A)p-!y^!%Q_#=g=#~yfYI`BVlV=3I;x*RTbJ(%N0fqACkL$XjU(C z-wHocS-;~s@w#DeDa*u(ZV^12{e2M>|7apV#PF0~8-fNqz|9D<{Hu9n7e*hW2`zs0agZpx?r}1|*?@cc<=p>E zUMkUm|Ap-(+sh4+uifszK`S4(6MA}wxDgzWu_m@c1J;UeI7NkIOc11R#IZLg3l}tl zd$&D4`X#_b9&uIqpCy(A#-4l3t6Jm{0HYah!q!~+vNm2V`wj_fJqjA?cyRU^6YpW+ zCQmOo86A}g$1)6&7^}yuPC(_TNx)zOgZ!upeFwuU1W^%c(JG$G#1Y2R7>&Xsz_5_F z5Vtk4{fUNL`($}@!N65(70tM0jD~K~!s20hVNgjVdHLhep*ylA#x6*k`;EzK)B!zH zYEGFoQTYK8N=HiHr`0~Ebv;&7vAczZs+FFL*LZmlkS;WW7;H!SJ*J%abaww`u;Bq5 zMbBCMLN%M;AKUkI)riftUVq@ul4`u@uDr@{L_?)&9cA0Zes(d5CZ9}^!4^vjo)~re zNk|<5XpS^3uuXb7;yOdG)>hNAXQysGB~c$O6k#b>tynMW%)xNq-RFQwFT)~sqa)M? z#;Idcu*~tVqH5FQDkLy=!;y=t+ZZBs|BSn0DPQw=(^Ss1=iuclJE!-V(C+qGZL&63 zH8K6i=$|0K>>hT7dh?`*pp7dth#}1+Y-w`r`U1zCoV0}Y26k(-SWyuLtq5w9YZgHqyz;40le-y|JL+uTY3&59-hE1p$0^zqT^s9r|n!b!4U4xF(Mf# z&R<7YJiKH6F&jHprtaa%FX+>~(fUY@F6;~CLJJmw z@wHDlOyd&3sdCrSq!8gO;ct_#fy00oQ*~j( z+61Fp{k=@+{;hv zE+s0=qdHLnEYh+Iwaa)-c~5gCax6PjD=t1RUB?5F5w{ z)=Y}qD9L^=Whq?pJ&mZk&4+=BJZ!XmCWD*co7VObx`C{({8(wY9835!@1xZ4{eT}B z$@)F_!x%|;nzfG52*9}F+<;8u@c`0Bc@LY(4*1*J9X0s9Q$%)o(Y0Od+X;R`< zh6JVzOA58n_|d);Mt4OaQLh})#KLvh8 zDCZm92#=o?PJMc6CQ)m&EGvG!+}`6;!r{IsZO9RaBPrRL2NtvV6bOH zb{mvX(xKs@*^B1G^MrI^7^1=(vS(emwGPF_0c*GnF{h)CS82#V^wcJ@jkObc9XpTN zYI&$<5t49lh{UdUn$`OV=z01x+4=i8>Ngb$C1>qQdCfC9;igd|F89qETmjGGofuQD zgElt8kGulzYEyRPW8q@#hWthHK((3TIm1}daigcs6*gL&*6vOUK2!Vp&>Y)Co#D;DKSX;64&JyI=@Uf8e@9>5S zde~Ho<7yP?Vt_oK`GTTe2)Fm+*W`uj>my}%Nyh?RgAR8Ut*Y7P93mEu_LWxg)k5vf zCWm=Kkg1u}OR8f8=ayRw9$I zkp$n;_VYgbkdI6)h;~Z0F;TzxF{j>cB(b15BxwAxG9{}Ut`1TTohF_}$3v!A)E7?qZ4kj8Yc z$J4m#Y`&H4?tk98a~;n9UU;m=_U5agE-R-hqYfy<+J#d3l^#)mVaSZSwcnreq0fj7 zHr+Mi>%$O}X%4cM4?luPn=+12KDDq!(!22H4&_#`L%K;6%CIiJ+zReXFzzsX$ck8VcW<+I$r z<#g_(<~1LfPCX;^h4<%gj#6HgbQZd8gUOKWU{f78I0sz>H*sz+wU_nXcEhA58Z{H@ z$kMJdPCR?f7GFW&R(u{ygvoKeHE~TqZ2KsoNY1Isv^%E#QB+n#0d@AqL?pBAZZ}Y? z=0h6T2_QThKR)T`oX6MZEyF0n&U2{q^=<*Evi$oN#>>xTI?!0U0aTBvj>@aX)AaC* zOZ9q7-u^k$?kPR`bK19`Hcwh@7RJ3Vky;L+-1~mV`Cs`_i+V=lI|MD^wHdd0K^#0* zGl45N|KEVolEgTJ)I^dCJ9|U9>yYv`PqrX!pY55LPWur&T~riZTqZt|Bm_JN+eh0r z3;FNGbTnt!-_8y2ze~MC&_IQ;t-t;xCMHyg5JP4hU@`diDmv@5@HQNOQM!&7gng4ImU9 zH?2V*I+Zq`L|q-Sm{L zC-(K~Aejc7wFw50DD^)}7i{XqsXDnd343vTh>x zwy<|xB@R6?Rxq#%Jj=?$ZBXH<^^(EedAf^glNhudV^Tprsy1QK9}Ft1!BTt(OWeIo zscu&d-6ctDkM7@z6@!*fTCiC(=C4KC*u9BhyXtJ&?3}m=u;<7ZVu^*TU7(LmfHBzA z2VtT6#{z|3Apl`{1*WDb6cMJ^DPMI0a1s!(@%{j4v7Up(=bPYmkFUS0e zy!$=y(F0cYE$JNqv-Ar>iYd&3g@vp_{os^RN7nC6Mbr}Fi!_)dG?+v#hYgrU3PdAi zFX83}MI$7?ZcsH3hk~LL1Av7%tTxD{FnFKXS7fXD*hkAw>Gf6h!32fQ%JaBpY4G}v zN{)`VPwYMsfA-|hq;yr9Cau`H9X7_D8}R+dqDjrt8`SvU*;NoFw;YwoRpLv!`QpD= zAsa+XF{W*)%Fy@D!G*qBPxs%Aj#Zwj`<=k?*QiulSIy|+i?oREyvZG5^cS$*9*mC) zU^{T6s*w=Fa~8q=Zd%UET`+?5Z5yICC> zvPDYRH%6l;(=U~LXGn5PQqbe1SKz%IT3j^@d#|&ITIHf^?zI-ZDpJh*cdTJ^)RM$p zt_Mh~!)H$dhAj5+?iJg8eF7S5Tdrp(-w9M2I^0jf!&59mVo|XF0O%vNLgbg79ai5C z_2sTiBh3cX%)^~|wrOQ0hAdykcZBjR^V+_Vs-MpQDssA|@7K$Uuj;Hd;G8&?Qka;i zjjWAd1fit~_BJ;qnTio)^o8X;yXO2SU^yS*0MFpU_;nb=nCfS9Xc;r(khrVO9!0InmM#z?RJ!C6rukmL;sET_D?Z)iM|Li;vZ; zy_NEP^Gj`CRHL6$!ED#Qyi_!L`p2|yU4L$merpdtJEOu-A=`?o8}mRvP<=HBG8Re+ zpe|J^-qNBLN^C-xE?oxnGqEpd%7%bv=VN#?Ktwd#Zg4pa7fgl1$l}lCXGh^lcnwLc z5r$0>mmz7pNCzcPKcTZP;WLrK$KFGCBqsC8D#pkN40FBR03f>+ejG z8K?Nef0x1X1R|ntZCA7j;*!9&{D?UwV$ zCyT`XKygJ|-^Gb}No`#*Fmps~X}qT;?TN9^w=rE{zao_rYl~cX-i2i+ACQOlL1!-? z$_`qk?1nbKN2vWEK4ix;Vkhzip_K=k39Q{s9yxz~B{iDTYKLdUe*DQfRa%&jIb$2s zPAOT%SG4UJp*bLC$Qzr5i`1R((|;-n+ym=GZ4AxKgU)LhG825S8N&3|Y^N{T!H)cd z^gLqk0g)gL{b!Krk8Yo-78v@tI;l(g#t9a7$!zpvb^<~oI8y9^)UHGqb#duvwTqd$ ziIA?uew1duA%!!`D!9dXKvtK^_f(74HRa-1Qp<=#sgSa|dcyk5MKvH=m{5oiMy>hG zXM*9A(LlYL&W2g;Y#MxWAvfRulv%sY16G>MF=9)Q?0d z2YuAboJW@CejJvqt&ux@?X%Tr^*S3OLC>J)*6%Z6>O)X%51~P6l8%;z=(Hw0SFsw< z$@r*tpWvla$5czY#uaB3jJkI0S5E9$H*gx)*y<9yOj{r6AHNG3;}#jU72V&+!^3~e z%p*Ohy#?_?e{IIp<`_QK6IaI$qt)@aSf* zeG5FJ$MKYKwG;(uJhv2d5vij0ryCA!AK%DMx=9e@`?XI?qX6fD$s63jN-jAvd9 zDJSF&_MUUPblf+cLfn!ws^(EbF>&Q7b?sy+tjq+>!}pz%nb*&pU3S1m7OEyu-{-xf zhpG*L*=6FYqA^W23;wKvVP0K%EmSyFzxFLbmKd-|=0x=U59DMkmKx3YT6Ont#04A~ zIQR_ilq2?YTfh6?$i-rRBIs1E5-0hdja+5GcoLLtD3waKN$A{eTVO*?pmV4iZ59RM zdxn*b29r$jyy!DW;X07Mbj3WaAbtxO3IiJ67rKlZF#&E&FLgfT3rWWTEA>BKadKi3fD$+!KRtPX2o6$_8V(KaK-?NhYMmwVx^jd~AIi zoFtXQN>QTu8-{sKv9uM>S?Qmy(RcN@(%X}^DO*5P7 z81AHt8WO<qC;W=opd(q6;=~pH{>&%OXndO{9*}5Tm`2ilR_Dc%)}!D zCl$VyskE-}wa`b3QX!1QQqDccj?B2y7kO>nP`tMMK#lMz*`vbwVE{FvDeNmvhCdJJ zeYs*t$Amc7?_@02iOX6pc@~o_4q{7J8zB+I$EZo^m{5kRu(!w3UyVWDL%U((h|khY zD0bOFsmTu8UPEDdl%Ur201sB02{n$rQ;0sK+Xhy+oF9+ZguoR zMrrNZPpAEgfag-3?urOxYcVvCOF)x~0)JkP&o}MX+b-;p+Q=So_jpqp&pwL}9KEIc zmSd z-LNc!Wp}f(zpP1Gm#A1P#a~%gl_E}A{N_w=QXo^Z*@DgL@5k9|%$w*wg5W}#X0yS9 z&AmXz?rJw=(IB5v({7RNbC(exVM#o*1CVNYZ?8bIEVk$o{`$tj%i`ny&_x&6Ue@xg zG*c~WRn5WVHP*-rA|3(eVJ=UmnKw(K0UciR^J_d;qC8N;WW0e0bG=Z9o+W0g_Y#tu zcIDyuK0U=O;@d#Mgv-=72wWZ?f`pTa=cHZ<@Ojx@(&VBI|H zwxt`hxA^?oX_vZdrRx+WIDAB2Kmk3|DkmE`i5XnW+qh5|Qgb`S44DrP*phze_+D`Y zyv0tJi6bD=e$o2rM&6-7(;PUSV&Ze666SYbgu%iuk9-}co>djl%DiR7eRUD)-yWt0 znmOZszh1R}`w1cVsRh^TH4svtpFAI69wcWxITal1d{*i^A@v`4y!gYRsEsn6eHA^n zn~Cj+rb(xxG~{(I?YJGxg*-H7T_hCWzTHK6qs|z;f@*{|_Zz5Fe0rR3bLMHQ&9Pmw9VfGN zPd3-E&E?eM64^SOE*Jmwt?QOWB`q@H=6%43e(wVsitS40B4I&4x_5|j0&aVA!}Rq% zHgS^=$UaW&Vz7~f`kmft7E&>};zawsxZiJP9qk~z8=}(hGAaNe+Kjjvs~tw_m36H| z-Dko<*A%;o92-w}+j7lx%?(CqMpYE-imD$~;k_389I*C0>jirN<|o5x)?j8|?K|iG zvFm9XvU)LI!d{|mNqAOZRhBoRQ>1L)u#A+^(#Qc*v(X*OZNcf&qw7U|$7;y0&OGhT+ZzKj_zG z)p6gZz^T3mz@>?ho|cnTB%M|4yn2=j6xjgzr2qGq)}0yUYJf+9;3u2@K}x@}!=x4@ z+eqbJlRcYVv)y|OpTl&W_$WD3SxISuw`t&3WLRRb43Y+{##2voFr1(}y#%ubiyN)S z$3zj^ygXwB?DpxF*@#|jt#w@|iGM7OVKz32pIJPO$D0Y``6TO`;06j`IseQrl}fVA zrp8lymM=0G{Bzi!(VOeqw!Ymo9BMZmf=8+9b{l-fu7S;`FVRmwh0oF z#z<~%qe7pb-d+wJMqgWJK={@f(aqV>&C=(I7gVZd2Y14)u70Y1&x#=gnY1IPsKocs zXNn%Le$~k!)x0`gJBpXZF`jRw3D0k@Zwcg`JjPpFF20?DSI5;ekR!^xJICkO{o|t% z(BQXp5GP!&a39#S;@wX(^k`Zdj1xMKi}WTD!oy8btFpK z;)}%4sue=ZCX5>UFe=e}$Uwu(G44(CW=3mNQqNEQ`iuA1-Tl3s+uNJRnAaC-(c*K# zg75XhkAqTMFGuy?R`#>Ys>Dm=sXO^N7qdaGqBKJ>C3E?ZPskb$8k((}M;5X z@0j=iqv*3YYZ+2Tes$k=gWuyGUGmdHf+CBf0QpV+zW={ITVLBC;$J@|-x^0;u>6Q9 zH=sbZI#47(_120qmWuKSJWTL)2n@9`F$EzApo^@4MA9Oapdw~4kRpWuwb(pVR1p-X zb4VycC|a$O9rzQ$jg;U3n~j7IAcnjb;KG()0pj7hi@ehtMI;Hl?AIGy&s(ibjz?oi z8)V8~ym3M$qePLXpbwS^pj$MsXNCo}{}|l=5yr-PYH|GovF>yjvzO2Rg6#Cm$Pf@F z;?5U0M>T&NF~jS}+H>Qp!+GANk`#{Q6?H~Jb&vqXc#s@9RU~E(PTLy#*JVJ>_is9* z`(#3homACrn0nauuc6nz$uinwZ-RhWX$@JD>`6SZ)D5hmrhJcihK9?f}QS5!Q_if`|K=~HJn2D?V(5U_u-}pV< zES)0MyiVM6$32V72p6#tqI{~D2CsgzRWB^ZI7Wzlsp300EJIZVo=Fs$+cna(jU$7s zrv%CY=RI^?QbqR>yX{T}cQ0Of%fD zN3zT$|&q5Kx-eVAG68h!o(;(h%QItsa7 zcyqDI|6Mp(ZStAWK(-tLdQ1D6mr*#2zLH6J>rp%11FXdsF8&P-)zu{6S=!EetJ*PZ z!M0(xxH+<5Kfe62j<=p+dsX&KY2Nf=kl4|4s+pCaOaJY|Xe$e=KMqR;~~kCMpX!~=pnDnn!cz`>0yqB55>+@g@u zfbakuDhm^G?7Xn@zyusJlf3e5e?{@955`k=Sf&2E8g_es_D=c>o=)Gn8}jvT_6;I0 z3B4du+<;V`U_%(Tfh_3=jyf^b0foE3(IuYV zVfSn^tU*(Xs&o%?Dld~hT1DT`DoVPsqgAZ;B*cZ7%NXJYWpjUGE8=r{@e3;Nr0FY? z?tc3R%3mOV>%U;YW`0ui5HJFWjD1lEQ0UR`eVr}TM}uW&}AZ$0%MlmBDw(MbdYGfsRVK(I`1?N@ zu;_i)ecAo4Dt%*`!z#mAn($9?nT^pG&rdyg>yD7@=d!D(9L-g`HZ7i4*v(g2?a5a? znXNEJxhx5S#tQwL?f?-GhFHXJm+NB8i0fVLZrNjag9|0Zx9Ac#3073kTIf=28 z7Jd9E!P76Q(3LaBg){150U=@XD9r&S3z-B?WSnV!EPq4=b@I#Sv~_c4jPVPmXO>SG zWWhDbnUhn!p0A}HAo&ri5!kt1-B_vZDC$C($p2~ft7}Dg_H&>N=I?S(4W#dac=D-H zI2=D@%~kQhB;1&@2g2AJvqyxGV^8gh3WwY;_%dkmOLXKz;sYZE-P8m`Kp~-umV2?~ zn90ofDPu`hw1z&6Yk9}Xs^StIu@%tlBbR|cs7_3Z(|%&@3#m-#$L=jqXFayh833Xo zbB-Y;PAWIVRXmhe|CUiecIi|(laJTopZ#4H`x3Q1B>wfG%nq|rKpL9fO0v)1lxH}T z_O6t!u(9v|9xY9O)Roh{j?e7eX_g;ftK-JiM%H@0WA6D`Py&;_BnnBxo{>74$|1J; zCXi>jeknU{zB2Zzc`1fJM^(dtmWY*5M^m`K_jLlp{_SM)6Vu0qVi16U_-C8je^%Ak zU9j2Ke~PAbtDmC%R7K`^Yl6?m|Lb*Am-_qu+!h!F{1-_BeIGPg2NYpAaUFSHIB6S( z!Plo@1W}dSo)kf@Fp?BusZpHNpF$-CDWXcJxp9JgX~uEFa;v)WKgC)O<3!b7cT_n! zg3wfXB?jSCxdjT6RQVMSW92z{l9VtiBFc+OszNeYk~k8~2eKbr0nPgW>Qjdzvb~BP>xz6M6 zX(X8bOoNhV-nH|j;;dDxh-00V<3d%H*2^%@E6<%;EJ+5Dtrm zM_JC3m`~Ca!>m?bb@McEm2|6+)TfrS8X{l;eJ+;stwQtrB!S*PiC;k9Fc>fpe CQ9i){ literal 0 HcmV?d00001 diff --git a/appasar/canary/app_bootstrap/splash/abddffb32a4a35627c3857a06c751424.png b/appasar/canary/app_bootstrap/splash/abddffb32a4a35627c3857a06c751424.png new file mode 100644 index 0000000000000000000000000000000000000000..909b7290936c50e51226b0661d686d21c207b749 GIT binary patch literal 6378 zcmXX~byySL_a3DvpmYpIj}REr-J_+XrBh&l!cY|H4r!25gDMOD{{o{@!tnbq2>zz&uyD*Fg;vazvg8NmcZl>UbSvaq{(2h;yQ zKWju>fq_l5y{n&*nUjQ!Dnvs4KN!f|?VYhxl7%fyL)Yw|=Rf?PMOPQ!Y+LuYmd;Uf zO4=tFCwypkwf1d#^<(P*J##-12?Zsn0UZ+yK12^>3y#V@!8ktii&8W6d1PdxsBWd# zl_)A_q-z-hMTE&fZRr?6Cs-%!VRrgk9%-)``=@Ov1XxjDr;k791#Hyr$3 zcGWTV_KjVF$1daX^gz(*yvvLDWpzX}p1=Rwjek(GkhmINS3`v31y2G+L=1krp=Sg^ zkr6tb3EceRKCj|V=A3+Dm+%05d#4zuGpv(O%o6mU`7iN5#R;E_58+SWxMh3~>c|Mc zfVX(Ff97Ur_C`k460hU4{sCf_@Pg067s8JNZ3|a#jfA3O{|6qJ`InMZ_%xFRNN>*zufWei_;=ur;}8u74WOwwRDV{VHV&#K8|_B4MNh%6JBz%HDz@CRf^<26~aPWWx9rGZ)$98gxS^=SH7B(;$HCt&pwf7aB zp&8S~RXvrhtA+JTS(WpRpEeOe)|>d%ke5^r~FOX{4 ze(&}BWA#4+GICEhLlo&ri3!6#GfO+z+R?{)UFS-`0-BT`(X^-ohX{K(+b5f!Eq5BX zsBcdre|geBoPm!3`7OZk=I>C8ZbH|9aVsv8pwOtWpo`<;G^>e914FN#EqcMUsG_xN z6jcQ@ql%lj38xNP7b4jql|l3l@M7rvslo%a9>tKXbytwo$g+Qsi=gLOpdHi zz?;Ub@OUv1O~FZa>|>g(TD< z%=)`?&{_RudJjVga5idScC&81uAR_Y%FwFa#^n40YtAJg1#Ujj?5O;H*af@S^ad13 zHh6CLjZ$^n@yl`(1F=lV?oa^fucY5yo1i+%(D*OQI?B=|eCD>oM3@7&+c$FhlPF|# z1@}?2V>|nTk+?Zh&Eo8(zzuT~f!4dvk!5un(@qNllbTbr&rfi3HZh!Ip2_Ktm+^X6}G36A5?T zAasIg*Y>Tk5kJ7a2UCqpEhI~DBqY{jdIBlu!oO*NsUfNwmNy?zz!YF^3wCC z&aJJ+YNCWgIXUNs>K;x@2c-Z6Uqxp-F6&gS*_h(BGP;%cs4#cJdF_%XR4l%I#tw9* z%Z6Jq3E2X$o8R4(%1HpYeUVWjSZQ%|Ik_J*dTeW!x5?j10LoeZ7P{FMY#LH)@%K7H zPFcOfvl2L)gbnTZVs{rzWVrvG|M*GV#$SH#c`E>usdfv&a84I(x%t~G>uDW%LdJF_ zoFV~VsgCw}k^A^%8SN(wVzo>#RBfa%aPbjCqNd%ezvXo7C5x2AW!ff)l^MYIYL=sx*6$rDy}4JUlje~! zZ|9}FnGYB_O8E^qTv zY{x#R>JnJ1%vzv5cD2gf!FhI;e6BwACjDyg+roCpBO&9Ca?s{|5J4HH=Y`+cV%2BZ zUV(IP<=SyagLdL?L0a5}itR-U`480CH=uxIWM5_SyC2hB01^`#l0X{VW9K|~vG1T; z&&?Y*MiS?KOtS{?e#|e^&<;o&;SH;g^)vutI~U{i8v80Uzl}Y6Jl0a7dK_FNz&Xz& zzbh7M6E8ITBfSlDUb@cS-hrH;x$fSk9I61FVw%Z_3|fJHy$$$tKd13q{6(r z5_0`iJjdI|Yuz@?RZ!FiPxlyS2!p62nDl+zNfUMX5W@#?feT;Dlbf(5;B)o~x>PSR z*5bB6{zjE(1IpPhEY&_gv=v;vc}a<*FGfD>t3-TY%zD1R>rU#ggtO__{vbI+NP?=C zXT?QxTCrB=vSdBST`-Xf1EXu|B7kaK&u*gvoMDFMNxIUlLO1H9zgkb0b?lCwn$2uR zD4QpHQizWD-1#ZVdLhBWT(lq;I{vV`?cUs%70Y7xm*^)io2IBGuo5qwN~XLE(7_o)V@f{-(W0p z^pR-MR>-_IdxN`4B5jR&fALLX!?(R!$#inREU^5 z|K&q3ou|~e>l=0I)IA4p_Cc^Uy3QPHxQ$eK_u`KNIa*7QxAD6K;0ZEj7tXD&4xZe)7Q$XQ_6=T3|yD+Z8;nwcFs02fd>sA#*EI#{Rfd_md6sM0HP#%_lg=dl<}<<0 z)0PII`}EQ^iEIvC-|!CzOIe%jwg&)Jv6(*4##;TzxAoE)h!!2IU7Q7E*s|JKIwN*} zxQb?X`8|=)b5}S_6X3EEEA&z%td&?$@hl*&&`XyJRx^hp%G*=>eC{wc&M0)(IX98h zJ5R5-Dx2f4Cc@{ArReW_j+KW^-nsGz%qY&Lt1o&(K5>ZhHynMa=iMVKiNupp;c_()_XfcA zLvllGred$n8t_g^+_mQ~S+&yG@P>^v<8+G#dvnUhvn6$Pb*j(tAZSAvUsX}Ky-Mw$ zKBadrp51?;_Q*GY$HTL6kQ%l-u=GZ-@$z`-4La$~{N`dk>UJ>uI+T(}>Q~Tmpx9BB z3wm(>EErU$@{p@Ng3{sk)Ms*=m{OU2E5yPcHP;u3SWCK(%|&4n?!Jo?FT63oTXmI_ z&6+eK=JI`Qh$%d^r^&kVq9I)_HF9q4Sa3a`TxQw@*Fa{m+mfy_Kr4OzUknyURD`J$ z*P{7G2}y}x3cqz)#&0;=Kgsg*U0tUQ=b}l(Iv+3+raK{TM7wiW8sP4WnRwxhDVYa% zXXyP{*cD9^_qn5mcP~!#TOni#!o0Fb`9aw0E%fA%usZDsnUTAin2?P1rsAEUrWvFz zxyTf|Kc?8DUPTZLCm{$;AJg|2s<&wMAPIb;5MXxy%ZXhc3y)Q6H$u0=NDq^zF*ui+ z_s*_$qZW0N)U}TV2T@&Afh#@Z9hAC zd(AbSP1B%zzgcK{y@f|?cOJa1@6ewi!4E3ay=%LNXd@dTl?P0%EB8)L)N&{ZfklAH zHJYN_r%bPVH4>oHp#Jk_sY4nk$5A}hhNf;34&IyC_kVu8RoDt#>B2x6Fs zY_h{fwX@PAMZ>JD*l6Rv_|Nybfte7sL1H$@gpS&-iTmXo>j6=kH!Nl1#Rk=mXi5G{ z@zg8hHxy~SRQaO*ztf0=S=1rY{#I>cjQQMzBNBBT->W?Ax`Apx<7tB^f$P~&LyYy- z9};g9TJ`)u_$T7$dVGwg!UU_do{|R{#oF)W)V#2S^Q=JFQZyM^-?LV!V#cuUxWHby>#*i; zDki#-zL6LH?(f+N)0hM2>#k>mEDNseN3bhF-Z4@=U0}(O7;TBHg?$>01u8pLk?3o-QL#VD{&ol0Qdt;I-Sbor zb6FIs33O=CuR~IpBuqS;nlqs;m%znY(WnHMJCbyf0w^4l4ASD?CKod4wrMGnBzq|+ zcNvu=nc1tHv`pL9zj%}os){irjFWL}*&xr!S{A@mQu9Ig4r`!Bq*567xKN{yk-?>CXN*c%DY+!|`80WXSC@QspER-T_PHjaJ26_HD>vqda*sSl;n%qTg2fw#xb+Dg z4Oz|GiUQ^fwi_2AIv69aID5IL_is_|ePP)>h9(Cu()U*S9Q{m&`&c^G3ucG5FVLl@ z$RN+i>U2KPjohzA+nmc?r@mkC^JP`g$ns*iRwNM-6pdUMtK;z=O@oWdIUCHH4%Ba`Rq4O(f_pi}vTN|n-#5Y-O{H+v!7O|Ie1xffPhGxX9p5QfJsR3yJ4f|J*|?KNN;s^k=)&qMX$rWy{o(qvTB*{G**uT zE+l^?=Dc1=k6b4kdfCjrQ*1tAztt<_r?2j5Q0?V2gt2_| z>;q>mth~lFR7;Lni7vACK-L>(W%v{gdtT>XO}TR$>@T2C=D^?oJOU^o$aat8sGqvn!@ zh(wENDD!aW)H9)YD&0xMh9Q;sjgqplSrpodkQms+XqI!;i`PD8T6ZIUTQFw7!7&td=(v6 zEP$VACtuElUaW!~L~}dwr%rR`8J*UcWKW(zdron}6!;>aIkRfMvj?rnv4cjDvG<{$ zbucoaPA2YWEt>n*lOGGi>kZgNN``p6_H2WALV+mrV-%F0G9^liA9dpV=j2WkHJ63) zrcuT$Gis(vFElb29`|r1%CZn3;wb%duTrujZ>!(#AJDI!B5j|@;!HGC` zHe8+}74B8N<_;{i+OiEXO$DO*TnZpPYUA4_>kA``xRX1STxQLB$Gxml9mRQUeH~vu z^`yX0cWCZ5HIp^H>~&mu^vm`}BN~FEwzW3SHJ)chSQG;2_TU8FDX(6MW$X7YPvg?q zDIW!npF8BF&0Iv*IBnWFm{azADN7Mm*u1QD9FG!s3LcfoKzXs4q> z5vRgu!fS;jzPkO3Fv+`OIA0n>QKEhg21>zCJ#n3>_}Y2+8soFP4YO2Zur~FQ%0eS?5kLOP&im0d0y5?~5=2#X zT%kcsH-RBA!OVqmQk!tiFxg-gU`C+F4r$RGQC_GM>)2tRbQPDfz^nCS)s{~PV_8=< zDU$8eBtYE?xpK=VPYfsdqBWCWoPab`n}!Q(y8vfPFD65MzB9KUMl}fQ!6qLFm+bkB z(jPt^d{LnrAQNwZJk_YAK{t z4{Yj9i?QV&Iqq$jY8mh<^_K~Suf@9ShQVWGf5krYaZ|ir@~{Imq%XPDt@bymGooUi zqoAF>I9wuJ#fWTqVYMVnn2=c3%+K9C-vSY<a@8hlpI7L>-N!Et2mvzCP6QNZSfpeXH-! z{Q%)W{smths(JhCI~zCA^1c)5ohV0f3;Ci8XBPLfIFWyw0lY;+W*q`CohGb5-M%h? zzAx|hE9f({ZIDScyB4*ma!d}H^u+l0<_ijq4lcv;r|CZn=nxT literal 0 HcmV?d00001 diff --git a/appasar/canary/app_bootstrap/splash/d153359b5d87601d2b9c708b7ae2db02.woff b/appasar/canary/app_bootstrap/splash/d153359b5d87601d2b9c708b7ae2db02.woff new file mode 100644 index 0000000000000000000000000000000000000000..2a2f65a5f2547329b1c17c3079824202837e2b64 GIT binary patch literal 23456 zcmY&fV{k4_untaa+qO<@+qP}nwr$(CZ71(J@ri9GH(%ZR=T6l#v;9nW&+b;uY)?(E zyS$hf5HQeB(JlZ&{;w_G{a^XN>;GTG#8hN~fPhneSezf=>Qk-Uii?Pf{csIGGX4(; zfx&@(i7Ut}|8NUHK+yd_Kxo+Y=f)f2%Bn&@K(Gn_>HG(qM3;DZWd`OS?mt_(9~cO$ zh+r7o8ae<0!TpH9RzGOM+gbT#?B+rU1O#vMLsI?+aB-*!GY50qAMWQ~fE$5;Kui%@ z7|P8Joquc*C4O`u{||`fHlAiboB|M#@Ej13A0pHNKaho~p$QO>3gM3q(+}7_j2g-; ze#jqAa(gDdI~k$MMv=O1615kGRsk55_oYMh*abC$0!K73GWa!w zBQOJU^z$5WNx(2bKmDy4`Z8#nc;o&Kz@wwU^n_h%-DnSjQJY$5hU;T3w0askNJtM= zIM!XC$xi@T%Vqw^&aH6trK{m3@nM+BSR%d~6Y}>4OD7^tJnHO$i?%Hp+2sXEYbO?_ zGA4GM{Rii{OmD0a+br_g*?1P`qnw@V=g&`Gh)Tpn+a~osS~UKbqxkx1wMrwgA%&In zsO$bm5>|?%So>73ztm{6`s*|dQxJDV4;4lA`$D5qhX#k{k-3q^k;#$l$m%Hl5u_5Y}8Y^wZtqDYj|qY9kUkh(JN#LtsBUhsqfCRzu`N! zB-7Kdd4O-Q4>ufK;ijfVhW#<7xQ2V4BPzCVGK?XFR@ovmUHVY5MOGS3%)w1=$h^#p zdgh@gekRP#2JxeVZAj9E9l4&?ka!b`PfTvw3m|B__QZhpcz8UmyQU99wP}2YeB<=) z0V?e=BKW9bV6N4IJOSH`Zb?65AV1W|CQ=rc>@4j?Oi1+(^k;WnuC;kuMH;q zTI`&c#~%i7JhMMq^ja`dA_}6PwK7y4U(fSl==ugw*!sLz{O|$l?OS;y>B$}4ZrhVP z{zucr&#g@NOrsrd_9+x)J~r)OZ>K2Y6^dI9kxBGJjnpdYWtQZpDv!|D`A`~R@cc+x zUrgS6|6{=!+$#GEP4F;i3Jt=aZs?is0QrE~T32B`(1BgcQ{p+{f@qV%$)|){L_Qz{ z2nsmwIT3jxePW^@=b-fC%BT+KEO5q7{`$(8XVg1NQS_70xxA2Nfzg>{Mt4EUCKoI{ zqkAU9&@ag|8LkT5;}BDGZM7`ULi>3Z75#BhMio!h7UXx9P%#fSr$x!x3M%%d6Y|-r z2S^b|LUoV4P&1GAF7yCe01c3O0n6G3{{j|wk*%FoY8Bf3Or^|c)XJTjd>*@yByA6b z?~~AbM6X+qW>sNzbfj$Q=!jy$G8NG+)!Cva5H19Sx3VL9M2O_Be$^P*ji#B;~n! z5Hlcgs<@HTudnCVo4_^QYLOD0(n;LGuwBAKgVt#1DQMjlD0!JGfkSb|QzCn8&nYE( zS<4Z5nR6G#U(+54&YE5Xs>?qS;Q=#J#iJ|abX^rD<9pk(56=NREBhWMUWXPcS~?-( z*vw15P1GpM1JRZS$*OEx8z!l>B+H`VTDh|0l?3MeiK&ds|ck?xwaRl2J+z< zlcG!)2J4{}^GCb81A}B@DsYoX6mfBT)iG7d_ybRMbu^C>b|FaxDoE>CUnvqWMY+@j z_aYgfcRUk#3CE@RC%6XwR1Dz-&0K5uBI!}?;U~~8@%YAo#Rn&PFX5#baNN;u?mq;06arP`F2;dw2o2 z<%)3aO%%NN(ER8eacVuju$d$3vww}`bM+Rvo>MFhi)lx5yR$!vi>)PV~X0$0^?QF1rJ3oI18W87)IN zc3IC@T+EAin%YZ5;hZM27eFI)IK)JN4~Kio%k@dp?h2bD^}L?Cgn&oaTJ!5;g! zxL|S|^T2o?o}z5KKq|N@whC|r$O0~ytd^T4H@~;qxiE}#x?}NjPxUpkaSbcm?`_pQ zRo6SQSK4BuCDE+d-`eYwXues#Pa>{bT@RDx(BA+YFNa*d`qVcEC3ih;wS1o5v#36P z)EgP#t9kBm+7my!C-e>Nh15^x1B}GR{I_2IwcLvRp8OE6M_svFmiA0w2dum*c~sYY zM&2Syb7WJ7o~KxJB-z-tJ?3-6`0Z6)648st4^`l9?v~OvJ@TlD%CtLF`%G*oe6d#uVq&3d zot#lUoDX@z*O3!l)c9(}SxwOLXvWoDWievMp)qr8hu^Cj@=w#awj6*(ED1;2k91rZ zq;a4)!4XG-yeqmL-kyp%sv2vi>^CMFD!aHb9&JAMlsje5Gk?KP&xllpr}3ht_`3?1 zI3`Y)(wV}Nd9ER=s}?_(;HTNz^y93Jn(A+Mg*T-_`)1Zff0Bz6v45xEe{&Yv^W3)M z8l`iSyH9y}4Sc}#d!*oa3ctk-<KJs}Hea zQ|(m=?nz>G>6#^<3+HagKaYvH37XHDwl$)yMnIKUD|GtS z(EjKn+SyyD**SR5GI@ENe9|q|A`@j0X_}19K=*jqFXkcn!z-q>7W?;Yq zwonrja|v^vnJ^F>JnRt|78-xT2o@d|x?gi+>8q59v4NchU&+7#)#Vp7OTLLMm=ZLs z3=lXv%*p@yGcYg&pf%GB1-()_al*yQHm;_U9|>h$*T z@_c`JdxiJ~4i+8~7Ah_xCOSScHcCOt+|ugqCZES-e_KR0okp+U>9v~GdcJPE(cyWX zX3O1nz1izdAgm~5b@Un)3bvU(-Gs?y#)QhkSdt#Bo31?EV5DyBgddTs?M+l!>H1bU zJT9NZ>3z2%7ZxmziAk^5A)oB-73%mk3@P&Ns|I{KjrH)BpAK&;L`Bb@;V1wzH(Cu?vEO63yS-~<>_ zzCihiluXvhqTk%y%|Ck;7U`+PDtF7?<4R|Ai9Neuvur<#5`bs`#L{D|m>6J?gpQ5H z>#)nWKYq~c_n{oNfakpSl(5*cTmkxJr#~})@E+gyG!H~@npsw!mN^k`$bb)vo#hQ{ zv8MZ{pnfBl4jgzG>axn;$8nXZ@3bQwTdX!VmMnJ%B4Yjwa0{#2Sb^nyt`aZ4I3p;h zSDP9*^0FHKNf8G_X5Cd4I+i{+hx`j#u8k5Y=Urg<2GzWv@PlHg&AvsR>CVnafzN8Q)`=q704#V0&$A7Gh6|>8@eKTgtf3(9H{gA|Owiw2e;Q5*g z*~CIN;xwQQKoS!aRr?CZoEf5lJ6FC~5XlTY-!AnjKx(A)^CafGY$p@b3jQ-R7h1y zd)P!fJ6)QhBozT#I^u{cq+4H~?xh>f0sqrW1aIg`mHybo(j){)genAeu9Rl#8JK>U zu9US@(+>4x1+wNG~EN*SHob3&z5;h;jjC8I`_YEUq!jCxh9IzoyxUL6U=UH)!V zG+F}%0r#zY$`h?#+7=Wzzpbr4et=||b zL|yHdX6ra2x{DzQfoH7gmiNU4X!Zo(Fe)Ly-{_9`xyq4%myrCfEoB@EBaJ3VfX z6&GDC(Q8S@9N8pc91CLHI2!W#W4P1(w6J5U)|)q&yr7|Hg%;DOmuP1Nro6NRz^1u- z*F}kWv)YRwg|>})RI8T5NQEkr%F{eSV)g7qy`~8}WEcn+++-Ch97(HGW>T5@t^#{5 zdqaGs=VpYDquCztxn3<%Fg3UB#BobkF6?hTMey54TIuee9?|?hs9&=<3m>&%=Q?`Z zkf6dyJ$+-B3OoT6ZU+Q!p*!m26ow9*WIU@hEwuw&@=6p25 zR8Ry-I`2eL&`{BSB*_;Q!V%K0pX^_C^w z<7-DZd29xGm0ZjKNGnB(PW;*9?ptRykX%B@{&PviXf_TN0-1_8>YS&6sBH0If<19< zCJ&h&UKN~X5RtT~3T+W^e`l0dQ7alBzfVC?&B{fzx_o7(4wCNWrN?dJr~mgkC=zE6 zZM&bP!Q)bAxVtW=Cidr12b=Tf+oqG_d-Qq~dvD{};VT`BbLhsyI(K_NO;6T)4^Ls~ zTKT3qW$x6Zbz!^@`F&EV<6Gf^)A$k;f^*F&aA9E}5cqbbxSQh|yzDWOPvnF8{yTdk=3i zari)tsFOg?KvgDBDM`c)Ri(X02&`x+-`^tBrW|zH(jq*ZSXdhwMcdnYmrhofQN8he zeePW^|E2;Tg&dQ-c6^k(b1MG4pBP7@GoaK{mCMsiDwm&-+P=4~9rbs63TtKhJ1R?{o@4`xK<)IB(6EhTc@Yo|yBGDUMYbuTyT-pB$bCt4@Y6!T^BrZj1`7`S2O3T8W{^itvDbJmxd*$vvTl4YbyUfF|jO7=rX8W*; zf4ZiqbNdv24<)duZt?5NdDG8cZ>_k`1)HxgsK%J_GV5!rIA-?*yq35%UF?rj?C3SW zV)|AlDzq@UAU89)JHixaV?b;9PPFX?bixI)4$whrA((L_ggfL8Rt_|CJLIK4=tzkK|H(V8wC`h4K*SZf;W zXiz=F=}P;IvBK_Bvt7VRuyl!PH*0FRcsJ*l*n!3KzfM_E?$Gx>GkXh5vpOx(|DFW{ z1i8?mSclv%f$x*El2Q%Xl;yA)0b5%_7|t6C|Gp)fVhkil5<3ZaMb5ndx<*z#qpClf(3=BQ@#RfC$bf=_(Z z?Da;5Rq*Msdq;}JUoCpsG7E&P4sm<2qgq117vcZfOIHQK56cK%U+RZ@_?2~v7TD5$ z;LbiE9J9qPX3){#Md>B+7U<}o$SL-g>{rOqA&Aq}c`Xd_3=h2zXGx+nE}WFYso~)M zB?)5@mbt&!3K}VWWPZnYIl%h&x5wlPVJ&FxF_Au@B+d4M>7_bP0ieb~-(IG$VEqEC zH*Dy1nKi=-O>x{?rywIjWVV6hI`3bqWKY&aNsUTEFPWYurDf6f_e;hUfZ~&&9j{0l z9)G26iEEDxP{&%XZaE*(FO|Ovzi=u<<{L3PsN%6uvN{6mJkTRrrLiEXBC6hR73v*L zp1_?5Uo`muTm&|I#hV`tBps}HoMg)sI58ABs&cJ+HRR9VARmnzI4&J~nR zNg+!?;e;e6nVh*6N}L=uJ*T*!F9`7_>lQW(j$U7Y5I7DHYZVc^EjVjkkg(ufRb$v# z=(-*ckrwz+73^TH9J$F@HyoL!X=GE7`=XkC2Qkqqy6C&_M~DD?hEKvyQ9A zhL%f%>lva$ZkKV?Wz2q!TCJQ*QIc94N3EGb*X&dpEi*3!#Nn>Y_@m$fzQetN*SILp zedrY)f!{{b7sj3)mvf|t%dWJ%h4<+U#R%k0v)v8JE$zuZqh}WBa7_MygtpA%U^1?- zXPFfKfjMGE`aEu<@ABNXSJ>-VU8LQpr-G8{t8)83CnS9n1a7V#MMnu%Ke+|CrTcL~ zOSIvfTQ-Fx-r!!0*w-8JZn_hB_S88@B`@Rq*7-VZ7U>0CiMz;IKA)>>cg1XWZ=K(I z+T+%3LBlf^9s1|!7s@*2O)J)#G1-U|C!(lND5)+7Hl~;oVrNDPtzr6Z5F*&P%D_zM z#T2FrH*CEEdj*wXQ-{crT!=5eebNS*7;VOE!X#lsP0Gv1Htg-}kfiYl+3Ha;{Nmr;NMrht*2Cga zgH3+9q`VV>h!ZO>8CH!0k5wB5pADEY9n@000}R!kC$__T96aWrytkYjOm!m%TgG7) z^eQI?F_;7({LvXUS3}HgIljr`sw)l{Q$cnVH^n)ga5I}O$`AaU)-$m!cL3A3m3liH z56N!Nj|aljjdsh=zIA?$_R6DI&`*9F+dm>0y4wp5cFXVAy&gTz0RA?6es8y902~9~ z)&d{=8p26Yynj{mBIIYXE8?^A#Y<>TimwrAaE^pL&EtogAaQ_tt^M_Lzix=~* zV9ZkW<9Wemr~#uwx6^x~qju&ktLL6kN)3_s2u>O41R?MxQp4f^b|b4TMjZ?tjl~XE zt**88u(#W?Y?;rXX{VyX|RYs@g`yjxCxYf+hGy*Lkk4G`3dDRvOHmv;YNn3GK-Ie@UsNSOR@uwr^ffMMVhX zDFc}*^f;#VbnFJTQk$MeL-^90FN$^e$^&;|g6$9)>0s0nfiJY{)f$3`J%VPTmwxn{ z%2t`KQ%ECP!$yj`fTUi2c|95YTYA`?Kg(bHEaA_Jp4I>K<#&9254hvMm;{c)kL@-3 z_PMj|Sc}Ao62LEuJiA0DwhU5th^Iz0s+5Qg2`AB&o%Sn*o`hnBQBxu+fjy|BOGVt0 zsGphgOM?&!h17Zl-bfpOl1*AoDEFND>*7$>c`M?!rcgC2c`J^z_*8`;B<(5PrRbu0 zSj1(B(q)25ZBd*-OjGlX&j-|?u)EHjBSW$x4yq`&dy=60D1DeCQxM|`(1Gc#JZdsw z`J^O95`fpa{0Z=@t%c1hLlpRPYE1*pK|d4di<#bbHh0GMpE33*iCAN050Z$7P+UEp*nGFtHfo#%kj`g#42 z)MIV>r711j#SriE**>qdH_KMF!rp@1)i{RSu9T(vB?d~E^yRl9ebDP;c)e7sQn>^r z?#!9>9HS_fdV15gEXoXE7O4c1FipauEU4+YKtykk5Y%!#tISRXeF%_I0$yX02LAVGmHXA-{xW90T_pQlP|Z_D3}MIppqKtzT&rn1mkFgw%UR zWg)r+xk0N@(rUbnt!y5nxM--#83wEfA3~!b&L{(*+CorXyQND1R7pwaPz0e`8O2Gh zIH+022K~71A3~ddm*~F7`(E37KX2(mDB-ky87%8nUJkS&pwBGU5%6xd80sG1$L7L4 z?(DHa+L|NOv;uX8lln^ZR|>?qBbDu;i(*9Re8qr)#^J%n3#bG4+niFVgK_N{D7o=P*i z56D*{zF30wzv1U*vju14qdeCHVw+^ij$wv2&W4A0+T_7Tcj$;6e019I+m=S3Jh#|e z^X7j9dY$$H3@_dN696r0m*W7w+Ey@HYa+Pi?gRpka>;^0L415k;EL`P6VrPtBBnW5 zCQLD=_1U9_z2c0>0*{AZ+i*PB7=D>oh321H0u{*st(Kv*hgbB2yjll&oX+$e=ZE)A z@lJy6Nv3_d_fV2kzBfMsoN#xh_7a>2&%R&xInsGc%{6s3o^qZ&f{UdroHjC@NPPi2 z2{X3`pH4jv{XD!$fu_YTyj7aa`&g@c@&zohd3mcait_txSdnSSjbKLOVj*IrJ+YX{~1{Qh_;AW>5?Z^304+?8z*`?RhcUcR=PNSrfT1dXZcKb*A zu8jh-MCZ9Gk`mu4z(ln{*KdQBk!y1~--GA!FKTid=e}{2S8J7}rY1cYJyu&F>Z~bN zxe#i&5M&%zoFp=H;d0Koq2K7Kv}|T-MTsr{iqWBp(e>1nU_es%CDa8avcsG&RWFN@ z4T+yt3|cpWU6CZtpPmb?tb>8os}lGtnJ7_75t5}5jfL&*lL7CJ&Z4{3UJc?L;l*I! zeQ5QXMZ?X=ncc;d#G%0EC#zz|e84w*QP`(85r#}a^FlgC)NsIGabq5sZ$*i!)j*Jq z($XvmBB`W-!V#t3WMT=e?*Gz6^Qa6u8BOd!ctLzljckdD+LFI0>n|gCTydve3aV}$ zAg;Vrn{l}_OSYV^JuL%mH%m0UGbdqj-Og_IsAo{eSXM2%is4c?MmbukHd9o8l=#Kb z@D`(xBAk)Xk0uT1V|75a+cL5W)xPd%O&I4|($W}ri&!#0=?sqRY4%YjD4hhagsJb$f3DpSbHr zThUI%Y&m^H=YFYv#k;`I7Bc5nlX=#mn3m;FmZi(gui5Ml7p8}uFNcx7GaH>590Cv9 z-xrT~;pG{QA@r0mn&LxNJ=N!b7P}n=HJQKT+s?l${h9n6pDXnaNygDD@e>nnc1ydR z2K$h@smZ~{HA0z2nD8iu&Hmuzz-bUbZ5D6kMy542^590F6q=5;k)1@0w)+U`%g%?l zPG(b>hrl2->Zp=s*C^>Nezdktc57Lj$liZ>@U&(3KtDLaog>lchY1vy*kN~}YI3F$ z;!;LzBFxTNgPlAP=*R@!Tipy%@y`4L!%`wecws_JK)K@Y;N3l?9yFx=t!*%w?nv*{ zzjvG5zjH6_)gWEH+3as^^#?&-+IIZOr5{7m9UY49l)mu$wQcS3uYL#dRT7)v$Qz|3 zI*u111&MEB#y(GRSio39O%{_k!mqTZ9@cr-Ox}Vl=ewxIK+2mce1>TRR2;N;y|V}O zU2o1zr*M2t_-Sq7m`N#o)6&^5ym0L{c3bYw$MvagbpQ9ZRy_G@j<$obz-5+hH5VS$ z=bw)eptbRRqUIQ5=}0(MU+d-xA*tK|m&Ne14x~?;(cNNBf}F{)DO6PHh-Kn$NhVqM z%!(Q->TU=l5!W&)M2qCSQ-;`@`p&+)u<`t6RoPpyQ}vA`>1^{>y24kLr)GRtov ziUHqa`0WJZC9#O=v2$ZVCUuJ(UIbGV5t#|Zz}i=>1-BNPE3Y?T-cO}Bm*^D@7n&WH zC-OIFX$aP7&5pcem&6j~b}ElbQdaGK$Ac!XeLU-atiu^8*AxTKI0e1mzSo`8qdgYT zZvd#btf?pmhn-LP+hx1D3bML3L46qHGi$*nu2>=R`Gh}kO<0F)T5S)UT_J6@1@lXy zxd0MbfU(vVHtra#@_g-USzflathk+_R>}-^j~N%SYa%YQqP}4p2TN}h=DKVHuCOXp z8-|)}y+IR~$I+75D;!k-4_qyM6y?ksidO=dLG5UR0x*&nIHo6f<%Sl zm)AfXy;}-Ue)Q{SI+jbF?u)gcR*%c#;M5_gHaT*nEjrfb3VmjrR~XtqWMpQqWH;hy z(&Xm_-6i5+MYYB9o^x3kwH>cB&|=Q3giN&wY%y8R&#Ow(t6I08<|VD2`Fz>)eEJA3 zHLNECFy)Y{|6FE5R5gTwls}F(@0exs;E5)q~&~ zIg+8oc4)MNyg3#;uC((w1pjkxfaM$`3d*5Dqcz0ia6gD#q?9HobnmPvbQp3q9N_Ed zF|Zae&eiFoGi#E^!~nJ2RKaPLg34=W2!$tZ{%9-dh42|Mr-2XXDtEPhUq5#1?|MGI zue$``Wwu=>w%)fcpK{h_pS-ng-s_d86{D@GZZyOo103;N12UmJG6;S>cv_(X;+5%m3r?Su9wj>&*&SUw1a3SWYE~mJWCZcIrps9|oW#GFKlyy=-0@ zoBE8NNeZFn4gf`Jo9&n|G~1>r=*> zw)7_XOy6FK3@ckr>4KV$_oKA~#qX5FbT-q_HmK5m#Qql&U~CledW=rX_%GHW0JT!9 zwM(NqW_C~t__d2YBrq@58;yuz&d1GQ`~;j0KHGW*gl>8JQfu`~!>+sO{CM6@r};MY z?I{i)P_F2iB;aH(cl}qa{C_2eI)rk~|}rQB?e@X0Jd|HMTTd4@tNu(nho&iagq#?T z_f-gwoX7XlaQuCAucR6oo(gm=e$^=Wq3G?6lE}U)QXcrnz62G+#Su(EMEMh4G5OgBu{BM+rKv_tGjy~ zyuFr6n=PJ~`hQzxy9;YOx7UQHlU!?~)j8sL{`xe%dh=UbU07B0T<^Wp=<9Xe)_OVv zK%CL-&sx(`(b7V;M&)_d`b>4tYx=dgXl@rs_3|7g7JvBng%Hg%LX>cw54eAY+Y8?<}uWpiD zPRO>qec!x3&>Bh;Y-Rdkt|?L=GOAns(mrK08YzJ*{e>&IICf8jI^!nC|Mkd43XL+K z#>W9opN0~s0CFV!Tl<#`>JINDx2Kfrf;~OjAj4&ky&N%9dBf}q|Mj-_F`3;g+B>+F zp(d=}a@U4$ZUa|YVhJ9ZN`n(`?Tc}h&A~ZHG9IA=aPl9xH>ipM=A6-A>@$hJetyEz zZdbz{-7Lt}*4oWA)Je zgk^@4iCV>&OS*Hf{+4dZ`+p{>!NTHeNVZ!!FZa)*{A&SUzX1M{3-XT8fFk-$1NLiX zn4bhp<^0q#_LV4h$H+R>q zu?5flPshuYMt}E>GvG|))>sHwm=7mHp8j5y)=P^h1jZ}_5vxfBL&}z0wcB3&`2JFA ze5al2+&#*7-gc{V8Lr`AW^diz!S-YM7yx5op&OKR8W=N#_Z zhaCRt3-$IjqCAMK1#tedcPjh>sO_4meMJd|T2R*$=R*}1woXsuko{ZAx)9{MGyIr&0~}<0xMc&%gW;7>F7JWJ&7H-Dvex3`(sK5`0#^wHzV^pA zaZo^N#u{zHFJ8}%;{m%PexOV3k>;6ktqOBWQ;lx)65oi*&P>#h=)*%)d)8^|!eUcF zap@M4MmLyfMvX01vNc0b0~ZWhe2ul?955@c*4LBg#d8q-!s_O)KiMh(aVS^$Zd16$ zbDTxh4KfwguaxP61u&mBgu`i;nbm0SH!1PCCOds@bMvz8;%RN$30c9VG&Fa77`6{m z`X@YITf0U#-n8v0Z#nvCqz?HIT9QfRwDW+?86*#5SXC*{y5Y=8SJa?eTAZ}=lh)&Z z=>?KBGbLP7P0Dzo!^(JtiIwnI@YtPkqJ@{;>Fj)chT`UDhjchWx$_K~Z5>ptj|+34 zENiQap3P=o?G~!e#=~RbTIS3B9tLMK6D4g&t_rmcY^Ilwo%Cw~jtI*GP; z&kezOYtX*eok9Z#j^)*@*fIava%w8hD#jVNxjz5-8Qp*OtCpANrUL0{E zSHVnVaonOZce+KfY{{AQ&8IymAC06&t8tjC1>ogNWdQltUnhIg(%EH0-iE0*4tpmd zY_kkvSo38DUssY(auM$&p^|c2E44up_gFV`=a6(ySQD+xj_+|>Y{s~<`?nvRUH8@F zS-gBcdfh5q4R|u~+$3URW{@7iePrFblW**j?}md~<8AiE6OS#v8i=OLRE_3IwkpgF zYTLMw=a%=bi%mYl0f@NjWzW~`mZ~4jU$tm-Yh@QcIv-eT@sE*w_GcO6@oOYC7XLV$ zq8nJy_cG}bpz4wwAzK5O(sXjf%6;SI3Pk5Erw{O|FID@dPClFODRyBA&?x?LEi?k| zT3pX!#Ms(i4Zh2Qam^34cJodQ3Y=b&o#^gEPfvHeLP1XnV3vJchf?3hm-D=Oo`wdc z9P3uZiYn|i*c*obA~bes0m(0BNHJbv5hxRzqdK={9glPfQ892H0QWJolB!b(A7Vm< zULZoL65}m`V7gO+U}t!!ncK2bW@B?ABc!ATr49Bt1XyMT_*28Brh1SE zvsD$r9Ou9-J6`v+viOe{PpchWEBJ`F-0wL*L!HaZc~OXM(X^@JXEq#VCQv;*0HDNa zy44lDFLGa~`qt#EXI`lykf|oU7ow%X|8rS zygQ_Uai>hJ#&%73LP7K>SAaXTOa- z9Bupv9i3IiV2B+Neh5}(y|sUpAG7Wo{YXR7ATd)UbM#PNL|l`YF^D~})gVDxd|%z~ z(;^tgj?Gtp9XsD2-v%CR*%`oQ4WP3~$r_NRCc?hH9=sVa9Sf5yr3|Bis);8a)!+pt z1vll5Z$B@*qQzUv4kSFAH2^XsO2UetO@fDkn(8ep2+4@0^6!YufD1X$05Q{7tw$j! z)x+@K`!DyQOpn2cz-R#XMa!OuPpVh+B_%{zQy_jw1erciJnh$MD~E6>?UnDeiDTCX zQG{Rf4c_j-o9EK_l_WB1PY5+S)-r3ROeq#BL^fO4eujiK(%4=ZTuP5Uz4z}WM*fC> zi{?>nb;1$6?jE8;xJDuz*+%2b7JNsO{&HA zh?neoEr0Oa=ikC~;T1dESB(^5--BkeB&GB>xz}B4UP=4$hT|oF)f2SyH32(!;~Nhe zVOuGLTV0>O*rssxQ;v)>S z417wSXDpX#T{#tU+I`1PPs_muU!)TBuk_Ub$*RC_nDxckmU}Wfv7fiW_7>4rtttI> zs$>h1OT>#TIUWiMs(!w$>v*vd<$jJie*kd0?eOG0i4jUVZJ8Hr3I0l1yh4)K`CCKR zo`lo!gac6@!CumOQ(O7ZxK}F7s+YJ-Y{75aTm{uDniPb(F-bVc$^g}USn_y_b&XoL z(bzj+5$bsoV~2arS@pFk$z7rK=ZwP!;#oJ-fpYd22NBIPt_nYdIR!4My{4__Yksza z{E$Z3LmLaNt!fFz84Z~XO2K;^X0}Nje~>uqwuz=EuKNAf38A{NCT}>y1N3}$(6Y9Q zUhKB-NOekMDtuAmq*7xXJnuxzV&n?@%+7Isqe!ef4!^#B_st~T7M{2MM(5(rYVS>> zCk=e9e!H3ddYmk;4K>XzC(be65$8)qRa- zSgM!s*J;+^^pfl)wHv6< zUDy5*k|!1TbFY6ISOna1qSCe*2eDG0m4AiYGH9?8DpI1eMKIXG$Ph778t@^C8IS`N z$plFh{G?|ZU!Cs9L^=6jkz5W0+`aKzvKtk75lLSmk%!F|dPLL`3GjQF_vnyIU+Pl#)^yGwju79ua{HC(hKBfVXnJVJVKejD54}n+aJ@%(1 zU_gbKS|tb`D}f zT=qmlp@mUDYpLmLnAcqAHz>u@d$rb=7Qx^n!%fy!Yj>B%`nQ=w?!5)T36pN|C!Myi z66zMLdq@ZT=a>q^Jvg2&u*IOB$%+RezCd8vlo+xg`0)JYK!@v?>T<_Iam(iI5d0E1 zmPd|ZQQs0w%as1J)-Rw{$*`7+R%fr3bGv5-CnLNno;6XRxIU%4`aNdQ-XITWWG>ObEoJq=2l+8uFW?`OXC&S!1e_jNWp zJ(H+f|M$zsT<<3zCkNg0C9?B}j>Q#HR%G^9={N(oQ!?0U@3I(ZQ4~y z3K;X8h;3)i+l5dE0@B6PC1uSr+70;#F-F$m0{;6@+uGAsA=Bw_g0_Xs=uwnVP-#o) z!nO;^knfLl+h_k*@84Eh^ezb1_Q~8U?Y=}WV~V2h6D>L0IIDbn%nhkrqcmlr4QY^X zj6`Xa5lglACm?SVxV99!9QuDsFSCR(GHUJzZ8aGo^ykW9T63LGNItL$<&1h&#B(;{ z4b57Cb>TI%$W4u%LN2|`;KhzUGt`>(?oE~n#<%mC<2e%PJ3i(gtYx_gI2IZ7KH+$EXVOpd%pp5b7P1n}=K~i1_A;|bL$U1Ka-fAB}LL^hNTHOq9cg^A| zNnw>USz?UmY~nO4I?IpC*5rIszXiWwzhy`t4ZNQME*%+5X1|3qno>EKW%ea-EFnb? zCkiTN;Pv7Y78^Kpp=@-_CEZ4C0tOIWlO@~E1qN)o3xmVX^!3-*J^?#*-dhYFCbe$2 zL81EE5369&vZgpYp6`e1Pgl!kbehC7dbc*?Q(bZJW(;b;d*dU@VZDr8Orm;9lT8>s z`4mI=>WfmBLU_65WR_&HRv2naomx?T67!+IHECvW6TaWi59e=c86vd_M~Zh^w7S5-pD)?5J^}czH5_y9dX7 zvHi4oW!pR4D=rupQ7|G_Bwn?x-r`RHPE?4W6=9V=x$v3m@Don{_502#e8<6>o%wWr z$R&z-KaZ6h4)?#aVQHiCHN=D{LC{=IYO>zVo(P4-JMt?afwiu5CdKmv$J=Pei8DTT zw4b;P&X|eoP-HX-{mDlrpT+{#JI$nR>lWXbVy8&prLw~CsaZvt`$y3Po^mXxQipxl zxJ|rzh0ipA#93!?8qwIN`?1a%PaipQhk@Qk+NX#S2XQbQX8V*^7g>Lk7qz~i3JQ4$ ztREZiozM5Jr^H|O%V3S3qK?bfr)L0SJToPGT-a`{JLm4s1M=L{4#GZR>XsDDO5A_y z+;nx5J0d>zjA%syX{m*vx7WG@60I3Xx_qZ8Ztt{3{?bxM6V=lnL z{l8>hQ+6oWR&iv5 z%X+0eGYp124J!qdOkv$f}gODXO_S=FXgeY=wN> z68W9Wr5HNLsqh$8V;Q)8%52vQb(pVFy>uuQYCu`nX{eyJ5{A~kS?RK@5 zTDW6#WJy2_nQ&yR zx}qIMJEOlZ`#%BG8Z6}m7HngqxFrBm$tM!)&jQZh;r(kmGY0i$A){9$*qj-Lxf6|U ztPBS*0JQSlnyp&Ls147nA#)T9FaJ3Bthh3f0^S#&-8%!FpEgh(?P z#wtwyyWY=%z97R;2S8$o(=NEGl-xMOJOrzmLb4-zoV9lZG7wd>-jRX`KLu4k_5-M9 z4=5E?7+8tZqf2t3sB0(U-^arS%q1E zEN?!>E`h{o&@43^;D*jAvu&obp<3J@31!vX4Di*$Ia*zccN$8`t`ssTXSX41+;`C8NJ^4El>kqrW(d{=7e#e%(jE^AJvRv+x;X zm@v#%@Nt;gIL4FbM;QmUEsc+>g|K!i3QJ+_gyCHA&~|Kmcp+FVA(vgE#D@vKhP{W1rTyh6Nysc(^XTH3X?ccLi^%*Q$Wcd47?>2EB zfo|clT7>(s-Oi;D(=fT9oeQcBz(f{r^0=bTlTkOOikNm*iiUWD_=$Ynd=7YH{nMAE zZd&g={$GQw{frUM;0E}=o(F0K9<_r1>I3~-MxNl^_=+!%yBZ|TB5zg=GF^2TefXRMqS?VWbR|a&(){L3 z^QissQ91!RwduM1BZswr1$(o6(|Y0b$6Li!&6<*SHq*H@r+*u>ISjvN!T38srjCZ- z3yy~13+V{HWRBO*J%ig(e5h)NA^EPMW*r61C!N%N;{S8Bpz0h(3q61y@o3bTeyn>* z20aku}OK+zPn`we^)dveX zRBc3EI+^Ga1o%P@ury{W%olQaXb9-~1Or$UGmphkebEkQsv8&SX!M^kd}EFev@NG-DuN@x-(`EqU=TD!zq5bw^YX9~< zyIwyowP~0B`Nw_dv?FxSOI;n$Bd%ufvT2>P7i?AsNk%gWHUuqU-H&ysmc?NFycQf~ zU8)tX{$#WQW11+jvF&n7c&9mfe{7oyeY4Dx3b0aUXQ0qugi6NdQN1DLVF+u&e(a6w zb>;-{Jr(>puWBnvB!<8`tTS$8)qY%*qe=n{z?0m(!XZ9Mx{h z2kKI*5Y4l0=TCOO+HmMQiNjkq{l95TZesS;er(0It+KB)kkz@GuJ&#J! zZV#dO3M@Q@n+4@79)j|fv55)0hLwDWLHWw{dT-Kd!$qhRc~WLaFqEse9%I$FxL{O3 zAHv2%W5N1ZiuDfAzDGgDT^kGDCkfy;4s6PR{K#+~6af!j9EoHs8P0?JkvzB)oUwca zoDn!sTvD3h0751rV*?wN60cJHnefJZ8lrcAIKKP7s(myz&QUDS_@bN-UBHKYG7h7k zAwCq}E(@hYe5hc2D1ea{FjIUxAEJoJ&yt0R=S`G_aQ-k>ogkcs3ce+thkVyU}$wtZqORjOy( zW7(`L85U}N4qlb>SLI_Uv%80J>~j!-?Q!HrO2<{;X0o5jF?AwHYHx8_c}aQbGuh`I zk-fhI8)xuD{*2`hKfL@7?Cip<{_2}6X3SVIi?3_xWAOu!!3ktC*~W1;*tl6?L5Gd8 z6w58ZRi(N*HPK&!jGYLKohU0JuG1>id^L=rWx%E~87)3C4bgHFtCRk_&_VF~Y*p$M zU|dW~n#dPK&VB7v3mupx3^ZtKIFA;Wh_U!WR`00hF{r}p&tNojg?A#I6 zuAdQBBK~-F{l;rMl#&^HfQ7qvBMdp&_d-+0?%nI#XV2ff`mYNMTYiCfWPvQzT6Fw* zcnk#kh&sc65`hjz%`yrK{d7;yXh`&Q8?P{k9Lo*19Cw8;z`gM@Xl}n~AjTim_noyD`Z%Dps9t%=i<03|(vt z#ed=$O2!yNWXv%X-f0YavV5#z_|G=~^h<~Lk2MhP5ilLh$5N@!M+w<*=Y0Y&EG>+y zd0?`Nstq*3ZKJ|H55k~#3%CIT=cy1AUOeTF?UDsymdR2IJxPZw;-V?>szHAu@t@gh zK-5jqSWGa19U7ej+jJ8|gu#yp#G9;_%7R@2CL?ZR_^M1%#Wk|1!trv5%rJ^8;a7Id z9oNP-5xKRQBe*dxRPbTw`WY;Uj$gB8aL&VvEUE-ylVVC_iY=nj_SBDFxq=tY>f;gy zZvy=n*?uc_GDVMh8U0ovtKj0gz2L$t&3K2b!i)J}L+T-AXI)!n`<0=wh#)P5exUa< zXVqSWv1>06Wz}9>L$w#aCGYLE7gM*p&EAbo&bQXHkv6j03(Dv*=>TZt3alfBP(BO6 zoR!BoMvOa7d3J_r!HCrdVJf;oC3(07waLMXz(g%C1orv}N6(tLXqAL2qL#AS3W!57 zH)it4mW;vn)=b832=me_bWumy%L|*^>R$BiZ28NEZ&CBEhFyC;e)hHY_5UDrs4Z{M zR38mKak;DGrw>;?QTdnO$=!BQ`+~M@S0nwy`EC2D=aX@A7d?)cX10&P0wRNj-Z}>2 z8>=p*arCcyOF{+UY5Ty_4p$p-*$@z1DFuU_!8L(9#E*s$;z}4lkjI_w@*%Xi8ZHG% z@JYN;RmY60B?ZisslJehcW~c^As26RtFut$lWy~(N8rp&t=V~Fu1Alv9`+oPhkBHu z&V8VHTp2wYwqyz&SwGrg6gp&H5>|qql+7jPxHG#^v%WahB^pTEEHFA6F**t$eT{Nt zu{JO&D&5qA7OZ&)o1RU3FpG9X%;$>35Z?Kt!R8Be*nG++hH~>*p4J0KD+@r+;4?~S zY#=?eVz+_mf5+_CXoz}xYMA{x4m!iZYBTf4roCu1+KYACdu>L6W(3jscOsgbt=s4h z@&x5rlp6-ipnU<*UP#7cEYE0<7}hFkVU-3jQC?U*`QDI~l_9cz9;e9O-|H;GIJJUR7%=w^prgJ~LN4~J1}F#7D?sRrZCs=?%i z*dUdBPtumdEO!xR{Qi`!AB@oP_SrAr`Sz~Sr~a1)-o^M`7H)g)Cd|I6HW&&54Qzbl zbPL~$#dHRNT3GD2R}cO23hT2#pP^CQp1!zc%NC(|^=fVD+iwe3_wHqDdLi%-_XOfK znkTbrH0FMWJ!dr<^H7b(IaH%@4b^B=>f@OptL!x!H5%2%@TEm;0|&&1ggw2~Vbo|; ztDXObLq(KD4SXXW+=0TV(wKdmkI{uIm(uI|x72^WVbxN4)$lj%(Kb1$GBg@_74F4B}4T6_{bdu zyoQ6qwh;*2c^iSC?zmtOWbq`u2#RLNmaJ_Ba1&$SXqyY5GS1#$;2}`LBR3f^U1c@# z|J^iOu#V#Ka%w$Dq@71ZSu}e_qZx|=!!|{TVJGTHs>KVszBTCX0=h%wTX&{A_s(>O zhw-}C>kEWXfE-@c=}!zNJun*Sy8g|k{#&}{y`6kr>54l2m5lGXqssBQh3P8@w$y}5P^oDXm{6Nsg9`O(m5vEmT$v(1~-+|S;q!q6|-qx);r zEF*_@nJE>4?{^?|vRYSd){X~0@wP22f-zo~$!vRo(TR7|%@43MYSax7OlX^L+Xcb2 zFjGV7)>_5$;ODx4%U?G3j4}4*3tBV%=BR80cQxxM^66EhJhtl?YpEgNDH(1NNIBot zrq(mXG}@*%?HzP3-_xdLJ>S!&)iN$O{ry*{zOBs~!JMEcj`SQ*n2zK;tJLd*Umatg zh}(;V-ZP_C28YUl0^7Fij@wEY0pF`tg#ZdH6G`*m8bS5RHrIk`AB;u8mPP3j%0;EaG}h$(7|0DDyx&OGKPI} z+N#t^n7qS?C?8QJE{`hZvS0u)ZN%$i<*Z7NT380}R)A4sn{-Z*z44L|g3O0SS)ErVOGc^m;#RP(xN5iI*3N7r9NU?clgr=G z2Iz{J{pdkT=A!8RtW9GL`5UST@53(5VHM%m--Lhv`}aWwJxs}V(`u1`@0-2Xg($e*o!%?zE5X1>W+YtUU3rjczAY3Et5rlQ?*yl~=Q=k2L^CH32+KRuc zCHB$zY+u_ftlRKk!}DgEZXhNS>$c9G3E%lAuQm(mTP5zNkFdQsvi5=<`}=Wm)fcyQ ziznzFtycd{DS^(s({J&4hy51c;+fmJFVnZQ1nL~1UFc!7TkzKej9*gV17L!{!QW;s z2$%sv7y#c&pN}T)<0E?O^;t9YQRzcNoR+v>Q1pF9;QA6@04WQ8 z3)}T!`}DC3Wci>V>>~Vkk?zLPE0(y<0OJ>o$G$pp1Fyb(#&&*n#ul0LhLZjCsIXb= zgDaQnzg=mz;dP9wnm7hkhrmyx#WaUT_m>?%9*G=3F7#c9L@xZIw3O$iKr5K8=yW=a zee_h5HO?|p5FJ!k>n+~4{!x=t##Sst`Kbpp`6*oR5&f_Gb$ZY1^xkcK>>rblxr5gQ zFT+-saAdWf*fSgQVK*7S-7o@Ioq#PEX#~9|WM9&h6S=TXTUnf2iZ#RUk6UZ## zkaU6V>+C0=aGC41*`2QP5C|RzyNlHbS&^*n96$c-vqRrq758U%Wbe<8`$Ql+hCnQO zJs0ga`{9Uxy;Z|@gRshq?I3(Wu^-%baMCRcJDGz!Z7FV9aly&2eEK(RGZ?4bD?4*= zdzfvXRK-gIJ6^75wAu}F>V4M6g~Y%^brQ)V{OVCzI{~a zDB%_`%y}Og3sKEzZh~VGPr*YSNp#{iatC&??LP+xkxp|!+ABxNY|{}!;Q33!Qg}9# zFA>7um##|(;QW8P{r&$1juiRN004N}V_;-pU;yIxdxMU|^V@u7kmq0kfm0WZ9>D1T zJN~7yUuSOyayb~7K%xMO@eXhR004N}V_;-pU~m3s$H2g0`hUm&9qiW`fFda1CIFhK z2P=5mZBsF5Q&AK>|G)cQN(U#wBAr4&!Ql@gK}14Qt+ibu6p>I$2%%(X&@{wQBtxel zA%rd}3LhoLK^&Y!N+?kT2ca!R2_1rC$K&beRk?{QxO z&K5a>cWMF+?I9)CaXU1QlD>)AFISP18Y&XUqO7CD_pGyn$3&ESl;tyg@*{PKwAnyWSCN!7+C0CapP(&cXsaE@ zb;eD!+21Fg8I?WeH_#5n;oH3a!84}FKgsvGZi3vxj9$SDeFw?03&`k`nAHZ;(nCqb z@lnD!M=q!qHo2FpTF$uYBP|!=CgKg+sF zAo)hKJ z9Lk*U9FZp$)oJ92JpYj;b(8n4!FSh?B=RPQS+xgn))N-y8PP=IFPCA}WdHyG00000 z0000005|}20agN30_+271C9f<1KI=>1Xcue1d;@{1kME*1v&+Y1?mPc29^f$2Nnm2 z2jU102s8*t2xt3DOEQ3VI5>3ib;q3z7@U3+N0K3`h)a4AKn@4Pp(X4fGC7 z4zLc|4;BwT52g>|5Ec+b5O5HP5VR295cUxk5rz@e5*QMC63i0_6W|mc6j~IV6wVat z6-*V771|a!7LFFe7bq8K7p@o97+x5X7|a;@8DtrL8SEN18a5hk8zvi;90nXv9Bdst z9cUf?9)2FI9>gBvABG>KALt-1AW9%+Ac!EUAmAYYAs`_twaA{rukBDf;> zBRnIxBp4)$B;X}5C3YpcCI%*CCX6PwCgdj|Cx9pVC|D@CDI6)TDkLgED!MBGD@ZGp zEAlKbEO;#VEqX2fE{HEMFUl}Gc6rHK>v04P=VKS_(!F8qJb*S zw9s6+Qe~)A9NCvYG4!kGS%z7neboAyy}8VeLJ>O zy-jLtb@QV2{igHSDkrn5;P0;+?(S}{1{Ck3E$;3vMT!>J;2H=C8w6W`;2H=p0KqLtfPooL z2Vf+W@wN1XD&J*Q1J#U4{VGR=JtJ@eQTPkl1o zOV7P<#tcRFdgGPXX8PirZDz?g+gx)LIAop$=38iyLW?c2)Mv}Au-ro_yblpb5nTQ+rjw1bpvBBgZBoGfQXHZjD3+C-Pp7v z6gLP&dT$U30x}vRWjC;C$3!q}U{P@0z^v`EfkVM{6H6zPHkiW>0zOd~H*$lBHUJQbJD>$pNcI2# literal 0 HcmV?d00001 diff --git a/appasar/canary/app_bootstrap/splash/index.html b/appasar/canary/app_bootstrap/splash/index.html new file mode 100644 index 0000000..5dec1de --- /dev/null +++ b/appasar/canary/app_bootstrap/splash/index.html @@ -0,0 +1,11 @@ + + + + + Discord Updater + + +
+ + + diff --git a/appasar/canary/app_bootstrap/splash/index.js b/appasar/canary/app_bootstrap/splash/index.js new file mode 100644 index 0000000..9f84c5e --- /dev/null +++ b/appasar/canary/app_bootstrap/splash/index.js @@ -0,0 +1,25745 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 85); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + +var validateFormat = function validateFormat(format) {}; + +if (process.env.NODE_ENV !== 'production') { + validateFormat = function validateFormat(format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; +} + +function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } +} + +module.exports = invariant; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var emptyFunction = __webpack_require__(7); + +/** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var warning = emptyFunction; + +if (process.env.NODE_ENV !== 'production') { + var printWarning = function printWarning(format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + warning = function warning(condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + + if (format.indexOf('Failed Composite propType: ') === 0) { + return; // Ignore CompositeComponent proptype check. + } + + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning.apply(undefined, [format].concat(args)); + } + }; +} + +module.exports = warning; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + +/** + * WARNING: DO NOT manually require this module. + * This is a replacement for `invariant(...)` used by the error code system + * and will _only_ be required by the corresponding babel pass. + * It always throws. + */ + +function reactProdInvariant(code) { + var argCount = arguments.length - 1; + + var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; + + for (var argIdx = 0; argIdx < argCount; argIdx++) { + message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); + } + + message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; + + var error = new Error(message); + error.name = 'Invariant Violation'; + error.framesToPop = 1; // we don't care about reactProdInvariant's own frame + + throw error; +} + +module.exports = reactProdInvariant; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + + +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var DOMProperty = __webpack_require__(12); +var ReactDOMComponentFlags = __webpack_require__(59); + +var invariant = __webpack_require__(0); + +var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; +var Flags = ReactDOMComponentFlags; + +var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); + +/** + * Check if a given node should be cached. + */ +function shouldPrecacheNode(node, nodeID) { + return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' '; +} + +/** + * Drill down (through composites and empty components) until we get a host or + * host text component. + * + * This is pretty polymorphic but unavoidable with the current structure we have + * for `_renderedChildren`. + */ +function getRenderedHostOrTextFromComponent(component) { + var rendered; + while (rendered = component._renderedComponent) { + component = rendered; + } + return component; +} + +/** + * Populate `_hostNode` on the rendered host/text component with the given + * DOM node. The passed `inst` can be a composite. + */ +function precacheNode(inst, node) { + var hostInst = getRenderedHostOrTextFromComponent(inst); + hostInst._hostNode = node; + node[internalInstanceKey] = hostInst; +} + +function uncacheNode(inst) { + var node = inst._hostNode; + if (node) { + delete node[internalInstanceKey]; + inst._hostNode = null; + } +} + +/** + * Populate `_hostNode` on each child of `inst`, assuming that the children + * match up with the DOM (element) children of `node`. + * + * We cache entire levels at once to avoid an n^2 problem where we access the + * children of a node sequentially and have to walk from the start to our target + * node every time. + * + * Since we update `_renderedChildren` and the actual DOM at (slightly) + * different times, we could race here and see a newer `_renderedChildren` than + * the DOM nodes we see. To avoid this, ReactMultiChild calls + * `prepareToManageChildren` before we change `_renderedChildren`, at which + * time the container's child nodes are always cached (until it unmounts). + */ +function precacheChildNodes(inst, node) { + if (inst._flags & Flags.hasCachedChildNodes) { + return; + } + var children = inst._renderedChildren; + var childNode = node.firstChild; + outer: for (var name in children) { + if (!children.hasOwnProperty(name)) { + continue; + } + var childInst = children[name]; + var childID = getRenderedHostOrTextFromComponent(childInst)._domID; + if (childID === 0) { + // We're currently unmounting this child in ReactMultiChild; skip it. + continue; + } + // We assume the child nodes are in the same order as the child instances. + for (; childNode !== null; childNode = childNode.nextSibling) { + if (shouldPrecacheNode(childNode, childID)) { + precacheNode(childInst, childNode); + continue outer; + } + } + // We reached the end of the DOM children without finding an ID match. + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0; + } + inst._flags |= Flags.hasCachedChildNodes; +} + +/** + * Given a DOM node, return the closest ReactDOMComponent or + * ReactDOMTextComponent instance ancestor. + */ +function getClosestInstanceFromNode(node) { + if (node[internalInstanceKey]) { + return node[internalInstanceKey]; + } + + // Walk up the tree until we find an ancestor whose instance we have cached. + var parents = []; + while (!node[internalInstanceKey]) { + parents.push(node); + if (node.parentNode) { + node = node.parentNode; + } else { + // Top of the tree. This node must not be part of a React tree (or is + // unmounted, potentially). + return null; + } + } + + var closest; + var inst; + for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { + closest = inst; + if (parents.length) { + precacheChildNodes(inst, node); + } + } + + return closest; +} + +/** + * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent + * instance, or null if the node was not rendered by this React. + */ +function getInstanceFromNode(node) { + var inst = getClosestInstanceFromNode(node); + if (inst != null && inst._hostNode === node) { + return inst; + } else { + return null; + } +} + +/** + * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding + * DOM node. + */ +function getNodeFromInstance(inst) { + // Without this first invariant, passing a non-DOM-component triggers the next + // invariant for a missing parent, which is super confusing. + !(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; + + if (inst._hostNode) { + return inst._hostNode; + } + + // Walk up the tree until we find an ancestor whose DOM node we have cached. + var parents = []; + while (!inst._hostNode) { + parents.push(inst); + !inst._hostParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0; + inst = inst._hostParent; + } + + // Now parents contains each ancestor that does *not* have a cached native + // node, and `inst` is the deepest ancestor that does. + for (; parents.length; inst = parents.pop()) { + precacheChildNodes(inst, inst._hostNode); + } + + return inst._hostNode; +} + +var ReactDOMComponentTree = { + getClosestInstanceFromNode: getClosestInstanceFromNode, + getInstanceFromNode: getInstanceFromNode, + getNodeFromInstance: getNodeFromInstance, + precacheChildNodes: precacheChildNodes, + precacheNode: precacheNode, + uncacheNode: uncacheNode +}; + +module.exports = ReactDOMComponentTree; + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + +/** + * Simple, lightweight module assisting with the detection and context of + * Worker. Helps avoid circular dependencies and allows code to reason about + * whether or not they are in a Worker, even if they never include the main + * `ReactWorker` dependency. + */ +var ExecutionEnvironment = { + + canUseDOM: canUseDOM, + + canUseWorkers: typeof Worker !== 'undefined', + + canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), + + canUseViewport: canUseDOM && !!window.screen, + + isInWorker: !canUseDOM // For now, this is true - might change in the future. + +}; + +module.exports = ExecutionEnvironment; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2016-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(16); + +var ReactCurrentOwner = __webpack_require__(9); + +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +function isNative(fn) { + // Based on isNative() from Lodash + var funcToString = Function.prototype.toString; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var reIsNative = RegExp('^' + funcToString + // Take an example native function source for comparison + .call(hasOwnProperty + // Strip regex characters so we can use it for regex + ).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&' + // Remove hasOwnProperty from the template to make it generic + ).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); + try { + var source = funcToString.call(fn); + return reIsNative.test(source); + } catch (err) { + return false; + } +} + +var canUseCollections = +// Array.from +typeof Array.from === 'function' && +// Map +typeof Map === 'function' && isNative(Map) && +// Map.prototype.keys +Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) && +// Set +typeof Set === 'function' && isNative(Set) && +// Set.prototype.keys +Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); + +var setItem; +var getItem; +var removeItem; +var getItemIDs; +var addRoot; +var removeRoot; +var getRootIDs; + +if (canUseCollections) { + var itemMap = new Map(); + var rootIDSet = new Set(); + + setItem = function (id, item) { + itemMap.set(id, item); + }; + getItem = function (id) { + return itemMap.get(id); + }; + removeItem = function (id) { + itemMap['delete'](id); + }; + getItemIDs = function () { + return Array.from(itemMap.keys()); + }; + + addRoot = function (id) { + rootIDSet.add(id); + }; + removeRoot = function (id) { + rootIDSet['delete'](id); + }; + getRootIDs = function () { + return Array.from(rootIDSet.keys()); + }; +} else { + var itemByKey = {}; + var rootByKey = {}; + + // Use non-numeric keys to prevent V8 performance issues: + // https://github.com/facebook/react/pull/7232 + var getKeyFromID = function (id) { + return '.' + id; + }; + var getIDFromKey = function (key) { + return parseInt(key.substr(1), 10); + }; + + setItem = function (id, item) { + var key = getKeyFromID(id); + itemByKey[key] = item; + }; + getItem = function (id) { + var key = getKeyFromID(id); + return itemByKey[key]; + }; + removeItem = function (id) { + var key = getKeyFromID(id); + delete itemByKey[key]; + }; + getItemIDs = function () { + return Object.keys(itemByKey).map(getIDFromKey); + }; + + addRoot = function (id) { + var key = getKeyFromID(id); + rootByKey[key] = true; + }; + removeRoot = function (id) { + var key = getKeyFromID(id); + delete rootByKey[key]; + }; + getRootIDs = function () { + return Object.keys(rootByKey).map(getIDFromKey); + }; +} + +var unmountedIDs = []; + +function purgeDeep(id) { + var item = getItem(id); + if (item) { + var childIDs = item.childIDs; + + removeItem(id); + childIDs.forEach(purgeDeep); + } +} + +function describeComponentFrame(name, source, ownerName) { + return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); +} + +function getDisplayName(element) { + if (element == null) { + return '#empty'; + } else if (typeof element === 'string' || typeof element === 'number') { + return '#text'; + } else if (typeof element.type === 'string') { + return element.type; + } else { + return element.type.displayName || element.type.name || 'Unknown'; + } +} + +function describeID(id) { + var name = ReactComponentTreeHook.getDisplayName(id); + var element = ReactComponentTreeHook.getElement(id); + var ownerID = ReactComponentTreeHook.getOwnerID(id); + var ownerName; + if (ownerID) { + ownerName = ReactComponentTreeHook.getDisplayName(ownerID); + } + process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; + return describeComponentFrame(name, element && element._source, ownerName); +} + +var ReactComponentTreeHook = { + onSetChildren: function (id, nextChildIDs) { + var item = getItem(id); + !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; + item.childIDs = nextChildIDs; + + for (var i = 0; i < nextChildIDs.length; i++) { + var nextChildID = nextChildIDs[i]; + var nextChild = getItem(nextChildID); + !nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0; + !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0; + !nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0; + if (nextChild.parentID == null) { + nextChild.parentID = id; + // TODO: This shouldn't be necessary but mounting a new root during in + // componentWillMount currently causes not-yet-mounted components to + // be purged from our tree data so their parent id is missing. + } + !(nextChild.parentID === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0; + } + }, + onBeforeMountComponent: function (id, element, parentID) { + var item = { + element: element, + parentID: parentID, + text: null, + childIDs: [], + isMounted: false, + updateCount: 0 + }; + setItem(id, item); + }, + onBeforeUpdateComponent: function (id, element) { + var item = getItem(id); + if (!item || !item.isMounted) { + // We may end up here as a result of setState() in componentWillUnmount(). + // In this case, ignore the element. + return; + } + item.element = element; + }, + onMountComponent: function (id) { + var item = getItem(id); + !item ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0; + item.isMounted = true; + var isRoot = item.parentID === 0; + if (isRoot) { + addRoot(id); + } + }, + onUpdateComponent: function (id) { + var item = getItem(id); + if (!item || !item.isMounted) { + // We may end up here as a result of setState() in componentWillUnmount(). + // In this case, ignore the element. + return; + } + item.updateCount++; + }, + onUnmountComponent: function (id) { + var item = getItem(id); + if (item) { + // We need to check if it exists. + // `item` might not exist if it is inside an error boundary, and a sibling + // error boundary child threw while mounting. Then this instance never + // got a chance to mount, but it still gets an unmounting event during + // the error boundary cleanup. + item.isMounted = false; + var isRoot = item.parentID === 0; + if (isRoot) { + removeRoot(id); + } + } + unmountedIDs.push(id); + }, + purgeUnmountedComponents: function () { + if (ReactComponentTreeHook._preventPurging) { + // Should only be used for testing. + return; + } + + for (var i = 0; i < unmountedIDs.length; i++) { + var id = unmountedIDs[i]; + purgeDeep(id); + } + unmountedIDs.length = 0; + }, + isMounted: function (id) { + var item = getItem(id); + return item ? item.isMounted : false; + }, + getCurrentStackAddendum: function (topElement) { + var info = ''; + if (topElement) { + var name = getDisplayName(topElement); + var owner = topElement._owner; + info += describeComponentFrame(name, topElement._source, owner && owner.getName()); + } + + var currentOwner = ReactCurrentOwner.current; + var id = currentOwner && currentOwner._debugID; + + info += ReactComponentTreeHook.getStackAddendumByID(id); + return info; + }, + getStackAddendumByID: function (id) { + var info = ''; + while (id) { + info += describeID(id); + id = ReactComponentTreeHook.getParentID(id); + } + return info; + }, + getChildIDs: function (id) { + var item = getItem(id); + return item ? item.childIDs : []; + }, + getDisplayName: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (!element) { + return null; + } + return getDisplayName(element); + }, + getElement: function (id) { + var item = getItem(id); + return item ? item.element : null; + }, + getOwnerID: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (!element || !element._owner) { + return null; + } + return element._owner._debugID; + }, + getParentID: function (id) { + var item = getItem(id); + return item ? item.parentID : null; + }, + getSource: function (id) { + var item = getItem(id); + var element = item ? item.element : null; + var source = element != null ? element._source : null; + return source; + }, + getText: function (id) { + var element = ReactComponentTreeHook.getElement(id); + if (typeof element === 'string') { + return element; + } else if (typeof element === 'number') { + return '' + element; + } else { + return null; + } + }, + getUpdateCount: function (id) { + var item = getItem(id); + return item ? item.updateCount : 0; + }, + + + getRootIDs: getRootIDs, + getRegisteredIDs: getItemIDs, + + pushNonStandardWarningStack: function (isCreatingElement, currentSource) { + if (typeof console.reactStack !== 'function') { + return; + } + + var stack = []; + var currentOwner = ReactCurrentOwner.current; + var id = currentOwner && currentOwner._debugID; + + try { + if (isCreatingElement) { + stack.push({ + name: id ? ReactComponentTreeHook.getDisplayName(id) : null, + fileName: currentSource ? currentSource.fileName : null, + lineNumber: currentSource ? currentSource.lineNumber : null + }); + } + + while (id) { + var element = ReactComponentTreeHook.getElement(id); + var parentID = ReactComponentTreeHook.getParentID(id); + var ownerID = ReactComponentTreeHook.getOwnerID(id); + var ownerName = ownerID ? ReactComponentTreeHook.getDisplayName(ownerID) : null; + var source = element && element._source; + stack.push({ + name: ownerName, + fileName: source ? source.fileName : null, + lineNumber: source ? source.lineNumber : null + }); + id = parentID; + } + } catch (err) { + // Internal state is messed up. + // Stop building the stack (it's just a nice to have). + } + + console.reactStack(stack); + }, + popNonStandardWarningStack: function () { + if (typeof console.reactStackEnd !== 'function') { + return; + } + console.reactStackEnd(); + } +}; + +module.exports = ReactComponentTreeHook; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + +function makeEmptyFunction(arg) { + return function () { + return arg; + }; +} + +/** + * This function accepts and discards inputs; it has no side effects. This is + * primarily useful idiomatically for overridable function endpoints which + * always need to be callable, since JS lacks a null-call idiom ala Cocoa. + */ +var emptyFunction = function emptyFunction() {}; + +emptyFunction.thatReturns = makeEmptyFunction; +emptyFunction.thatReturnsFalse = makeEmptyFunction(false); +emptyFunction.thatReturnsTrue = makeEmptyFunction(true); +emptyFunction.thatReturnsNull = makeEmptyFunction(null); +emptyFunction.thatReturnsThis = function () { + return this; +}; +emptyFunction.thatReturnsArgument = function (arg) { + return arg; +}; + +module.exports = emptyFunction; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2016-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +// Trust the developer to only use ReactInstrumentation with a __DEV__ check + +var debugTool = null; + +if (process.env.NODE_ENV !== 'production') { + var ReactDebugTool = __webpack_require__(118); + debugTool = ReactDebugTool; +} + +module.exports = { debugTool: debugTool }; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +/** + * Keeps track of the current owner. + * + * The current owner is the component who should own any components that are + * currently being constructed. + */ +var ReactCurrentOwner = { + /** + * @internal + * @type {ReactComponent} + */ + current: null +}; + +module.exports = ReactCurrentOwner; + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2), + _assign = __webpack_require__(3); + +var CallbackQueue = __webpack_require__(63); +var PooledClass = __webpack_require__(14); +var ReactFeatureFlags = __webpack_require__(64); +var ReactReconciler = __webpack_require__(17); +var Transaction = __webpack_require__(27); + +var invariant = __webpack_require__(0); + +var dirtyComponents = []; +var updateBatchNumber = 0; +var asapCallbackQueue = CallbackQueue.getPooled(); +var asapEnqueued = false; + +var batchingStrategy = null; + +function ensureInjected() { + !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0; +} + +var NESTED_UPDATES = { + initialize: function () { + this.dirtyComponentsLength = dirtyComponents.length; + }, + close: function () { + if (this.dirtyComponentsLength !== dirtyComponents.length) { + // Additional updates were enqueued by componentDidUpdate handlers or + // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run + // these new updates so that if A's componentDidUpdate calls setState on + // B, B will update before the callback A's updater provided when calling + // setState. + dirtyComponents.splice(0, this.dirtyComponentsLength); + flushBatchedUpdates(); + } else { + dirtyComponents.length = 0; + } + } +}; + +var UPDATE_QUEUEING = { + initialize: function () { + this.callbackQueue.reset(); + }, + close: function () { + this.callbackQueue.notifyAll(); + } +}; + +var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; + +function ReactUpdatesFlushTransaction() { + this.reinitializeTransaction(); + this.dirtyComponentsLength = null; + this.callbackQueue = CallbackQueue.getPooled(); + this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( + /* useCreateElement */true); +} + +_assign(ReactUpdatesFlushTransaction.prototype, Transaction, { + getTransactionWrappers: function () { + return TRANSACTION_WRAPPERS; + }, + + destructor: function () { + this.dirtyComponentsLength = null; + CallbackQueue.release(this.callbackQueue); + this.callbackQueue = null; + ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); + this.reconcileTransaction = null; + }, + + perform: function (method, scope, a) { + // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` + // with this transaction's wrappers around it. + return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); + } +}); + +PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); + +function batchedUpdates(callback, a, b, c, d, e) { + ensureInjected(); + return batchingStrategy.batchedUpdates(callback, a, b, c, d, e); +} + +/** + * Array comparator for ReactComponents by mount ordering. + * + * @param {ReactComponent} c1 first component you're comparing + * @param {ReactComponent} c2 second component you're comparing + * @return {number} Return value usable by Array.prototype.sort(). + */ +function mountOrderComparator(c1, c2) { + return c1._mountOrder - c2._mountOrder; +} + +function runBatchedUpdates(transaction) { + var len = transaction.dirtyComponentsLength; + !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0; + + // Since reconciling a component higher in the owner hierarchy usually (not + // always -- see shouldComponentUpdate()) will reconcile children, reconcile + // them before their children by sorting the array. + dirtyComponents.sort(mountOrderComparator); + + // Any updates enqueued while reconciling must be performed after this entire + // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and + // C, B could update twice in a single batch if C's render enqueues an update + // to B (since B would have already updated, we should skip it, and the only + // way we can know to do so is by checking the batch counter). + updateBatchNumber++; + + for (var i = 0; i < len; i++) { + // If a component is unmounted before pending changes apply, it will still + // be here, but we assume that it has cleared its _pendingCallbacks and + // that performUpdateIfNecessary is a noop. + var component = dirtyComponents[i]; + + // If performUpdateIfNecessary happens to enqueue any new updates, we + // shouldn't execute the callbacks until the next render happens, so + // stash the callbacks first + var callbacks = component._pendingCallbacks; + component._pendingCallbacks = null; + + var markerName; + if (ReactFeatureFlags.logTopLevelRenders) { + var namedComponent = component; + // Duck type TopLevelWrapper. This is probably always true. + if (component._currentElement.type.isReactTopLevelWrapper) { + namedComponent = component._renderedComponent; + } + markerName = 'React update: ' + namedComponent.getName(); + console.time(markerName); + } + + ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); + + if (markerName) { + console.timeEnd(markerName); + } + + if (callbacks) { + for (var j = 0; j < callbacks.length; j++) { + transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); + } + } + } +} + +var flushBatchedUpdates = function () { + // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents + // array and perform any updates enqueued by mount-ready handlers (i.e., + // componentDidUpdate) but we need to check here too in order to catch + // updates enqueued by setState callbacks and asap calls. + while (dirtyComponents.length || asapEnqueued) { + if (dirtyComponents.length) { + var transaction = ReactUpdatesFlushTransaction.getPooled(); + transaction.perform(runBatchedUpdates, null, transaction); + ReactUpdatesFlushTransaction.release(transaction); + } + + if (asapEnqueued) { + asapEnqueued = false; + var queue = asapCallbackQueue; + asapCallbackQueue = CallbackQueue.getPooled(); + queue.notifyAll(); + CallbackQueue.release(queue); + } + } +}; + +/** + * Mark a component as needing a rerender, adding an optional callback to a + * list of functions which will be executed once the rerender occurs. + */ +function enqueueUpdate(component) { + ensureInjected(); + + // Various parts of our code (such as ReactCompositeComponent's + // _renderValidatedComponent) assume that calls to render aren't nested; + // verify that that's the case. (This is called by each top-level update + // function, like setState, forceUpdate, etc.; creation and + // destruction of top-level components is guarded in ReactMount.) + + if (!batchingStrategy.isBatchingUpdates) { + batchingStrategy.batchedUpdates(enqueueUpdate, component); + return; + } + + dirtyComponents.push(component); + if (component._updateBatchNumber == null) { + component._updateBatchNumber = updateBatchNumber + 1; + } +} + +/** + * Enqueue a callback to be run at the end of the current batching cycle. Throws + * if no updates are currently being performed. + */ +function asap(callback, context) { + invariant(batchingStrategy.isBatchingUpdates, "ReactUpdates.asap: Can't enqueue an asap callback in a context where" + 'updates are not being batched.'); + asapCallbackQueue.enqueue(callback, context); + asapEnqueued = true; +} + +var ReactUpdatesInjection = { + injectReconcileTransaction: function (ReconcileTransaction) { + !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0; + ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; + }, + + injectBatchingStrategy: function (_batchingStrategy) { + !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0; + !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0; + !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0; + batchingStrategy = _batchingStrategy; + } +}; + +var ReactUpdates = { + /** + * React references `ReactReconcileTransaction` using this property in order + * to allow dependency injection. + * + * @internal + */ + ReactReconcileTransaction: null, + + batchedUpdates: batchedUpdates, + enqueueUpdate: enqueueUpdate, + flushBatchedUpdates: flushBatchedUpdates, + injection: ReactUpdatesInjection, + asap: asap +}; + +module.exports = ReactUpdates; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var PooledClass = __webpack_require__(14); + +var emptyFunction = __webpack_require__(7); +var warning = __webpack_require__(1); + +var didWarnForAddedNewProperty = false; +var isProxySupported = typeof Proxy === 'function'; + +var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; + +/** + * @interface Event + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var EventInterface = { + type: null, + target: null, + // currentTarget is set when dispatching; no use in copying it here + currentTarget: emptyFunction.thatReturnsNull, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function (event) { + return event.timeStamp || Date.now(); + }, + defaultPrevented: null, + isTrusted: null +}; + +/** + * Synthetic events are dispatched by event plugins, typically in response to a + * top-level event delegation handler. + * + * These systems should generally use pooling to reduce the frequency of garbage + * collection. The system should check `isPersistent` to determine whether the + * event should be released into the pool after being dispatched. Users that + * need a persisted event should invoke `persist`. + * + * Synthetic events (and subclasses) implement the DOM Level 3 Events API by + * normalizing browser quirks. Subclasses do not necessarily have to implement a + * DOM interface; custom application-specific events can also subclass this. + * + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {*} targetInst Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @param {DOMEventTarget} nativeEventTarget Target node. + */ +function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { + if (process.env.NODE_ENV !== 'production') { + // these have a getter/setter for warnings + delete this.nativeEvent; + delete this.preventDefault; + delete this.stopPropagation; + } + + this.dispatchConfig = dispatchConfig; + this._targetInst = targetInst; + this.nativeEvent = nativeEvent; + + var Interface = this.constructor.Interface; + for (var propName in Interface) { + if (!Interface.hasOwnProperty(propName)) { + continue; + } + if (process.env.NODE_ENV !== 'production') { + delete this[propName]; // this has a getter/setter for warnings + } + var normalize = Interface[propName]; + if (normalize) { + this[propName] = normalize(nativeEvent); + } else { + if (propName === 'target') { + this.target = nativeEventTarget; + } else { + this[propName] = nativeEvent[propName]; + } + } + } + + var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; + if (defaultPrevented) { + this.isDefaultPrevented = emptyFunction.thatReturnsTrue; + } else { + this.isDefaultPrevented = emptyFunction.thatReturnsFalse; + } + this.isPropagationStopped = emptyFunction.thatReturnsFalse; + return this; +} + +_assign(SyntheticEvent.prototype, { + preventDefault: function () { + this.defaultPrevented = true; + var event = this.nativeEvent; + if (!event) { + return; + } + + if (event.preventDefault) { + event.preventDefault(); + // eslint-disable-next-line valid-typeof + } else if (typeof event.returnValue !== 'unknown') { + event.returnValue = false; + } + this.isDefaultPrevented = emptyFunction.thatReturnsTrue; + }, + + stopPropagation: function () { + var event = this.nativeEvent; + if (!event) { + return; + } + + if (event.stopPropagation) { + event.stopPropagation(); + // eslint-disable-next-line valid-typeof + } else if (typeof event.cancelBubble !== 'unknown') { + // The ChangeEventPlugin registers a "propertychange" event for + // IE. This event does not support bubbling or cancelling, and + // any references to cancelBubble throw "Member not found". A + // typeof check of "unknown" circumvents this issue (and is also + // IE specific). + event.cancelBubble = true; + } + + this.isPropagationStopped = emptyFunction.thatReturnsTrue; + }, + + /** + * We release all dispatched `SyntheticEvent`s after each event loop, adding + * them back into the pool. This allows a way to hold onto a reference that + * won't be added back into the pool. + */ + persist: function () { + this.isPersistent = emptyFunction.thatReturnsTrue; + }, + + /** + * Checks if this event should be released back into the pool. + * + * @return {boolean} True if this should not be released, false otherwise. + */ + isPersistent: emptyFunction.thatReturnsFalse, + + /** + * `PooledClass` looks for `destructor` on each instance it releases. + */ + destructor: function () { + var Interface = this.constructor.Interface; + for (var propName in Interface) { + if (process.env.NODE_ENV !== 'production') { + Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); + } else { + this[propName] = null; + } + } + for (var i = 0; i < shouldBeReleasedProperties.length; i++) { + this[shouldBeReleasedProperties[i]] = null; + } + if (process.env.NODE_ENV !== 'production') { + Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); + Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction)); + Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); + } + } +}); + +SyntheticEvent.Interface = EventInterface; + +/** + * Helper to reduce boilerplate when creating subclasses. + * + * @param {function} Class + * @param {?object} Interface + */ +SyntheticEvent.augmentClass = function (Class, Interface) { + var Super = this; + + var E = function () {}; + E.prototype = Super.prototype; + var prototype = new E(); + + _assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; + + Class.Interface = _assign({}, Super.Interface, Interface); + Class.augmentClass = Super.augmentClass; + + PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); +}; + +/** Proxying after everything set on SyntheticEvent + * to resolve Proxy issue on some WebKit browsers + * in which some Event properties are set to undefined (GH#10010) + */ +if (process.env.NODE_ENV !== 'production') { + if (isProxySupported) { + /*eslint-disable no-func-assign */ + SyntheticEvent = new Proxy(SyntheticEvent, { + construct: function (target, args) { + return this.apply(target, Object.create(target.prototype), args); + }, + apply: function (constructor, that, args) { + return new Proxy(constructor.apply(that, args), { + set: function (target, prop, value) { + if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) { + process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0; + didWarnForAddedNewProperty = true; + } + target[prop] = value; + return true; + } + }); + } + }); + /*eslint-enable no-func-assign */ + } +} + +PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); + +module.exports = SyntheticEvent; + +/** + * Helper to nullify syntheticEvent instance properties when destructing + * + * @param {object} SyntheticEvent + * @param {String} propName + * @return {object} defineProperty object + */ +function getPooledWarningPropertyDefinition(propName, getVal) { + var isFunction = typeof getVal === 'function'; + return { + configurable: true, + set: set, + get: get + }; + + function set(val) { + var action = isFunction ? 'setting the method' : 'setting the property'; + warn(action, 'This is effectively a no-op'); + return val; + } + + function get() { + var action = isFunction ? 'accessing the method' : 'accessing the property'; + var result = isFunction ? 'This is a no-op function' : 'This is set to null'; + warn(action, result); + return getVal; + } + + function warn(action, result) { + var warningCondition = false; + process.env.NODE_ENV !== 'production' ? warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0; + } +} + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +function checkMask(value, bitmask) { + return (value & bitmask) === bitmask; +} + +var DOMPropertyInjection = { + /** + * Mapping from normalized, camelcased property names to a configuration that + * specifies how the associated DOM property should be accessed or rendered. + */ + MUST_USE_PROPERTY: 0x1, + HAS_BOOLEAN_VALUE: 0x4, + HAS_NUMERIC_VALUE: 0x8, + HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, + HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, + + /** + * Inject some specialized knowledge about the DOM. This takes a config object + * with the following properties: + * + * isCustomAttribute: function that given an attribute name will return true + * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* + * attributes where it's impossible to enumerate all of the possible + * attribute names, + * + * Properties: object mapping DOM property name to one of the + * DOMPropertyInjection constants or null. If your attribute isn't in here, + * it won't get written to the DOM. + * + * DOMAttributeNames: object mapping React attribute name to the DOM + * attribute name. Attribute names not specified use the **lowercase** + * normalized name. + * + * DOMAttributeNamespaces: object mapping React attribute name to the DOM + * attribute namespace URL. (Attribute names not specified use no namespace.) + * + * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. + * Property names not specified use the normalized name. + * + * DOMMutationMethods: Properties that require special mutation methods. If + * `value` is undefined, the mutation method should unset the property. + * + * @param {object} domPropertyConfig the config as described above. + */ + injectDOMPropertyConfig: function (domPropertyConfig) { + var Injection = DOMPropertyInjection; + var Properties = domPropertyConfig.Properties || {}; + var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; + var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; + var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; + var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; + + if (domPropertyConfig.isCustomAttribute) { + DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); + } + + for (var propName in Properties) { + !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0; + + var lowerCased = propName.toLowerCase(); + var propConfig = Properties[propName]; + + var propertyInfo = { + attributeName: lowerCased, + attributeNamespace: null, + propertyName: propName, + mutationMethod: null, + + mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), + hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), + hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), + hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE), + hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) + }; + !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0; + + if (process.env.NODE_ENV !== 'production') { + DOMProperty.getPossibleStandardName[lowerCased] = propName; + } + + if (DOMAttributeNames.hasOwnProperty(propName)) { + var attributeName = DOMAttributeNames[propName]; + propertyInfo.attributeName = attributeName; + if (process.env.NODE_ENV !== 'production') { + DOMProperty.getPossibleStandardName[attributeName] = propName; + } + } + + if (DOMAttributeNamespaces.hasOwnProperty(propName)) { + propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; + } + + if (DOMPropertyNames.hasOwnProperty(propName)) { + propertyInfo.propertyName = DOMPropertyNames[propName]; + } + + if (DOMMutationMethods.hasOwnProperty(propName)) { + propertyInfo.mutationMethod = DOMMutationMethods[propName]; + } + + DOMProperty.properties[propName] = propertyInfo; + } + } +}; + +/* eslint-disable max-len */ +var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; +/* eslint-enable max-len */ + +/** + * DOMProperty exports lookup objects that can be used like functions: + * + * > DOMProperty.isValid['id'] + * true + * > DOMProperty.isValid['foobar'] + * undefined + * + * Although this may be confusing, it performs better in general. + * + * @see http://jsperf.com/key-exists + * @see http://jsperf.com/key-missing + */ +var DOMProperty = { + ID_ATTRIBUTE_NAME: 'data-reactid', + ROOT_ATTRIBUTE_NAME: 'data-reactroot', + + ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, + ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', + + /** + * Map from property "standard name" to an object with info about how to set + * the property in the DOM. Each object contains: + * + * attributeName: + * Used when rendering markup or with `*Attribute()`. + * attributeNamespace + * propertyName: + * Used on DOM node instances. (This includes properties that mutate due to + * external factors.) + * mutationMethod: + * If non-null, used instead of the property or `setAttribute()` after + * initial render. + * mustUseProperty: + * Whether the property must be accessed and mutated as an object property. + * hasBooleanValue: + * Whether the property should be removed when set to a falsey value. + * hasNumericValue: + * Whether the property must be numeric or parse as a numeric and should be + * removed when set to a falsey value. + * hasPositiveNumericValue: + * Whether the property must be positive numeric or parse as a positive + * numeric and should be removed when set to a falsey value. + * hasOverloadedBooleanValue: + * Whether the property can be used as a flag as well as with a value. + * Removed when strictly equal to false; present without a value when + * strictly equal to true; present with a value otherwise. + */ + properties: {}, + + /** + * Mapping from lowercase property names to the properly cased version, used + * to warn in the case of missing properties. Available only in __DEV__. + * + * autofocus is predefined, because adding it to the property whitelist + * causes unintended side effects. + * + * @type {Object} + */ + getPossibleStandardName: process.env.NODE_ENV !== 'production' ? { autofocus: 'autoFocus' } : null, + + /** + * All of the isCustomAttribute() functions that have been injected. + */ + _isCustomAttributeFunctions: [], + + /** + * Checks whether a property name is a custom attribute. + * @method + */ + isCustomAttribute: function (attributeName) { + for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { + var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; + if (isCustomAttributeFn(attributeName)) { + return true; + } + } + return false; + }, + + injection: DOMPropertyInjection +}; + +module.exports = DOMProperty; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var ReactCurrentOwner = __webpack_require__(9); + +var warning = __webpack_require__(1); +var canDefineProperty = __webpack_require__(24); +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var REACT_ELEMENT_TYPE = __webpack_require__(54); + +var RESERVED_PROPS = { + key: true, + ref: true, + __self: true, + __source: true +}; + +var specialPropKeyWarningShown, specialPropRefWarningShown; + +function hasValidRef(config) { + if (process.env.NODE_ENV !== 'production') { + if (hasOwnProperty.call(config, 'ref')) { + var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; + if (getter && getter.isReactWarning) { + return false; + } + } + } + return config.ref !== undefined; +} + +function hasValidKey(config) { + if (process.env.NODE_ENV !== 'production') { + if (hasOwnProperty.call(config, 'key')) { + var getter = Object.getOwnPropertyDescriptor(config, 'key').get; + if (getter && getter.isReactWarning) { + return false; + } + } + } + return config.key !== undefined; +} + +function defineKeyPropWarningGetter(props, displayName) { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; + } + }; + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, 'key', { + get: warnAboutAccessingKey, + configurable: true + }); +} + +function defineRefPropWarningGetter(props, displayName) { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0; + } + }; + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, 'ref', { + get: warnAboutAccessingRef, + configurable: true + }); +} + +/** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, no instanceof check + * will work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} key + * @param {string|object} ref + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @param {*} owner + * @param {*} props + * @internal + */ +var ReactElement = function (type, key, ref, self, source, owner, props) { + var element = { + // This tag allow us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + + // Record the component responsible for creating this element. + _owner: owner + }; + + if (process.env.NODE_ENV !== 'production') { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; + + // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + if (canDefineProperty) { + Object.defineProperty(element._store, 'validated', { + configurable: false, + enumerable: false, + writable: true, + value: false + }); + // self and source are DEV only properties. + Object.defineProperty(element, '_self', { + configurable: false, + enumerable: false, + writable: false, + value: self + }); + // Two elements created in two different places should be considered + // equal for testing purposes and therefore we hide it from enumeration. + Object.defineProperty(element, '_source', { + configurable: false, + enumerable: false, + writable: false, + value: source + }); + } else { + element._store.validated = false; + element._self = self; + element._source = source; + } + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; +}; + +/** + * Create and return a new ReactElement of the given type. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement + */ +ReactElement.createElement = function (type, config, children) { + var propName; + + // Reserved names are extracted + var props = {}; + + var key = null; + var ref = null; + var self = null; + var source = null; + + if (config != null) { + if (hasValidRef(config)) { + ref = config.ref; + } + if (hasValidKey(config)) { + key = '' + config.key; + } + + self = config.__self === undefined ? null : config.__self; + source = config.__source === undefined ? null : config.__source; + // Remaining properties are added to a new props object + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; + } + } + } + + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + if (process.env.NODE_ENV !== 'production') { + if (Object.freeze) { + Object.freeze(childArray); + } + } + props.children = childArray; + } + + // Resolve default props + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + if (process.env.NODE_ENV !== 'production') { + if (key || ref) { + if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { + var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + } + } + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); +}; + +/** + * Return a function that produces ReactElements of a given type. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory + */ +ReactElement.createFactory = function (type) { + var factory = ReactElement.createElement.bind(null, type); + // Expose the type on the factory and the prototype so that it can be + // easily accessed on elements. E.g. `.type === Foo`. + // This should not be named `constructor` since this may not be the function + // that created the element, and it may not even be a constructor. + // Legacy hook TODO: Warn if this is accessed + factory.type = type; + return factory; +}; + +ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { + var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); + + return newElement; +}; + +/** + * Clone and return a new ReactElement using element as the starting point. + * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement + */ +ReactElement.cloneElement = function (element, config, children) { + var propName; + + // Original props are copied + var props = _assign({}, element.props); + + // Reserved names are extracted + var key = element.key; + var ref = element.ref; + // Self is preserved since the owner is preserved. + var self = element._self; + // Source is preserved since cloneElement is unlikely to be targeted by a + // transpiler, and the original source is probably a better indicator of the + // true owner. + var source = element._source; + + // Owner will be preserved, unless ref is overridden + var owner = element._owner; + + if (config != null) { + if (hasValidRef(config)) { + // Silently steal the ref from the parent. + ref = config.ref; + owner = ReactCurrentOwner.current; + } + if (hasValidKey(config)) { + key = '' + config.key; + } + + // Remaining properties override existing props + var defaultProps; + if (element.type && element.type.defaultProps) { + defaultProps = element.type.defaultProps; + } + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + if (config[propName] === undefined && defaultProps !== undefined) { + // Resolve default props + props[propName] = defaultProps[propName]; + } else { + props[propName] = config[propName]; + } + } + } + } + + // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + var childrenLength = arguments.length - 2; + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + props.children = childArray; + } + + return ReactElement(element.type, key, ref, self, source, owner, props); +}; + +/** + * Verifies the object is a ReactElement. + * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement + * @param {?object} object + * @return {boolean} True if `object` is a valid component. + * @final + */ +ReactElement.isValidElement = function (object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +}; + +module.exports = ReactElement; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +/** + * Static poolers. Several custom versions for each potential number of + * arguments. A completely generic pooler is easy to implement, but would + * require accessing the `arguments` object. In each of these, `this` refers to + * the Class itself, not an instance. If any others are needed, simply add them + * here, or in their own files. + */ +var oneArgumentPooler = function (copyFieldsFrom) { + var Klass = this; + if (Klass.instancePool.length) { + var instance = Klass.instancePool.pop(); + Klass.call(instance, copyFieldsFrom); + return instance; + } else { + return new Klass(copyFieldsFrom); + } +}; + +var twoArgumentPooler = function (a1, a2) { + var Klass = this; + if (Klass.instancePool.length) { + var instance = Klass.instancePool.pop(); + Klass.call(instance, a1, a2); + return instance; + } else { + return new Klass(a1, a2); + } +}; + +var threeArgumentPooler = function (a1, a2, a3) { + var Klass = this; + if (Klass.instancePool.length) { + var instance = Klass.instancePool.pop(); + Klass.call(instance, a1, a2, a3); + return instance; + } else { + return new Klass(a1, a2, a3); + } +}; + +var fourArgumentPooler = function (a1, a2, a3, a4) { + var Klass = this; + if (Klass.instancePool.length) { + var instance = Klass.instancePool.pop(); + Klass.call(instance, a1, a2, a3, a4); + return instance; + } else { + return new Klass(a1, a2, a3, a4); + } +}; + +var standardReleaser = function (instance) { + var Klass = this; + !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0; + instance.destructor(); + if (Klass.instancePool.length < Klass.poolSize) { + Klass.instancePool.push(instance); + } +}; + +var DEFAULT_POOL_SIZE = 10; +var DEFAULT_POOLER = oneArgumentPooler; + +/** + * Augments `CopyConstructor` to be a poolable class, augmenting only the class + * itself (statically) not adding any prototypical fields. Any CopyConstructor + * you give this may have a `poolSize` property, and will look for a + * prototypical `destructor` on instances. + * + * @param {Function} CopyConstructor Constructor that can be used to reset. + * @param {Function} pooler Customizable pooler. + */ +var addPoolingTo = function (CopyConstructor, pooler) { + // Casting as any so that flow ignores the actual implementation and trusts + // it to match the type we declared + var NewKlass = CopyConstructor; + NewKlass.instancePool = []; + NewKlass.getPooled = pooler || DEFAULT_POOLER; + if (!NewKlass.poolSize) { + NewKlass.poolSize = DEFAULT_POOL_SIZE; + } + NewKlass.release = standardReleaser; + return NewKlass; +}; + +var PooledClass = { + addPoolingTo: addPoolingTo, + oneArgumentPooler: oneArgumentPooler, + twoArgumentPooler: twoArgumentPooler, + threeArgumentPooler: threeArgumentPooler, + fourArgumentPooler: fourArgumentPooler +}; + +module.exports = PooledClass; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var ReactBaseClasses = __webpack_require__(52); +var ReactChildren = __webpack_require__(94); +var ReactDOMFactories = __webpack_require__(98); +var ReactElement = __webpack_require__(13); +var ReactPropTypes = __webpack_require__(102); +var ReactVersion = __webpack_require__(104); + +var createReactClass = __webpack_require__(105); +var onlyChild = __webpack_require__(107); + +var createElement = ReactElement.createElement; +var createFactory = ReactElement.createFactory; +var cloneElement = ReactElement.cloneElement; + +if (process.env.NODE_ENV !== 'production') { + var lowPriorityWarning = __webpack_require__(32); + var canDefineProperty = __webpack_require__(24); + var ReactElementValidator = __webpack_require__(56); + var didWarnPropTypesDeprecated = false; + createElement = ReactElementValidator.createElement; + createFactory = ReactElementValidator.createFactory; + cloneElement = ReactElementValidator.cloneElement; +} + +var __spread = _assign; +var createMixin = function (mixin) { + return mixin; +}; + +if (process.env.NODE_ENV !== 'production') { + var warnedForSpread = false; + var warnedForCreateMixin = false; + __spread = function () { + lowPriorityWarning(warnedForSpread, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.'); + warnedForSpread = true; + return _assign.apply(null, arguments); + }; + + createMixin = function (mixin) { + lowPriorityWarning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. ' + 'In React v16.0, it will be removed. ' + 'You can use this mixin directly instead. ' + 'See https://fb.me/createmixin-was-never-implemented for more info.'); + warnedForCreateMixin = true; + return mixin; + }; +} + +var React = { + // Modern + + Children: { + map: ReactChildren.map, + forEach: ReactChildren.forEach, + count: ReactChildren.count, + toArray: ReactChildren.toArray, + only: onlyChild + }, + + Component: ReactBaseClasses.Component, + PureComponent: ReactBaseClasses.PureComponent, + + createElement: createElement, + cloneElement: cloneElement, + isValidElement: ReactElement.isValidElement, + + // Classic + + PropTypes: ReactPropTypes, + createClass: createReactClass, + createFactory: createFactory, + createMixin: createMixin, + + // This looks DOM specific but these are actually isomorphic helpers + // since they are just generating DOM strings. + DOM: ReactDOMFactories, + + version: ReactVersion, + + // Deprecated hook for JSX spread, don't use this for anything. + __spread: __spread +}; + +if (process.env.NODE_ENV !== 'production') { + var warnedForCreateClass = false; + if (canDefineProperty) { + Object.defineProperty(React, 'PropTypes', { + get: function () { + lowPriorityWarning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated,' + ' and will be removed in React v16.0.' + ' Use the latest available v15.* prop-types package from npm instead.' + ' For info on usage, compatibility, migration and more, see ' + 'https://fb.me/prop-types-docs'); + didWarnPropTypesDeprecated = true; + return ReactPropTypes; + } + }); + + Object.defineProperty(React, 'createClass', { + get: function () { + lowPriorityWarning(warnedForCreateClass, 'Accessing createClass via the main React package is deprecated,' + ' and will be removed in React v16.0.' + " Use a plain JavaScript class instead. If you're not yet " + 'ready to migrate, create-react-class v15.* is available ' + 'on npm as a temporary, drop-in replacement. ' + 'For more info see https://fb.me/react-create-class'); + warnedForCreateClass = true; + return createReactClass; + } + }); + } + + // React.DOM factories are deprecated. Wrap these methods so that + // invocations of the React.DOM namespace and alert users to switch + // to the `react-dom-factories` package. + React.DOM = {}; + var warnedForFactories = false; + Object.keys(ReactDOMFactories).forEach(function (factory) { + React.DOM[factory] = function () { + if (!warnedForFactories) { + lowPriorityWarning(false, 'Accessing factories like React.DOM.%s has been deprecated ' + 'and will be removed in v16.0+. Use the ' + 'react-dom-factories package instead. ' + ' Version 1.0 provides a drop-in replacement.' + ' For more info, see https://fb.me/react-dom-factories', factory); + warnedForFactories = true; + } + return ReactDOMFactories[factory].apply(ReactDOMFactories, arguments); + }; + }); +} + +module.exports = React; + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + +/** + * WARNING: DO NOT manually require this module. + * This is a replacement for `invariant(...)` used by the error code system + * and will _only_ be required by the corresponding babel pass. + * It always throws. + */ + +function reactProdInvariant(code) { + var argCount = arguments.length - 1; + + var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; + + for (var argIdx = 0; argIdx < argCount; argIdx++) { + message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); + } + + message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; + + var error = new Error(message); + error.name = 'Invariant Violation'; + error.framesToPop = 1; // we don't care about reactProdInvariant's own frame + + throw error; +} + +module.exports = reactProdInvariant; + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactRef = __webpack_require__(116); +var ReactInstrumentation = __webpack_require__(8); + +var warning = __webpack_require__(1); + +/** + * Helper to call ReactRef.attachRefs with this composite component, split out + * to avoid allocations in the transaction mount-ready queue. + */ +function attachRefs() { + ReactRef.attachRefs(this, this._currentElement); +} + +var ReactReconciler = { + /** + * Initializes the component, renders markup, and registers event listeners. + * + * @param {ReactComponent} internalInstance + * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction + * @param {?object} the containing host component instance + * @param {?object} info about the host container + * @return {?string} Rendered markup to be inserted into the DOM. + * @final + * @internal + */ + mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID) // 0 in production and for roots + { + if (process.env.NODE_ENV !== 'production') { + if (internalInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID); + } + } + var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID); + if (internalInstance._currentElement && internalInstance._currentElement.ref != null) { + transaction.getReactMountReady().enqueue(attachRefs, internalInstance); + } + if (process.env.NODE_ENV !== 'production') { + if (internalInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID); + } + } + return markup; + }, + + /** + * Returns a value that can be passed to + * ReactComponentEnvironment.replaceNodeWithMarkup. + */ + getHostNode: function (internalInstance) { + return internalInstance.getHostNode(); + }, + + /** + * Releases any resources allocated by `mountComponent`. + * + * @final + * @internal + */ + unmountComponent: function (internalInstance, safely) { + if (process.env.NODE_ENV !== 'production') { + if (internalInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID); + } + } + ReactRef.detachRefs(internalInstance, internalInstance._currentElement); + internalInstance.unmountComponent(safely); + if (process.env.NODE_ENV !== 'production') { + if (internalInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); + } + } + }, + + /** + * Update a component using a new element. + * + * @param {ReactComponent} internalInstance + * @param {ReactElement} nextElement + * @param {ReactReconcileTransaction} transaction + * @param {object} context + * @internal + */ + receiveComponent: function (internalInstance, nextElement, transaction, context) { + var prevElement = internalInstance._currentElement; + + if (nextElement === prevElement && context === internalInstance._context) { + // Since elements are immutable after the owner is rendered, + // we can do a cheap identity compare here to determine if this is a + // superfluous reconcile. It's possible for state to be mutable but such + // change should trigger an update of the owner which would recreate + // the element. We explicitly check for the existence of an owner since + // it's possible for an element created outside a composite to be + // deeply mutated and reused. + + // TODO: Bailing out early is just a perf optimization right? + // TODO: Removing the return statement should affect correctness? + return; + } + + if (process.env.NODE_ENV !== 'production') { + if (internalInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); + } + } + + var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); + + if (refsChanged) { + ReactRef.detachRefs(internalInstance, prevElement); + } + + internalInstance.receiveComponent(nextElement, transaction, context); + + if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { + transaction.getReactMountReady().enqueue(attachRefs, internalInstance); + } + + if (process.env.NODE_ENV !== 'production') { + if (internalInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); + } + } + }, + + /** + * Flush any dirty changes in a component. + * + * @param {ReactComponent} internalInstance + * @param {ReactReconcileTransaction} transaction + * @internal + */ + performUpdateIfNecessary: function (internalInstance, transaction, updateBatchNumber) { + if (internalInstance._updateBatchNumber !== updateBatchNumber) { + // The component's enqueued batch number should always be the current + // batch or the following one. + process.env.NODE_ENV !== 'production' ? warning(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1, 'performUpdateIfNecessary: Unexpected batch number (current %s, ' + 'pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : void 0; + return; + } + if (process.env.NODE_ENV !== 'production') { + if (internalInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement); + } + } + internalInstance.performUpdateIfNecessary(transaction); + if (process.env.NODE_ENV !== 'production') { + if (internalInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); + } + } + } +}; + +module.exports = ReactReconciler; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMNamespaces = __webpack_require__(41); +var setInnerHTML = __webpack_require__(29); + +var createMicrosoftUnsafeLocalFunction = __webpack_require__(42); +var setTextContent = __webpack_require__(68); + +var ELEMENT_NODE_TYPE = 1; +var DOCUMENT_FRAGMENT_NODE_TYPE = 11; + +/** + * In IE (8-11) and Edge, appending nodes with no children is dramatically + * faster than appending a full subtree, so we essentially queue up the + * .appendChild calls here and apply them so each node is added to its parent + * before any children are added. + * + * In other browsers, doing so is slower or neutral compared to the other order + * (in Firefox, twice as slow) so we only do this inversion in IE. + * + * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode. + */ +var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent); + +function insertTreeChildren(tree) { + if (!enableLazy) { + return; + } + var node = tree.node; + var children = tree.children; + if (children.length) { + for (var i = 0; i < children.length; i++) { + insertTreeBefore(node, children[i], null); + } + } else if (tree.html != null) { + setInnerHTML(node, tree.html); + } else if (tree.text != null) { + setTextContent(node, tree.text); + } +} + +var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) { + // DocumentFragments aren't actually part of the DOM after insertion so + // appending children won't update the DOM. We need to ensure the fragment + // is properly populated first, breaking out of our lazy approach for just + // this level. Also, some plugins (like Flash Player) will read + // nodes immediately upon insertion into the DOM, so + // must also be populated prior to insertion into the DOM. + if (tree.node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE || tree.node.nodeType === ELEMENT_NODE_TYPE && tree.node.nodeName.toLowerCase() === 'object' && (tree.node.namespaceURI == null || tree.node.namespaceURI === DOMNamespaces.html)) { + insertTreeChildren(tree); + parentNode.insertBefore(tree.node, referenceNode); + } else { + parentNode.insertBefore(tree.node, referenceNode); + insertTreeChildren(tree); + } +}); + +function replaceChildWithTree(oldNode, newTree) { + oldNode.parentNode.replaceChild(newTree.node, oldNode); + insertTreeChildren(newTree); +} + +function queueChild(parentTree, childTree) { + if (enableLazy) { + parentTree.children.push(childTree); + } else { + parentTree.node.appendChild(childTree.node); + } +} + +function queueHTML(tree, html) { + if (enableLazy) { + tree.html = html; + } else { + setInnerHTML(tree.node, html); + } +} + +function queueText(tree, text) { + if (enableLazy) { + tree.text = text; + } else { + setTextContent(tree.node, text); + } +} + +function toString() { + return this.node.nodeName; +} + +function DOMLazyTree(node) { + return { + node: node, + children: [], + html: null, + text: null, + toString: toString + }; +} + +DOMLazyTree.insertTreeBefore = insertTreeBefore; +DOMLazyTree.replaceChildWithTree = replaceChildWithTree; +DOMLazyTree.queueChild = queueChild; +DOMLazyTree.queueHTML = queueHTML; +DOMLazyTree.queueText = queueText; + +module.exports = DOMLazyTree; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = __webpack_require__(15); + + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var EventPluginHub = __webpack_require__(21); +var EventPluginUtils = __webpack_require__(35); + +var accumulateInto = __webpack_require__(60); +var forEachAccumulated = __webpack_require__(61); +var warning = __webpack_require__(1); + +var getListener = EventPluginHub.getListener; + +/** + * Some event types have a notion of different registration names for different + * "phases" of propagation. This finds listeners by a given phase. + */ +function listenerAtPhase(inst, event, propagationPhase) { + var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; + return getListener(inst, registrationName); +} + +/** + * Tags a `SyntheticEvent` with dispatched listeners. Creating this function + * here, allows us to not have to bind or create functions for each event. + * Mutating the event's members allows us to not have to create a wrapping + * "dispatch" object that pairs the event with the listener. + */ +function accumulateDirectionalDispatches(inst, phase, event) { + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0; + } + var listener = listenerAtPhase(inst, event, phase); + if (listener) { + event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } +} + +/** + * Collect dispatches (must be entirely collected before dispatching - see unit + * tests). Lazily allocate the array to conserve memory. We must loop through + * each event and perform the traversal for each one. We cannot perform a + * single traversal for the entire collection of events because each event may + * have a different target. + */ +function accumulateTwoPhaseDispatchesSingle(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); + } +} + +/** + * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. + */ +function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { + if (event && event.dispatchConfig.phasedRegistrationNames) { + var targetInst = event._targetInst; + var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null; + EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); + } +} + +/** + * Accumulates without regard to direction, does not look for phased + * registration names. Same as `accumulateDirectDispatchesSingle` but without + * requiring that the `dispatchMarker` be the same as the dispatched ID. + */ +function accumulateDispatches(inst, ignoredDirection, event) { + if (event && event.dispatchConfig.registrationName) { + var registrationName = event.dispatchConfig.registrationName; + var listener = getListener(inst, registrationName); + if (listener) { + event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); + event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); + } + } +} + +/** + * Accumulates dispatches on an `SyntheticEvent`, but only for the + * `dispatchMarker`. + * @param {SyntheticEvent} event + */ +function accumulateDirectDispatchesSingle(event) { + if (event && event.dispatchConfig.registrationName) { + accumulateDispatches(event._targetInst, null, event); + } +} + +function accumulateTwoPhaseDispatches(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); +} + +function accumulateTwoPhaseDispatchesSkipTarget(events) { + forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); +} + +function accumulateEnterLeaveDispatches(leave, enter, from, to) { + EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); +} + +function accumulateDirectDispatches(events) { + forEachAccumulated(events, accumulateDirectDispatchesSingle); +} + +/** + * A small set of propagation patterns, each of which will accept a small amount + * of information, and generate a set of "dispatch ready event objects" - which + * are sets of events that have already been annotated with a set of dispatched + * listener functions/ids. The API is designed this way to discourage these + * propagation strategies from actually executing the dispatches, since we + * always want to collect the entire set of dispatches before executing event a + * single one. + * + * @constructor EventPropagators + */ +var EventPropagators = { + accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, + accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, + accumulateDirectDispatches: accumulateDirectDispatches, + accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches +}; + +module.exports = EventPropagators; + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var EventPluginRegistry = __webpack_require__(26); +var EventPluginUtils = __webpack_require__(35); +var ReactErrorUtils = __webpack_require__(36); + +var accumulateInto = __webpack_require__(60); +var forEachAccumulated = __webpack_require__(61); +var invariant = __webpack_require__(0); + +/** + * Internal store for event listeners + */ +var listenerBank = {}; + +/** + * Internal queue of events that have accumulated their dispatches and are + * waiting to have their dispatches executed. + */ +var eventQueue = null; + +/** + * Dispatches an event and releases it back into the pool, unless persistent. + * + * @param {?object} event Synthetic event to be dispatched. + * @param {boolean} simulated If the event is simulated (changes exn behavior) + * @private + */ +var executeDispatchesAndRelease = function (event, simulated) { + if (event) { + EventPluginUtils.executeDispatchesInOrder(event, simulated); + + if (!event.isPersistent()) { + event.constructor.release(event); + } + } +}; +var executeDispatchesAndReleaseSimulated = function (e) { + return executeDispatchesAndRelease(e, true); +}; +var executeDispatchesAndReleaseTopLevel = function (e) { + return executeDispatchesAndRelease(e, false); +}; + +var getDictionaryKey = function (inst) { + // Prevents V8 performance issue: + // https://github.com/facebook/react/pull/7232 + return '.' + inst._rootNodeID; +}; + +function isInteractive(tag) { + return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; +} + +function shouldPreventMouseEvent(name, type, props) { + switch (name) { + case 'onClick': + case 'onClickCapture': + case 'onDoubleClick': + case 'onDoubleClickCapture': + case 'onMouseDown': + case 'onMouseDownCapture': + case 'onMouseMove': + case 'onMouseMoveCapture': + case 'onMouseUp': + case 'onMouseUpCapture': + return !!(props.disabled && isInteractive(type)); + default: + return false; + } +} + +/** + * This is a unified interface for event plugins to be installed and configured. + * + * Event plugins can implement the following properties: + * + * `extractEvents` {function(string, DOMEventTarget, string, object): *} + * Required. When a top-level event is fired, this method is expected to + * extract synthetic events that will in turn be queued and dispatched. + * + * `eventTypes` {object} + * Optional, plugins that fire events must publish a mapping of registration + * names that are used to register listeners. Values of this mapping must + * be objects that contain `registrationName` or `phasedRegistrationNames`. + * + * `executeDispatch` {function(object, function, string)} + * Optional, allows plugins to override how an event gets dispatched. By + * default, the listener is simply invoked. + * + * Each plugin that is injected into `EventsPluginHub` is immediately operable. + * + * @public + */ +var EventPluginHub = { + /** + * Methods for injecting dependencies. + */ + injection: { + /** + * @param {array} InjectedEventPluginOrder + * @public + */ + injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, + + /** + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + */ + injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName + }, + + /** + * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent. + * + * @param {object} inst The instance, which is the source of events. + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @param {function} listener The callback to store. + */ + putListener: function (inst, registrationName, listener) { + !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0; + + var key = getDictionaryKey(inst); + var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); + bankForRegistrationName[key] = listener; + + var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; + if (PluginModule && PluginModule.didPutListener) { + PluginModule.didPutListener(inst, registrationName, listener); + } + }, + + /** + * @param {object} inst The instance, which is the source of events. + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @return {?function} The stored callback. + */ + getListener: function (inst, registrationName) { + // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not + // live here; needs to be moved to a better place soon + var bankForRegistrationName = listenerBank[registrationName]; + if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, inst._currentElement.props)) { + return null; + } + var key = getDictionaryKey(inst); + return bankForRegistrationName && bankForRegistrationName[key]; + }, + + /** + * Deletes a listener from the registration bank. + * + * @param {object} inst The instance, which is the source of events. + * @param {string} registrationName Name of listener (e.g. `onClick`). + */ + deleteListener: function (inst, registrationName) { + var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; + if (PluginModule && PluginModule.willDeleteListener) { + PluginModule.willDeleteListener(inst, registrationName); + } + + var bankForRegistrationName = listenerBank[registrationName]; + // TODO: This should never be null -- when is it? + if (bankForRegistrationName) { + var key = getDictionaryKey(inst); + delete bankForRegistrationName[key]; + } + }, + + /** + * Deletes all listeners for the DOM element with the supplied ID. + * + * @param {object} inst The instance, which is the source of events. + */ + deleteAllListeners: function (inst) { + var key = getDictionaryKey(inst); + for (var registrationName in listenerBank) { + if (!listenerBank.hasOwnProperty(registrationName)) { + continue; + } + + if (!listenerBank[registrationName][key]) { + continue; + } + + var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; + if (PluginModule && PluginModule.willDeleteListener) { + PluginModule.willDeleteListener(inst, registrationName); + } + + delete listenerBank[registrationName][key]; + } + }, + + /** + * Allows registered plugins an opportunity to extract events from top-level + * native browser events. + * + * @return {*} An accumulation of synthetic events. + * @internal + */ + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var events; + var plugins = EventPluginRegistry.plugins; + for (var i = 0; i < plugins.length; i++) { + // Not every plugin in the ordering may be loaded at runtime. + var possiblePlugin = plugins[i]; + if (possiblePlugin) { + var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); + if (extractedEvents) { + events = accumulateInto(events, extractedEvents); + } + } + } + return events; + }, + + /** + * Enqueues a synthetic event that should be dispatched when + * `processEventQueue` is invoked. + * + * @param {*} events An accumulation of synthetic events. + * @internal + */ + enqueueEvents: function (events) { + if (events) { + eventQueue = accumulateInto(eventQueue, events); + } + }, + + /** + * Dispatches all synthetic events on the event queue. + * + * @internal + */ + processEventQueue: function (simulated) { + // Set `eventQueue` to null before processing it so that we can tell if more + // events get enqueued while processing. + var processingEventQueue = eventQueue; + eventQueue = null; + if (simulated) { + forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated); + } else { + forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); + } + !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0; + // This would be a good time to rethrow if any of the event handlers threw. + ReactErrorUtils.rethrowCaughtError(); + }, + + /** + * These are needed for tests only. Do not use! + */ + __purge: function () { + listenerBank = {}; + }, + + __getListenerBank: function () { + return listenerBank; + } +}; + +module.exports = EventPluginHub; + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticEvent = __webpack_require__(11); + +var getEventTarget = __webpack_require__(37); + +/** + * @interface UIEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var UIEventInterface = { + view: function (event) { + if (event.view) { + return event.view; + } + + var target = getEventTarget(event); + if (target.window === target) { + // target is a window object + return target; + } + + var doc = target.ownerDocument; + // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. + if (doc) { + return doc.defaultView || doc.parentWindow; + } else { + return window; + } + }, + detail: function (event) { + return event.detail || 0; + } +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticEvent} + */ +function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); + +module.exports = SyntheticUIEvent; + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * `ReactInstanceMap` maintains a mapping from a public facing stateful + * instance (key) and the internal representation (value). This allows public + * methods to accept the user facing instance as an argument and map them back + * to internal methods. + */ + +// TODO: Replace this with ES6: var ReactInstanceMap = new Map(); + +var ReactInstanceMap = { + /** + * This API should be called `delete` but we'd have to make sure to always + * transform these to strings for IE support. When this transform is fully + * supported we can rename it. + */ + remove: function (key) { + key._reactInternalInstance = undefined; + }, + + get: function (key) { + return key._reactInternalInstance; + }, + + has: function (key) { + return key._reactInternalInstance !== undefined; + }, + + set: function (key, value) { + key._reactInternalInstance = value; + } +}; + +module.exports = ReactInstanceMap; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var canDefineProperty = false; +if (process.env.NODE_ENV !== 'production') { + try { + // $FlowFixMe https://github.com/facebook/flow/issues/285 + Object.defineProperty({}, 'x', { get: function () {} }); + canDefineProperty = true; + } catch (x) { + // IE will fail on defineProperty + } +} + +module.exports = canDefineProperty; + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var emptyObject = {}; + +if (process.env.NODE_ENV !== 'production') { + Object.freeze(emptyObject); +} + +module.exports = emptyObject; + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +/** + * Injectable ordering of event plugins. + */ +var eventPluginOrder = null; + +/** + * Injectable mapping from names to event plugin modules. + */ +var namesToPlugins = {}; + +/** + * Recomputes the plugin list using the injected plugins and plugin ordering. + * + * @private + */ +function recomputePluginOrdering() { + if (!eventPluginOrder) { + // Wait until an `eventPluginOrder` is injected. + return; + } + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName]; + var pluginIndex = eventPluginOrder.indexOf(pluginName); + !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : _prodInvariant('96', pluginName) : void 0; + if (EventPluginRegistry.plugins[pluginIndex]) { + continue; + } + !pluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : _prodInvariant('97', pluginName) : void 0; + EventPluginRegistry.plugins[pluginIndex] = pluginModule; + var publishedEvents = pluginModule.eventTypes; + for (var eventName in publishedEvents) { + !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : _prodInvariant('98', eventName, pluginName) : void 0; + } + } +} + +/** + * Publishes an event so that it can be dispatched by the supplied plugin. + * + * @param {object} dispatchConfig Dispatch configuration for the event. + * @param {object} PluginModule Plugin publishing the event. + * @return {boolean} True if the event was successfully published. + * @private + */ +function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { + !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0; + EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; + + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + if (phasedRegistrationNames) { + for (var phaseName in phasedRegistrationNames) { + if (phasedRegistrationNames.hasOwnProperty(phaseName)) { + var phasedRegistrationName = phasedRegistrationNames[phaseName]; + publishRegistrationName(phasedRegistrationName, pluginModule, eventName); + } + } + return true; + } else if (dispatchConfig.registrationName) { + publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); + return true; + } + return false; +} + +/** + * Publishes a registration name that is used to identify dispatched events and + * can be used with `EventPluginHub.putListener` to register listeners. + * + * @param {string} registrationName Registration name to add. + * @param {object} PluginModule Plugin publishing the event. + * @private + */ +function publishRegistrationName(registrationName, pluginModule, eventName) { + !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0; + EventPluginRegistry.registrationNameModules[registrationName] = pluginModule; + EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; + + if (process.env.NODE_ENV !== 'production') { + var lowerCasedName = registrationName.toLowerCase(); + EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName; + + if (registrationName === 'onDoubleClick') { + EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName; + } + } +} + +/** + * Registers plugins so that they can extract and dispatch events. + * + * @see {EventPluginHub} + */ +var EventPluginRegistry = { + /** + * Ordered list of injected plugins. + */ + plugins: [], + + /** + * Mapping from event name to dispatch config + */ + eventNameDispatchConfigs: {}, + + /** + * Mapping from registration name to plugin module + */ + registrationNameModules: {}, + + /** + * Mapping from registration name to event name + */ + registrationNameDependencies: {}, + + /** + * Mapping from lowercase registration names to the properly cased version, + * used to warn in the case of missing event handlers. Available + * only in __DEV__. + * @type {Object} + */ + possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null, + // Trust the developer to only use possibleRegistrationNames in __DEV__ + + /** + * Injects an ordering of plugins (by plugin name). This allows the ordering + * to be decoupled from injection of the actual plugins so that ordering is + * always deterministic regardless of packaging, on-the-fly injection, etc. + * + * @param {array} InjectedEventPluginOrder + * @internal + * @see {EventPluginHub.injection.injectEventPluginOrder} + */ + injectEventPluginOrder: function (injectedEventPluginOrder) { + !!eventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : _prodInvariant('101') : void 0; + // Clone the ordering so it cannot be dynamically mutated. + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); + }, + + /** + * Injects plugins to be used by `EventPluginHub`. The plugin names must be + * in the ordering injected by `injectEventPluginOrder`. + * + * Plugins can be injected as part of page initialization or on-the-fly. + * + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + * @internal + * @see {EventPluginHub.injection.injectEventPluginsByName} + */ + injectEventPluginsByName: function (injectedNamesToPlugins) { + var isOrderingDirty = false; + for (var pluginName in injectedNamesToPlugins) { + if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { + continue; + } + var pluginModule = injectedNamesToPlugins[pluginName]; + if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { + !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : _prodInvariant('102', pluginName) : void 0; + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = true; + } + } + if (isOrderingDirty) { + recomputePluginOrdering(); + } + }, + + /** + * Looks up the plugin for the supplied event. + * + * @param {object} event A synthetic event. + * @return {?object} The plugin that created the supplied event. + * @internal + */ + getPluginModuleForEvent: function (event) { + var dispatchConfig = event.dispatchConfig; + if (dispatchConfig.registrationName) { + return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null; + } + if (dispatchConfig.phasedRegistrationNames !== undefined) { + // pulling phasedRegistrationNames out of dispatchConfig helps Flow see + // that it is not undefined. + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + + for (var phase in phasedRegistrationNames) { + if (!phasedRegistrationNames.hasOwnProperty(phase)) { + continue; + } + var pluginModule = EventPluginRegistry.registrationNameModules[phasedRegistrationNames[phase]]; + if (pluginModule) { + return pluginModule; + } + } + } + return null; + }, + + /** + * Exposed for unit testing. + * @private + */ + _resetEventPlugins: function () { + eventPluginOrder = null; + for (var pluginName in namesToPlugins) { + if (namesToPlugins.hasOwnProperty(pluginName)) { + delete namesToPlugins[pluginName]; + } + } + EventPluginRegistry.plugins.length = 0; + + var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; + for (var eventName in eventNameDispatchConfigs) { + if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { + delete eventNameDispatchConfigs[eventName]; + } + } + + var registrationNameModules = EventPluginRegistry.registrationNameModules; + for (var registrationName in registrationNameModules) { + if (registrationNameModules.hasOwnProperty(registrationName)) { + delete registrationNameModules[registrationName]; + } + } + + if (process.env.NODE_ENV !== 'production') { + var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames; + for (var lowerCasedName in possibleRegistrationNames) { + if (possibleRegistrationNames.hasOwnProperty(lowerCasedName)) { + delete possibleRegistrationNames[lowerCasedName]; + } + } + } + } +}; + +module.exports = EventPluginRegistry; + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +var OBSERVED_ERROR = {}; + +/** + * `Transaction` creates a black box that is able to wrap any method such that + * certain invariants are maintained before and after the method is invoked + * (Even if an exception is thrown while invoking the wrapped method). Whoever + * instantiates a transaction can provide enforcers of the invariants at + * creation time. The `Transaction` class itself will supply one additional + * automatic invariant for you - the invariant that any transaction instance + * should not be run while it is already being run. You would typically create a + * single instance of a `Transaction` for reuse multiple times, that potentially + * is used to wrap several different methods. Wrappers are extremely simple - + * they only require implementing two methods. + * + *
+ *                       wrappers (injected at creation time)
+ *                                      +        +
+ *                                      |        |
+ *                    +-----------------|--------|--------------+
+ *                    |                 v        |              |
+ *                    |      +---------------+   |              |
+ *                    |   +--|    wrapper1   |---|----+         |
+ *                    |   |  +---------------+   v    |         |
+ *                    |   |          +-------------+  |         |
+ *                    |   |     +----|   wrapper2  |--------+   |
+ *                    |   |     |    +-------------+  |     |   |
+ *                    |   |     |                     |     |   |
+ *                    |   v     v                     v     v   | wrapper
+ *                    | +---+ +---+   +---------+   +---+ +---+ | invariants
+ * perform(anyMethod) | |   | |   |   |         |   |   | |   | | maintained
+ * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
+ *                    | |   | |   |   |         |   |   | |   | |
+ *                    | |   | |   |   |         |   |   | |   | |
+ *                    | |   | |   |   |         |   |   | |   | |
+ *                    | +---+ +---+   +---------+   +---+ +---+ |
+ *                    |  initialize                    close    |
+ *                    +-----------------------------------------+
+ * 
+ * + * Use cases: + * - Preserving the input selection ranges before/after reconciliation. + * Restoring selection even in the event of an unexpected error. + * - Deactivating events while rearranging the DOM, preventing blurs/focuses, + * while guaranteeing that afterwards, the event system is reactivated. + * - Flushing a queue of collected DOM mutations to the main UI thread after a + * reconciliation takes place in a worker thread. + * - Invoking any collected `componentDidUpdate` callbacks after rendering new + * content. + * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue + * to preserve the `scrollTop` (an automatic scroll aware DOM). + * - (Future use case): Layout calculations before and after DOM updates. + * + * Transactional plugin API: + * - A module that has an `initialize` method that returns any precomputation. + * - and a `close` method that accepts the precomputation. `close` is invoked + * when the wrapped process is completed, or has failed. + * + * @param {Array} transactionWrapper Wrapper modules + * that implement `initialize` and `close`. + * @return {Transaction} Single transaction for reuse in thread. + * + * @class Transaction + */ +var TransactionImpl = { + /** + * Sets up this instance so that it is prepared for collecting metrics. Does + * so such that this setup method may be used on an instance that is already + * initialized, in a way that does not consume additional memory upon reuse. + * That can be useful if you decide to make your subclass of this mixin a + * "PooledClass". + */ + reinitializeTransaction: function () { + this.transactionWrappers = this.getTransactionWrappers(); + if (this.wrapperInitData) { + this.wrapperInitData.length = 0; + } else { + this.wrapperInitData = []; + } + this._isInTransaction = false; + }, + + _isInTransaction: false, + + /** + * @abstract + * @return {Array} Array of transaction wrappers. + */ + getTransactionWrappers: null, + + isInTransaction: function () { + return !!this._isInTransaction; + }, + + /* eslint-disable space-before-function-paren */ + + /** + * Executes the function within a safety window. Use this for the top level + * methods that result in large amounts of computation/mutations that would + * need to be safety checked. The optional arguments helps prevent the need + * to bind in many cases. + * + * @param {function} method Member of scope to call. + * @param {Object} scope Scope to invoke from. + * @param {Object?=} a Argument to pass to the method. + * @param {Object?=} b Argument to pass to the method. + * @param {Object?=} c Argument to pass to the method. + * @param {Object?=} d Argument to pass to the method. + * @param {Object?=} e Argument to pass to the method. + * @param {Object?=} f Argument to pass to the method. + * + * @return {*} Return value from `method`. + */ + perform: function (method, scope, a, b, c, d, e, f) { + /* eslint-enable space-before-function-paren */ + !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0; + var errorThrown; + var ret; + try { + this._isInTransaction = true; + // Catching errors makes debugging more difficult, so we start with + // errorThrown set to true before setting it to false after calling + // close -- if it's still set to true in the finally block, it means + // one of these calls threw. + errorThrown = true; + this.initializeAll(0); + ret = method.call(scope, a, b, c, d, e, f); + errorThrown = false; + } finally { + try { + if (errorThrown) { + // If `method` throws, prefer to show that stack trace over any thrown + // by invoking `closeAll`. + try { + this.closeAll(0); + } catch (err) {} + } else { + // Since `method` didn't throw, we don't want to silence the exception + // here. + this.closeAll(0); + } + } finally { + this._isInTransaction = false; + } + } + return ret; + }, + + initializeAll: function (startIndex) { + var transactionWrappers = this.transactionWrappers; + for (var i = startIndex; i < transactionWrappers.length; i++) { + var wrapper = transactionWrappers[i]; + try { + // Catching errors makes debugging more difficult, so we start with the + // OBSERVED_ERROR state before overwriting it with the real return value + // of initialize -- if it's still set to OBSERVED_ERROR in the finally + // block, it means wrapper.initialize threw. + this.wrapperInitData[i] = OBSERVED_ERROR; + this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; + } finally { + if (this.wrapperInitData[i] === OBSERVED_ERROR) { + // The initializer for wrapper i threw an error; initialize the + // remaining wrappers but silence any exceptions from them to ensure + // that the first error is the one to bubble up. + try { + this.initializeAll(i + 1); + } catch (err) {} + } + } + } + }, + + /** + * Invokes each of `this.transactionWrappers.close[i]` functions, passing into + * them the respective return values of `this.transactionWrappers.init[i]` + * (`close`rs that correspond to initializers that failed will not be + * invoked). + */ + closeAll: function (startIndex) { + !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0; + var transactionWrappers = this.transactionWrappers; + for (var i = startIndex; i < transactionWrappers.length; i++) { + var wrapper = transactionWrappers[i]; + var initData = this.wrapperInitData[i]; + var errorThrown; + try { + // Catching errors makes debugging more difficult, so we start with + // errorThrown set to true before setting it to false after calling + // close -- if it's still set to true in the finally block, it means + // wrapper.close threw. + errorThrown = true; + if (initData !== OBSERVED_ERROR && wrapper.close) { + wrapper.close.call(this, initData); + } + errorThrown = false; + } finally { + if (errorThrown) { + // The closer for wrapper i threw an error; close the remaining + // wrappers but silence any exceptions from them to ensure that the + // first error is the one to bubble up. + try { + this.closeAll(i + 1); + } catch (e) {} + } + } + } + this.wrapperInitData.length = 0; + } +}; + +module.exports = TransactionImpl; + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticUIEvent = __webpack_require__(22); +var ViewportMetrics = __webpack_require__(67); + +var getEventModifierState = __webpack_require__(39); + +/** + * @interface MouseEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var MouseEventInterface = { + screenX: null, + screenY: null, + clientX: null, + clientY: null, + ctrlKey: null, + shiftKey: null, + altKey: null, + metaKey: null, + getModifierState: getEventModifierState, + button: function (event) { + // Webkit, Firefox, IE9+ + // which: 1 2 3 + // button: 0 1 2 (standard) + var button = event.button; + if ('which' in event) { + return button; + } + // IE<9 + // which: undefined + // button: 0 0 0 + // button: 1 4 2 (onmouseup) + return button === 2 ? 2 : button === 4 ? 1 : 0; + }, + buttons: null, + relatedTarget: function (event) { + return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); + }, + // "Proprietary" Interface. + pageX: function (event) { + return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft; + }, + pageY: function (event) { + return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; + } +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticUIEvent} + */ +function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); + +module.exports = SyntheticMouseEvent; + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ExecutionEnvironment = __webpack_require__(5); +var DOMNamespaces = __webpack_require__(41); + +var WHITESPACE_TEST = /^[ \r\n\t\f]/; +var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; + +var createMicrosoftUnsafeLocalFunction = __webpack_require__(42); + +// SVG temp container for IE lacking innerHTML +var reusableSVGContainer; + +/** + * Set the innerHTML property of a node, ensuring that whitespace is preserved + * even in IE8. + * + * @param {DOMElement} node + * @param {string} html + * @internal + */ +var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { + // IE does not have innerHTML for SVG nodes, so instead we inject the + // new markup in a temp node and then move the child nodes across into + // the target node + if (node.namespaceURI === DOMNamespaces.svg && !('innerHTML' in node)) { + reusableSVGContainer = reusableSVGContainer || document.createElement('div'); + reusableSVGContainer.innerHTML = '' + html + ''; + var svgNode = reusableSVGContainer.firstChild; + while (svgNode.firstChild) { + node.appendChild(svgNode.firstChild); + } + } else { + node.innerHTML = html; + } +}); + +if (ExecutionEnvironment.canUseDOM) { + // IE8: When updating a just created node with innerHTML only leading + // whitespace is removed. When updating an existing node with innerHTML + // whitespace in root TextNodes is also collapsed. + // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html + + // Feature detection; only IE8 is known to behave improperly like this. + var testElement = document.createElement('div'); + testElement.innerHTML = ' '; + if (testElement.innerHTML === '') { + setInnerHTML = function (node, html) { + // Magic theory: IE8 supposedly differentiates between added and updated + // nodes when processing innerHTML, innerHTML on updated nodes suffers + // from worse whitespace behavior. Re-adding a node like this triggers + // the initial and more favorable whitespace behavior. + // TODO: What to do on a detached node? + if (node.parentNode) { + node.parentNode.replaceChild(node, node); + } + + // We also implement a workaround for non-visible tags disappearing into + // thin air on IE8, this only happens if there is no visible text + // in-front of the non-visible tags. Piggyback on the whitespace fix + // and simply check if any non-visible tags appear in the source. + if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) { + // Recover leading whitespace by temporarily prepending any character. + // \uFEFF has the potential advantage of being zero-width/invisible. + // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode + // in hopes that this is preserved even if "\uFEFF" is transformed to + // the actual Unicode character (by Babel, for example). + // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 + node.innerHTML = String.fromCharCode(0xfeff) + html; + + // deleteData leaves an empty `TextNode` which offsets the index of all + // children. Definitely want to avoid this. + var textNode = node.firstChild; + if (textNode.data.length === 1) { + node.removeChild(textNode); + } else { + textNode.deleteData(0, 1); + } + } else { + node.innerHTML = html; + } + }; + } + testElement = null; +} + +module.exports = setInnerHTML; + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2016-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * Based on the escape-html library, which is used under the MIT License below: + * + * Copyright (c) 2012-2013 TJ Holowaychuk + * Copyright (c) 2015 Andreas Lubbe + * Copyright (c) 2015 Tiancheng "Timothy" Gu + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + + + +// code copied and modified from escape-html +/** + * Module variables. + * @private + */ + +var matchHtmlRegExp = /["'&<>]/; + +/** + * Escape special characters in the given string of html. + * + * @param {string} string The string to escape for inserting into HTML + * @return {string} + * @public + */ + +function escapeHtml(string) { + var str = '' + string; + var match = matchHtmlRegExp.exec(str); + + if (!match) { + return str; + } + + var escape; + var html = ''; + var index = 0; + var lastIndex = 0; + + for (index = match.index; index < str.length; index++) { + switch (str.charCodeAt(index)) { + case 34: + // " + escape = '"'; + break; + case 38: + // & + escape = '&'; + break; + case 39: + // ' + escape = '''; // modified from escape-html; used to be ''' + break; + case 60: + // < + escape = '<'; + break; + case 62: + // > + escape = '>'; + break; + default: + continue; + } + + if (lastIndex !== index) { + html += str.substring(lastIndex, index); + } + + lastIndex = index + 1; + html += escape; + } + + return lastIndex !== index ? html + str.substring(lastIndex, index) : html; +} +// end code copied and modified from escape-html + +/** + * Escapes text to prevent scripting attacks. + * + * @param {*} text Text value to escape. + * @return {string} An escaped string. + */ +function escapeTextContentForBrowser(text) { + if (typeof text === 'boolean' || typeof text === 'number') { + // this shortcircuit helps perf for types that we know will never have + // special characters, especially given that this function is used often + // for numeric dom ids. + return '' + text; + } + return escapeHtml(text); +} + +module.exports = escapeTextContentForBrowser; + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var EventPluginRegistry = __webpack_require__(26); +var ReactEventEmitterMixin = __webpack_require__(142); +var ViewportMetrics = __webpack_require__(67); + +var getVendorPrefixedEventName = __webpack_require__(143); +var isEventSupported = __webpack_require__(38); + +/** + * Summary of `ReactBrowserEventEmitter` event handling: + * + * - Top-level delegation is used to trap most native browser events. This + * may only occur in the main thread and is the responsibility of + * ReactEventListener, which is injected and can therefore support pluggable + * event sources. This is the only work that occurs in the main thread. + * + * - We normalize and de-duplicate events to account for browser quirks. This + * may be done in the worker thread. + * + * - Forward these native events (with the associated top-level type used to + * trap it) to `EventPluginHub`, which in turn will ask plugins if they want + * to extract any synthetic events. + * + * - The `EventPluginHub` will then process each event by annotating them with + * "dispatches", a sequence of listeners and IDs that care about that event. + * + * - The `EventPluginHub` then dispatches the events. + * + * Overview of React and the event system: + * + * +------------+ . + * | DOM | . + * +------------+ . + * | . + * v . + * +------------+ . + * | ReactEvent | . + * | Listener | . + * +------------+ . +-----------+ + * | . +--------+|SimpleEvent| + * | . | |Plugin | + * +-----|------+ . v +-----------+ + * | | | . +--------------+ +------------+ + * | +-----------.--->|EventPluginHub| | Event | + * | | . | | +-----------+ | Propagators| + * | ReactEvent | . | | |TapEvent | |------------| + * | Emitter | . | |<---+|Plugin | |other plugin| + * | | . | | +-----------+ | utilities | + * | +-----------.--->| | +------------+ + * | | | . +--------------+ + * +-----|------+ . ^ +-----------+ + * | . | |Enter/Leave| + * + . +-------+|Plugin | + * +-------------+ . +-----------+ + * | application | . + * |-------------| . + * | | . + * | | . + * +-------------+ . + * . + * React Core . General Purpose Event Plugin System + */ + +var hasEventPageXY; +var alreadyListeningTo = {}; +var isMonitoringScrollValue = false; +var reactTopListenersCounter = 0; + +// For events like 'submit' which don't consistently bubble (which we trap at a +// lower node than `document`), binding at `document` would cause duplicate +// events so we don't include them here +var topEventMapping = { + topAbort: 'abort', + topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', + topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration', + topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart', + topBlur: 'blur', + topCanPlay: 'canplay', + topCanPlayThrough: 'canplaythrough', + topChange: 'change', + topClick: 'click', + topCompositionEnd: 'compositionend', + topCompositionStart: 'compositionstart', + topCompositionUpdate: 'compositionupdate', + topContextMenu: 'contextmenu', + topCopy: 'copy', + topCut: 'cut', + topDoubleClick: 'dblclick', + topDrag: 'drag', + topDragEnd: 'dragend', + topDragEnter: 'dragenter', + topDragExit: 'dragexit', + topDragLeave: 'dragleave', + topDragOver: 'dragover', + topDragStart: 'dragstart', + topDrop: 'drop', + topDurationChange: 'durationchange', + topEmptied: 'emptied', + topEncrypted: 'encrypted', + topEnded: 'ended', + topError: 'error', + topFocus: 'focus', + topInput: 'input', + topKeyDown: 'keydown', + topKeyPress: 'keypress', + topKeyUp: 'keyup', + topLoadedData: 'loadeddata', + topLoadedMetadata: 'loadedmetadata', + topLoadStart: 'loadstart', + topMouseDown: 'mousedown', + topMouseMove: 'mousemove', + topMouseOut: 'mouseout', + topMouseOver: 'mouseover', + topMouseUp: 'mouseup', + topPaste: 'paste', + topPause: 'pause', + topPlay: 'play', + topPlaying: 'playing', + topProgress: 'progress', + topRateChange: 'ratechange', + topScroll: 'scroll', + topSeeked: 'seeked', + topSeeking: 'seeking', + topSelectionChange: 'selectionchange', + topStalled: 'stalled', + topSuspend: 'suspend', + topTextInput: 'textInput', + topTimeUpdate: 'timeupdate', + topTouchCancel: 'touchcancel', + topTouchEnd: 'touchend', + topTouchMove: 'touchmove', + topTouchStart: 'touchstart', + topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend', + topVolumeChange: 'volumechange', + topWaiting: 'waiting', + topWheel: 'wheel' +}; + +/** + * To ensure no conflicts with other potential React instances on the page + */ +var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2); + +function getListeningForDocument(mountAt) { + // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` + // directly. + if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { + mountAt[topListenersIDKey] = reactTopListenersCounter++; + alreadyListeningTo[mountAt[topListenersIDKey]] = {}; + } + return alreadyListeningTo[mountAt[topListenersIDKey]]; +} + +/** + * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For + * example: + * + * EventPluginHub.putListener('myID', 'onClick', myFunction); + * + * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'. + * + * @internal + */ +var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, { + /** + * Injectable event backend + */ + ReactEventListener: null, + + injection: { + /** + * @param {object} ReactEventListener + */ + injectReactEventListener: function (ReactEventListener) { + ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel); + ReactBrowserEventEmitter.ReactEventListener = ReactEventListener; + } + }, + + /** + * Sets whether or not any created callbacks should be enabled. + * + * @param {boolean} enabled True if callbacks should be enabled. + */ + setEnabled: function (enabled) { + if (ReactBrowserEventEmitter.ReactEventListener) { + ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled); + } + }, + + /** + * @return {boolean} True if callbacks are enabled. + */ + isEnabled: function () { + return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled()); + }, + + /** + * We listen for bubbled touch events on the document object. + * + * Firefox v8.01 (and possibly others) exhibited strange behavior when + * mounting `onmousemove` events at some node that was not the document + * element. The symptoms were that if your mouse is not moving over something + * contained within that mount point (for example on the background) the + * top-level listeners for `onmousemove` won't be called. However, if you + * register the `mousemove` on the document object, then it will of course + * catch all `mousemove`s. This along with iOS quirks, justifies restricting + * top-level listeners to the document object only, at least for these + * movement types of events and possibly all events. + * + * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html + * + * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but + * they bubble to document. + * + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @param {object} contentDocumentHandle Document which owns the container + */ + listenTo: function (registrationName, contentDocumentHandle) { + var mountAt = contentDocumentHandle; + var isListening = getListeningForDocument(mountAt); + var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName]; + + for (var i = 0; i < dependencies.length; i++) { + var dependency = dependencies[i]; + if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { + if (dependency === 'topWheel') { + if (isEventSupported('wheel')) { + ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'wheel', mountAt); + } else if (isEventSupported('mousewheel')) { + ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'mousewheel', mountAt); + } else { + // Firefox needs to capture a different mouse scroll event. + // @see http://www.quirksmode.org/dom/events/tests/scroll.html + ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topWheel', 'DOMMouseScroll', mountAt); + } + } else if (dependency === 'topScroll') { + if (isEventSupported('scroll', true)) { + ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topScroll', 'scroll', mountAt); + } else { + ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topScroll', 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE); + } + } else if (dependency === 'topFocus' || dependency === 'topBlur') { + if (isEventSupported('focus', true)) { + ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topFocus', 'focus', mountAt); + ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent('topBlur', 'blur', mountAt); + } else if (isEventSupported('focusin')) { + // IE has `focusin` and `focusout` events which bubble. + // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html + ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topFocus', 'focusin', mountAt); + ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent('topBlur', 'focusout', mountAt); + } + + // to make sure blur and focus event listeners are only attached once + isListening.topBlur = true; + isListening.topFocus = true; + } else if (topEventMapping.hasOwnProperty(dependency)) { + ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt); + } + + isListening[dependency] = true; + } + } + }, + + trapBubbledEvent: function (topLevelType, handlerBaseName, handle) { + return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle); + }, + + trapCapturedEvent: function (topLevelType, handlerBaseName, handle) { + return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle); + }, + + /** + * Protect against document.createEvent() returning null + * Some popup blocker extensions appear to do this: + * https://github.com/facebook/react/issues/6887 + */ + supportsEventPageXY: function () { + if (!document.createEvent) { + return false; + } + var ev = document.createEvent('MouseEvent'); + return ev != null && 'pageX' in ev; + }, + + /** + * Listens to window scroll and resize events. We cache scroll values so that + * application code can access them without triggering reflows. + * + * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when + * pageX/pageY isn't supported (legacy browsers). + * + * NOTE: Scroll events do not bubble. + * + * @see http://www.quirksmode.org/dom/events/scroll.html + */ + ensureScrollValueMonitoring: function () { + if (hasEventPageXY === undefined) { + hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY(); + } + if (!hasEventPageXY && !isMonitoringScrollValue) { + var refresh = ViewportMetrics.refreshScrollValues; + ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh); + isMonitoringScrollValue = true; + } + } +}); + +module.exports = ReactBrowserEventEmitter; + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var lowPriorityWarning = function () {}; + +if (process.env.NODE_ENV !== 'production') { + var printWarning = function (format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.warn(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + lowPriorityWarning = function (condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning.apply(undefined, [format].concat(args)); + } + }; +} + +module.exports = lowPriorityWarning; + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = __webpack_require__(108); + + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var ReactErrorUtils = __webpack_require__(36); + +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +/** + * Injected dependencies: + */ + +/** + * - `ComponentTree`: [required] Module that can convert between React instances + * and actual node references. + */ +var ComponentTree; +var TreeTraversal; +var injection = { + injectComponentTree: function (Injected) { + ComponentTree = Injected; + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; + } + }, + injectTreeTraversal: function (Injected) { + TreeTraversal = Injected; + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(Injected && Injected.isAncestor && Injected.getLowestCommonAncestor, 'EventPluginUtils.injection.injectTreeTraversal(...): Injected ' + 'module is missing isAncestor or getLowestCommonAncestor.') : void 0; + } + } +}; + +function isEndish(topLevelType) { + return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel'; +} + +function isMoveish(topLevelType) { + return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove'; +} +function isStartish(topLevelType) { + return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart'; +} + +var validateEventDispatches; +if (process.env.NODE_ENV !== 'production') { + validateEventDispatches = function (event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + + var listenersIsArr = Array.isArray(dispatchListeners); + var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; + + var instancesIsArr = Array.isArray(dispatchInstances); + var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; + + process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0; + }; +} + +/** + * Dispatch the event to the listener. + * @param {SyntheticEvent} event SyntheticEvent to handle + * @param {boolean} simulated If the event is simulated (changes exn behavior) + * @param {function} listener Application-level callback + * @param {*} inst Internal component instance + */ +function executeDispatch(event, simulated, listener, inst) { + var type = event.type || 'unknown-event'; + event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); + if (simulated) { + ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event); + } else { + ReactErrorUtils.invokeGuardedCallback(type, listener, event); + } + event.currentTarget = null; +} + +/** + * Standard/simple iteration through an event's collected dispatches. + */ +function executeDispatchesInOrder(event, simulated) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + if (process.env.NODE_ENV !== 'production') { + validateEventDispatches(event); + } + if (Array.isArray(dispatchListeners)) { + for (var i = 0; i < dispatchListeners.length; i++) { + if (event.isPropagationStopped()) { + break; + } + // Listeners and Instances are two parallel arrays that are always in sync. + executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); + } + } else if (dispatchListeners) { + executeDispatch(event, simulated, dispatchListeners, dispatchInstances); + } + event._dispatchListeners = null; + event._dispatchInstances = null; +} + +/** + * Standard/simple iteration through an event's collected dispatches, but stops + * at the first dispatch execution returning true, and returns that id. + * + * @return {?string} id of the first dispatch execution who's listener returns + * true, or null if no listener returned true. + */ +function executeDispatchesInOrderStopAtTrueImpl(event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + if (process.env.NODE_ENV !== 'production') { + validateEventDispatches(event); + } + if (Array.isArray(dispatchListeners)) { + for (var i = 0; i < dispatchListeners.length; i++) { + if (event.isPropagationStopped()) { + break; + } + // Listeners and Instances are two parallel arrays that are always in sync. + if (dispatchListeners[i](event, dispatchInstances[i])) { + return dispatchInstances[i]; + } + } + } else if (dispatchListeners) { + if (dispatchListeners(event, dispatchInstances)) { + return dispatchInstances; + } + } + return null; +} + +/** + * @see executeDispatchesInOrderStopAtTrueImpl + */ +function executeDispatchesInOrderStopAtTrue(event) { + var ret = executeDispatchesInOrderStopAtTrueImpl(event); + event._dispatchInstances = null; + event._dispatchListeners = null; + return ret; +} + +/** + * Execution of a "direct" dispatch - there must be at most one dispatch + * accumulated on the event or it is considered an error. It doesn't really make + * sense for an event with multiple dispatches (bubbled) to keep track of the + * return values at each dispatch execution, but it does tend to make sense when + * dealing with "direct" dispatches. + * + * @return {*} The return value of executing the single dispatch. + */ +function executeDirectDispatch(event) { + if (process.env.NODE_ENV !== 'production') { + validateEventDispatches(event); + } + var dispatchListener = event._dispatchListeners; + var dispatchInstance = event._dispatchInstances; + !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : _prodInvariant('103') : void 0; + event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null; + var res = dispatchListener ? dispatchListener(event) : null; + event.currentTarget = null; + event._dispatchListeners = null; + event._dispatchInstances = null; + return res; +} + +/** + * @param {SyntheticEvent} event + * @return {boolean} True iff number of dispatches accumulated is greater than 0. + */ +function hasDispatches(event) { + return !!event._dispatchListeners; +} + +/** + * General utilities that are useful in creating custom Event Plugins. + */ +var EventPluginUtils = { + isEndish: isEndish, + isMoveish: isMoveish, + isStartish: isStartish, + + executeDirectDispatch: executeDirectDispatch, + executeDispatchesInOrder: executeDispatchesInOrder, + executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, + hasDispatches: hasDispatches, + + getInstanceFromNode: function (node) { + return ComponentTree.getInstanceFromNode(node); + }, + getNodeFromInstance: function (node) { + return ComponentTree.getNodeFromInstance(node); + }, + isAncestor: function (a, b) { + return TreeTraversal.isAncestor(a, b); + }, + getLowestCommonAncestor: function (a, b) { + return TreeTraversal.getLowestCommonAncestor(a, b); + }, + getParentInstance: function (inst) { + return TreeTraversal.getParentInstance(inst); + }, + traverseTwoPhase: function (target, fn, arg) { + return TreeTraversal.traverseTwoPhase(target, fn, arg); + }, + traverseEnterLeave: function (from, to, fn, argFrom, argTo) { + return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo); + }, + + injection: injection +}; + +module.exports = EventPluginUtils; + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var caughtError = null; + +/** + * Call a function while guarding against errors that happens within it. + * + * @param {String} name of the guard to use for logging or debugging + * @param {Function} func The function to invoke + * @param {*} a First argument + * @param {*} b Second argument + */ +function invokeGuardedCallback(name, func, a) { + try { + func(a); + } catch (x) { + if (caughtError === null) { + caughtError = x; + } + } +} + +var ReactErrorUtils = { + invokeGuardedCallback: invokeGuardedCallback, + + /** + * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event + * handler are sure to be rethrown by rethrowCaughtError. + */ + invokeGuardedCallbackWithCatch: invokeGuardedCallback, + + /** + * During execution of guarded functions we will capture the first error which + * we will rethrow to be handled by the top level error handler. + */ + rethrowCaughtError: function () { + if (caughtError) { + var error = caughtError; + caughtError = null; + throw error; + } + } +}; + +if (process.env.NODE_ENV !== 'production') { + /** + * To help development we can get better devtools integration by simulating a + * real browser event. + */ + if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { + var fakeNode = document.createElement('react'); + ReactErrorUtils.invokeGuardedCallback = function (name, func, a) { + var boundFunc = function () { + func(a); + }; + var evtType = 'react-' + name; + fakeNode.addEventListener(evtType, boundFunc, false); + var evt = document.createEvent('Event'); + evt.initEvent(evtType, false, false); + fakeNode.dispatchEvent(evt); + fakeNode.removeEventListener(evtType, boundFunc, false); + }; + } +} + +module.exports = ReactErrorUtils; + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * Gets the target node from a native browser event by accounting for + * inconsistencies in browser DOM APIs. + * + * @param {object} nativeEvent Native browser event. + * @return {DOMEventTarget} Target node. + */ + +function getEventTarget(nativeEvent) { + var target = nativeEvent.target || nativeEvent.srcElement || window; + + // Normalize SVG element events #4963 + if (target.correspondingUseElement) { + target = target.correspondingUseElement; + } + + // Safari may fire events on text nodes (Node.TEXT_NODE is 3). + // @see http://www.quirksmode.org/js/events_properties.html + return target.nodeType === 3 ? target.parentNode : target; +} + +module.exports = getEventTarget; + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ExecutionEnvironment = __webpack_require__(5); + +var useHasFeature; +if (ExecutionEnvironment.canUseDOM) { + useHasFeature = document.implementation && document.implementation.hasFeature && + // always returns true in newer browsers as per the standard. + // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature + document.implementation.hasFeature('', '') !== true; +} + +/** + * Checks if an event is supported in the current execution environment. + * + * NOTE: This will not work correctly for non-generic events such as `change`, + * `reset`, `load`, `error`, and `select`. + * + * Borrows from Modernizr. + * + * @param {string} eventNameSuffix Event name, e.g. "click". + * @param {?boolean} capture Check if the capture phase is supported. + * @return {boolean} True if the event is supported. + * @internal + * @license Modernizr 3.0.0pre (Custom Build) | MIT + */ +function isEventSupported(eventNameSuffix, capture) { + if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { + return false; + } + + var eventName = 'on' + eventNameSuffix; + var isSupported = eventName in document; + + if (!isSupported) { + var element = document.createElement('div'); + element.setAttribute(eventName, 'return;'); + isSupported = typeof element[eventName] === 'function'; + } + + if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { + // This is the only way to test support for the `wheel` event in IE9+. + isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); + } + + return isSupported; +} + +module.exports = isEventSupported; + +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * Translation from modifier key to the associated property in the event. + * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers + */ + +var modifierKeyToProp = { + Alt: 'altKey', + Control: 'ctrlKey', + Meta: 'metaKey', + Shift: 'shiftKey' +}; + +// IE8 does not implement getModifierState so we simply map it to the only +// modifier keys exposed by the event itself, does not support Lock-keys. +// Currently, all major browsers except Chrome seems to support Lock-keys. +function modifierStateGetter(keyArg) { + var syntheticEvent = this; + var nativeEvent = syntheticEvent.nativeEvent; + if (nativeEvent.getModifierState) { + return nativeEvent.getModifierState(keyArg); + } + var keyProp = modifierKeyToProp[keyArg]; + return keyProp ? !!nativeEvent[keyProp] : false; +} + +function getEventModifierState(nativeEvent) { + return modifierStateGetter; +} + +module.exports = getEventModifierState; + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMLazyTree = __webpack_require__(18); +var Danger = __webpack_require__(127); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactInstrumentation = __webpack_require__(8); + +var createMicrosoftUnsafeLocalFunction = __webpack_require__(42); +var setInnerHTML = __webpack_require__(29); +var setTextContent = __webpack_require__(68); + +function getNodeAfter(parentNode, node) { + // Special case for text components, which return [open, close] comments + // from getHostNode. + if (Array.isArray(node)) { + node = node[1]; + } + return node ? node.nextSibling : parentNode.firstChild; +} + +/** + * Inserts `childNode` as a child of `parentNode` at the `index`. + * + * @param {DOMElement} parentNode Parent node in which to insert. + * @param {DOMElement} childNode Child node to insert. + * @param {number} index Index at which to insert the child. + * @internal + */ +var insertChildAt = createMicrosoftUnsafeLocalFunction(function (parentNode, childNode, referenceNode) { + // We rely exclusively on `insertBefore(node, null)` instead of also using + // `appendChild(node)`. (Using `undefined` is not allowed by all browsers so + // we are careful to use `null`.) + parentNode.insertBefore(childNode, referenceNode); +}); + +function insertLazyTreeChildAt(parentNode, childTree, referenceNode) { + DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode); +} + +function moveChild(parentNode, childNode, referenceNode) { + if (Array.isArray(childNode)) { + moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode); + } else { + insertChildAt(parentNode, childNode, referenceNode); + } +} + +function removeChild(parentNode, childNode) { + if (Array.isArray(childNode)) { + var closingComment = childNode[1]; + childNode = childNode[0]; + removeDelimitedText(parentNode, childNode, closingComment); + parentNode.removeChild(closingComment); + } + parentNode.removeChild(childNode); +} + +function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) { + var node = openingComment; + while (true) { + var nextNode = node.nextSibling; + insertChildAt(parentNode, node, referenceNode); + if (node === closingComment) { + break; + } + node = nextNode; + } +} + +function removeDelimitedText(parentNode, startNode, closingComment) { + while (true) { + var node = startNode.nextSibling; + if (node === closingComment) { + // The closing comment is removed by ReactMultiChild. + break; + } else { + parentNode.removeChild(node); + } + } +} + +function replaceDelimitedText(openingComment, closingComment, stringText) { + var parentNode = openingComment.parentNode; + var nodeAfterComment = openingComment.nextSibling; + if (nodeAfterComment === closingComment) { + // There are no text nodes between the opening and closing comments; insert + // a new one if stringText isn't empty. + if (stringText) { + insertChildAt(parentNode, document.createTextNode(stringText), nodeAfterComment); + } + } else { + if (stringText) { + // Set the text content of the first node after the opening comment, and + // remove all following nodes up until the closing comment. + setTextContent(nodeAfterComment, stringText); + removeDelimitedText(parentNode, nodeAfterComment, closingComment); + } else { + removeDelimitedText(parentNode, openingComment, closingComment); + } + } + + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, + type: 'replace text', + payload: stringText + }); + } +} + +var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; +if (process.env.NODE_ENV !== 'production') { + dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) { + Danger.dangerouslyReplaceNodeWithMarkup(oldChild, markup); + if (prevInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: prevInstance._debugID, + type: 'replace with', + payload: markup.toString() + }); + } else { + var nextInstance = ReactDOMComponentTree.getInstanceFromNode(markup.node); + if (nextInstance._debugID !== 0) { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: nextInstance._debugID, + type: 'mount', + payload: markup.toString() + }); + } + } + }; +} + +/** + * Operations for updating with DOM children. + */ +var DOMChildrenOperations = { + dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, + + replaceDelimitedText: replaceDelimitedText, + + /** + * Updates a component's children by processing a series of updates. The + * update configurations are each expected to have a `parentNode` property. + * + * @param {array} updates List of update configurations. + * @internal + */ + processUpdates: function (parentNode, updates) { + if (process.env.NODE_ENV !== 'production') { + var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; + } + + for (var k = 0; k < updates.length; k++) { + var update = updates[k]; + switch (update.type) { + case 'INSERT_MARKUP': + insertLazyTreeChildAt(parentNode, update.content, getNodeAfter(parentNode, update.afterNode)); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: parentNodeDebugID, + type: 'insert child', + payload: { + toIndex: update.toIndex, + content: update.content.toString() + } + }); + } + break; + case 'MOVE_EXISTING': + moveChild(parentNode, update.fromNode, getNodeAfter(parentNode, update.afterNode)); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: parentNodeDebugID, + type: 'move child', + payload: { fromIndex: update.fromIndex, toIndex: update.toIndex } + }); + } + break; + case 'SET_MARKUP': + setInnerHTML(parentNode, update.content); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: parentNodeDebugID, + type: 'replace children', + payload: update.content.toString() + }); + } + break; + case 'TEXT_CONTENT': + setTextContent(parentNode, update.content); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: parentNodeDebugID, + type: 'replace text', + payload: update.content.toString() + }); + } + break; + case 'REMOVE_NODE': + removeChild(parentNode, update.fromNode); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: parentNodeDebugID, + type: 'remove child', + payload: { fromIndex: update.fromIndex } + }); + } + break; + } + } + } +}; + +module.exports = DOMChildrenOperations; + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMNamespaces = { + html: 'http://www.w3.org/1999/xhtml', + mathml: 'http://www.w3.org/1998/Math/MathML', + svg: 'http://www.w3.org/2000/svg' +}; + +module.exports = DOMNamespaces; + +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +/* globals MSApp */ + + + +/** + * Create a function which has 'unsafe' privileges (required by windows8 apps) + */ + +var createMicrosoftUnsafeLocalFunction = function (func) { + if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { + return function (arg0, arg1, arg2, arg3) { + MSApp.execUnsafeLocalFunction(function () { + return func(arg0, arg1, arg2, arg3); + }); + }; + } else { + return func; + } +}; + +module.exports = createMicrosoftUnsafeLocalFunction; + +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var ReactPropTypesSecret = __webpack_require__(72); +var propTypesFactory = __webpack_require__(57); + +var React = __webpack_require__(15); +var PropTypes = propTypesFactory(React.isValidElement); + +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +var hasReadOnlyValue = { + button: true, + checkbox: true, + image: true, + hidden: true, + radio: true, + reset: true, + submit: true +}; + +function _assertSingleLink(inputProps) { + !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don\'t want to use valueLink and vice versa.') : _prodInvariant('87') : void 0; +} +function _assertValueLink(inputProps) { + _assertSingleLink(inputProps); + !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don\'t want to use valueLink.') : _prodInvariant('88') : void 0; +} + +function _assertCheckedLink(inputProps) { + _assertSingleLink(inputProps); + !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don\'t want to use checkedLink') : _prodInvariant('89') : void 0; +} + +var propTypes = { + value: function (props, propName, componentName) { + if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) { + return null; + } + return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); + }, + checked: function (props, propName, componentName) { + if (!props[propName] || props.onChange || props.readOnly || props.disabled) { + return null; + } + return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); + }, + onChange: PropTypes.func +}; + +var loggedTypeFailures = {}; +function getDeclarationErrorAddendum(owner) { + if (owner) { + var name = owner.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; +} + +/** + * Provide a linked `value` attribute for controlled forms. You should not use + * this outside of the ReactDOM controlled form components. + */ +var LinkedValueUtils = { + checkPropTypes: function (tagName, props, owner) { + for (var propName in propTypes) { + if (propTypes.hasOwnProperty(propName)) { + var error = propTypes[propName](props, propName, tagName, 'prop', null, ReactPropTypesSecret); + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var addendum = getDeclarationErrorAddendum(owner); + process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : void 0; + } + } + }, + + /** + * @param {object} inputProps Props for form component + * @return {*} current value of the input either from value prop or link. + */ + getValue: function (inputProps) { + if (inputProps.valueLink) { + _assertValueLink(inputProps); + return inputProps.valueLink.value; + } + return inputProps.value; + }, + + /** + * @param {object} inputProps Props for form component + * @return {*} current checked status of the input either from checked prop + * or link. + */ + getChecked: function (inputProps) { + if (inputProps.checkedLink) { + _assertCheckedLink(inputProps); + return inputProps.checkedLink.value; + } + return inputProps.checked; + }, + + /** + * @param {object} inputProps Props for form component + * @param {SyntheticEvent} event change event to handle + */ + executeOnChange: function (inputProps, event) { + if (inputProps.valueLink) { + _assertValueLink(inputProps); + return inputProps.valueLink.requestChange(event.target.value); + } else if (inputProps.checkedLink) { + _assertCheckedLink(inputProps); + return inputProps.checkedLink.requestChange(event.target.checked); + } else if (inputProps.onChange) { + return inputProps.onChange.call(undefined, event); + } + } +}; + +module.exports = LinkedValueUtils; + +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +var injected = false; + +var ReactComponentEnvironment = { + /** + * Optionally injectable hook for swapping out mount images in the middle of + * the tree. + */ + replaceNodeWithMarkup: null, + + /** + * Optionally injectable hook for processing a queue of child updates. Will + * later move into MultiChildComponents. + */ + processChildrenUpdates: null, + + injection: { + injectEnvironment: function (environment) { + !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : _prodInvariant('104') : void 0; + ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup; + ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates; + injected = true; + } + } +}; + +module.exports = ReactComponentEnvironment; + +/***/ }), +/* 45 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + * + */ + +/*eslint-disable no-self-compare */ + + + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + // Added the nonzero y check to make Flow happy, but it is redundant + return x !== 0 || y !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } +} + +/** + * Performs equality by iterating through keys on an object and returning false + * when any key has values which are not strictly equal between the arguments. + * Returns true when the values of all keys are strictly equal. + */ +function shallowEqual(objA, objB) { + if (is(objA, objB)) { + return true; + } + + if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { + return false; + } + + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); + + if (keysA.length !== keysB.length) { + return false; + } + + // Test for A's keys different from B. + for (var i = 0; i < keysA.length; i++) { + if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { + return false; + } + } + + return true; +} + +module.exports = shallowEqual; + +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * Given a `prevElement` and `nextElement`, determines if the existing + * instance should be updated as opposed to being destroyed or replaced by a new + * instance. Both arguments are elements. This ensures that this logic can + * operate on stateless trees without any backing instance. + * + * @param {?object} prevElement + * @param {?object} nextElement + * @return {boolean} True if the existing instance should be updated. + * @protected + */ + +function shouldUpdateReactComponent(prevElement, nextElement) { + var prevEmpty = prevElement === null || prevElement === false; + var nextEmpty = nextElement === null || nextElement === false; + if (prevEmpty || nextEmpty) { + return prevEmpty === nextEmpty; + } + + var prevType = typeof prevElement; + var nextType = typeof nextElement; + if (prevType === 'string' || prevType === 'number') { + return nextType === 'string' || nextType === 'number'; + } else { + return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key; + } +} + +module.exports = shouldUpdateReactComponent; + +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +/** + * Escape and wrap key so it is safe to use as a reactid + * + * @param {string} key to be escaped. + * @return {string} the escaped key. + */ + +function escape(key) { + var escapeRegex = /[=:]/g; + var escaperLookup = { + '=': '=0', + ':': '=2' + }; + var escapedString = ('' + key).replace(escapeRegex, function (match) { + return escaperLookup[match]; + }); + + return '$' + escapedString; +} + +/** + * Unescape and unwrap key for human-readable display + * + * @param {string} key to unescape. + * @return {string} the unescaped key. + */ +function unescape(key) { + var unescapeRegex = /(=0|=2)/g; + var unescaperLookup = { + '=0': '=', + '=2': ':' + }; + var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); + + return ('' + keySubstring).replace(unescapeRegex, function (match) { + return unescaperLookup[match]; + }); +} + +var KeyEscapeUtils = { + escape: escape, + unescape: unescape +}; + +module.exports = KeyEscapeUtils; + +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var ReactCurrentOwner = __webpack_require__(9); +var ReactInstanceMap = __webpack_require__(23); +var ReactInstrumentation = __webpack_require__(8); +var ReactUpdates = __webpack_require__(10); + +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +function enqueueUpdate(internalInstance) { + ReactUpdates.enqueueUpdate(internalInstance); +} + +function formatUnexpectedArgument(arg) { + var type = typeof arg; + if (type !== 'object') { + return type; + } + var displayName = arg.constructor && arg.constructor.name || type; + var keys = Object.keys(arg); + if (keys.length > 0 && keys.length < 20) { + return displayName + ' (keys: ' + keys.join(', ') + ')'; + } + return displayName; +} + +function getInternalInstanceReadyForUpdate(publicInstance, callerName) { + var internalInstance = ReactInstanceMap.get(publicInstance); + if (!internalInstance) { + if (process.env.NODE_ENV !== 'production') { + var ctor = publicInstance.constructor; + // Only warn when we have a callerName. Otherwise we should be silent. + // We're probably calling from enqueueCallback. We don't want to warn + // there because we already warned for the corresponding lifecycle method. + process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, ctor && (ctor.displayName || ctor.name) || 'ReactClass') : void 0; + } + return null; + } + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + "within `render` or another component's constructor). Render methods " + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0; + } + + return internalInstance; +} + +/** + * ReactUpdateQueue allows for state updates to be scheduled into a later + * reconciliation step. + */ +var ReactUpdateQueue = { + /** + * Checks whether or not this composite component is mounted. + * @param {ReactClass} publicInstance The instance we want to test. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function (publicInstance) { + if (process.env.NODE_ENV !== 'production') { + var owner = ReactCurrentOwner.current; + if (owner !== null) { + process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0; + owner._warnedAboutRefsInRender = true; + } + } + var internalInstance = ReactInstanceMap.get(publicInstance); + if (internalInstance) { + // During componentWillMount and render this will still be null but after + // that will always render to something. At least for now. So we can use + // this hack. + return !!internalInstance._renderedComponent; + } else { + return false; + } + }, + + /** + * Enqueue a callback that will be executed after all the pending updates + * have processed. + * + * @param {ReactClass} publicInstance The instance to use as `this` context. + * @param {?function} callback Called after state is updated. + * @param {string} callerName Name of the calling function in the public API. + * @internal + */ + enqueueCallback: function (publicInstance, callback, callerName) { + ReactUpdateQueue.validateCallback(callback, callerName); + var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); + + // Previously we would throw an error if we didn't have an internal + // instance. Since we want to make it a no-op instead, we mirror the same + // behavior we have in other enqueue* methods. + // We also need to ignore callbacks in componentWillMount. See + // enqueueUpdates. + if (!internalInstance) { + return null; + } + + if (internalInstance._pendingCallbacks) { + internalInstance._pendingCallbacks.push(callback); + } else { + internalInstance._pendingCallbacks = [callback]; + } + // TODO: The callback here is ignored when setState is called from + // componentWillMount. Either fix it or disallow doing so completely in + // favor of getInitialState. Alternatively, we can disallow + // componentWillMount during server-side rendering. + enqueueUpdate(internalInstance); + }, + + enqueueCallbackInternal: function (internalInstance, callback) { + if (internalInstance._pendingCallbacks) { + internalInstance._pendingCallbacks.push(callback); + } else { + internalInstance._pendingCallbacks = [callback]; + } + enqueueUpdate(internalInstance); + }, + + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @internal + */ + enqueueForceUpdate: function (publicInstance) { + var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate'); + + if (!internalInstance) { + return; + } + + internalInstance._pendingForceUpdate = true; + + enqueueUpdate(internalInstance); + }, + + /** + * Replaces all of the state. Always use this or `setState` to mutate state. + * You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} completeState Next state. + * @internal + */ + enqueueReplaceState: function (publicInstance, completeState, callback) { + var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState'); + + if (!internalInstance) { + return; + } + + internalInstance._pendingStateQueue = [completeState]; + internalInstance._pendingReplaceState = true; + + // Future-proof 15.5 + if (callback !== undefined && callback !== null) { + ReactUpdateQueue.validateCallback(callback, 'replaceState'); + if (internalInstance._pendingCallbacks) { + internalInstance._pendingCallbacks.push(callback); + } else { + internalInstance._pendingCallbacks = [callback]; + } + } + + enqueueUpdate(internalInstance); + }, + + /** + * Sets a subset of the state. This only exists because _pendingState is + * internal. This provides a merging strategy that is not available to deep + * properties which is confusing. TODO: Expose pendingState or don't use it + * during the merge. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} partialState Next partial state to be merged with state. + * @internal + */ + enqueueSetState: function (publicInstance, partialState) { + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onSetState(); + process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0; + } + + var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState'); + + if (!internalInstance) { + return; + } + + var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []); + queue.push(partialState); + + enqueueUpdate(internalInstance); + }, + + enqueueElementInternal: function (internalInstance, nextElement, nextContext) { + internalInstance._pendingElement = nextElement; + // TODO: introduce _pendingContext instead of setting it directly. + internalInstance._context = nextContext; + enqueueUpdate(internalInstance); + }, + + validateCallback: function (callback, callerName) { + !(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0; + } +}; + +module.exports = ReactUpdateQueue; + +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var emptyFunction = __webpack_require__(7); +var warning = __webpack_require__(1); + +var validateDOMNesting = emptyFunction; + +if (process.env.NODE_ENV !== 'production') { + // This validation code was written based on the HTML5 parsing spec: + // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope + // + // Note: this does not catch all invalid nesting, nor does it try to (as it's + // not clear what practical benefit doing so provides); instead, we warn only + // for cases where the parser will give a parse tree differing from what React + // intended. For example,
is invalid but we don't warn + // because it still parses correctly; we do warn for other cases like nested + //

tags where the beginning of the second element implicitly closes the + // first, causing a confusing mess. + + // https://html.spec.whatwg.org/multipage/syntax.html#special + var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; + + // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope + var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', + + // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point + // TODO: Distinguish by namespace here -- for , including it here + // errs on the side of fewer warnings + 'foreignObject', 'desc', 'title']; + + // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope + var buttonScopeTags = inScopeTags.concat(['button']); + + // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags + var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; + + var emptyAncestorInfo = { + current: null, + + formTag: null, + aTagInScope: null, + buttonTagInScope: null, + nobrTagInScope: null, + pTagInButtonScope: null, + + listItemTagAutoclosing: null, + dlItemTagAutoclosing: null + }; + + var updatedAncestorInfo = function (oldInfo, tag, instance) { + var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); + var info = { tag: tag, instance: instance }; + + if (inScopeTags.indexOf(tag) !== -1) { + ancestorInfo.aTagInScope = null; + ancestorInfo.buttonTagInScope = null; + ancestorInfo.nobrTagInScope = null; + } + if (buttonScopeTags.indexOf(tag) !== -1) { + ancestorInfo.pTagInButtonScope = null; + } + + // See rules for 'li', 'dd', 'dt' start tags in + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody + if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { + ancestorInfo.listItemTagAutoclosing = null; + ancestorInfo.dlItemTagAutoclosing = null; + } + + ancestorInfo.current = info; + + if (tag === 'form') { + ancestorInfo.formTag = info; + } + if (tag === 'a') { + ancestorInfo.aTagInScope = info; + } + if (tag === 'button') { + ancestorInfo.buttonTagInScope = info; + } + if (tag === 'nobr') { + ancestorInfo.nobrTagInScope = info; + } + if (tag === 'p') { + ancestorInfo.pTagInButtonScope = info; + } + if (tag === 'li') { + ancestorInfo.listItemTagAutoclosing = info; + } + if (tag === 'dd' || tag === 'dt') { + ancestorInfo.dlItemTagAutoclosing = info; + } + + return ancestorInfo; + }; + + /** + * Returns whether + */ + var isTagValidWithParent = function (tag, parentTag) { + // First, let's check if we're in an unusual parsing mode... + switch (parentTag) { + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect + case 'select': + return tag === 'option' || tag === 'optgroup' || tag === '#text'; + case 'optgroup': + return tag === 'option' || tag === '#text'; + // Strictly speaking, seeing an <option> doesn't mean we're in a <select> + // but + case 'option': + return tag === '#text'; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption + // No special behavior since these rules fall back to "in body" mode for + // all except special table nodes which cause bad parsing behavior anyway. + + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr + case 'tr': + return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody + case 'tbody': + case 'thead': + case 'tfoot': + return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup + case 'colgroup': + return tag === 'col' || tag === 'template'; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable + case 'table': + return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead + case 'head': + return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; + // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element + case 'html': + return tag === 'head' || tag === 'body'; + case '#document': + return tag === 'html'; + } + + // Probably in the "in body" parsing mode, so we outlaw only tag combos + // where the parsing rules cause implicit opens or closes to be added. + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody + switch (tag) { + case 'h1': + case 'h2': + case 'h3': + case 'h4': + case 'h5': + case 'h6': + return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; + + case 'rp': + case 'rt': + return impliedEndTags.indexOf(parentTag) === -1; + + case 'body': + case 'caption': + case 'col': + case 'colgroup': + case 'frame': + case 'head': + case 'html': + case 'tbody': + case 'td': + case 'tfoot': + case 'th': + case 'thead': + case 'tr': + // These tags are only valid with a few parents that have special child + // parsing rules -- if we're down here, then none of those matched and + // so we allow it only if we don't know what the parent is, as all other + // cases are invalid. + return parentTag == null; + } + + return true; + }; + + /** + * Returns whether + */ + var findInvalidAncestorForTag = function (tag, ancestorInfo) { + switch (tag) { + case 'address': + case 'article': + case 'aside': + case 'blockquote': + case 'center': + case 'details': + case 'dialog': + case 'dir': + case 'div': + case 'dl': + case 'fieldset': + case 'figcaption': + case 'figure': + case 'footer': + case 'header': + case 'hgroup': + case 'main': + case 'menu': + case 'nav': + case 'ol': + case 'p': + case 'section': + case 'summary': + case 'ul': + case 'pre': + case 'listing': + case 'table': + case 'hr': + case 'xmp': + case 'h1': + case 'h2': + case 'h3': + case 'h4': + case 'h5': + case 'h6': + return ancestorInfo.pTagInButtonScope; + + case 'form': + return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; + + case 'li': + return ancestorInfo.listItemTagAutoclosing; + + case 'dd': + case 'dt': + return ancestorInfo.dlItemTagAutoclosing; + + case 'button': + return ancestorInfo.buttonTagInScope; + + case 'a': + // Spec says something about storing a list of markers, but it sounds + // equivalent to this check. + return ancestorInfo.aTagInScope; + + case 'nobr': + return ancestorInfo.nobrTagInScope; + } + + return null; + }; + + /** + * Given a ReactCompositeComponent instance, return a list of its recursive + * owners, starting at the root and ending with the instance itself. + */ + var findOwnerStack = function (instance) { + if (!instance) { + return []; + } + + var stack = []; + do { + stack.push(instance); + } while (instance = instance._currentElement._owner); + stack.reverse(); + return stack; + }; + + var didWarn = {}; + + validateDOMNesting = function (childTag, childText, childInstance, ancestorInfo) { + ancestorInfo = ancestorInfo || emptyAncestorInfo; + var parentInfo = ancestorInfo.current; + var parentTag = parentInfo && parentInfo.tag; + + if (childText != null) { + process.env.NODE_ENV !== 'production' ? warning(childTag == null, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0; + childTag = '#text'; + } + + var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; + var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); + var problematic = invalidParent || invalidAncestor; + + if (problematic) { + var ancestorTag = problematic.tag; + var ancestorInstance = problematic.instance; + + var childOwner = childInstance && childInstance._currentElement._owner; + var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner; + + var childOwners = findOwnerStack(childOwner); + var ancestorOwners = findOwnerStack(ancestorOwner); + + var minStackLen = Math.min(childOwners.length, ancestorOwners.length); + var i; + + var deepestCommon = -1; + for (i = 0; i < minStackLen; i++) { + if (childOwners[i] === ancestorOwners[i]) { + deepestCommon = i; + } else { + break; + } + } + + var UNKNOWN = '(unknown)'; + var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) { + return inst.getName() || UNKNOWN; + }); + var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) { + return inst.getName() || UNKNOWN; + }); + var ownerInfo = [].concat( + // If the parent and child instances have a common owner ancestor, start + // with that -- otherwise we just start with the parent's owners. + deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag, + // If we're warning about an invalid (non-parent) ancestry, add '...' + invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > '); + + var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo; + if (didWarn[warnKey]) { + return; + } + didWarn[warnKey] = true; + + var tagDisplayName = childTag; + var whitespaceInfo = ''; + if (childTag === '#text') { + if (/\S/.test(childText)) { + tagDisplayName = 'Text nodes'; + } else { + tagDisplayName = 'Whitespace text nodes'; + whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.'; + } + } else { + tagDisplayName = '<' + childTag + '>'; + } + + if (invalidParent) { + var info = ''; + if (ancestorTag === 'table' && childTag === 'tr') { + info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.'; + } + process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s ' + 'See %s.%s', tagDisplayName, ancestorTag, whitespaceInfo, ownerInfo, info) : void 0; + } else { + process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0; + } + } + }; + + validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo; + + // For testing + validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) { + ancestorInfo = ancestorInfo || emptyAncestorInfo; + var parentInfo = ancestorInfo.current; + var parentTag = parentInfo && parentInfo.tag; + return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo); + }; +} + +module.exports = validateDOMNesting; + +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * `charCode` represents the actual "character code" and is safe to use with + * `String.fromCharCode`. As such, only keys that correspond to printable + * characters produce a valid `charCode`, the only exception to this is Enter. + * The Tab-key is considered non-printable and does not have a `charCode`, + * presumably because it does not produce a tab-character in browsers. + * + * @param {object} nativeEvent Native browser event. + * @return {number} Normalized `charCode` property. + */ + +function getEventCharCode(nativeEvent) { + var charCode; + var keyCode = nativeEvent.keyCode; + + if ('charCode' in nativeEvent) { + charCode = nativeEvent.charCode; + + // FF does not set `charCode` for the Enter-key, check against `keyCode`. + if (charCode === 0 && keyCode === 13) { + charCode = 13; + } + } else { + // IE8 does not implement `charCode`, but `keyCode` has the correct value. + charCode = keyCode; + } + + // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. + // Must not discard the (non-)printable Enter-key. + if (charCode >= 32 || charCode === 13) { + return charCode; + } + + return 0; +} + +module.exports = getEventCharCode; + +/***/ }), +/* 51 */ +/***/ (function(module, exports) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +module.exports = function(useSourceMap) { + var list = []; + + // return the list of modules as css string + list.toString = function toString() { + return this.map(function (item) { + var content = cssWithMappingToString(item, useSourceMap); + if(item[2]) { + return "@media " + item[2] + "{" + content + "}"; + } else { + return content; + } + }).join(""); + }; + + // import a list of modules into the list + list.i = function(modules, mediaQuery) { + if(typeof modules === "string") + modules = [[null, modules, ""]]; + var alreadyImportedModules = {}; + for(var i = 0; i < this.length; i++) { + var id = this[i][0]; + if(typeof id === "number") + alreadyImportedModules[id] = true; + } + for(i = 0; i < modules.length; i++) { + var item = modules[i]; + // skip already imported module + // this implementation is not 100% perfect for weird media query combinations + // when a module is imported multiple times with different media queries. + // I hope this will never occur (Hey this way we have smaller bundles) + if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { + if(mediaQuery && !item[2]) { + item[2] = mediaQuery; + } else if(mediaQuery) { + item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; + } + list.push(item); + } + } + }; + return list; +}; + +function cssWithMappingToString(item, useSourceMap) { + var content = item[1] || ''; + var cssMapping = item[3]; + if (!cssMapping) { + return content; + } + + if (useSourceMap && typeof btoa === 'function') { + var sourceMapping = toComment(cssMapping); + var sourceURLs = cssMapping.sources.map(function (source) { + return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' + }); + + return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); + } + + return [content].join('\n'); +} + +// Adapted from convert-source-map (MIT) +function toComment(sourceMap) { + // eslint-disable-next-line no-undef + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); + var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; + + return '/*# ' + data + ' */'; +} + + +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(16), + _assign = __webpack_require__(3); + +var ReactNoopUpdateQueue = __webpack_require__(53); + +var canDefineProperty = __webpack_require__(24); +var emptyObject = __webpack_require__(25); +var invariant = __webpack_require__(0); +var lowPriorityWarning = __webpack_require__(32); + +/** + * Base class helpers for the updating state of a component. + */ +function ReactComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +ReactComponent.prototype.isReactComponent = {}; + +/** + * Sets a subset of the state. Always use this to mutate + * state. You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * There is no guarantee that calls to `setState` will run synchronously, + * as they may eventually be batched together. You can provide an optional + * callback that will be executed when the call to setState is actually + * completed. + * + * When a function is provided to setState, it will be called at some point in + * the future (not synchronously). It will be called with the up to date + * component arguments (state, props, context). These values can be different + * from this.* because your function may be called after receiveProps but before + * shouldComponentUpdate, and this new state, props, and context will not yet be + * assigned to this. + * + * @param {object|function} partialState Next partial state or function to + * produce next partial state to be merged with current state. + * @param {?function} callback Called after state is updated. + * @final + * @protected + */ +ReactComponent.prototype.setState = function (partialState, callback) { + !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; + this.updater.enqueueSetState(this, partialState); + if (callback) { + this.updater.enqueueCallback(this, callback, 'setState'); + } +}; + +/** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {?function} callback Called after update is complete. + * @final + * @protected + */ +ReactComponent.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this); + if (callback) { + this.updater.enqueueCallback(this, callback, 'forceUpdate'); + } +}; + +/** + * Deprecated APIs. These APIs used to exist on classic React classes but since + * we would like to deprecate them, we're not going to move them over to this + * modern base class. Instead, we define a getter that warns if it's accessed. + */ +if (process.env.NODE_ENV !== 'production') { + var deprecatedAPIs = { + isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], + replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] + }; + var defineDeprecationWarning = function (methodName, info) { + if (canDefineProperty) { + Object.defineProperty(ReactComponent.prototype, methodName, { + get: function () { + lowPriorityWarning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); + return undefined; + } + }); + } + }; + for (var fnName in deprecatedAPIs) { + if (deprecatedAPIs.hasOwnProperty(fnName)) { + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + } + } +} + +/** + * Base class helpers for the updating state of a component. + */ +function ReactPureComponent(props, context, updater) { + // Duplicated from ReactComponent. + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +function ComponentDummy() {} +ComponentDummy.prototype = ReactComponent.prototype; +ReactPureComponent.prototype = new ComponentDummy(); +ReactPureComponent.prototype.constructor = ReactPureComponent; +// Avoid an extra prototype jump for these methods. +_assign(ReactPureComponent.prototype, ReactComponent.prototype); +ReactPureComponent.prototype.isPureReactComponent = true; + +module.exports = { + Component: ReactComponent, + PureComponent: ReactPureComponent +}; + +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var warning = __webpack_require__(1); + +function warnNoop(publicInstance, callerName) { + if (process.env.NODE_ENV !== 'production') { + var constructor = publicInstance.constructor; + process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; + } +} + +/** + * This is the abstract API for an update queue. + */ +var ReactNoopUpdateQueue = { + /** + * Checks whether or not this composite component is mounted. + * @param {ReactClass} publicInstance The instance we want to test. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function (publicInstance) { + return false; + }, + + /** + * Enqueue a callback that will be executed after all the pending updates + * have processed. + * + * @param {ReactClass} publicInstance The instance to use as `this` context. + * @param {?function} callback Called after state is updated. + * @internal + */ + enqueueCallback: function (publicInstance, callback) {}, + + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @internal + */ + enqueueForceUpdate: function (publicInstance) { + warnNoop(publicInstance, 'forceUpdate'); + }, + + /** + * Replaces all of the state. Always use this or `setState` to mutate state. + * You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} completeState Next state. + * @internal + */ + enqueueReplaceState: function (publicInstance, completeState) { + warnNoop(publicInstance, 'replaceState'); + }, + + /** + * Sets a subset of the state. This only exists because _pendingState is + * internal. This provides a merging strategy that is not available to deep + * properties which is confusing. TODO: Expose pendingState or don't use it + * during the merge. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} partialState Next partial state to be merged with state. + * @internal + */ + enqueueSetState: function (publicInstance, partialState) { + warnNoop(publicInstance, 'setState'); + } +}; + +module.exports = ReactNoopUpdateQueue; + +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +// The Symbol used to tag the ReactElement type. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. + +var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; + +module.exports = REACT_ELEMENT_TYPE; + +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +/* global Symbol */ + +var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + +/** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ +function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } +} + +module.exports = getIteratorFn; + +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +/** + * ReactElementValidator provides a wrapper around a element factory + * which validates the props passed to the element. This is intended to be + * used only in DEV and could be replaced by a static type checker for languages + * that support it. + */ + + + +var ReactCurrentOwner = __webpack_require__(9); +var ReactComponentTreeHook = __webpack_require__(6); +var ReactElement = __webpack_require__(13); + +var checkReactTypeSpec = __webpack_require__(99); + +var canDefineProperty = __webpack_require__(24); +var getIteratorFn = __webpack_require__(55); +var warning = __webpack_require__(1); +var lowPriorityWarning = __webpack_require__(32); + +function getDeclarationErrorAddendum() { + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; +} + +function getSourceInfoErrorAddendum(elementProps) { + if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { + var source = elementProps.__source; + var fileName = source.fileName.replace(/^.*[\\\/]/, ''); + var lineNumber = source.lineNumber; + return ' Check your code at ' + fileName + ':' + lineNumber + '.'; + } + return ''; +} + +/** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ +var ownerHasKeyUseWarning = {}; + +function getCurrentComponentErrorInfo(parentType) { + var info = getDeclarationErrorAddendum(); + + if (!info) { + var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; + if (parentName) { + info = ' Check the top-level render call using <' + parentName + '>.'; + } + } + return info; +} + +/** + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ +function validateExplicitKey(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } + element._store.validated = true; + + var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); + + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); + if (memoizer[currentComponentErrorInfo]) { + return; + } + memoizer[currentComponentErrorInfo] = true; + + // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + var childOwner = ''; + if (element && element._owner && element._owner !== ReactCurrentOwner.current) { + // Give the component that originally created this child. + childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; + } + + process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0; +} + +/** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. + */ +function validateChildKeys(node, parentType) { + if (typeof node !== 'object') { + return; + } + if (Array.isArray(node)) { + for (var i = 0; i < node.length; i++) { + var child = node[i]; + if (ReactElement.isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } else if (ReactElement.isValidElement(node)) { + // This element was passed in a valid location. + if (node._store) { + node._store.validated = true; + } + } else if (node) { + var iteratorFn = getIteratorFn(node); + // Entry iterators provide implicit keys. + if (iteratorFn) { + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + while (!(step = iterator.next()).done) { + if (ReactElement.isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } +} + +/** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ +function validatePropTypes(element) { + var componentClass = element.type; + if (typeof componentClass !== 'function') { + return; + } + var name = componentClass.displayName || componentClass.name; + if (componentClass.propTypes) { + checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null); + } + if (typeof componentClass.getDefaultProps === 'function') { + process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0; + } +} + +var ReactElementValidator = { + createElement: function (type, props, children) { + var validType = typeof type === 'string' || typeof type === 'function'; + // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + if (!validType) { + if (typeof type !== 'function' && typeof type !== 'string') { + var info = ''; + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + "it's defined in."; + } + + var sourceInfo = getSourceInfoErrorAddendum(props); + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); + } + + info += ReactComponentTreeHook.getCurrentStackAddendum(); + + var currentSource = props !== null && props !== undefined && props.__source !== undefined ? props.__source : null; + ReactComponentTreeHook.pushNonStandardWarningStack(true, currentSource); + process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0; + ReactComponentTreeHook.popNonStandardWarningStack(); + } + } + + var element = ReactElement.createElement.apply(this, arguments); + + // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + if (element == null) { + return element; + } + + // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + if (validType) { + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } + } + + validatePropTypes(element); + + return element; + }, + + createFactory: function (type) { + var validatedFactory = ReactElementValidator.createElement.bind(null, type); + // Legacy hook TODO: Warn if this is accessed + validatedFactory.type = type; + + if (process.env.NODE_ENV !== 'production') { + if (canDefineProperty) { + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + get: function () { + lowPriorityWarning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); + Object.defineProperty(this, 'type', { + value: type + }); + return type; + } + }); + } + } + + return validatedFactory; + }, + + cloneElement: function (element, props, children) { + var newElement = ReactElement.cloneElement.apply(this, arguments); + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], newElement.type); + } + validatePropTypes(newElement); + return newElement; + } +}; + +module.exports = ReactElementValidator; + +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +// React 15.5 references this module, and assumes PropTypes are still callable in production. +// Therefore we re-export development-only version with all the PropTypes checks here. +// However if one is migrating to the `prop-types` npm library, they will go through the +// `index.js` entry point, and it will branch depending on the environment. +var factory = __webpack_require__(58); +module.exports = function(isValidElement) { + // It is still allowed in 15.5. + var throwOnDirectAccess = false; + return factory(isValidElement, throwOnDirectAccess); +}; + + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +var emptyFunction = __webpack_require__(7); +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); +var assign = __webpack_require__(3); + +var ReactPropTypesSecret = __webpack_require__(33); +var checkPropTypes = __webpack_require__(103); + +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<<anonymous>>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + invariant( + false, + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + warning( + false, + 'You are manually calling a React.PropTypes validation ' + + 'function for the `%s` prop on `%s`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', + propFullName, + componentName + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunction.thatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + return emptyFunction.thatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (propValue.hasOwnProperty(key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunction.thatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + warning( + false, + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received %s at index %s.', + getPostfixForTypeWarning(checker), + i + ); + return emptyFunction.thatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + return null; + } + } + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + + +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactDOMComponentFlags = { + hasCachedChildNodes: 1 << 0 +}; + +module.exports = ReactDOMComponentFlags; + +/***/ }), +/* 60 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +/** + * Accumulates items that must not be null or undefined into the first one. This + * is used to conserve memory by avoiding array allocations, and thus sacrifices + * API cleanness. Since `current` can be null before being passed in and not + * null after this function, make sure to assign it back to `current`: + * + * `a = accumulateInto(a, b);` + * + * This API should be sparingly used. Try `accumulate` for something cleaner. + * + * @return {*|array<*>} An accumulation of items. + */ + +function accumulateInto(current, next) { + !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; + + if (current == null) { + return next; + } + + // Both are not empty. Warning: Never call x.concat(y) when you are not + // certain that x is an Array (x could be a string with concat method). + if (Array.isArray(current)) { + if (Array.isArray(next)) { + current.push.apply(current, next); + return current; + } + current.push(next); + return current; + } + + if (Array.isArray(next)) { + // A bit too dangerous to mutate `next`. + return [current].concat(next); + } + + return [current, next]; +} + +module.exports = accumulateInto; + +/***/ }), +/* 61 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +/** + * @param {array} arr an "accumulation" of items which is either an Array or + * a single item. Useful when paired with the `accumulate` module. This is a + * simple utility that allows us to reason about a collection of items, but + * handling the case when there is exactly one item (and we do not need to + * allocate an array). + */ + +function forEachAccumulated(arr, cb, scope) { + if (Array.isArray(arr)) { + arr.forEach(cb, scope); + } else if (arr) { + cb.call(scope, arr); + } +} + +module.exports = forEachAccumulated; + +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ExecutionEnvironment = __webpack_require__(5); + +var contentKey = null; + +/** + * Gets the key used to access text content on a DOM node. + * + * @return {?string} Key used to access text content. + * @internal + */ +function getTextContentAccessor() { + if (!contentKey && ExecutionEnvironment.canUseDOM) { + // Prefer textContent to innerText because many browsers support both but + // SVG <text> elements don't support innerText even when <div> does. + contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText'; + } + return contentKey; +} + +module.exports = getTextContentAccessor; + +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var PooledClass = __webpack_require__(14); + +var invariant = __webpack_require__(0); + +/** + * A specialized pseudo-event module to help keep track of components waiting to + * be notified when their DOM representations are available for use. + * + * This implements `PooledClass`, so you should never need to instantiate this. + * Instead, use `CallbackQueue.getPooled()`. + * + * @class ReactMountReady + * @implements PooledClass + * @internal + */ + +var CallbackQueue = function () { + function CallbackQueue(arg) { + _classCallCheck(this, CallbackQueue); + + this._callbacks = null; + this._contexts = null; + this._arg = arg; + } + + /** + * Enqueues a callback to be invoked when `notifyAll` is invoked. + * + * @param {function} callback Invoked when `notifyAll` is invoked. + * @param {?object} context Context to call `callback` with. + * @internal + */ + + + CallbackQueue.prototype.enqueue = function enqueue(callback, context) { + this._callbacks = this._callbacks || []; + this._callbacks.push(callback); + this._contexts = this._contexts || []; + this._contexts.push(context); + }; + + /** + * Invokes all enqueued callbacks and clears the queue. This is invoked after + * the DOM representation of a component has been created or updated. + * + * @internal + */ + + + CallbackQueue.prototype.notifyAll = function notifyAll() { + var callbacks = this._callbacks; + var contexts = this._contexts; + var arg = this._arg; + if (callbacks && contexts) { + !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : _prodInvariant('24') : void 0; + this._callbacks = null; + this._contexts = null; + for (var i = 0; i < callbacks.length; i++) { + callbacks[i].call(contexts[i], arg); + } + callbacks.length = 0; + contexts.length = 0; + } + }; + + CallbackQueue.prototype.checkpoint = function checkpoint() { + return this._callbacks ? this._callbacks.length : 0; + }; + + CallbackQueue.prototype.rollback = function rollback(len) { + if (this._callbacks && this._contexts) { + this._callbacks.length = len; + this._contexts.length = len; + } + }; + + /** + * Resets the internal queue. + * + * @internal + */ + + + CallbackQueue.prototype.reset = function reset() { + this._callbacks = null; + this._contexts = null; + }; + + /** + * `PooledClass` looks for this. + */ + + + CallbackQueue.prototype.destructor = function destructor() { + this.reset(); + }; + + return CallbackQueue; +}(); + +module.exports = PooledClass.addPoolingTo(CallbackQueue); + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var ReactFeatureFlags = { + // When true, call console.time() before and .timeEnd() after each top-level + // render (both initial renders and updates). Useful when looking at prod-mode + // timeline profiles in Chrome, for example. + logTopLevelRenders: false +}; + +module.exports = ReactFeatureFlags; + +/***/ }), +/* 65 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactDOMComponentTree = __webpack_require__(4); + +function isCheckable(elem) { + var type = elem.type; + var nodeName = elem.nodeName; + return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); +} + +function getTracker(inst) { + return inst._wrapperState.valueTracker; +} + +function attachTracker(inst, tracker) { + inst._wrapperState.valueTracker = tracker; +} + +function detachTracker(inst) { + inst._wrapperState.valueTracker = null; +} + +function getValueFromNode(node) { + var value; + if (node) { + value = isCheckable(node) ? '' + node.checked : node.value; + } + return value; +} + +var inputValueTracking = { + // exposed for testing + _getTrackerFromNode: function (node) { + return getTracker(ReactDOMComponentTree.getInstanceFromNode(node)); + }, + + + track: function (inst) { + if (getTracker(inst)) { + return; + } + + var node = ReactDOMComponentTree.getNodeFromInstance(inst); + var valueField = isCheckable(node) ? 'checked' : 'value'; + var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); + + var currentValue = '' + node[valueField]; + + // if someone has already defined a value or Safari, then bail + // and don't track value will cause over reporting of changes, + // but it's better then a hard failure + // (needed for certain tests that spyOn input values and Safari) + if (node.hasOwnProperty(valueField) || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { + return; + } + + Object.defineProperty(node, valueField, { + enumerable: descriptor.enumerable, + configurable: true, + get: function () { + return descriptor.get.call(this); + }, + set: function (value) { + currentValue = '' + value; + descriptor.set.call(this, value); + } + }); + + attachTracker(inst, { + getValue: function () { + return currentValue; + }, + setValue: function (value) { + currentValue = '' + value; + }, + stopTracking: function () { + detachTracker(inst); + delete node[valueField]; + } + }); + }, + + updateValueIfChanged: function (inst) { + if (!inst) { + return false; + } + var tracker = getTracker(inst); + + if (!tracker) { + inputValueTracking.track(inst); + return true; + } + + var lastValue = tracker.getValue(); + var nextValue = getValueFromNode(ReactDOMComponentTree.getNodeFromInstance(inst)); + + if (nextValue !== lastValue) { + tracker.setValue(nextValue); + return true; + } + + return false; + }, + stopTracking: function (inst) { + var tracker = getTracker(inst); + if (tracker) { + tracker.stopTracking(); + } + } +}; + +module.exports = inputValueTracking; + +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +/** + * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary + */ + +var supportedInputTypes = { + color: true, + date: true, + datetime: true, + 'datetime-local': true, + email: true, + month: true, + number: true, + password: true, + range: true, + search: true, + tel: true, + text: true, + time: true, + url: true, + week: true +}; + +function isTextInputElement(elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); + + if (nodeName === 'input') { + return !!supportedInputTypes[elem.type]; + } + + if (nodeName === 'textarea') { + return true; + } + + return false; +} + +module.exports = isTextInputElement; + +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ViewportMetrics = { + currentScrollLeft: 0, + + currentScrollTop: 0, + + refreshScrollValues: function (scrollPosition) { + ViewportMetrics.currentScrollLeft = scrollPosition.x; + ViewportMetrics.currentScrollTop = scrollPosition.y; + } +}; + +module.exports = ViewportMetrics; + +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ExecutionEnvironment = __webpack_require__(5); +var escapeTextContentForBrowser = __webpack_require__(30); +var setInnerHTML = __webpack_require__(29); + +/** + * Set the textContent property of a node, ensuring that whitespace is preserved + * even in IE8. innerText is a poor substitute for textContent and, among many + * issues, inserts <br> instead of the literal newline chars. innerHTML behaves + * as it should. + * + * @param {DOMElement} node + * @param {string} text + * @internal + */ +var setTextContent = function (node, text) { + if (text) { + var firstChild = node.firstChild; + + if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { + firstChild.nodeValue = text; + return; + } + } + node.textContent = text; +}; + +if (ExecutionEnvironment.canUseDOM) { + if (!('textContent' in document.documentElement)) { + setTextContent = function (node, text) { + if (node.nodeType === 3) { + node.nodeValue = text; + return; + } + setInnerHTML(node, escapeTextContentForBrowser(text)); + }; + } +} + +module.exports = setTextContent; + +/***/ }), +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * @param {DOMElement} node input/textarea to focus + */ + +function focusNode(node) { + // IE8 can throw "Can't move focus to the control because it is invisible, + // not enabled, or of a type that does not accept the focus." for all kinds of + // reasons that are too expensive and fragile to test. + try { + node.focus(); + } catch (e) {} +} + +module.exports = focusNode; + +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * CSS properties which accept numbers but are not in units of "px". + */ + +var isUnitlessNumber = { + animationIterationCount: true, + borderImageOutset: true, + borderImageSlice: true, + borderImageWidth: true, + boxFlex: true, + boxFlexGroup: true, + boxOrdinalGroup: true, + columnCount: true, + columns: true, + flex: true, + flexGrow: true, + flexPositive: true, + flexShrink: true, + flexNegative: true, + flexOrder: true, + gridRow: true, + gridRowEnd: true, + gridRowSpan: true, + gridRowStart: true, + gridColumn: true, + gridColumnEnd: true, + gridColumnSpan: true, + gridColumnStart: true, + fontWeight: true, + lineClamp: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + tabSize: true, + widows: true, + zIndex: true, + zoom: true, + + // SVG-related properties + fillOpacity: true, + floodOpacity: true, + stopOpacity: true, + strokeDasharray: true, + strokeDashoffset: true, + strokeMiterlimit: true, + strokeOpacity: true, + strokeWidth: true +}; + +/** + * @param {string} prefix vendor-specific prefix, eg: Webkit + * @param {string} key style name, eg: transitionDuration + * @return {string} style name prefixed with `prefix`, properly camelCased, eg: + * WebkitTransitionDuration + */ +function prefixKey(prefix, key) { + return prefix + key.charAt(0).toUpperCase() + key.substring(1); +} + +/** + * Support style names that may come passed in prefixed by adding permutations + * of vendor prefixes. + */ +var prefixes = ['Webkit', 'ms', 'Moz', 'O']; + +// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an +// infinite loop, because it iterates over the newly added props too. +Object.keys(isUnitlessNumber).forEach(function (prop) { + prefixes.forEach(function (prefix) { + isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; + }); +}); + +/** + * Most style properties can be unset by doing .style[prop] = '' but IE8 + * doesn't like doing that with shorthand properties so for the properties that + * IE8 breaks on, which are listed here, we instead unset each of the + * individual properties. See http://bugs.jquery.com/ticket/12385. + * The 4-value 'clock' properties like margin, padding, border-width seem to + * behave without any problems. Curiously, list-style works too without any + * special prodding. + */ +var shorthandPropertyExpansions = { + background: { + backgroundAttachment: true, + backgroundColor: true, + backgroundImage: true, + backgroundPositionX: true, + backgroundPositionY: true, + backgroundRepeat: true + }, + backgroundPosition: { + backgroundPositionX: true, + backgroundPositionY: true + }, + border: { + borderWidth: true, + borderStyle: true, + borderColor: true + }, + borderBottom: { + borderBottomWidth: true, + borderBottomStyle: true, + borderBottomColor: true + }, + borderLeft: { + borderLeftWidth: true, + borderLeftStyle: true, + borderLeftColor: true + }, + borderRight: { + borderRightWidth: true, + borderRightStyle: true, + borderRightColor: true + }, + borderTop: { + borderTopWidth: true, + borderTopStyle: true, + borderTopColor: true + }, + font: { + fontStyle: true, + fontVariant: true, + fontWeight: true, + fontSize: true, + lineHeight: true, + fontFamily: true + }, + outline: { + outlineWidth: true, + outlineStyle: true, + outlineColor: true + } +}; + +var CSSProperty = { + isUnitlessNumber: isUnitlessNumber, + shorthandPropertyExpansions: shorthandPropertyExpansions +}; + +module.exports = CSSProperty; + +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMProperty = __webpack_require__(12); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactInstrumentation = __webpack_require__(8); + +var quoteAttributeValueForBrowser = __webpack_require__(141); +var warning = __webpack_require__(1); + +var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + DOMProperty.ATTRIBUTE_NAME_START_CHAR + '][' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); +var illegalAttributeNameCache = {}; +var validatedAttributeNameCache = {}; + +function isAttributeNameSafe(attributeName) { + if (validatedAttributeNameCache.hasOwnProperty(attributeName)) { + return true; + } + if (illegalAttributeNameCache.hasOwnProperty(attributeName)) { + return false; + } + if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { + validatedAttributeNameCache[attributeName] = true; + return true; + } + illegalAttributeNameCache[attributeName] = true; + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : void 0; + return false; +} + +function shouldIgnoreValue(propertyInfo, value) { + return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false; +} + +/** + * Operations for dealing with DOM properties. + */ +var DOMPropertyOperations = { + /** + * Creates markup for the ID property. + * + * @param {string} id Unescaped ID. + * @return {string} Markup string. + */ + createMarkupForID: function (id) { + return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id); + }, + + setAttributeForID: function (node, id) { + node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id); + }, + + createMarkupForRoot: function () { + return DOMProperty.ROOT_ATTRIBUTE_NAME + '=""'; + }, + + setAttributeForRoot: function (node) { + node.setAttribute(DOMProperty.ROOT_ATTRIBUTE_NAME, ''); + }, + + /** + * Creates markup for a property. + * + * @param {string} name + * @param {*} value + * @return {?string} Markup string, or null if the property was invalid. + */ + createMarkupForProperty: function (name, value) { + var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; + if (propertyInfo) { + if (shouldIgnoreValue(propertyInfo, value)) { + return ''; + } + var attributeName = propertyInfo.attributeName; + if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { + return attributeName + '=""'; + } + return attributeName + '=' + quoteAttributeValueForBrowser(value); + } else if (DOMProperty.isCustomAttribute(name)) { + if (value == null) { + return ''; + } + return name + '=' + quoteAttributeValueForBrowser(value); + } + return null; + }, + + /** + * Creates markup for a custom property. + * + * @param {string} name + * @param {*} value + * @return {string} Markup string, or empty string if the property was invalid. + */ + createMarkupForCustomAttribute: function (name, value) { + if (!isAttributeNameSafe(name) || value == null) { + return ''; + } + return name + '=' + quoteAttributeValueForBrowser(value); + }, + + /** + * Sets the value for a property on a node. + * + * @param {DOMElement} node + * @param {string} name + * @param {*} value + */ + setValueForProperty: function (node, name, value) { + var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; + if (propertyInfo) { + var mutationMethod = propertyInfo.mutationMethod; + if (mutationMethod) { + mutationMethod(node, value); + } else if (shouldIgnoreValue(propertyInfo, value)) { + this.deleteValueForProperty(node, name); + return; + } else if (propertyInfo.mustUseProperty) { + // Contrary to `setAttribute`, object properties are properly + // `toString`ed by IE8/9. + node[propertyInfo.propertyName] = value; + } else { + var attributeName = propertyInfo.attributeName; + var namespace = propertyInfo.attributeNamespace; + // `setAttribute` with objects becomes only `[object]` in IE8/9, + // ('' + value) makes it output the correct toString()-value. + if (namespace) { + node.setAttributeNS(namespace, attributeName, '' + value); + } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) { + node.setAttribute(attributeName, ''); + } else { + node.setAttribute(attributeName, '' + value); + } + } + } else if (DOMProperty.isCustomAttribute(name)) { + DOMPropertyOperations.setValueForAttribute(node, name, value); + return; + } + + if (process.env.NODE_ENV !== 'production') { + var payload = {}; + payload[name] = value; + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, + type: 'update attribute', + payload: payload + }); + } + }, + + setValueForAttribute: function (node, name, value) { + if (!isAttributeNameSafe(name)) { + return; + } + if (value == null) { + node.removeAttribute(name); + } else { + node.setAttribute(name, '' + value); + } + + if (process.env.NODE_ENV !== 'production') { + var payload = {}; + payload[name] = value; + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, + type: 'update attribute', + payload: payload + }); + } + }, + + /** + * Deletes an attributes from a node. + * + * @param {DOMElement} node + * @param {string} name + */ + deleteValueForAttribute: function (node, name) { + node.removeAttribute(name); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, + type: 'remove attribute', + payload: name + }); + } + }, + + /** + * Deletes the value for a property on a node. + * + * @param {DOMElement} node + * @param {string} name + */ + deleteValueForProperty: function (node, name) { + var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null; + if (propertyInfo) { + var mutationMethod = propertyInfo.mutationMethod; + if (mutationMethod) { + mutationMethod(node, undefined); + } else if (propertyInfo.mustUseProperty) { + var propName = propertyInfo.propertyName; + if (propertyInfo.hasBooleanValue) { + node[propName] = false; + } else { + node[propName] = ''; + } + } else { + node.removeAttribute(propertyInfo.attributeName); + } + } else if (DOMProperty.isCustomAttribute(name)) { + node.removeAttribute(name); + } + + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: ReactDOMComponentTree.getInstanceFromNode(node)._debugID, + type: 'remove attribute', + payload: name + }); + } + } +}; + +module.exports = DOMPropertyOperations; + +/***/ }), +/* 72 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var LinkedValueUtils = __webpack_require__(43); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactUpdates = __webpack_require__(10); + +var warning = __webpack_require__(1); + +var didWarnValueLink = false; +var didWarnValueDefaultValue = false; + +function updateOptionsIfPendingUpdateAndMounted() { + if (this._rootNodeID && this._wrapperState.pendingUpdate) { + this._wrapperState.pendingUpdate = false; + + var props = this._currentElement.props; + var value = LinkedValueUtils.getValue(props); + + if (value != null) { + updateOptions(this, Boolean(props.multiple), value); + } + } +} + +function getDeclarationErrorAddendum(owner) { + if (owner) { + var name = owner.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; +} + +var valuePropNames = ['value', 'defaultValue']; + +/** + * Validation function for `value` and `defaultValue`. + * @private + */ +function checkSelectPropTypes(inst, props) { + var owner = inst._currentElement._owner; + LinkedValueUtils.checkPropTypes('select', props, owner); + + if (props.valueLink !== undefined && !didWarnValueLink) { + process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0; + didWarnValueLink = true; + } + + for (var i = 0; i < valuePropNames.length; i++) { + var propName = valuePropNames[i]; + if (props[propName] == null) { + continue; + } + var isArray = Array.isArray(props[propName]); + if (props.multiple && !isArray) { + process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; + } else if (!props.multiple && isArray) { + process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0; + } + } +} + +/** + * @param {ReactDOMComponent} inst + * @param {boolean} multiple + * @param {*} propValue A stringable (with `multiple`, a list of stringables). + * @private + */ +function updateOptions(inst, multiple, propValue) { + var selectedValue, i; + var options = ReactDOMComponentTree.getNodeFromInstance(inst).options; + + if (multiple) { + selectedValue = {}; + for (i = 0; i < propValue.length; i++) { + selectedValue['' + propValue[i]] = true; + } + for (i = 0; i < options.length; i++) { + var selected = selectedValue.hasOwnProperty(options[i].value); + if (options[i].selected !== selected) { + options[i].selected = selected; + } + } + } else { + // Do not set `select.value` as exact behavior isn't consistent across all + // browsers for all cases. + selectedValue = '' + propValue; + for (i = 0; i < options.length; i++) { + if (options[i].value === selectedValue) { + options[i].selected = true; + return; + } + } + if (options.length) { + options[0].selected = true; + } + } +} + +/** + * Implements a <select> host component that allows optionally setting the + * props `value` and `defaultValue`. If `multiple` is false, the prop must be a + * stringable. If `multiple` is true, the prop must be an array of stringables. + * + * If `value` is not supplied (or null/undefined), user actions that change the + * selected option will trigger updates to the rendered options. + * + * If it is supplied (and not null/undefined), the rendered options will not + * update in response to user actions. Instead, the `value` prop must change in + * order for the rendered options to update. + * + * If `defaultValue` is provided, any options with the supplied values will be + * selected. + */ +var ReactDOMSelect = { + getHostProps: function (inst, props) { + return _assign({}, props, { + onChange: inst._wrapperState.onChange, + value: undefined + }); + }, + + mountWrapper: function (inst, props) { + if (process.env.NODE_ENV !== 'production') { + checkSelectPropTypes(inst, props); + } + + var value = LinkedValueUtils.getValue(props); + inst._wrapperState = { + pendingUpdate: false, + initialValue: value != null ? value : props.defaultValue, + listeners: null, + onChange: _handleChange.bind(inst), + wasMultiple: Boolean(props.multiple) + }; + + if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; + didWarnValueDefaultValue = true; + } + }, + + getSelectValueContext: function (inst) { + // ReactDOMOption looks at this initial value so the initial generated + // markup has correct `selected` attributes + return inst._wrapperState.initialValue; + }, + + postUpdateWrapper: function (inst) { + var props = inst._currentElement.props; + + // After the initial mount, we control selected-ness manually so don't pass + // this value down + inst._wrapperState.initialValue = undefined; + + var wasMultiple = inst._wrapperState.wasMultiple; + inst._wrapperState.wasMultiple = Boolean(props.multiple); + + var value = LinkedValueUtils.getValue(props); + if (value != null) { + inst._wrapperState.pendingUpdate = false; + updateOptions(inst, Boolean(props.multiple), value); + } else if (wasMultiple !== Boolean(props.multiple)) { + // For simplicity, reapply `defaultValue` if `multiple` is toggled. + if (props.defaultValue != null) { + updateOptions(inst, Boolean(props.multiple), props.defaultValue); + } else { + // Revert the select back to its default unselected state. + updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : ''); + } + } + } +}; + +function _handleChange(event) { + var props = this._currentElement.props; + var returnValue = LinkedValueUtils.executeOnChange(props, event); + + if (this._rootNodeID) { + this._wrapperState.pendingUpdate = true; + } + ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); + return returnValue; +} + +module.exports = ReactDOMSelect; + +/***/ }), +/* 74 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2), + _assign = __webpack_require__(3); + +var ReactCompositeComponent = __webpack_require__(149); +var ReactEmptyComponent = __webpack_require__(76); +var ReactHostComponent = __webpack_require__(77); + +var getNextDebugID = __webpack_require__(152); +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +// To avoid a cyclic dependency, we create the final class in this module +var ReactCompositeComponentWrapper = function (element) { + this.construct(element); +}; + +function getDeclarationErrorAddendum(owner) { + if (owner) { + var name = owner.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; +} + +/** + * Check if the type reference is a known internal type. I.e. not a user + * provided composite type. + * + * @param {function} type + * @return {boolean} Returns true if this is a valid internal type. + */ +function isInternalComponentType(type) { + return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function'; +} + +/** + * Given a ReactNode, create an instance that will actually be mounted. + * + * @param {ReactNode} node + * @param {boolean} shouldHaveDebugID + * @return {object} A new instance of the element's constructor. + * @protected + */ +function instantiateReactComponent(node, shouldHaveDebugID) { + var instance; + + if (node === null || node === false) { + instance = ReactEmptyComponent.create(instantiateReactComponent); + } else if (typeof node === 'object') { + var element = node; + var type = element.type; + if (typeof type !== 'function' && typeof type !== 'string') { + var info = ''; + if (process.env.NODE_ENV !== 'production') { + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + "it's defined in."; + } + } + info += getDeclarationErrorAddendum(element._owner); + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info) : _prodInvariant('130', type == null ? type : typeof type, info) : void 0; + } + + // Special case string values + if (typeof element.type === 'string') { + instance = ReactHostComponent.createInternalComponent(element); + } else if (isInternalComponentType(element.type)) { + // This is temporarily available for custom components that are not string + // representations. I.e. ART. Once those are updated to use the string + // representation, we can drop this code path. + instance = new element.type(element); + + // We renamed this. Allow the old name for compat. :( + if (!instance.getHostNode) { + instance.getHostNode = instance.getNativeNode; + } + } else { + instance = new ReactCompositeComponentWrapper(element); + } + } else if (typeof node === 'string' || typeof node === 'number') { + instance = ReactHostComponent.createInstanceForText(node); + } else { + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : _prodInvariant('131', typeof node) : void 0; + } + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getHostNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0; + } + + // These two fields are used by the DOM and ART diffing algorithms + // respectively. Instead of using expandos on components, we should be + // storing the state needed by the diffing algorithms elsewhere. + instance._mountIndex = 0; + instance._mountImage = null; + + if (process.env.NODE_ENV !== 'production') { + instance._debugID = shouldHaveDebugID ? getNextDebugID() : 0; + } + + // Internal instances should fully constructed at this point, so they should + // not get any new fields added to them at this point. + if (process.env.NODE_ENV !== 'production') { + if (Object.preventExtensions) { + Object.preventExtensions(instance); + } + } + + return instance; +} + +_assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent, { + _instantiateReactComponent: instantiateReactComponent +}); + +module.exports = instantiateReactComponent; + +/***/ }), +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var React = __webpack_require__(15); + +var invariant = __webpack_require__(0); + +var ReactNodeTypes = { + HOST: 0, + COMPOSITE: 1, + EMPTY: 2, + + getType: function (node) { + if (node === null || node === false) { + return ReactNodeTypes.EMPTY; + } else if (React.isValidElement(node)) { + if (typeof node.type === 'function') { + return ReactNodeTypes.COMPOSITE; + } else { + return ReactNodeTypes.HOST; + } + } + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0; + } +}; + +module.exports = ReactNodeTypes; + +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var emptyComponentFactory; + +var ReactEmptyComponentInjection = { + injectEmptyComponentFactory: function (factory) { + emptyComponentFactory = factory; + } +}; + +var ReactEmptyComponent = { + create: function (instantiate) { + return emptyComponentFactory(instantiate); + } +}; + +ReactEmptyComponent.injection = ReactEmptyComponentInjection; + +module.exports = ReactEmptyComponent; + +/***/ }), +/* 77 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +var genericComponentClass = null; +var textComponentClass = null; + +var ReactHostComponentInjection = { + // This accepts a class that receives the tag string. This is a catch all + // that can render any kind of tag. + injectGenericComponentClass: function (componentClass) { + genericComponentClass = componentClass; + }, + // This accepts a text component class that takes the text string to be + // rendered as props. + injectTextComponentClass: function (componentClass) { + textComponentClass = componentClass; + } +}; + +/** + * Get a host internal component class for a specific tag. + * + * @param {ReactElement} element The element to create. + * @return {function} The internal class constructor function. + */ +function createInternalComponent(element) { + !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0; + return new genericComponentClass(element); +} + +/** + * @param {ReactText} text + * @return {ReactComponent} + */ +function createInstanceForText(text) { + return new textComponentClass(text); +} + +/** + * @param {ReactComponent} component + * @return {boolean} + */ +function isTextComponent(component) { + return component instanceof textComponentClass; +} + +var ReactHostComponent = { + createInternalComponent: createInternalComponent, + createInstanceForText: createInstanceForText, + isTextComponent: isTextComponent, + injection: ReactHostComponentInjection +}; + +module.exports = ReactHostComponent; + +/***/ }), +/* 78 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var ReactCurrentOwner = __webpack_require__(9); +var REACT_ELEMENT_TYPE = __webpack_require__(153); + +var getIteratorFn = __webpack_require__(154); +var invariant = __webpack_require__(0); +var KeyEscapeUtils = __webpack_require__(47); +var warning = __webpack_require__(1); + +var SEPARATOR = '.'; +var SUBSEPARATOR = ':'; + +/** + * This is inlined from ReactElement since this file is shared between + * isomorphic and renderers. We could extract this to a + * + */ + +/** + * TODO: Test that a single child and an array with one item have the same key + * pattern. + */ + +var didWarnAboutMaps = false; + +/** + * Generate a key string that identifies a component within a set. + * + * @param {*} component A component that could contain a manual key. + * @param {number} index Index that is used if a manual key is not provided. + * @return {string} + */ +function getComponentKey(component, index) { + // Do some typechecking here since we call this blindly. We want to ensure + // that we don't block potential future ES APIs. + if (component && typeof component === 'object' && component.key != null) { + // Explicit key + return KeyEscapeUtils.escape(component.key); + } + // Implicit key determined by the index in the set + return index.toString(36); +} + +/** + * @param {?*} children Children tree container. + * @param {!string} nameSoFar Name of the key path so far. + * @param {!function} callback Callback to invoke with each child found. + * @param {?*} traverseContext Used to pass information throughout the traversal + * process. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { + var type = typeof children; + + if (type === 'undefined' || type === 'boolean') { + // All of the above are perceived as null. + children = null; + } + + if (children === null || type === 'string' || type === 'number' || + // The following is inlined from ReactElement. This means we can optimize + // some checks. React Fiber also inlines this logic for similar purposes. + type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { + callback(traverseContext, children, + // If it's the only child, treat the name as if it was wrapped in an array + // so that it's consistent if the number of children grows. + nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); + return 1; + } + + var child; + var nextName; + var subtreeCount = 0; // Count of children found in the current subtree. + var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; + + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + child = children[i]; + nextName = nextNamePrefix + getComponentKey(child, i); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + var iteratorFn = getIteratorFn(children); + if (iteratorFn) { + var iterator = iteratorFn.call(children); + var step; + if (iteratorFn !== children.entries) { + var ii = 0; + while (!(step = iterator.next()).done) { + child = step.value; + nextName = nextNamePrefix + getComponentKey(child, ii++); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + if (process.env.NODE_ENV !== 'production') { + var mapsAsChildrenAddendum = ''; + if (ReactCurrentOwner.current) { + var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); + if (mapsAsChildrenOwnerName) { + mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; + } + } + process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; + didWarnAboutMaps = true; + } + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + child = entry[1]; + nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } + } + } else if (type === 'object') { + var addendum = ''; + if (process.env.NODE_ENV !== 'production') { + addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; + if (children._isReactElement) { + addendum = " It looks like you're using an element created by a different " + 'version of React. Make sure to use only one copy of React.'; + } + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + addendum += ' Check the render method of `' + name + '`.'; + } + } + } + var childrenString = String(children); + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; + } + } + + return subtreeCount; +} + +/** + * Traverses children that are typically specified as `props.children`, but + * might also be specified through attributes: + * + * - `traverseAllChildren(this.props.children, ...)` + * - `traverseAllChildren(this.props.leftPanelChildren, ...)` + * + * The `traverseContext` is an optional argument that is passed through the + * entire traversal. It can be used to store accumulations or anything else that + * the callback might find relevant. + * + * @param {?*} children Children tree object. + * @param {!function} callback To invoke upon traversing each child. + * @param {?*} traverseContext Context for traversal. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildren(children, callback, traverseContext) { + if (children == null) { + return 0; + } + + return traverseAllChildrenImpl(children, '', callback, traverseContext); +} + +module.exports = traverseAllChildren; + +/***/ }), +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +var emptyFunction = __webpack_require__(7); + +/** + * Upstream version of event listener. Does not take into account specific + * nature of platform. + */ +var EventListener = { + /** + * Listen to DOM events during the bubble phase. + * + * @param {DOMEventTarget} target DOM element to register listener on. + * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. + * @param {function} callback Callback function. + * @return {object} Object with a `remove` method. + */ + listen: function listen(target, eventType, callback) { + if (target.addEventListener) { + target.addEventListener(eventType, callback, false); + return { + remove: function remove() { + target.removeEventListener(eventType, callback, false); + } + }; + } else if (target.attachEvent) { + target.attachEvent('on' + eventType, callback); + return { + remove: function remove() { + target.detachEvent('on' + eventType, callback); + } + }; + } + }, + + /** + * Listen to DOM events during the capture phase. + * + * @param {DOMEventTarget} target DOM element to register listener on. + * @param {string} eventType Event type, e.g. 'click' or 'mouseover'. + * @param {function} callback Callback function. + * @return {object} Object with a `remove` method. + */ + capture: function capture(target, eventType, callback) { + if (target.addEventListener) { + target.addEventListener(eventType, callback, true); + return { + remove: function remove() { + target.removeEventListener(eventType, callback, true); + } + }; + } else { + if (process.env.NODE_ENV !== 'production') { + console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.'); + } + return { + remove: emptyFunction + }; + } + }, + + registerDefault: function registerDefault() {} +}; + +module.exports = EventListener; + +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactDOMSelection = __webpack_require__(166); + +var containsNode = __webpack_require__(168); +var focusNode = __webpack_require__(69); +var getActiveElement = __webpack_require__(81); + +function isInDocument(node) { + return containsNode(document.documentElement, node); +} + +/** + * @ReactInputSelection: React input selection module. Based on Selection.js, + * but modified to be suitable for react and has a couple of bug fixes (doesn't + * assume buttons have range selections allowed). + * Input selection module for React. + */ +var ReactInputSelection = { + hasSelectionCapabilities: function (elem) { + var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); + return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true'); + }, + + getSelectionInformation: function () { + var focusedElem = getActiveElement(); + return { + focusedElem: focusedElem, + selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null + }; + }, + + /** + * @restoreSelection: If any selection information was potentially lost, + * restore it. This is useful when performing operations that could remove dom + * nodes and place them back in, resulting in focus being lost. + */ + restoreSelection: function (priorSelectionInformation) { + var curFocusedElem = getActiveElement(); + var priorFocusedElem = priorSelectionInformation.focusedElem; + var priorSelectionRange = priorSelectionInformation.selectionRange; + if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { + if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) { + ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange); + } + focusNode(priorFocusedElem); + } + }, + + /** + * @getSelection: Gets the selection bounds of a focused textarea, input or + * contentEditable node. + * -@input: Look up selection bounds of this input + * -@return {start: selectionStart, end: selectionEnd} + */ + getSelection: function (input) { + var selection; + + if ('selectionStart' in input) { + // Modern browser with input or textarea. + selection = { + start: input.selectionStart, + end: input.selectionEnd + }; + } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { + // IE8 input. + var range = document.selection.createRange(); + // There can only be one selection per document in IE, so it must + // be in our element. + if (range.parentElement() === input) { + selection = { + start: -range.moveStart('character', -input.value.length), + end: -range.moveEnd('character', -input.value.length) + }; + } + } else { + // Content editable or old IE textarea. + selection = ReactDOMSelection.getOffsets(input); + } + + return selection || { start: 0, end: 0 }; + }, + + /** + * @setSelection: Sets the selection bounds of a textarea or input and focuses + * the input. + * -@input Set selection bounds of this input or textarea + * -@offsets Object of same form that is returned from get* + */ + setSelection: function (input, offsets) { + var start = offsets.start; + var end = offsets.end; + if (end === undefined) { + end = start; + } + + if ('selectionStart' in input) { + input.selectionStart = start; + input.selectionEnd = Math.min(end, input.value.length); + } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') { + var range = input.createTextRange(); + range.collapse(true); + range.moveStart('character', start); + range.moveEnd('character', end - start); + range.select(); + } else { + ReactDOMSelection.setOffsets(input, offsets); + } + } +}; + +module.exports = ReactInputSelection; + +/***/ }), +/* 81 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +/* eslint-disable fb-www/typeof-undefined */ + +/** + * Same as document.activeElement but wraps in a try-catch block. In IE it is + * not safe to call document.activeElement if there is nothing focused. + * + * The activeElement will be null only if the document or document body is not + * yet defined. + * + * @param {?DOMDocument} doc Defaults to current document. + * @return {?DOMElement} + */ +function getActiveElement(doc) /*?DOMElement*/{ + doc = doc || (typeof document !== 'undefined' ? document : undefined); + if (typeof doc === 'undefined') { + return null; + } + try { + return doc.activeElement || doc.body; + } catch (e) { + return doc.body; + } +} + +module.exports = getActiveElement; + +/***/ }), +/* 82 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var DOMLazyTree = __webpack_require__(18); +var DOMProperty = __webpack_require__(12); +var React = __webpack_require__(15); +var ReactBrowserEventEmitter = __webpack_require__(31); +var ReactCurrentOwner = __webpack_require__(9); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactDOMContainerInfo = __webpack_require__(183); +var ReactDOMFeatureFlags = __webpack_require__(184); +var ReactFeatureFlags = __webpack_require__(64); +var ReactInstanceMap = __webpack_require__(23); +var ReactInstrumentation = __webpack_require__(8); +var ReactMarkupChecksum = __webpack_require__(185); +var ReactReconciler = __webpack_require__(17); +var ReactUpdateQueue = __webpack_require__(48); +var ReactUpdates = __webpack_require__(10); + +var emptyObject = __webpack_require__(25); +var instantiateReactComponent = __webpack_require__(74); +var invariant = __webpack_require__(0); +var setInnerHTML = __webpack_require__(29); +var shouldUpdateReactComponent = __webpack_require__(46); +var warning = __webpack_require__(1); + +var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; +var ROOT_ATTR_NAME = DOMProperty.ROOT_ATTRIBUTE_NAME; + +var ELEMENT_NODE_TYPE = 1; +var DOC_NODE_TYPE = 9; +var DOCUMENT_FRAGMENT_NODE_TYPE = 11; + +var instancesByReactRootID = {}; + +/** + * Finds the index of the first character + * that's not common between the two given strings. + * + * @return {number} the index of the character where the strings diverge + */ +function firstDifferenceIndex(string1, string2) { + var minLen = Math.min(string1.length, string2.length); + for (var i = 0; i < minLen; i++) { + if (string1.charAt(i) !== string2.charAt(i)) { + return i; + } + } + return string1.length === string2.length ? -1 : minLen; +} + +/** + * @param {DOMElement|DOMDocument} container DOM element that may contain + * a React component + * @return {?*} DOM element that may have the reactRoot ID, or null. + */ +function getReactRootElementInContainer(container) { + if (!container) { + return null; + } + + if (container.nodeType === DOC_NODE_TYPE) { + return container.documentElement; + } else { + return container.firstChild; + } +} + +function internalGetID(node) { + // If node is something like a window, document, or text node, none of + // which support attributes or a .getAttribute method, gracefully return + // the empty string, as if the attribute were missing. + return node.getAttribute && node.getAttribute(ATTR_NAME) || ''; +} + +/** + * Mounts this component and inserts it into the DOM. + * + * @param {ReactComponent} componentInstance The instance to mount. + * @param {DOMElement} container DOM element to mount into. + * @param {ReactReconcileTransaction} transaction + * @param {boolean} shouldReuseMarkup If true, do not insert markup + */ +function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) { + var markerName; + if (ReactFeatureFlags.logTopLevelRenders) { + var wrappedElement = wrapperInstance._currentElement.props.child; + var type = wrappedElement.type; + markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name); + console.time(markerName); + } + + var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */ + ); + + if (markerName) { + console.timeEnd(markerName); + } + + wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance; + ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction); +} + +/** + * Batched mount. + * + * @param {ReactComponent} componentInstance The instance to mount. + * @param {DOMElement} container DOM element to mount into. + * @param {boolean} shouldReuseMarkup If true, do not insert markup + */ +function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) { + var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( + /* useCreateElement */ + !shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement); + transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context); + ReactUpdates.ReactReconcileTransaction.release(transaction); +} + +/** + * Unmounts a component and removes it from the DOM. + * + * @param {ReactComponent} instance React component instance. + * @param {DOMElement} container DOM element to unmount from. + * @final + * @internal + * @see {ReactMount.unmountComponentAtNode} + */ +function unmountComponentFromNode(instance, container, safely) { + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onBeginFlush(); + } + ReactReconciler.unmountComponent(instance, safely); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onEndFlush(); + } + + if (container.nodeType === DOC_NODE_TYPE) { + container = container.documentElement; + } + + // http://jsperf.com/emptying-a-node + while (container.lastChild) { + container.removeChild(container.lastChild); + } +} + +/** + * True if the supplied DOM node has a direct React-rendered child that is + * not a React root element. Useful for warning in `render`, + * `unmountComponentAtNode`, etc. + * + * @param {?DOMElement} node The candidate DOM node. + * @return {boolean} True if the DOM element contains a direct child that was + * rendered by React but is not a root element. + * @internal + */ +function hasNonRootReactChild(container) { + var rootEl = getReactRootElementInContainer(container); + if (rootEl) { + var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl); + return !!(inst && inst._hostParent); + } +} + +/** + * True if the supplied DOM node is a React DOM element and + * it has been rendered by another copy of React. + * + * @param {?DOMElement} node The candidate DOM node. + * @return {boolean} True if the DOM has been rendered by another copy of React + * @internal + */ +function nodeIsRenderedByOtherInstance(container) { + var rootEl = getReactRootElementInContainer(container); + return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl)); +} + +/** + * True if the supplied DOM node is a valid node element. + * + * @param {?DOMElement} node The candidate DOM node. + * @return {boolean} True if the DOM is a valid DOM node. + * @internal + */ +function isValidContainer(node) { + return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)); +} + +/** + * True if the supplied DOM node is a valid React node element. + * + * @param {?DOMElement} node The candidate DOM node. + * @return {boolean} True if the DOM is a valid React DOM node. + * @internal + */ +function isReactNode(node) { + return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME)); +} + +function getHostRootInstanceInContainer(container) { + var rootEl = getReactRootElementInContainer(container); + var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl); + return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null; +} + +function getTopLevelWrapperInContainer(container) { + var root = getHostRootInstanceInContainer(container); + return root ? root._hostContainerInfo._topLevelWrapper : null; +} + +/** + * Temporary (?) hack so that we can store all top-level pending updates on + * composites instead of having to worry about different types of components + * here. + */ +var topLevelRootCounter = 1; +var TopLevelWrapper = function () { + this.rootID = topLevelRootCounter++; +}; +TopLevelWrapper.prototype.isReactComponent = {}; +if (process.env.NODE_ENV !== 'production') { + TopLevelWrapper.displayName = 'TopLevelWrapper'; +} +TopLevelWrapper.prototype.render = function () { + return this.props.child; +}; +TopLevelWrapper.isReactTopLevelWrapper = true; + +/** + * Mounting is the process of initializing a React component by creating its + * representative DOM elements and inserting them into a supplied `container`. + * Any prior content inside `container` is destroyed in the process. + * + * ReactMount.render( + * component, + * document.getElementById('container') + * ); + * + * <div id="container"> <-- Supplied `container`. + * <div data-reactid=".3"> <-- Rendered reactRoot of React + * // ... component. + * </div> + * </div> + * + * Inside of `container`, the first element rendered is the "reactRoot". + */ +var ReactMount = { + TopLevelWrapper: TopLevelWrapper, + + /** + * Used by devtools. The keys are not important. + */ + _instancesByReactRootID: instancesByReactRootID, + + /** + * This is a hook provided to support rendering React components while + * ensuring that the apparent scroll position of its `container` does not + * change. + * + * @param {DOMElement} container The `container` being rendered into. + * @param {function} renderCallback This must be called once to do the render. + */ + scrollMonitor: function (container, renderCallback) { + renderCallback(); + }, + + /** + * Take a component that's already mounted into the DOM and replace its props + * @param {ReactComponent} prevComponent component instance already in the DOM + * @param {ReactElement} nextElement component instance to render + * @param {DOMElement} container container to render into + * @param {?function} callback function triggered on completion + */ + _updateRootComponent: function (prevComponent, nextElement, nextContext, container, callback) { + ReactMount.scrollMonitor(container, function () { + ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext); + if (callback) { + ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback); + } + }); + + return prevComponent; + }, + + /** + * Render a new component into the DOM. Hooked by hooks! + * + * @param {ReactElement} nextElement element to render + * @param {DOMElement} container container to render into + * @param {boolean} shouldReuseMarkup if we should skip the markup insertion + * @return {ReactComponent} nextComponent + */ + _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) { + // Various parts of our code (such as ReactCompositeComponent's + // _renderValidatedComponent) assume that calls to render aren't nested; + // verify that that's the case. + process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; + + !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0; + + ReactBrowserEventEmitter.ensureScrollValueMonitoring(); + var componentInstance = instantiateReactComponent(nextElement, false); + + // The initial render is synchronous but any updates that happen during + // rendering, in componentWillMount or componentDidMount, will be batched + // according to the current batching strategy. + + ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context); + + var wrapperID = componentInstance._instance.rootID; + instancesByReactRootID[wrapperID] = componentInstance; + + return componentInstance; + }, + + /** + * Renders a React component into the DOM in the supplied `container`. + * + * If the React component was previously rendered into `container`, this will + * perform an update on it and only mutate the DOM as necessary to reflect the + * latest React component. + * + * @param {ReactComponent} parentComponent The conceptual parent of this render tree. + * @param {ReactElement} nextElement Component element to render. + * @param {DOMElement} container DOM element to render into. + * @param {?function} callback function triggered on completion + * @return {ReactComponent} Component instance rendered in `container`. + */ + renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { + !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0; + return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback); + }, + + _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) { + ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render'); + !React.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? " Instead of passing a string like 'div', pass " + "React.createElement('div') or <div />." : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : // Check if it quacks like an element + nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? " Instead of passing a string like 'div', pass " + "React.createElement('div') or <div />." : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0; + + process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0; + + var nextWrappedElement = React.createElement(TopLevelWrapper, { + child: nextElement + }); + + var nextContext; + if (parentComponent) { + var parentInst = ReactInstanceMap.get(parentComponent); + nextContext = parentInst._processChildContext(parentInst._context); + } else { + nextContext = emptyObject; + } + + var prevComponent = getTopLevelWrapperInContainer(container); + + if (prevComponent) { + var prevWrappedElement = prevComponent._currentElement; + var prevElement = prevWrappedElement.props.child; + if (shouldUpdateReactComponent(prevElement, nextElement)) { + var publicInst = prevComponent._renderedComponent.getPublicInstance(); + var updatedCallback = callback && function () { + callback.call(publicInst); + }; + ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback); + return publicInst; + } else { + ReactMount.unmountComponentAtNode(container); + } + } + + var reactRootElement = getReactRootElementInContainer(container); + var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement); + var containerHasNonRootReactChild = hasNonRootReactChild(container); + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0; + + if (!containerHasReactMarkup || reactRootElement.nextSibling) { + var rootElementSibling = reactRootElement; + while (rootElementSibling) { + if (internalGetID(rootElementSibling)) { + process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0; + break; + } + rootElementSibling = rootElementSibling.nextSibling; + } + } + } + + var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild; + var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance(); + if (callback) { + callback.call(component); + } + return component; + }, + + /** + * Renders a React component into the DOM in the supplied `container`. + * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render + * + * If the React component was previously rendered into `container`, this will + * perform an update on it and only mutate the DOM as necessary to reflect the + * latest React component. + * + * @param {ReactElement} nextElement Component element to render. + * @param {DOMElement} container DOM element to render into. + * @param {?function} callback function triggered on completion + * @return {ReactComponent} Component instance rendered in `container`. + */ + render: function (nextElement, container, callback) { + return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback); + }, + + /** + * Unmounts and destroys the React component rendered in the `container`. + * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode + * + * @param {DOMElement} container DOM element containing a React component. + * @return {boolean} True if a component was found in and unmounted from + * `container` + */ + unmountComponentAtNode: function (container) { + // Various parts of our code (such as ReactCompositeComponent's + // _renderValidatedComponent) assume that calls to render aren't nested; + // verify that that's the case. (Strictly speaking, unmounting won't cause a + // render but we still don't expect to be in a render call here.) + process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0; + + !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0; + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(!nodeIsRenderedByOtherInstance(container), "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0; + } + + var prevComponent = getTopLevelWrapperInContainer(container); + if (!prevComponent) { + // Check if the node being unmounted was rendered by React, but isn't a + // root node. + var containerHasNonRootReactChild = hasNonRootReactChild(container); + + // Check if the container itself is a React root node. + var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME); + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0; + } + + return false; + } + delete instancesByReactRootID[prevComponent._instance.rootID]; + ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false); + return true; + }, + + _mountImageIntoNode: function (markup, container, instance, shouldReuseMarkup, transaction) { + !isValidContainer(container) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0; + + if (shouldReuseMarkup) { + var rootElement = getReactRootElementInContainer(container); + if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) { + ReactDOMComponentTree.precacheNode(instance, rootElement); + return; + } else { + var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); + rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); + + var rootMarkup = rootElement.outerHTML; + rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum); + + var normalizedMarkup = markup; + if (process.env.NODE_ENV !== 'production') { + // because rootMarkup is retrieved from the DOM, various normalizations + // will have occurred which will not be present in `markup`. Here, + // insert markup into a <div> or <iframe> depending on the container + // type to perform the same normalizations before comparing. + var normalizer; + if (container.nodeType === ELEMENT_NODE_TYPE) { + normalizer = document.createElement('div'); + normalizer.innerHTML = markup; + normalizedMarkup = normalizer.innerHTML; + } else { + normalizer = document.createElement('iframe'); + document.body.appendChild(normalizer); + normalizer.contentDocument.write(markup); + normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML; + document.body.removeChild(normalizer); + } + } + + var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup); + var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20); + + !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0; + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0; + } + } + } + + !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0; + + if (transaction.useCreateElement) { + while (container.lastChild) { + container.removeChild(container.lastChild); + } + DOMLazyTree.insertTreeBefore(container, markup, null); + } else { + setInnerHTML(container, markup); + ReactDOMComponentTree.precacheNode(instance, container.firstChild); + } + + if (process.env.NODE_ENV !== 'production') { + var hostNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild); + if (hostNode._debugID !== 0) { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: hostNode._debugID, + type: 'mount', + payload: markup.toString() + }); + } + } + } +}; + +module.exports = ReactMount; + +/***/ }), +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactNodeTypes = __webpack_require__(75); + +function getHostComponentFromComposite(inst) { + var type; + + while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) { + inst = inst._renderedComponent; + } + + if (type === ReactNodeTypes.HOST) { + return inst._renderedComponent; + } else if (type === ReactNodeTypes.EMPTY) { + return null; + } +} + +module.exports = getHostComponentFromComposite; + +/***/ }), +/* 84 */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (process.env.NODE_ENV !== 'production') { + var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && + Symbol.for && + Symbol.for('react.element')) || + 0xeac7; + + var isValidElement = function(object) { + return typeof object === 'object' && + object !== null && + object.$$typeof === REACT_ELEMENT_TYPE; + }; + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = __webpack_require__(58)(isValidElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = __webpack_require__(195)(); +} + + +/***/ }), +/* 85 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +__webpack_require__(86); + +var _react = __webpack_require__(19); + +var _react2 = _interopRequireDefault(_react); + +var _reactDom = __webpack_require__(34); + +var _reactDom2 = _interopRequireDefault(_reactDom); + +var _Splash = __webpack_require__(193); + +var _Splash2 = _interopRequireDefault(_Splash); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_reactDom2.default.render(_react2.default.createElement(_Splash2.default, null), document.getElementById('splash-mount')); + +/***/ }), +/* 86 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a <style> tag + +// load the styles +var content = __webpack_require__(87); +if(typeof content === 'string') content = [[module.i, content, '']]; +// Prepare cssTransformation +var transform; + +var options = {"hmr":true} +options.transform = transform +// add the styles to the DOM +var update = __webpack_require__(92)(content, options); +if(content.locals) module.exports = content.locals; +// Hot Module Replacement +if(false) { + // When the styles change, update the <style> tags + if(!content.locals) { + module.hot.accept("!!../../../../node_modules/css-loader/index.js!../../../../node_modules/stylus-loader/index.js!./index.styl", function() { + var newContent = require("!!../../../../node_modules/css-loader/index.js!../../../../node_modules/stylus-loader/index.js!./index.styl"); + if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; + update(newContent); + }); + } + // When the module is disposed, remove the <style> tags + module.hot.dispose(function() { update(); }); +} + +/***/ }), +/* 87 */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(51)(undefined); +// imports +exports.i(__webpack_require__(88), ""); + +// module +exports.push([module.i, "@font-face {\n font-family: Whitney;\n font-style: normal;\n font-weight: 400;\n src: url(" + __webpack_require__(89) + ") format('woff');\n}\n@font-face {\n font-family: Whitney;\n font-style: medium;\n font-weight: 600;\n src: url(" + __webpack_require__(90) + ") format('woff');\n}\n* {\n box-sizing: border-box;\n -webkit-user-select: none;\n cursor: default;\n}\nbody,\nhtml {\n -webkit-app-region: drag;\n padding: 0;\n margin: 0;\n overflow: hidden;\n width: 300px;\n height: 300px;\n}\n#splash {\n -webkit-app-region: drag;\n background: #282b30;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 3000;\n transform: translateZ(0);\n padding-bottom: 40px;\n}\n#splash .splash-inner {\n text-align: center;\n}\n#splash .splash-inner img,\n#splash .splash-inner video {\n size: 200px;\n}\n#splash .splash-inner video {\n visibility: hidden;\n}\n#splash .splash-inner video.loaded {\n visibility: visible;\n}\n#splash .splash-inner > span {\n color: #8a8e94;\n font-size: 12px;\n font-family: Whitney, \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n font-weight: 600;\n text-transform: uppercase;\n display: block;\n}\n#splash .splash-inner > span.quote {\n margin-bottom: 10px;\n color: #fff;\n font-weight: 400;\n font-style: italic;\n font-size: 16px;\n}\n#splash .splash-inner-dl .dice-image {\n position: absolute;\n left: 77px;\n top: 45px;\n width: 146px;\n height: 100px;\n background: url(" + __webpack_require__(91) + ") center center no-repeat;\n background-size: 146px 100px;\n}\n#splash .splash-inner-dl .dl-update-message {\n font-family: Whitney, \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n font-style: medium;\n font-size: 18px;\n color: #fff;\n padding-left: 20px;\n padding-right: 20px;\n top: 169px;\n left: 0;\n margin: 0;\n position: absolute;\n text-align: center;\n}\n#splash .splash-inner-dl .dl-version-message {\n font-family: Whitney, \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n font-style: medium;\n font-size: 12px;\n color: #8a8e94;\n text-transform: uppercase;\n position: absolute;\n width: 100%;\n bottom: 12px;\n left: 0;\n margin: 0;\n text-align: center;\n}\n#splash .splash-inner-dl .dl-select-frame {\n -webkit-app-region: no-drag;\n font-family: Whitney, \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif;\n overflow: hidden;\n position: absolute;\n width: 100%;\n height: 130px;\n top: 220px;\n left: 0;\n margin: 0;\n}\n#splash .splash-inner-dl .dl-select-frame .Select {\n position: absolute;\n left: 0;\n top: 0;\n width: 165px;\n height: 44px;\n margin-left: 20px;\n margin-right: 10px;\n color: #fff;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-control {\n border: 1px solid;\n border-color: rgba(255,255,255,0.3);\n border-radius: 3px;\n background: #282b30;\n height: 44px;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-menu-outer {\n background: #282b30;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-menu {\n max-height: 80px;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-option {\n color: #8a8e94;\n line-height: 15px;\n padding: 5px 10px;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-option.is-focused {\n color: #fff;\n background-color: #697ec4;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-value {\n color: #fff;\n bottom: 0;\n align-items: center;\n display: flex;\n}\n#splash .splash-inner-dl .dl-select-frame .Select-input {\n outline: none;\n}\n#splash .splash-inner-dl .dl-select-frame .dl-button {\n position: absolute;\n left: 195px;\n top: 0;\n width: 85px;\n height: 44px;\n background-color: #7289da;\n color: #fff;\n font-size: 14px;\n font-weight: 600;\n border-radius: 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n#splash .splash-inner-dl .dl-select-frame .dl-button:hover {\n background-color: #697ec4;\n}\n.progress {\n display: flex;\n justify-content: center;\n margin-top: 10px;\n}\n.progress .progress-bar {\n height: 8px;\n border-radius: 4px;\n width: 180px;\n background-color: rgba(255,255,255,0.1);\n}\n.progress .progress-bar .complete {\n border-radius: 4px;\n box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1), inset 0px 1px 0px 0px rgba(255,255,255,0.1);\n height: 100%;\n background-color: #737f8d;\n}\n.progress-placeholder {\n margin-top: 10px;\n height: 8px;\n}\n", ""]); + +// exports + + +/***/ }), +/* 88 */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(51)(undefined); +// imports + + +// module +exports.push([module.i, "/**\n * React Select\n * ============\n * Created by Jed Watson and Joss Mackison for KeystoneJS, http://www.keystonejs.com/\n * https://twitter.com/jedwatson https://twitter.com/jossmackison https://twitter.com/keystonejs\n * MIT License: https://github.com/keystonejs/react-select\n*/\n.Select {\n position: relative;\n}\n.Select,\n.Select div,\n.Select input,\n.Select span {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n.Select.is-disabled > .Select-control {\n background-color: #f6f6f6;\n}\n.Select.is-disabled .Select-arrow-zone {\n cursor: default;\n pointer-events: none;\n}\n.Select-control {\n background-color: #fff;\n border-color: #d9d9d9 #ccc #b3b3b3;\n border-radius: 4px;\n border: 1px solid #ccc;\n color: #333;\n cursor: default;\n display: table;\n height: 36px;\n outline: none;\n overflow: hidden;\n position: relative;\n width: 100%;\n}\n.Select-control:hover {\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);\n}\n.is-searchable.is-open > .Select-control {\n cursor: text;\n}\n.is-open > .Select-control {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n background: #fff;\n border-color: #b3b3b3 #ccc #d9d9d9;\n}\n.is-open > .Select-control > .Select-arrow {\n border-color: transparent transparent #999;\n border-width: 0 5px 5px;\n}\n.is-searchable.is-focused:not(.is-open) > .Select-control {\n cursor: text;\n}\n.is-focused:not(.is-open) > .Select-control {\n border-color: #08c #0099e6 #0099e6;\n box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 5px -1px rgba(0, 136, 204, 0.5);\n}\n.Select-placeholder {\n bottom: 0;\n color: #aaa;\n left: 0;\n line-height: 34px;\n padding-left: 10px;\n padding-right: 10px;\n position: absolute;\n right: 0;\n top: 0;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.has-value > .Select-control > .Select-placeholder {\n color: #333;\n}\n.Select-value {\n color: #aaa;\n left: 0;\n padding: 8px 52px 8px 10px;\n position: absolute;\n right: -15px;\n top: 0;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.has-value > .Select-control > .Select-value {\n color: #333;\n}\n.Select-input {\n height: 34px;\n padding-left: 10px;\n padding-right: 10px;\n vertical-align: middle;\n}\n.Select-input > input {\n background: none transparent;\n border: 0 none;\n box-shadow: none;\n cursor: default;\n display: inline-block;\n font-family: inherit;\n font-size: inherit;\n height: 34px;\n margin: 0;\n outline: none;\n padding: 0;\n -webkit-appearance: none;\n}\n.is-focused .Select-input > input {\n cursor: text;\n}\n.Select-control:not(.is-searchable) > .Select-input {\n outline: none;\n}\n.Select-loading-zone {\n cursor: pointer;\n display: table-cell;\n position: relative;\n text-align: center;\n vertical-align: middle;\n width: 16px;\n}\n.Select-loading {\n -webkit-animation: Select-animation-spin 400ms infinite linear;\n -o-animation: Select-animation-spin 400ms infinite linear;\n animation: Select-animation-spin 400ms infinite linear;\n width: 16px;\n height: 16px;\n box-sizing: border-box;\n border-radius: 50%;\n border: 2px solid #ccc;\n border-right-color: #333;\n display: inline-block;\n position: relative;\n vertical-align: middle;\n}\n.Select-clear-zone {\n -webkit-animation: Select-animation-fadeIn 200ms;\n -o-animation: Select-animation-fadeIn 200ms;\n animation: Select-animation-fadeIn 200ms;\n color: #999;\n cursor: pointer;\n display: table-cell;\n position: relative;\n text-align: center;\n vertical-align: middle;\n width: 17px;\n}\n.Select-clear-zone:hover {\n color: #d0021b;\n}\n.Select-clear {\n display: inline-block;\n font-size: 18px;\n line-height: 1;\n}\n.Select--multi .Select-clear-zone {\n width: 17px;\n}\n.Select-arrow-zone {\n cursor: pointer;\n display: table-cell;\n position: relative;\n text-align: center;\n vertical-align: middle;\n width: 25px;\n padding-right: 5px;\n}\n.Select-arrow {\n border-color: #999 transparent transparent;\n border-style: solid;\n border-width: 5px 5px 2.5px;\n display: inline-block;\n height: 0;\n width: 0;\n}\n.is-open .Select-arrow,\n.Select-arrow-zone:hover > .Select-arrow {\n border-top-color: #666;\n}\n@-webkit-keyframes Select-animation-fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n@keyframes Select-animation-fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n.Select-menu-outer {\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px;\n background-color: #fff;\n border: 1px solid #ccc;\n border-top-color: #e6e6e6;\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);\n box-sizing: border-box;\n margin-top: -1px;\n max-height: 200px;\n position: absolute;\n top: 100%;\n width: 100%;\n z-index: 1000;\n -webkit-overflow-scrolling: touch;\n}\n.Select-menu {\n max-height: 198px;\n overflow-y: auto;\n}\n.Select-option {\n box-sizing: border-box;\n color: #666666;\n cursor: pointer;\n display: block;\n padding: 8px 10px;\n}\n.Select-option:last-child {\n border-bottom-right-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.Select-option.is-focused {\n background-color: #f2f9fc;\n color: #333;\n}\n.Select-option.is-disabled {\n color: #cccccc;\n cursor: not-allowed;\n}\n.Select-noresults,\n.Select-search-prompt,\n.Select-searching {\n box-sizing: border-box;\n color: #999999;\n cursor: default;\n display: block;\n padding: 8px 10px;\n}\n.Select--multi .Select-input {\n vertical-align: middle;\n margin-left: 10px;\n padding: 0;\n}\n.Select--multi.has-value .Select-input {\n margin-left: 5px;\n}\n.Select-item {\n background-color: #f2f9fc;\n border-radius: 2px;\n border: 1px solid #c9e6f2;\n color: #08c;\n display: inline-block;\n font-size: 0.9em;\n margin-left: 5px;\n margin-top: 5px;\n vertical-align: top;\n}\n.Select-item-icon,\n.Select-item-label {\n display: inline-block;\n vertical-align: middle;\n}\n.Select-item-label {\n border-bottom-right-radius: 2px;\n border-top-right-radius: 2px;\n cursor: default;\n padding: 2px 5px;\n}\n.Select-item-label .Select-item-label__a {\n color: #08c;\n cursor: pointer;\n}\n.Select-item-icon {\n cursor: pointer;\n border-bottom-left-radius: 2px;\n border-top-left-radius: 2px;\n border-right: 1px solid #c9e6f2;\n padding: 1px 5px 3px;\n}\n.Select-item-icon:hover,\n.Select-item-icon:focus {\n background-color: #ddeff7;\n color: #0077b3;\n}\n.Select-item-icon:active {\n background-color: #c9e6f2;\n}\n.Select--multi.is-disabled .Select-item {\n background-color: #f2f2f2;\n border: 1px solid #d9d9d9;\n color: #888;\n}\n.Select--multi.is-disabled .Select-item-icon {\n cursor: not-allowed;\n border-right: 1px solid #d9d9d9;\n}\n.Select--multi.is-disabled .Select-item-icon:hover,\n.Select--multi.is-disabled .Select-item-icon:focus,\n.Select--multi.is-disabled .Select-item-icon:active {\n background-color: #f2f2f2;\n}\n@keyframes Select-animation-spin {\n to {\n transform: rotate(1turn);\n }\n}\n@-webkit-keyframes Select-animation-spin {\n to {\n -webkit-transform: rotate(1turn);\n }\n}\n", ""]); + +// exports + + +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "d153359b5d87601d2b9c708b7ae2db02.woff"; + +/***/ }), +/* 90 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "a934ab008c7f6a2274ec441f6be0696a.woff"; + +/***/ }), +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__.p + "abddffb32a4a35627c3857a06c751424.png"; + +/***/ }), +/* 92 */ +/***/ (function(module, exports, __webpack_require__) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +var stylesInDom = {}; + +var memoize = function (fn) { + var memo; + + return function () { + if (typeof memo === "undefined") memo = fn.apply(this, arguments); + return memo; + }; +}; + +var isOldIE = memoize(function () { + // Test for IE <= 9 as proposed by Browserhacks + // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 + // Tests for existence of standard globals is to allow style-loader + // to operate correctly into non-standard environments + // @see https://github.com/webpack-contrib/style-loader/issues/177 + return window && document && document.all && !window.atob; +}); + +var getElement = (function (fn) { + var memo = {}; + + return function(selector) { + if (typeof memo[selector] === "undefined") { + var styleTarget = fn.call(this, selector); + // Special case to return head of iframe instead of iframe itself + if (styleTarget instanceof window.HTMLIFrameElement) { + try { + // This will throw an exception if access to iframe is blocked + // due to cross-origin restrictions + styleTarget = styleTarget.contentDocument.head; + } catch(e) { + styleTarget = null; + } + } + memo[selector] = styleTarget; + } + return memo[selector] + }; +})(function (target) { + return document.querySelector(target) +}); + +var singleton = null; +var singletonCounter = 0; +var stylesInsertedAtTop = []; + +var fixUrls = __webpack_require__(93); + +module.exports = function(list, options) { + if (typeof DEBUG !== "undefined" && DEBUG) { + if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); + } + + options = options || {}; + + options.attrs = typeof options.attrs === "object" ? options.attrs : {}; + + // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> + // tags it will allow on a page + if (!options.singleton) options.singleton = isOldIE(); + + // By default, add <style> tags to the <head> element + if (!options.insertInto) options.insertInto = "head"; + + // By default, add <style> tags to the bottom of the target + if (!options.insertAt) options.insertAt = "bottom"; + + var styles = listToStyles(list, options); + + addStylesToDom(styles, options); + + return function update (newList) { + var mayRemove = []; + + for (var i = 0; i < styles.length; i++) { + var item = styles[i]; + var domStyle = stylesInDom[item.id]; + + domStyle.refs--; + mayRemove.push(domStyle); + } + + if(newList) { + var newStyles = listToStyles(newList, options); + addStylesToDom(newStyles, options); + } + + for (var i = 0; i < mayRemove.length; i++) { + var domStyle = mayRemove[i]; + + if(domStyle.refs === 0) { + for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); + + delete stylesInDom[domStyle.id]; + } + } + }; +}; + +function addStylesToDom (styles, options) { + for (var i = 0; i < styles.length; i++) { + var item = styles[i]; + var domStyle = stylesInDom[item.id]; + + if(domStyle) { + domStyle.refs++; + + for(var j = 0; j < domStyle.parts.length; j++) { + domStyle.parts[j](item.parts[j]); + } + + for(; j < item.parts.length; j++) { + domStyle.parts.push(addStyle(item.parts[j], options)); + } + } else { + var parts = []; + + for(var j = 0; j < item.parts.length; j++) { + parts.push(addStyle(item.parts[j], options)); + } + + stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; + } + } +} + +function listToStyles (list, options) { + var styles = []; + var newStyles = {}; + + for (var i = 0; i < list.length; i++) { + var item = list[i]; + var id = options.base ? item[0] + options.base : item[0]; + var css = item[1]; + var media = item[2]; + var sourceMap = item[3]; + var part = {css: css, media: media, sourceMap: sourceMap}; + + if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); + else newStyles[id].parts.push(part); + } + + return styles; +} + +function insertStyleElement (options, style) { + var target = getElement(options.insertInto) + + if (!target) { + throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); + } + + var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1]; + + if (options.insertAt === "top") { + if (!lastStyleElementInsertedAtTop) { + target.insertBefore(style, target.firstChild); + } else if (lastStyleElementInsertedAtTop.nextSibling) { + target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling); + } else { + target.appendChild(style); + } + stylesInsertedAtTop.push(style); + } else if (options.insertAt === "bottom") { + target.appendChild(style); + } else if (typeof options.insertAt === "object" && options.insertAt.before) { + var nextSibling = getElement(options.insertInto + " " + options.insertAt.before); + target.insertBefore(style, nextSibling); + } else { + throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); + } +} + +function removeStyleElement (style) { + if (style.parentNode === null) return false; + style.parentNode.removeChild(style); + + var idx = stylesInsertedAtTop.indexOf(style); + if(idx >= 0) { + stylesInsertedAtTop.splice(idx, 1); + } +} + +function createStyleElement (options) { + var style = document.createElement("style"); + + options.attrs.type = "text/css"; + + addAttrs(style, options.attrs); + insertStyleElement(options, style); + + return style; +} + +function createLinkElement (options) { + var link = document.createElement("link"); + + options.attrs.type = "text/css"; + options.attrs.rel = "stylesheet"; + + addAttrs(link, options.attrs); + insertStyleElement(options, link); + + return link; +} + +function addAttrs (el, attrs) { + Object.keys(attrs).forEach(function (key) { + el.setAttribute(key, attrs[key]); + }); +} + +function addStyle (obj, options) { + var style, update, remove, result; + + // If a transform function was defined, run it on the css + if (options.transform && obj.css) { + result = options.transform(obj.css); + + if (result) { + // If transform returns a value, use that instead of the original css. + // This allows running runtime transformations on the css. + obj.css = result; + } else { + // If the transform function returns a falsy value, don't add this css. + // This allows conditional loading of css + return function() { + // noop + }; + } + } + + if (options.singleton) { + var styleIndex = singletonCounter++; + + style = singleton || (singleton = createStyleElement(options)); + + update = applyToSingletonTag.bind(null, style, styleIndex, false); + remove = applyToSingletonTag.bind(null, style, styleIndex, true); + + } else if ( + obj.sourceMap && + typeof URL === "function" && + typeof URL.createObjectURL === "function" && + typeof URL.revokeObjectURL === "function" && + typeof Blob === "function" && + typeof btoa === "function" + ) { + style = createLinkElement(options); + update = updateLink.bind(null, style, options); + remove = function () { + removeStyleElement(style); + + if(style.href) URL.revokeObjectURL(style.href); + }; + } else { + style = createStyleElement(options); + update = applyToTag.bind(null, style); + remove = function () { + removeStyleElement(style); + }; + } + + update(obj); + + return function updateStyle (newObj) { + if (newObj) { + if ( + newObj.css === obj.css && + newObj.media === obj.media && + newObj.sourceMap === obj.sourceMap + ) { + return; + } + + update(obj = newObj); + } else { + remove(); + } + }; +} + +var replaceText = (function () { + var textStore = []; + + return function (index, replacement) { + textStore[index] = replacement; + + return textStore.filter(Boolean).join('\n'); + }; +})(); + +function applyToSingletonTag (style, index, remove, obj) { + var css = remove ? "" : obj.css; + + if (style.styleSheet) { + style.styleSheet.cssText = replaceText(index, css); + } else { + var cssNode = document.createTextNode(css); + var childNodes = style.childNodes; + + if (childNodes[index]) style.removeChild(childNodes[index]); + + if (childNodes.length) { + style.insertBefore(cssNode, childNodes[index]); + } else { + style.appendChild(cssNode); + } + } +} + +function applyToTag (style, obj) { + var css = obj.css; + var media = obj.media; + + if(media) { + style.setAttribute("media", media) + } + + if(style.styleSheet) { + style.styleSheet.cssText = css; + } else { + while(style.firstChild) { + style.removeChild(style.firstChild); + } + + style.appendChild(document.createTextNode(css)); + } +} + +function updateLink (link, options, obj) { + var css = obj.css; + var sourceMap = obj.sourceMap; + + /* + If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled + and there is no publicPath defined then lets turn convertToAbsoluteUrls + on by default. Otherwise default to the convertToAbsoluteUrls option + directly + */ + var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap; + + if (options.convertToAbsoluteUrls || autoFixUrls) { + css = fixUrls(css); + } + + if (sourceMap) { + // http://stackoverflow.com/a/26603875 + css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; + } + + var blob = new Blob([css], { type: "text/css" }); + + var oldSrc = link.href; + + link.href = URL.createObjectURL(blob); + + if(oldSrc) URL.revokeObjectURL(oldSrc); +} + + +/***/ }), +/* 93 */ +/***/ (function(module, exports) { + + +/** + * When source maps are enabled, `style-loader` uses a link element with a data-uri to + * embed the css on the page. This breaks all relative urls because now they are relative to a + * bundle instead of the current page. + * + * One solution is to only use full urls, but that may be impossible. + * + * Instead, this function "fixes" the relative urls to be absolute according to the current page location. + * + * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. + * + */ + +module.exports = function (css) { + // get current location + var location = typeof window !== "undefined" && window.location; + + if (!location) { + throw new Error("fixUrls requires window.location"); + } + + // blank or null? + if (!css || typeof css !== "string") { + return css; + } + + var baseUrl = location.protocol + "//" + location.host; + var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); + + // convert each url(...) + /* + This regular expression is just a way to recursively match brackets within + a string. + + /url\s*\( = Match on the word "url" with any whitespace after it and then a parens + ( = Start a capturing group + (?: = Start a non-capturing group + [^)(] = Match anything that isn't a parentheses + | = OR + \( = Match a start parentheses + (?: = Start another non-capturing groups + [^)(]+ = Match anything that isn't a parentheses + | = OR + \( = Match a start parentheses + [^)(]* = Match anything that isn't a parentheses + \) = Match a end parentheses + ) = End Group + *\) = Match anything and then a close parens + ) = Close non-capturing group + * = Match anything + ) = Close capturing group + \) = Match a close parens + + /gi = Get all matches, not the first. Be case insensitive. + */ + var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { + // strip quotes (if they exist) + var unquotedOrigUrl = origUrl + .trim() + .replace(/^"(.*)"$/, function(o, $1){ return $1; }) + .replace(/^'(.*)'$/, function(o, $1){ return $1; }); + + // already a full url? no change + if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) { + return fullMatch; + } + + // convert the url to a full url + var newUrl; + + if (unquotedOrigUrl.indexOf("//") === 0) { + //TODO: should we add protocol? + newUrl = unquotedOrigUrl; + } else if (unquotedOrigUrl.indexOf("/") === 0) { + // path should be relative to the base url + newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' + } else { + // path should be relative to current directory + newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' + } + + // send back the fixed url(...) + return "url(" + JSON.stringify(newUrl) + ")"; + }); + + // send back the fixed css + return fixedCss; +}; + + +/***/ }), +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var PooledClass = __webpack_require__(95); +var ReactElement = __webpack_require__(13); + +var emptyFunction = __webpack_require__(7); +var traverseAllChildren = __webpack_require__(96); + +var twoArgumentPooler = PooledClass.twoArgumentPooler; +var fourArgumentPooler = PooledClass.fourArgumentPooler; + +var userProvidedKeyEscapeRegex = /\/+/g; +function escapeUserProvidedKey(text) { + return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); +} + +/** + * PooledClass representing the bookkeeping associated with performing a child + * traversal. Allows avoiding binding callbacks. + * + * @constructor ForEachBookKeeping + * @param {!function} forEachFunction Function to perform traversal with. + * @param {?*} forEachContext Context to perform context with. + */ +function ForEachBookKeeping(forEachFunction, forEachContext) { + this.func = forEachFunction; + this.context = forEachContext; + this.count = 0; +} +ForEachBookKeeping.prototype.destructor = function () { + this.func = null; + this.context = null; + this.count = 0; +}; +PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); + +function forEachSingleChild(bookKeeping, child, name) { + var func = bookKeeping.func, + context = bookKeeping.context; + + func.call(context, child, bookKeeping.count++); +} + +/** + * Iterates through children that are typically specified as `props.children`. + * + * See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach + * + * The provided forEachFunc(child, index) will be called for each + * leaf child. + * + * @param {?*} children Children tree container. + * @param {function(*, int)} forEachFunc + * @param {*} forEachContext Context for forEachContext. + */ +function forEachChildren(children, forEachFunc, forEachContext) { + if (children == null) { + return children; + } + var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); + traverseAllChildren(children, forEachSingleChild, traverseContext); + ForEachBookKeeping.release(traverseContext); +} + +/** + * PooledClass representing the bookkeeping associated with performing a child + * mapping. Allows avoiding binding callbacks. + * + * @constructor MapBookKeeping + * @param {!*} mapResult Object containing the ordered map of results. + * @param {!function} mapFunction Function to perform mapping with. + * @param {?*} mapContext Context to perform mapping with. + */ +function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) { + this.result = mapResult; + this.keyPrefix = keyPrefix; + this.func = mapFunction; + this.context = mapContext; + this.count = 0; +} +MapBookKeeping.prototype.destructor = function () { + this.result = null; + this.keyPrefix = null; + this.func = null; + this.context = null; + this.count = 0; +}; +PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler); + +function mapSingleChildIntoContext(bookKeeping, child, childKey) { + var result = bookKeeping.result, + keyPrefix = bookKeeping.keyPrefix, + func = bookKeeping.func, + context = bookKeeping.context; + + + var mappedChild = func.call(context, child, bookKeeping.count++); + if (Array.isArray(mappedChild)) { + mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); + } else if (mappedChild != null) { + if (ReactElement.isValidElement(mappedChild)) { + mappedChild = ReactElement.cloneAndReplaceKey(mappedChild, + // Keep both the (mapped) and old keys if they differ, just as + // traverseAllChildren used to do for objects as children + keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); + } + result.push(mappedChild); + } +} + +function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { + var escapedPrefix = ''; + if (prefix != null) { + escapedPrefix = escapeUserProvidedKey(prefix) + '/'; + } + var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context); + traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); + MapBookKeeping.release(traverseContext); +} + +/** + * Maps children that are typically specified as `props.children`. + * + * See https://facebook.github.io/react/docs/top-level-api.html#react.children.map + * + * The provided mapFunction(child, key, index) will be called for each + * leaf child. + * + * @param {?*} children Children tree container. + * @param {function(*, int)} func The map function. + * @param {*} context Context for mapFunction. + * @return {object} Object containing the ordered map of results. + */ +function mapChildren(children, func, context) { + if (children == null) { + return children; + } + var result = []; + mapIntoWithKeyPrefixInternal(children, result, null, func, context); + return result; +} + +function forEachSingleChildDummy(traverseContext, child, name) { + return null; +} + +/** + * Count the number of children that are typically specified as + * `props.children`. + * + * See https://facebook.github.io/react/docs/top-level-api.html#react.children.count + * + * @param {?*} children Children tree container. + * @return {number} The number of children. + */ +function countChildren(children, context) { + return traverseAllChildren(children, forEachSingleChildDummy, null); +} + +/** + * Flatten a children object (typically specified as `props.children`) and + * return an array with appropriately re-keyed children. + * + * See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray + */ +function toArray(children) { + var result = []; + mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); + return result; +} + +var ReactChildren = { + forEach: forEachChildren, + map: mapChildren, + mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal, + count: countChildren, + toArray: toArray +}; + +module.exports = ReactChildren; + +/***/ }), +/* 95 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(16); + +var invariant = __webpack_require__(0); + +/** + * Static poolers. Several custom versions for each potential number of + * arguments. A completely generic pooler is easy to implement, but would + * require accessing the `arguments` object. In each of these, `this` refers to + * the Class itself, not an instance. If any others are needed, simply add them + * here, or in their own files. + */ +var oneArgumentPooler = function (copyFieldsFrom) { + var Klass = this; + if (Klass.instancePool.length) { + var instance = Klass.instancePool.pop(); + Klass.call(instance, copyFieldsFrom); + return instance; + } else { + return new Klass(copyFieldsFrom); + } +}; + +var twoArgumentPooler = function (a1, a2) { + var Klass = this; + if (Klass.instancePool.length) { + var instance = Klass.instancePool.pop(); + Klass.call(instance, a1, a2); + return instance; + } else { + return new Klass(a1, a2); + } +}; + +var threeArgumentPooler = function (a1, a2, a3) { + var Klass = this; + if (Klass.instancePool.length) { + var instance = Klass.instancePool.pop(); + Klass.call(instance, a1, a2, a3); + return instance; + } else { + return new Klass(a1, a2, a3); + } +}; + +var fourArgumentPooler = function (a1, a2, a3, a4) { + var Klass = this; + if (Klass.instancePool.length) { + var instance = Klass.instancePool.pop(); + Klass.call(instance, a1, a2, a3, a4); + return instance; + } else { + return new Klass(a1, a2, a3, a4); + } +}; + +var standardReleaser = function (instance) { + var Klass = this; + !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0; + instance.destructor(); + if (Klass.instancePool.length < Klass.poolSize) { + Klass.instancePool.push(instance); + } +}; + +var DEFAULT_POOL_SIZE = 10; +var DEFAULT_POOLER = oneArgumentPooler; + +/** + * Augments `CopyConstructor` to be a poolable class, augmenting only the class + * itself (statically) not adding any prototypical fields. Any CopyConstructor + * you give this may have a `poolSize` property, and will look for a + * prototypical `destructor` on instances. + * + * @param {Function} CopyConstructor Constructor that can be used to reset. + * @param {Function} pooler Customizable pooler. + */ +var addPoolingTo = function (CopyConstructor, pooler) { + // Casting as any so that flow ignores the actual implementation and trusts + // it to match the type we declared + var NewKlass = CopyConstructor; + NewKlass.instancePool = []; + NewKlass.getPooled = pooler || DEFAULT_POOLER; + if (!NewKlass.poolSize) { + NewKlass.poolSize = DEFAULT_POOL_SIZE; + } + NewKlass.release = standardReleaser; + return NewKlass; +}; + +var PooledClass = { + addPoolingTo: addPoolingTo, + oneArgumentPooler: oneArgumentPooler, + twoArgumentPooler: twoArgumentPooler, + threeArgumentPooler: threeArgumentPooler, + fourArgumentPooler: fourArgumentPooler +}; + +module.exports = PooledClass; + +/***/ }), +/* 96 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(16); + +var ReactCurrentOwner = __webpack_require__(9); +var REACT_ELEMENT_TYPE = __webpack_require__(54); + +var getIteratorFn = __webpack_require__(55); +var invariant = __webpack_require__(0); +var KeyEscapeUtils = __webpack_require__(97); +var warning = __webpack_require__(1); + +var SEPARATOR = '.'; +var SUBSEPARATOR = ':'; + +/** + * This is inlined from ReactElement since this file is shared between + * isomorphic and renderers. We could extract this to a + * + */ + +/** + * TODO: Test that a single child and an array with one item have the same key + * pattern. + */ + +var didWarnAboutMaps = false; + +/** + * Generate a key string that identifies a component within a set. + * + * @param {*} component A component that could contain a manual key. + * @param {number} index Index that is used if a manual key is not provided. + * @return {string} + */ +function getComponentKey(component, index) { + // Do some typechecking here since we call this blindly. We want to ensure + // that we don't block potential future ES APIs. + if (component && typeof component === 'object' && component.key != null) { + // Explicit key + return KeyEscapeUtils.escape(component.key); + } + // Implicit key determined by the index in the set + return index.toString(36); +} + +/** + * @param {?*} children Children tree container. + * @param {!string} nameSoFar Name of the key path so far. + * @param {!function} callback Callback to invoke with each child found. + * @param {?*} traverseContext Used to pass information throughout the traversal + * process. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { + var type = typeof children; + + if (type === 'undefined' || type === 'boolean') { + // All of the above are perceived as null. + children = null; + } + + if (children === null || type === 'string' || type === 'number' || + // The following is inlined from ReactElement. This means we can optimize + // some checks. React Fiber also inlines this logic for similar purposes. + type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) { + callback(traverseContext, children, + // If it's the only child, treat the name as if it was wrapped in an array + // so that it's consistent if the number of children grows. + nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); + return 1; + } + + var child; + var nextName; + var subtreeCount = 0; // Count of children found in the current subtree. + var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; + + if (Array.isArray(children)) { + for (var i = 0; i < children.length; i++) { + child = children[i]; + nextName = nextNamePrefix + getComponentKey(child, i); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + var iteratorFn = getIteratorFn(children); + if (iteratorFn) { + var iterator = iteratorFn.call(children); + var step; + if (iteratorFn !== children.entries) { + var ii = 0; + while (!(step = iterator.next()).done) { + child = step.value; + nextName = nextNamePrefix + getComponentKey(child, ii++); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } else { + if (process.env.NODE_ENV !== 'production') { + var mapsAsChildrenAddendum = ''; + if (ReactCurrentOwner.current) { + var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName(); + if (mapsAsChildrenOwnerName) { + mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.'; + } + } + process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0; + didWarnAboutMaps = true; + } + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + child = entry[1]; + nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0); + subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); + } + } + } + } else if (type === 'object') { + var addendum = ''; + if (process.env.NODE_ENV !== 'production') { + addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.'; + if (children._isReactElement) { + addendum = " It looks like you're using an element created by a different " + 'version of React. Make sure to use only one copy of React.'; + } + if (ReactCurrentOwner.current) { + var name = ReactCurrentOwner.current.getName(); + if (name) { + addendum += ' Check the render method of `' + name + '`.'; + } + } + } + var childrenString = String(children); + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; + } + } + + return subtreeCount; +} + +/** + * Traverses children that are typically specified as `props.children`, but + * might also be specified through attributes: + * + * - `traverseAllChildren(this.props.children, ...)` + * - `traverseAllChildren(this.props.leftPanelChildren, ...)` + * + * The `traverseContext` is an optional argument that is passed through the + * entire traversal. It can be used to store accumulations or anything else that + * the callback might find relevant. + * + * @param {?*} children Children tree object. + * @param {!function} callback To invoke upon traversing each child. + * @param {?*} traverseContext Context for traversal. + * @return {!number} The number of children in this subtree. + */ +function traverseAllChildren(children, callback, traverseContext) { + if (children == null) { + return 0; + } + + return traverseAllChildrenImpl(children, '', callback, traverseContext); +} + +module.exports = traverseAllChildren; + +/***/ }), +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +/** + * Escape and wrap key so it is safe to use as a reactid + * + * @param {string} key to be escaped. + * @return {string} the escaped key. + */ + +function escape(key) { + var escapeRegex = /[=:]/g; + var escaperLookup = { + '=': '=0', + ':': '=2' + }; + var escapedString = ('' + key).replace(escapeRegex, function (match) { + return escaperLookup[match]; + }); + + return '$' + escapedString; +} + +/** + * Unescape and unwrap key for human-readable display + * + * @param {string} key to unescape. + * @return {string} the unescaped key. + */ +function unescape(key) { + var unescapeRegex = /(=0|=2)/g; + var unescaperLookup = { + '=0': '=', + '=2': ':' + }; + var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); + + return ('' + keySubstring).replace(unescapeRegex, function (match) { + return unescaperLookup[match]; + }); +} + +var KeyEscapeUtils = { + escape: escape, + unescape: unescape +}; + +module.exports = KeyEscapeUtils; + +/***/ }), +/* 98 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactElement = __webpack_require__(13); + +/** + * Create a factory that creates HTML tag elements. + * + * @private + */ +var createDOMFactory = ReactElement.createFactory; +if (process.env.NODE_ENV !== 'production') { + var ReactElementValidator = __webpack_require__(56); + createDOMFactory = ReactElementValidator.createFactory; +} + +/** + * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. + * + * @public + */ +var ReactDOMFactories = { + a: createDOMFactory('a'), + abbr: createDOMFactory('abbr'), + address: createDOMFactory('address'), + area: createDOMFactory('area'), + article: createDOMFactory('article'), + aside: createDOMFactory('aside'), + audio: createDOMFactory('audio'), + b: createDOMFactory('b'), + base: createDOMFactory('base'), + bdi: createDOMFactory('bdi'), + bdo: createDOMFactory('bdo'), + big: createDOMFactory('big'), + blockquote: createDOMFactory('blockquote'), + body: createDOMFactory('body'), + br: createDOMFactory('br'), + button: createDOMFactory('button'), + canvas: createDOMFactory('canvas'), + caption: createDOMFactory('caption'), + cite: createDOMFactory('cite'), + code: createDOMFactory('code'), + col: createDOMFactory('col'), + colgroup: createDOMFactory('colgroup'), + data: createDOMFactory('data'), + datalist: createDOMFactory('datalist'), + dd: createDOMFactory('dd'), + del: createDOMFactory('del'), + details: createDOMFactory('details'), + dfn: createDOMFactory('dfn'), + dialog: createDOMFactory('dialog'), + div: createDOMFactory('div'), + dl: createDOMFactory('dl'), + dt: createDOMFactory('dt'), + em: createDOMFactory('em'), + embed: createDOMFactory('embed'), + fieldset: createDOMFactory('fieldset'), + figcaption: createDOMFactory('figcaption'), + figure: createDOMFactory('figure'), + footer: createDOMFactory('footer'), + form: createDOMFactory('form'), + h1: createDOMFactory('h1'), + h2: createDOMFactory('h2'), + h3: createDOMFactory('h3'), + h4: createDOMFactory('h4'), + h5: createDOMFactory('h5'), + h6: createDOMFactory('h6'), + head: createDOMFactory('head'), + header: createDOMFactory('header'), + hgroup: createDOMFactory('hgroup'), + hr: createDOMFactory('hr'), + html: createDOMFactory('html'), + i: createDOMFactory('i'), + iframe: createDOMFactory('iframe'), + img: createDOMFactory('img'), + input: createDOMFactory('input'), + ins: createDOMFactory('ins'), + kbd: createDOMFactory('kbd'), + keygen: createDOMFactory('keygen'), + label: createDOMFactory('label'), + legend: createDOMFactory('legend'), + li: createDOMFactory('li'), + link: createDOMFactory('link'), + main: createDOMFactory('main'), + map: createDOMFactory('map'), + mark: createDOMFactory('mark'), + menu: createDOMFactory('menu'), + menuitem: createDOMFactory('menuitem'), + meta: createDOMFactory('meta'), + meter: createDOMFactory('meter'), + nav: createDOMFactory('nav'), + noscript: createDOMFactory('noscript'), + object: createDOMFactory('object'), + ol: createDOMFactory('ol'), + optgroup: createDOMFactory('optgroup'), + option: createDOMFactory('option'), + output: createDOMFactory('output'), + p: createDOMFactory('p'), + param: createDOMFactory('param'), + picture: createDOMFactory('picture'), + pre: createDOMFactory('pre'), + progress: createDOMFactory('progress'), + q: createDOMFactory('q'), + rp: createDOMFactory('rp'), + rt: createDOMFactory('rt'), + ruby: createDOMFactory('ruby'), + s: createDOMFactory('s'), + samp: createDOMFactory('samp'), + script: createDOMFactory('script'), + section: createDOMFactory('section'), + select: createDOMFactory('select'), + small: createDOMFactory('small'), + source: createDOMFactory('source'), + span: createDOMFactory('span'), + strong: createDOMFactory('strong'), + style: createDOMFactory('style'), + sub: createDOMFactory('sub'), + summary: createDOMFactory('summary'), + sup: createDOMFactory('sup'), + table: createDOMFactory('table'), + tbody: createDOMFactory('tbody'), + td: createDOMFactory('td'), + textarea: createDOMFactory('textarea'), + tfoot: createDOMFactory('tfoot'), + th: createDOMFactory('th'), + thead: createDOMFactory('thead'), + time: createDOMFactory('time'), + title: createDOMFactory('title'), + tr: createDOMFactory('tr'), + track: createDOMFactory('track'), + u: createDOMFactory('u'), + ul: createDOMFactory('ul'), + 'var': createDOMFactory('var'), + video: createDOMFactory('video'), + wbr: createDOMFactory('wbr'), + + // SVG + circle: createDOMFactory('circle'), + clipPath: createDOMFactory('clipPath'), + defs: createDOMFactory('defs'), + ellipse: createDOMFactory('ellipse'), + g: createDOMFactory('g'), + image: createDOMFactory('image'), + line: createDOMFactory('line'), + linearGradient: createDOMFactory('linearGradient'), + mask: createDOMFactory('mask'), + path: createDOMFactory('path'), + pattern: createDOMFactory('pattern'), + polygon: createDOMFactory('polygon'), + polyline: createDOMFactory('polyline'), + radialGradient: createDOMFactory('radialGradient'), + rect: createDOMFactory('rect'), + stop: createDOMFactory('stop'), + svg: createDOMFactory('svg'), + text: createDOMFactory('text'), + tspan: createDOMFactory('tspan') +}; + +module.exports = ReactDOMFactories; + +/***/ }), +/* 99 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(16); + +var ReactPropTypeLocationNames = __webpack_require__(100); +var ReactPropTypesSecret = __webpack_require__(101); + +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = __webpack_require__(6); +} + +var loggedTypeFailures = {}; + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?object} element The React element that is being type-checked + * @param {?number} debugID The React component instance that is being type-checked + * @private + */ +function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + !(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0; + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0; + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var componentStackInfo = ''; + + if (process.env.NODE_ENV !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = __webpack_require__(6); + } + if (debugID !== null) { + componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); + } else if (element !== null) { + componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); + } + } + + process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; + } + } + } +} + +module.exports = checkReactTypeSpec; + +/***/ }), +/* 100 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var ReactPropTypeLocationNames = {}; + +if (process.env.NODE_ENV !== 'production') { + ReactPropTypeLocationNames = { + prop: 'prop', + context: 'context', + childContext: 'child context' + }; +} + +module.exports = ReactPropTypeLocationNames; + +/***/ }), +/* 101 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +/***/ }), +/* 102 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _require = __webpack_require__(13), + isValidElement = _require.isValidElement; + +var factory = __webpack_require__(57); + +module.exports = factory(isValidElement); + +/***/ }), +/* 103 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +if (process.env.NODE_ENV !== 'production') { + var invariant = __webpack_require__(0); + var warning = __webpack_require__(1); + var ReactPropTypesSecret = __webpack_require__(33); + var loggedTypeFailures = {}; +} + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (process.env.NODE_ENV !== 'production') { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); + } + } + } + } +} + +module.exports = checkPropTypes; + + +/***/ }), +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +module.exports = '15.6.2'; + +/***/ }), +/* 105 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _require = __webpack_require__(52), + Component = _require.Component; + +var _require2 = __webpack_require__(13), + isValidElement = _require2.isValidElement; + +var ReactNoopUpdateQueue = __webpack_require__(53); +var factory = __webpack_require__(106); + +module.exports = factory(Component, isValidElement, ReactNoopUpdateQueue); + +/***/ }), +/* 106 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var emptyObject = __webpack_require__(25); +var _invariant = __webpack_require__(0); + +if (process.env.NODE_ENV !== 'production') { + var warning = __webpack_require__(1); +} + +var MIXINS_KEY = 'mixins'; + +// Helper function to allow the creation of anonymous functions which do not +// have .name set to the name of the variable being assigned to. +function identity(fn) { + return fn; +} + +var ReactPropTypeLocationNames; +if (process.env.NODE_ENV !== 'production') { + ReactPropTypeLocationNames = { + prop: 'prop', + context: 'context', + childContext: 'child context' + }; +} else { + ReactPropTypeLocationNames = {}; +} + +function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { + /** + * Policies that describe methods in `ReactClassInterface`. + */ + + var injectedMixins = []; + + /** + * Composite components are higher-level components that compose other composite + * or host components. + * + * To create a new type of `ReactClass`, pass a specification of + * your new class to `React.createClass`. The only requirement of your class + * specification is that you implement a `render` method. + * + * var MyComponent = React.createClass({ + * render: function() { + * return <div>Hello World</div>; + * } + * }); + * + * The class specification supports a specific protocol of methods that have + * special meaning (e.g. `render`). See `ReactClassInterface` for + * more the comprehensive protocol. Any other properties and methods in the + * class specification will be available on the prototype. + * + * @interface ReactClassInterface + * @internal + */ + var ReactClassInterface = { + /** + * An array of Mixin objects to include when defining your component. + * + * @type {array} + * @optional + */ + mixins: 'DEFINE_MANY', + + /** + * An object containing properties and methods that should be defined on + * the component's constructor instead of its prototype (static methods). + * + * @type {object} + * @optional + */ + statics: 'DEFINE_MANY', + + /** + * Definition of prop types for this component. + * + * @type {object} + * @optional + */ + propTypes: 'DEFINE_MANY', + + /** + * Definition of context types for this component. + * + * @type {object} + * @optional + */ + contextTypes: 'DEFINE_MANY', + + /** + * Definition of context types this component sets for its children. + * + * @type {object} + * @optional + */ + childContextTypes: 'DEFINE_MANY', + + // ==== Definition methods ==== + + /** + * Invoked when the component is mounted. Values in the mapping will be set on + * `this.props` if that prop is not specified (i.e. using an `in` check). + * + * This method is invoked before `getInitialState` and therefore cannot rely + * on `this.state` or use `this.setState`. + * + * @return {object} + * @optional + */ + getDefaultProps: 'DEFINE_MANY_MERGED', + + /** + * Invoked once before the component is mounted. The return value will be used + * as the initial value of `this.state`. + * + * getInitialState: function() { + * return { + * isOn: false, + * fooBaz: new BazFoo() + * } + * } + * + * @return {object} + * @optional + */ + getInitialState: 'DEFINE_MANY_MERGED', + + /** + * @return {object} + * @optional + */ + getChildContext: 'DEFINE_MANY_MERGED', + + /** + * Uses props from `this.props` and state from `this.state` to render the + * structure of the component. + * + * No guarantees are made about when or how often this method is invoked, so + * it must not have side effects. + * + * render: function() { + * var name = this.props.name; + * return <div>Hello, {name}!</div>; + * } + * + * @return {ReactComponent} + * @required + */ + render: 'DEFINE_ONCE', + + // ==== Delegate methods ==== + + /** + * Invoked when the component is initially created and about to be mounted. + * This may have side effects, but any external subscriptions or data created + * by this method must be cleaned up in `componentWillUnmount`. + * + * @optional + */ + componentWillMount: 'DEFINE_MANY', + + /** + * Invoked when the component has been mounted and has a DOM representation. + * However, there is no guarantee that the DOM node is in the document. + * + * Use this as an opportunity to operate on the DOM when the component has + * been mounted (initialized and rendered) for the first time. + * + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidMount: 'DEFINE_MANY', + + /** + * Invoked before the component receives new props. + * + * Use this as an opportunity to react to a prop transition by updating the + * state using `this.setState`. Current props are accessed via `this.props`. + * + * componentWillReceiveProps: function(nextProps, nextContext) { + * this.setState({ + * likesIncreasing: nextProps.likeCount > this.props.likeCount + * }); + * } + * + * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop + * transition may cause a state change, but the opposite is not true. If you + * need it, you are probably looking for `componentWillUpdate`. + * + * @param {object} nextProps + * @optional + */ + componentWillReceiveProps: 'DEFINE_MANY', + + /** + * Invoked while deciding if the component should be updated as a result of + * receiving new props, state and/or context. + * + * Use this as an opportunity to `return false` when you're certain that the + * transition to the new props/state/context will not require a component + * update. + * + * shouldComponentUpdate: function(nextProps, nextState, nextContext) { + * return !equal(nextProps, this.props) || + * !equal(nextState, this.state) || + * !equal(nextContext, this.context); + * } + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @return {boolean} True if the component should update. + * @optional + */ + shouldComponentUpdate: 'DEFINE_ONCE', + + /** + * Invoked when the component is about to update due to a transition from + * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` + * and `nextContext`. + * + * Use this as an opportunity to perform preparation before an update occurs. + * + * NOTE: You **cannot** use `this.setState()` in this method. + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @param {ReactReconcileTransaction} transaction + * @optional + */ + componentWillUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component's DOM representation has been updated. + * + * Use this as an opportunity to operate on the DOM when the component has + * been updated. + * + * @param {object} prevProps + * @param {?object} prevState + * @param {?object} prevContext + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component is about to be removed from its parent and have + * its DOM representation destroyed. + * + * Use this as an opportunity to deallocate any external resources. + * + * NOTE: There is no `componentDidUnmount` since your component will have been + * destroyed by that point. + * + * @optional + */ + componentWillUnmount: 'DEFINE_MANY', + + // ==== Advanced methods ==== + + /** + * Updates the component's currently mounted DOM representation. + * + * By default, this implements React's rendering and reconciliation algorithm. + * Sophisticated clients may wish to override this. + * + * @param {ReactReconcileTransaction} transaction + * @internal + * @overridable + */ + updateComponent: 'OVERRIDE_BASE' + }; + + /** + * Mapping from class specification keys to special processing functions. + * + * Although these are declared like instance properties in the specification + * when defining classes using `React.createClass`, they are actually static + * and are accessible on the constructor instead of the prototype. Despite + * being static, they must be defined outside of the "statics" key under + * which all other static methods are defined. + */ + var RESERVED_SPEC_KEYS = { + displayName: function(Constructor, displayName) { + Constructor.displayName = displayName; + }, + mixins: function(Constructor, mixins) { + if (mixins) { + for (var i = 0; i < mixins.length; i++) { + mixSpecIntoComponent(Constructor, mixins[i]); + } + } + }, + childContextTypes: function(Constructor, childContextTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, childContextTypes, 'childContext'); + } + Constructor.childContextTypes = _assign( + {}, + Constructor.childContextTypes, + childContextTypes + ); + }, + contextTypes: function(Constructor, contextTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, contextTypes, 'context'); + } + Constructor.contextTypes = _assign( + {}, + Constructor.contextTypes, + contextTypes + ); + }, + /** + * Special case getDefaultProps which should move into statics but requires + * automatic merging. + */ + getDefaultProps: function(Constructor, getDefaultProps) { + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps = createMergedResultFunction( + Constructor.getDefaultProps, + getDefaultProps + ); + } else { + Constructor.getDefaultProps = getDefaultProps; + } + }, + propTypes: function(Constructor, propTypes) { + if (process.env.NODE_ENV !== 'production') { + validateTypeDef(Constructor, propTypes, 'prop'); + } + Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); + }, + statics: function(Constructor, statics) { + mixStaticSpecIntoComponent(Constructor, statics); + }, + autobind: function() {} + }; + + function validateTypeDef(Constructor, typeDef, location) { + for (var propName in typeDef) { + if (typeDef.hasOwnProperty(propName)) { + // use a warning instead of an _invariant so components + // don't show up in prod but only in __DEV__ + if (process.env.NODE_ENV !== 'production') { + warning( + typeof typeDef[propName] === 'function', + '%s: %s type `%s` is invalid; it must be a function, usually from ' + + 'React.PropTypes.', + Constructor.displayName || 'ReactClass', + ReactPropTypeLocationNames[location], + propName + ); + } + } + } + } + + function validateMethodOverride(isAlreadyDefined, name) { + var specPolicy = ReactClassInterface.hasOwnProperty(name) + ? ReactClassInterface[name] + : null; + + // Disallow overriding of base class methods unless explicitly allowed. + if (ReactClassMixin.hasOwnProperty(name)) { + _invariant( + specPolicy === 'OVERRIDE_BASE', + 'ReactClassInterface: You are attempting to override ' + + '`%s` from your class specification. Ensure that your method names ' + + 'do not overlap with React methods.', + name + ); + } + + // Disallow defining methods more than once unless explicitly allowed. + if (isAlreadyDefined) { + _invariant( + specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', + 'ReactClassInterface: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be due ' + + 'to a mixin.', + name + ); + } + } + + /** + * Mixin helper which handles policy validation and reserved + * specification keys when building React classes. + */ + function mixSpecIntoComponent(Constructor, spec) { + if (!spec) { + if (process.env.NODE_ENV !== 'production') { + var typeofSpec = typeof spec; + var isMixinValid = typeofSpec === 'object' && spec !== null; + + if (process.env.NODE_ENV !== 'production') { + warning( + isMixinValid, + "%s: You're attempting to include a mixin that is either null " + + 'or not an object. Check the mixins included by the component, ' + + 'as well as any mixins they include themselves. ' + + 'Expected object but got %s.', + Constructor.displayName || 'ReactClass', + spec === null ? null : typeofSpec + ); + } + } + + return; + } + + _invariant( + typeof spec !== 'function', + "ReactClass: You're attempting to " + + 'use a component class or function as a mixin. Instead, just use a ' + + 'regular object.' + ); + _invariant( + !isValidElement(spec), + "ReactClass: You're attempting to " + + 'use a component as a mixin. Instead, just use a regular object.' + ); + + var proto = Constructor.prototype; + var autoBindPairs = proto.__reactAutoBindPairs; + + // By handling mixins before any other properties, we ensure the same + // chaining order is applied to methods with DEFINE_MANY policy, whether + // mixins are listed before or after these methods in the spec. + if (spec.hasOwnProperty(MIXINS_KEY)) { + RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); + } + + for (var name in spec) { + if (!spec.hasOwnProperty(name)) { + continue; + } + + if (name === MIXINS_KEY) { + // We have already handled mixins in a special case above. + continue; + } + + var property = spec[name]; + var isAlreadyDefined = proto.hasOwnProperty(name); + validateMethodOverride(isAlreadyDefined, name); + + if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { + RESERVED_SPEC_KEYS[name](Constructor, property); + } else { + // Setup methods on prototype: + // The following member methods should not be automatically bound: + // 1. Expected ReactClass methods (in the "interface"). + // 2. Overridden methods (that were mixed in). + var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); + var isFunction = typeof property === 'function'; + var shouldAutoBind = + isFunction && + !isReactClassMethod && + !isAlreadyDefined && + spec.autobind !== false; + + if (shouldAutoBind) { + autoBindPairs.push(name, property); + proto[name] = property; + } else { + if (isAlreadyDefined) { + var specPolicy = ReactClassInterface[name]; + + // These cases should already be caught by validateMethodOverride. + _invariant( + isReactClassMethod && + (specPolicy === 'DEFINE_MANY_MERGED' || + specPolicy === 'DEFINE_MANY'), + 'ReactClass: Unexpected spec policy %s for key %s ' + + 'when mixing in component specs.', + specPolicy, + name + ); + + // For methods which are defined more than once, call the existing + // methods before calling the new property, merging if appropriate. + if (specPolicy === 'DEFINE_MANY_MERGED') { + proto[name] = createMergedResultFunction(proto[name], property); + } else if (specPolicy === 'DEFINE_MANY') { + proto[name] = createChainedFunction(proto[name], property); + } + } else { + proto[name] = property; + if (process.env.NODE_ENV !== 'production') { + // Add verbose displayName to the function, which helps when looking + // at profiling tools. + if (typeof property === 'function' && spec.displayName) { + proto[name].displayName = spec.displayName + '_' + name; + } + } + } + } + } + } + } + + function mixStaticSpecIntoComponent(Constructor, statics) { + if (!statics) { + return; + } + for (var name in statics) { + var property = statics[name]; + if (!statics.hasOwnProperty(name)) { + continue; + } + + var isReserved = name in RESERVED_SPEC_KEYS; + _invariant( + !isReserved, + 'ReactClass: You are attempting to define a reserved ' + + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + + 'as an instance property instead; it will still be accessible on the ' + + 'constructor.', + name + ); + + var isInherited = name in Constructor; + _invariant( + !isInherited, + 'ReactClass: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be ' + + 'due to a mixin.', + name + ); + Constructor[name] = property; + } + } + + /** + * Merge two objects, but throw if both contain the same key. + * + * @param {object} one The first object, which is mutated. + * @param {object} two The second object + * @return {object} one after it has been mutated to contain everything in two. + */ + function mergeIntoWithNoDuplicateKeys(one, two) { + _invariant( + one && two && typeof one === 'object' && typeof two === 'object', + 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.' + ); + + for (var key in two) { + if (two.hasOwnProperty(key)) { + _invariant( + one[key] === undefined, + 'mergeIntoWithNoDuplicateKeys(): ' + + 'Tried to merge two objects with the same key: `%s`. This conflict ' + + 'may be due to a mixin; in particular, this may be caused by two ' + + 'getInitialState() or getDefaultProps() methods returning objects ' + + 'with clashing keys.', + key + ); + one[key] = two[key]; + } + } + return one; + } + + /** + * Creates a function that invokes two functions and merges their return values. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ + function createMergedResultFunction(one, two) { + return function mergedResult() { + var a = one.apply(this, arguments); + var b = two.apply(this, arguments); + if (a == null) { + return b; + } else if (b == null) { + return a; + } + var c = {}; + mergeIntoWithNoDuplicateKeys(c, a); + mergeIntoWithNoDuplicateKeys(c, b); + return c; + }; + } + + /** + * Creates a function that invokes two functions and ignores their return vales. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ + function createChainedFunction(one, two) { + return function chainedFunction() { + one.apply(this, arguments); + two.apply(this, arguments); + }; + } + + /** + * Binds a method to the component. + * + * @param {object} component Component whose method is going to be bound. + * @param {function} method Method to be bound. + * @return {function} The bound method. + */ + function bindAutoBindMethod(component, method) { + var boundMethod = method.bind(component); + if (process.env.NODE_ENV !== 'production') { + boundMethod.__reactBoundContext = component; + boundMethod.__reactBoundMethod = method; + boundMethod.__reactBoundArguments = null; + var componentName = component.constructor.displayName; + var _bind = boundMethod.bind; + boundMethod.bind = function(newThis) { + for ( + var _len = arguments.length, + args = Array(_len > 1 ? _len - 1 : 0), + _key = 1; + _key < _len; + _key++ + ) { + args[_key - 1] = arguments[_key]; + } + + // User is trying to bind() an autobound method; we effectively will + // ignore the value of "this" that the user is trying to use, so + // let's warn. + if (newThis !== component && newThis !== null) { + if (process.env.NODE_ENV !== 'production') { + warning( + false, + 'bind(): React component methods may only be bound to the ' + + 'component instance. See %s', + componentName + ); + } + } else if (!args.length) { + if (process.env.NODE_ENV !== 'production') { + warning( + false, + 'bind(): You are binding a component method to the component. ' + + 'React does this for you automatically in a high-performance ' + + 'way, so you can safely remove this call. See %s', + componentName + ); + } + return boundMethod; + } + var reboundMethod = _bind.apply(boundMethod, arguments); + reboundMethod.__reactBoundContext = component; + reboundMethod.__reactBoundMethod = method; + reboundMethod.__reactBoundArguments = args; + return reboundMethod; + }; + } + return boundMethod; + } + + /** + * Binds all auto-bound methods in a component. + * + * @param {object} component Component whose method is going to be bound. + */ + function bindAutoBindMethods(component) { + var pairs = component.__reactAutoBindPairs; + for (var i = 0; i < pairs.length; i += 2) { + var autoBindKey = pairs[i]; + var method = pairs[i + 1]; + component[autoBindKey] = bindAutoBindMethod(component, method); + } + } + + var IsMountedPreMixin = { + componentDidMount: function() { + this.__isMounted = true; + } + }; + + var IsMountedPostMixin = { + componentWillUnmount: function() { + this.__isMounted = false; + } + }; + + /** + * Add more to the ReactClass base class. These are all legacy features and + * therefore not already part of the modern ReactComponent. + */ + var ReactClassMixin = { + /** + * TODO: This will be deprecated because state should always keep a consistent + * type signature and the only use case for this, is to avoid that. + */ + replaceState: function(newState, callback) { + this.updater.enqueueReplaceState(this, newState, callback); + }, + + /** + * Checks whether or not this composite component is mounted. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function() { + if (process.env.NODE_ENV !== 'production') { + warning( + this.__didWarnIsMounted, + '%s: isMounted is deprecated. Instead, make sure to clean up ' + + 'subscriptions and pending requests in componentWillUnmount to ' + + 'prevent memory leaks.', + (this.constructor && this.constructor.displayName) || + this.name || + 'Component' + ); + this.__didWarnIsMounted = true; + } + return !!this.__isMounted; + } + }; + + var ReactClassComponent = function() {}; + _assign( + ReactClassComponent.prototype, + ReactComponent.prototype, + ReactClassMixin + ); + + /** + * Creates a composite component class given a class specification. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass + * + * @param {object} spec Class specification (which must define `render`). + * @return {function} Component constructor function. + * @public + */ + function createClass(spec) { + // To keep our warnings more understandable, we'll use a little hack here to + // ensure that Constructor.name !== 'Constructor'. This makes sure we don't + // unnecessarily identify a class without displayName as 'Constructor'. + var Constructor = identity(function(props, context, updater) { + // This constructor gets overridden by mocks. The argument is used + // by mocks to assert on what gets mounted. + + if (process.env.NODE_ENV !== 'production') { + warning( + this instanceof Constructor, + 'Something is calling a React component directly. Use a factory or ' + + 'JSX instead. See: https://fb.me/react-legacyfactory' + ); + } + + // Wire up auto-binding + if (this.__reactAutoBindPairs.length) { + bindAutoBindMethods(this); + } + + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + + this.state = null; + + // ReactClasses doesn't have constructors. Instead, they use the + // getInitialState and componentWillMount methods for initialization. + + var initialState = this.getInitialState ? this.getInitialState() : null; + if (process.env.NODE_ENV !== 'production') { + // We allow auto-mocks to proceed as if they're returning null. + if ( + initialState === undefined && + this.getInitialState._isMockFunction + ) { + // This is probably bad practice. Consider warning here and + // deprecating this convenience. + initialState = null; + } + } + _invariant( + typeof initialState === 'object' && !Array.isArray(initialState), + '%s.getInitialState(): must return an object or null', + Constructor.displayName || 'ReactCompositeComponent' + ); + + this.state = initialState; + }); + Constructor.prototype = new ReactClassComponent(); + Constructor.prototype.constructor = Constructor; + Constructor.prototype.__reactAutoBindPairs = []; + + injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); + + mixSpecIntoComponent(Constructor, IsMountedPreMixin); + mixSpecIntoComponent(Constructor, spec); + mixSpecIntoComponent(Constructor, IsMountedPostMixin); + + // Initialize the defaultProps property after all mixins have been merged. + if (Constructor.getDefaultProps) { + Constructor.defaultProps = Constructor.getDefaultProps(); + } + + if (process.env.NODE_ENV !== 'production') { + // This is a tag to indicate that the use of these method names is ok, + // since it's used with createClass. If it's not, then it's likely a + // mistake so we'll warn you to use the static property, property + // initializer or constructor respectively. + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps.isReactClassApproved = {}; + } + if (Constructor.prototype.getInitialState) { + Constructor.prototype.getInitialState.isReactClassApproved = {}; + } + } + + _invariant( + Constructor.prototype.render, + 'createClass(...): Class specification must implement a `render` method.' + ); + + if (process.env.NODE_ENV !== 'production') { + warning( + !Constructor.prototype.componentShouldUpdate, + '%s has a method called ' + + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + + 'The name is phrased as a question because the function is ' + + 'expected to return a value.', + spec.displayName || 'A component' + ); + warning( + !Constructor.prototype.componentWillRecieveProps, + '%s has a method called ' + + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', + spec.displayName || 'A component' + ); + } + + // Reduce time spent doing lookups by setting these on the prototype. + for (var methodName in ReactClassInterface) { + if (!Constructor.prototype[methodName]) { + Constructor.prototype[methodName] = null; + } + } + + return Constructor; + } + + return createClass; +} + +module.exports = factory; + + +/***/ }), +/* 107 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + +var _prodInvariant = __webpack_require__(16); + +var ReactElement = __webpack_require__(13); + +var invariant = __webpack_require__(0); + +/** + * Returns the first child in a collection of children and verifies that there + * is only one child in the collection. + * + * See https://facebook.github.io/react/docs/top-level-api.html#react.children.only + * + * The current implementation of this function assumes that a single child gets + * passed without a wrapper, but the purpose of this helper function is to + * abstract away the particular structure of children. + * + * @param {?object} children Child collection structure. + * @return {ReactElement} The first and only `ReactElement` contained in the + * structure. + */ +function onlyChild(children) { + !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0; + return children; +} + +module.exports = onlyChild; + +/***/ }), +/* 108 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ + + + +var ReactDOMComponentTree = __webpack_require__(4); +var ReactDefaultInjection = __webpack_require__(109); +var ReactMount = __webpack_require__(82); +var ReactReconciler = __webpack_require__(17); +var ReactUpdates = __webpack_require__(10); +var ReactVersion = __webpack_require__(187); + +var findDOMNode = __webpack_require__(188); +var getHostComponentFromComposite = __webpack_require__(83); +var renderSubtreeIntoContainer = __webpack_require__(189); +var warning = __webpack_require__(1); + +ReactDefaultInjection.inject(); + +var ReactDOM = { + findDOMNode: findDOMNode, + render: ReactMount.render, + unmountComponentAtNode: ReactMount.unmountComponentAtNode, + version: ReactVersion, + + /* eslint-disable camelcase */ + unstable_batchedUpdates: ReactUpdates.batchedUpdates, + unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer + /* eslint-enable camelcase */ +}; + +// Inject the runtime into a devtools global hook regardless of browser. +// Allows for debugging when the hook is injected on the page. +if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { + __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ + ComponentTree: { + getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode, + getNodeFromInstance: function (inst) { + // inst is an internal instance (but could be a composite) + if (inst._renderedComponent) { + inst = getHostComponentFromComposite(inst); + } + if (inst) { + return ReactDOMComponentTree.getNodeFromInstance(inst); + } else { + return null; + } + } + }, + Mount: ReactMount, + Reconciler: ReactReconciler + }); +} + +if (process.env.NODE_ENV !== 'production') { + var ExecutionEnvironment = __webpack_require__(5); + if (ExecutionEnvironment.canUseDOM && window.top === window.self) { + // First check if devtools is not installed + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + // If we're in Chrome or Firefox, provide a download link if not installed. + if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { + // Firefox does not have the issue with devtools loaded over file:// + var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1; + console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools'); + } + } + + var testFunc = function testFn() {}; + process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, "It looks like you're using a minified copy of the development build " + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0; + + // If we're in IE8, check to see if we are in compatibility mode and provide + // information on preventing compatibility mode + var ieCompatibilityMode = document.documentMode && document.documentMode < 8; + + process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0; + + var expectedFeatures = [ + // shims + Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim]; + + for (var i = 0; i < expectedFeatures.length; i++) { + if (!expectedFeatures[i]) { + process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0; + break; + } + } + } +} + +if (process.env.NODE_ENV !== 'production') { + var ReactInstrumentation = __webpack_require__(8); + var ReactDOMUnknownPropertyHook = __webpack_require__(190); + var ReactDOMNullInputValuePropHook = __webpack_require__(191); + var ReactDOMInvalidARIAHook = __webpack_require__(192); + + ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook); + ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook); + ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook); +} + +module.exports = ReactDOM; + +/***/ }), +/* 109 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ARIADOMPropertyConfig = __webpack_require__(110); +var BeforeInputEventPlugin = __webpack_require__(111); +var ChangeEventPlugin = __webpack_require__(115); +var DefaultEventPluginOrder = __webpack_require__(123); +var EnterLeaveEventPlugin = __webpack_require__(124); +var HTMLDOMPropertyConfig = __webpack_require__(125); +var ReactComponentBrowserEnvironment = __webpack_require__(126); +var ReactDOMComponent = __webpack_require__(132); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactDOMEmptyComponent = __webpack_require__(158); +var ReactDOMTreeTraversal = __webpack_require__(159); +var ReactDOMTextComponent = __webpack_require__(160); +var ReactDefaultBatchingStrategy = __webpack_require__(161); +var ReactEventListener = __webpack_require__(162); +var ReactInjection = __webpack_require__(164); +var ReactReconcileTransaction = __webpack_require__(165); +var SVGDOMPropertyConfig = __webpack_require__(171); +var SelectEventPlugin = __webpack_require__(172); +var SimpleEventPlugin = __webpack_require__(173); + +var alreadyInjected = false; + +function inject() { + if (alreadyInjected) { + // TODO: This is currently true because these injections are shared between + // the client and the server package. They should be built independently + // and not share any injection state. Then this problem will be solved. + return; + } + alreadyInjected = true; + + ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); + + /** + * Inject modules for resolving DOM hierarchy and plugin ordering. + */ + ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); + ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree); + ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal); + + /** + * Some important event plugins included by default (without having to require + * them). + */ + ReactInjection.EventPluginHub.injectEventPluginsByName({ + SimpleEventPlugin: SimpleEventPlugin, + EnterLeaveEventPlugin: EnterLeaveEventPlugin, + ChangeEventPlugin: ChangeEventPlugin, + SelectEventPlugin: SelectEventPlugin, + BeforeInputEventPlugin: BeforeInputEventPlugin + }); + + ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent); + + ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent); + + ReactInjection.DOMProperty.injectDOMPropertyConfig(ARIADOMPropertyConfig); + ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); + ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); + + ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) { + return new ReactDOMEmptyComponent(instantiate); + }); + + ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); + ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); + + ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); +} + +module.exports = { + inject: inject +}; + +/***/ }), +/* 110 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ARIADOMPropertyConfig = { + Properties: { + // Global States and Properties + 'aria-current': 0, // state + 'aria-details': 0, + 'aria-disabled': 0, // state + 'aria-hidden': 0, // state + 'aria-invalid': 0, // state + 'aria-keyshortcuts': 0, + 'aria-label': 0, + 'aria-roledescription': 0, + // Widget Attributes + 'aria-autocomplete': 0, + 'aria-checked': 0, + 'aria-expanded': 0, + 'aria-haspopup': 0, + 'aria-level': 0, + 'aria-modal': 0, + 'aria-multiline': 0, + 'aria-multiselectable': 0, + 'aria-orientation': 0, + 'aria-placeholder': 0, + 'aria-pressed': 0, + 'aria-readonly': 0, + 'aria-required': 0, + 'aria-selected': 0, + 'aria-sort': 0, + 'aria-valuemax': 0, + 'aria-valuemin': 0, + 'aria-valuenow': 0, + 'aria-valuetext': 0, + // Live Region Attributes + 'aria-atomic': 0, + 'aria-busy': 0, + 'aria-live': 0, + 'aria-relevant': 0, + // Drag-and-Drop Attributes + 'aria-dropeffect': 0, + 'aria-grabbed': 0, + // Relationship Attributes + 'aria-activedescendant': 0, + 'aria-colcount': 0, + 'aria-colindex': 0, + 'aria-colspan': 0, + 'aria-controls': 0, + 'aria-describedby': 0, + 'aria-errormessage': 0, + 'aria-flowto': 0, + 'aria-labelledby': 0, + 'aria-owns': 0, + 'aria-posinset': 0, + 'aria-rowcount': 0, + 'aria-rowindex': 0, + 'aria-rowspan': 0, + 'aria-setsize': 0 + }, + DOMAttributeNames: {}, + DOMPropertyNames: {} +}; + +module.exports = ARIADOMPropertyConfig; + +/***/ }), +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var EventPropagators = __webpack_require__(20); +var ExecutionEnvironment = __webpack_require__(5); +var FallbackCompositionState = __webpack_require__(112); +var SyntheticCompositionEvent = __webpack_require__(113); +var SyntheticInputEvent = __webpack_require__(114); + +var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space +var START_KEYCODE = 229; + +var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; + +var documentMode = null; +if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { + documentMode = document.documentMode; +} + +// Webkit offers a very useful `textInput` event that can be used to +// directly represent `beforeInput`. The IE `textinput` event is not as +// useful, so we don't use it. +var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); + +// In IE9+, we have access to composition events, but the data supplied +// by the native compositionend event may be incorrect. Japanese ideographic +// spaces, for instance (\u3000) are not recorded correctly. +var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); + +/** + * Opera <= 12 includes TextEvent in window, but does not fire + * text input events. Rely on keypress instead. + */ +function isPresto() { + var opera = window.opera; + return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; +} + +var SPACEBAR_CODE = 32; +var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); + +// Events and their corresponding property names. +var eventTypes = { + beforeInput: { + phasedRegistrationNames: { + bubbled: 'onBeforeInput', + captured: 'onBeforeInputCapture' + }, + dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste'] + }, + compositionEnd: { + phasedRegistrationNames: { + bubbled: 'onCompositionEnd', + captured: 'onCompositionEndCapture' + }, + dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] + }, + compositionStart: { + phasedRegistrationNames: { + bubbled: 'onCompositionStart', + captured: 'onCompositionStartCapture' + }, + dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] + }, + compositionUpdate: { + phasedRegistrationNames: { + bubbled: 'onCompositionUpdate', + captured: 'onCompositionUpdateCapture' + }, + dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown'] + } +}; + +// Track whether we've ever handled a keypress on the space key. +var hasSpaceKeypress = false; + +/** + * Return whether a native keypress event is assumed to be a command. + * This is required because Firefox fires `keypress` events for key commands + * (cut, copy, select-all, etc.) even though no character is inserted. + */ +function isKeypressCommand(nativeEvent) { + return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && + // ctrlKey && altKey is equivalent to AltGr, and is not a command. + !(nativeEvent.ctrlKey && nativeEvent.altKey); +} + +/** + * Translate native top level events into event types. + * + * @param {string} topLevelType + * @return {object} + */ +function getCompositionEventType(topLevelType) { + switch (topLevelType) { + case 'topCompositionStart': + return eventTypes.compositionStart; + case 'topCompositionEnd': + return eventTypes.compositionEnd; + case 'topCompositionUpdate': + return eventTypes.compositionUpdate; + } +} + +/** + * Does our fallback best-guess model think this event signifies that + * composition has begun? + * + * @param {string} topLevelType + * @param {object} nativeEvent + * @return {boolean} + */ +function isFallbackCompositionStart(topLevelType, nativeEvent) { + return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; +} + +/** + * Does our fallback mode think that this event is the end of composition? + * + * @param {string} topLevelType + * @param {object} nativeEvent + * @return {boolean} + */ +function isFallbackCompositionEnd(topLevelType, nativeEvent) { + switch (topLevelType) { + case 'topKeyUp': + // Command keys insert or clear IME input. + return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; + case 'topKeyDown': + // Expect IME keyCode on each keydown. If we get any other + // code we must have exited earlier. + return nativeEvent.keyCode !== START_KEYCODE; + case 'topKeyPress': + case 'topMouseDown': + case 'topBlur': + // Events are not possible without cancelling IME. + return true; + default: + return false; + } +} + +/** + * Google Input Tools provides composition data via a CustomEvent, + * with the `data` property populated in the `detail` object. If this + * is available on the event object, use it. If not, this is a plain + * composition event and we have nothing special to extract. + * + * @param {object} nativeEvent + * @return {?string} + */ +function getDataFromCustomEvent(nativeEvent) { + var detail = nativeEvent.detail; + if (typeof detail === 'object' && 'data' in detail) { + return detail.data; + } + return null; +} + +// Track the current IME composition fallback object, if any. +var currentComposition = null; + +/** + * @return {?object} A SyntheticCompositionEvent. + */ +function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var eventType; + var fallbackData; + + if (canUseCompositionEvent) { + eventType = getCompositionEventType(topLevelType); + } else if (!currentComposition) { + if (isFallbackCompositionStart(topLevelType, nativeEvent)) { + eventType = eventTypes.compositionStart; + } + } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { + eventType = eventTypes.compositionEnd; + } + + if (!eventType) { + return null; + } + + if (useFallbackCompositionData) { + // The current composition is stored statically and must not be + // overwritten while composition continues. + if (!currentComposition && eventType === eventTypes.compositionStart) { + currentComposition = FallbackCompositionState.getPooled(nativeEventTarget); + } else if (eventType === eventTypes.compositionEnd) { + if (currentComposition) { + fallbackData = currentComposition.getData(); + } + } + } + + var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); + + if (fallbackData) { + // Inject data generated from fallback path into the synthetic event. + // This matches the property of native CompositionEventInterface. + event.data = fallbackData; + } else { + var customData = getDataFromCustomEvent(nativeEvent); + if (customData !== null) { + event.data = customData; + } + } + + EventPropagators.accumulateTwoPhaseDispatches(event); + return event; +} + +/** + * @param {string} topLevelType Record from `EventConstants`. + * @param {object} nativeEvent Native browser event. + * @return {?string} The string corresponding to this `beforeInput` event. + */ +function getNativeBeforeInputChars(topLevelType, nativeEvent) { + switch (topLevelType) { + case 'topCompositionEnd': + return getDataFromCustomEvent(nativeEvent); + case 'topKeyPress': + /** + * If native `textInput` events are available, our goal is to make + * use of them. However, there is a special case: the spacebar key. + * In Webkit, preventing default on a spacebar `textInput` event + * cancels character insertion, but it *also* causes the browser + * to fall back to its default spacebar behavior of scrolling the + * page. + * + * Tracking at: + * https://code.google.com/p/chromium/issues/detail?id=355103 + * + * To avoid this issue, use the keypress event as if no `textInput` + * event is available. + */ + var which = nativeEvent.which; + if (which !== SPACEBAR_CODE) { + return null; + } + + hasSpaceKeypress = true; + return SPACEBAR_CHAR; + + case 'topTextInput': + // Record the characters to be added to the DOM. + var chars = nativeEvent.data; + + // If it's a spacebar character, assume that we have already handled + // it at the keypress level and bail immediately. Android Chrome + // doesn't give us keycodes, so we need to blacklist it. + if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { + return null; + } + + return chars; + + default: + // For other native event types, do nothing. + return null; + } +} + +/** + * For browsers that do not provide the `textInput` event, extract the + * appropriate string to use for SyntheticInputEvent. + * + * @param {string} topLevelType Record from `EventConstants`. + * @param {object} nativeEvent Native browser event. + * @return {?string} The fallback string for this `beforeInput` event. + */ +function getFallbackBeforeInputChars(topLevelType, nativeEvent) { + // If we are currently composing (IME) and using a fallback to do so, + // try to extract the composed characters from the fallback object. + // If composition event is available, we extract a string only at + // compositionevent, otherwise extract it at fallback events. + if (currentComposition) { + if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { + var chars = currentComposition.getData(); + FallbackCompositionState.release(currentComposition); + currentComposition = null; + return chars; + } + return null; + } + + switch (topLevelType) { + case 'topPaste': + // If a paste event occurs after a keypress, throw out the input + // chars. Paste events should not lead to BeforeInput events. + return null; + case 'topKeyPress': + /** + * As of v27, Firefox may fire keypress events even when no character + * will be inserted. A few possibilities: + * + * - `which` is `0`. Arrow keys, Esc key, etc. + * + * - `which` is the pressed key code, but no char is available. + * Ex: 'AltGr + d` in Polish. There is no modified character for + * this key combination and no character is inserted into the + * document, but FF fires the keypress for char code `100` anyway. + * No `input` event will occur. + * + * - `which` is the pressed key code, but a command combination is + * being used. Ex: `Cmd+C`. No character is inserted, and no + * `input` event will occur. + */ + if (nativeEvent.which && !isKeypressCommand(nativeEvent)) { + return String.fromCharCode(nativeEvent.which); + } + return null; + case 'topCompositionEnd': + return useFallbackCompositionData ? null : nativeEvent.data; + default: + return null; + } +} + +/** + * Extract a SyntheticInputEvent for `beforeInput`, based on either native + * `textInput` or fallback behavior. + * + * @return {?object} A SyntheticInputEvent. + */ +function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var chars; + + if (canUseTextInputEvent) { + chars = getNativeBeforeInputChars(topLevelType, nativeEvent); + } else { + chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); + } + + // If no characters are being inserted, no BeforeInput event should + // be fired. + if (!chars) { + return null; + } + + var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); + + event.data = chars; + EventPropagators.accumulateTwoPhaseDispatches(event); + return event; +} + +/** + * Create an `onBeforeInput` event to match + * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. + * + * This event plugin is based on the native `textInput` event + * available in Chrome, Safari, Opera, and IE. This event fires after + * `onKeyPress` and `onCompositionEnd`, but before `onInput`. + * + * `beforeInput` is spec'd but not implemented in any browsers, and + * the `input` event does not provide any useful information about what has + * actually been added, contrary to the spec. Thus, `textInput` is the best + * available event to identify the characters that have actually been inserted + * into the target node. + * + * This plugin is also responsible for emitting `composition` events, thus + * allowing us to share composition fallback code for both `beforeInput` and + * `composition` event types. + */ +var BeforeInputEventPlugin = { + eventTypes: eventTypes, + + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)]; + } +}; + +module.exports = BeforeInputEventPlugin; + +/***/ }), +/* 112 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var PooledClass = __webpack_require__(14); + +var getTextContentAccessor = __webpack_require__(62); + +/** + * This helper class stores information about text content of a target node, + * allowing comparison of content before and after a given event. + * + * Identify the node where selection currently begins, then observe + * both its text content and its current position in the DOM. Since the + * browser may natively replace the target node during composition, we can + * use its position to find its replacement. + * + * @param {DOMEventTarget} root + */ +function FallbackCompositionState(root) { + this._root = root; + this._startText = this.getText(); + this._fallbackText = null; +} + +_assign(FallbackCompositionState.prototype, { + destructor: function () { + this._root = null; + this._startText = null; + this._fallbackText = null; + }, + + /** + * Get current text of input. + * + * @return {string} + */ + getText: function () { + if ('value' in this._root) { + return this._root.value; + } + return this._root[getTextContentAccessor()]; + }, + + /** + * Determine the differing substring between the initially stored + * text content and the current content. + * + * @return {string} + */ + getData: function () { + if (this._fallbackText) { + return this._fallbackText; + } + + var start; + var startValue = this._startText; + var startLength = startValue.length; + var end; + var endValue = this.getText(); + var endLength = endValue.length; + + for (start = 0; start < startLength; start++) { + if (startValue[start] !== endValue[start]) { + break; + } + } + + var minEnd = startLength - start; + for (end = 1; end <= minEnd; end++) { + if (startValue[startLength - end] !== endValue[endLength - end]) { + break; + } + } + + var sliceTail = end > 1 ? 1 - end : undefined; + this._fallbackText = endValue.slice(start, sliceTail); + return this._fallbackText; + } +}); + +PooledClass.addPoolingTo(FallbackCompositionState); + +module.exports = FallbackCompositionState; + +/***/ }), +/* 113 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticEvent = __webpack_require__(11); + +/** + * @interface Event + * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents + */ +var CompositionEventInterface = { + data: null +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticUIEvent} + */ +function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); + +module.exports = SyntheticCompositionEvent; + +/***/ }), +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticEvent = __webpack_require__(11); + +/** + * @interface Event + * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 + * /#events-inputevents + */ +var InputEventInterface = { + data: null +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticUIEvent} + */ +function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); + +module.exports = SyntheticInputEvent; + +/***/ }), +/* 115 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var EventPluginHub = __webpack_require__(21); +var EventPropagators = __webpack_require__(20); +var ExecutionEnvironment = __webpack_require__(5); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactUpdates = __webpack_require__(10); +var SyntheticEvent = __webpack_require__(11); + +var inputValueTracking = __webpack_require__(65); +var getEventTarget = __webpack_require__(37); +var isEventSupported = __webpack_require__(38); +var isTextInputElement = __webpack_require__(66); + +var eventTypes = { + change: { + phasedRegistrationNames: { + bubbled: 'onChange', + captured: 'onChangeCapture' + }, + dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange'] + } +}; + +function createAndAccumulateChangeEvent(inst, nativeEvent, target) { + var event = SyntheticEvent.getPooled(eventTypes.change, inst, nativeEvent, target); + event.type = 'change'; + EventPropagators.accumulateTwoPhaseDispatches(event); + return event; +} +/** + * For IE shims + */ +var activeElement = null; +var activeElementInst = null; + +/** + * SECTION: handle `change` event + */ +function shouldUseChangeEvent(elem) { + var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); + return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; +} + +var doesChangeEventBubble = false; +if (ExecutionEnvironment.canUseDOM) { + // See `handleChange` comment below + doesChangeEventBubble = isEventSupported('change') && (!document.documentMode || document.documentMode > 8); +} + +function manualDispatchChangeEvent(nativeEvent) { + var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); + + // If change and propertychange bubbled, we'd just bind to it like all the + // other events and have it go through ReactBrowserEventEmitter. Since it + // doesn't, we manually listen for the events and so we have to enqueue and + // process the abstract event manually. + // + // Batching is necessary here in order to ensure that all event handlers run + // before the next rerender (including event handlers attached to ancestor + // elements instead of directly on the input). Without this, controlled + // components don't work properly in conjunction with event bubbling because + // the component is rerendered and the value reverted before all the event + // handlers can run. See https://github.com/facebook/react/issues/708. + ReactUpdates.batchedUpdates(runEventInBatch, event); +} + +function runEventInBatch(event) { + EventPluginHub.enqueueEvents(event); + EventPluginHub.processEventQueue(false); +} + +function startWatchingForChangeEventIE8(target, targetInst) { + activeElement = target; + activeElementInst = targetInst; + activeElement.attachEvent('onchange', manualDispatchChangeEvent); +} + +function stopWatchingForChangeEventIE8() { + if (!activeElement) { + return; + } + activeElement.detachEvent('onchange', manualDispatchChangeEvent); + activeElement = null; + activeElementInst = null; +} + +function getInstIfValueChanged(targetInst, nativeEvent) { + var updated = inputValueTracking.updateValueIfChanged(targetInst); + var simulated = nativeEvent.simulated === true && ChangeEventPlugin._allowSimulatedPassThrough; + + if (updated || simulated) { + return targetInst; + } +} + +function getTargetInstForChangeEvent(topLevelType, targetInst) { + if (topLevelType === 'topChange') { + return targetInst; + } +} + +function handleEventsForChangeEventIE8(topLevelType, target, targetInst) { + if (topLevelType === 'topFocus') { + // stopWatching() should be a noop here but we call it just in case we + // missed a blur event somehow. + stopWatchingForChangeEventIE8(); + startWatchingForChangeEventIE8(target, targetInst); + } else if (topLevelType === 'topBlur') { + stopWatchingForChangeEventIE8(); + } +} + +/** + * SECTION: handle `input` event + */ +var isInputEventSupported = false; +if (ExecutionEnvironment.canUseDOM) { + // IE9 claims to support the input event but fails to trigger it when + // deleting text, so we ignore its input events. + + isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); +} + +/** + * (For IE <=9) Starts tracking propertychange events on the passed-in element + * and override the value property so that we can distinguish user events from + * value changes in JS. + */ +function startWatchingForValueChange(target, targetInst) { + activeElement = target; + activeElementInst = targetInst; + activeElement.attachEvent('onpropertychange', handlePropertyChange); +} + +/** + * (For IE <=9) Removes the event listeners from the currently-tracked element, + * if any exists. + */ +function stopWatchingForValueChange() { + if (!activeElement) { + return; + } + activeElement.detachEvent('onpropertychange', handlePropertyChange); + + activeElement = null; + activeElementInst = null; +} + +/** + * (For IE <=9) Handles a propertychange event, sending a `change` event if + * the value of the active element has changed. + */ +function handlePropertyChange(nativeEvent) { + if (nativeEvent.propertyName !== 'value') { + return; + } + if (getInstIfValueChanged(activeElementInst, nativeEvent)) { + manualDispatchChangeEvent(nativeEvent); + } +} + +function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) { + if (topLevelType === 'topFocus') { + // In IE8, we can capture almost all .value changes by adding a + // propertychange handler and looking for events with propertyName + // equal to 'value' + // In IE9, propertychange fires for most input events but is buggy and + // doesn't fire when text is deleted, but conveniently, selectionchange + // appears to fire in all of the remaining cases so we catch those and + // forward the event if the value has changed + // In either case, we don't want to call the event handler if the value + // is changed from JS so we redefine a setter for `.value` that updates + // our activeElementValue variable, allowing us to ignore those changes + // + // stopWatching() should be a noop here but we call it just in case we + // missed a blur event somehow. + stopWatchingForValueChange(); + startWatchingForValueChange(target, targetInst); + } else if (topLevelType === 'topBlur') { + stopWatchingForValueChange(); + } +} + +// For IE8 and IE9. +function getTargetInstForInputEventPolyfill(topLevelType, targetInst, nativeEvent) { + if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') { + // On the selectionchange event, the target is just document which isn't + // helpful for us so just check activeElement instead. + // + // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire + // propertychange on the first input event after setting `value` from a + // script and fires only keydown, keypress, keyup. Catching keyup usually + // gets it and catching keydown lets us fire an event for the first + // keystroke if user does a key repeat (it'll be a little delayed: right + // before the second keystroke). Other input methods (e.g., paste) seem to + // fire selectionchange normally. + return getInstIfValueChanged(activeElementInst, nativeEvent); + } +} + +/** + * SECTION: handle `click` event + */ +function shouldUseClickEvent(elem) { + // Use the `click` event to detect changes to checkbox and radio inputs. + // This approach works across all browsers, whereas `change` does not fire + // until `blur` in IE8. + var nodeName = elem.nodeName; + return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); +} + +function getTargetInstForClickEvent(topLevelType, targetInst, nativeEvent) { + if (topLevelType === 'topClick') { + return getInstIfValueChanged(targetInst, nativeEvent); + } +} + +function getTargetInstForInputOrChangeEvent(topLevelType, targetInst, nativeEvent) { + if (topLevelType === 'topInput' || topLevelType === 'topChange') { + return getInstIfValueChanged(targetInst, nativeEvent); + } +} + +function handleControlledInputBlur(inst, node) { + // TODO: In IE, inst is occasionally null. Why? + if (inst == null) { + return; + } + + // Fiber and ReactDOM keep wrapper state in separate places + var state = inst._wrapperState || node._wrapperState; + + if (!state || !state.controlled || node.type !== 'number') { + return; + } + + // If controlled, assign the value attribute to the current value on blur + var value = '' + node.value; + if (node.getAttribute('value') !== value) { + node.setAttribute('value', value); + } +} + +/** + * This plugin creates an `onChange` event that normalizes change events + * across form elements. This event fires at a time when it's possible to + * change the element's value without seeing a flicker. + * + * Supported elements are: + * - input (see `isTextInputElement`) + * - textarea + * - select + */ +var ChangeEventPlugin = { + eventTypes: eventTypes, + + _allowSimulatedPassThrough: true, + _isInputEventSupported: isInputEventSupported, + + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; + + var getTargetInstFunc, handleEventFunc; + if (shouldUseChangeEvent(targetNode)) { + if (doesChangeEventBubble) { + getTargetInstFunc = getTargetInstForChangeEvent; + } else { + handleEventFunc = handleEventsForChangeEventIE8; + } + } else if (isTextInputElement(targetNode)) { + if (isInputEventSupported) { + getTargetInstFunc = getTargetInstForInputOrChangeEvent; + } else { + getTargetInstFunc = getTargetInstForInputEventPolyfill; + handleEventFunc = handleEventsForInputEventPolyfill; + } + } else if (shouldUseClickEvent(targetNode)) { + getTargetInstFunc = getTargetInstForClickEvent; + } + + if (getTargetInstFunc) { + var inst = getTargetInstFunc(topLevelType, targetInst, nativeEvent); + if (inst) { + var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget); + return event; + } + } + + if (handleEventFunc) { + handleEventFunc(topLevelType, targetNode, targetInst); + } + + // When blurring, set the value attribute for number inputs + if (topLevelType === 'topBlur') { + handleControlledInputBlur(targetInst, targetNode); + } + } +}; + +module.exports = ChangeEventPlugin; + +/***/ }), +/* 116 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var ReactOwner = __webpack_require__(117); + +var ReactRef = {}; + +function attachRef(ref, component, owner) { + if (typeof ref === 'function') { + ref(component.getPublicInstance()); + } else { + // Legacy ref + ReactOwner.addComponentAsRefTo(component, ref, owner); + } +} + +function detachRef(ref, component, owner) { + if (typeof ref === 'function') { + ref(null); + } else { + // Legacy ref + ReactOwner.removeComponentAsRefFrom(component, ref, owner); + } +} + +ReactRef.attachRefs = function (instance, element) { + if (element === null || typeof element !== 'object') { + return; + } + var ref = element.ref; + if (ref != null) { + attachRef(ref, instance, element._owner); + } +}; + +ReactRef.shouldUpdateRefs = function (prevElement, nextElement) { + // If either the owner or a `ref` has changed, make sure the newest owner + // has stored a reference to `this`, and the previous owner (if different) + // has forgotten the reference to `this`. We use the element instead + // of the public this.props because the post processing cannot determine + // a ref. The ref conceptually lives on the element. + + // TODO: Should this even be possible? The owner cannot change because + // it's forbidden by shouldUpdateReactComponent. The ref can change + // if you swap the keys of but not the refs. Reconsider where this check + // is made. It probably belongs where the key checking and + // instantiateReactComponent is done. + + var prevRef = null; + var prevOwner = null; + if (prevElement !== null && typeof prevElement === 'object') { + prevRef = prevElement.ref; + prevOwner = prevElement._owner; + } + + var nextRef = null; + var nextOwner = null; + if (nextElement !== null && typeof nextElement === 'object') { + nextRef = nextElement.ref; + nextOwner = nextElement._owner; + } + + return prevRef !== nextRef || + // If owner changes but we have an unchanged function ref, don't update refs + typeof nextRef === 'string' && nextOwner !== prevOwner; +}; + +ReactRef.detachRefs = function (instance, element) { + if (element === null || typeof element !== 'object') { + return; + } + var ref = element.ref; + if (ref != null) { + detachRef(ref, instance, element._owner); + } +}; + +module.exports = ReactRef; + +/***/ }), +/* 117 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +/** + * @param {?object} object + * @return {boolean} True if `object` is a valid owner. + * @final + */ +function isValidOwner(object) { + return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function'); +} + +/** + * ReactOwners are capable of storing references to owned components. + * + * All components are capable of //being// referenced by owner components, but + * only ReactOwner components are capable of //referencing// owned components. + * The named reference is known as a "ref". + * + * Refs are available when mounted and updated during reconciliation. + * + * var MyComponent = React.createClass({ + * render: function() { + * return ( + * <div onClick={this.handleClick}> + * <CustomComponent ref="custom" /> + * </div> + * ); + * }, + * handleClick: function() { + * this.refs.custom.handleClick(); + * }, + * componentDidMount: function() { + * this.refs.custom.initialize(); + * } + * }); + * + * Refs should rarely be used. When refs are used, they should only be done to + * control data that is not handled by React's data flow. + * + * @class ReactOwner + */ +var ReactOwner = { + /** + * Adds a component by ref to an owner component. + * + * @param {ReactComponent} component Component to reference. + * @param {string} ref Name by which to refer to the component. + * @param {ReactOwner} owner Component on which to record the ref. + * @final + * @internal + */ + addComponentAsRefTo: function (component, ref, owner) { + !isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0; + owner.attachRef(ref, component); + }, + + /** + * Removes a component by ref from an owner component. + * + * @param {ReactComponent} component Component to dereference. + * @param {string} ref Name of the ref to remove. + * @param {ReactOwner} owner Component on which the ref is recorded. + * @final + * @internal + */ + removeComponentAsRefFrom: function (component, ref, owner) { + !isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0; + var ownerPublicInstance = owner.getPublicInstance(); + // Check that `component`'s owner is still alive and that `component` is still the current ref + // because we do not want to detach the ref if another component stole it. + if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) { + owner.detachRef(ref); + } + } +}; + +module.exports = ReactOwner; + +/***/ }), +/* 118 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2016-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var ReactInvalidSetStateWarningHook = __webpack_require__(119); +var ReactHostOperationHistoryHook = __webpack_require__(120); +var ReactComponentTreeHook = __webpack_require__(6); +var ExecutionEnvironment = __webpack_require__(5); + +var performanceNow = __webpack_require__(121); +var warning = __webpack_require__(1); + +var hooks = []; +var didHookThrowForEvent = {}; + +function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) { + try { + fn.call(context, arg1, arg2, arg3, arg4, arg5); + } catch (e) { + process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0; + didHookThrowForEvent[event] = true; + } +} + +function emitEvent(event, arg1, arg2, arg3, arg4, arg5) { + for (var i = 0; i < hooks.length; i++) { + var hook = hooks[i]; + var fn = hook[event]; + if (fn) { + callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5); + } + } +} + +var isProfiling = false; +var flushHistory = []; +var lifeCycleTimerStack = []; +var currentFlushNesting = 0; +var currentFlushMeasurements = []; +var currentFlushStartTime = 0; +var currentTimerDebugID = null; +var currentTimerStartTime = 0; +var currentTimerNestedFlushDuration = 0; +var currentTimerType = null; + +var lifeCycleTimerHasWarned = false; + +function clearHistory() { + ReactComponentTreeHook.purgeUnmountedComponents(); + ReactHostOperationHistoryHook.clearHistory(); +} + +function getTreeSnapshot(registeredIDs) { + return registeredIDs.reduce(function (tree, id) { + var ownerID = ReactComponentTreeHook.getOwnerID(id); + var parentID = ReactComponentTreeHook.getParentID(id); + tree[id] = { + displayName: ReactComponentTreeHook.getDisplayName(id), + text: ReactComponentTreeHook.getText(id), + updateCount: ReactComponentTreeHook.getUpdateCount(id), + childIDs: ReactComponentTreeHook.getChildIDs(id), + // Text nodes don't have owners but this is close enough. + ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0, + parentID: parentID + }; + return tree; + }, {}); +} + +function resetMeasurements() { + var previousStartTime = currentFlushStartTime; + var previousMeasurements = currentFlushMeasurements; + var previousOperations = ReactHostOperationHistoryHook.getHistory(); + + if (currentFlushNesting === 0) { + currentFlushStartTime = 0; + currentFlushMeasurements = []; + clearHistory(); + return; + } + + if (previousMeasurements.length || previousOperations.length) { + var registeredIDs = ReactComponentTreeHook.getRegisteredIDs(); + flushHistory.push({ + duration: performanceNow() - previousStartTime, + measurements: previousMeasurements || [], + operations: previousOperations || [], + treeSnapshot: getTreeSnapshot(registeredIDs) + }); + } + + clearHistory(); + currentFlushStartTime = performanceNow(); + currentFlushMeasurements = []; +} + +function checkDebugID(debugID) { + var allowRoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (allowRoot && debugID === 0) { + return; + } + if (!debugID) { + process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0; + } +} + +function beginLifeCycleTimer(debugID, timerType) { + if (currentFlushNesting === 0) { + return; + } + if (currentTimerType && !lifeCycleTimerHasWarned) { + process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0; + lifeCycleTimerHasWarned = true; + } + currentTimerStartTime = performanceNow(); + currentTimerNestedFlushDuration = 0; + currentTimerDebugID = debugID; + currentTimerType = timerType; +} + +function endLifeCycleTimer(debugID, timerType) { + if (currentFlushNesting === 0) { + return; + } + if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) { + process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0; + lifeCycleTimerHasWarned = true; + } + if (isProfiling) { + currentFlushMeasurements.push({ + timerType: timerType, + instanceID: debugID, + duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration + }); + } + currentTimerStartTime = 0; + currentTimerNestedFlushDuration = 0; + currentTimerDebugID = null; + currentTimerType = null; +} + +function pauseCurrentLifeCycleTimer() { + var currentTimer = { + startTime: currentTimerStartTime, + nestedFlushStartTime: performanceNow(), + debugID: currentTimerDebugID, + timerType: currentTimerType + }; + lifeCycleTimerStack.push(currentTimer); + currentTimerStartTime = 0; + currentTimerNestedFlushDuration = 0; + currentTimerDebugID = null; + currentTimerType = null; +} + +function resumeCurrentLifeCycleTimer() { + var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(), + startTime = _lifeCycleTimerStack$.startTime, + nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime, + debugID = _lifeCycleTimerStack$.debugID, + timerType = _lifeCycleTimerStack$.timerType; + + var nestedFlushDuration = performanceNow() - nestedFlushStartTime; + currentTimerStartTime = startTime; + currentTimerNestedFlushDuration += nestedFlushDuration; + currentTimerDebugID = debugID; + currentTimerType = timerType; +} + +var lastMarkTimeStamp = 0; +var canUsePerformanceMeasure = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; + +function shouldMark(debugID) { + if (!isProfiling || !canUsePerformanceMeasure) { + return false; + } + var element = ReactComponentTreeHook.getElement(debugID); + if (element == null || typeof element !== 'object') { + return false; + } + var isHostElement = typeof element.type === 'string'; + if (isHostElement) { + return false; + } + return true; +} + +function markBegin(debugID, markType) { + if (!shouldMark(debugID)) { + return; + } + + var markName = debugID + '::' + markType; + lastMarkTimeStamp = performanceNow(); + performance.mark(markName); +} + +function markEnd(debugID, markType) { + if (!shouldMark(debugID)) { + return; + } + + var markName = debugID + '::' + markType; + var displayName = ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown'; + + // Chrome has an issue of dropping markers recorded too fast: + // https://bugs.chromium.org/p/chromium/issues/detail?id=640652 + // To work around this, we will not report very small measurements. + // I determined the magic number by tweaking it back and forth. + // 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe. + // When the bug is fixed, we can `measure()` unconditionally if we want to. + var timeStamp = performanceNow(); + if (timeStamp - lastMarkTimeStamp > 0.1) { + var measurementName = displayName + ' [' + markType + ']'; + performance.measure(measurementName, markName); + } + + performance.clearMarks(markName); + if (measurementName) { + performance.clearMeasures(measurementName); + } +} + +var ReactDebugTool = { + addHook: function (hook) { + hooks.push(hook); + }, + removeHook: function (hook) { + for (var i = 0; i < hooks.length; i++) { + if (hooks[i] === hook) { + hooks.splice(i, 1); + i--; + } + } + }, + isProfiling: function () { + return isProfiling; + }, + beginProfiling: function () { + if (isProfiling) { + return; + } + + isProfiling = true; + flushHistory.length = 0; + resetMeasurements(); + ReactDebugTool.addHook(ReactHostOperationHistoryHook); + }, + endProfiling: function () { + if (!isProfiling) { + return; + } + + isProfiling = false; + resetMeasurements(); + ReactDebugTool.removeHook(ReactHostOperationHistoryHook); + }, + getFlushHistory: function () { + return flushHistory; + }, + onBeginFlush: function () { + currentFlushNesting++; + resetMeasurements(); + pauseCurrentLifeCycleTimer(); + emitEvent('onBeginFlush'); + }, + onEndFlush: function () { + resetMeasurements(); + currentFlushNesting--; + resumeCurrentLifeCycleTimer(); + emitEvent('onEndFlush'); + }, + onBeginLifeCycleTimer: function (debugID, timerType) { + checkDebugID(debugID); + emitEvent('onBeginLifeCycleTimer', debugID, timerType); + markBegin(debugID, timerType); + beginLifeCycleTimer(debugID, timerType); + }, + onEndLifeCycleTimer: function (debugID, timerType) { + checkDebugID(debugID); + endLifeCycleTimer(debugID, timerType); + markEnd(debugID, timerType); + emitEvent('onEndLifeCycleTimer', debugID, timerType); + }, + onBeginProcessingChildContext: function () { + emitEvent('onBeginProcessingChildContext'); + }, + onEndProcessingChildContext: function () { + emitEvent('onEndProcessingChildContext'); + }, + onHostOperation: function (operation) { + checkDebugID(operation.instanceID); + emitEvent('onHostOperation', operation); + }, + onSetState: function () { + emitEvent('onSetState'); + }, + onSetChildren: function (debugID, childDebugIDs) { + checkDebugID(debugID); + childDebugIDs.forEach(checkDebugID); + emitEvent('onSetChildren', debugID, childDebugIDs); + }, + onBeforeMountComponent: function (debugID, element, parentDebugID) { + checkDebugID(debugID); + checkDebugID(parentDebugID, true); + emitEvent('onBeforeMountComponent', debugID, element, parentDebugID); + markBegin(debugID, 'mount'); + }, + onMountComponent: function (debugID) { + checkDebugID(debugID); + markEnd(debugID, 'mount'); + emitEvent('onMountComponent', debugID); + }, + onBeforeUpdateComponent: function (debugID, element) { + checkDebugID(debugID); + emitEvent('onBeforeUpdateComponent', debugID, element); + markBegin(debugID, 'update'); + }, + onUpdateComponent: function (debugID) { + checkDebugID(debugID); + markEnd(debugID, 'update'); + emitEvent('onUpdateComponent', debugID); + }, + onBeforeUnmountComponent: function (debugID) { + checkDebugID(debugID); + emitEvent('onBeforeUnmountComponent', debugID); + markBegin(debugID, 'unmount'); + }, + onUnmountComponent: function (debugID) { + checkDebugID(debugID); + markEnd(debugID, 'unmount'); + emitEvent('onUnmountComponent', debugID); + }, + onTestEvent: function () { + emitEvent('onTestEvent'); + } +}; + +// TODO remove these when RN/www gets updated +ReactDebugTool.addDevtool = ReactDebugTool.addHook; +ReactDebugTool.removeDevtool = ReactDebugTool.removeHook; + +ReactDebugTool.addHook(ReactInvalidSetStateWarningHook); +ReactDebugTool.addHook(ReactComponentTreeHook); +var url = ExecutionEnvironment.canUseDOM && window.location.href || ''; +if (/[?&]react_perf\b/.test(url)) { + ReactDebugTool.beginProfiling(); +} + +module.exports = ReactDebugTool; + +/***/ }), +/* 119 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2016-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var warning = __webpack_require__(1); + +if (process.env.NODE_ENV !== 'production') { + var processingChildContext = false; + + var warnInvalidSetState = function () { + process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0; + }; +} + +var ReactInvalidSetStateWarningHook = { + onBeginProcessingChildContext: function () { + processingChildContext = true; + }, + onEndProcessingChildContext: function () { + processingChildContext = false; + }, + onSetState: function () { + warnInvalidSetState(); + } +}; + +module.exports = ReactInvalidSetStateWarningHook; + +/***/ }), +/* 120 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2016-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var history = []; + +var ReactHostOperationHistoryHook = { + onHostOperation: function (operation) { + history.push(operation); + }, + clearHistory: function () { + if (ReactHostOperationHistoryHook._preventClearing) { + // Should only be used for tests. + return; + } + + history = []; + }, + getHistory: function () { + return history; + } +}; + +module.exports = ReactHostOperationHistoryHook; + +/***/ }), +/* 121 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +var performance = __webpack_require__(122); + +var performanceNow; + +/** + * Detect if we can use `window.performance.now()` and gracefully fallback to + * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now + * because of Facebook's testing infrastructure. + */ +if (performance.now) { + performanceNow = function performanceNow() { + return performance.now(); + }; +} else { + performanceNow = function performanceNow() { + return Date.now(); + }; +} + +module.exports = performanceNow; + +/***/ }), +/* 122 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + + + +var ExecutionEnvironment = __webpack_require__(5); + +var performance; + +if (ExecutionEnvironment.canUseDOM) { + performance = window.performance || window.msPerformance || window.webkitPerformance; +} + +module.exports = performance || {}; + +/***/ }), +/* 123 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * Module that is injectable into `EventPluginHub`, that specifies a + * deterministic ordering of `EventPlugin`s. A convenient way to reason about + * plugins, without having to package every one of them. This is better than + * having plugins be ordered in the same order that they are injected because + * that ordering would be influenced by the packaging order. + * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that + * preventing default on events is convenient in `SimpleEventPlugin` handlers. + */ + +var DefaultEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; + +module.exports = DefaultEventPluginOrder; + +/***/ }), +/* 124 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var EventPropagators = __webpack_require__(20); +var ReactDOMComponentTree = __webpack_require__(4); +var SyntheticMouseEvent = __webpack_require__(28); + +var eventTypes = { + mouseEnter: { + registrationName: 'onMouseEnter', + dependencies: ['topMouseOut', 'topMouseOver'] + }, + mouseLeave: { + registrationName: 'onMouseLeave', + dependencies: ['topMouseOut', 'topMouseOver'] + } +}; + +var EnterLeaveEventPlugin = { + eventTypes: eventTypes, + + /** + * For almost every interaction we care about, there will be both a top-level + * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that + * we do not extract duplicate events. However, moving the mouse into the + * browser from outside will not fire a `mouseout` event. In this case, we use + * the `mouseover` top-level event. + */ + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { + return null; + } + if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') { + // Must not be a mouse in or mouse out - ignoring. + return null; + } + + var win; + if (nativeEventTarget.window === nativeEventTarget) { + // `nativeEventTarget` is probably a window object. + win = nativeEventTarget; + } else { + // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. + var doc = nativeEventTarget.ownerDocument; + if (doc) { + win = doc.defaultView || doc.parentWindow; + } else { + win = window; + } + } + + var from; + var to; + if (topLevelType === 'topMouseOut') { + from = targetInst; + var related = nativeEvent.relatedTarget || nativeEvent.toElement; + to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null; + } else { + // Moving to a node from outside the window. + from = null; + to = targetInst; + } + + if (from === to) { + // Nothing pertains to our managed components. + return null; + } + + var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from); + var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to); + + var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget); + leave.type = 'mouseleave'; + leave.target = fromNode; + leave.relatedTarget = toNode; + + var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget); + enter.type = 'mouseenter'; + enter.target = toNode; + enter.relatedTarget = fromNode; + + EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to); + + return [leave, enter]; + } +}; + +module.exports = EnterLeaveEventPlugin; + +/***/ }), +/* 125 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMProperty = __webpack_require__(12); + +var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; +var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; +var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; +var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; +var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; + +var HTMLDOMPropertyConfig = { + isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')), + Properties: { + /** + * Standard Properties + */ + accept: 0, + acceptCharset: 0, + accessKey: 0, + action: 0, + allowFullScreen: HAS_BOOLEAN_VALUE, + allowTransparency: 0, + alt: 0, + // specifies target context for links with `preload` type + as: 0, + async: HAS_BOOLEAN_VALUE, + autoComplete: 0, + // autoFocus is polyfilled/normalized by AutoFocusUtils + // autoFocus: HAS_BOOLEAN_VALUE, + autoPlay: HAS_BOOLEAN_VALUE, + capture: HAS_BOOLEAN_VALUE, + cellPadding: 0, + cellSpacing: 0, + charSet: 0, + challenge: 0, + checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + cite: 0, + classID: 0, + className: 0, + cols: HAS_POSITIVE_NUMERIC_VALUE, + colSpan: 0, + content: 0, + contentEditable: 0, + contextMenu: 0, + controls: HAS_BOOLEAN_VALUE, + controlsList: 0, + coords: 0, + crossOrigin: 0, + data: 0, // For `<object />` acts as `src`. + dateTime: 0, + 'default': HAS_BOOLEAN_VALUE, + defer: HAS_BOOLEAN_VALUE, + dir: 0, + disabled: HAS_BOOLEAN_VALUE, + download: HAS_OVERLOADED_BOOLEAN_VALUE, + draggable: 0, + encType: 0, + form: 0, + formAction: 0, + formEncType: 0, + formMethod: 0, + formNoValidate: HAS_BOOLEAN_VALUE, + formTarget: 0, + frameBorder: 0, + headers: 0, + height: 0, + hidden: HAS_BOOLEAN_VALUE, + high: 0, + href: 0, + hrefLang: 0, + htmlFor: 0, + httpEquiv: 0, + icon: 0, + id: 0, + inputMode: 0, + integrity: 0, + is: 0, + keyParams: 0, + keyType: 0, + kind: 0, + label: 0, + lang: 0, + list: 0, + loop: HAS_BOOLEAN_VALUE, + low: 0, + manifest: 0, + marginHeight: 0, + marginWidth: 0, + max: 0, + maxLength: 0, + media: 0, + mediaGroup: 0, + method: 0, + min: 0, + minLength: 0, + // Caution; `option.selected` is not updated if `select.multiple` is + // disabled with `removeAttribute`. + multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + name: 0, + nonce: 0, + noValidate: HAS_BOOLEAN_VALUE, + open: HAS_BOOLEAN_VALUE, + optimum: 0, + pattern: 0, + placeholder: 0, + playsInline: HAS_BOOLEAN_VALUE, + poster: 0, + preload: 0, + profile: 0, + radioGroup: 0, + readOnly: HAS_BOOLEAN_VALUE, + referrerPolicy: 0, + rel: 0, + required: HAS_BOOLEAN_VALUE, + reversed: HAS_BOOLEAN_VALUE, + role: 0, + rows: HAS_POSITIVE_NUMERIC_VALUE, + rowSpan: HAS_NUMERIC_VALUE, + sandbox: 0, + scope: 0, + scoped: HAS_BOOLEAN_VALUE, + scrolling: 0, + seamless: HAS_BOOLEAN_VALUE, + selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + shape: 0, + size: HAS_POSITIVE_NUMERIC_VALUE, + sizes: 0, + span: HAS_POSITIVE_NUMERIC_VALUE, + spellCheck: 0, + src: 0, + srcDoc: 0, + srcLang: 0, + srcSet: 0, + start: HAS_NUMERIC_VALUE, + step: 0, + style: 0, + summary: 0, + tabIndex: 0, + target: 0, + title: 0, + // Setting .type throws on non-<input> tags + type: 0, + useMap: 0, + value: 0, + width: 0, + wmode: 0, + wrap: 0, + + /** + * RDFa Properties + */ + about: 0, + datatype: 0, + inlist: 0, + prefix: 0, + // property is also supported for OpenGraph in meta tags. + property: 0, + resource: 0, + 'typeof': 0, + vocab: 0, + + /** + * Non-standard Properties + */ + // autoCapitalize and autoCorrect are supported in Mobile Safari for + // keyboard hints. + autoCapitalize: 0, + autoCorrect: 0, + // autoSave allows WebKit/Blink to persist values of input fields on page reloads + autoSave: 0, + // color is for Safari mask-icon link + color: 0, + // itemProp, itemScope, itemType are for + // Microdata support. See http://schema.org/docs/gs.html + itemProp: 0, + itemScope: HAS_BOOLEAN_VALUE, + itemType: 0, + // itemID and itemRef are for Microdata support as well but + // only specified in the WHATWG spec document. See + // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api + itemID: 0, + itemRef: 0, + // results show looking glass icon and recent searches on input + // search fields in WebKit/Blink + results: 0, + // IE-only attribute that specifies security restrictions on an iframe + // as an alternative to the sandbox attribute on IE<10 + security: 0, + // IE-only attribute that controls focus behavior + unselectable: 0 + }, + DOMAttributeNames: { + acceptCharset: 'accept-charset', + className: 'class', + htmlFor: 'for', + httpEquiv: 'http-equiv' + }, + DOMPropertyNames: {}, + DOMMutationMethods: { + value: function (node, value) { + if (value == null) { + return node.removeAttribute('value'); + } + + // Number inputs get special treatment due to some edge cases in + // Chrome. Let everything else assign the value attribute as normal. + // https://github.com/facebook/react/issues/7253#issuecomment-236074326 + if (node.type !== 'number' || node.hasAttribute('value') === false) { + node.setAttribute('value', '' + value); + } else if (node.validity && !node.validity.badInput && node.ownerDocument.activeElement !== node) { + // Don't assign an attribute if validation reports bad + // input. Chrome will clear the value. Additionally, don't + // operate on inputs that have focus, otherwise Chrome might + // strip off trailing decimal places and cause the user's + // cursor position to jump to the beginning of the input. + // + // In ReactDOMInput, we have an onBlur event that will trigger + // this function again when focus is lost. + node.setAttribute('value', '' + value); + } + } + } +}; + +module.exports = HTMLDOMPropertyConfig; + +/***/ }), +/* 126 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMChildrenOperations = __webpack_require__(40); +var ReactDOMIDOperations = __webpack_require__(131); + +/** + * Abstracts away all functionality of the reconciler that requires knowledge of + * the browser context. TODO: These callers should be refactored to avoid the + * need for this injection. + */ +var ReactComponentBrowserEnvironment = { + processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, + + replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup +}; + +module.exports = ReactComponentBrowserEnvironment; + +/***/ }), +/* 127 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var DOMLazyTree = __webpack_require__(18); +var ExecutionEnvironment = __webpack_require__(5); + +var createNodesFromMarkup = __webpack_require__(128); +var emptyFunction = __webpack_require__(7); +var invariant = __webpack_require__(0); + +var Danger = { + /** + * Replaces a node with a string of markup at its current position within its + * parent. The markup must render into a single root node. + * + * @param {DOMElement} oldChild Child node to replace. + * @param {string} markup Markup to render in place of the child node. + * @internal + */ + dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) { + !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('56') : void 0; + !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0; + !(oldChild.nodeName !== 'HTML') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the <html> node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString().') : _prodInvariant('58') : void 0; + + if (typeof markup === 'string') { + var newChild = createNodesFromMarkup(markup, emptyFunction)[0]; + oldChild.parentNode.replaceChild(newChild, oldChild); + } else { + DOMLazyTree.replaceChildWithTree(oldChild, markup); + } + } +}; + +module.exports = Danger; + +/***/ }), +/* 128 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +/*eslint-disable fb-www/unsafe-html*/ + +var ExecutionEnvironment = __webpack_require__(5); + +var createArrayFromMixed = __webpack_require__(129); +var getMarkupWrap = __webpack_require__(130); +var invariant = __webpack_require__(0); + +/** + * Dummy container used to render all markup. + */ +var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; + +/** + * Pattern used by `getNodeName`. + */ +var nodeNamePattern = /^\s*<(\w+)/; + +/** + * Extracts the `nodeName` of the first element in a string of markup. + * + * @param {string} markup String of markup. + * @return {?string} Node name of the supplied markup. + */ +function getNodeName(markup) { + var nodeNameMatch = markup.match(nodeNamePattern); + return nodeNameMatch && nodeNameMatch[1].toLowerCase(); +} + +/** + * Creates an array containing the nodes rendered from the supplied markup. The + * optionally supplied `handleScript` function will be invoked once for each + * <script> element that is rendered. If no `handleScript` function is supplied, + * an exception is thrown if any <script> elements are rendered. + * + * @param {string} markup A string of valid HTML markup. + * @param {?function} handleScript Invoked once for each rendered <script>. + * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes. + */ +function createNodesFromMarkup(markup, handleScript) { + var node = dummyNode; + !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0; + var nodeName = getNodeName(markup); + + var wrap = nodeName && getMarkupWrap(nodeName); + if (wrap) { + node.innerHTML = wrap[1] + markup + wrap[2]; + + var wrapDepth = wrap[0]; + while (wrapDepth--) { + node = node.lastChild; + } + } else { + node.innerHTML = markup; + } + + var scripts = node.getElementsByTagName('script'); + if (scripts.length) { + !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : void 0; + createArrayFromMixed(scripts).forEach(handleScript); + } + + var nodes = Array.from(node.childNodes); + while (node.lastChild) { + node.removeChild(node.lastChild); + } + return nodes; +} + +module.exports = createNodesFromMarkup; + +/***/ }), +/* 129 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +var invariant = __webpack_require__(0); + +/** + * Convert array-like objects to arrays. + * + * This API assumes the caller knows the contents of the data type. For less + * well defined inputs use createArrayFromMixed. + * + * @param {object|function|filelist} obj + * @return {array} + */ +function toArray(obj) { + var length = obj.length; + + // Some browsers builtin objects can report typeof 'function' (e.g. NodeList + // in old versions of Safari). + !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0; + + !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; + + !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; + + !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; + + // Old IE doesn't give collections access to hasOwnProperty. Assume inputs + // without method will throw during the slice call and skip straight to the + // fallback. + if (obj.hasOwnProperty) { + try { + return Array.prototype.slice.call(obj); + } catch (e) { + // IE < 9 does not support Array#slice on collections objects + } + } + + // Fall back to copying key by key. This assumes all keys have a value, + // so will not preserve sparsely populated inputs. + var ret = Array(length); + for (var ii = 0; ii < length; ii++) { + ret[ii] = obj[ii]; + } + return ret; +} + +/** + * Perform a heuristic test to determine if an object is "array-like". + * + * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" + * Joshu replied: "Mu." + * + * This function determines if its argument has "array nature": it returns + * true if the argument is an actual array, an `arguments' object, or an + * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). + * + * It will return false for other array-like objects like Filelist. + * + * @param {*} obj + * @return {boolean} + */ +function hasArrayNature(obj) { + return ( + // not null/false + !!obj && ( + // arrays are objects, NodeLists are functions in Safari + typeof obj == 'object' || typeof obj == 'function') && + // quacks like an array + 'length' in obj && + // not window + !('setInterval' in obj) && + // no DOM node should be considered an array-like + // a 'select' element has 'length' and 'item' properties on IE8 + typeof obj.nodeType != 'number' && ( + // a real array + Array.isArray(obj) || + // arguments + 'callee' in obj || + // HTMLCollection/NodeList + 'item' in obj) + ); +} + +/** + * Ensure that the argument is an array by wrapping it in an array if it is not. + * Creates a copy of the argument if it is already an array. + * + * This is mostly useful idiomatically: + * + * var createArrayFromMixed = require('createArrayFromMixed'); + * + * function takesOneOrMoreThings(things) { + * things = createArrayFromMixed(things); + * ... + * } + * + * This allows you to treat `things' as an array, but accept scalars in the API. + * + * If you need to convert an array-like object, like `arguments`, into an array + * use toArray instead. + * + * @param {*} obj + * @return {array} + */ +function createArrayFromMixed(obj) { + if (!hasArrayNature(obj)) { + return [obj]; + } else if (Array.isArray(obj)) { + return obj.slice(); + } else { + return toArray(obj); + } +} + +module.exports = createArrayFromMixed; + +/***/ }), +/* 130 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +/*eslint-disable fb-www/unsafe-html */ + +var ExecutionEnvironment = __webpack_require__(5); + +var invariant = __webpack_require__(0); + +/** + * Dummy container used to detect which wraps are necessary. + */ +var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; + +/** + * Some browsers cannot use `innerHTML` to render certain elements standalone, + * so we wrap them, render the wrapped nodes, then extract the desired node. + * + * In IE8, certain elements cannot render alone, so wrap all elements ('*'). + */ + +var shouldWrap = {}; + +var selectWrap = [1, '<select multiple="true">', '</select>']; +var tableWrap = [1, '<table>', '</table>']; +var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>']; + +var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>']; + +var markupWrap = { + '*': [1, '?<div>', '</div>'], + + 'area': [1, '<map>', '</map>'], + 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'], + 'legend': [1, '<fieldset>', '</fieldset>'], + 'param': [1, '<object>', '</object>'], + 'tr': [2, '<table><tbody>', '</tbody></table>'], + + 'optgroup': selectWrap, + 'option': selectWrap, + + 'caption': tableWrap, + 'colgroup': tableWrap, + 'tbody': tableWrap, + 'tfoot': tableWrap, + 'thead': tableWrap, + + 'td': trWrap, + 'th': trWrap +}; + +// Initialize the SVG elements since we know they'll always need to be wrapped +// consistently. If they are created inside a <div> they will be initialized in +// the wrong namespace (and will not display). +var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan']; +svgElements.forEach(function (nodeName) { + markupWrap[nodeName] = svgWrap; + shouldWrap[nodeName] = true; +}); + +/** + * Gets the markup wrap configuration for the supplied `nodeName`. + * + * NOTE: This lazily detects which wraps are necessary for the current browser. + * + * @param {string} nodeName Lowercase `nodeName`. + * @return {?array} Markup wrap configuration, if applicable. + */ +function getMarkupWrap(nodeName) { + !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0; + if (!markupWrap.hasOwnProperty(nodeName)) { + nodeName = '*'; + } + if (!shouldWrap.hasOwnProperty(nodeName)) { + if (nodeName === '*') { + dummyNode.innerHTML = '<link />'; + } else { + dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>'; + } + shouldWrap[nodeName] = !dummyNode.firstChild; + } + return shouldWrap[nodeName] ? markupWrap[nodeName] : null; +} + +module.exports = getMarkupWrap; + +/***/ }), +/* 131 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMChildrenOperations = __webpack_require__(40); +var ReactDOMComponentTree = __webpack_require__(4); + +/** + * Operations used to process updates to DOM nodes. + */ +var ReactDOMIDOperations = { + /** + * Updates a component's children by processing a series of updates. + * + * @param {array<object>} updates List of update configurations. + * @internal + */ + dangerouslyProcessChildrenUpdates: function (parentInst, updates) { + var node = ReactDOMComponentTree.getNodeFromInstance(parentInst); + DOMChildrenOperations.processUpdates(node, updates); + } +}; + +module.exports = ReactDOMIDOperations; + +/***/ }), +/* 132 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + +/* global hasOwnProperty:true */ + + + +var _prodInvariant = __webpack_require__(2), + _assign = __webpack_require__(3); + +var AutoFocusUtils = __webpack_require__(133); +var CSSPropertyOperations = __webpack_require__(134); +var DOMLazyTree = __webpack_require__(18); +var DOMNamespaces = __webpack_require__(41); +var DOMProperty = __webpack_require__(12); +var DOMPropertyOperations = __webpack_require__(71); +var EventPluginHub = __webpack_require__(21); +var EventPluginRegistry = __webpack_require__(26); +var ReactBrowserEventEmitter = __webpack_require__(31); +var ReactDOMComponentFlags = __webpack_require__(59); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactDOMInput = __webpack_require__(144); +var ReactDOMOption = __webpack_require__(145); +var ReactDOMSelect = __webpack_require__(73); +var ReactDOMTextarea = __webpack_require__(146); +var ReactInstrumentation = __webpack_require__(8); +var ReactMultiChild = __webpack_require__(147); +var ReactServerRenderingTransaction = __webpack_require__(156); + +var emptyFunction = __webpack_require__(7); +var escapeTextContentForBrowser = __webpack_require__(30); +var invariant = __webpack_require__(0); +var isEventSupported = __webpack_require__(38); +var shallowEqual = __webpack_require__(45); +var inputValueTracking = __webpack_require__(65); +var validateDOMNesting = __webpack_require__(49); +var warning = __webpack_require__(1); + +var Flags = ReactDOMComponentFlags; +var deleteListener = EventPluginHub.deleteListener; +var getNode = ReactDOMComponentTree.getNodeFromInstance; +var listenTo = ReactBrowserEventEmitter.listenTo; +var registrationNameModules = EventPluginRegistry.registrationNameModules; + +// For quickly matching children type, to test if can be treated as content. +var CONTENT_TYPES = { string: true, number: true }; + +var STYLE = 'style'; +var HTML = '__html'; +var RESERVED_PROPS = { + children: null, + dangerouslySetInnerHTML: null, + suppressContentEditableWarning: null +}; + +// Node type for document fragments (Node.DOCUMENT_FRAGMENT_NODE). +var DOC_FRAGMENT_TYPE = 11; + +function getDeclarationErrorAddendum(internalInstance) { + if (internalInstance) { + var owner = internalInstance._currentElement._owner || null; + if (owner) { + var name = owner.getName(); + if (name) { + return ' This DOM node was rendered by `' + name + '`.'; + } + } + } + return ''; +} + +function friendlyStringify(obj) { + if (typeof obj === 'object') { + if (Array.isArray(obj)) { + return '[' + obj.map(friendlyStringify).join(', ') + ']'; + } else { + var pairs = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key); + pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key])); + } + } + return '{' + pairs.join(', ') + '}'; + } + } else if (typeof obj === 'string') { + return JSON.stringify(obj); + } else if (typeof obj === 'function') { + return '[function object]'; + } + // Differs from JSON.stringify in that undefined because undefined and that + // inf and nan don't become null + return String(obj); +} + +var styleMutationWarning = {}; + +function checkAndWarnForMutatedStyle(style1, style2, component) { + if (style1 == null || style2 == null) { + return; + } + if (shallowEqual(style1, style2)) { + return; + } + + var componentName = component._tag; + var owner = component._currentElement._owner; + var ownerName; + if (owner) { + ownerName = owner.getName(); + } + + var hash = ownerName + '|' + componentName; + + if (styleMutationWarning.hasOwnProperty(hash)) { + return; + } + + styleMutationWarning[hash] = true; + + process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : void 0; +} + +/** + * @param {object} component + * @param {?object} props + */ +function assertValidProps(component, props) { + if (!props) { + return; + } + // Note the use of `==` which checks for null or undefined. + if (voidElementTags[component._tag]) { + !(props.children == null && props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : _prodInvariant('137', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : void 0; + } + if (props.dangerouslySetInnerHTML != null) { + !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : _prodInvariant('60') : void 0; + !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : _prodInvariant('61') : void 0; + } + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : void 0; + process.env.NODE_ENV !== 'production' ? warning(props.suppressContentEditableWarning || !props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0; + process.env.NODE_ENV !== 'production' ? warning(props.onFocusIn == null && props.onFocusOut == null, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.') : void 0; + } + !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getDeclarationErrorAddendum(component)) : _prodInvariant('62', getDeclarationErrorAddendum(component)) : void 0; +} + +function enqueuePutListener(inst, registrationName, listener, transaction) { + if (transaction instanceof ReactServerRenderingTransaction) { + return; + } + if (process.env.NODE_ENV !== 'production') { + // IE8 has no API for event capturing and the `onScroll` event doesn't + // bubble. + process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), "This browser doesn't support the `onScroll` event") : void 0; + } + var containerInfo = inst._hostContainerInfo; + var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE; + var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument; + listenTo(registrationName, doc); + transaction.getReactMountReady().enqueue(putListener, { + inst: inst, + registrationName: registrationName, + listener: listener + }); +} + +function putListener() { + var listenerToPut = this; + EventPluginHub.putListener(listenerToPut.inst, listenerToPut.registrationName, listenerToPut.listener); +} + +function inputPostMount() { + var inst = this; + ReactDOMInput.postMountWrapper(inst); +} + +function textareaPostMount() { + var inst = this; + ReactDOMTextarea.postMountWrapper(inst); +} + +function optionPostMount() { + var inst = this; + ReactDOMOption.postMountWrapper(inst); +} + +var setAndValidateContentChildDev = emptyFunction; +if (process.env.NODE_ENV !== 'production') { + setAndValidateContentChildDev = function (content) { + var hasExistingContent = this._contentDebugID != null; + var debugID = this._debugID; + // This ID represents the inlined child that has no backing instance: + var contentDebugID = -debugID; + + if (content == null) { + if (hasExistingContent) { + ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID); + } + this._contentDebugID = null; + return; + } + + validateDOMNesting(null, String(content), this, this._ancestorInfo); + this._contentDebugID = contentDebugID; + if (hasExistingContent) { + ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content); + ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID); + } else { + ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID); + ReactInstrumentation.debugTool.onMountComponent(contentDebugID); + ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]); + } + }; +} + +// There are so many media events, it makes sense to just +// maintain a list rather than create a `trapBubbledEvent` for each +var mediaEvents = { + topAbort: 'abort', + topCanPlay: 'canplay', + topCanPlayThrough: 'canplaythrough', + topDurationChange: 'durationchange', + topEmptied: 'emptied', + topEncrypted: 'encrypted', + topEnded: 'ended', + topError: 'error', + topLoadedData: 'loadeddata', + topLoadedMetadata: 'loadedmetadata', + topLoadStart: 'loadstart', + topPause: 'pause', + topPlay: 'play', + topPlaying: 'playing', + topProgress: 'progress', + topRateChange: 'ratechange', + topSeeked: 'seeked', + topSeeking: 'seeking', + topStalled: 'stalled', + topSuspend: 'suspend', + topTimeUpdate: 'timeupdate', + topVolumeChange: 'volumechange', + topWaiting: 'waiting' +}; + +function trackInputValue() { + inputValueTracking.track(this); +} + +function trapBubbledEventsLocal() { + var inst = this; + // If a component renders to null or if another component fatals and causes + // the state of the tree to be corrupted, `node` here can be null. + !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : _prodInvariant('63') : void 0; + var node = getNode(inst); + !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : _prodInvariant('64') : void 0; + + switch (inst._tag) { + case 'iframe': + case 'object': + inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)]; + break; + case 'video': + case 'audio': + inst._wrapperState.listeners = []; + // Create listener for each media event + for (var event in mediaEvents) { + if (mediaEvents.hasOwnProperty(event)) { + inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(event, mediaEvents[event], node)); + } + } + break; + case 'source': + inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node)]; + break; + case 'img': + inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topError', 'error', node), ReactBrowserEventEmitter.trapBubbledEvent('topLoad', 'load', node)]; + break; + case 'form': + inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topReset', 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent('topSubmit', 'submit', node)]; + break; + case 'input': + case 'select': + case 'textarea': + inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent('topInvalid', 'invalid', node)]; + break; + } +} + +function postUpdateSelectWrapper() { + ReactDOMSelect.postUpdateWrapper(this); +} + +// For HTML, certain tags should omit their close tag. We keep a whitelist for +// those special-case tags. + +var omittedCloseTags = { + area: true, + base: true, + br: true, + col: true, + embed: true, + hr: true, + img: true, + input: true, + keygen: true, + link: true, + meta: true, + param: true, + source: true, + track: true, + wbr: true + // NOTE: menuitem's close tag should be omitted, but that causes problems. +}; + +var newlineEatingTags = { + listing: true, + pre: true, + textarea: true +}; + +// For HTML, certain tags cannot have children. This has the same purpose as +// `omittedCloseTags` except that `menuitem` should still have its closing tag. + +var voidElementTags = _assign({ + menuitem: true +}, omittedCloseTags); + +// We accept any tag to be rendered but since this gets injected into arbitrary +// HTML, we want to make sure that it's a safe tag. +// http://www.w3.org/TR/REC-xml/#NT-Name + +var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset +var validatedTagCache = {}; +var hasOwnProperty = {}.hasOwnProperty; + +function validateDangerousTag(tag) { + if (!hasOwnProperty.call(validatedTagCache, tag)) { + !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : _prodInvariant('65', tag) : void 0; + validatedTagCache[tag] = true; + } +} + +function isCustomComponent(tagName, props) { + return tagName.indexOf('-') >= 0 || props.is != null; +} + +var globalIdCounter = 1; + +/** + * Creates a new React class that is idempotent and capable of containing other + * React components. It accepts event listeners and DOM properties that are + * valid according to `DOMProperty`. + * + * - Event listeners: `onClick`, `onMouseDown`, etc. + * - DOM properties: `className`, `name`, `title`, etc. + * + * The `style` property functions differently from the DOM API. It accepts an + * object mapping of style properties to values. + * + * @constructor ReactDOMComponent + * @extends ReactMultiChild + */ +function ReactDOMComponent(element) { + var tag = element.type; + validateDangerousTag(tag); + this._currentElement = element; + this._tag = tag.toLowerCase(); + this._namespaceURI = null; + this._renderedChildren = null; + this._previousStyle = null; + this._previousStyleCopy = null; + this._hostNode = null; + this._hostParent = null; + this._rootNodeID = 0; + this._domID = 0; + this._hostContainerInfo = null; + this._wrapperState = null; + this._topLevelWrapper = null; + this._flags = 0; + if (process.env.NODE_ENV !== 'production') { + this._ancestorInfo = null; + setAndValidateContentChildDev.call(this, null); + } +} + +ReactDOMComponent.displayName = 'ReactDOMComponent'; + +ReactDOMComponent.Mixin = { + /** + * Generates root tag markup then recurses. This method has side effects and + * is not idempotent. + * + * @internal + * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction + * @param {?ReactDOMComponent} the parent component instance + * @param {?object} info about the host container + * @param {object} context + * @return {string} The computed markup. + */ + mountComponent: function (transaction, hostParent, hostContainerInfo, context) { + this._rootNodeID = globalIdCounter++; + this._domID = hostContainerInfo._idCounter++; + this._hostParent = hostParent; + this._hostContainerInfo = hostContainerInfo; + + var props = this._currentElement.props; + + switch (this._tag) { + case 'audio': + case 'form': + case 'iframe': + case 'img': + case 'link': + case 'object': + case 'source': + case 'video': + this._wrapperState = { + listeners: null + }; + transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); + break; + case 'input': + ReactDOMInput.mountWrapper(this, props, hostParent); + props = ReactDOMInput.getHostProps(this, props); + transaction.getReactMountReady().enqueue(trackInputValue, this); + transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); + break; + case 'option': + ReactDOMOption.mountWrapper(this, props, hostParent); + props = ReactDOMOption.getHostProps(this, props); + break; + case 'select': + ReactDOMSelect.mountWrapper(this, props, hostParent); + props = ReactDOMSelect.getHostProps(this, props); + transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); + break; + case 'textarea': + ReactDOMTextarea.mountWrapper(this, props, hostParent); + props = ReactDOMTextarea.getHostProps(this, props); + transaction.getReactMountReady().enqueue(trackInputValue, this); + transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this); + break; + } + + assertValidProps(this, props); + + // We create tags in the namespace of their parent container, except HTML + // tags get no namespace. + var namespaceURI; + var parentTag; + if (hostParent != null) { + namespaceURI = hostParent._namespaceURI; + parentTag = hostParent._tag; + } else if (hostContainerInfo._tag) { + namespaceURI = hostContainerInfo._namespaceURI; + parentTag = hostContainerInfo._tag; + } + if (namespaceURI == null || namespaceURI === DOMNamespaces.svg && parentTag === 'foreignobject') { + namespaceURI = DOMNamespaces.html; + } + if (namespaceURI === DOMNamespaces.html) { + if (this._tag === 'svg') { + namespaceURI = DOMNamespaces.svg; + } else if (this._tag === 'math') { + namespaceURI = DOMNamespaces.mathml; + } + } + this._namespaceURI = namespaceURI; + + if (process.env.NODE_ENV !== 'production') { + var parentInfo; + if (hostParent != null) { + parentInfo = hostParent._ancestorInfo; + } else if (hostContainerInfo._tag) { + parentInfo = hostContainerInfo._ancestorInfo; + } + if (parentInfo) { + // parentInfo should always be present except for the top-level + // component when server rendering + validateDOMNesting(this._tag, null, this, parentInfo); + } + this._ancestorInfo = validateDOMNesting.updatedAncestorInfo(parentInfo, this._tag, this); + } + + var mountImage; + if (transaction.useCreateElement) { + var ownerDocument = hostContainerInfo._ownerDocument; + var el; + if (namespaceURI === DOMNamespaces.html) { + if (this._tag === 'script') { + // Create the script via .innerHTML so its "parser-inserted" flag is + // set to true and it does not execute + var div = ownerDocument.createElement('div'); + var type = this._currentElement.type; + div.innerHTML = '<' + type + '></' + type + '>'; + el = div.removeChild(div.firstChild); + } else if (props.is) { + el = ownerDocument.createElement(this._currentElement.type, props.is); + } else { + // Separate else branch instead of using `props.is || undefined` above becuase of a Firefox bug. + // See discussion in https://github.com/facebook/react/pull/6896 + // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 + el = ownerDocument.createElement(this._currentElement.type); + } + } else { + el = ownerDocument.createElementNS(namespaceURI, this._currentElement.type); + } + ReactDOMComponentTree.precacheNode(this, el); + this._flags |= Flags.hasCachedChildNodes; + if (!this._hostParent) { + DOMPropertyOperations.setAttributeForRoot(el); + } + this._updateDOMProperties(null, props, transaction); + var lazyTree = DOMLazyTree(el); + this._createInitialChildren(transaction, props, context, lazyTree); + mountImage = lazyTree; + } else { + var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props); + var tagContent = this._createContentMarkup(transaction, props, context); + if (!tagContent && omittedCloseTags[this._tag]) { + mountImage = tagOpen + '/>'; + } else { + mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>'; + } + } + + switch (this._tag) { + case 'input': + transaction.getReactMountReady().enqueue(inputPostMount, this); + if (props.autoFocus) { + transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); + } + break; + case 'textarea': + transaction.getReactMountReady().enqueue(textareaPostMount, this); + if (props.autoFocus) { + transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); + } + break; + case 'select': + if (props.autoFocus) { + transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); + } + break; + case 'button': + if (props.autoFocus) { + transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this); + } + break; + case 'option': + transaction.getReactMountReady().enqueue(optionPostMount, this); + break; + } + + return mountImage; + }, + + /** + * Creates markup for the open tag and all attributes. + * + * This method has side effects because events get registered. + * + * Iterating over object properties is faster than iterating over arrays. + * @see http://jsperf.com/obj-vs-arr-iteration + * + * @private + * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction + * @param {object} props + * @return {string} Markup of opening tag. + */ + _createOpenTagMarkupAndPutListeners: function (transaction, props) { + var ret = '<' + this._currentElement.type; + + for (var propKey in props) { + if (!props.hasOwnProperty(propKey)) { + continue; + } + var propValue = props[propKey]; + if (propValue == null) { + continue; + } + if (registrationNameModules.hasOwnProperty(propKey)) { + if (propValue) { + enqueuePutListener(this, propKey, propValue, transaction); + } + } else { + if (propKey === STYLE) { + if (propValue) { + if (process.env.NODE_ENV !== 'production') { + // See `_updateDOMProperties`. style block + this._previousStyle = propValue; + } + propValue = this._previousStyleCopy = _assign({}, props.style); + } + propValue = CSSPropertyOperations.createMarkupForStyles(propValue, this); + } + var markup = null; + if (this._tag != null && isCustomComponent(this._tag, props)) { + if (!RESERVED_PROPS.hasOwnProperty(propKey)) { + markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue); + } + } else { + markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue); + } + if (markup) { + ret += ' ' + markup; + } + } + } + + // For static pages, no need to put React ID and checksum. Saves lots of + // bytes. + if (transaction.renderToStaticMarkup) { + return ret; + } + + if (!this._hostParent) { + ret += ' ' + DOMPropertyOperations.createMarkupForRoot(); + } + ret += ' ' + DOMPropertyOperations.createMarkupForID(this._domID); + return ret; + }, + + /** + * Creates markup for the content between the tags. + * + * @private + * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction + * @param {object} props + * @param {object} context + * @return {string} Content markup. + */ + _createContentMarkup: function (transaction, props, context) { + var ret = ''; + + // Intentional use of != to avoid catching zero/false. + var innerHTML = props.dangerouslySetInnerHTML; + if (innerHTML != null) { + if (innerHTML.__html != null) { + ret = innerHTML.__html; + } + } else { + var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; + var childrenToUse = contentToUse != null ? null : props.children; + if (contentToUse != null) { + // TODO: Validate that text is allowed as a child of this node + ret = escapeTextContentForBrowser(contentToUse); + if (process.env.NODE_ENV !== 'production') { + setAndValidateContentChildDev.call(this, contentToUse); + } + } else if (childrenToUse != null) { + var mountImages = this.mountChildren(childrenToUse, transaction, context); + ret = mountImages.join(''); + } + } + if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') { + // text/html ignores the first character in these tags if it's a newline + // Prefer to break application/xml over text/html (for now) by adding + // a newline specifically to get eaten by the parser. (Alternately for + // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first + // \r is normalized out by HTMLTextAreaElement#value.) + // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre> + // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions> + // See: <http://www.w3.org/TR/html5/syntax.html#newlines> + // See: Parsing of "textarea" "listing" and "pre" elements + // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody> + return '\n' + ret; + } else { + return ret; + } + }, + + _createInitialChildren: function (transaction, props, context, lazyTree) { + // Intentional use of != to avoid catching zero/false. + var innerHTML = props.dangerouslySetInnerHTML; + if (innerHTML != null) { + if (innerHTML.__html != null) { + DOMLazyTree.queueHTML(lazyTree, innerHTML.__html); + } + } else { + var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null; + var childrenToUse = contentToUse != null ? null : props.children; + // TODO: Validate that text is allowed as a child of this node + if (contentToUse != null) { + // Avoid setting textContent when the text is empty. In IE11 setting + // textContent on a text area will cause the placeholder to not + // show within the textarea until it has been focused and blurred again. + // https://github.com/facebook/react/issues/6731#issuecomment-254874553 + if (contentToUse !== '') { + if (process.env.NODE_ENV !== 'production') { + setAndValidateContentChildDev.call(this, contentToUse); + } + DOMLazyTree.queueText(lazyTree, contentToUse); + } + } else if (childrenToUse != null) { + var mountImages = this.mountChildren(childrenToUse, transaction, context); + for (var i = 0; i < mountImages.length; i++) { + DOMLazyTree.queueChild(lazyTree, mountImages[i]); + } + } + } + }, + + /** + * Receives a next element and updates the component. + * + * @internal + * @param {ReactElement} nextElement + * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction + * @param {object} context + */ + receiveComponent: function (nextElement, transaction, context) { + var prevElement = this._currentElement; + this._currentElement = nextElement; + this.updateComponent(transaction, prevElement, nextElement, context); + }, + + /** + * Updates a DOM component after it has already been allocated and + * attached to the DOM. Reconciles the root DOM node, then recurses. + * + * @param {ReactReconcileTransaction} transaction + * @param {ReactElement} prevElement + * @param {ReactElement} nextElement + * @internal + * @overridable + */ + updateComponent: function (transaction, prevElement, nextElement, context) { + var lastProps = prevElement.props; + var nextProps = this._currentElement.props; + + switch (this._tag) { + case 'input': + lastProps = ReactDOMInput.getHostProps(this, lastProps); + nextProps = ReactDOMInput.getHostProps(this, nextProps); + break; + case 'option': + lastProps = ReactDOMOption.getHostProps(this, lastProps); + nextProps = ReactDOMOption.getHostProps(this, nextProps); + break; + case 'select': + lastProps = ReactDOMSelect.getHostProps(this, lastProps); + nextProps = ReactDOMSelect.getHostProps(this, nextProps); + break; + case 'textarea': + lastProps = ReactDOMTextarea.getHostProps(this, lastProps); + nextProps = ReactDOMTextarea.getHostProps(this, nextProps); + break; + } + + assertValidProps(this, nextProps); + this._updateDOMProperties(lastProps, nextProps, transaction); + this._updateDOMChildren(lastProps, nextProps, transaction, context); + + switch (this._tag) { + case 'input': + // Update the wrapper around inputs *after* updating props. This has to + // happen after `_updateDOMProperties`. Otherwise HTML5 input validations + // raise warnings and prevent the new value from being assigned. + ReactDOMInput.updateWrapper(this); + + // We also check that we haven't missed a value update, such as a + // Radio group shifting the checked value to another named radio input. + inputValueTracking.updateValueIfChanged(this); + break; + case 'textarea': + ReactDOMTextarea.updateWrapper(this); + break; + case 'select': + // <select> value update needs to occur after <option> children + // reconciliation + transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this); + break; + } + }, + + /** + * Reconciles the properties by detecting differences in property values and + * updating the DOM as necessary. This function is probably the single most + * critical path for performance optimization. + * + * TODO: Benchmark whether checking for changed values in memory actually + * improves performance (especially statically positioned elements). + * TODO: Benchmark the effects of putting this at the top since 99% of props + * do not change for a given reconciliation. + * TODO: Benchmark areas that can be improved with caching. + * + * @private + * @param {object} lastProps + * @param {object} nextProps + * @param {?DOMElement} node + */ + _updateDOMProperties: function (lastProps, nextProps, transaction) { + var propKey; + var styleName; + var styleUpdates; + for (propKey in lastProps) { + if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { + continue; + } + if (propKey === STYLE) { + var lastStyle = this._previousStyleCopy; + for (styleName in lastStyle) { + if (lastStyle.hasOwnProperty(styleName)) { + styleUpdates = styleUpdates || {}; + styleUpdates[styleName] = ''; + } + } + this._previousStyleCopy = null; + } else if (registrationNameModules.hasOwnProperty(propKey)) { + if (lastProps[propKey]) { + // Only call deleteListener if there was a listener previously or + // else willDeleteListener gets called when there wasn't actually a + // listener (e.g., onClick={null}) + deleteListener(this, propKey); + } + } else if (isCustomComponent(this._tag, lastProps)) { + if (!RESERVED_PROPS.hasOwnProperty(propKey)) { + DOMPropertyOperations.deleteValueForAttribute(getNode(this), propKey); + } + } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { + DOMPropertyOperations.deleteValueForProperty(getNode(this), propKey); + } + } + for (propKey in nextProps) { + var nextProp = nextProps[propKey]; + var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps != null ? lastProps[propKey] : undefined; + if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { + continue; + } + if (propKey === STYLE) { + if (nextProp) { + if (process.env.NODE_ENV !== 'production') { + checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this); + this._previousStyle = nextProp; + } + nextProp = this._previousStyleCopy = _assign({}, nextProp); + } else { + this._previousStyleCopy = null; + } + if (lastProp) { + // Unset styles on `lastProp` but not on `nextProp`. + for (styleName in lastProp) { + if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { + styleUpdates = styleUpdates || {}; + styleUpdates[styleName] = ''; + } + } + // Update styles that changed since `lastProp`. + for (styleName in nextProp) { + if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { + styleUpdates = styleUpdates || {}; + styleUpdates[styleName] = nextProp[styleName]; + } + } + } else { + // Relies on `updateStylesByID` not mutating `styleUpdates`. + styleUpdates = nextProp; + } + } else if (registrationNameModules.hasOwnProperty(propKey)) { + if (nextProp) { + enqueuePutListener(this, propKey, nextProp, transaction); + } else if (lastProp) { + deleteListener(this, propKey); + } + } else if (isCustomComponent(this._tag, nextProps)) { + if (!RESERVED_PROPS.hasOwnProperty(propKey)) { + DOMPropertyOperations.setValueForAttribute(getNode(this), propKey, nextProp); + } + } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) { + var node = getNode(this); + // If we're updating to null or undefined, we should remove the property + // from the DOM node instead of inadvertently setting to a string. This + // brings us in line with the same behavior we have on initial render. + if (nextProp != null) { + DOMPropertyOperations.setValueForProperty(node, propKey, nextProp); + } else { + DOMPropertyOperations.deleteValueForProperty(node, propKey); + } + } + } + if (styleUpdates) { + CSSPropertyOperations.setValueForStyles(getNode(this), styleUpdates, this); + } + }, + + /** + * Reconciles the children with the various properties that affect the + * children content. + * + * @param {object} lastProps + * @param {object} nextProps + * @param {ReactReconcileTransaction} transaction + * @param {object} context + */ + _updateDOMChildren: function (lastProps, nextProps, transaction, context) { + var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null; + var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null; + + var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html; + var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html; + + // Note the use of `!=` which checks for null or undefined. + var lastChildren = lastContent != null ? null : lastProps.children; + var nextChildren = nextContent != null ? null : nextProps.children; + + // If we're switching from children to content/html or vice versa, remove + // the old content + var lastHasContentOrHtml = lastContent != null || lastHtml != null; + var nextHasContentOrHtml = nextContent != null || nextHtml != null; + if (lastChildren != null && nextChildren == null) { + this.updateChildren(null, transaction, context); + } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { + this.updateTextContent(''); + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); + } + } + + if (nextContent != null) { + if (lastContent !== nextContent) { + this.updateTextContent('' + nextContent); + if (process.env.NODE_ENV !== 'production') { + setAndValidateContentChildDev.call(this, nextContent); + } + } + } else if (nextHtml != null) { + if (lastHtml !== nextHtml) { + this.updateMarkup('' + nextHtml); + } + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onSetChildren(this._debugID, []); + } + } else if (nextChildren != null) { + if (process.env.NODE_ENV !== 'production') { + setAndValidateContentChildDev.call(this, null); + } + + this.updateChildren(nextChildren, transaction, context); + } + }, + + getHostNode: function () { + return getNode(this); + }, + + /** + * Destroys all event registrations for this instance. Does not remove from + * the DOM. That must be done by the parent. + * + * @internal + */ + unmountComponent: function (safely) { + switch (this._tag) { + case 'audio': + case 'form': + case 'iframe': + case 'img': + case 'link': + case 'object': + case 'source': + case 'video': + var listeners = this._wrapperState.listeners; + if (listeners) { + for (var i = 0; i < listeners.length; i++) { + listeners[i].remove(); + } + } + break; + case 'input': + case 'textarea': + inputValueTracking.stopTracking(this); + break; + case 'html': + case 'head': + case 'body': + /** + * Components like <html> <head> and <body> can't be removed or added + * easily in a cross-browser way, however it's valuable to be able to + * take advantage of React's reconciliation for styling and <title> + * management. So we just document it and throw in dangerous cases. + */ + true ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is impossible to unmount some top-level components (eg <html>, <head>, and <body>) reliably and efficiently. To fix this, have a single top-level component that never unmounts render these elements.', this._tag) : _prodInvariant('66', this._tag) : void 0; + break; + } + + this.unmountChildren(safely); + ReactDOMComponentTree.uncacheNode(this); + EventPluginHub.deleteAllListeners(this); + this._rootNodeID = 0; + this._domID = 0; + this._wrapperState = null; + + if (process.env.NODE_ENV !== 'production') { + setAndValidateContentChildDev.call(this, null); + } + }, + + getPublicInstance: function () { + return getNode(this); + } +}; + +_assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin); + +module.exports = ReactDOMComponent; + +/***/ }), +/* 133 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactDOMComponentTree = __webpack_require__(4); + +var focusNode = __webpack_require__(69); + +var AutoFocusUtils = { + focusDOMComponent: function () { + focusNode(ReactDOMComponentTree.getNodeFromInstance(this)); + } +}; + +module.exports = AutoFocusUtils; + +/***/ }), +/* 134 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var CSSProperty = __webpack_require__(70); +var ExecutionEnvironment = __webpack_require__(5); +var ReactInstrumentation = __webpack_require__(8); + +var camelizeStyleName = __webpack_require__(135); +var dangerousStyleValue = __webpack_require__(137); +var hyphenateStyleName = __webpack_require__(138); +var memoizeStringOnly = __webpack_require__(140); +var warning = __webpack_require__(1); + +var processStyleName = memoizeStringOnly(function (styleName) { + return hyphenateStyleName(styleName); +}); + +var hasShorthandPropertyBug = false; +var styleFloatAccessor = 'cssFloat'; +if (ExecutionEnvironment.canUseDOM) { + var tempStyle = document.createElement('div').style; + try { + // IE8 throws "Invalid argument." if resetting shorthand style properties. + tempStyle.font = ''; + } catch (e) { + hasShorthandPropertyBug = true; + } + // IE8 only supports accessing cssFloat (standard) as styleFloat + if (document.documentElement.style.cssFloat === undefined) { + styleFloatAccessor = 'styleFloat'; + } +} + +if (process.env.NODE_ENV !== 'production') { + // 'msTransform' is correct, but the other prefixes should be capitalized + var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; + + // style values shouldn't contain a semicolon + var badStyleValueWithSemicolonPattern = /;\s*$/; + + var warnedStyleNames = {}; + var warnedStyleValues = {}; + var warnedForNaNValue = false; + + var warnHyphenatedStyleName = function (name, owner) { + if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { + return; + } + + warnedStyleNames[name] = true; + process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0; + }; + + var warnBadVendoredStyleName = function (name, owner) { + if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { + return; + } + + warnedStyleNames[name] = true; + process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0; + }; + + var warnStyleValueWithSemicolon = function (name, value, owner) { + if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { + return; + } + + warnedStyleValues[value] = true; + process.env.NODE_ENV !== 'production' ? warning(false, "Style property values shouldn't contain a semicolon.%s " + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0; + }; + + var warnStyleValueIsNaN = function (name, value, owner) { + if (warnedForNaNValue) { + return; + } + + warnedForNaNValue = true; + process.env.NODE_ENV !== 'production' ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0; + }; + + var checkRenderMessage = function (owner) { + if (owner) { + var name = owner.getName(); + if (name) { + return ' Check the render method of `' + name + '`.'; + } + } + return ''; + }; + + /** + * @param {string} name + * @param {*} value + * @param {ReactDOMComponent} component + */ + var warnValidStyle = function (name, value, component) { + var owner; + if (component) { + owner = component._currentElement._owner; + } + if (name.indexOf('-') > -1) { + warnHyphenatedStyleName(name, owner); + } else if (badVendoredStyleNamePattern.test(name)) { + warnBadVendoredStyleName(name, owner); + } else if (badStyleValueWithSemicolonPattern.test(value)) { + warnStyleValueWithSemicolon(name, value, owner); + } + + if (typeof value === 'number' && isNaN(value)) { + warnStyleValueIsNaN(name, value, owner); + } + }; +} + +/** + * Operations for dealing with CSS properties. + */ +var CSSPropertyOperations = { + /** + * Serializes a mapping of style properties for use as inline styles: + * + * > createMarkupForStyles({width: '200px', height: 0}) + * "width:200px;height:0;" + * + * Undefined values are ignored so that declarative programming is easier. + * The result should be HTML-escaped before insertion into the DOM. + * + * @param {object} styles + * @param {ReactDOMComponent} component + * @return {?string} + */ + createMarkupForStyles: function (styles, component) { + var serialized = ''; + for (var styleName in styles) { + if (!styles.hasOwnProperty(styleName)) { + continue; + } + var isCustomProperty = styleName.indexOf('--') === 0; + var styleValue = styles[styleName]; + if (process.env.NODE_ENV !== 'production') { + if (!isCustomProperty) { + warnValidStyle(styleName, styleValue, component); + } + } + if (styleValue != null) { + serialized += processStyleName(styleName) + ':'; + serialized += dangerousStyleValue(styleName, styleValue, component, isCustomProperty) + ';'; + } + } + return serialized || null; + }, + + /** + * Sets the value for multiple styles on a node. If a value is specified as + * '' (empty string), the corresponding style property will be unset. + * + * @param {DOMElement} node + * @param {object} styles + * @param {ReactDOMComponent} component + */ + setValueForStyles: function (node, styles, component) { + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onHostOperation({ + instanceID: component._debugID, + type: 'update styles', + payload: styles + }); + } + + var style = node.style; + for (var styleName in styles) { + if (!styles.hasOwnProperty(styleName)) { + continue; + } + var isCustomProperty = styleName.indexOf('--') === 0; + if (process.env.NODE_ENV !== 'production') { + if (!isCustomProperty) { + warnValidStyle(styleName, styles[styleName], component); + } + } + var styleValue = dangerousStyleValue(styleName, styles[styleName], component, isCustomProperty); + if (styleName === 'float' || styleName === 'cssFloat') { + styleName = styleFloatAccessor; + } + if (isCustomProperty) { + style.setProperty(styleName, styleValue); + } else if (styleValue) { + style[styleName] = styleValue; + } else { + var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName]; + if (expansion) { + // Shorthand property that IE8 won't like unsetting, so unset each + // component to placate it + for (var individualStyleName in expansion) { + style[individualStyleName] = ''; + } + } else { + style[styleName] = ''; + } + } + } + } +}; + +module.exports = CSSPropertyOperations; + +/***/ }), +/* 135 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + + + +var camelize = __webpack_require__(136); + +var msPattern = /^-ms-/; + +/** + * Camelcases a hyphenated CSS property name, for example: + * + * > camelizeStyleName('background-color') + * < "backgroundColor" + * > camelizeStyleName('-moz-transition') + * < "MozTransition" + * > camelizeStyleName('-ms-transition') + * < "msTransition" + * + * As Andi Smith suggests + * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix + * is converted to lowercase `ms`. + * + * @param {string} string + * @return {string} + */ +function camelizeStyleName(string) { + return camelize(string.replace(msPattern, 'ms-')); +} + +module.exports = camelizeStyleName; + +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +var _hyphenPattern = /-(.)/g; + +/** + * Camelcases a hyphenated string, for example: + * + * > camelize('background-color') + * < "backgroundColor" + * + * @param {string} string + * @return {string} + */ +function camelize(string) { + return string.replace(_hyphenPattern, function (_, character) { + return character.toUpperCase(); + }); +} + +module.exports = camelize; + +/***/ }), +/* 137 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var CSSProperty = __webpack_require__(70); +var warning = __webpack_require__(1); + +var isUnitlessNumber = CSSProperty.isUnitlessNumber; +var styleWarnings = {}; + +/** + * Convert a value into the proper css writable value. The style name `name` + * should be logical (no hyphens), as specified + * in `CSSProperty.isUnitlessNumber`. + * + * @param {string} name CSS property name such as `topMargin`. + * @param {*} value CSS property value such as `10px`. + * @param {ReactDOMComponent} component + * @return {string} Normalized style value with dimensions applied. + */ +function dangerousStyleValue(name, value, component, isCustomProperty) { + // Note that we've removed escapeTextForBrowser() calls here since the + // whole string will be escaped when the attribute is injected into + // the markup. If you provide unsafe user data here they can inject + // arbitrary CSS which may be problematic (I couldn't repro this): + // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet + // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ + // This is not an XSS hole but instead a potential CSS injection issue + // which has lead to a greater discussion about how we're going to + // trust URLs moving forward. See #2115901 + + var isEmpty = value == null || typeof value === 'boolean' || value === ''; + if (isEmpty) { + return ''; + } + + var isNonNumeric = isNaN(value); + if (isCustomProperty || isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) { + return '' + value; // cast to string + } + + if (typeof value === 'string') { + if (process.env.NODE_ENV !== 'production') { + // Allow '0' to pass through without warning. 0 is already special and + // doesn't require units, so we don't need to warn about it. + if (component && value !== '0') { + var owner = component._currentElement._owner; + var ownerName = owner ? owner.getName() : null; + if (ownerName && !styleWarnings[ownerName]) { + styleWarnings[ownerName] = {}; + } + var warned = false; + if (ownerName) { + var warnings = styleWarnings[ownerName]; + warned = warnings[name]; + if (!warned) { + warnings[name] = true; + } + } + if (!warned) { + process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0; + } + } + } + value = value.trim(); + } + return value + 'px'; +} + +module.exports = dangerousStyleValue; + +/***/ }), +/* 138 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + + + +var hyphenate = __webpack_require__(139); + +var msPattern = /^ms-/; + +/** + * Hyphenates a camelcased CSS property name, for example: + * + * > hyphenateStyleName('backgroundColor') + * < "background-color" + * > hyphenateStyleName('MozTransition') + * < "-moz-transition" + * > hyphenateStyleName('msTransition') + * < "-ms-transition" + * + * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix + * is converted to `-ms-`. + * + * @param {string} string + * @return {string} + */ +function hyphenateStyleName(string) { + return hyphenate(string).replace(msPattern, '-ms-'); +} + +module.exports = hyphenateStyleName; + +/***/ }), +/* 139 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +var _uppercasePattern = /([A-Z])/g; + +/** + * Hyphenates a camelcased string, for example: + * + * > hyphenate('backgroundColor') + * < "background-color" + * + * For CSS style names, use `hyphenateStyleName` instead which works properly + * with all vendor prefixes, including `ms`. + * + * @param {string} string + * @return {string} + */ +function hyphenate(string) { + return string.replace(_uppercasePattern, '-$1').toLowerCase(); +} + +module.exports = hyphenate; + +/***/ }), +/* 140 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + * @typechecks static-only + */ + + + +/** + * Memoizes the return value of a function that accepts one string argument. + */ + +function memoizeStringOnly(callback) { + var cache = {}; + return function (string) { + if (!cache.hasOwnProperty(string)) { + cache[string] = callback.call(this, string); + } + return cache[string]; + }; +} + +module.exports = memoizeStringOnly; + +/***/ }), +/* 141 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var escapeTextContentForBrowser = __webpack_require__(30); + +/** + * Escapes attribute value to prevent scripting attacks. + * + * @param {*} value Value to escape. + * @return {string} An escaped string. + */ +function quoteAttributeValueForBrowser(value) { + return '"' + escapeTextContentForBrowser(value) + '"'; +} + +module.exports = quoteAttributeValueForBrowser; + +/***/ }), +/* 142 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var EventPluginHub = __webpack_require__(21); + +function runEventQueueInBatch(events) { + EventPluginHub.enqueueEvents(events); + EventPluginHub.processEventQueue(false); +} + +var ReactEventEmitterMixin = { + /** + * Streams a fired top-level event to `EventPluginHub` where plugins have the + * opportunity to create `ReactEvent`s to be dispatched. + */ + handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); + runEventQueueInBatch(events); + } +}; + +module.exports = ReactEventEmitterMixin; + +/***/ }), +/* 143 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ExecutionEnvironment = __webpack_require__(5); + +/** + * Generate a mapping of standard vendor prefixes using the defined style property and event name. + * + * @param {string} styleProp + * @param {string} eventName + * @returns {object} + */ +function makePrefixMap(styleProp, eventName) { + var prefixes = {}; + + prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); + prefixes['Webkit' + styleProp] = 'webkit' + eventName; + prefixes['Moz' + styleProp] = 'moz' + eventName; + prefixes['ms' + styleProp] = 'MS' + eventName; + prefixes['O' + styleProp] = 'o' + eventName.toLowerCase(); + + return prefixes; +} + +/** + * A list of event names to a configurable list of vendor prefixes. + */ +var vendorPrefixes = { + animationend: makePrefixMap('Animation', 'AnimationEnd'), + animationiteration: makePrefixMap('Animation', 'AnimationIteration'), + animationstart: makePrefixMap('Animation', 'AnimationStart'), + transitionend: makePrefixMap('Transition', 'TransitionEnd') +}; + +/** + * Event names that have already been detected and prefixed (if applicable). + */ +var prefixedEventNames = {}; + +/** + * Element to check for prefixes on. + */ +var style = {}; + +/** + * Bootstrap if a DOM exists. + */ +if (ExecutionEnvironment.canUseDOM) { + style = document.createElement('div').style; + + // On some platforms, in particular some releases of Android 4.x, + // the un-prefixed "animation" and "transition" properties are defined on the + // style object but the events that fire will still be prefixed, so we need + // to check if the un-prefixed events are usable, and if not remove them from the map. + if (!('AnimationEvent' in window)) { + delete vendorPrefixes.animationend.animation; + delete vendorPrefixes.animationiteration.animation; + delete vendorPrefixes.animationstart.animation; + } + + // Same as above + if (!('TransitionEvent' in window)) { + delete vendorPrefixes.transitionend.transition; + } +} + +/** + * Attempts to determine the correct vendor prefixed event name. + * + * @param {string} eventName + * @returns {string} + */ +function getVendorPrefixedEventName(eventName) { + if (prefixedEventNames[eventName]) { + return prefixedEventNames[eventName]; + } else if (!vendorPrefixes[eventName]) { + return eventName; + } + + var prefixMap = vendorPrefixes[eventName]; + + for (var styleProp in prefixMap) { + if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { + return prefixedEventNames[eventName] = prefixMap[styleProp]; + } + } + + return ''; +} + +module.exports = getVendorPrefixedEventName; + +/***/ }), +/* 144 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2), + _assign = __webpack_require__(3); + +var DOMPropertyOperations = __webpack_require__(71); +var LinkedValueUtils = __webpack_require__(43); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactUpdates = __webpack_require__(10); + +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +var didWarnValueLink = false; +var didWarnCheckedLink = false; +var didWarnValueDefaultValue = false; +var didWarnCheckedDefaultChecked = false; +var didWarnControlledToUncontrolled = false; +var didWarnUncontrolledToControlled = false; + +function forceUpdateIfMounted() { + if (this._rootNodeID) { + // DOM component is still mounted; update + ReactDOMInput.updateWrapper(this); + } +} + +function isControlled(props) { + var usesChecked = props.type === 'checkbox' || props.type === 'radio'; + return usesChecked ? props.checked != null : props.value != null; +} + +/** + * Implements an <input> host component that allows setting these optional + * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. + * + * If `checked` or `value` are not supplied (or null/undefined), user actions + * that affect the checked state or value will trigger updates to the element. + * + * If they are supplied (and not null/undefined), the rendered element will not + * trigger updates to the element. Instead, the props must change in order for + * the rendered element to be updated. + * + * The rendered element will be initialized as unchecked (or `defaultChecked`) + * with an empty value (or `defaultValue`). + * + * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html + */ +var ReactDOMInput = { + getHostProps: function (inst, props) { + var value = LinkedValueUtils.getValue(props); + var checked = LinkedValueUtils.getChecked(props); + + var hostProps = _assign({ + // Make sure we set .type before any other properties (setting .value + // before .type means .value is lost in IE11 and below) + type: undefined, + // Make sure we set .step before .value (setting .value before .step + // means .value is rounded on mount, based upon step precision) + step: undefined, + // Make sure we set .min & .max before .value (to ensure proper order + // in corner cases such as min or max deriving from value, e.g. Issue #7170) + min: undefined, + max: undefined + }, props, { + defaultChecked: undefined, + defaultValue: undefined, + value: value != null ? value : inst._wrapperState.initialValue, + checked: checked != null ? checked : inst._wrapperState.initialChecked, + onChange: inst._wrapperState.onChange + }); + + return hostProps; + }, + + mountWrapper: function (inst, props) { + if (process.env.NODE_ENV !== 'production') { + LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner); + + var owner = inst._currentElement._owner; + + if (props.valueLink !== undefined && !didWarnValueLink) { + process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; + didWarnValueLink = true; + } + if (props.checkedLink !== undefined && !didWarnCheckedLink) { + process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0; + didWarnCheckedLink = true; + } + if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { + process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; + didWarnCheckedDefaultChecked = true; + } + if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { + process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; + didWarnValueDefaultValue = true; + } + } + + var defaultValue = props.defaultValue; + inst._wrapperState = { + initialChecked: props.checked != null ? props.checked : props.defaultChecked, + initialValue: props.value != null ? props.value : defaultValue, + listeners: null, + onChange: _handleChange.bind(inst), + controlled: isControlled(props) + }; + }, + + updateWrapper: function (inst) { + var props = inst._currentElement.props; + + if (process.env.NODE_ENV !== 'production') { + var controlled = isControlled(props); + var owner = inst._currentElement._owner; + + if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { + process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; + didWarnUncontrolledToControlled = true; + } + if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { + process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0; + didWarnControlledToUncontrolled = true; + } + } + + // TODO: Shouldn't this be getChecked(props)? + var checked = props.checked; + if (checked != null) { + DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false); + } + + var node = ReactDOMComponentTree.getNodeFromInstance(inst); + var value = LinkedValueUtils.getValue(props); + if (value != null) { + if (value === 0 && node.value === '') { + node.value = '0'; + // Note: IE9 reports a number inputs as 'text', so check props instead. + } else if (props.type === 'number') { + // Simulate `input.valueAsNumber`. IE9 does not support it + var valueAsNumber = parseFloat(node.value, 10) || 0; + + if ( + // eslint-disable-next-line + value != valueAsNumber || + // eslint-disable-next-line + value == valueAsNumber && node.value != value) { + // Cast `value` to a string to ensure the value is set correctly. While + // browsers typically do this as necessary, jsdom doesn't. + node.value = '' + value; + } + } else if (node.value !== '' + value) { + // Cast `value` to a string to ensure the value is set correctly. While + // browsers typically do this as necessary, jsdom doesn't. + node.value = '' + value; + } + } else { + if (props.value == null && props.defaultValue != null) { + // In Chrome, assigning defaultValue to certain input types triggers input validation. + // For number inputs, the display value loses trailing decimal points. For email inputs, + // Chrome raises "The specified value <x> is not a valid email address". + // + // Here we check to see if the defaultValue has actually changed, avoiding these problems + // when the user is inputting text + // + // https://github.com/facebook/react/issues/7253 + if (node.defaultValue !== '' + props.defaultValue) { + node.defaultValue = '' + props.defaultValue; + } + } + if (props.checked == null && props.defaultChecked != null) { + node.defaultChecked = !!props.defaultChecked; + } + } + }, + + postMountWrapper: function (inst) { + var props = inst._currentElement.props; + + // This is in postMount because we need access to the DOM node, which is not + // available until after the component has mounted. + var node = ReactDOMComponentTree.getNodeFromInstance(inst); + + // Detach value from defaultValue. We won't do anything if we're working on + // submit or reset inputs as those values & defaultValues are linked. They + // are not resetable nodes so this operation doesn't matter and actually + // removes browser-default values (eg "Submit Query") when no value is + // provided. + + switch (props.type) { + case 'submit': + case 'reset': + break; + case 'color': + case 'date': + case 'datetime': + case 'datetime-local': + case 'month': + case 'time': + case 'week': + // This fixes the no-show issue on iOS Safari and Android Chrome: + // https://github.com/facebook/react/issues/7233 + node.value = ''; + node.value = node.defaultValue; + break; + default: + node.value = node.value; + break; + } + + // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug + // this is needed to work around a chrome bug where setting defaultChecked + // will sometimes influence the value of checked (even after detachment). + // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 + // We need to temporarily unset name to avoid disrupting radio button groups. + var name = node.name; + if (name !== '') { + node.name = ''; + } + node.defaultChecked = !node.defaultChecked; + node.defaultChecked = !node.defaultChecked; + if (name !== '') { + node.name = name; + } + } +}; + +function _handleChange(event) { + var props = this._currentElement.props; + + var returnValue = LinkedValueUtils.executeOnChange(props, event); + + // Here we use asap to wait until all updates have propagated, which + // is important when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + ReactUpdates.asap(forceUpdateIfMounted, this); + + var name = props.name; + if (props.type === 'radio' && name != null) { + var rootNode = ReactDOMComponentTree.getNodeFromInstance(this); + var queryRoot = rootNode; + + while (queryRoot.parentNode) { + queryRoot = queryRoot.parentNode; + } + + // If `rootNode.form` was non-null, then we could try `form.elements`, + // but that sometimes behaves strangely in IE8. We could also try using + // `form.getElementsByName`, but that will only return direct children + // and won't include inputs that use the HTML5 `form=` attribute. Since + // the input might not even be in a form, let's just use the global + // `querySelectorAll` to ensure we don't miss anything. + var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); + + for (var i = 0; i < group.length; i++) { + var otherNode = group[i]; + if (otherNode === rootNode || otherNode.form !== rootNode.form) { + continue; + } + // This will throw if radio buttons rendered by different copies of React + // and the same name are rendered into the same form (same as #1939). + // That's probably okay; we don't support it just as we don't support + // mixing React radio buttons with non-React ones. + var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode); + !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0; + // If this is a controlled radio button group, forcing the input that + // was previously checked to update will cause it to be come re-checked + // as appropriate. + ReactUpdates.asap(forceUpdateIfMounted, otherInstance); + } + } + + return returnValue; +} + +module.exports = ReactDOMInput; + +/***/ }), +/* 145 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var React = __webpack_require__(15); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactDOMSelect = __webpack_require__(73); + +var warning = __webpack_require__(1); +var didWarnInvalidOptionChildren = false; + +function flattenChildren(children) { + var content = ''; + + // Flatten children and warn if they aren't strings or numbers; + // invalid types are ignored. + React.Children.forEach(children, function (child) { + if (child == null) { + return; + } + if (typeof child === 'string' || typeof child === 'number') { + content += child; + } else if (!didWarnInvalidOptionChildren) { + didWarnInvalidOptionChildren = true; + process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : void 0; + } + }); + + return content; +} + +/** + * Implements an <option> host component that warns when `selected` is set. + */ +var ReactDOMOption = { + mountWrapper: function (inst, props, hostParent) { + // TODO (yungsters): Remove support for `selected` in <option>. + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : void 0; + } + + // Look up whether this option is 'selected' + var selectValue = null; + if (hostParent != null) { + var selectParent = hostParent; + + if (selectParent._tag === 'optgroup') { + selectParent = selectParent._hostParent; + } + + if (selectParent != null && selectParent._tag === 'select') { + selectValue = ReactDOMSelect.getSelectValueContext(selectParent); + } + } + + // If the value is null (e.g., no specified value or after initial mount) + // or missing (e.g., for <datalist>), we don't change props.selected + var selected = null; + if (selectValue != null) { + var value; + if (props.value != null) { + value = props.value + ''; + } else { + value = flattenChildren(props.children); + } + selected = false; + if (Array.isArray(selectValue)) { + // multiple + for (var i = 0; i < selectValue.length; i++) { + if ('' + selectValue[i] === value) { + selected = true; + break; + } + } + } else { + selected = '' + selectValue === value; + } + } + + inst._wrapperState = { selected: selected }; + }, + + postMountWrapper: function (inst) { + // value="" should make a value attribute (#6219) + var props = inst._currentElement.props; + if (props.value != null) { + var node = ReactDOMComponentTree.getNodeFromInstance(inst); + node.setAttribute('value', props.value); + } + }, + + getHostProps: function (inst, props) { + var hostProps = _assign({ selected: undefined, children: undefined }, props); + + // Read state only from initial mount because <select> updates value + // manually; we need the initial state only for server rendering + if (inst._wrapperState.selected != null) { + hostProps.selected = inst._wrapperState.selected; + } + + var content = flattenChildren(props.children); + + if (content) { + hostProps.children = content; + } + + return hostProps; + } +}; + +module.exports = ReactDOMOption; + +/***/ }), +/* 146 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2), + _assign = __webpack_require__(3); + +var LinkedValueUtils = __webpack_require__(43); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactUpdates = __webpack_require__(10); + +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +var didWarnValueLink = false; +var didWarnValDefaultVal = false; + +function forceUpdateIfMounted() { + if (this._rootNodeID) { + // DOM component is still mounted; update + ReactDOMTextarea.updateWrapper(this); + } +} + +/** + * Implements a <textarea> host component that allows setting `value`, and + * `defaultValue`. This differs from the traditional DOM API because value is + * usually set as PCDATA children. + * + * If `value` is not supplied (or null/undefined), user actions that affect the + * value will trigger updates to the element. + * + * If `value` is supplied (and not null/undefined), the rendered element will + * not trigger updates to the element. Instead, the `value` prop must change in + * order for the rendered element to be updated. + * + * The rendered element will be initialized with an empty value, the prop + * `defaultValue` if specified, or the children content (deprecated). + */ +var ReactDOMTextarea = { + getHostProps: function (inst, props) { + !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : _prodInvariant('91') : void 0; + + // Always set children to the same thing. In IE9, the selection range will + // get reset if `textContent` is mutated. We could add a check in setTextContent + // to only set the value if/when the value differs from the node value (which would + // completely solve this IE9 bug), but Sebastian+Ben seemed to like this solution. + // The value can be a boolean or object so that's why it's forced to be a string. + var hostProps = _assign({}, props, { + value: undefined, + defaultValue: undefined, + children: '' + inst._wrapperState.initialValue, + onChange: inst._wrapperState.onChange + }); + + return hostProps; + }, + + mountWrapper: function (inst, props) { + if (process.env.NODE_ENV !== 'production') { + LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner); + if (props.valueLink !== undefined && !didWarnValueLink) { + process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : void 0; + didWarnValueLink = true; + } + if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : void 0; + didWarnValDefaultVal = true; + } + } + + var value = LinkedValueUtils.getValue(props); + var initialValue = value; + + // Only bother fetching default value if we're going to use it + if (value == null) { + var defaultValue = props.defaultValue; + // TODO (yungsters): Remove support for children content in <textarea>. + var children = props.children; + if (children != null) { + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : void 0; + } + !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : _prodInvariant('92') : void 0; + if (Array.isArray(children)) { + !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : _prodInvariant('93') : void 0; + children = children[0]; + } + + defaultValue = '' + children; + } + if (defaultValue == null) { + defaultValue = ''; + } + initialValue = defaultValue; + } + + inst._wrapperState = { + initialValue: '' + initialValue, + listeners: null, + onChange: _handleChange.bind(inst) + }; + }, + + updateWrapper: function (inst) { + var props = inst._currentElement.props; + + var node = ReactDOMComponentTree.getNodeFromInstance(inst); + var value = LinkedValueUtils.getValue(props); + if (value != null) { + // Cast `value` to a string to ensure the value is set correctly. While + // browsers typically do this as necessary, jsdom doesn't. + var newValue = '' + value; + + // To avoid side effects (such as losing text selection), only set value if changed + if (newValue !== node.value) { + node.value = newValue; + } + if (props.defaultValue == null) { + node.defaultValue = newValue; + } + } + if (props.defaultValue != null) { + node.defaultValue = props.defaultValue; + } + }, + + postMountWrapper: function (inst) { + // This is in postMount because we need access to the DOM node, which is not + // available until after the component has mounted. + var node = ReactDOMComponentTree.getNodeFromInstance(inst); + var textContent = node.textContent; + + // Only set node.value if textContent is equal to the expected + // initial value. In IE10/IE11 there is a bug where the placeholder attribute + // will populate textContent as well. + // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/ + if (textContent === inst._wrapperState.initialValue) { + node.value = textContent; + } + } +}; + +function _handleChange(event) { + var props = this._currentElement.props; + var returnValue = LinkedValueUtils.executeOnChange(props, event); + ReactUpdates.asap(forceUpdateIfMounted, this); + return returnValue; +} + +module.exports = ReactDOMTextarea; + +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var ReactComponentEnvironment = __webpack_require__(44); +var ReactInstanceMap = __webpack_require__(23); +var ReactInstrumentation = __webpack_require__(8); + +var ReactCurrentOwner = __webpack_require__(9); +var ReactReconciler = __webpack_require__(17); +var ReactChildReconciler = __webpack_require__(148); + +var emptyFunction = __webpack_require__(7); +var flattenChildren = __webpack_require__(155); +var invariant = __webpack_require__(0); + +/** + * Make an update for markup to be rendered and inserted at a supplied index. + * + * @param {string} markup Markup that renders into an element. + * @param {number} toIndex Destination index. + * @private + */ +function makeInsertMarkup(markup, afterNode, toIndex) { + // NOTE: Null values reduce hidden classes. + return { + type: 'INSERT_MARKUP', + content: markup, + fromIndex: null, + fromNode: null, + toIndex: toIndex, + afterNode: afterNode + }; +} + +/** + * Make an update for moving an existing element to another index. + * + * @param {number} fromIndex Source index of the existing element. + * @param {number} toIndex Destination index of the element. + * @private + */ +function makeMove(child, afterNode, toIndex) { + // NOTE: Null values reduce hidden classes. + return { + type: 'MOVE_EXISTING', + content: null, + fromIndex: child._mountIndex, + fromNode: ReactReconciler.getHostNode(child), + toIndex: toIndex, + afterNode: afterNode + }; +} + +/** + * Make an update for removing an element at an index. + * + * @param {number} fromIndex Index of the element to remove. + * @private + */ +function makeRemove(child, node) { + // NOTE: Null values reduce hidden classes. + return { + type: 'REMOVE_NODE', + content: null, + fromIndex: child._mountIndex, + fromNode: node, + toIndex: null, + afterNode: null + }; +} + +/** + * Make an update for setting the markup of a node. + * + * @param {string} markup Markup that renders into an element. + * @private + */ +function makeSetMarkup(markup) { + // NOTE: Null values reduce hidden classes. + return { + type: 'SET_MARKUP', + content: markup, + fromIndex: null, + fromNode: null, + toIndex: null, + afterNode: null + }; +} + +/** + * Make an update for setting the text content. + * + * @param {string} textContent Text content to set. + * @private + */ +function makeTextContent(textContent) { + // NOTE: Null values reduce hidden classes. + return { + type: 'TEXT_CONTENT', + content: textContent, + fromIndex: null, + fromNode: null, + toIndex: null, + afterNode: null + }; +} + +/** + * Push an update, if any, onto the queue. Creates a new queue if none is + * passed and always returns the queue. Mutative. + */ +function enqueue(queue, update) { + if (update) { + queue = queue || []; + queue.push(update); + } + return queue; +} + +/** + * Processes any enqueued updates. + * + * @private + */ +function processQueue(inst, updateQueue) { + ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue); +} + +var setChildrenForInstrumentation = emptyFunction; +if (process.env.NODE_ENV !== 'production') { + var getDebugID = function (inst) { + if (!inst._debugID) { + // Check for ART-like instances. TODO: This is silly/gross. + var internal; + if (internal = ReactInstanceMap.get(inst)) { + inst = internal; + } + } + return inst._debugID; + }; + setChildrenForInstrumentation = function (children) { + var debugID = getDebugID(this); + // TODO: React Native empty components are also multichild. + // This means they still get into this method but don't have _debugID. + if (debugID !== 0) { + ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) { + return children[key]._debugID; + }) : []); + } + }; +} + +/** + * ReactMultiChild are capable of reconciling multiple children. + * + * @class ReactMultiChild + * @internal + */ +var ReactMultiChild = { + /** + * Provides common functionality for components that must reconcile multiple + * children. This is used by `ReactDOMComponent` to mount, update, and + * unmount child components. + * + * @lends {ReactMultiChild.prototype} + */ + Mixin: { + _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) { + if (process.env.NODE_ENV !== 'production') { + var selfDebugID = getDebugID(this); + if (this._currentElement) { + try { + ReactCurrentOwner.current = this._currentElement._owner; + return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID); + } finally { + ReactCurrentOwner.current = null; + } + } + } + return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context); + }, + + _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) { + var nextChildren; + var selfDebugID = 0; + if (process.env.NODE_ENV !== 'production') { + selfDebugID = getDebugID(this); + if (this._currentElement) { + try { + ReactCurrentOwner.current = this._currentElement._owner; + nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); + } finally { + ReactCurrentOwner.current = null; + } + ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID); + return nextChildren; + } + } + nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID); + ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID); + return nextChildren; + }, + + /** + * Generates a "mount image" for each of the supplied children. In the case + * of `ReactDOMComponent`, a mount image is a string of markup. + * + * @param {?object} nestedChildren Nested child maps. + * @return {array} An array of mounted representations. + * @internal + */ + mountChildren: function (nestedChildren, transaction, context) { + var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); + this._renderedChildren = children; + + var mountImages = []; + var index = 0; + for (var name in children) { + if (children.hasOwnProperty(name)) { + var child = children[name]; + var selfDebugID = 0; + if (process.env.NODE_ENV !== 'production') { + selfDebugID = getDebugID(this); + } + var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID); + child._mountIndex = index++; + mountImages.push(mountImage); + } + } + + if (process.env.NODE_ENV !== 'production') { + setChildrenForInstrumentation.call(this, children); + } + + return mountImages; + }, + + /** + * Replaces any rendered children with a text content string. + * + * @param {string} nextContent String of content. + * @internal + */ + updateTextContent: function (nextContent) { + var prevChildren = this._renderedChildren; + // Remove any rendered children. + ReactChildReconciler.unmountChildren(prevChildren, false); + for (var name in prevChildren) { + if (prevChildren.hasOwnProperty(name)) { + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; + } + } + // Set new text content. + var updates = [makeTextContent(nextContent)]; + processQueue(this, updates); + }, + + /** + * Replaces any rendered children with a markup string. + * + * @param {string} nextMarkup String of markup. + * @internal + */ + updateMarkup: function (nextMarkup) { + var prevChildren = this._renderedChildren; + // Remove any rendered children. + ReactChildReconciler.unmountChildren(prevChildren, false); + for (var name in prevChildren) { + if (prevChildren.hasOwnProperty(name)) { + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0; + } + } + var updates = [makeSetMarkup(nextMarkup)]; + processQueue(this, updates); + }, + + /** + * Updates the rendered children with new children. + * + * @param {?object} nextNestedChildrenElements Nested child element maps. + * @param {ReactReconcileTransaction} transaction + * @internal + */ + updateChildren: function (nextNestedChildrenElements, transaction, context) { + // Hook used by React ART + this._updateChildren(nextNestedChildrenElements, transaction, context); + }, + + /** + * @param {?object} nextNestedChildrenElements Nested child element maps. + * @param {ReactReconcileTransaction} transaction + * @final + * @protected + */ + _updateChildren: function (nextNestedChildrenElements, transaction, context) { + var prevChildren = this._renderedChildren; + var removedNodes = {}; + var mountImages = []; + var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context); + if (!nextChildren && !prevChildren) { + return; + } + var updates = null; + var name; + // `nextIndex` will increment for each child in `nextChildren`, but + // `lastIndex` will be the last index visited in `prevChildren`. + var nextIndex = 0; + var lastIndex = 0; + // `nextMountIndex` will increment for each newly mounted child. + var nextMountIndex = 0; + var lastPlacedNode = null; + for (name in nextChildren) { + if (!nextChildren.hasOwnProperty(name)) { + continue; + } + var prevChild = prevChildren && prevChildren[name]; + var nextChild = nextChildren[name]; + if (prevChild === nextChild) { + updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex)); + lastIndex = Math.max(prevChild._mountIndex, lastIndex); + prevChild._mountIndex = nextIndex; + } else { + if (prevChild) { + // Update `lastIndex` before `_mountIndex` gets unset by unmounting. + lastIndex = Math.max(prevChild._mountIndex, lastIndex); + // The `removedNodes` loop below will actually remove the child. + } + // The child must be instantiated before it's mounted. + updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context)); + nextMountIndex++; + } + nextIndex++; + lastPlacedNode = ReactReconciler.getHostNode(nextChild); + } + // Remove children that are no longer present. + for (name in removedNodes) { + if (removedNodes.hasOwnProperty(name)) { + updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name])); + } + } + if (updates) { + processQueue(this, updates); + } + this._renderedChildren = nextChildren; + + if (process.env.NODE_ENV !== 'production') { + setChildrenForInstrumentation.call(this, nextChildren); + } + }, + + /** + * Unmounts all rendered children. This should be used to clean up children + * when this component is unmounted. It does not actually perform any + * backend operations. + * + * @internal + */ + unmountChildren: function (safely) { + var renderedChildren = this._renderedChildren; + ReactChildReconciler.unmountChildren(renderedChildren, safely); + this._renderedChildren = null; + }, + + /** + * Moves a child component to the supplied index. + * + * @param {ReactComponent} child Component to move. + * @param {number} toIndex Destination index of the element. + * @param {number} lastIndex Last index visited of the siblings of `child`. + * @protected + */ + moveChild: function (child, afterNode, toIndex, lastIndex) { + // If the index of `child` is less than `lastIndex`, then it needs to + // be moved. Otherwise, we do not need to move it because a child will be + // inserted or moved before `child`. + if (child._mountIndex < lastIndex) { + return makeMove(child, afterNode, toIndex); + } + }, + + /** + * Creates a child component. + * + * @param {ReactComponent} child Component to create. + * @param {string} mountImage Markup to insert. + * @protected + */ + createChild: function (child, afterNode, mountImage) { + return makeInsertMarkup(mountImage, afterNode, child._mountIndex); + }, + + /** + * Removes a child component. + * + * @param {ReactComponent} child Child to remove. + * @protected + */ + removeChild: function (child, node) { + return makeRemove(child, node); + }, + + /** + * Mounts a child with the supplied name. + * + * NOTE: This is part of `updateChildren` and is here for readability. + * + * @param {ReactComponent} child Component to mount. + * @param {string} name Name of the child. + * @param {number} index Index at which to insert the child. + * @param {ReactReconcileTransaction} transaction + * @private + */ + _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) { + child._mountIndex = index; + return this.createChild(child, afterNode, mountImage); + }, + + /** + * Unmounts a rendered child. + * + * NOTE: This is part of `updateChildren` and is here for readability. + * + * @param {ReactComponent} child Component to unmount. + * @private + */ + _unmountChild: function (child, node) { + var update = this.removeChild(child, node); + child._mountIndex = null; + return update; + } + } +}; + +module.exports = ReactMultiChild; + +/***/ }), +/* 148 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactReconciler = __webpack_require__(17); + +var instantiateReactComponent = __webpack_require__(74); +var KeyEscapeUtils = __webpack_require__(47); +var shouldUpdateReactComponent = __webpack_require__(46); +var traverseAllChildren = __webpack_require__(78); +var warning = __webpack_require__(1); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = __webpack_require__(6); +} + +function instantiateChild(childInstances, child, name, selfDebugID) { + // We found a component instance. + var keyUnique = childInstances[name] === undefined; + if (process.env.NODE_ENV !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = __webpack_require__(6); + } + if (!keyUnique) { + process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; + } + } + if (child != null && keyUnique) { + childInstances[name] = instantiateReactComponent(child, true); + } +} + +/** + * ReactChildReconciler provides helpers for initializing or updating a set of + * children. Its output is suitable for passing it onto ReactMultiChild which + * does diffed reordering and insertion. + */ +var ReactChildReconciler = { + /** + * Generates a "mount image" for each of the supplied children. In the case + * of `ReactDOMComponent`, a mount image is a string of markup. + * + * @param {?object} nestedChildNodes Nested child maps. + * @return {?object} A set of child instances. + * @internal + */ + instantiateChildren: function (nestedChildNodes, transaction, context, selfDebugID) // 0 in production and for roots + { + if (nestedChildNodes == null) { + return null; + } + var childInstances = {}; + + if (process.env.NODE_ENV !== 'production') { + traverseAllChildren(nestedChildNodes, function (childInsts, child, name) { + return instantiateChild(childInsts, child, name, selfDebugID); + }, childInstances); + } else { + traverseAllChildren(nestedChildNodes, instantiateChild, childInstances); + } + return childInstances; + }, + + /** + * Updates the rendered children and returns a new set of children. + * + * @param {?object} prevChildren Previously initialized set of children. + * @param {?object} nextChildren Flat child element maps. + * @param {ReactReconcileTransaction} transaction + * @param {object} context + * @return {?object} A new set of child instances. + * @internal + */ + updateChildren: function (prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID) // 0 in production and for roots + { + // We currently don't have a way to track moves here but if we use iterators + // instead of for..in we can zip the iterators and check if an item has + // moved. + // TODO: If nothing has changed, return the prevChildren object so that we + // can quickly bailout if nothing has changed. + if (!nextChildren && !prevChildren) { + return; + } + var name; + var prevChild; + for (name in nextChildren) { + if (!nextChildren.hasOwnProperty(name)) { + continue; + } + prevChild = prevChildren && prevChildren[name]; + var prevElement = prevChild && prevChild._currentElement; + var nextElement = nextChildren[name]; + if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) { + ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context); + nextChildren[name] = prevChild; + } else { + if (prevChild) { + removedNodes[name] = ReactReconciler.getHostNode(prevChild); + ReactReconciler.unmountComponent(prevChild, false); + } + // The child must be instantiated before it's mounted. + var nextChildInstance = instantiateReactComponent(nextElement, true); + nextChildren[name] = nextChildInstance; + // Creating mount image now ensures refs are resolved in right order + // (see https://github.com/facebook/react/pull/7101 for explanation). + var nextChildMountImage = ReactReconciler.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID); + mountImages.push(nextChildMountImage); + } + } + // Unmount children that are no longer present. + for (name in prevChildren) { + if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) { + prevChild = prevChildren[name]; + removedNodes[name] = ReactReconciler.getHostNode(prevChild); + ReactReconciler.unmountComponent(prevChild, false); + } + } + }, + + /** + * Unmounts all rendered children. This should be used to clean up children + * when this component is unmounted. + * + * @param {?object} renderedChildren Previously initialized set of children. + * @internal + */ + unmountChildren: function (renderedChildren, safely) { + for (var name in renderedChildren) { + if (renderedChildren.hasOwnProperty(name)) { + var renderedChild = renderedChildren[name]; + ReactReconciler.unmountComponent(renderedChild, safely); + } + } + } +}; + +module.exports = ReactChildReconciler; + +/***/ }), +/* 149 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2), + _assign = __webpack_require__(3); + +var React = __webpack_require__(15); +var ReactComponentEnvironment = __webpack_require__(44); +var ReactCurrentOwner = __webpack_require__(9); +var ReactErrorUtils = __webpack_require__(36); +var ReactInstanceMap = __webpack_require__(23); +var ReactInstrumentation = __webpack_require__(8); +var ReactNodeTypes = __webpack_require__(75); +var ReactReconciler = __webpack_require__(17); + +if (process.env.NODE_ENV !== 'production') { + var checkReactTypeSpec = __webpack_require__(150); +} + +var emptyObject = __webpack_require__(25); +var invariant = __webpack_require__(0); +var shallowEqual = __webpack_require__(45); +var shouldUpdateReactComponent = __webpack_require__(46); +var warning = __webpack_require__(1); + +var CompositeTypes = { + ImpureClass: 0, + PureClass: 1, + StatelessFunctional: 2 +}; + +function StatelessComponent(Component) {} +StatelessComponent.prototype.render = function () { + var Component = ReactInstanceMap.get(this)._currentElement.type; + var element = Component(this.props, this.context, this.updater); + warnIfInvalidElement(Component, element); + return element; +}; + +function warnIfInvalidElement(Component, element) { + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || React.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0; + process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0; + } +} + +function shouldConstruct(Component) { + return !!(Component.prototype && Component.prototype.isReactComponent); +} + +function isPureComponent(Component) { + return !!(Component.prototype && Component.prototype.isPureReactComponent); +} + +// Separated into a function to contain deoptimizations caused by try/finally. +function measureLifeCyclePerf(fn, debugID, timerType) { + if (debugID === 0) { + // Top-level wrappers (see ReactMount) and empty components (see + // ReactDOMEmptyComponent) are invisible to hooks and devtools. + // Both are implementation details that should go away in the future. + return fn(); + } + + ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType); + try { + return fn(); + } finally { + ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType); + } +} + +/** + * ------------------ The Life-Cycle of a Composite Component ------------------ + * + * - constructor: Initialization of state. The instance is now retained. + * - componentWillMount + * - render + * - [children's constructors] + * - [children's componentWillMount and render] + * - [children's componentDidMount] + * - componentDidMount + * + * Update Phases: + * - componentWillReceiveProps (only called if parent updated) + * - shouldComponentUpdate + * - componentWillUpdate + * - render + * - [children's constructors or receive props phases] + * - componentDidUpdate + * + * - componentWillUnmount + * - [children's componentWillUnmount] + * - [children destroyed] + * - (destroyed): The instance is now blank, released by React and ready for GC. + * + * ----------------------------------------------------------------------------- + */ + +/** + * An incrementing ID assigned to each component when it is mounted. This is + * used to enforce the order in which `ReactUpdates` updates dirty components. + * + * @private + */ +var nextMountID = 1; + +/** + * @lends {ReactCompositeComponent.prototype} + */ +var ReactCompositeComponent = { + /** + * Base constructor for all composite component. + * + * @param {ReactElement} element + * @final + * @internal + */ + construct: function (element) { + this._currentElement = element; + this._rootNodeID = 0; + this._compositeType = null; + this._instance = null; + this._hostParent = null; + this._hostContainerInfo = null; + + // See ReactUpdateQueue + this._updateBatchNumber = null; + this._pendingElement = null; + this._pendingStateQueue = null; + this._pendingReplaceState = false; + this._pendingForceUpdate = false; + + this._renderedNodeType = null; + this._renderedComponent = null; + this._context = null; + this._mountOrder = 0; + this._topLevelWrapper = null; + + // See ReactUpdates and ReactUpdateQueue. + this._pendingCallbacks = null; + + // ComponentWillUnmount shall only be called once + this._calledComponentWillUnmount = false; + + if (process.env.NODE_ENV !== 'production') { + this._warnedAboutRefsInRender = false; + } + }, + + /** + * Initializes the component, renders markup, and registers event listeners. + * + * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction + * @param {?object} hostParent + * @param {?object} hostContainerInfo + * @param {?object} context + * @return {?string} Rendered markup to be inserted into the DOM. + * @final + * @internal + */ + mountComponent: function (transaction, hostParent, hostContainerInfo, context) { + var _this = this; + + this._context = context; + this._mountOrder = nextMountID++; + this._hostParent = hostParent; + this._hostContainerInfo = hostContainerInfo; + + var publicProps = this._currentElement.props; + var publicContext = this._processContext(context); + + var Component = this._currentElement.type; + + var updateQueue = transaction.getUpdateQueue(); + + // Initialize the public class + var doConstruct = shouldConstruct(Component); + var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue); + var renderedElement; + + // Support functional components + if (!doConstruct && (inst == null || inst.render == null)) { + renderedElement = inst; + warnIfInvalidElement(Component, renderedElement); + !(inst === null || inst === false || React.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0; + inst = new StatelessComponent(Component); + this._compositeType = CompositeTypes.StatelessFunctional; + } else { + if (isPureComponent(Component)) { + this._compositeType = CompositeTypes.PureClass; + } else { + this._compositeType = CompositeTypes.ImpureClass; + } + } + + if (process.env.NODE_ENV !== 'production') { + // This will throw later in _renderValidatedComponent, but add an early + // warning now to help debugging + if (inst.render == null) { + process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0; + } + + var propsMutated = inst.props !== publicProps; + var componentName = Component.displayName || Component.name || 'Component'; + + process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", componentName, componentName) : void 0; + } + + // These should be set up in the constructor, but as a convenience for + // simpler class abstractions, we set them up after the fact. + inst.props = publicProps; + inst.context = publicContext; + inst.refs = emptyObject; + inst.updater = updateQueue; + + this._instance = inst; + + // Store a reference from the instance back to the internal representation + ReactInstanceMap.set(inst, this); + + if (process.env.NODE_ENV !== 'production') { + // Since plain JS classes are defined without any special initialization + // logic, we can not catch common errors early. Therefore, we have to + // catch them here, at initialization time, instead. + process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0; + process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0; + process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0; + process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0; + process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0; + process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0; + process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0; + } + + var initialState = inst.state; + if (initialState === undefined) { + inst.state = initialState = null; + } + !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0; + + this._pendingStateQueue = null; + this._pendingReplaceState = false; + this._pendingForceUpdate = false; + + var markup; + if (inst.unstable_handleError) { + markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context); + } else { + markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); + } + + if (inst.componentDidMount) { + if (process.env.NODE_ENV !== 'production') { + transaction.getReactMountReady().enqueue(function () { + measureLifeCyclePerf(function () { + return inst.componentDidMount(); + }, _this._debugID, 'componentDidMount'); + }); + } else { + transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); + } + } + + return markup; + }, + + _constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) { + if (process.env.NODE_ENV !== 'production' && !doConstruct) { + ReactCurrentOwner.current = this; + try { + return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); + } finally { + ReactCurrentOwner.current = null; + } + } else { + return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); + } + }, + + _constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) { + var Component = this._currentElement.type; + + if (doConstruct) { + if (process.env.NODE_ENV !== 'production') { + return measureLifeCyclePerf(function () { + return new Component(publicProps, publicContext, updateQueue); + }, this._debugID, 'ctor'); + } else { + return new Component(publicProps, publicContext, updateQueue); + } + } + + // This can still be an instance in case of factory components + // but we'll count this as time spent rendering as the more common case. + if (process.env.NODE_ENV !== 'production') { + return measureLifeCyclePerf(function () { + return Component(publicProps, publicContext, updateQueue); + }, this._debugID, 'render'); + } else { + return Component(publicProps, publicContext, updateQueue); + } + }, + + performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { + var markup; + var checkpoint = transaction.checkpoint(); + try { + markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); + } catch (e) { + // Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint + transaction.rollback(checkpoint); + this._instance.unstable_handleError(e); + if (this._pendingStateQueue) { + this._instance.state = this._processPendingState(this._instance.props, this._instance.context); + } + checkpoint = transaction.checkpoint(); + + this._renderedComponent.unmountComponent(true); + transaction.rollback(checkpoint); + + // Try again - we've informed the component about the error, so they can render an error message this time. + // If this throws again, the error will bubble up (and can be caught by a higher error boundary). + markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); + } + return markup; + }, + + performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) { + var inst = this._instance; + + var debugID = 0; + if (process.env.NODE_ENV !== 'production') { + debugID = this._debugID; + } + + if (inst.componentWillMount) { + if (process.env.NODE_ENV !== 'production') { + measureLifeCyclePerf(function () { + return inst.componentWillMount(); + }, debugID, 'componentWillMount'); + } else { + inst.componentWillMount(); + } + // When mounting, calls to `setState` by `componentWillMount` will set + // `this._pendingStateQueue` without triggering a re-render. + if (this._pendingStateQueue) { + inst.state = this._processPendingState(inst.props, inst.context); + } + } + + // If not a stateless component, we now render + if (renderedElement === undefined) { + renderedElement = this._renderValidatedComponent(); + } + + var nodeType = ReactNodeTypes.getType(renderedElement); + this._renderedNodeType = nodeType; + var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ + ); + this._renderedComponent = child; + + var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID); + + if (process.env.NODE_ENV !== 'production') { + if (debugID !== 0) { + var childDebugIDs = child._debugID !== 0 ? [child._debugID] : []; + ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); + } + } + + return markup; + }, + + getHostNode: function () { + return ReactReconciler.getHostNode(this._renderedComponent); + }, + + /** + * Releases any resources allocated by `mountComponent`. + * + * @final + * @internal + */ + unmountComponent: function (safely) { + if (!this._renderedComponent) { + return; + } + + var inst = this._instance; + + if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) { + inst._calledComponentWillUnmount = true; + + if (safely) { + var name = this.getName() + '.componentWillUnmount()'; + ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst)); + } else { + if (process.env.NODE_ENV !== 'production') { + measureLifeCyclePerf(function () { + return inst.componentWillUnmount(); + }, this._debugID, 'componentWillUnmount'); + } else { + inst.componentWillUnmount(); + } + } + } + + if (this._renderedComponent) { + ReactReconciler.unmountComponent(this._renderedComponent, safely); + this._renderedNodeType = null; + this._renderedComponent = null; + this._instance = null; + } + + // Reset pending fields + // Even if this component is scheduled for another update in ReactUpdates, + // it would still be ignored because these fields are reset. + this._pendingStateQueue = null; + this._pendingReplaceState = false; + this._pendingForceUpdate = false; + this._pendingCallbacks = null; + this._pendingElement = null; + + // These fields do not really need to be reset since this object is no + // longer accessible. + this._context = null; + this._rootNodeID = 0; + this._topLevelWrapper = null; + + // Delete the reference from the instance to this internal representation + // which allow the internals to be properly cleaned up even if the user + // leaks a reference to the public instance. + ReactInstanceMap.remove(inst); + + // Some existing components rely on inst.props even after they've been + // destroyed (in event handlers). + // TODO: inst.props = null; + // TODO: inst.state = null; + // TODO: inst.context = null; + }, + + /** + * Filters the context object to only contain keys specified in + * `contextTypes` + * + * @param {object} context + * @return {?object} + * @private + */ + _maskContext: function (context) { + var Component = this._currentElement.type; + var contextTypes = Component.contextTypes; + if (!contextTypes) { + return emptyObject; + } + var maskedContext = {}; + for (var contextName in contextTypes) { + maskedContext[contextName] = context[contextName]; + } + return maskedContext; + }, + + /** + * Filters the context object to only contain keys specified in + * `contextTypes`, and asserts that they are valid. + * + * @param {object} context + * @return {?object} + * @private + */ + _processContext: function (context) { + var maskedContext = this._maskContext(context); + if (process.env.NODE_ENV !== 'production') { + var Component = this._currentElement.type; + if (Component.contextTypes) { + this._checkContextTypes(Component.contextTypes, maskedContext, 'context'); + } + } + return maskedContext; + }, + + /** + * @param {object} currentContext + * @return {object} + * @private + */ + _processChildContext: function (currentContext) { + var Component = this._currentElement.type; + var inst = this._instance; + var childContext; + + if (inst.getChildContext) { + if (process.env.NODE_ENV !== 'production') { + ReactInstrumentation.debugTool.onBeginProcessingChildContext(); + try { + childContext = inst.getChildContext(); + } finally { + ReactInstrumentation.debugTool.onEndProcessingChildContext(); + } + } else { + childContext = inst.getChildContext(); + } + } + + if (childContext) { + !(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0; + if (process.env.NODE_ENV !== 'production') { + this._checkContextTypes(Component.childContextTypes, childContext, 'child context'); + } + for (var name in childContext) { + !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0; + } + return _assign({}, currentContext, childContext); + } + return currentContext; + }, + + /** + * Assert that the context types are valid + * + * @param {object} typeSpecs Map of context field to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @private + */ + _checkContextTypes: function (typeSpecs, values, location) { + if (process.env.NODE_ENV !== 'production') { + checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID); + } + }, + + receiveComponent: function (nextElement, transaction, nextContext) { + var prevElement = this._currentElement; + var prevContext = this._context; + + this._pendingElement = null; + + this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); + }, + + /** + * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate` + * is set, update the component. + * + * @param {ReactReconcileTransaction} transaction + * @internal + */ + performUpdateIfNecessary: function (transaction) { + if (this._pendingElement != null) { + ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context); + } else if (this._pendingStateQueue !== null || this._pendingForceUpdate) { + this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); + } else { + this._updateBatchNumber = null; + } + }, + + /** + * Perform an update to a mounted component. The componentWillReceiveProps and + * shouldComponentUpdate methods are called, then (assuming the update isn't + * skipped) the remaining update lifecycle methods are called and the DOM + * representation is updated. + * + * By default, this implements React's rendering and reconciliation algorithm. + * Sophisticated clients may wish to override this. + * + * @param {ReactReconcileTransaction} transaction + * @param {ReactElement} prevParentElement + * @param {ReactElement} nextParentElement + * @internal + * @overridable + */ + updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { + var inst = this._instance; + !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Attempted to update component `%s` that has already been unmounted (or failed to mount).', this.getName() || 'ReactCompositeComponent') : _prodInvariant('136', this.getName() || 'ReactCompositeComponent') : void 0; + + var willReceive = false; + var nextContext; + + // Determine if the context has changed or not + if (this._context === nextUnmaskedContext) { + nextContext = inst.context; + } else { + nextContext = this._processContext(nextUnmaskedContext); + willReceive = true; + } + + var prevProps = prevParentElement.props; + var nextProps = nextParentElement.props; + + // Not a simple state update but a props update + if (prevParentElement !== nextParentElement) { + willReceive = true; + } + + // An update here will schedule an update but immediately set + // _pendingStateQueue which will ensure that any state updates gets + // immediately reconciled instead of waiting for the next batch. + if (willReceive && inst.componentWillReceiveProps) { + if (process.env.NODE_ENV !== 'production') { + measureLifeCyclePerf(function () { + return inst.componentWillReceiveProps(nextProps, nextContext); + }, this._debugID, 'componentWillReceiveProps'); + } else { + inst.componentWillReceiveProps(nextProps, nextContext); + } + } + + var nextState = this._processPendingState(nextProps, nextContext); + var shouldUpdate = true; + + if (!this._pendingForceUpdate) { + if (inst.shouldComponentUpdate) { + if (process.env.NODE_ENV !== 'production') { + shouldUpdate = measureLifeCyclePerf(function () { + return inst.shouldComponentUpdate(nextProps, nextState, nextContext); + }, this._debugID, 'shouldComponentUpdate'); + } else { + shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext); + } + } else { + if (this._compositeType === CompositeTypes.PureClass) { + shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState); + } + } + } + + if (process.env.NODE_ENV !== 'production') { + process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0; + } + + this._updateBatchNumber = null; + if (shouldUpdate) { + this._pendingForceUpdate = false; + // Will set `this.props`, `this.state` and `this.context`. + this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext); + } else { + // If it's determined that a component should not update, we still want + // to set props and state but we shortcut the rest of the update. + this._currentElement = nextParentElement; + this._context = nextUnmaskedContext; + inst.props = nextProps; + inst.state = nextState; + inst.context = nextContext; + } + }, + + _processPendingState: function (props, context) { + var inst = this._instance; + var queue = this._pendingStateQueue; + var replace = this._pendingReplaceState; + this._pendingReplaceState = false; + this._pendingStateQueue = null; + + if (!queue) { + return inst.state; + } + + if (replace && queue.length === 1) { + return queue[0]; + } + + var nextState = _assign({}, replace ? queue[0] : inst.state); + for (var i = replace ? 1 : 0; i < queue.length; i++) { + var partial = queue[i]; + _assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial); + } + + return nextState; + }, + + /** + * Merges new props and state, notifies delegate methods of update and + * performs update. + * + * @param {ReactElement} nextElement Next element + * @param {object} nextProps Next public object to set as properties. + * @param {?object} nextState Next object to set as state. + * @param {?object} nextContext Next public object to set as context. + * @param {ReactReconcileTransaction} transaction + * @param {?object} unmaskedContext + * @private + */ + _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { + var _this2 = this; + + var inst = this._instance; + + var hasComponentDidUpdate = Boolean(inst.componentDidUpdate); + var prevProps; + var prevState; + var prevContext; + if (hasComponentDidUpdate) { + prevProps = inst.props; + prevState = inst.state; + prevContext = inst.context; + } + + if (inst.componentWillUpdate) { + if (process.env.NODE_ENV !== 'production') { + measureLifeCyclePerf(function () { + return inst.componentWillUpdate(nextProps, nextState, nextContext); + }, this._debugID, 'componentWillUpdate'); + } else { + inst.componentWillUpdate(nextProps, nextState, nextContext); + } + } + + this._currentElement = nextElement; + this._context = unmaskedContext; + inst.props = nextProps; + inst.state = nextState; + inst.context = nextContext; + + this._updateRenderedComponent(transaction, unmaskedContext); + + if (hasComponentDidUpdate) { + if (process.env.NODE_ENV !== 'production') { + transaction.getReactMountReady().enqueue(function () { + measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate'); + }); + } else { + transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst); + } + } + }, + + /** + * Call the component's `render` method and update the DOM accordingly. + * + * @param {ReactReconcileTransaction} transaction + * @internal + */ + _updateRenderedComponent: function (transaction, context) { + var prevComponentInstance = this._renderedComponent; + var prevRenderedElement = prevComponentInstance._currentElement; + var nextRenderedElement = this._renderValidatedComponent(); + + var debugID = 0; + if (process.env.NODE_ENV !== 'production') { + debugID = this._debugID; + } + + if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { + ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); + } else { + var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance); + ReactReconciler.unmountComponent(prevComponentInstance, false); + + var nodeType = ReactNodeTypes.getType(nextRenderedElement); + this._renderedNodeType = nodeType; + var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */ + ); + this._renderedComponent = child; + + var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID); + + if (process.env.NODE_ENV !== 'production') { + if (debugID !== 0) { + var childDebugIDs = child._debugID !== 0 ? [child._debugID] : []; + ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); + } + } + + this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance); + } + }, + + /** + * Overridden in shallow rendering. + * + * @protected + */ + _replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) { + ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance); + }, + + /** + * @protected + */ + _renderValidatedComponentWithoutOwnerOrContext: function () { + var inst = this._instance; + var renderedElement; + + if (process.env.NODE_ENV !== 'production') { + renderedElement = measureLifeCyclePerf(function () { + return inst.render(); + }, this._debugID, 'render'); + } else { + renderedElement = inst.render(); + } + + if (process.env.NODE_ENV !== 'production') { + // We allow auto-mocks to proceed as if they're returning null. + if (renderedElement === undefined && inst.render._isMockFunction) { + // This is probably bad practice. Consider warning here and + // deprecating this convenience. + renderedElement = null; + } + } + + return renderedElement; + }, + + /** + * @private + */ + _renderValidatedComponent: function () { + var renderedElement; + if (process.env.NODE_ENV !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) { + ReactCurrentOwner.current = this; + try { + renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); + } finally { + ReactCurrentOwner.current = null; + } + } else { + renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); + } + !( + // TODO: An `isValidNode` function would probably be more appropriate + renderedElement === null || renderedElement === false || React.isValidElement(renderedElement)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : _prodInvariant('109', this.getName() || 'ReactCompositeComponent') : void 0; + + return renderedElement; + }, + + /** + * Lazily allocates the refs object and stores `component` as `ref`. + * + * @param {string} ref Reference name. + * @param {component} component Component to store as `ref`. + * @final + * @private + */ + attachRef: function (ref, component) { + var inst = this.getPublicInstance(); + !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0; + var publicComponentInstance = component.getPublicInstance(); + if (process.env.NODE_ENV !== 'production') { + var componentName = component && component.getName ? component.getName() : 'a component'; + process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null || component._compositeType !== CompositeTypes.StatelessFunctional, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0; + } + var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; + refs[ref] = publicComponentInstance; + }, + + /** + * Detaches a reference name. + * + * @param {string} ref Name to dereference. + * @final + * @private + */ + detachRef: function (ref) { + var refs = this.getPublicInstance().refs; + delete refs[ref]; + }, + + /** + * Get a text description of the component that can be used to identify it + * in error messages. + * @return {string} The name or null. + * @internal + */ + getName: function () { + var type = this._currentElement.type; + var constructor = this._instance && this._instance.constructor; + return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; + }, + + /** + * Get the publicly accessible representation of this component - i.e. what + * is exposed by refs and returned by render. Can be null for stateless + * components. + * + * @return {ReactComponent} the public component instance. + * @internal + */ + getPublicInstance: function () { + var inst = this._instance; + if (this._compositeType === CompositeTypes.StatelessFunctional) { + return null; + } + return inst; + }, + + // Stub + _instantiateReactComponent: null +}; + +module.exports = ReactCompositeComponent; + +/***/ }), +/* 150 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var ReactPropTypeLocationNames = __webpack_require__(151); +var ReactPropTypesSecret = __webpack_require__(72); + +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = __webpack_require__(6); +} + +var loggedTypeFailures = {}; + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?object} element The React element that is being type-checked + * @param {?number} debugID The React component instance that is being type-checked + * @private + */ +function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + !(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0; + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0; + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var componentStackInfo = ''; + + if (process.env.NODE_ENV !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = __webpack_require__(6); + } + if (debugID !== null) { + componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); + } else if (element !== null) { + componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); + } + } + + process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; + } + } + } +} + +module.exports = checkReactTypeSpec; + +/***/ }), +/* 151 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var ReactPropTypeLocationNames = {}; + +if (process.env.NODE_ENV !== 'production') { + ReactPropTypeLocationNames = { + prop: 'prop', + context: 'context', + childContext: 'child context' + }; +} + +module.exports = ReactPropTypeLocationNames; + +/***/ }), +/* 152 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var nextDebugID = 1; + +function getNextDebugID() { + return nextDebugID++; +} + +module.exports = getNextDebugID; + +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +// The Symbol used to tag the ReactElement type. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. + +var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; + +module.exports = REACT_ELEMENT_TYPE; + +/***/ }), +/* 154 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +/* global Symbol */ + +var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + +/** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ +function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } +} + +module.exports = getIteratorFn; + +/***/ }), +/* 155 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var KeyEscapeUtils = __webpack_require__(47); +var traverseAllChildren = __webpack_require__(78); +var warning = __webpack_require__(1); + +var ReactComponentTreeHook; + +if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { + // Temporary hack. + // Inline requires don't work well with Jest: + // https://github.com/facebook/react/issues/7240 + // Remove the inline requires when we don't need them anymore: + // https://github.com/facebook/react/pull/7178 + ReactComponentTreeHook = __webpack_require__(6); +} + +/** + * @param {function} traverseContext Context passed through traversal. + * @param {?ReactComponent} child React child component. + * @param {!string} name String name of key path to child. + * @param {number=} selfDebugID Optional debugID of the current internal instance. + */ +function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) { + // We found a component instance. + if (traverseContext && typeof traverseContext === 'object') { + var result = traverseContext; + var keyUnique = result[name] === undefined; + if (process.env.NODE_ENV !== 'production') { + if (!ReactComponentTreeHook) { + ReactComponentTreeHook = __webpack_require__(6); + } + if (!keyUnique) { + process.env.NODE_ENV !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; + } + } + if (keyUnique && child != null) { + result[name] = child; + } + } +} + +/** + * Flattens children that are typically specified as `props.children`. Any null + * children will not be included in the resulting object. + * @return {!object} flattened children keyed by name. + */ +function flattenChildren(children, selfDebugID) { + if (children == null) { + return children; + } + var result = {}; + + if (process.env.NODE_ENV !== 'production') { + traverseAllChildren(children, function (traverseContext, child, name) { + return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID); + }, result); + } else { + traverseAllChildren(children, flattenSingleChildIntoContext, result); + } + return result; +} + +module.exports = flattenChildren; + +/***/ }), +/* 156 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var PooledClass = __webpack_require__(14); +var Transaction = __webpack_require__(27); +var ReactInstrumentation = __webpack_require__(8); +var ReactServerUpdateQueue = __webpack_require__(157); + +/** + * Executed within the scope of the `Transaction` instance. Consider these as + * being member methods, but with an implied ordering while being isolated from + * each other. + */ +var TRANSACTION_WRAPPERS = []; + +if (process.env.NODE_ENV !== 'production') { + TRANSACTION_WRAPPERS.push({ + initialize: ReactInstrumentation.debugTool.onBeginFlush, + close: ReactInstrumentation.debugTool.onEndFlush + }); +} + +var noopCallbackQueue = { + enqueue: function () {} +}; + +/** + * @class ReactServerRenderingTransaction + * @param {boolean} renderToStaticMarkup + */ +function ReactServerRenderingTransaction(renderToStaticMarkup) { + this.reinitializeTransaction(); + this.renderToStaticMarkup = renderToStaticMarkup; + this.useCreateElement = false; + this.updateQueue = new ReactServerUpdateQueue(this); +} + +var Mixin = { + /** + * @see Transaction + * @abstract + * @final + * @return {array} Empty list of operation wrap procedures. + */ + getTransactionWrappers: function () { + return TRANSACTION_WRAPPERS; + }, + + /** + * @return {object} The queue to collect `onDOMReady` callbacks with. + */ + getReactMountReady: function () { + return noopCallbackQueue; + }, + + /** + * @return {object} The queue to collect React async events. + */ + getUpdateQueue: function () { + return this.updateQueue; + }, + + /** + * `PooledClass` looks for this, and will invoke this before allowing this + * instance to be reused. + */ + destructor: function () {}, + + checkpoint: function () {}, + + rollback: function () {} +}; + +_assign(ReactServerRenderingTransaction.prototype, Transaction, Mixin); + +PooledClass.addPoolingTo(ReactServerRenderingTransaction); + +module.exports = ReactServerRenderingTransaction; + +/***/ }), +/* 157 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var ReactUpdateQueue = __webpack_require__(48); + +var warning = __webpack_require__(1); + +function warnNoop(publicInstance, callerName) { + if (process.env.NODE_ENV !== 'production') { + var constructor = publicInstance.constructor; + process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; + } +} + +/** + * This is the update queue used for server rendering. + * It delegates to ReactUpdateQueue while server rendering is in progress and + * switches to ReactNoopUpdateQueue after the transaction has completed. + * @class ReactServerUpdateQueue + * @param {Transaction} transaction + */ + +var ReactServerUpdateQueue = function () { + function ReactServerUpdateQueue(transaction) { + _classCallCheck(this, ReactServerUpdateQueue); + + this.transaction = transaction; + } + + /** + * Checks whether or not this composite component is mounted. + * @param {ReactClass} publicInstance The instance we want to test. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + + + ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) { + return false; + }; + + /** + * Enqueue a callback that will be executed after all the pending updates + * have processed. + * + * @param {ReactClass} publicInstance The instance to use as `this` context. + * @param {?function} callback Called after state is updated. + * @internal + */ + + + ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) { + if (this.transaction.isInTransaction()) { + ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName); + } + }; + + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @internal + */ + + + ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) { + if (this.transaction.isInTransaction()) { + ReactUpdateQueue.enqueueForceUpdate(publicInstance); + } else { + warnNoop(publicInstance, 'forceUpdate'); + } + }; + + /** + * Replaces all of the state. Always use this or `setState` to mutate state. + * You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object|function} completeState Next state. + * @internal + */ + + + ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) { + if (this.transaction.isInTransaction()) { + ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState); + } else { + warnNoop(publicInstance, 'replaceState'); + } + }; + + /** + * Sets a subset of the state. This only exists because _pendingState is + * internal. This provides a merging strategy that is not available to deep + * properties which is confusing. TODO: Expose pendingState or don't use it + * during the merge. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object|function} partialState Next partial state to be merged with state. + * @internal + */ + + + ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) { + if (this.transaction.isInTransaction()) { + ReactUpdateQueue.enqueueSetState(publicInstance, partialState); + } else { + warnNoop(publicInstance, 'setState'); + } + }; + + return ReactServerUpdateQueue; +}(); + +module.exports = ReactServerUpdateQueue; + +/***/ }), +/* 158 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var DOMLazyTree = __webpack_require__(18); +var ReactDOMComponentTree = __webpack_require__(4); + +var ReactDOMEmptyComponent = function (instantiate) { + // ReactCompositeComponent uses this: + this._currentElement = null; + // ReactDOMComponentTree uses these: + this._hostNode = null; + this._hostParent = null; + this._hostContainerInfo = null; + this._domID = 0; +}; +_assign(ReactDOMEmptyComponent.prototype, { + mountComponent: function (transaction, hostParent, hostContainerInfo, context) { + var domID = hostContainerInfo._idCounter++; + this._domID = domID; + this._hostParent = hostParent; + this._hostContainerInfo = hostContainerInfo; + + var nodeValue = ' react-empty: ' + this._domID + ' '; + if (transaction.useCreateElement) { + var ownerDocument = hostContainerInfo._ownerDocument; + var node = ownerDocument.createComment(nodeValue); + ReactDOMComponentTree.precacheNode(this, node); + return DOMLazyTree(node); + } else { + if (transaction.renderToStaticMarkup) { + // Normally we'd insert a comment node, but since this is a situation + // where React won't take over (static pages), we can simply return + // nothing. + return ''; + } + return '<!--' + nodeValue + '-->'; + } + }, + receiveComponent: function () {}, + getHostNode: function () { + return ReactDOMComponentTree.getNodeFromInstance(this); + }, + unmountComponent: function () { + ReactDOMComponentTree.uncacheNode(this); + } +}); + +module.exports = ReactDOMEmptyComponent; + +/***/ }), +/* 159 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var invariant = __webpack_require__(0); + +/** + * Return the lowest common ancestor of A and B, or null if they are in + * different trees. + */ +function getLowestCommonAncestor(instA, instB) { + !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; + !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; + + var depthA = 0; + for (var tempA = instA; tempA; tempA = tempA._hostParent) { + depthA++; + } + var depthB = 0; + for (var tempB = instB; tempB; tempB = tempB._hostParent) { + depthB++; + } + + // If A is deeper, crawl up. + while (depthA - depthB > 0) { + instA = instA._hostParent; + depthA--; + } + + // If B is deeper, crawl up. + while (depthB - depthA > 0) { + instB = instB._hostParent; + depthB--; + } + + // Walk in lockstep until we find a match. + var depth = depthA; + while (depth--) { + if (instA === instB) { + return instA; + } + instA = instA._hostParent; + instB = instB._hostParent; + } + return null; +} + +/** + * Return if A is an ancestor of B. + */ +function isAncestor(instA, instB) { + !('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; + !('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0; + + while (instB) { + if (instB === instA) { + return true; + } + instB = instB._hostParent; + } + return false; +} + +/** + * Return the parent instance of the passed-in instance. + */ +function getParentInstance(inst) { + !('_hostNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0; + + return inst._hostParent; +} + +/** + * Simulates the traversal of a two-phase, capture/bubble event dispatch. + */ +function traverseTwoPhase(inst, fn, arg) { + var path = []; + while (inst) { + path.push(inst); + inst = inst._hostParent; + } + var i; + for (i = path.length; i-- > 0;) { + fn(path[i], 'captured', arg); + } + for (i = 0; i < path.length; i++) { + fn(path[i], 'bubbled', arg); + } +} + +/** + * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that + * should would receive a `mouseEnter` or `mouseLeave` event. + * + * Does not invoke the callback on the nearest common ancestor because nothing + * "entered" or "left" that element. + */ +function traverseEnterLeave(from, to, fn, argFrom, argTo) { + var common = from && to ? getLowestCommonAncestor(from, to) : null; + var pathFrom = []; + while (from && from !== common) { + pathFrom.push(from); + from = from._hostParent; + } + var pathTo = []; + while (to && to !== common) { + pathTo.push(to); + to = to._hostParent; + } + var i; + for (i = 0; i < pathFrom.length; i++) { + fn(pathFrom[i], 'bubbled', argFrom); + } + for (i = pathTo.length; i-- > 0;) { + fn(pathTo[i], 'captured', argTo); + } +} + +module.exports = { + isAncestor: isAncestor, + getLowestCommonAncestor: getLowestCommonAncestor, + getParentInstance: getParentInstance, + traverseTwoPhase: traverseTwoPhase, + traverseEnterLeave: traverseEnterLeave +}; + +/***/ }), +/* 160 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2), + _assign = __webpack_require__(3); + +var DOMChildrenOperations = __webpack_require__(40); +var DOMLazyTree = __webpack_require__(18); +var ReactDOMComponentTree = __webpack_require__(4); + +var escapeTextContentForBrowser = __webpack_require__(30); +var invariant = __webpack_require__(0); +var validateDOMNesting = __webpack_require__(49); + +/** + * Text nodes violate a couple assumptions that React makes about components: + * + * - When mounting text into the DOM, adjacent text nodes are merged. + * - Text nodes cannot be assigned a React root ID. + * + * This component is used to wrap strings between comment nodes so that they + * can undergo the same reconciliation that is applied to elements. + * + * TODO: Investigate representing React components in the DOM with text nodes. + * + * @class ReactDOMTextComponent + * @extends ReactComponent + * @internal + */ +var ReactDOMTextComponent = function (text) { + // TODO: This is really a ReactText (ReactNode), not a ReactElement + this._currentElement = text; + this._stringText = '' + text; + // ReactDOMComponentTree uses these: + this._hostNode = null; + this._hostParent = null; + + // Properties + this._domID = 0; + this._mountIndex = 0; + this._closingComment = null; + this._commentNodes = null; +}; + +_assign(ReactDOMTextComponent.prototype, { + /** + * Creates the markup for this text node. This node is not intended to have + * any features besides containing text content. + * + * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction + * @return {string} Markup for this text node. + * @internal + */ + mountComponent: function (transaction, hostParent, hostContainerInfo, context) { + if (process.env.NODE_ENV !== 'production') { + var parentInfo; + if (hostParent != null) { + parentInfo = hostParent._ancestorInfo; + } else if (hostContainerInfo != null) { + parentInfo = hostContainerInfo._ancestorInfo; + } + if (parentInfo) { + // parentInfo should always be present except for the top-level + // component when server rendering + validateDOMNesting(null, this._stringText, this, parentInfo); + } + } + + var domID = hostContainerInfo._idCounter++; + var openingValue = ' react-text: ' + domID + ' '; + var closingValue = ' /react-text '; + this._domID = domID; + this._hostParent = hostParent; + if (transaction.useCreateElement) { + var ownerDocument = hostContainerInfo._ownerDocument; + var openingComment = ownerDocument.createComment(openingValue); + var closingComment = ownerDocument.createComment(closingValue); + var lazyTree = DOMLazyTree(ownerDocument.createDocumentFragment()); + DOMLazyTree.queueChild(lazyTree, DOMLazyTree(openingComment)); + if (this._stringText) { + DOMLazyTree.queueChild(lazyTree, DOMLazyTree(ownerDocument.createTextNode(this._stringText))); + } + DOMLazyTree.queueChild(lazyTree, DOMLazyTree(closingComment)); + ReactDOMComponentTree.precacheNode(this, openingComment); + this._closingComment = closingComment; + return lazyTree; + } else { + var escapedText = escapeTextContentForBrowser(this._stringText); + + if (transaction.renderToStaticMarkup) { + // Normally we'd wrap this between comment nodes for the reasons stated + // above, but since this is a situation where React won't take over + // (static pages), we can simply return the text as it is. + return escapedText; + } + + return '<!--' + openingValue + '-->' + escapedText + '<!--' + closingValue + '-->'; + } + }, + + /** + * Updates this component by updating the text content. + * + * @param {ReactText} nextText The next text content + * @param {ReactReconcileTransaction} transaction + * @internal + */ + receiveComponent: function (nextText, transaction) { + if (nextText !== this._currentElement) { + this._currentElement = nextText; + var nextStringText = '' + nextText; + if (nextStringText !== this._stringText) { + // TODO: Save this as pending props and use performUpdateIfNecessary + // and/or updateComponent to do the actual update for consistency with + // other component types? + this._stringText = nextStringText; + var commentNodes = this.getHostNode(); + DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText); + } + } + }, + + getHostNode: function () { + var hostNode = this._commentNodes; + if (hostNode) { + return hostNode; + } + if (!this._closingComment) { + var openingComment = ReactDOMComponentTree.getNodeFromInstance(this); + var node = openingComment.nextSibling; + while (true) { + !(node != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Missing closing comment for text component %s', this._domID) : _prodInvariant('67', this._domID) : void 0; + if (node.nodeType === 8 && node.nodeValue === ' /react-text ') { + this._closingComment = node; + break; + } + node = node.nextSibling; + } + } + hostNode = [this._hostNode, this._closingComment]; + this._commentNodes = hostNode; + return hostNode; + }, + + unmountComponent: function () { + this._closingComment = null; + this._commentNodes = null; + ReactDOMComponentTree.uncacheNode(this); + } +}); + +module.exports = ReactDOMTextComponent; + +/***/ }), +/* 161 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var ReactUpdates = __webpack_require__(10); +var Transaction = __webpack_require__(27); + +var emptyFunction = __webpack_require__(7); + +var RESET_BATCHED_UPDATES = { + initialize: emptyFunction, + close: function () { + ReactDefaultBatchingStrategy.isBatchingUpdates = false; + } +}; + +var FLUSH_BATCHED_UPDATES = { + initialize: emptyFunction, + close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates) +}; + +var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]; + +function ReactDefaultBatchingStrategyTransaction() { + this.reinitializeTransaction(); +} + +_assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, { + getTransactionWrappers: function () { + return TRANSACTION_WRAPPERS; + } +}); + +var transaction = new ReactDefaultBatchingStrategyTransaction(); + +var ReactDefaultBatchingStrategy = { + isBatchingUpdates: false, + + /** + * Call the provided function in a context within which calls to `setState` + * and friends are batched such that components aren't updated unnecessarily. + */ + batchedUpdates: function (callback, a, b, c, d, e) { + var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; + + ReactDefaultBatchingStrategy.isBatchingUpdates = true; + + // The code is written this way to avoid extra allocations + if (alreadyBatchingUpdates) { + return callback(a, b, c, d, e); + } else { + return transaction.perform(callback, null, a, b, c, d, e); + } + } +}; + +module.exports = ReactDefaultBatchingStrategy; + +/***/ }), +/* 162 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var EventListener = __webpack_require__(79); +var ExecutionEnvironment = __webpack_require__(5); +var PooledClass = __webpack_require__(14); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactUpdates = __webpack_require__(10); + +var getEventTarget = __webpack_require__(37); +var getUnboundedScrollPosition = __webpack_require__(163); + +/** + * Find the deepest React component completely containing the root of the + * passed-in instance (for use when entire React trees are nested within each + * other). If React trees are not nested, returns null. + */ +function findParent(inst) { + // TODO: It may be a good idea to cache this to prevent unnecessary DOM + // traversal, but caching is difficult to do correctly without using a + // mutation observer to listen for all DOM changes. + while (inst._hostParent) { + inst = inst._hostParent; + } + var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst); + var container = rootNode.parentNode; + return ReactDOMComponentTree.getClosestInstanceFromNode(container); +} + +// Used to store ancestor hierarchy in top level callback +function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { + this.topLevelType = topLevelType; + this.nativeEvent = nativeEvent; + this.ancestors = []; +} +_assign(TopLevelCallbackBookKeeping.prototype, { + destructor: function () { + this.topLevelType = null; + this.nativeEvent = null; + this.ancestors.length = 0; + } +}); +PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler); + +function handleTopLevelImpl(bookKeeping) { + var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent); + var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget); + + // Loop through the hierarchy, in case there's any nested components. + // It's important that we build the array of ancestors before calling any + // event handlers, because event handlers can modify the DOM, leading to + // inconsistencies with ReactMount's node cache. See #1105. + var ancestor = targetInst; + do { + bookKeeping.ancestors.push(ancestor); + ancestor = ancestor && findParent(ancestor); + } while (ancestor); + + for (var i = 0; i < bookKeeping.ancestors.length; i++) { + targetInst = bookKeeping.ancestors[i]; + ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); + } +} + +function scrollValueMonitor(cb) { + var scrollPosition = getUnboundedScrollPosition(window); + cb(scrollPosition); +} + +var ReactEventListener = { + _enabled: true, + _handleTopLevel: null, + + WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null, + + setHandleTopLevel: function (handleTopLevel) { + ReactEventListener._handleTopLevel = handleTopLevel; + }, + + setEnabled: function (enabled) { + ReactEventListener._enabled = !!enabled; + }, + + isEnabled: function () { + return ReactEventListener._enabled; + }, + + /** + * Traps top-level events by using event bubbling. + * + * @param {string} topLevelType Record from `EventConstants`. + * @param {string} handlerBaseName Event name (e.g. "click"). + * @param {object} element Element on which to attach listener. + * @return {?object} An object with a remove function which will forcefully + * remove the listener. + * @internal + */ + trapBubbledEvent: function (topLevelType, handlerBaseName, element) { + if (!element) { + return null; + } + return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); + }, + + /** + * Traps a top-level event by using event capturing. + * + * @param {string} topLevelType Record from `EventConstants`. + * @param {string} handlerBaseName Event name (e.g. "click"). + * @param {object} element Element on which to attach listener. + * @return {?object} An object with a remove function which will forcefully + * remove the listener. + * @internal + */ + trapCapturedEvent: function (topLevelType, handlerBaseName, element) { + if (!element) { + return null; + } + return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType)); + }, + + monitorScrollValue: function (refresh) { + var callback = scrollValueMonitor.bind(null, refresh); + EventListener.listen(window, 'scroll', callback); + }, + + dispatchEvent: function (topLevelType, nativeEvent) { + if (!ReactEventListener._enabled) { + return; + } + + var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent); + try { + // Event queue being processed in the same cycle allows + // `preventDefault`. + ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping); + } finally { + TopLevelCallbackBookKeeping.release(bookKeeping); + } + } +}; + +module.exports = ReactEventListener; + +/***/ }), +/* 163 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + + + +/** + * Gets the scroll position of the supplied element or window. + * + * The return values are unbounded, unlike `getScrollPosition`. This means they + * may be negative or exceed the element boundaries (which is possible using + * inertial scrolling). + * + * @param {DOMWindow|DOMElement} scrollable + * @return {object} Map with `x` and `y` keys. + */ + +function getUnboundedScrollPosition(scrollable) { + if (scrollable.Window && scrollable instanceof scrollable.Window) { + return { + x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft, + y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop + }; + } + return { + x: scrollable.scrollLeft, + y: scrollable.scrollTop + }; +} + +module.exports = getUnboundedScrollPosition; + +/***/ }), +/* 164 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMProperty = __webpack_require__(12); +var EventPluginHub = __webpack_require__(21); +var EventPluginUtils = __webpack_require__(35); +var ReactComponentEnvironment = __webpack_require__(44); +var ReactEmptyComponent = __webpack_require__(76); +var ReactBrowserEventEmitter = __webpack_require__(31); +var ReactHostComponent = __webpack_require__(77); +var ReactUpdates = __webpack_require__(10); + +var ReactInjection = { + Component: ReactComponentEnvironment.injection, + DOMProperty: DOMProperty.injection, + EmptyComponent: ReactEmptyComponent.injection, + EventPluginHub: EventPluginHub.injection, + EventPluginUtils: EventPluginUtils.injection, + EventEmitter: ReactBrowserEventEmitter.injection, + HostComponent: ReactHostComponent.injection, + Updates: ReactUpdates.injection +}; + +module.exports = ReactInjection; + +/***/ }), +/* 165 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _assign = __webpack_require__(3); + +var CallbackQueue = __webpack_require__(63); +var PooledClass = __webpack_require__(14); +var ReactBrowserEventEmitter = __webpack_require__(31); +var ReactInputSelection = __webpack_require__(80); +var ReactInstrumentation = __webpack_require__(8); +var Transaction = __webpack_require__(27); +var ReactUpdateQueue = __webpack_require__(48); + +/** + * Ensures that, when possible, the selection range (currently selected text + * input) is not disturbed by performing the transaction. + */ +var SELECTION_RESTORATION = { + /** + * @return {Selection} Selection information. + */ + initialize: ReactInputSelection.getSelectionInformation, + /** + * @param {Selection} sel Selection information returned from `initialize`. + */ + close: ReactInputSelection.restoreSelection +}; + +/** + * Suppresses events (blur/focus) that could be inadvertently dispatched due to + * high level DOM manipulations (like temporarily removing a text input from the + * DOM). + */ +var EVENT_SUPPRESSION = { + /** + * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before + * the reconciliation. + */ + initialize: function () { + var currentlyEnabled = ReactBrowserEventEmitter.isEnabled(); + ReactBrowserEventEmitter.setEnabled(false); + return currentlyEnabled; + }, + + /** + * @param {boolean} previouslyEnabled Enabled status of + * `ReactBrowserEventEmitter` before the reconciliation occurred. `close` + * restores the previous value. + */ + close: function (previouslyEnabled) { + ReactBrowserEventEmitter.setEnabled(previouslyEnabled); + } +}; + +/** + * Provides a queue for collecting `componentDidMount` and + * `componentDidUpdate` callbacks during the transaction. + */ +var ON_DOM_READY_QUEUEING = { + /** + * Initializes the internal `onDOMReady` queue. + */ + initialize: function () { + this.reactMountReady.reset(); + }, + + /** + * After DOM is flushed, invoke all registered `onDOMReady` callbacks. + */ + close: function () { + this.reactMountReady.notifyAll(); + } +}; + +/** + * Executed within the scope of the `Transaction` instance. Consider these as + * being member methods, but with an implied ordering while being isolated from + * each other. + */ +var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING]; + +if (process.env.NODE_ENV !== 'production') { + TRANSACTION_WRAPPERS.push({ + initialize: ReactInstrumentation.debugTool.onBeginFlush, + close: ReactInstrumentation.debugTool.onEndFlush + }); +} + +/** + * Currently: + * - The order that these are listed in the transaction is critical: + * - Suppresses events. + * - Restores selection range. + * + * Future: + * - Restore document/overflow scroll positions that were unintentionally + * modified via DOM insertions above the top viewport boundary. + * - Implement/integrate with customized constraint based layout system and keep + * track of which dimensions must be remeasured. + * + * @class ReactReconcileTransaction + */ +function ReactReconcileTransaction(useCreateElement) { + this.reinitializeTransaction(); + // Only server-side rendering really needs this option (see + // `ReactServerRendering`), but server-side uses + // `ReactServerRenderingTransaction` instead. This option is here so that it's + // accessible and defaults to false when `ReactDOMComponent` and + // `ReactDOMTextComponent` checks it in `mountComponent`.` + this.renderToStaticMarkup = false; + this.reactMountReady = CallbackQueue.getPooled(null); + this.useCreateElement = useCreateElement; +} + +var Mixin = { + /** + * @see Transaction + * @abstract + * @final + * @return {array<object>} List of operation wrap procedures. + * TODO: convert to array<TransactionWrapper> + */ + getTransactionWrappers: function () { + return TRANSACTION_WRAPPERS; + }, + + /** + * @return {object} The queue to collect `onDOMReady` callbacks with. + */ + getReactMountReady: function () { + return this.reactMountReady; + }, + + /** + * @return {object} The queue to collect React async events. + */ + getUpdateQueue: function () { + return ReactUpdateQueue; + }, + + /** + * Save current transaction state -- if the return value from this method is + * passed to `rollback`, the transaction will be reset to that state. + */ + checkpoint: function () { + // reactMountReady is the our only stateful wrapper + return this.reactMountReady.checkpoint(); + }, + + rollback: function (checkpoint) { + this.reactMountReady.rollback(checkpoint); + }, + + /** + * `PooledClass` looks for this, and will invoke this before allowing this + * instance to be reused. + */ + destructor: function () { + CallbackQueue.release(this.reactMountReady); + this.reactMountReady = null; + } +}; + +_assign(ReactReconcileTransaction.prototype, Transaction, Mixin); + +PooledClass.addPoolingTo(ReactReconcileTransaction); + +module.exports = ReactReconcileTransaction; + +/***/ }), +/* 166 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ExecutionEnvironment = __webpack_require__(5); + +var getNodeForCharacterOffset = __webpack_require__(167); +var getTextContentAccessor = __webpack_require__(62); + +/** + * While `isCollapsed` is available on the Selection object and `collapsed` + * is available on the Range object, IE11 sometimes gets them wrong. + * If the anchor/focus nodes and offsets are the same, the range is collapsed. + */ +function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) { + return anchorNode === focusNode && anchorOffset === focusOffset; +} + +/** + * Get the appropriate anchor and focus node/offset pairs for IE. + * + * The catch here is that IE's selection API doesn't provide information + * about whether the selection is forward or backward, so we have to + * behave as though it's always forward. + * + * IE text differs from modern selection in that it behaves as though + * block elements end with a new line. This means character offsets will + * differ between the two APIs. + * + * @param {DOMElement} node + * @return {object} + */ +function getIEOffsets(node) { + var selection = document.selection; + var selectedRange = selection.createRange(); + var selectedLength = selectedRange.text.length; + + // Duplicate selection so we can move range without breaking user selection. + var fromStart = selectedRange.duplicate(); + fromStart.moveToElementText(node); + fromStart.setEndPoint('EndToStart', selectedRange); + + var startOffset = fromStart.text.length; + var endOffset = startOffset + selectedLength; + + return { + start: startOffset, + end: endOffset + }; +} + +/** + * @param {DOMElement} node + * @return {?object} + */ +function getModernOffsets(node) { + var selection = window.getSelection && window.getSelection(); + + if (!selection || selection.rangeCount === 0) { + return null; + } + + var anchorNode = selection.anchorNode; + var anchorOffset = selection.anchorOffset; + var focusNode = selection.focusNode; + var focusOffset = selection.focusOffset; + + var currentRange = selection.getRangeAt(0); + + // In Firefox, range.startContainer and range.endContainer can be "anonymous + // divs", e.g. the up/down buttons on an <input type="number">. Anonymous + // divs do not seem to expose properties, triggering a "Permission denied + // error" if any of its properties are accessed. The only seemingly possible + // way to avoid erroring is to access a property that typically works for + // non-anonymous divs and catch any error that may otherwise arise. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 + try { + /* eslint-disable no-unused-expressions */ + currentRange.startContainer.nodeType; + currentRange.endContainer.nodeType; + /* eslint-enable no-unused-expressions */ + } catch (e) { + return null; + } + + // If the node and offset values are the same, the selection is collapsed. + // `Selection.isCollapsed` is available natively, but IE sometimes gets + // this value wrong. + var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset); + + var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length; + + var tempRange = currentRange.cloneRange(); + tempRange.selectNodeContents(node); + tempRange.setEnd(currentRange.startContainer, currentRange.startOffset); + + var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset); + + var start = isTempRangeCollapsed ? 0 : tempRange.toString().length; + var end = start + rangeLength; + + // Detect whether the selection is backward. + var detectionRange = document.createRange(); + detectionRange.setStart(anchorNode, anchorOffset); + detectionRange.setEnd(focusNode, focusOffset); + var isBackward = detectionRange.collapsed; + + return { + start: isBackward ? end : start, + end: isBackward ? start : end + }; +} + +/** + * @param {DOMElement|DOMTextNode} node + * @param {object} offsets + */ +function setIEOffsets(node, offsets) { + var range = document.selection.createRange().duplicate(); + var start, end; + + if (offsets.end === undefined) { + start = offsets.start; + end = start; + } else if (offsets.start > offsets.end) { + start = offsets.end; + end = offsets.start; + } else { + start = offsets.start; + end = offsets.end; + } + + range.moveToElementText(node); + range.moveStart('character', start); + range.setEndPoint('EndToStart', range); + range.moveEnd('character', end - start); + range.select(); +} + +/** + * In modern non-IE browsers, we can support both forward and backward + * selections. + * + * Note: IE10+ supports the Selection object, but it does not support + * the `extend` method, which means that even in modern IE, it's not possible + * to programmatically create a backward selection. Thus, for all IE + * versions, we use the old IE API to create our selections. + * + * @param {DOMElement|DOMTextNode} node + * @param {object} offsets + */ +function setModernOffsets(node, offsets) { + if (!window.getSelection) { + return; + } + + var selection = window.getSelection(); + var length = node[getTextContentAccessor()].length; + var start = Math.min(offsets.start, length); + var end = offsets.end === undefined ? start : Math.min(offsets.end, length); + + // IE 11 uses modern selection, but doesn't support the extend method. + // Flip backward selections, so we can set with a single range. + if (!selection.extend && start > end) { + var temp = end; + end = start; + start = temp; + } + + var startMarker = getNodeForCharacterOffset(node, start); + var endMarker = getNodeForCharacterOffset(node, end); + + if (startMarker && endMarker) { + var range = document.createRange(); + range.setStart(startMarker.node, startMarker.offset); + selection.removeAllRanges(); + + if (start > end) { + selection.addRange(range); + selection.extend(endMarker.node, endMarker.offset); + } else { + range.setEnd(endMarker.node, endMarker.offset); + selection.addRange(range); + } + } +} + +var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window); + +var ReactDOMSelection = { + /** + * @param {DOMElement} node + */ + getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets, + + /** + * @param {DOMElement|DOMTextNode} node + * @param {object} offsets + */ + setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets +}; + +module.exports = ReactDOMSelection; + +/***/ }), +/* 167 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +/** + * Given any node return the first leaf node without children. + * + * @param {DOMElement|DOMTextNode} node + * @return {DOMElement|DOMTextNode} + */ + +function getLeafNode(node) { + while (node && node.firstChild) { + node = node.firstChild; + } + return node; +} + +/** + * Get the next sibling within a container. This will walk up the + * DOM if a node's siblings have been exhausted. + * + * @param {DOMElement|DOMTextNode} node + * @return {?DOMElement|DOMTextNode} + */ +function getSiblingNode(node) { + while (node) { + if (node.nextSibling) { + return node.nextSibling; + } + node = node.parentNode; + } +} + +/** + * Get object describing the nodes which contain characters at offset. + * + * @param {DOMElement|DOMTextNode} root + * @param {number} offset + * @return {?object} + */ +function getNodeForCharacterOffset(root, offset) { + var node = getLeafNode(root); + var nodeStart = 0; + var nodeEnd = 0; + + while (node) { + if (node.nodeType === 3) { + nodeEnd = nodeStart + node.textContent.length; + + if (nodeStart <= offset && nodeEnd >= offset) { + return { + node: node, + offset: offset - nodeStart + }; + } + + nodeStart = nodeEnd; + } + + node = getLeafNode(getSiblingNode(node)); + } +} + +module.exports = getNodeForCharacterOffset; + +/***/ }), +/* 168 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + +var isTextNode = __webpack_require__(169); + +/*eslint-disable no-bitwise */ + +/** + * Checks if a given DOM node contains or is another DOM node. + */ +function containsNode(outerNode, innerNode) { + if (!outerNode || !innerNode) { + return false; + } else if (outerNode === innerNode) { + return true; + } else if (isTextNode(outerNode)) { + return false; + } else if (isTextNode(innerNode)) { + return containsNode(outerNode, innerNode.parentNode); + } else if ('contains' in outerNode) { + return outerNode.contains(innerNode); + } else if (outerNode.compareDocumentPosition) { + return !!(outerNode.compareDocumentPosition(innerNode) & 16); + } else { + return false; + } +} + +module.exports = containsNode; + +/***/ }), +/* 169 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +var isNode = __webpack_require__(170); + +/** + * @param {*} object The object to check. + * @return {boolean} Whether or not the object is a DOM text node. + */ +function isTextNode(object) { + return isNode(object) && object.nodeType == 3; +} + +module.exports = isTextNode; + +/***/ }), +/* 170 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @typechecks + */ + +/** + * @param {*} object The object to check. + * @return {boolean} Whether or not the object is a DOM node. + */ +function isNode(object) { + var doc = object ? object.ownerDocument || object : document; + var defaultView = doc.defaultView || window; + return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); +} + +module.exports = isNode; + +/***/ }), +/* 171 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var NS = { + xlink: 'http://www.w3.org/1999/xlink', + xml: 'http://www.w3.org/XML/1998/namespace' +}; + +// We use attributes for everything SVG so let's avoid some duplication and run +// code instead. +// The following are all specified in the HTML config already so we exclude here. +// - class (as className) +// - color +// - height +// - id +// - lang +// - max +// - media +// - method +// - min +// - name +// - style +// - target +// - type +// - width +var ATTRS = { + accentHeight: 'accent-height', + accumulate: 0, + additive: 0, + alignmentBaseline: 'alignment-baseline', + allowReorder: 'allowReorder', + alphabetic: 0, + amplitude: 0, + arabicForm: 'arabic-form', + ascent: 0, + attributeName: 'attributeName', + attributeType: 'attributeType', + autoReverse: 'autoReverse', + azimuth: 0, + baseFrequency: 'baseFrequency', + baseProfile: 'baseProfile', + baselineShift: 'baseline-shift', + bbox: 0, + begin: 0, + bias: 0, + by: 0, + calcMode: 'calcMode', + capHeight: 'cap-height', + clip: 0, + clipPath: 'clip-path', + clipRule: 'clip-rule', + clipPathUnits: 'clipPathUnits', + colorInterpolation: 'color-interpolation', + colorInterpolationFilters: 'color-interpolation-filters', + colorProfile: 'color-profile', + colorRendering: 'color-rendering', + contentScriptType: 'contentScriptType', + contentStyleType: 'contentStyleType', + cursor: 0, + cx: 0, + cy: 0, + d: 0, + decelerate: 0, + descent: 0, + diffuseConstant: 'diffuseConstant', + direction: 0, + display: 0, + divisor: 0, + dominantBaseline: 'dominant-baseline', + dur: 0, + dx: 0, + dy: 0, + edgeMode: 'edgeMode', + elevation: 0, + enableBackground: 'enable-background', + end: 0, + exponent: 0, + externalResourcesRequired: 'externalResourcesRequired', + fill: 0, + fillOpacity: 'fill-opacity', + fillRule: 'fill-rule', + filter: 0, + filterRes: 'filterRes', + filterUnits: 'filterUnits', + floodColor: 'flood-color', + floodOpacity: 'flood-opacity', + focusable: 0, + fontFamily: 'font-family', + fontSize: 'font-size', + fontSizeAdjust: 'font-size-adjust', + fontStretch: 'font-stretch', + fontStyle: 'font-style', + fontVariant: 'font-variant', + fontWeight: 'font-weight', + format: 0, + from: 0, + fx: 0, + fy: 0, + g1: 0, + g2: 0, + glyphName: 'glyph-name', + glyphOrientationHorizontal: 'glyph-orientation-horizontal', + glyphOrientationVertical: 'glyph-orientation-vertical', + glyphRef: 'glyphRef', + gradientTransform: 'gradientTransform', + gradientUnits: 'gradientUnits', + hanging: 0, + horizAdvX: 'horiz-adv-x', + horizOriginX: 'horiz-origin-x', + ideographic: 0, + imageRendering: 'image-rendering', + 'in': 0, + in2: 0, + intercept: 0, + k: 0, + k1: 0, + k2: 0, + k3: 0, + k4: 0, + kernelMatrix: 'kernelMatrix', + kernelUnitLength: 'kernelUnitLength', + kerning: 0, + keyPoints: 'keyPoints', + keySplines: 'keySplines', + keyTimes: 'keyTimes', + lengthAdjust: 'lengthAdjust', + letterSpacing: 'letter-spacing', + lightingColor: 'lighting-color', + limitingConeAngle: 'limitingConeAngle', + local: 0, + markerEnd: 'marker-end', + markerMid: 'marker-mid', + markerStart: 'marker-start', + markerHeight: 'markerHeight', + markerUnits: 'markerUnits', + markerWidth: 'markerWidth', + mask: 0, + maskContentUnits: 'maskContentUnits', + maskUnits: 'maskUnits', + mathematical: 0, + mode: 0, + numOctaves: 'numOctaves', + offset: 0, + opacity: 0, + operator: 0, + order: 0, + orient: 0, + orientation: 0, + origin: 0, + overflow: 0, + overlinePosition: 'overline-position', + overlineThickness: 'overline-thickness', + paintOrder: 'paint-order', + panose1: 'panose-1', + pathLength: 'pathLength', + patternContentUnits: 'patternContentUnits', + patternTransform: 'patternTransform', + patternUnits: 'patternUnits', + pointerEvents: 'pointer-events', + points: 0, + pointsAtX: 'pointsAtX', + pointsAtY: 'pointsAtY', + pointsAtZ: 'pointsAtZ', + preserveAlpha: 'preserveAlpha', + preserveAspectRatio: 'preserveAspectRatio', + primitiveUnits: 'primitiveUnits', + r: 0, + radius: 0, + refX: 'refX', + refY: 'refY', + renderingIntent: 'rendering-intent', + repeatCount: 'repeatCount', + repeatDur: 'repeatDur', + requiredExtensions: 'requiredExtensions', + requiredFeatures: 'requiredFeatures', + restart: 0, + result: 0, + rotate: 0, + rx: 0, + ry: 0, + scale: 0, + seed: 0, + shapeRendering: 'shape-rendering', + slope: 0, + spacing: 0, + specularConstant: 'specularConstant', + specularExponent: 'specularExponent', + speed: 0, + spreadMethod: 'spreadMethod', + startOffset: 'startOffset', + stdDeviation: 'stdDeviation', + stemh: 0, + stemv: 0, + stitchTiles: 'stitchTiles', + stopColor: 'stop-color', + stopOpacity: 'stop-opacity', + strikethroughPosition: 'strikethrough-position', + strikethroughThickness: 'strikethrough-thickness', + string: 0, + stroke: 0, + strokeDasharray: 'stroke-dasharray', + strokeDashoffset: 'stroke-dashoffset', + strokeLinecap: 'stroke-linecap', + strokeLinejoin: 'stroke-linejoin', + strokeMiterlimit: 'stroke-miterlimit', + strokeOpacity: 'stroke-opacity', + strokeWidth: 'stroke-width', + surfaceScale: 'surfaceScale', + systemLanguage: 'systemLanguage', + tableValues: 'tableValues', + targetX: 'targetX', + targetY: 'targetY', + textAnchor: 'text-anchor', + textDecoration: 'text-decoration', + textRendering: 'text-rendering', + textLength: 'textLength', + to: 0, + transform: 0, + u1: 0, + u2: 0, + underlinePosition: 'underline-position', + underlineThickness: 'underline-thickness', + unicode: 0, + unicodeBidi: 'unicode-bidi', + unicodeRange: 'unicode-range', + unitsPerEm: 'units-per-em', + vAlphabetic: 'v-alphabetic', + vHanging: 'v-hanging', + vIdeographic: 'v-ideographic', + vMathematical: 'v-mathematical', + values: 0, + vectorEffect: 'vector-effect', + version: 0, + vertAdvY: 'vert-adv-y', + vertOriginX: 'vert-origin-x', + vertOriginY: 'vert-origin-y', + viewBox: 'viewBox', + viewTarget: 'viewTarget', + visibility: 0, + widths: 0, + wordSpacing: 'word-spacing', + writingMode: 'writing-mode', + x: 0, + xHeight: 'x-height', + x1: 0, + x2: 0, + xChannelSelector: 'xChannelSelector', + xlinkActuate: 'xlink:actuate', + xlinkArcrole: 'xlink:arcrole', + xlinkHref: 'xlink:href', + xlinkRole: 'xlink:role', + xlinkShow: 'xlink:show', + xlinkTitle: 'xlink:title', + xlinkType: 'xlink:type', + xmlBase: 'xml:base', + xmlns: 0, + xmlnsXlink: 'xmlns:xlink', + xmlLang: 'xml:lang', + xmlSpace: 'xml:space', + y: 0, + y1: 0, + y2: 0, + yChannelSelector: 'yChannelSelector', + z: 0, + zoomAndPan: 'zoomAndPan' +}; + +var SVGDOMPropertyConfig = { + Properties: {}, + DOMAttributeNamespaces: { + xlinkActuate: NS.xlink, + xlinkArcrole: NS.xlink, + xlinkHref: NS.xlink, + xlinkRole: NS.xlink, + xlinkShow: NS.xlink, + xlinkTitle: NS.xlink, + xlinkType: NS.xlink, + xmlBase: NS.xml, + xmlLang: NS.xml, + xmlSpace: NS.xml + }, + DOMAttributeNames: {} +}; + +Object.keys(ATTRS).forEach(function (key) { + SVGDOMPropertyConfig.Properties[key] = 0; + if (ATTRS[key]) { + SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key]; + } +}); + +module.exports = SVGDOMPropertyConfig; + +/***/ }), +/* 172 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var EventPropagators = __webpack_require__(20); +var ExecutionEnvironment = __webpack_require__(5); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactInputSelection = __webpack_require__(80); +var SyntheticEvent = __webpack_require__(11); + +var getActiveElement = __webpack_require__(81); +var isTextInputElement = __webpack_require__(66); +var shallowEqual = __webpack_require__(45); + +var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11; + +var eventTypes = { + select: { + phasedRegistrationNames: { + bubbled: 'onSelect', + captured: 'onSelectCapture' + }, + dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange'] + } +}; + +var activeElement = null; +var activeElementInst = null; +var lastSelection = null; +var mouseDown = false; + +// Track whether a listener exists for this plugin. If none exist, we do +// not extract events. See #3639. +var hasListener = false; + +/** + * Get an object which is a unique representation of the current selection. + * + * The return value will not be consistent across nodes or browsers, but + * two identical selections on the same node will return identical objects. + * + * @param {DOMElement} node + * @return {object} + */ +function getSelection(node) { + if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) { + return { + start: node.selectionStart, + end: node.selectionEnd + }; + } else if (window.getSelection) { + var selection = window.getSelection(); + return { + anchorNode: selection.anchorNode, + anchorOffset: selection.anchorOffset, + focusNode: selection.focusNode, + focusOffset: selection.focusOffset + }; + } else if (document.selection) { + var range = document.selection.createRange(); + return { + parentElement: range.parentElement(), + text: range.text, + top: range.boundingTop, + left: range.boundingLeft + }; + } +} + +/** + * Poll selection to see whether it's changed. + * + * @param {object} nativeEvent + * @return {?SyntheticEvent} + */ +function constructSelectEvent(nativeEvent, nativeEventTarget) { + // Ensure we have the right element, and that the user is not dragging a + // selection (this matches native `select` event behavior). In HTML5, select + // fires only on input and textarea thus if there's no focused element we + // won't dispatch. + if (mouseDown || activeElement == null || activeElement !== getActiveElement()) { + return null; + } + + // Only fire when selection has actually changed. + var currentSelection = getSelection(activeElement); + if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { + lastSelection = currentSelection; + + var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget); + + syntheticEvent.type = 'select'; + syntheticEvent.target = activeElement; + + EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent); + + return syntheticEvent; + } + + return null; +} + +/** + * This plugin creates an `onSelect` event that normalizes select events + * across form elements. + * + * Supported elements are: + * - input (see `isTextInputElement`) + * - textarea + * - contentEditable + * + * This differs from native browser implementations in the following ways: + * - Fires on contentEditable fields as well as inputs. + * - Fires for collapsed selection. + * - Fires after user input. + */ +var SelectEventPlugin = { + eventTypes: eventTypes, + + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + if (!hasListener) { + return null; + } + + var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; + + switch (topLevelType) { + // Track the input node that has focus. + case 'topFocus': + if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { + activeElement = targetNode; + activeElementInst = targetInst; + lastSelection = null; + } + break; + case 'topBlur': + activeElement = null; + activeElementInst = null; + lastSelection = null; + break; + // Don't fire the event while the user is dragging. This matches the + // semantics of the native select event. + case 'topMouseDown': + mouseDown = true; + break; + case 'topContextMenu': + case 'topMouseUp': + mouseDown = false; + return constructSelectEvent(nativeEvent, nativeEventTarget); + // Chrome and IE fire non-standard event when selection is changed (and + // sometimes when it hasn't). IE's event fires out of order with respect + // to key and input events on deletion, so we discard it. + // + // Firefox doesn't support selectionchange, so check selection status + // after each key entry. The selection changes after keydown and before + // keyup, but we check on keydown as well in the case of holding down a + // key, when multiple keydown events are fired but only one keyup is. + // This is also our approach for IE handling, for the reason above. + case 'topSelectionChange': + if (skipSelectionChangeEvent) { + break; + } + // falls through + case 'topKeyDown': + case 'topKeyUp': + return constructSelectEvent(nativeEvent, nativeEventTarget); + } + + return null; + }, + + didPutListener: function (inst, registrationName, listener) { + if (registrationName === 'onSelect') { + hasListener = true; + } + } +}; + +module.exports = SelectEventPlugin; + +/***/ }), +/* 173 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var EventListener = __webpack_require__(79); +var EventPropagators = __webpack_require__(20); +var ReactDOMComponentTree = __webpack_require__(4); +var SyntheticAnimationEvent = __webpack_require__(174); +var SyntheticClipboardEvent = __webpack_require__(175); +var SyntheticEvent = __webpack_require__(11); +var SyntheticFocusEvent = __webpack_require__(176); +var SyntheticKeyboardEvent = __webpack_require__(177); +var SyntheticMouseEvent = __webpack_require__(28); +var SyntheticDragEvent = __webpack_require__(179); +var SyntheticTouchEvent = __webpack_require__(180); +var SyntheticTransitionEvent = __webpack_require__(181); +var SyntheticUIEvent = __webpack_require__(22); +var SyntheticWheelEvent = __webpack_require__(182); + +var emptyFunction = __webpack_require__(7); +var getEventCharCode = __webpack_require__(50); +var invariant = __webpack_require__(0); + +/** + * Turns + * ['abort', ...] + * into + * eventTypes = { + * 'abort': { + * phasedRegistrationNames: { + * bubbled: 'onAbort', + * captured: 'onAbortCapture', + * }, + * dependencies: ['topAbort'], + * }, + * ... + * }; + * topLevelEventsToDispatchConfig = { + * 'topAbort': { sameConfig } + * }; + */ +var eventTypes = {}; +var topLevelEventsToDispatchConfig = {}; +['abort', 'animationEnd', 'animationIteration', 'animationStart', 'blur', 'canPlay', 'canPlayThrough', 'click', 'contextMenu', 'copy', 'cut', 'doubleClick', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'progress', 'rateChange', 'reset', 'scroll', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchMove', 'touchStart', 'transitionEnd', 'volumeChange', 'waiting', 'wheel'].forEach(function (event) { + var capitalizedEvent = event[0].toUpperCase() + event.slice(1); + var onEvent = 'on' + capitalizedEvent; + var topEvent = 'top' + capitalizedEvent; + + var type = { + phasedRegistrationNames: { + bubbled: onEvent, + captured: onEvent + 'Capture' + }, + dependencies: [topEvent] + }; + eventTypes[event] = type; + topLevelEventsToDispatchConfig[topEvent] = type; +}); + +var onClickListeners = {}; + +function getDictionaryKey(inst) { + // Prevents V8 performance issue: + // https://github.com/facebook/react/pull/7232 + return '.' + inst._rootNodeID; +} + +function isInteractive(tag) { + return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; +} + +var SimpleEventPlugin = { + eventTypes: eventTypes, + + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { + var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; + if (!dispatchConfig) { + return null; + } + var EventConstructor; + switch (topLevelType) { + case 'topAbort': + case 'topCanPlay': + case 'topCanPlayThrough': + case 'topDurationChange': + case 'topEmptied': + case 'topEncrypted': + case 'topEnded': + case 'topError': + case 'topInput': + case 'topInvalid': + case 'topLoad': + case 'topLoadedData': + case 'topLoadedMetadata': + case 'topLoadStart': + case 'topPause': + case 'topPlay': + case 'topPlaying': + case 'topProgress': + case 'topRateChange': + case 'topReset': + case 'topSeeked': + case 'topSeeking': + case 'topStalled': + case 'topSubmit': + case 'topSuspend': + case 'topTimeUpdate': + case 'topVolumeChange': + case 'topWaiting': + // HTML Events + // @see http://www.w3.org/TR/html5/index.html#events-0 + EventConstructor = SyntheticEvent; + break; + case 'topKeyPress': + // Firefox creates a keypress event for function keys too. This removes + // the unwanted keypress events. Enter is however both printable and + // non-printable. One would expect Tab to be as well (but it isn't). + if (getEventCharCode(nativeEvent) === 0) { + return null; + } + /* falls through */ + case 'topKeyDown': + case 'topKeyUp': + EventConstructor = SyntheticKeyboardEvent; + break; + case 'topBlur': + case 'topFocus': + EventConstructor = SyntheticFocusEvent; + break; + case 'topClick': + // Firefox creates a click event on right mouse clicks. This removes the + // unwanted click events. + if (nativeEvent.button === 2) { + return null; + } + /* falls through */ + case 'topDoubleClick': + case 'topMouseDown': + case 'topMouseMove': + case 'topMouseUp': + // TODO: Disabled elements should not respond to mouse events + /* falls through */ + case 'topMouseOut': + case 'topMouseOver': + case 'topContextMenu': + EventConstructor = SyntheticMouseEvent; + break; + case 'topDrag': + case 'topDragEnd': + case 'topDragEnter': + case 'topDragExit': + case 'topDragLeave': + case 'topDragOver': + case 'topDragStart': + case 'topDrop': + EventConstructor = SyntheticDragEvent; + break; + case 'topTouchCancel': + case 'topTouchEnd': + case 'topTouchMove': + case 'topTouchStart': + EventConstructor = SyntheticTouchEvent; + break; + case 'topAnimationEnd': + case 'topAnimationIteration': + case 'topAnimationStart': + EventConstructor = SyntheticAnimationEvent; + break; + case 'topTransitionEnd': + EventConstructor = SyntheticTransitionEvent; + break; + case 'topScroll': + EventConstructor = SyntheticUIEvent; + break; + case 'topWheel': + EventConstructor = SyntheticWheelEvent; + break; + case 'topCopy': + case 'topCut': + case 'topPaste': + EventConstructor = SyntheticClipboardEvent; + break; + } + !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0; + var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); + EventPropagators.accumulateTwoPhaseDispatches(event); + return event; + }, + + didPutListener: function (inst, registrationName, listener) { + // Mobile Safari does not fire properly bubble click events on + // non-interactive elements, which means delegated click listeners do not + // fire. The workaround for this bug involves attaching an empty click + // listener on the target node. + // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html + if (registrationName === 'onClick' && !isInteractive(inst._tag)) { + var key = getDictionaryKey(inst); + var node = ReactDOMComponentTree.getNodeFromInstance(inst); + if (!onClickListeners[key]) { + onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction); + } + } + }, + + willDeleteListener: function (inst, registrationName) { + if (registrationName === 'onClick' && !isInteractive(inst._tag)) { + var key = getDictionaryKey(inst); + onClickListeners[key].remove(); + delete onClickListeners[key]; + } + } +}; + +module.exports = SimpleEventPlugin; + +/***/ }), +/* 174 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticEvent = __webpack_require__(11); + +/** + * @interface Event + * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface + * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent + */ +var AnimationEventInterface = { + animationName: null, + elapsedTime: null, + pseudoElement: null +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticEvent} + */ +function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface); + +module.exports = SyntheticAnimationEvent; + +/***/ }), +/* 175 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticEvent = __webpack_require__(11); + +/** + * @interface Event + * @see http://www.w3.org/TR/clipboard-apis/ + */ +var ClipboardEventInterface = { + clipboardData: function (event) { + return 'clipboardData' in event ? event.clipboardData : window.clipboardData; + } +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticUIEvent} + */ +function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface); + +module.exports = SyntheticClipboardEvent; + +/***/ }), +/* 176 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticUIEvent = __webpack_require__(22); + +/** + * @interface FocusEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var FocusEventInterface = { + relatedTarget: null +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticUIEvent} + */ +function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface); + +module.exports = SyntheticFocusEvent; + +/***/ }), +/* 177 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticUIEvent = __webpack_require__(22); + +var getEventCharCode = __webpack_require__(50); +var getEventKey = __webpack_require__(178); +var getEventModifierState = __webpack_require__(39); + +/** + * @interface KeyboardEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var KeyboardEventInterface = { + key: getEventKey, + location: null, + ctrlKey: null, + shiftKey: null, + altKey: null, + metaKey: null, + repeat: null, + locale: null, + getModifierState: getEventModifierState, + // Legacy Interface + charCode: function (event) { + // `charCode` is the result of a KeyPress event and represents the value of + // the actual printable character. + + // KeyPress is deprecated, but its replacement is not yet final and not + // implemented in any major browser. Only KeyPress has charCode. + if (event.type === 'keypress') { + return getEventCharCode(event); + } + return 0; + }, + keyCode: function (event) { + // `keyCode` is the result of a KeyDown/Up event and represents the value of + // physical keyboard key. + + // The actual meaning of the value depends on the users' keyboard layout + // which cannot be detected. Assuming that it is a US keyboard layout + // provides a surprisingly accurate mapping for US and European users. + // Due to this, it is left to the user to implement at this time. + if (event.type === 'keydown' || event.type === 'keyup') { + return event.keyCode; + } + return 0; + }, + which: function (event) { + // `which` is an alias for either `keyCode` or `charCode` depending on the + // type of the event. + if (event.type === 'keypress') { + return getEventCharCode(event); + } + if (event.type === 'keydown' || event.type === 'keyup') { + return event.keyCode; + } + return 0; + } +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticUIEvent} + */ +function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface); + +module.exports = SyntheticKeyboardEvent; + +/***/ }), +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var getEventCharCode = __webpack_require__(50); + +/** + * Normalization of deprecated HTML5 `key` values + * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names + */ +var normalizeKey = { + Esc: 'Escape', + Spacebar: ' ', + Left: 'ArrowLeft', + Up: 'ArrowUp', + Right: 'ArrowRight', + Down: 'ArrowDown', + Del: 'Delete', + Win: 'OS', + Menu: 'ContextMenu', + Apps: 'ContextMenu', + Scroll: 'ScrollLock', + MozPrintableKey: 'Unidentified' +}; + +/** + * Translation from legacy `keyCode` to HTML5 `key` + * Only special keys supported, all others depend on keyboard layout or browser + * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names + */ +var translateToKey = { + 8: 'Backspace', + 9: 'Tab', + 12: 'Clear', + 13: 'Enter', + 16: 'Shift', + 17: 'Control', + 18: 'Alt', + 19: 'Pause', + 20: 'CapsLock', + 27: 'Escape', + 32: ' ', + 33: 'PageUp', + 34: 'PageDown', + 35: 'End', + 36: 'Home', + 37: 'ArrowLeft', + 38: 'ArrowUp', + 39: 'ArrowRight', + 40: 'ArrowDown', + 45: 'Insert', + 46: 'Delete', + 112: 'F1', + 113: 'F2', + 114: 'F3', + 115: 'F4', + 116: 'F5', + 117: 'F6', + 118: 'F7', + 119: 'F8', + 120: 'F9', + 121: 'F10', + 122: 'F11', + 123: 'F12', + 144: 'NumLock', + 145: 'ScrollLock', + 224: 'Meta' +}; + +/** + * @param {object} nativeEvent Native browser event. + * @return {string} Normalized `key` property. + */ +function getEventKey(nativeEvent) { + if (nativeEvent.key) { + // Normalize inconsistent values reported by browsers due to + // implementations of a working draft specification. + + // FireFox implements `key` but returns `MozPrintableKey` for all + // printable characters (normalized to `Unidentified`), ignore it. + var key = normalizeKey[nativeEvent.key] || nativeEvent.key; + if (key !== 'Unidentified') { + return key; + } + } + + // Browser does not implement `key`, polyfill as much of it as we can. + if (nativeEvent.type === 'keypress') { + var charCode = getEventCharCode(nativeEvent); + + // The enter-key is technically both printable and non-printable and can + // thus be captured by `keypress`, no other non-printable key should. + return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); + } + if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { + // While user keyboard layout determines the actual meaning of each + // `keyCode` value, almost all function keys have a universal value. + return translateToKey[nativeEvent.keyCode] || 'Unidentified'; + } + return ''; +} + +module.exports = getEventKey; + +/***/ }), +/* 179 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticMouseEvent = __webpack_require__(28); + +/** + * @interface DragEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var DragEventInterface = { + dataTransfer: null +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticUIEvent} + */ +function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface); + +module.exports = SyntheticDragEvent; + +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticUIEvent = __webpack_require__(22); + +var getEventModifierState = __webpack_require__(39); + +/** + * @interface TouchEvent + * @see http://www.w3.org/TR/touch-events/ + */ +var TouchEventInterface = { + touches: null, + targetTouches: null, + changedTouches: null, + altKey: null, + metaKey: null, + ctrlKey: null, + shiftKey: null, + getModifierState: getEventModifierState +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticUIEvent} + */ +function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface); + +module.exports = SyntheticTouchEvent; + +/***/ }), +/* 181 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticEvent = __webpack_require__(11); + +/** + * @interface Event + * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- + * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent + */ +var TransitionEventInterface = { + propertyName: null, + elapsedTime: null, + pseudoElement: null +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticEvent} + */ +function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticEvent.augmentClass(SyntheticTransitionEvent, TransitionEventInterface); + +module.exports = SyntheticTransitionEvent; + +/***/ }), +/* 182 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var SyntheticMouseEvent = __webpack_require__(28); + +/** + * @interface WheelEvent + * @see http://www.w3.org/TR/DOM-Level-3-Events/ + */ +var WheelEventInterface = { + deltaX: function (event) { + return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). + 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; + }, + deltaY: function (event) { + return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). + 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). + 'wheelDelta' in event ? -event.wheelDelta : 0; + }, + deltaZ: null, + + // Browsers without "deltaMode" is reporting in raw wheel delta where one + // notch on the scroll is always +/- 120, roughly equivalent to pixels. + // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or + // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. + deltaMode: null +}; + +/** + * @param {object} dispatchConfig Configuration used to dispatch this event. + * @param {string} dispatchMarker Marker identifying the event target. + * @param {object} nativeEvent Native browser event. + * @extends {SyntheticMouseEvent} + */ +function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { + return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); +} + +SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface); + +module.exports = SyntheticWheelEvent; + +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var validateDOMNesting = __webpack_require__(49); + +var DOC_NODE_TYPE = 9; + +function ReactDOMContainerInfo(topLevelWrapper, node) { + var info = { + _topLevelWrapper: topLevelWrapper, + _idCounter: 1, + _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null, + _node: node, + _tag: node ? node.nodeName.toLowerCase() : null, + _namespaceURI: node ? node.namespaceURI : null + }; + if (process.env.NODE_ENV !== 'production') { + info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null; + } + return info; +} + +module.exports = ReactDOMContainerInfo; + +/***/ }), +/* 184 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactDOMFeatureFlags = { + useCreateElement: true, + useFiber: false +}; + +module.exports = ReactDOMFeatureFlags; + +/***/ }), +/* 185 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var adler32 = __webpack_require__(186); + +var TAG_END = /\/?>/; +var COMMENT_START = /^<\!\-\-/; + +var ReactMarkupChecksum = { + CHECKSUM_ATTR_NAME: 'data-react-checksum', + + /** + * @param {string} markup Markup string + * @return {string} Markup string with checksum attribute attached + */ + addChecksumToMarkup: function (markup) { + var checksum = adler32(markup); + + // Add checksum (handle both parent tags, comments and self-closing tags) + if (COMMENT_START.test(markup)) { + return markup; + } else { + return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&'); + } + }, + + /** + * @param {string} markup to use + * @param {DOMElement} element root React element + * @returns {boolean} whether or not the markup is the same + */ + canReuseMarkup: function (markup, element) { + var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME); + existingChecksum = existingChecksum && parseInt(existingChecksum, 10); + var markupChecksum = adler32(markup); + return markupChecksum === existingChecksum; + } +}; + +module.exports = ReactMarkupChecksum; + +/***/ }), +/* 186 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +var MOD = 65521; + +// adler32 is not cryptographically strong, and is only used to sanity check that +// markup generated on the server matches the markup generated on the client. +// This implementation (a modified version of the SheetJS version) has been optimized +// for our use case, at the expense of conforming to the adler32 specification +// for non-ascii inputs. +function adler32(data) { + var a = 1; + var b = 0; + var i = 0; + var l = data.length; + var m = l & ~0x3; + while (i < m) { + var n = Math.min(i + 4096, m); + for (; i < n; i += 4) { + b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3)); + } + a %= MOD; + b %= MOD; + } + for (; i < l; i++) { + b += a += data.charCodeAt(i); + } + a %= MOD; + b %= MOD; + return a | b << 16; +} + +module.exports = adler32; + +/***/ }), +/* 187 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +module.exports = '15.6.2'; + +/***/ }), +/* 188 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var _prodInvariant = __webpack_require__(2); + +var ReactCurrentOwner = __webpack_require__(9); +var ReactDOMComponentTree = __webpack_require__(4); +var ReactInstanceMap = __webpack_require__(23); + +var getHostComponentFromComposite = __webpack_require__(83); +var invariant = __webpack_require__(0); +var warning = __webpack_require__(1); + +/** + * Returns the DOM node rendered by this element. + * + * See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode + * + * @param {ReactComponent|DOMElement} componentOrElement + * @return {?DOMElement} The root node of this element. + */ +function findDOMNode(componentOrElement) { + if (process.env.NODE_ENV !== 'production') { + var owner = ReactCurrentOwner.current; + if (owner !== null) { + process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0; + owner._warnedAboutRefsInRender = true; + } + } + if (componentOrElement == null) { + return null; + } + if (componentOrElement.nodeType === 1) { + return componentOrElement; + } + + var inst = ReactInstanceMap.get(componentOrElement); + if (inst) { + inst = getHostComponentFromComposite(inst); + return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null; + } + + if (typeof componentOrElement.render === 'function') { + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0; + } else { + true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0; + } +} + +module.exports = findDOMNode; + +/***/ }), +/* 189 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactMount = __webpack_require__(82); + +module.exports = ReactMount.renderSubtreeIntoContainer; + +/***/ }), +/* 190 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMProperty = __webpack_require__(12); +var EventPluginRegistry = __webpack_require__(26); +var ReactComponentTreeHook = __webpack_require__(6); + +var warning = __webpack_require__(1); + +if (process.env.NODE_ENV !== 'production') { + var reactProps = { + children: true, + dangerouslySetInnerHTML: true, + key: true, + ref: true, + + autoFocus: true, + defaultValue: true, + valueLink: true, + defaultChecked: true, + checkedLink: true, + innerHTML: true, + suppressContentEditableWarning: true, + onFocusIn: true, + onFocusOut: true + }; + var warnedProperties = {}; + + var validateProperty = function (tagName, name, debugID) { + if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) { + return true; + } + if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { + return true; + } + if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) { + return true; + } + warnedProperties[name] = true; + var lowerCasedName = name.toLowerCase(); + + // data-* attributes should be lowercase; suggest the lowercase version + var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; + + var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null; + + if (standardName != null) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; + return true; + } else if (registrationName != null) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; + return true; + } else { + // We were unable to guess which prop the user intended. + // It is likely that the user was just blindly spreading/forwarding props + // Components should be careful to only render valid props/attributes. + // Warning will be invoked in warnUnknownProperties to allow grouping. + return false; + } + }; +} + +var warnUnknownProperties = function (debugID, element) { + var unknownProps = []; + for (var key in element.props) { + var isValid = validateProperty(element.type, key, debugID); + if (!isValid) { + unknownProps.push(key); + } + } + + var unknownPropString = unknownProps.map(function (prop) { + return '`' + prop + '`'; + }).join(', '); + + if (unknownProps.length === 1) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown prop %s on <%s> tag. Remove this prop from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; + } else if (unknownProps.length > 1) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown props %s on <%s> tag. Remove these props from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; + } +}; + +function handleElement(debugID, element) { + if (element == null || typeof element.type !== 'string') { + return; + } + if (element.type.indexOf('-') >= 0 || element.props.is) { + return; + } + warnUnknownProperties(debugID, element); +} + +var ReactDOMUnknownPropertyHook = { + onBeforeMountComponent: function (debugID, element) { + handleElement(debugID, element); + }, + onBeforeUpdateComponent: function (debugID, element) { + handleElement(debugID, element); + } +}; + +module.exports = ReactDOMUnknownPropertyHook; + +/***/ }), +/* 191 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var ReactComponentTreeHook = __webpack_require__(6); + +var warning = __webpack_require__(1); + +var didWarnValueNull = false; + +function handleElement(debugID, element) { + if (element == null) { + return; + } + if (element.type !== 'input' && element.type !== 'textarea' && element.type !== 'select') { + return; + } + if (element.props != null && element.props.value === null && !didWarnValueNull) { + process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; + + didWarnValueNull = true; + } +} + +var ReactDOMNullInputValuePropHook = { + onBeforeMountComponent: function (debugID, element) { + handleElement(debugID, element); + }, + onBeforeUpdateComponent: function (debugID, element) { + handleElement(debugID, element); + } +}; + +module.exports = ReactDOMNullInputValuePropHook; + +/***/ }), +/* 192 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + + +var DOMProperty = __webpack_require__(12); +var ReactComponentTreeHook = __webpack_require__(6); + +var warning = __webpack_require__(1); + +var warnedProperties = {}; +var rARIA = new RegExp('^(aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$'); + +function validateProperty(tagName, name, debugID) { + if (warnedProperties.hasOwnProperty(name) && warnedProperties[name]) { + return true; + } + + if (rARIA.test(name)) { + var lowerCasedName = name.toLowerCase(); + var standardName = DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null; + + // If this is an aria-* attribute, but is not listed in the known DOM + // DOM properties, then it is an invalid aria-* attribute. + if (standardName == null) { + warnedProperties[name] = true; + return false; + } + // aria-* attributes should be lowercase; suggest the lowercase version. + if (name !== standardName) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown ARIA attribute %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; + warnedProperties[name] = true; + return true; + } + } + + return true; +} + +function warnInvalidARIAProps(debugID, element) { + var invalidProps = []; + + for (var key in element.props) { + var isValid = validateProperty(element.type, key, debugID); + if (!isValid) { + invalidProps.push(key); + } + } + + var unknownPropString = invalidProps.map(function (prop) { + return '`' + prop + '`'; + }).join(', '); + + if (invalidProps.length === 1) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; + } else if (invalidProps.length > 1) { + process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; + } +} + +function handleElement(debugID, element) { + if (element == null || typeof element.type !== 'string') { + return; + } + if (element.type.indexOf('-') >= 0 || element.props.is) { + return; + } + + warnInvalidARIAProps(debugID, element); +} + +var ReactDOMInvalidARIAHook = { + onBeforeMountComponent: function (debugID, element) { + if (process.env.NODE_ENV !== 'production') { + handleElement(debugID, element); + } + }, + onBeforeUpdateComponent: function (debugID, element) { + if (process.env.NODE_ENV !== 'production') { + handleElement(debugID, element); + } + } +}; + +module.exports = ReactDOMInvalidARIAHook; + +/***/ }), +/* 193 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _react = __webpack_require__(19); + +var _react2 = _interopRequireDefault(_react); + +var _reactDom = __webpack_require__(34); + +var _reactDom2 = _interopRequireDefault(_reactDom); + +var _reactSelect = __webpack_require__(194); + +var _reactSelect2 = _interopRequireDefault(_reactSelect); + +var _electron = __webpack_require__(198); + +var _quotes_copy = __webpack_require__(199); + +var _quotes_copy2 = _interopRequireDefault(_quotes_copy); + +var _Progress = __webpack_require__(200); + +var _Progress2 = _interopRequireDefault(_Progress); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var VIDEO_REF = 'video'; +var DOWNLOAD_OPTIONS = [{ value: 'deb', label: 'Ubuntu (deb)' }, { value: 'tar.gz', label: 'Linux (tar.gz)' }, { value: 'nope', label: 'I\'ll figure it out' }]; +var RELEASE_CHANNEL = _electron.remote.getGlobal('releaseChannel'); +var LINUX_DOWNLOAD_URL_BASE = 'https://discordapp.com/api/download/' + RELEASE_CHANNEL + '?platform=linux&format='; + +var ipcRenderer = { + send: function send(event) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + return _electron.ipcRenderer.send.apply(_electron.ipcRenderer, ['DISCORD_' + event].concat(args)); + }, + on: function on(event, callback) { + return _electron.ipcRenderer.on('DISCORD_' + event, callback); + }, + removeListener: function removeListener(event, callback) { + return _electron.ipcRenderer.removeListener('DISCORD_' + event, callback); + } +}; + +var Splash = _react2.default.createClass({ + displayName: 'Splash', + setInterval: function setInterval(interval, callback) { + this.clearInterval(); + + this._interval = window.setInterval(callback, interval); + }, + clearInterval: function clearInterval() { + if (this._interval) { + window.clearInterval(this._interval); + this._interval = null; + } + }, + componentWillUnmount: function componentWillUnmount() { + this.clearInterval(); + }, + getInitialState: function getInitialState() { + return { + quote: _quotes_copy2.default[Math.floor(Math.random() * _quotes_copy2.default.length)], + videoLoaded: false, + status: 'checking-for-updates', + update: {}, + selectedDownload: 'deb' + }; + }, + componentDidMount: function componentDidMount() { + var _this = this; + + _reactDom2.default.findDOMNode(this.refs[VIDEO_REF]).addEventListener('loadeddata', this.handleVideoLoaded); + this.setInterval(1000, this.updateCountdownSeconds); + ipcRenderer.on('SPLASH_UPDATE_STATE', function (_e, state) { + _this.setState({ update: state }); + }); + ipcRenderer.send('SPLASH_SCREEN_READY'); + }, + updateCountdownSeconds: function updateCountdownSeconds() { + if (this.state.update.seconds > 0) { + var newUpdateState = this.state.update; + newUpdateState.seconds -= 1; + this.setState({ update: newUpdateState }); + } + }, + handleVideoLoaded: function handleVideoLoaded() { + this.setState({ videoLoaded: true }); + }, + handleDownloadChanged: function handleDownloadChanged(selection) { + this.setState({ selectedDownload: selection.value }); + }, + handleDownload: function handleDownload() { + if (this.state.selectedDownload != 'nope') { + var url = LINUX_DOWNLOAD_URL_BASE + this.state.selectedDownload; + _electron.shell.openExternal(url, { activate: true }); + } + _electron.remote.app.quit(); + }, + render: function render() { + var statusText = void 0; + var progress = _react2.default.createElement( + 'div', + { className: 'progress-placeholder' }, + '\xA0' + ); + switch (this.state.update.status) { + case 'installing-updates': + statusText = _react2.default.createElement( + 'span', + null, + 'Installing Update ', + this.state.update.current, + ' of ', + this.state.update.total + ); + if (this.state.update.progress > 0) { + progress = _react2.default.createElement(_Progress2.default, { percent: this.state.update.progress }); + } + break; + case 'downloading-updates': + statusText = _react2.default.createElement( + 'span', + null, + 'Downloading Update ', + this.state.update.current, + ' of ', + this.state.update.total + ); + if (this.state.update.progress > 0) { + progress = _react2.default.createElement(_Progress2.default, { percent: this.state.update.progress }); + } + break; + case 'update-failure': + statusText = _react2.default.createElement( + 'span', + null, + 'Update Failed \u2014 Retrying in ', + this.state.update.seconds, + ' sec' + ); + break; + case 'launching': + statusText = _react2.default.createElement( + 'span', + null, + 'Starting' + ); + break; + case 'update-manually': + var buttonText = this.state.selectedDownload != 'nope' ? 'Download' : 'Okay'; + return _react2.default.createElement( + 'div', + { id: 'splash' }, + _react2.default.createElement( + 'div', + { className: 'splash-inner-dl' }, + _react2.default.createElement('div', { className: 'dice-image' }), + _react2.default.createElement( + 'div', + { className: 'dl-update-message' }, + 'Must be your lucky day, there\u2019s a new update!' + ), + _react2.default.createElement( + 'div', + { className: 'dl-select-frame' }, + _react2.default.createElement(_reactSelect2.default, { + value: this.state.selectedDownload, + autosize: false, + clearable: false, + searchable: false, + options: DOWNLOAD_OPTIONS, + disabled: false, + onChange: this.handleDownloadChanged + }), + _react2.default.createElement( + 'div', + { className: 'dl-button', onClick: this.handleDownload }, + buttonText + ) + ), + _react2.default.createElement( + 'div', + { className: 'dl-version-message' }, + 'Version ', + this.state.update.newVersion, + ' available' + ) + ) + ); + case 'checking-for-updates': + default: + statusText = _react2.default.createElement( + 'span', + null, + 'Checking For Updates' + ); + break; + } + + return _react2.default.createElement( + 'div', + { id: 'splash' }, + _react2.default.createElement( + 'div', + { className: 'splash-inner' }, + _react2.default.createElement( + 'video', + { + autoPlay: true, + width: 200, + height: 200, + loop: true, + ref: VIDEO_REF, + className: this.state.videoLoaded && 'loaded' || undefined }, + _react2.default.createElement('source', { src: '../videos/connecting.webm', type: 'video/webm' }) + ), + _react2.default.createElement( + 'span', + { className: 'quote' }, + this.state.quote + ), + statusText, + progress + ) + ); + } +}); + +exports.default = Splash; +module.exports = exports['default']; + +/***/ }), +/* 194 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Async", function() { return Async; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncCreatable", function() { return AsyncCreatableSelect; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Creatable", function() { return CreatableSelect; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Value", function() { return Value; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Option", function() { return Option; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultMenuRenderer", function() { return menuRenderer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultArrowRenderer", function() { return arrowRenderer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultClearRenderer", function() { return clearRenderer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultFilterOptions", function() { return filterOptions; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(19); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types__ = __webpack_require__(84); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_prop_types__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_dom__ = __webpack_require__(34); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_react_dom__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_react_input_autosize__ = __webpack_require__(196); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_react_input_autosize___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_react_input_autosize__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_classnames__ = __webpack_require__(197); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_classnames__); + + + + + + +function arrowRenderer(_ref) { + var onMouseDown = _ref.onMouseDown; + + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('span', { + className: 'Select-arrow', + onMouseDown: onMouseDown + }); +} + +arrowRenderer.propTypes = { + onMouseDown: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func +}; + +var map = [{ 'base': 'A', 'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g }, { 'base': 'AA', 'letters': /[\uA732]/g }, { 'base': 'AE', 'letters': /[\u00C6\u01FC\u01E2]/g }, { 'base': 'AO', 'letters': /[\uA734]/g }, { 'base': 'AU', 'letters': /[\uA736]/g }, { 'base': 'AV', 'letters': /[\uA738\uA73A]/g }, { 'base': 'AY', 'letters': /[\uA73C]/g }, { 'base': 'B', 'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g }, { 'base': 'C', 'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g }, { 'base': 'D', 'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g }, { 'base': 'DZ', 'letters': /[\u01F1\u01C4]/g }, { 'base': 'Dz', 'letters': /[\u01F2\u01C5]/g }, { 'base': 'E', 'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g }, { 'base': 'F', 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g }, { 'base': 'G', 'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g }, { 'base': 'H', 'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g }, { 'base': 'I', 'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g }, { 'base': 'J', 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g }, { 'base': 'K', 'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g }, { 'base': 'L', 'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g }, { 'base': 'LJ', 'letters': /[\u01C7]/g }, { 'base': 'Lj', 'letters': /[\u01C8]/g }, { 'base': 'M', 'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g }, { 'base': 'N', 'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g }, { 'base': 'NJ', 'letters': /[\u01CA]/g }, { 'base': 'Nj', 'letters': /[\u01CB]/g }, { 'base': 'O', 'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g }, { 'base': 'OI', 'letters': /[\u01A2]/g }, { 'base': 'OO', 'letters': /[\uA74E]/g }, { 'base': 'OU', 'letters': /[\u0222]/g }, { 'base': 'P', 'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g }, { 'base': 'Q', 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g }, { 'base': 'R', 'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g }, { 'base': 'S', 'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g }, { 'base': 'T', 'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g }, { 'base': 'TZ', 'letters': /[\uA728]/g }, { 'base': 'U', 'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g }, { 'base': 'V', 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g }, { 'base': 'VY', 'letters': /[\uA760]/g }, { 'base': 'W', 'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g }, { 'base': 'X', 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g }, { 'base': 'Y', 'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g }, { 'base': 'Z', 'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g }, { 'base': 'a', 'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g }, { 'base': 'aa', 'letters': /[\uA733]/g }, { 'base': 'ae', 'letters': /[\u00E6\u01FD\u01E3]/g }, { 'base': 'ao', 'letters': /[\uA735]/g }, { 'base': 'au', 'letters': /[\uA737]/g }, { 'base': 'av', 'letters': /[\uA739\uA73B]/g }, { 'base': 'ay', 'letters': /[\uA73D]/g }, { 'base': 'b', 'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g }, { 'base': 'c', 'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g }, { 'base': 'd', 'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g }, { 'base': 'dz', 'letters': /[\u01F3\u01C6]/g }, { 'base': 'e', 'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g }, { 'base': 'f', 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g }, { 'base': 'g', 'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g }, { 'base': 'h', 'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g }, { 'base': 'hv', 'letters': /[\u0195]/g }, { 'base': 'i', 'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g }, { 'base': 'j', 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g }, { 'base': 'k', 'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g }, { 'base': 'l', 'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g }, { 'base': 'lj', 'letters': /[\u01C9]/g }, { 'base': 'm', 'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g }, { 'base': 'n', 'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g }, { 'base': 'nj', 'letters': /[\u01CC]/g }, { 'base': 'o', 'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g }, { 'base': 'oi', 'letters': /[\u01A3]/g }, { 'base': 'ou', 'letters': /[\u0223]/g }, { 'base': 'oo', 'letters': /[\uA74F]/g }, { 'base': 'p', 'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g }, { 'base': 'q', 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g }, { 'base': 'r', 'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g }, { 'base': 's', 'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g }, { 'base': 't', 'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g }, { 'base': 'tz', 'letters': /[\uA729]/g }, { 'base': 'u', 'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g }, { 'base': 'v', 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g }, { 'base': 'vy', 'letters': /[\uA761]/g }, { 'base': 'w', 'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g }, { 'base': 'x', 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g }, { 'base': 'y', 'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g }, { 'base': 'z', 'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g }]; + +function stripDiacritics(str) { + for (var i = 0; i < map.length; i++) { + str = str.replace(map[i].letters, map[i].base); + } + return str; +} + +function trim(str) { + return str.replace(/^\s+|\s+$/g, ''); +} + +function filterOptions(options, filterValue, excludeOptions, props) { + var _this = this; + + if (props.ignoreAccents) { + filterValue = stripDiacritics(filterValue); + } + + if (props.ignoreCase) { + filterValue = filterValue.toLowerCase(); + } + + if (props.trimFilter) { + filterValue = trim(filterValue); + } + + if (excludeOptions) excludeOptions = excludeOptions.map(function (i) { + return i[props.valueKey]; + }); + + return options.filter(function (option) { + if (excludeOptions && excludeOptions.indexOf(option[props.valueKey]) > -1) return false; + if (props.filterOption) return props.filterOption.call(_this, option, filterValue); + if (!filterValue) return true; + var valueTest = String(option[props.valueKey]); + var labelTest = String(option[props.labelKey]); + + if (props.ignoreAccents) { + if (props.matchProp !== 'label') valueTest = stripDiacritics(valueTest); + if (props.matchProp !== 'value') labelTest = stripDiacritics(labelTest); + } + + if (props.ignoreCase) { + if (props.matchProp !== 'label') valueTest = valueTest.toLowerCase(); + if (props.matchProp !== 'value') labelTest = labelTest.toLowerCase(); + } + return props.matchPos === 'start' ? props.matchProp !== 'label' && valueTest.substr(0, filterValue.length) === filterValue || props.matchProp !== 'value' && labelTest.substr(0, filterValue.length) === filterValue : props.matchProp !== 'label' && valueTest.indexOf(filterValue) >= 0 || props.matchProp !== 'value' && labelTest.indexOf(filterValue) >= 0; + }); +} + +function menuRenderer(_ref) { + var focusedOption = _ref.focusedOption, + focusOption = _ref.focusOption, + inputValue = _ref.inputValue, + instancePrefix = _ref.instancePrefix, + labelKey = _ref.labelKey, + onFocus = _ref.onFocus, + onOptionRef = _ref.onOptionRef, + onSelect = _ref.onSelect, + optionClassName = _ref.optionClassName, + optionComponent = _ref.optionComponent, + optionRenderer = _ref.optionRenderer, + options = _ref.options, + removeValue = _ref.removeValue, + selectValue = _ref.selectValue, + valueArray = _ref.valueArray, + valueKey = _ref.valueKey; + + var Option = optionComponent; + + return options.map(function (option, i) { + var isSelected = valueArray && valueArray.some(function (x) { + return x[valueKey] == option[valueKey]; + }); + var isFocused = option === focusedOption; + var optionClass = __WEBPACK_IMPORTED_MODULE_4_classnames___default()(optionClassName, { + 'Select-option': true, + 'is-selected': isSelected, + 'is-focused': isFocused, + 'is-disabled': option.disabled + }); + + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + Option, + { + className: optionClass, + focusOption: focusOption, + inputValue: inputValue, + instancePrefix: instancePrefix, + isDisabled: option.disabled, + isFocused: isFocused, + isSelected: isSelected, + key: 'option-' + i + '-' + option[valueKey], + onFocus: onFocus, + onSelect: onSelect, + option: option, + optionIndex: i, + ref: function ref(_ref2) { + onOptionRef(_ref2, isFocused); + }, + removeValue: removeValue, + selectValue: selectValue + }, + optionRenderer(option, i, inputValue) + ); + }); +} + +function clearRenderer() { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('span', { + className: 'Select-clear', + dangerouslySetInnerHTML: { __html: '×' } + }); +} + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; +} : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; +}; + + + + + +var asyncGenerator = function () { + function AwaitValue(value) { + this.value = value; + } + + function AsyncGenerator(gen) { + var front, back; + + function send(key, arg) { + return new Promise(function (resolve, reject) { + var request = { + key: key, + arg: arg, + resolve: resolve, + reject: reject, + next: null + }; + + if (back) { + back = back.next = request; + } else { + front = back = request; + resume(key, arg); + } + }); + } + + function resume(key, arg) { + try { + var result = gen[key](arg); + var value = result.value; + + if (value instanceof AwaitValue) { + Promise.resolve(value.value).then(function (arg) { + resume("next", arg); + }, function (arg) { + resume("throw", arg); + }); + } else { + settle(result.done ? "return" : "normal", result.value); + } + } catch (err) { + settle("throw", err); + } + } + + function settle(type, value) { + switch (type) { + case "return": + front.resolve({ + value: value, + done: true + }); + break; + + case "throw": + front.reject(value); + break; + + default: + front.resolve({ + value: value, + done: false + }); + break; + } + + front = front.next; + + if (front) { + resume(front.key, front.arg); + } else { + back = null; + } + } + + this._invoke = send; + + if (typeof gen.return !== "function") { + this.return = undefined; + } + } + + if (typeof Symbol === "function" && Symbol.asyncIterator) { + AsyncGenerator.prototype[Symbol.asyncIterator] = function () { + return this; + }; + } + + AsyncGenerator.prototype.next = function (arg) { + return this._invoke("next", arg); + }; + + AsyncGenerator.prototype.throw = function (arg) { + return this._invoke("throw", arg); + }; + + AsyncGenerator.prototype.return = function (arg) { + return this._invoke("return", arg); + }; + + return { + wrap: function (fn) { + return function () { + return new AsyncGenerator(fn.apply(this, arguments)); + }; + }, + await: function (value) { + return new AwaitValue(value); + } + }; +}(); + + + + + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + + + + + +var defineProperty = function (obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +}; + +var _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; +}; + + + +var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +}; + + + + + + + + + +var objectWithoutProperties = function (obj, keys) { + var target = {}; + + for (var i in obj) { + if (keys.indexOf(i) >= 0) continue; + if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; + target[i] = obj[i]; + } + + return target; +}; + +var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; +}; + +var Option = function (_React$Component) { + inherits(Option, _React$Component); + + function Option(props) { + classCallCheck(this, Option); + + var _this = possibleConstructorReturn(this, (Option.__proto__ || Object.getPrototypeOf(Option)).call(this, props)); + + _this.handleMouseDown = _this.handleMouseDown.bind(_this); + _this.handleMouseEnter = _this.handleMouseEnter.bind(_this); + _this.handleMouseMove = _this.handleMouseMove.bind(_this); + _this.handleTouchStart = _this.handleTouchStart.bind(_this); + _this.handleTouchEnd = _this.handleTouchEnd.bind(_this); + _this.handleTouchMove = _this.handleTouchMove.bind(_this); + _this.onFocus = _this.onFocus.bind(_this); + return _this; + } + + createClass(Option, [{ + key: 'blockEvent', + value: function blockEvent(event) { + event.preventDefault(); + event.stopPropagation(); + if (event.target.tagName !== 'A' || !('href' in event.target)) { + return; + } + if (event.target.target) { + window.open(event.target.href, event.target.target); + } else { + window.location.href = event.target.href; + } + } + }, { + key: 'handleMouseDown', + value: function handleMouseDown(event) { + event.preventDefault(); + event.stopPropagation(); + this.props.onSelect(this.props.option, event); + } + }, { + key: 'handleMouseEnter', + value: function handleMouseEnter(event) { + this.onFocus(event); + } + }, { + key: 'handleMouseMove', + value: function handleMouseMove(event) { + this.onFocus(event); + } + }, { + key: 'handleTouchEnd', + value: function handleTouchEnd(event) { + // Check if the view is being dragged, In this case + // we don't want to fire the click event (because the user only wants to scroll) + if (this.dragging) return; + + this.handleMouseDown(event); + } + }, { + key: 'handleTouchMove', + value: function handleTouchMove(event) { + // Set a flag that the view is being dragged + this.dragging = true; + } + }, { + key: 'handleTouchStart', + value: function handleTouchStart(event) { + // Set a flag that the view is not being dragged + this.dragging = false; + } + }, { + key: 'onFocus', + value: function onFocus(event) { + if (!this.props.isFocused) { + this.props.onFocus(this.props.option, event); + } + } + }, { + key: 'render', + value: function render() { + var _props = this.props, + option = _props.option, + instancePrefix = _props.instancePrefix, + optionIndex = _props.optionIndex; + + var className = __WEBPACK_IMPORTED_MODULE_4_classnames___default()(this.props.className, option.className); + + return option.disabled ? __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { className: className, + onMouseDown: this.blockEvent, + onClick: this.blockEvent }, + this.props.children + ) : __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { className: className, + style: option.style, + role: 'option', + 'aria-label': option.label, + onMouseDown: this.handleMouseDown, + onMouseEnter: this.handleMouseEnter, + onMouseMove: this.handleMouseMove, + onTouchStart: this.handleTouchStart, + onTouchMove: this.handleTouchMove, + onTouchEnd: this.handleTouchEnd, + id: instancePrefix + '-option-' + optionIndex, + title: option.title }, + this.props.children + ); + } + }]); + return Option; +}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component); + + + +Option.propTypes = { + children: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.node, + className: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // className (based on mouse position) + instancePrefix: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string.isRequired, // unique prefix for the ids (used for aria) + isDisabled: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // the option is disabled + isFocused: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // the option is focused + isSelected: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // the option is selected + onFocus: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // method to handle mouseEnter on option element + onSelect: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // method to handle click on option element + onUnfocus: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // method to handle mouseLeave on option element + option: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.object.isRequired, // object that is base for that option + optionIndex: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.number // index of the option, used to generate unique ids for aria +}; + +var Value = function (_React$Component) { + inherits(Value, _React$Component); + + function Value(props) { + classCallCheck(this, Value); + + var _this = possibleConstructorReturn(this, (Value.__proto__ || Object.getPrototypeOf(Value)).call(this, props)); + + _this.handleMouseDown = _this.handleMouseDown.bind(_this); + _this.onRemove = _this.onRemove.bind(_this); + _this.handleTouchEndRemove = _this.handleTouchEndRemove.bind(_this); + _this.handleTouchMove = _this.handleTouchMove.bind(_this); + _this.handleTouchStart = _this.handleTouchStart.bind(_this); + return _this; + } + + createClass(Value, [{ + key: 'handleMouseDown', + value: function handleMouseDown(event) { + if (event.type === 'mousedown' && event.button !== 0) { + return; + } + if (this.props.onClick) { + event.stopPropagation(); + this.props.onClick(this.props.value, event); + return; + } + if (this.props.value.href) { + event.stopPropagation(); + } + } + }, { + key: 'onRemove', + value: function onRemove(event) { + event.preventDefault(); + event.stopPropagation(); + this.props.onRemove(this.props.value); + } + }, { + key: 'handleTouchEndRemove', + value: function handleTouchEndRemove(event) { + // Check if the view is being dragged, In this case + // we don't want to fire the click event (because the user only wants to scroll) + if (this.dragging) return; + + // Fire the mouse events + this.onRemove(event); + } + }, { + key: 'handleTouchMove', + value: function handleTouchMove(event) { + // Set a flag that the view is being dragged + this.dragging = true; + } + }, { + key: 'handleTouchStart', + value: function handleTouchStart(event) { + // Set a flag that the view is not being dragged + this.dragging = false; + } + }, { + key: 'renderRemoveIcon', + value: function renderRemoveIcon() { + if (this.props.disabled || !this.props.onRemove) return; + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'span', + { className: 'Select-value-icon', + 'aria-hidden': 'true', + onMouseDown: this.onRemove, + onTouchEnd: this.handleTouchEndRemove, + onTouchStart: this.handleTouchStart, + onTouchMove: this.handleTouchMove }, + '\xD7' + ); + } + }, { + key: 'renderLabel', + value: function renderLabel() { + var className = 'Select-value-label'; + return this.props.onClick || this.props.value.href ? __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'a', + { className: className, href: this.props.value.href, target: this.props.value.target, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown }, + this.props.children + ) : __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'span', + { className: className, role: 'option', 'aria-selected': 'true', id: this.props.id }, + this.props.children + ); + } + }, { + key: 'render', + value: function render() { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { className: __WEBPACK_IMPORTED_MODULE_4_classnames___default()('Select-value', this.props.value.className), + style: this.props.value.style, + title: this.props.value.title + }, + this.renderRemoveIcon(), + this.renderLabel() + ); + } + }]); + return Value; +}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component); + + + +Value.propTypes = { + children: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.node, + disabled: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // disabled prop passed to ReactSelect + id: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // Unique id for the value - used for aria + onClick: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // method to handle click on value label + onRemove: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // method to handle removal of the value + value: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.object.isRequired // the option object for this value +}; + +/*! + Copyright (c) 2017 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/react-select +*/ +var stringifyValue = function stringifyValue(value) { + return typeof value === 'string' ? value : value !== null && JSON.stringify(value) || ''; +}; + +var stringOrNode = __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOfType([__WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.node]); +var stringOrNumber = __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOfType([__WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.number]); + +var instanceId = 1; + +var Select$1 = function (_React$Component) { + inherits(Select, _React$Component); + + function Select(props) { + classCallCheck(this, Select); + + var _this = possibleConstructorReturn(this, (Select.__proto__ || Object.getPrototypeOf(Select)).call(this, props)); + + ['clearValue', 'focusOption', 'handleInputBlur', 'handleInputChange', 'handleInputFocus', 'handleInputValueChange', 'handleKeyDown', 'handleMenuScroll', 'handleMouseDown', 'handleMouseDownOnArrow', 'handleMouseDownOnMenu', 'handleRequired', 'handleTouchOutside', 'handleTouchMove', 'handleTouchStart', 'handleTouchEnd', 'handleTouchEndClearValue', 'handleValueClick', 'getOptionLabel', 'onOptionRef', 'removeValue', 'selectValue'].forEach(function (fn) { + return _this[fn] = _this[fn].bind(_this); + }); + + _this.state = { + inputValue: '', + isFocused: false, + isOpen: false, + isPseudoFocused: false, + required: false + }; + return _this; + } + + createClass(Select, [{ + key: 'componentWillMount', + value: function componentWillMount() { + this._instancePrefix = 'react-select-' + (this.props.instanceId || ++instanceId) + '-'; + var valueArray = this.getValueArray(this.props.value); + + if (this.props.required) { + this.setState({ + required: this.handleRequired(valueArray[0], this.props.multi) + }); + } + } + }, { + key: 'componentDidMount', + value: function componentDidMount() { + if (typeof this.props.autofocus !== 'undefined' && typeof console !== 'undefined') { + console.warn('Warning: The autofocus prop has changed to autoFocus, support will be removed after react-select@1.0'); + } + if (this.props.autoFocus || this.props.autofocus) { + this.focus(); + } + } + }, { + key: 'componentWillReceiveProps', + value: function componentWillReceiveProps(nextProps) { + var valueArray = this.getValueArray(nextProps.value, nextProps); + + if (nextProps.required) { + this.setState({ + required: this.handleRequired(valueArray[0], nextProps.multi) + }); + } else if (this.props.required) { + // Used to be required but it's not any more + this.setState({ required: false }); + } + } + }, { + key: 'componentDidUpdate', + value: function componentDidUpdate(prevProps, prevState) { + // focus to the selected option + if (this.menu && this.focused && this.state.isOpen && !this.hasScrolledToOption) { + var focusedOptionNode = Object(__WEBPACK_IMPORTED_MODULE_2_react_dom__["findDOMNode"])(this.focused); + var menuNode = Object(__WEBPACK_IMPORTED_MODULE_2_react_dom__["findDOMNode"])(this.menu); + + var scrollTop = menuNode.scrollTop; + var scrollBottom = scrollTop + menuNode.offsetHeight; + var optionTop = focusedOptionNode.offsetTop; + var optionBottom = optionTop + focusedOptionNode.offsetHeight; + + if (scrollTop > optionTop || scrollBottom < optionBottom) { + menuNode.scrollTop = focusedOptionNode.offsetTop; + } + + // We still set hasScrolledToOption to true even if we didn't + // actually need to scroll, as we've still confirmed that the + // option is in view. + this.hasScrolledToOption = true; + } else if (!this.state.isOpen) { + this.hasScrolledToOption = false; + } + + if (this._scrollToFocusedOptionOnUpdate && this.focused && this.menu) { + this._scrollToFocusedOptionOnUpdate = false; + var focusedDOM = Object(__WEBPACK_IMPORTED_MODULE_2_react_dom__["findDOMNode"])(this.focused); + var menuDOM = Object(__WEBPACK_IMPORTED_MODULE_2_react_dom__["findDOMNode"])(this.menu); + var focusedRect = focusedDOM.getBoundingClientRect(); + var menuRect = menuDOM.getBoundingClientRect(); + if (focusedRect.bottom > menuRect.bottom) { + menuDOM.scrollTop = focusedDOM.offsetTop + focusedDOM.clientHeight - menuDOM.offsetHeight; + } else if (focusedRect.top < menuRect.top) { + menuDOM.scrollTop = focusedDOM.offsetTop; + } + } + if (this.props.scrollMenuIntoView && this.menuContainer) { + var menuContainerRect = this.menuContainer.getBoundingClientRect(); + if (window.innerHeight < menuContainerRect.bottom + this.props.menuBuffer) { + window.scrollBy(0, menuContainerRect.bottom + this.props.menuBuffer - window.innerHeight); + } + } + if (prevProps.disabled !== this.props.disabled) { + this.setState({ isFocused: false }); // eslint-disable-line react/no-did-update-set-state + this.closeMenu(); + } + if (prevState.isOpen !== this.state.isOpen) { + this.toggleTouchOutsideEvent(this.state.isOpen); + var handler = this.state.isOpen ? this.props.onOpen : this.props.onClose; + handler && handler(); + } + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + this.toggleTouchOutsideEvent(false); + } + }, { + key: 'toggleTouchOutsideEvent', + value: function toggleTouchOutsideEvent(enabled) { + if (enabled) { + if (!document.addEventListener && document.attachEvent) { + document.attachEvent('ontouchstart', this.handleTouchOutside); + } else { + document.addEventListener('touchstart', this.handleTouchOutside); + } + } else { + if (!document.removeEventListener && document.detachEvent) { + document.detachEvent('ontouchstart', this.handleTouchOutside); + } else { + document.removeEventListener('touchstart', this.handleTouchOutside); + } + } + } + }, { + key: 'handleTouchOutside', + value: function handleTouchOutside(event) { + // handle touch outside on ios to dismiss menu + if (this.wrapper && !this.wrapper.contains(event.target)) { + this.closeMenu(); + } + } + }, { + key: 'focus', + value: function focus() { + if (!this.input) return; + this.input.focus(); + } + }, { + key: 'blurInput', + value: function blurInput() { + if (!this.input) return; + this.input.blur(); + } + }, { + key: 'handleTouchMove', + value: function handleTouchMove(event) { + // Set a flag that the view is being dragged + this.dragging = true; + } + }, { + key: 'handleTouchStart', + value: function handleTouchStart(event) { + // Set a flag that the view is not being dragged + this.dragging = false; + } + }, { + key: 'handleTouchEnd', + value: function handleTouchEnd(event) { + // Check if the view is being dragged, In this case + // we don't want to fire the click event (because the user only wants to scroll) + if (this.dragging) return; + + // Fire the mouse events + this.handleMouseDown(event); + } + }, { + key: 'handleTouchEndClearValue', + value: function handleTouchEndClearValue(event) { + // Check if the view is being dragged, In this case + // we don't want to fire the click event (because the user only wants to scroll) + if (this.dragging) return; + + // Clear the value + this.clearValue(event); + } + }, { + key: 'handleMouseDown', + value: function handleMouseDown(event) { + // if the event was triggered by a mousedown and not the primary + // button, or if the component is disabled, ignore it. + if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) { + return; + } + + if (event.target.tagName === 'INPUT') { + if (!this.state.isFocused) { + this._openAfterFocus = this.props.openOnClick; + this.focus(); + } else if (!this.state.isOpen) { + this.setState({ + isOpen: true, + isPseudoFocused: false + }); + } + return; + } + + // prevent default event handlers + event.preventDefault(); + + // for the non-searchable select, toggle the menu + if (!this.props.searchable) { + // TODO: This code means that if a select is searchable, onClick the options menu will not appear, only on subsequent click will it open. + this.focus(); + return this.setState({ + isOpen: !this.state.isOpen + }); + } + + if (this.state.isFocused) { + // On iOS, we can get into a state where we think the input is focused but it isn't really, + // since iOS ignores programmatic calls to input.focus() that weren't triggered by a click event. + // Call focus() again here to be safe. + this.focus(); + + var input = this.input; + if (typeof input.getInput === 'function') { + // Get the actual DOM input if the ref is an <AutosizeInput /> component + input = input.getInput(); + } + + // clears the value so that the cursor will be at the end of input when the component re-renders + input.value = ''; + + // if the input is focused, ensure the menu is open + this.setState({ + isOpen: true, + isPseudoFocused: false + }); + } else { + // otherwise, focus the input and open the menu + this._openAfterFocus = this.props.openOnClick; + this.focus(); + } + } + }, { + key: 'handleMouseDownOnArrow', + value: function handleMouseDownOnArrow(event) { + // if the event was triggered by a mousedown and not the primary + // button, or if the component is disabled, ignore it. + if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) { + return; + } + // If the menu isn't open, let the event bubble to the main handleMouseDown + if (!this.state.isOpen) { + this.setState({ + isOpen: true + }); + } + // prevent default event handlers + event.stopPropagation(); + event.preventDefault(); + // close the menu + if (this.state.isOpen) { + this.closeMenu(); + } + } + }, { + key: 'handleMouseDownOnMenu', + value: function handleMouseDownOnMenu(event) { + // if the event was triggered by a mousedown and not the primary + // button, or if the component is disabled, ignore it. + if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) { + return; + } + event.stopPropagation(); + event.preventDefault(); + + this._openAfterFocus = true; + this.focus(); + } + }, { + key: 'closeMenu', + value: function closeMenu() { + if (this.props.onCloseResetsInput) { + this.setState({ + isOpen: false, + isPseudoFocused: this.state.isFocused && !this.props.multi, + inputValue: this.handleInputValueChange('') + }); + } else { + this.setState({ + isOpen: false, + isPseudoFocused: this.state.isFocused && !this.props.multi + }); + } + this.hasScrolledToOption = false; + } + }, { + key: 'handleInputFocus', + value: function handleInputFocus(event) { + if (this.props.disabled) return; + var isOpen = this.state.isOpen || this._openAfterFocus || this.props.openOnFocus; + if (this.props.onFocus) { + this.props.onFocus(event); + } + this.setState({ + isFocused: true, + isOpen: isOpen + }); + this._openAfterFocus = false; + } + }, { + key: 'handleInputBlur', + value: function handleInputBlur(event) { + // The check for menu.contains(activeElement) is necessary to prevent IE11's scrollbar from closing the menu in certain contexts. + if (this.menu && (this.menu === document.activeElement || this.menu.contains(document.activeElement))) { + this.focus(); + return; + } + + if (this.props.onBlur) { + this.props.onBlur(event); + } + var onBlurredState = { + isFocused: false, + isOpen: false, + isPseudoFocused: false + }; + if (this.props.onBlurResetsInput) { + onBlurredState.inputValue = this.handleInputValueChange(''); + } + this.setState(onBlurredState); + } + }, { + key: 'handleInputChange', + value: function handleInputChange(event) { + var newInputValue = event.target.value; + + if (this.state.inputValue !== event.target.value) { + newInputValue = this.handleInputValueChange(newInputValue); + } + + this.setState({ + isOpen: true, + isPseudoFocused: false, + inputValue: newInputValue + }); + } + }, { + key: 'handleInputValueChange', + value: function handleInputValueChange(newValue) { + if (this.props.onInputChange) { + var nextState = this.props.onInputChange(newValue); + // Note: != used deliberately here to catch undefined and null + if (nextState != null && (typeof nextState === 'undefined' ? 'undefined' : _typeof(nextState)) !== 'object') { + newValue = '' + nextState; + } + } + return newValue; + } + }, { + key: 'handleKeyDown', + value: function handleKeyDown(event) { + if (this.props.disabled) return; + + if (typeof this.props.onInputKeyDown === 'function') { + this.props.onInputKeyDown(event); + if (event.defaultPrevented) { + return; + } + } + + switch (event.keyCode) { + case 8: + // backspace + if (!this.state.inputValue && this.props.backspaceRemoves) { + event.preventDefault(); + this.popValue(); + } + return; + case 9: + // tab + if (event.shiftKey || !this.state.isOpen || !this.props.tabSelectsValue) { + return; + } + event.preventDefault(); + this.selectFocusedOption(); + return; + case 13: + // enter + event.preventDefault(); + event.stopPropagation(); + if (this.state.isOpen) { + this.selectFocusedOption(); + } else { + this.focusNextOption(); + } + return; + break; + case 27: + // escape + if (this.state.isOpen) { + this.closeMenu(); + event.stopPropagation(); + } else if (this.props.clearable && this.props.escapeClearsValue) { + this.clearValue(event); + event.stopPropagation(); + } + break; + case 32: + // space + if (this.props.searchable) { + return; + } + event.preventDefault(); + if (!this.state.isOpen) { + this.focusNextOption(); + return; + } + event.stopPropagation(); + this.selectFocusedOption(); + break; + case 38: + // up + this.focusPreviousOption(); + break; + case 40: + // down + this.focusNextOption(); + break; + case 33: + // page up + this.focusPageUpOption(); + break; + case 34: + // page down + this.focusPageDownOption(); + break; + case 35: + // end key + if (event.shiftKey) { + return; + } + this.focusEndOption(); + break; + case 36: + // home key + if (event.shiftKey) { + return; + } + this.focusStartOption(); + break; + case 46: + // delete + if (!this.state.inputValue && this.props.deleteRemoves) { + event.preventDefault(); + this.popValue(); + } + return; + default: + return; + } + event.preventDefault(); + } + }, { + key: 'handleValueClick', + value: function handleValueClick(option, event) { + if (!this.props.onValueClick) return; + this.props.onValueClick(option, event); + } + }, { + key: 'handleMenuScroll', + value: function handleMenuScroll(event) { + if (!this.props.onMenuScrollToBottom) return; + var target = event.target; + + if (target.scrollHeight > target.offsetHeight && target.scrollHeight - target.offsetHeight - target.scrollTop <= 0) { + this.props.onMenuScrollToBottom(); + } + } + }, { + key: 'handleRequired', + value: function handleRequired(value, multi) { + if (!value) return true; + return multi ? value.length === 0 : Object.keys(value).length === 0; + } + }, { + key: 'getOptionLabel', + value: function getOptionLabel(op) { + return op[this.props.labelKey]; + } + + /** + * Turns a value into an array from the given options + * @param {String|Number|Array} value - the value of the select input + * @param {Object} nextProps - optionally specify the nextProps so the returned array uses the latest configuration + * @returns {Array} the value of the select represented in an array + */ + + }, { + key: 'getValueArray', + value: function getValueArray(value, nextProps) { + var _this2 = this; + + /** support optionally passing in the `nextProps` so `componentWillReceiveProps` updates will function as expected */ + var props = (typeof nextProps === 'undefined' ? 'undefined' : _typeof(nextProps)) === 'object' ? nextProps : this.props; + if (props.multi) { + if (typeof value === 'string') { + value = value.split(props.delimiter); + } + if (!Array.isArray(value)) { + if (value === null || value === undefined) return []; + value = [value]; + } + return value.map(function (value) { + return _this2.expandValue(value, props); + }).filter(function (i) { + return i; + }); + } + var expandedValue = this.expandValue(value, props); + return expandedValue ? [expandedValue] : []; + } + + /** + * Retrieve a value from the given options and valueKey + * @param {String|Number|Array} value - the selected value(s) + * @param {Object} props - the Select component's props (or nextProps) + */ + + }, { + key: 'expandValue', + value: function expandValue(value, props) { + var valueType = typeof value === 'undefined' ? 'undefined' : _typeof(value); + if (valueType !== 'string' && valueType !== 'number' && valueType !== 'boolean') return value; + var options = props.options, + valueKey = props.valueKey; + + if (!options) return; + for (var i = 0; i < options.length; i++) { + if (String(options[i][valueKey]) === String(value)) return options[i]; + } + } + }, { + key: 'setValue', + value: function setValue(value) { + var _this3 = this; + + if (this.props.autoBlur) { + this.blurInput(); + } + if (this.props.required) { + var required = this.handleRequired(value, this.props.multi); + this.setState({ required: required }); + } + if (this.props.onChange) { + if (this.props.simpleValue && value) { + value = this.props.multi ? value.map(function (i) { + return i[_this3.props.valueKey]; + }).join(this.props.delimiter) : value[this.props.valueKey]; + } + this.props.onChange(value); + } + } + }, { + key: 'selectValue', + value: function selectValue(value) { + var _this4 = this; + + // NOTE: we actually add/set the value in a callback to make sure the + // input value is empty to avoid styling issues in Chrome + if (this.props.closeOnSelect) { + this.hasScrolledToOption = false; + } + if (this.props.multi) { + var updatedValue = this.props.onSelectResetsInput ? '' : this.state.inputValue; + this.setState({ + focusedIndex: null, + inputValue: this.handleInputValueChange(updatedValue), + isOpen: !this.props.closeOnSelect + }, function () { + var valueArray = _this4.getValueArray(_this4.props.value); + if (valueArray.some(function (i) { + return i[_this4.props.valueKey] === value[_this4.props.valueKey]; + })) { + _this4.removeValue(value); + } else { + _this4.addValue(value); + } + }); + } else { + this.setState({ + inputValue: this.handleInputValueChange(''), + isOpen: !this.props.closeOnSelect, + isPseudoFocused: this.state.isFocused + }, function () { + _this4.setValue(value); + }); + } + } + }, { + key: 'addValue', + value: function addValue(value) { + var valueArray = this.getValueArray(this.props.value); + var visibleOptions = this._visibleOptions.filter(function (val) { + return !val.disabled; + }); + var lastValueIndex = visibleOptions.indexOf(value); + this.setValue(valueArray.concat(value)); + if (visibleOptions.length - 1 === lastValueIndex) { + // the last option was selected; focus the second-last one + this.focusOption(visibleOptions[lastValueIndex - 1]); + } else if (visibleOptions.length > lastValueIndex) { + // focus the option below the selected one + this.focusOption(visibleOptions[lastValueIndex + 1]); + } + } + }, { + key: 'popValue', + value: function popValue() { + var valueArray = this.getValueArray(this.props.value); + if (!valueArray.length) return; + if (valueArray[valueArray.length - 1].clearableValue === false) return; + this.setValue(this.props.multi ? valueArray.slice(0, valueArray.length - 1) : null); + } + }, { + key: 'removeValue', + value: function removeValue(value) { + var _this5 = this; + + var valueArray = this.getValueArray(this.props.value); + this.setValue(valueArray.filter(function (i) { + return i[_this5.props.valueKey] !== value[_this5.props.valueKey]; + })); + this.focus(); + } + }, { + key: 'clearValue', + value: function clearValue(event) { + // if the event was triggered by a mousedown and not the primary + // button, ignore it. + if (event && event.type === 'mousedown' && event.button !== 0) { + return; + } + event.preventDefault(); + this.setValue(this.getResetValue()); + this.setState({ + isOpen: false, + inputValue: this.handleInputValueChange('') + }, this.focus); + } + }, { + key: 'getResetValue', + value: function getResetValue() { + if (this.props.resetValue !== undefined) { + return this.props.resetValue; + } else if (this.props.multi) { + return []; + } else { + return null; + } + } + }, { + key: 'focusOption', + value: function focusOption(option) { + this.setState({ + focusedOption: option + }); + } + }, { + key: 'focusNextOption', + value: function focusNextOption() { + this.focusAdjacentOption('next'); + } + }, { + key: 'focusPreviousOption', + value: function focusPreviousOption() { + this.focusAdjacentOption('previous'); + } + }, { + key: 'focusPageUpOption', + value: function focusPageUpOption() { + this.focusAdjacentOption('page_up'); + } + }, { + key: 'focusPageDownOption', + value: function focusPageDownOption() { + this.focusAdjacentOption('page_down'); + } + }, { + key: 'focusStartOption', + value: function focusStartOption() { + this.focusAdjacentOption('start'); + } + }, { + key: 'focusEndOption', + value: function focusEndOption() { + this.focusAdjacentOption('end'); + } + }, { + key: 'focusAdjacentOption', + value: function focusAdjacentOption(dir) { + var options = this._visibleOptions.map(function (option, index) { + return { option: option, index: index }; + }).filter(function (option) { + return !option.option.disabled; + }); + this._scrollToFocusedOptionOnUpdate = true; + if (!this.state.isOpen) { + this.setState({ + isOpen: true, + inputValue: '', + focusedOption: this._focusedOption || (options.length ? options[dir === 'next' ? 0 : options.length - 1].option : null) + }); + return; + } + if (!options.length) return; + var focusedIndex = -1; + for (var i = 0; i < options.length; i++) { + if (this._focusedOption === options[i].option) { + focusedIndex = i; + break; + } + } + if (dir === 'next' && focusedIndex !== -1) { + focusedIndex = (focusedIndex + 1) % options.length; + } else if (dir === 'previous') { + if (focusedIndex > 0) { + focusedIndex = focusedIndex - 1; + } else { + focusedIndex = options.length - 1; + } + } else if (dir === 'start') { + focusedIndex = 0; + } else if (dir === 'end') { + focusedIndex = options.length - 1; + } else if (dir === 'page_up') { + var potentialIndex = focusedIndex - this.props.pageSize; + if (potentialIndex < 0) { + focusedIndex = 0; + } else { + focusedIndex = potentialIndex; + } + } else if (dir === 'page_down') { + var potentialIndex = focusedIndex + this.props.pageSize; + if (potentialIndex > options.length - 1) { + focusedIndex = options.length - 1; + } else { + focusedIndex = potentialIndex; + } + } + + if (focusedIndex === -1) { + focusedIndex = 0; + } + + this.setState({ + focusedIndex: options[focusedIndex].index, + focusedOption: options[focusedIndex].option + }); + } + }, { + key: 'getFocusedOption', + value: function getFocusedOption() { + return this._focusedOption; + } + }, { + key: 'selectFocusedOption', + value: function selectFocusedOption() { + if (this._focusedOption) { + return this.selectValue(this._focusedOption); + } + } + }, { + key: 'renderLoading', + value: function renderLoading() { + if (!this.props.isLoading) return; + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'span', + { className: 'Select-loading-zone', 'aria-hidden': 'true' }, + __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('span', { className: 'Select-loading' }) + ); + } + }, { + key: 'renderValue', + value: function renderValue(valueArray, isOpen) { + var _this6 = this; + + var renderLabel = this.props.valueRenderer || this.getOptionLabel; + var ValueComponent = this.props.valueComponent; + if (!valueArray.length) { + return !this.state.inputValue ? __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { className: 'Select-placeholder' }, + this.props.placeholder + ) : null; + } + var onClick = this.props.onValueClick ? this.handleValueClick : null; + if (this.props.multi) { + return valueArray.map(function (value, i) { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + ValueComponent, + { + id: _this6._instancePrefix + '-value-' + i, + instancePrefix: _this6._instancePrefix, + disabled: _this6.props.disabled || value.clearableValue === false, + key: 'value-' + i + '-' + value[_this6.props.valueKey], + onClick: onClick, + onRemove: _this6.removeValue, + value: value + }, + renderLabel(value, i), + __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'span', + { className: 'Select-aria-only' }, + '\xA0' + ) + ); + }); + } else if (!this.state.inputValue) { + if (isOpen) onClick = null; + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + ValueComponent, + { + id: this._instancePrefix + '-value-item', + disabled: this.props.disabled, + instancePrefix: this._instancePrefix, + onClick: onClick, + value: valueArray[0] + }, + renderLabel(valueArray[0]) + ); + } + } + }, { + key: 'renderInput', + value: function renderInput(valueArray, focusedOptionIndex) { + var _classNames, + _this7 = this; + + var className = __WEBPACK_IMPORTED_MODULE_4_classnames___default()('Select-input', this.props.inputProps.className); + var isOpen = !!this.state.isOpen; + + var ariaOwns = __WEBPACK_IMPORTED_MODULE_4_classnames___default()((_classNames = {}, defineProperty(_classNames, this._instancePrefix + '-list', isOpen), defineProperty(_classNames, this._instancePrefix + '-backspace-remove-message', this.props.multi && !this.props.disabled && this.state.isFocused && !this.state.inputValue), _classNames)); + var inputProps = _extends({}, this.props.inputProps, { + role: 'combobox', + 'aria-expanded': '' + isOpen, + 'aria-owns': ariaOwns, + 'aria-haspopup': '' + isOpen, + 'aria-activedescendant': isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value', + 'aria-describedby': this.props['aria-describedby'], + 'aria-labelledby': this.props['aria-labelledby'], + 'aria-label': this.props['aria-label'], + className: className, + tabIndex: this.props.tabIndex, + onBlur: this.handleInputBlur, + onChange: this.handleInputChange, + onFocus: this.handleInputFocus, + ref: function ref(_ref) { + return _this7.input = _ref; + }, + required: this.state.required, + value: this.state.inputValue + }); + + if (this.props.inputRenderer) { + return this.props.inputRenderer(inputProps); + } + + if (this.props.disabled || !this.props.searchable) { + var _props$inputProps = this.props.inputProps, + inputClassName = _props$inputProps.inputClassName, + divProps = objectWithoutProperties(_props$inputProps, ['inputClassName']); + + + var _ariaOwns = __WEBPACK_IMPORTED_MODULE_4_classnames___default()(defineProperty({}, this._instancePrefix + '-list', isOpen)); + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', _extends({}, divProps, { + role: 'combobox', + 'aria-expanded': isOpen, + 'aria-owns': _ariaOwns, + 'aria-activedescendant': isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value', + 'aria-labelledby': this.props['aria-labelledby'], + 'aria-label': this.props['aria-label'], + className: className, + tabIndex: this.props.tabIndex || 0, + onBlur: this.handleInputBlur, + onFocus: this.handleInputFocus, + ref: function ref(_ref2) { + return _this7.input = _ref2; + }, + 'aria-disabled': '' + !!this.props.disabled, + style: { border: 0, width: 1, display: 'inline-block' } })); + } + + if (this.props.autosize) { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_3_react_input_autosize___default.a, _extends({ id: this.props.id }, inputProps, { minWidth: '5' })); + } + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { className: className, key: 'input-wrap' }, + __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', _extends({ id: this.props.id }, inputProps)) + ); + } + }, { + key: 'renderClear', + value: function renderClear() { + var valueArray = this.getValueArray(this.props.value); + if (!this.props.clearable || !valueArray.length || this.props.disabled || this.props.isLoading) return; + var clear = this.props.clearRenderer(); + + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'span', + { className: 'Select-clear-zone', title: this.props.multi ? this.props.clearAllText : this.props.clearValueText, + 'aria-label': this.props.multi ? this.props.clearAllText : this.props.clearValueText, + onMouseDown: this.clearValue, + onTouchStart: this.handleTouchStart, + onTouchMove: this.handleTouchMove, + onTouchEnd: this.handleTouchEndClearValue + }, + clear + ); + } + }, { + key: 'renderArrow', + value: function renderArrow() { + if (!this.props.arrowRenderer) return; + + var onMouseDown = this.handleMouseDownOnArrow; + var isOpen = this.state.isOpen; + var arrow = this.props.arrowRenderer({ onMouseDown: onMouseDown, isOpen: isOpen }); + + if (!arrow) { + return null; + } + + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'span', + { + className: 'Select-arrow-zone', + onMouseDown: onMouseDown + }, + arrow + ); + } + }, { + key: 'filterOptions', + value: function filterOptions$$1(excludeOptions) { + var filterValue = this.state.inputValue; + var options = this.props.options || []; + if (this.props.filterOptions) { + // Maintain backwards compatibility with boolean attribute + var filterOptions$$1 = typeof this.props.filterOptions === 'function' ? this.props.filterOptions : filterOptions; + + return filterOptions$$1(options, filterValue, excludeOptions, { + filterOption: this.props.filterOption, + ignoreAccents: this.props.ignoreAccents, + ignoreCase: this.props.ignoreCase, + labelKey: this.props.labelKey, + matchPos: this.props.matchPos, + matchProp: this.props.matchProp, + valueKey: this.props.valueKey, + trimFilter: this.props.trimFilter + }); + } else { + return options; + } + } + }, { + key: 'onOptionRef', + value: function onOptionRef(ref, isFocused) { + if (isFocused) { + this.focused = ref; + } + } + }, { + key: 'renderMenu', + value: function renderMenu(options, valueArray, focusedOption) { + if (options && options.length) { + return this.props.menuRenderer({ + focusedOption: focusedOption, + focusOption: this.focusOption, + inputValue: this.state.inputValue, + instancePrefix: this._instancePrefix, + labelKey: this.props.labelKey, + onFocus: this.focusOption, + onSelect: this.selectValue, + optionClassName: this.props.optionClassName, + optionComponent: this.props.optionComponent, + optionRenderer: this.props.optionRenderer || this.getOptionLabel, + options: options, + selectValue: this.selectValue, + removeValue: this.removeValue, + valueArray: valueArray, + valueKey: this.props.valueKey, + onOptionRef: this.onOptionRef + }); + } else if (this.props.noResultsText) { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { className: 'Select-noresults' }, + this.props.noResultsText + ); + } else { + return null; + } + } + }, { + key: 'renderHiddenField', + value: function renderHiddenField(valueArray) { + var _this8 = this; + + if (!this.props.name) return; + if (this.props.joinValues) { + var value = valueArray.map(function (i) { + return stringifyValue(i[_this8.props.valueKey]); + }).join(this.props.delimiter); + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { + type: 'hidden', + ref: function ref(_ref3) { + return _this8.value = _ref3; + }, + name: this.props.name, + value: value, + disabled: this.props.disabled }); + } + return valueArray.map(function (item, index) { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { key: 'hidden.' + index, + type: 'hidden', + ref: 'value' + index, + name: _this8.props.name, + value: stringifyValue(item[_this8.props.valueKey]), + disabled: _this8.props.disabled }); + }); + } + }, { + key: 'getFocusableOptionIndex', + value: function getFocusableOptionIndex(selectedOption) { + var options = this._visibleOptions; + if (!options.length) return null; + + var valueKey = this.props.valueKey; + var focusedOption = this.state.focusedOption || selectedOption; + if (focusedOption && !focusedOption.disabled) { + var focusedOptionIndex = -1; + options.some(function (option, index) { + var isOptionEqual = option[valueKey] === focusedOption[valueKey]; + if (isOptionEqual) { + focusedOptionIndex = index; + } + return isOptionEqual; + }); + if (focusedOptionIndex !== -1) { + return focusedOptionIndex; + } + } + + for (var i = 0; i < options.length; i++) { + if (!options[i].disabled) return i; + } + return null; + } + }, { + key: 'renderOuter', + value: function renderOuter(options, valueArray, focusedOption) { + var _this9 = this; + + var menu = this.renderMenu(options, valueArray, focusedOption); + if (!menu) { + return null; + } + + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { ref: function ref(_ref5) { + return _this9.menuContainer = _ref5; + }, className: 'Select-menu-outer', style: this.props.menuContainerStyle }, + __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { ref: function ref(_ref4) { + return _this9.menu = _ref4; + }, role: 'listbox', tabIndex: -1, className: 'Select-menu', id: this._instancePrefix + '-list', + style: this.props.menuStyle, + onScroll: this.handleMenuScroll, + onMouseDown: this.handleMouseDownOnMenu }, + menu + ) + ); + } + }, { + key: 'render', + value: function render() { + var _this10 = this; + + var valueArray = this.getValueArray(this.props.value); + var options = this._visibleOptions = this.filterOptions(this.props.multi && this.props.removeSelected ? valueArray : null); + var isOpen = this.state.isOpen; + if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false; + var focusedOptionIndex = this.getFocusableOptionIndex(valueArray[0]); + + var focusedOption = null; + if (focusedOptionIndex !== null) { + focusedOption = this._focusedOption = options[focusedOptionIndex]; + } else { + focusedOption = this._focusedOption = null; + } + var className = __WEBPACK_IMPORTED_MODULE_4_classnames___default()('Select', this.props.className, { + 'Select--multi': this.props.multi, + 'Select--single': !this.props.multi, + 'is-clearable': this.props.clearable, + 'is-disabled': this.props.disabled, + 'is-focused': this.state.isFocused, + 'is-loading': this.props.isLoading, + 'is-open': isOpen, + 'is-pseudo-focused': this.state.isPseudoFocused, + 'is-searchable': this.props.searchable, + 'has-value': valueArray.length, + 'Select--rtl': this.props.rtl + }); + + var removeMessage = null; + if (this.props.multi && !this.props.disabled && valueArray.length && !this.state.inputValue && this.state.isFocused && this.props.backspaceRemoves) { + removeMessage = __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'span', + { id: this._instancePrefix + '-backspace-remove-message', className: 'Select-aria-only', 'aria-live': 'assertive' }, + this.props.backspaceToRemoveMessage.replace('{label}', valueArray[valueArray.length - 1][this.props.labelKey]) + ); + } + + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { ref: function ref(_ref7) { + return _this10.wrapper = _ref7; + }, + className: className, + style: this.props.wrapperStyle }, + this.renderHiddenField(valueArray), + __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'div', + { ref: function ref(_ref6) { + return _this10.control = _ref6; + }, + className: 'Select-control', + style: this.props.style, + onKeyDown: this.handleKeyDown, + onMouseDown: this.handleMouseDown, + onTouchEnd: this.handleTouchEnd, + onTouchStart: this.handleTouchStart, + onTouchMove: this.handleTouchMove + }, + __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + 'span', + { className: 'Select-multi-value-wrapper', id: this._instancePrefix + '-value' }, + this.renderValue(valueArray, isOpen), + this.renderInput(valueArray, focusedOptionIndex) + ), + removeMessage, + this.renderLoading(), + this.renderClear(), + this.renderArrow() + ), + isOpen ? this.renderOuter(options, valueArray, focusedOption) : null + ); + } + }]); + return Select; +}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component); + + + +Select$1.propTypes = { + 'aria-describedby': __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // html id(s) of element(s) that should be used to describe this input (for assistive tech) + 'aria-label': __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // aria label (for assistive tech) + 'aria-labelledby': __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // html id of an element that should be used as the label (for assistive tech) + arrowRenderer: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // create the drop-down caret element + autoBlur: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // automatically blur the component when an option is selected + autoFocus: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // autofocus the component on mount + autofocus: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // deprecated; use autoFocus instead + autosize: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether to enable autosizing or not + backspaceRemoves: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether backspace removes an item if there is no text input + backspaceToRemoveMessage: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // message to use for screenreaders to press backspace to remove the current item - {label} is replaced with the item label + className: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // className for the outer element + clearAllText: stringOrNode, // title for the "clear" control when multi: true + clearRenderer: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // create clearable x element + clearValueText: stringOrNode, // title for the "clear" control + clearable: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // should it be possible to reset value + closeOnSelect: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether to close the menu when a value is selected + deleteRemoves: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether delete removes an item if there is no text input + delimiter: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // delimiter to use to join multiple values for the hidden field value + disabled: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether the Select is disabled or not + escapeClearsValue: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether escape clears the value when the menu is closed + filterOption: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // method to filter a single option (option, filterString) + filterOptions: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values]) + id: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // html id to set on the input element for accessibility or tests + ignoreAccents: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether to strip diacritics when filtering + ignoreCase: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether to perform case-insensitive filtering + inputProps: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.object, // custom attributes for the Input + inputRenderer: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // returns a custom input component + instanceId: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // set the components instanceId + isLoading: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether the Select is loading externally or not (such as options being loaded) + joinValues: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // joins multiple values into a single form field with the delimiter (legacy mode) + labelKey: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // path of the label value in option objects + matchPos: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // (any|start) match the start or entire string when filtering + matchProp: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // (any|label|value) which option property to filter on + menuBuffer: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.number, // optional buffer (in px) between the bottom of the viewport and the bottom of the menu + menuContainerStyle: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.object, // optional style to apply to the menu container + menuRenderer: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // renders a custom menu with options + menuStyle: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.object, // optional style to apply to the menu + multi: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // multi-value input + name: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // generates a hidden <input /> tag with this field name for html forms + noResultsText: stringOrNode, // placeholder displayed when there are no matching search results + onBlur: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // onBlur handler: function (event) {} + onBlurResetsInput: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether input is cleared on blur + onChange: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // onChange handler: function (newValue) {} + onClose: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // fires when the menu is closed + onCloseResetsInput: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether input is cleared when menu is closed through the arrow + onFocus: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // onFocus handler: function (event) {} + onInputChange: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // onInputChange handler: function (inputValue) {} + onInputKeyDown: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // input keyDown handler: function (event) {} + onMenuScrollToBottom: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // fires when the menu is scrolled to the bottom; can be used to paginate options + onOpen: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // fires when the menu is opened + onSelectResetsInput: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether input is cleared on select (works only for multiselect) + onValueClick: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // onClick handler for value labels: function (value, event) {} + openOnClick: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // boolean to control opening the menu when the control is clicked + openOnFocus: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // always open options menu on focus + optionClassName: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // additional class(es) to apply to the <Option /> elements + optionComponent: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // option component to render in dropdown + optionRenderer: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // optionRenderer: function (option) {} + options: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.array, // array of options + pageSize: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.number, // number of entries to page when using page up/down keys + placeholder: stringOrNode, // field placeholder, displayed when there's no value + removeSelected: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether the selected option is removed from the dropdown on multi selects + required: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // applies HTML5 required attribute when needed + resetValue: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.any, // value to use when you clear the control + rtl: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // set to true in order to use react-select in right-to-left direction + scrollMenuIntoView: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // boolean to enable the viewport to shift so that the full menu fully visible when engaged + searchable: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether to enable searching feature or not + simpleValue: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false + style: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.object, // optional style to apply to the control + tabIndex: stringOrNumber, // optional tab index of the control + tabSelectsValue: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether to treat tabbing out while focused to be value selection + trimFilter: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // whether to trim whitespace around filter value + value: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.any, // initial field value + valueComponent: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // value component to render + valueKey: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, // path of the label value in option objects + valueRenderer: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // valueRenderer: function (option) {} + wrapperStyle: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.object // optional style to apply to the component wrapper +}; + +Select$1.defaultProps = { + arrowRenderer: arrowRenderer, + autosize: true, + backspaceRemoves: true, + backspaceToRemoveMessage: 'Press backspace to remove {label}', + clearable: true, + clearAllText: 'Clear all', + clearRenderer: clearRenderer, + clearValueText: 'Clear value', + closeOnSelect: true, + deleteRemoves: true, + delimiter: ',', + disabled: false, + escapeClearsValue: true, + filterOptions: filterOptions, + ignoreAccents: true, + ignoreCase: true, + inputProps: {}, + isLoading: false, + joinValues: false, + labelKey: 'label', + matchPos: 'any', + matchProp: 'any', + menuBuffer: 0, + menuRenderer: menuRenderer, + multi: false, + noResultsText: 'No results found', + onBlurResetsInput: true, + onSelectResetsInput: true, + onCloseResetsInput: true, + openOnClick: true, + optionComponent: Option, + pageSize: 5, + placeholder: 'Select...', + removeSelected: true, + required: false, + rtl: false, + scrollMenuIntoView: true, + searchable: true, + simpleValue: false, + tabSelectsValue: true, + trimFilter: true, + valueComponent: Value, + valueKey: 'value' +}; + +var propTypes = { + autoload: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool.isRequired, // automatically call the `loadOptions` prop on-mount; defaults to true + cache: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.any, // object to use to cache results; set to null/false to disable caching + children: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func.isRequired, // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element + ignoreAccents: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // strip diacritics when filtering; defaults to true + ignoreCase: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // perform case-insensitive filtering; defaults to true + loadOptions: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func.isRequired, // callback to load options asynchronously; (inputValue: string, callback: Function): ?Promise + loadingPlaceholder: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOfType([// replaces the placeholder while options are loading + __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.node]), + multi: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.bool, // multi-value input + noResultsText: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOfType([// field noResultsText, displayed when no options come back from the server + __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.node]), + onChange: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // onChange handler: function (newValue) {} + onInputChange: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, // optional for keeping track of what is being typed + options: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.array.isRequired, // array of options + placeholder: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOfType([// field placeholder, displayed when there's no value (shared with Select) + __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.node]), + searchPromptText: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.oneOfType([// label to prompt for search input + __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.string, __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.node]), + value: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.any // initial field value +}; + +var defaultCache = {}; + +var defaultProps = { + autoload: true, + cache: defaultCache, + children: defaultChildren, + ignoreAccents: true, + ignoreCase: true, + loadingPlaceholder: 'Loading...', + options: [], + searchPromptText: 'Type to search' +}; + +var Async = function (_Component) { + inherits(Async, _Component); + + function Async(props, context) { + classCallCheck(this, Async); + + var _this = possibleConstructorReturn(this, (Async.__proto__ || Object.getPrototypeOf(Async)).call(this, props, context)); + + _this._cache = props.cache === defaultCache ? {} : props.cache; + + _this.state = { + inputValue: '', + isLoading: false, + options: props.options + }; + + _this.onInputChange = _this.onInputChange.bind(_this); + return _this; + } + + createClass(Async, [{ + key: 'componentDidMount', + value: function componentDidMount() { + var autoload = this.props.autoload; + + + if (autoload) { + this.loadOptions(''); + } + } + }, { + key: 'componentWillReceiveProps', + value: function componentWillReceiveProps(nextProps) { + if (nextProps.options !== this.props.options) { + this.setState({ + options: nextProps.options + }); + } + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + this._callback = null; + } + }, { + key: 'loadOptions', + value: function loadOptions(inputValue) { + var _this2 = this; + + var loadOptions = this.props.loadOptions; + + var cache = this._cache; + + if (cache && Object.prototype.hasOwnProperty.call(cache, inputValue)) { + this._callback = null; + + this.setState({ + isLoading: false, + options: cache[inputValue] + }); + + return; + } + + var callback = function callback(error, data) { + var options = data && data.options || []; + + if (cache) { + cache[inputValue] = options; + } + + if (callback === _this2._callback) { + _this2._callback = null; + + _this2.setState({ + isLoading: false, + options: options + }); + } + }; + + // Ignore all but the most recent request + this._callback = callback; + + var promise = loadOptions(inputValue, callback); + if (promise) { + promise.then(function (data) { + return callback(null, data); + }, function (error) { + return callback(error); + }); + } + + if (this._callback && !this.state.isLoading) { + this.setState({ + isLoading: true + }); + } + } + }, { + key: 'onInputChange', + value: function onInputChange(inputValue) { + var _props = this.props, + ignoreAccents = _props.ignoreAccents, + ignoreCase = _props.ignoreCase, + onInputChange = _props.onInputChange; + + var newInputValue = inputValue; + + if (onInputChange) { + var value = onInputChange(newInputValue); + // Note: != used deliberately here to catch undefined and null + if (value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object') { + newInputValue = '' + value; + } + } + + var transformedInputValue = newInputValue; + + if (ignoreAccents) { + transformedInputValue = stripDiacritics(transformedInputValue); + } + + if (ignoreCase) { + transformedInputValue = transformedInputValue.toLowerCase(); + } + + this.setState({ inputValue: newInputValue }); + this.loadOptions(transformedInputValue); + + // Return new input value, but without applying toLowerCase() to avoid modifying the user's view case of the input while typing. + return newInputValue; + } + }, { + key: 'noResultsText', + value: function noResultsText() { + var _props2 = this.props, + loadingPlaceholder = _props2.loadingPlaceholder, + noResultsText = _props2.noResultsText, + searchPromptText = _props2.searchPromptText; + var _state = this.state, + inputValue = _state.inputValue, + isLoading = _state.isLoading; + + + if (isLoading) { + return loadingPlaceholder; + } + if (inputValue && noResultsText) { + return noResultsText; + } + return searchPromptText; + } + }, { + key: 'focus', + value: function focus() { + this.select.focus(); + } + }, { + key: 'render', + value: function render() { + var _this3 = this; + + var _props3 = this.props, + children = _props3.children, + loadingPlaceholder = _props3.loadingPlaceholder, + multi = _props3.multi, + onChange = _props3.onChange, + placeholder = _props3.placeholder; + var _state2 = this.state, + isLoading = _state2.isLoading, + options = _state2.options; + + + var props = { + noResultsText: this.noResultsText(), + placeholder: isLoading ? loadingPlaceholder : placeholder, + options: isLoading && loadingPlaceholder ? [] : options, + ref: function ref(_ref) { + return _this3.select = _ref; + } + }; + + return children(_extends({}, this.props, props, { + isLoading: isLoading, + onInputChange: this.onInputChange + })); + } + }]); + return Async; +}(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]); + +Async.propTypes = propTypes; +Async.defaultProps = defaultProps; + +function defaultChildren(props) { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(Select$1, props); +} + +var CreatableSelect = function (_React$Component) { + inherits(CreatableSelect, _React$Component); + + function CreatableSelect(props, context) { + classCallCheck(this, CreatableSelect); + + var _this = possibleConstructorReturn(this, (CreatableSelect.__proto__ || Object.getPrototypeOf(CreatableSelect)).call(this, props, context)); + + _this.filterOptions = _this.filterOptions.bind(_this); + _this.menuRenderer = _this.menuRenderer.bind(_this); + _this.onInputKeyDown = _this.onInputKeyDown.bind(_this); + _this.onInputChange = _this.onInputChange.bind(_this); + _this.onOptionSelect = _this.onOptionSelect.bind(_this); + return _this; + } + + createClass(CreatableSelect, [{ + key: 'createNewOption', + value: function createNewOption() { + var _props = this.props, + isValidNewOption = _props.isValidNewOption, + newOptionCreator = _props.newOptionCreator, + onNewOptionClick = _props.onNewOptionClick, + _props$options = _props.options, + options = _props$options === undefined ? [] : _props$options; + + + if (isValidNewOption({ label: this.inputValue })) { + var option = newOptionCreator({ label: this.inputValue, labelKey: this.labelKey, valueKey: this.valueKey }); + var _isOptionUnique = this.isOptionUnique({ option: option }); + + // Don't add the same option twice. + if (_isOptionUnique) { + if (onNewOptionClick) { + onNewOptionClick(option); + } else { + options.unshift(option); + + this.select.selectValue(option); + } + } + } + } + }, { + key: 'filterOptions', + value: function filterOptions$$1() { + var _props2 = this.props, + filterOptions$$1 = _props2.filterOptions, + isValidNewOption = _props2.isValidNewOption, + promptTextCreator = _props2.promptTextCreator; + + // TRICKY Check currently selected options as well. + // Don't display a create-prompt for a value that's selected. + // This covers async edge-cases where a newly-created Option isn't yet in the async-loaded array. + + var excludeOptions = (arguments.length <= 2 ? undefined : arguments[2]) || []; + + var filteredOptions = filterOptions$$1.apply(undefined, arguments) || []; + + if (isValidNewOption({ label: this.inputValue })) { + var _newOptionCreator = this.props.newOptionCreator; + + + var option = _newOptionCreator({ + label: this.inputValue, + labelKey: this.labelKey, + valueKey: this.valueKey + }); + + // TRICKY Compare to all options (not just filtered options) in case option has already been selected). + // For multi-selects, this would remove it from the filtered list. + var _isOptionUnique2 = this.isOptionUnique({ + option: option, + options: excludeOptions.concat(filteredOptions) + }); + + if (_isOptionUnique2) { + var prompt = promptTextCreator(this.inputValue); + + this._createPlaceholderOption = _newOptionCreator({ + label: prompt, + labelKey: this.labelKey, + valueKey: this.valueKey + }); + + filteredOptions.unshift(this._createPlaceholderOption); + } + } + + return filteredOptions; + } + }, { + key: 'isOptionUnique', + value: function isOptionUnique(_ref) { + var option = _ref.option, + options = _ref.options; + var isOptionUnique = this.props.isOptionUnique; + + + options = options || this.props.options; + + return isOptionUnique({ + labelKey: this.labelKey, + option: option, + options: options, + valueKey: this.valueKey + }); + } + }, { + key: 'menuRenderer', + value: function menuRenderer$$1(params) { + var menuRenderer$$1 = this.props.menuRenderer; + + + return menuRenderer$$1(_extends({}, params, { + onSelect: this.onOptionSelect, + selectValue: this.onOptionSelect + })); + } + }, { + key: 'onInputChange', + value: function onInputChange(input) { + var onInputChange = this.props.onInputChange; + + // This value may be needed in between Select mounts (when this.select is null) + + this.inputValue = input; + + if (onInputChange) { + this.inputValue = onInputChange(input); + } + + return this.inputValue; + } + }, { + key: 'onInputKeyDown', + value: function onInputKeyDown(event) { + var _props3 = this.props, + shouldKeyDownEventCreateNewOption = _props3.shouldKeyDownEventCreateNewOption, + onInputKeyDown = _props3.onInputKeyDown; + + var focusedOption = this.select.getFocusedOption(); + + if (focusedOption && focusedOption === this._createPlaceholderOption && shouldKeyDownEventCreateNewOption({ keyCode: event.keyCode })) { + this.createNewOption(); + + // Prevent decorated Select from doing anything additional with this keyDown event + event.preventDefault(); + } else if (onInputKeyDown) { + onInputKeyDown(event); + } + } + }, { + key: 'onOptionSelect', + value: function onOptionSelect(option, event) { + if (option === this._createPlaceholderOption) { + this.createNewOption(); + } else { + this.select.selectValue(option); + } + } + }, { + key: 'focus', + value: function focus() { + this.select.focus(); + } + }, { + key: 'render', + value: function render() { + var _this2 = this; + + var _props4 = this.props, + newOptionCreator = _props4.newOptionCreator, + shouldKeyDownEventCreateNewOption = _props4.shouldKeyDownEventCreateNewOption, + refProp = _props4.ref, + restProps = objectWithoutProperties(_props4, ['newOptionCreator', 'shouldKeyDownEventCreateNewOption', 'ref']); + var children = this.props.children; + + // We can't use destructuring default values to set the children, + // because it won't apply work if `children` is null. A falsy check is + // more reliable in real world use-cases. + + if (!children) { + children = defaultChildren$2; + } + + var props = _extends({}, restProps, { + allowCreate: true, + filterOptions: this.filterOptions, + menuRenderer: this.menuRenderer, + onInputChange: this.onInputChange, + onInputKeyDown: this.onInputKeyDown, + ref: function ref(_ref2) { + _this2.select = _ref2; + + // These values may be needed in between Select mounts (when this.select is null) + if (_ref2) { + _this2.labelKey = _ref2.props.labelKey; + _this2.valueKey = _ref2.props.valueKey; + } + if (refProp) { + refProp(_ref2); + } + } + }); + + return children(props); + } + }]); + return CreatableSelect; +}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component); + + + +function defaultChildren$2(props) { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(Select$1, props); +} + +function isOptionUnique(_ref3) { + var option = _ref3.option, + options = _ref3.options, + labelKey = _ref3.labelKey, + valueKey = _ref3.valueKey; + + return options.filter(function (existingOption) { + return existingOption[labelKey] === option[labelKey] || existingOption[valueKey] === option[valueKey]; + }).length === 0; +} + +function isValidNewOption(_ref4) { + var label = _ref4.label; + + return !!label; +} + +function newOptionCreator(_ref5) { + var label = _ref5.label, + labelKey = _ref5.labelKey, + valueKey = _ref5.valueKey; + + var option = {}; + option[valueKey] = label; + option[labelKey] = label; + option.className = 'Select-create-option-placeholder'; + return option; +} + +function promptTextCreator(label) { + return 'Create option "' + label + '"'; +} + +function shouldKeyDownEventCreateNewOption(_ref6) { + var keyCode = _ref6.keyCode; + + switch (keyCode) { + case 9: // TAB + case 13: // ENTER + case 188: + // COMMA + return true; + default: + return false; + } +} + +// Default prop methods +CreatableSelect.isOptionUnique = isOptionUnique; +CreatableSelect.isValidNewOption = isValidNewOption; +CreatableSelect.newOptionCreator = newOptionCreator; +CreatableSelect.promptTextCreator = promptTextCreator; +CreatableSelect.shouldKeyDownEventCreateNewOption = shouldKeyDownEventCreateNewOption; + +CreatableSelect.defaultProps = { + filterOptions: filterOptions, + isOptionUnique: isOptionUnique, + isValidNewOption: isValidNewOption, + menuRenderer: menuRenderer, + newOptionCreator: newOptionCreator, + promptTextCreator: promptTextCreator, + shouldKeyDownEventCreateNewOption: shouldKeyDownEventCreateNewOption +}; + +CreatableSelect.propTypes = { + // Child function responsible for creating the inner Select component + // This component can be used to compose HOCs (eg Creatable and Async) + // (props: Object): PropTypes.element + children: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + // See Select.propTypes.filterOptions + filterOptions: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.any, + + // Searches for any matching option within the set of options. + // This function prevents duplicate options from being created. + // ({ option: Object, options: Array, labelKey: string, valueKey: string }): boolean + isOptionUnique: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + // Determines if the current input text represents a valid option. + // ({ label: string }): boolean + isValidNewOption: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + // See Select.propTypes.menuRenderer + menuRenderer: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.any, + + // Factory to create new option. + // ({ label: string, labelKey: string, valueKey: string }): Object + newOptionCreator: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + // input change handler: function (inputValue) {} + onInputChange: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + // input keyDown handler: function (event) {} + onInputKeyDown: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + // new option click handler: function (option) {} + onNewOptionClick: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + // See Select.propTypes.options + options: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.array, + + // Creates prompt/placeholder option text. + // (filterText: string): string + promptTextCreator: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + ref: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func, + + // Decides if a keyDown event (eg its `keyCode`) should result in the creation of a new option. + shouldKeyDownEventCreateNewOption: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func +}; + +var AsyncCreatableSelect = function (_React$Component) { + inherits(AsyncCreatableSelect, _React$Component); + + function AsyncCreatableSelect() { + classCallCheck(this, AsyncCreatableSelect); + return possibleConstructorReturn(this, (AsyncCreatableSelect.__proto__ || Object.getPrototypeOf(AsyncCreatableSelect)).apply(this, arguments)); + } + + createClass(AsyncCreatableSelect, [{ + key: 'focus', + value: function focus() { + this.select.focus(); + } + }, { + key: 'render', + value: function render() { + var _this2 = this; + + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + Async, + this.props, + function (_ref) { + var ref = _ref.ref, + asyncProps = objectWithoutProperties(_ref, ['ref']); + + var asyncRef = ref; + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( + CreatableSelect, + asyncProps, + function (_ref2) { + var ref = _ref2.ref, + creatableProps = objectWithoutProperties(_ref2, ['ref']); + + var creatableRef = ref; + return _this2.props.children(_extends({}, creatableProps, { + ref: function ref(select) { + creatableRef(select); + asyncRef(select); + _this2.select = select; + } + })); + } + ); + } + ); + } + }]); + return AsyncCreatableSelect; +}(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component); + + + +function defaultChildren$1(props) { + return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(Select$1, props); +} + +AsyncCreatableSelect.propTypes = { + children: __WEBPACK_IMPORTED_MODULE_1_prop_types___default.a.func.isRequired // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element +}; + +AsyncCreatableSelect.defaultProps = { + children: defaultChildren$1 +}; + +Select$1.Async = Async; +Select$1.AsyncCreatable = AsyncCreatableSelect; +Select$1.Creatable = CreatableSelect; +Select$1.Value = Value; +Select$1.Option = Option; + + +/* harmony default export */ __webpack_exports__["default"] = (Select$1); + + +/***/ }), +/* 195 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +var emptyFunction = __webpack_require__(7); +var invariant = __webpack_require__(0); +var ReactPropTypesSecret = __webpack_require__(33); + +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + invariant( + false, + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim + }; + + ReactPropTypes.checkPropTypes = emptyFunction; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + + +/***/ }), +/* 196 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = __webpack_require__(19); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = __webpack_require__(84); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var sizerStyle = { + position: 'absolute', + top: 0, + left: 0, + visibility: 'hidden', + height: 0, + overflow: 'scroll', + whiteSpace: 'pre' +}; + +var INPUT_PROPS_BLACKLIST = ['injectStyles', 'inputClassName', 'inputRef', 'inputStyle', 'minWidth', 'onAutosize', 'placeholderIsMinWidth']; + +var cleanInputProps = function cleanInputProps(inputProps) { + INPUT_PROPS_BLACKLIST.forEach(function (field) { + return delete inputProps[field]; + }); + return inputProps; +}; + +var copyStyles = function copyStyles(styles, node) { + node.style.fontSize = styles.fontSize; + node.style.fontFamily = styles.fontFamily; + node.style.fontWeight = styles.fontWeight; + node.style.fontStyle = styles.fontStyle; + node.style.letterSpacing = styles.letterSpacing; + node.style.textTransform = styles.textTransform; +}; + +var isIE = typeof window === 'undefined' ? false : /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent); + +var generateId = function generateId() { + // we only need an auto-generated ID for stylesheet injection, which is only + // used for IE. so if the browser is not IE, this should return undefined. + return isIE ? '_' + Math.random().toString(36).substr(2, 12) : undefined; +}; + +var AutosizeInput = function (_Component) { + _inherits(AutosizeInput, _Component); + + function AutosizeInput(props) { + _classCallCheck(this, AutosizeInput); + + var _this = _possibleConstructorReturn(this, (AutosizeInput.__proto__ || Object.getPrototypeOf(AutosizeInput)).call(this, props)); + + _this.inputRef = function (el) { + _this.input = el; + if (typeof _this.props.inputRef === 'function') { + _this.props.inputRef(el); + } + }; + + _this.placeHolderSizerRef = function (el) { + _this.placeHolderSizer = el; + }; + + _this.sizerRef = function (el) { + _this.sizer = el; + }; + + _this.state = { + inputWidth: props.minWidth, + inputId: props.id || generateId() + }; + return _this; + } + + _createClass(AutosizeInput, [{ + key: 'componentDidMount', + value: function componentDidMount() { + this.mounted = true; + this.copyInputStyles(); + this.updateInputWidth(); + } + }, { + key: 'componentWillReceiveProps', + value: function componentWillReceiveProps(nextProps) { + var id = nextProps.id; + + if (id !== this.props.id) { + this.setState({ inputId: id || generateId() }); + } + } + }, { + key: 'componentDidUpdate', + value: function componentDidUpdate(prevProps, prevState) { + if (prevState.inputWidth !== this.state.inputWidth) { + if (typeof this.props.onAutosize === 'function') { + this.props.onAutosize(this.state.inputWidth); + } + } + this.updateInputWidth(); + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + this.mounted = false; + } + }, { + key: 'copyInputStyles', + value: function copyInputStyles() { + if (!this.mounted || !window.getComputedStyle) { + return; + } + var inputStyles = this.input && window.getComputedStyle(this.input); + if (!inputStyles) { + return; + } + copyStyles(inputStyles, this.sizer); + if (this.placeHolderSizer) { + copyStyles(inputStyles, this.placeHolderSizer); + } + } + }, { + key: 'updateInputWidth', + value: function updateInputWidth() { + if (!this.mounted || !this.sizer || typeof this.sizer.scrollWidth === 'undefined') { + return; + } + var newInputWidth = void 0; + if (this.props.placeholder && (!this.props.value || this.props.value && this.props.placeholderIsMinWidth)) { + newInputWidth = Math.max(this.sizer.scrollWidth, this.placeHolderSizer.scrollWidth) + 2; + } else { + newInputWidth = this.sizer.scrollWidth + 2; + } + // allow for stepper UI on number types + if (this.props.type === 'number') { + newInputWidth += 16; + } + if (newInputWidth < this.props.minWidth) { + newInputWidth = this.props.minWidth; + } + if (newInputWidth !== this.state.inputWidth) { + this.setState({ + inputWidth: newInputWidth + }); + } + } + }, { + key: 'getInput', + value: function getInput() { + return this.input; + } + }, { + key: 'focus', + value: function focus() { + this.input.focus(); + } + }, { + key: 'blur', + value: function blur() { + this.input.blur(); + } + }, { + key: 'select', + value: function select() { + this.input.select(); + } + }, { + key: 'renderStyles', + value: function renderStyles() { + // this method injects styles to hide IE's clear indicator, which messes + // with input size detection. the stylesheet is only injected when the + // browser is IE, and can also be disabled by the `injectStyles` prop. + var injectStyles = this.props.injectStyles; + + return isIE && injectStyles ? _react2.default.createElement('style', { dangerouslySetInnerHTML: { + __html: 'input#' + this.state.inputId + '::-ms-clear {display: none;}' + } }) : null; + } + }, { + key: 'render', + value: function render() { + var sizerValue = [this.props.defaultValue, this.props.value, ''].reduce(function (previousValue, currentValue) { + if (previousValue !== null && previousValue !== undefined) { + return previousValue; + } + return currentValue; + }); + + var wrapperStyle = _extends({}, this.props.style); + if (!wrapperStyle.display) wrapperStyle.display = 'inline-block'; + + var inputStyle = _extends({ + boxSizing: 'content-box', + width: this.state.inputWidth + 'px' + }, this.props.inputStyle); + + var inputProps = _objectWithoutProperties(this.props, []); + + cleanInputProps(inputProps); + inputProps.className = this.props.inputClassName; + inputProps.id = this.state.inputId; + inputProps.style = inputStyle; + + return _react2.default.createElement( + 'div', + { className: this.props.className, style: wrapperStyle }, + this.renderStyles(), + _react2.default.createElement('input', _extends({}, inputProps, { ref: this.inputRef })), + _react2.default.createElement( + 'div', + { ref: this.sizerRef, style: sizerStyle }, + sizerValue + ), + this.props.placeholder ? _react2.default.createElement( + 'div', + { ref: this.placeHolderSizerRef, style: sizerStyle }, + this.props.placeholder + ) : null + ); + } + }]); + + return AutosizeInput; +}(_react.Component); + +; + +AutosizeInput.propTypes = { + className: _propTypes2.default.string, // className for the outer element + defaultValue: _propTypes2.default.any, // default field value + id: _propTypes2.default.string, // id to use for the input, can be set for consistent snapshots + injectStyles: _propTypes2.default.bool, // inject the custom stylesheet to hide clear UI, defaults to true + inputClassName: _propTypes2.default.string, // className for the input element + inputRef: _propTypes2.default.func, // ref callback for the input element + inputStyle: _propTypes2.default.object, // css styles for the input element + minWidth: _propTypes2.default.oneOfType([// minimum width for input element + _propTypes2.default.number, _propTypes2.default.string]), + onAutosize: _propTypes2.default.func, // onAutosize handler: function(newWidth) {} + onChange: _propTypes2.default.func, // onChange handler: function(newValue) {} + placeholder: _propTypes2.default.string, // placeholder text + placeholderIsMinWidth: _propTypes2.default.bool, // don't collapse size to less than the placeholder + style: _propTypes2.default.object, // css styles for the outer element + value: _propTypes2.default.any // field value +}; +AutosizeInput.defaultProps = { + minWidth: 1, + injectStyles: true +}; + +exports.default = AutosizeInput; + +/***/ }), +/* 197 */ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + Copyright (c) 2016 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/* global define */ + +(function () { + 'use strict'; + + var hasOwn = {}.hasOwnProperty; + + function classNames () { + var classes = []; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (!arg) continue; + + var argType = typeof arg; + + if (argType === 'string' || argType === 'number') { + classes.push(arg); + } else if (Array.isArray(arg)) { + classes.push(classNames.apply(null, arg)); + } else if (argType === 'object') { + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes.push(key); + } + } + } + } + + return classes.join(' '); + } + + if (typeof module !== 'undefined' && module.exports) { + module.exports = classNames; + } else if (true) { + // register as 'classnames', consistent with npm package name + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { + return classNames; + }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else { + window.classNames = classNames; + } +}()); + + +/***/ }), +/* 198 */ +/***/ (function(module, exports) { + +module.exports = require("electron"); + +/***/ }), +/* 199 */ +/***/ (function(module, exports) { + +module.exports = ["Leeeeeeroy jenkins!","Readying the felines.","Ensuring dankest memes.","Recruiting robot hamsters.","Getting dunked.","Summoning unnecessarily dramatic encounters.","Procedurally generating buttons.","Preparing for a team fight.","Buffing before the raid.","Top decking lethal.","Reloading the R8.","Constructing additional pylons.","Unbenching the Kench."] + +/***/ }), +/* 200 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _react = __webpack_require__(19); + +var _react2 = _interopRequireDefault(_react); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var Progress = function Progress(_ref) { + var _ref$percent = _ref.percent, + percent = _ref$percent === undefined ? 0 : _ref$percent; + return _react2.default.createElement( + "div", + { className: "progress" }, + _react2.default.createElement( + "div", + { className: "progress-bar" }, + _react2.default.createElement("div", { className: "complete", style: { width: percent + "%" } }) + ) + ); +}; + +exports.default = Progress; +module.exports = exports["default"]; + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/splash/variables.json b/appasar/canary/app_bootstrap/splash/variables.json new file mode 100644 index 0000000..db7882a --- /dev/null +++ b/appasar/canary/app_bootstrap/splash/variables.json @@ -0,0 +1,6 @@ +{ + "width": "300px", + "height": "300px", + "inDuration": 700, + "outDuration": 333 +} diff --git a/appasar/canary/app_bootstrap/splashScreen.js b/appasar/canary/app_bootstrap/splashScreen.js new file mode 100644 index 0000000..047d0ad --- /dev/null +++ b/appasar/canary/app_bootstrap/splashScreen.js @@ -0,0 +1,318 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.events = exports.APP_SHOULD_SHOW = exports.APP_SHOULD_LAUNCH = undefined; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.initSplash = initSplash; +exports.focusWindow = focusWindow; +exports.pageReady = pageReady; + +var _electron = require('electron'); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _url = require('url'); + +var _url2 = _interopRequireDefault(_url); + +var _events = require('events'); + +var _moduleUpdater = require('../common/moduleUpdater'); + +var moduleUpdater = _interopRequireWildcard(_moduleUpdater); + +var _ipcMain = require('./ipcMain'); + +var _ipcMain2 = _interopRequireDefault(_ipcMain); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var UPDATE_TIMEOUT_WAIT = 10000; +var RETRY_CAP_SECONDS = 60; +// citron note: atom seems to add about 50px height to the frame on mac but not windows +// TODO: see if we can eliminate fudge by using useContentSize BrowserWindow option +var LOADING_WINDOW_WIDTH = 300; +var LOADING_WINDOW_HEIGHT = process.platform == 'darwin' ? 300 : 350; + +// TODO: addModulesListener events should use Module's constants +var CHECKING_FOR_UPDATES = 'checking-for-updates'; +var UPDATE_CHECK_FINISHED = 'update-check-finished'; +var UPDATE_FAILURE = 'update-failure'; +var LAUNCHING = 'launching'; +var DOWNLOADING_MODULE = 'downloading-module'; +var DOWNLOADING_UPDATES = 'downloading-updates'; +var DOWNLOADING_MODULES_FINISHED = 'downloading-modules-finished'; +var DOWNLOADING_MODULE_PROGRESS = 'downloading-module-progress'; +var DOWNLOADED_MODULE = 'downloaded-module'; +var NO_PENDING_UPDATES = 'no-pending-updates'; +var INSTALLING_MODULE = 'installing-module'; +var INSTALLING_UPDATES = 'installing-updates'; +var INSTALLED_MODULE = 'installed-module'; +var INSTALLING_MODULE_PROGRESS = 'installing-module-progress'; +var INSTALLING_MODULES_FINISHED = 'installing-modules-finished'; +var UPDATE_MANUALLY = 'update-manually'; + +var APP_SHOULD_LAUNCH = exports.APP_SHOULD_LAUNCH = 'APP_SHOULD_LAUNCH'; +var APP_SHOULD_SHOW = exports.APP_SHOULD_SHOW = 'APP_SHOULD_SHOW'; + +var events = exports.events = new _events.EventEmitter(); + +function webContentsSend(win, event) { + if (win != null && win.webContents != null) { + var _win$webContents; + + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + + (_win$webContents = win.webContents).send.apply(_win$webContents, ['DISCORD_' + event].concat(args)); + } +} + +var splashWindow = void 0; +var modulesListeners = void 0; +var updateTimeout = void 0; +var updateAttempt = void 0; +var splashState = void 0; +var launchedMainWindow = void 0; + +function initSplash() { + var startMinimized = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + modulesListeners = {}; + splashState = {}; + launchedMainWindow = false; + updateAttempt = 0; + + addModulesListener(CHECKING_FOR_UPDATES, function () { + startUpdateTimeout(); + updateSplashState(CHECKING_FOR_UPDATES); + }); + + addModulesListener(UPDATE_CHECK_FINISHED, function (succeeded, updateCount, manualRequired) { + stopUpdateTimeout(); + if (!succeeded) { + scheduleUpdateCheck(); + updateSplashState(UPDATE_FAILURE); + } else if (updateCount === 0) { + launchMainWindow(); + updateSplashState(LAUNCHING); + } + }); + + addModulesListener(DOWNLOADING_MODULE, function (name, current, total) { + stopUpdateTimeout(); + splashState = { current: current, total: total }; + updateSplashState(DOWNLOADING_UPDATES); + }); + + addModulesListener(DOWNLOADING_MODULE_PROGRESS, function (name, progress) { + splashState.progress = progress; + updateSplashState(DOWNLOADING_UPDATES); + }); + + addModulesListener(DOWNLOADED_MODULE, function (name, current, total, succeeded) { + return delete splashState.progress; + }); + + addModulesListener(DOWNLOADING_MODULES_FINISHED, function (succeeded, failed) { + if (failed > 0) { + scheduleUpdateCheck(); + updateSplashState(UPDATE_FAILURE); + } else { + process.nextTick(function () { + return moduleUpdater.quitAndInstallUpdates(); + }); + } + }); + + addModulesListener(NO_PENDING_UPDATES, function () { + return moduleUpdater.checkForUpdates(); + }); + + addModulesListener(INSTALLING_MODULE, function (name, current, total) { + splashState = { current: current, total: total }; + updateSplashState(INSTALLING_UPDATES); + }); + + addModulesListener(INSTALLED_MODULE, function (name, current, total, succeeded) { + return delete splashState.progress; + }); + + addModulesListener(INSTALLING_MODULE_PROGRESS, function (name, progress) { + splashState.progress = progress; + updateSplashState(INSTALLING_UPDATES); + }); + + addModulesListener(INSTALLING_MODULES_FINISHED, function (succeeded, failed) { + return moduleUpdater.checkForUpdates(); + }); + + addModulesListener(UPDATE_MANUALLY, function (newVersion) { + splashState.newVersion = newVersion; + updateSplashState(UPDATE_MANUALLY); + }); + + launchSplashWindow(startMinimized); +} + +function destroySplash() { + removeModulesListeners(); + stopUpdateTimeout(); + + if (splashWindow) { + splashWindow.setSkipTaskbar(true); + // defer the window hiding for a short moment so it gets covered by the main window + var _nukeWindow = function _nukeWindow() { + splashWindow.hide(); + splashWindow.close(); + splashWindow = null; + }; + setTimeout(_nukeWindow, 100); + } +} + +function addModulesListener(event, listener) { + modulesListeners[event] = listener; + moduleUpdater.events.addListener(event, listener); +} + +function removeModulesListeners() { + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = Object.keys(modulesListeners)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var event = _step.value; + + moduleUpdater.events.removeListener(event, modulesListeners[event]); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } +} + +function startUpdateTimeout() { + if (!updateTimeout) { + updateTimeout = setTimeout(function () { + return scheduleUpdateCheck(); + }, UPDATE_TIMEOUT_WAIT); + } +} + +function stopUpdateTimeout() { + if (updateTimeout) { + clearTimeout(updateTimeout); + updateTimeout = null; + } +} + +function updateSplashState(event) { + if (splashWindow != null && !splashWindow.isDestroyed() && !splashWindow.webContents.isDestroyed()) { + webContentsSend(splashWindow, 'SPLASH_UPDATE_STATE', _extends({ status: event }, splashState)); + } +} + +function launchSplashWindow(startMinimized) { + var windowConfig = { + width: LOADING_WINDOW_WIDTH, + height: LOADING_WINDOW_HEIGHT, + transparent: false, + frame: false, + resizable: false, + center: true, + show: false + }; + + splashWindow = new _electron.BrowserWindow(windowConfig); + + // prevent users from dropping links to navigate in splash window + splashWindow.webContents.on('will-navigate', function (e) { + return e.preventDefault(); + }); + + splashWindow.webContents.on('new-window', function (e, windowURL) { + e.preventDefault(); + _electron.shell.openExternal(windowURL); + // exit, but delay half a second because openExternal is about to fire + // some events to things that are freed by app.quit. + setTimeout(_electron.app.quit, 500); + }); + + if (process.platform !== 'darwin') { + // citron note: this causes a crash on quit while the window is open on osx + splashWindow.on('closed', function () { + splashWindow = null; + if (!launchedMainWindow) { + // user has closed this window before we launched the app, so let's quit + _electron.app.quit(); + } + }); + } + + _ipcMain2.default.on('SPLASH_SCREEN_READY', function () { + if (splashWindow && !startMinimized) { + splashWindow.show(); + } + + moduleUpdater.installPendingUpdates(); + }); + + var splashUrl = _url2.default.format({ + protocol: 'file', + slashes: true, + pathname: _path2.default.join(__dirname, 'splash', 'index.html') + }); + + splashWindow.loadURL(splashUrl); +} + +function launchMainWindow() { + if (!launchedMainWindow && splashWindow != null) { + launchedMainWindow = true; + events.emit(APP_SHOULD_LAUNCH); + } +} + +function scheduleUpdateCheck() { + // TODO: can we use backoff here? + updateAttempt += 1; + var retryInSeconds = Math.min(updateAttempt * 10, RETRY_CAP_SECONDS); + splashState.seconds = retryInSeconds; + setTimeout(function () { + return moduleUpdater.checkForUpdates(); + }, retryInSeconds * 1000); +} + +function focusWindow() { + if (splashWindow != null) { + splashWindow.focus(); + } +} + +function pageReady() { + destroySplash(); + process.nextTick(function () { + return events.emit(APP_SHOULD_SHOW); + }); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/squirrelUpdate.js b/appasar/canary/app_bootstrap/squirrelUpdate.js new file mode 100644 index 0000000..d451c75 --- /dev/null +++ b/appasar/canary/app_bootstrap/squirrelUpdate.js @@ -0,0 +1,224 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.spawnUpdateInstall = spawnUpdateInstall; +exports.spawnUpdate = spawnUpdate; +exports.handleStartupEvent = handleStartupEvent; +exports.updateExistsSync = updateExistsSync; +exports.restart = restart; + +var _child_process = require('child_process'); + +var _child_process2 = _interopRequireDefault(_child_process); + +var _fs = require('fs'); + +var _fs2 = _interopRequireDefault(_fs); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _autoStart = require('./autoStart'); + +var autoStart = _interopRequireWildcard(_autoStart); + +var _windowsUtils = require('./windowsUtils'); + +var windowsUtils = _interopRequireWildcard(_windowsUtils); + +var _singleInstance = require('./singleInstance'); + +var singleInstance = _interopRequireWildcard(_singleInstance); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// citron note: this assumes the execPath is in the format Discord/someVersion/Discord.exe +var appFolder = _path2.default.resolve(process.execPath, '..'); +var rootFolder = _path2.default.resolve(appFolder, '..'); +var exeName = _path2.default.basename(process.execPath); +var updateExe = _path2.default.join(rootFolder, 'Update.exe'); + +// Specialized spawn function specifically used for spawning the updater in +// update mode. Calls back with progress percentages. +// Returns Promise. +function spawnUpdateInstall(updateUrl, progressCallback) { + return new Promise(function (resolve, reject) { + var proc = _child_process2.default.spawn(updateExe, ['--update', updateUrl]); + proc.on('error', reject); + proc.on('exit', function (code) { + if (code !== 0) { + return reject(new Error('Update failed with exit code ' + code)); + } + return resolve(); + }); + + var lastProgress = -1; + function parseProgress() { + var lines = stdout.split(/\r?\n/); + if (lines.length === 1) return; + // return the last (possibly incomplete) line to stdout for parsing again + stdout = lines.pop(); + var currentProgress = void 0; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var line = _step.value; + + if (!/^\d\d?$/.test(line)) continue; + var progress = Number(line); + // make sure that this number is steadily increasing + if (lastProgress > progress) continue; + currentProgress = progress; + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + if (currentProgress == null) return; + lastProgress = currentProgress; + progressCallback(Math.min(currentProgress, 100)); + } + + var stdout = ''; + proc.stdout.on('data', function (chunk) { + stdout += String(chunk); + parseProgress(); + }); + }); +} + +// Spawn the Update.exe with the given arguments and invoke the callback when +// the command completes. +function spawnUpdate(args, callback) { + windowsUtils.spawn(updateExe, args, callback); +} + +// Create a desktop and start menu shortcut by using the command line API +// provided by Squirrel's Update.exe +function createShortcuts(callback, updateOnly) { + // move icon out to a more stable location, to keep shortcuts from breaking as much + var icoSrc = _path2.default.join(appFolder, 'app.ico'); + var icoDest = _path2.default.join(rootFolder, 'app.ico'); + var icoForTarget = icoDest; + try { + var ico = _fs2.default.readFileSync(icoSrc); + _fs2.default.writeFileSync(icoDest, ico); + } catch (e) { + // if we can't write there for some reason, just use the source. + icoForTarget = icoSrc; + } + var createShortcutArgs = ['--createShortcut', exeName, '--setupIcon', icoForTarget]; + if (updateOnly) { + createShortcutArgs.push('--updateOnly'); + } + spawnUpdate(createShortcutArgs, callback); +} + +// Add a protocol registration for this application. +function installProtocol(protocol, callback) { + var queue = [['HKCU\\Software\\Classes\\' + protocol, '/ve', '/d', 'URL:' + protocol + ' Protocol'], ['HKCU\\Software\\Classes\\' + protocol, '/v', 'URL Protocol'], ['HKCU\\Software\\Classes\\' + protocol + '\\DefaultIcon', '/ve', '/d', '"' + process.execPath + '",-1'], ['HKCU\\Software\\Classes\\' + protocol + '\\shell\\open\\command', '/ve', '/d', '"' + process.execPath + '" --url -- "%1"']]; + + windowsUtils.addToRegistry(queue, callback); +} + +function terminate(app) { + app.quit(); + process.exit(0); +} + +// Remove the desktop and start menu shortcuts by using the command line API +// provided by Squirrel's Update.exe +function removeShortcuts(callback) { + spawnUpdate(['--removeShortcut', exeName], callback); +} + +// Update the desktop and start menu shortcuts by using the command line API +// provided by Squirrel's Update.exe +function updateShortcuts(callback) { + createShortcuts(callback, true); +} + +// Purge the protocol for this applicationstart. +function uninstallProtocol(protocol, callback) { + windowsUtils.spawnReg(['delete', 'HKCU\\Software\\Classes\\' + protocol, '/f'], callback); +} + +// Handle squirrel events denoted by --squirrel-* command line arguments. +// returns `true` if regular startup should be prevented +function handleStartupEvent(protocol, app, squirrelCommand) { + switch (squirrelCommand) { + case '--squirrel-install': + createShortcuts(function () { + autoStart.install(function () { + installProtocol(protocol, function () { + terminate(app); + }); + }); + }, false); + return true; + + case '--squirrel-updated': + updateShortcuts(function () { + autoStart.update(function () { + installProtocol(protocol, function () { + terminate(app); + }); + }); + }); + return true; + + case '--squirrel-uninstall': + removeShortcuts(function () { + autoStart.uninstall(function () { + uninstallProtocol(protocol, function () { + singleInstance.pipeCommandLineArgs(function () { + return terminate(app); + }, function () { + return terminate(app); + }); + }); + }); + }); + return true; + + case '--squirrel-obsolete': + terminate(app); + return true; + + default: + return false; + } +} + +// Are we using Squirrel for updates? +function updateExistsSync() { + return _fs2.default.existsSync(updateExe); +} + +// Restart app as the new version +function restart(app, newVersion) { + app.once('will-quit', function () { + var execPath = _path2.default.resolve(rootFolder, 'app-' + newVersion + '/' + exeName); + _child_process2.default.spawn(execPath, [], { detached: true }); + }); + app.quit(); +} \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/startupMenu/darwin.js b/appasar/canary/app_bootstrap/startupMenu/darwin.js new file mode 100644 index 0000000..e1ebc0a --- /dev/null +++ b/appasar/canary/app_bootstrap/startupMenu/darwin.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _electron = require('electron'); + +exports.default = [{ + label: 'Discord', + submenu: [{ + label: 'Quit', + click: function click() { + return _electron.app.quit(); + }, + accelerator: 'Command+Q' + }] +}]; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/startupMenu/index.js b/appasar/canary/app_bootstrap/startupMenu/index.js new file mode 100644 index 0000000..a4d7641 --- /dev/null +++ b/appasar/canary/app_bootstrap/startupMenu/index.js @@ -0,0 +1,12 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _electron = require('electron'); + +var menu = require('./' + process.platform); + +exports.default = _electron.Menu.buildFromTemplate(menu); +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/startupMenu/linux.js b/appasar/canary/app_bootstrap/startupMenu/linux.js new file mode 100644 index 0000000..043ea5f --- /dev/null +++ b/appasar/canary/app_bootstrap/startupMenu/linux.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _electron = require('electron'); + +exports.default = [{ + label: '&File', + submenu: [{ + label: '&Exit', + click: function click() { + return _electron.app.quit(); + }, + accelerator: 'Control+Q' + }] +}]; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/startupMenu/win32.js b/appasar/canary/app_bootstrap/startupMenu/win32.js new file mode 100644 index 0000000..b22093a --- /dev/null +++ b/appasar/canary/app_bootstrap/startupMenu/win32.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _electron = require('electron'); + +exports.default = [{ + label: '&File', + submenu: [{ + label: '&Exit', + click: function click() { + return _electron.app.quit(); + }, + accelerator: 'Alt+F4' + }] +}]; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/app_bootstrap/videos/connecting.webm b/appasar/canary/app_bootstrap/videos/connecting.webm new file mode 100644 index 0000000000000000000000000000000000000000..70224559c9f62503258d82b0febb495883752993 GIT binary patch literal 44980 zcmdS91ydYd8?`%wy95dD!QI{6-Q9yra2*_iyK8Wl0Kr{?yGw9)34S7Po^wvs_Xj?z zhU%`Fp5A+}Ypwh4?!gh;C;$Tf{1FO=fPljHzg|}$2;plGjBr4Zo0+k#a3}~&I2Z(m zrQ&b#_oLN5sB#&f1Zm}3KdY1nVMvvlt5kq?<ys?u?P01`S*uh807?Ju;;FR$-mNw~ z`QKT}{+{grhX21O_P<dxQ!ms8A`1)3`A5kbxtg<a&~q@+Gchu12>t)}MZ?1cV=Mkl z?)O6c?`V;#|7~zDfPl{ZAYdj4K=L&+(8bO)Bv{=*U6Csg1SH)K4186j-u&N3k!u2g zu`Rz|=^!wbE)bAVq|xQ?Ta{b;AVBWlZFu!Ou@ca)^94u+3Inh%u<mF%$?&l50N}BH zb1SVJos|!-2K(*Bg}2MrmG+fX9W4v0Cxk0m*6z2`S{JVhkHwo_Ri%(Vf!i({4*l7{ zbVdNcVtRnGl+GtFZq8FJgzte&)P<;pw3o0uowfl`JoJ5|L-h2O1%3usnrxjS+k@x& zn!DlnAZB?Fe;s663~eS(6||0Ob0)VVO%yhX5wC*E#)35p$VC%O#bc4OZKF5ZsF{<{ z&)ezuY4b2}2sJw&Mc-g)-s9EB-+BjLNmTSSWMQ$3&rIxRBjF*&)UNQp+K`C+x}ObJ za_=#SRmk1@df>^-Qh43DhU65;!mRr$(dAY9g^Y9D27=YmV0m#^)S`9+2u;~jc(!ko z`vX2htMqCM??6hD_w2L82kArwpYkX>UG&yATFR;tLgP3Gg650<?vJ(iW5EEP0}Wn+ zKI>3p^2;bvg`2#u;0{X=?j*xr1FIJjjm3mqXrWSRcy6F=hId5YOZ}L|;6KZ#TN(oS zgzU%?_n3Z$q~*E$^GZP6K=^!EkKupp-l$?LsBbBo^tD`H!Ibm(PLasPKk=b%(aNMU zTk-AMO3}Im{7!&R77ZGibs^lSs%m+$+Uv;nfCPN3;4*^$Lc3ao-{6Qx1q+fqRG)?` z8x^_E@0mv}bAx`_LO^ui=Mzw5n1j0fR>Rpo6$yotV?l@`w&(iIi`9uCn|jx#ytYOD z@~d<+-AS|!GdFaGA!Cbot(!5t`LnmFOGy<Adp(35<J(qE<jA{uC7TANA=JH9pSE-P zR%p^VlHl~QPpOjmgmE&E!q4*_#=#X8+4S&oF&#FPfVjym{p8CP@E+9m!-R=}KAT>c zv*(a{c0~lR)%&kVY;sZ%rdXHVWjp8c{;cNTC~RU+lA-d;sD+H%2n_BXI|@PZrV~#E z9<e*}k6NV3M62%&D0AZ|K2HZL#emGRL?#aBOGsMuv?&>SOhv1gNqZJZN;%Q^;I1NE zqLksW0wa#z+^O~yZPAr_B`_KGS^*r^lF^6qgG8d#tD%ZP;nSSePPS7jZk}52bHtND zbomGI1;|2?fNOd?=qPD@lsf11F1EorCW+Mhc7<i49AJ}5o?>c@r6|T+#&MZqLW;`U zs02^Bapc#d_g!i3%<yxG{6|_W!EzF5pO|qh>Q?gyCvw-!z4U<eZFJ1IkXuGjNU1ZN zuqo=}yzG3KpOp|c(c*KF+8pK(NIr;gqG1o5f1$lpXSjH)yvPM_-oNuaN;Wl;c)^Sa znQfF7DZfb=ElANc<FRmhd(oz8Cl=$Co7I2U0lBA<q*+dB+E8-R8LMkr$Zz%jaau~} z!=l5~GxB)~H_;mow(WV6I*{s+fHVWCU};Zy37eX~DC4BX-<C{nzjrO=^xY&OH86uY z#q#(lpg5^-V58><EXscA;KNw1%1XOEcxH#b4)Gekl}=cX3`7Z=1A$O&f#JA4Pq>ol zjShZP8c$CmWe3g@o6>;!JjW6WQ&A3rZ}r9(#!?+D!eAwfRlCjy0+GmqGK=m8M$6;l zWA=F%WFVo`1ot@8f%p3d<P$n4ia_9_i5mLks(4Qe7+9sgB~<QL{tsfN{F-C>o-*NW z(d(}EFUo`w1vHQ?bWu47y70CLE2zF@A5$O`e)8Pc(jl0wPzT^)p^qc7nl&Ag^9s&p z%!X_YuP+mgfW#)O7;zJ{o!*dJ;5r!hjL^lK)jcDVmxfCQVO^0aT6-KMweJf%p3k&= zOtaW0shoy*Jg_5i5RpB{qJF+@I?<`0{dAKkz!ve`!NI+6Cmt7VU+jjyiZaNi?6J?^ zfCx)jP2!o(9>Kysyun>>QtldNwwXT^Tzo$g!`l$1xCoVORKbG-wO?hhHii2%0k3_i zC6z#JYxuL9<iM*j=)4fOc%GO?Si`EsCGT%&L*^CzZzJ^#1S}Mb|1Z47|AsfP#!u<E zm7`gJVdOan`_`9Ydkm~<8DhHn`B&0gY!t<TR`(S2lsw%Uhe|Oz$Y=GP-usb=Iy&_` zM_F~84SuR`^uA2O@?;DpK|`J#Oj7V$-Aixt(s3oq6>*W5%0A7%w*izk(5V^lrM#qA zjIm%coAkI~H=Q*{qm`yqkFC(nbTX@zyrSG`5}I{uy3w)wQyvx}%bR7sJ|AdXoyy)O zmU@9CXN~J57jk3-Cr-{ZrAXBkrrB^=q(N+RIY(F~t2i(UuvgYHurV&q7Aju#8^vbB z*bi5%gKpJ!J;8x)@}*JIP}3zf0{E*X!}I(nX~T$%4|IXaH=<B$hl)q={xG!+?`4#w z#^bG@xl$_fA!vwH^Iyr4>WC)L=L1a|mmSkz=f`f{rrAi(iTlBe=$hGs)=CEl1qQyU z2p|$whAn1-&}BKRi>YTMW`hs|*i{mQ<*;7LsF6f1`-$$#+UMNCrp<5dM$WJ?qFk@i z`wWoTQ$!!I3Q+sucencLxJY*g`S<o-AgBsV3kFNY$x|8=QzGvkg||LFQ|_4G#dbG! zfMQG#1s>oGCh}6+pi%V{i6SQ`<utos0F>v#HCM2)g^xqNO0(cOnz7fVMf+%GbFp35 zG`r9U_VXXz;nwJ}yzxjSMrjLRn1fk&m|CK`A6X^ha;{w&Wu{}0^vGU{K|TzoE(<C4 z&bP=`g|ZmI5rxUsS!UP*0`L%`H4!jULO9R1uQZ~&JYb$D*@S!IUeThMZJIqJNqy#| z)?_#Cgm@_(@7%tEV9>Q33b#sSQ3tzj6If1HBe&;>3bHRZlYuLUA13Ks!_Gp!B^$;` zLp(~x+TkBy>BBj{&~}2fxEajZWs~3IyJg$zj2=|Mcm!5Pjb`D#6TKX9i+0|iaxOEP zdCfv()mo)It6iq$q3_Hpk(!7o#{NOllmS80gA+81-sf1}#ce|;dkFA~`;-BS#CHDN z<Z$NCTMH4Pizw-Y5ZJZI_dpOxmZfB(>ljCd!7V@e)`9c+i#qT4z*yqMs%m8lTZADO zj3qVe4jlsb@HMs=nwP~lBqSUq#3S}-NT1qD_KuZtlSCy#lyW!)&CAXUqRwVvi|^#b zY?{oS^!}FQhiIJKIy&S+fqJEH8WV5mE9ji5O~@TL^TOGpZk*8Ujal|PXu(6#rEt|8 zYD5W(0?pXN2+Wj<e8{WV6EAP9hE2w5Tn%W(d8Ej4F+XtFYBYCnEW?8|gT`;aW$w$| zXj3cS?iTdxff6VHRkpS%2i)mDqk%L?$sgA#AOs3}kV5(9S$dZ_zHHr+&6Hp2Y!~O) z`LH5Mu~XkJ-@3V*&M9<>@JOnFD#`}Z!YC$R3J38;wPHTmf@jNPdN++b{}lA&p71ji zmc5w1X@!39913;rzB?Ro2;<zwrlK3`{1_k*^sL+Cm6zBk$k!8_T>M7i5lWE<-S={X zN7kT@-o<NU#lGawWNq}d3NFcSaPHm8aCqg(_O7w=mq#xyX}Unfm-pY*1v{>7EFCzS zf_qDQ2V<5NR&gz<wP*b<NAYsn-n*3}^Dha1WnNYegk_?HEQuyOFDfB-$n4(O$+#%! zLHWw_&{4*S#MfOq7I?Tkt%5Nj{6f*u$2=W4#W__zk7}A`b^+itl1oZkT9SlEu8LnX zmmjolKpHxO7^(YN2OowVG1@h+3yX6aZl!!ChMUTLlNz3t)YOtOJYk%0BUwz$-cS|! zJ{ql3bX2Fdp3S+1*-(U;g}rCSksgZbYw_+}W=RlNa)lgdq1{&vUklTSds4whWFf(4 zSpbKJHOZ#GL25%|fs;bmCE{oT?c=AS&`h+JC-NKeA6R%*ahtY#!ouIOv5Tl4ro2D6 z29y75uK_A~Ss(x^AOs*7j|ZdQ1%RO_`4Lp<GY!xWl~6?`b9e#){-rvA;(w_QAo!i? zX@8CZ{2z|_U+WG?%Ub~fi2r`Kpq?QB%5YXy901VMKzb*Ui0afAPMS$;Gjea7mCS;r zHccFH@{T~iG<L4e=iya8<OBcILK92B0?=CpuD-v^@;WtmW+e>^FMUsMr<U;N=Zhy0 z>VG3+_%|~0-y_TWJDXo;1SbOgp2!VOBHEYLtn65ZjtP_6I{tsN2NLHA#)AONe}`zO zV+epn&KH`xW%^ZxG-%7-zE91VWbWB34D(>weSVXe4Q<B4w6EzH-6yyfMv;j?P8^}V z_89g(<Tye$p6KT|af(aF*S~(H`ZSB}0=E933}!+lD-t|4;4yCcI0YdfQVPkR4cA$o zi4xxD-hrS-E3C9PyTgc;t!_9ZLJgHlvWeKfy=>wC1S0-#W`6%>=K6bPm%nFLA*dk; zfI!awHO2~IM<iWVc*Bog;m%)Q8^$izXY8UA+??bI#y!`Fu<^7UOF8-|V3sF6t$Po` z%1YfhZ?Lr4(H?zKCF|`<!ZJM43SFYzLy|c4`PjF0f$#i04l2rw{TCi0T4Q@sm!7r- z|EDF;F;B1x1Q7YVQr_CX#Dqb?75p^>v`;_cs=@Sot7*}!tqOTBF;}>gx>kSUM5K5D zgy>n?Pwf`Q<w~0GbeePU#;o`_$k#U8-pM~r`hh%PtCxH0dMBYb$;-IFS5H2~A}j?n zh)+i;u|OH7HTf!c7!kYkOXdEkkd{rpM|A4cy%vDpcojhz;XjOuS-z#gyOIV8?*Z#) znutu;z7)#!7<On}bMJef)+pmmZ9ajR|69fSf2&ybdld!0{8>g(wOjzCL%BNuppL6( z>LS2?rg&&~ZTuNO!oP8r)=%{08_NL`tpg!)(r#t`yQ&(mX6h)a^R9vX*kb&|?A<L* zz~OpDCJR8L_h<`D<P)b@70x9xeP#ITVPWpWlYci7ydxb_-Ipp|x`L0EZ2fcf7oXJ0 z2uC5Pz9e<lUELja22*EI0>EpaQ*VNP>ZcJ_>qG259l<W>#-Pz|<@o<w`NurLT@XO! z@5=jY<pQ7_@|Q3ff3N&Dn+p*cwXsh*oP=i5J|8>!D9W8R6Z=xx6ftL8Z7Pr8)yHZ- zHGF-|EGv$kYpd&>bZEqs7FyP%Bkr7HG+Ue?sp{n2L(XWpiRJ9!Gw5Qh7W;NTA7Y*i zSyVA9WWY5;$(M1Q4ly;lguZyN*6r`94vnTJHUlvO{Qma*7vSLMP|HUhD!rrMpi_;U z>~DB~^h-0RDJ)I(A&!lR4~}WtLs5T7%TiR0`>G%1X5GZOi9Qvb9i%~~fz1@#*D-G~ z%1EZU95z4X{H<2c5AXyM`6n0<@}FSOe+0YxBbcV@CIH;wk6iKDYS`%=pO?CnF>?b` zg#2Z|%gO3_-9<E@z~`(?jiOd+-iq5=0_Mi^nhuzR4AdUYpU*1i6Gi<{svKF#Vv9*Q zq#^lER=_Fy6*!xiIWThtO45zYGHXMyOyOIhc&?#ze4?S<ZX_MFwQPxH-{x&UfJ@l% z)h)Dz?cSO5))b3cwS4K9)uZw=@(~7@bMToUuls8(O0CdGhKy)prghZO)t)wHzgEF$ zTAn~I;J&`@o;%SCq$P@z@pt0$3c}##z#k~f^AKWmB6(#T5s(OcPKf~+Rnd#pl?5W; zeV^lYvdb?24}pn1!2=M$^nWq+3js(682>-s+lnQzpe&F+xXA~?{Y3TRwDG;@zNKSA zF%m;%Hy|7D;TrTp9Yl~I;8VXDHEDl#O`^hDa73ioF^6E=nUB;g7Ysr4>XC1pa;%=` z=8ZNyOgkA;o~P5AJ>Z%c57<qH{*K;>DDpy46PfQU@=dp(5`v_1Mg!%O<}@LjMZae- zU%Bv+`~X~ypAFG_tYq3Q6^X<cVh?I6avWsBtA?L`j#N7?Tb+%dLD?Tp_nB)CT6#=? zE)E41qk=89Hde-$Y|eJi$RKE<%7)yKAp(ZLJ^o)5sQjY<u<(z9@jny{{h`284FG@u ze))reWq*QQyM|iyL%#1K**HKFnPB_l1a;FS_PK<b2vHCRh%E_kKAnTQB4hf8sQO}) zTsbxU3RHUQSA}iuQ?$|VXrgkl&T=)xyNxT70C92GLzlRQ?k5XgV0CQXx=B7jA@>P& zRnXg&FP8+-n0m@kWTCM;NhJSpvE70{VYpaqk*hw@2@DT0GLNI9YnbXYq~aZP2-CZ4 zsx)Djc=`T&8HOXs=Z!$(XEbrou&^V@JbBn)ny>$b>P4R5@vr*&S67?gx*B%;s#w3B z4b7ca&qpo#k%VfELZkGXE%=T+)e8{~L{cR3mopDqbZ;7wO!vnzJw3*1_to9S`*HEs z{Iu<Jn7dj|r8@JN>9SQEJc79gdLR1tcA{UO>l@?nQ(e3utmuU<>FlSyH8*uqcL(dQ z#t&+*9UINr4afl+$aQs++(iD+W{{{sLKyT>+Q&o#JsRf5NL#%Y*69v5F_$NFAeNMb zL2YlOiG%Yydl_=B+IKo~xEwhu-Tg<Z@Z&<V^c?)xOAf{6KghP(;KUDEFGqt;sruwl zWrPkKeo1TkpR~9Cq&@i~?cV<kp8L<>p55s$_pTD|Mew3MuG%4LBp8122(w-86+dX~ zf@)NSb}EMuTB0YUFYuv`@?$;mtLkjixkBQOvJkrOvx`_-7&BuQ?7Bd9?aT-2{U*F0 z0=~HK*)1|D`hLb4RUosVf~?4<!o@PkFRi;|tK^=|99C+KvxXD&MHP~HPJq|X3wals zm{fOfS$ge=aVuv8Ostk#tT?G@nNe^s5B;#MAwK%7>mNV#Q<yDjv|~*z&}5S20zeK` ztTK^LE*h=4lXY*>Fq4GxrgSn_Lc<2SD9k$AwE54_Z+U`iAVBb6;WK{;|2x(+(CjNN zzpZzy`PbpU_kT19TYVY6g3;|rOG7TqWD(#qY`<~*!FKs3UEN|$poOqKxc|M8E7>%5 zl!TMCyozk0{hM_=lPzoHY4xZd*L_?%A+t8P-~zUiwoPy-GtpEEM1u{lp4^@3gR!&% z+&C-UPu36q$yxV1HjwI_1s|J&oVfH<s)l8Kev#o01M9-UOWrx-&OCD3GYNjb@zq!D z#D%>ZfzAH2Wr~y(Vr7^n@z_CdI>PYeWg{5r$1_1|inx7BS;Vw<Ns-B4#n<JZ)WCQD zlNt#7TWTTj-%?*0Df<Hueob0UEoA$H3|Klr)ui--my%nL$MF&42bPA>H-h4PnLMv} zOB^xV1u{%v4)O;3M6F8w@PggD&Hl46itvn33Q~%94D>%5JrkymAS9$nJ=e#nBZnql zcNYdeGhbUd)`oZ~cRZF`fGsdwfte+^LBpR8?$a(o0;!;B0X?}f+;5@j$XWI;*>fML zU{fSklvdbe2=#V=;f{!VcvE2dPq<X-WnE*`%_}meI2`y5i`Q(#1l1vxaQgs1Hv8n| zfVd9~pNskfvxSVgK9z2KqR{|3V-K%+U?S%vvz*fB?RyM@bmxn0&Q*!|sm*tUDI{mi zY_sI!4FA>k^*q7vAVBh84r;Xg0T7748f5kG{Nil-<MT#JcMk9|U25tnIziyANpi7_ zqwyyoa36QfSrj1_eXksLmS54=@RFD9Yn;qDw3;ds9Ru~pKwhD{mrfgF9h{SB7DdNP z44N?T_@}8b{>+Z=U13+w*FtayYvxQhY?m~Tk8B3!0`|Q*0=*I~9|@F&kW-INaQjjf zkt267Oj27LuuD{XT4HXz1+qzE=(H25`qBwJF~|+WAlny0BP%X-Yo0$gWy12_-(o6v zghW0C0D}Kh9sHlcAO9Hq=C|sXmn#3S>ii~{qE%rMu#C7`Vzb?!Xj#&yWndp-j)Hx9 zr0LnOdLvzk<%)8!Vz`T5r`lcXk@qYC>{M9?gB~Gw8La3cNBC!4Rg?Gg2pCq_Ms<PM zZ;nV<0z0=!ALjR^^gNnA9zWiVl^3BE<+Gk8R#4zhjV0;V^_1m@5dBEXK_1tn&{o3F ziXZlOMPOyTzIpz%+VW|&?|^P^%v}8T7vsiuoch>q?zGHm=oYM}_CE4Q=Tdj{mE%$d zRGQ8`g!TCyKfHI@w#Z3Z2|ex1*oI;|b-=rPvA@VZZtFUE7p0HOXmzCI{*(DSPjDRs zDE=#RgO=dmkPFYdZ)P_0p68Cw@YVRNzS?AhGp1_;;GuDRudFcKXyR(~rT;zjz1EWo z0v-v8D#Ev3Yah&oi3>@+dCNs&Q#v;MOVuFx8iy6cJ?KzyAXCA;8eMz>cEdcw-H+(G zQ2rU}UPHW(IFB!d8#0~)s#@<E4T>5a`T{~pO!6Won+#m8&ATzc&%q96HRB?|f%Q^x zpO9G9>Ad}=Mxf`(L+}=?ji1v6eaJ{W!P6K>sGFN}M*%3F0zb>TKNI!i4UIyD!Wm`| z5VTi4OagvMpZuTn5dWlq`Xl}AAH(OV0{$6(lV#8io!PhINrvI`IuE2U9M5nKW6i=6 zBVwn*k6_j>KcRyt0T*EmNk8hbkumWRZyhZc^ottc4N$Dze||uh-_5p2b9|SGOVWyM zcNuVXzFhIyytWx$R5<u<jZapaz0cE60+1lCj*H8+kIF7BUjTJJDH|LKEm0BE0|k8| zBV+x&YtO^bhbo~I!lf=j(5^@A`c?uuNXhLJ?;swYsJa%PPRTnJSM)>zQpU<$5ZU*w zZcb*dkGL3^^A$Qc-MC3I&<TC8Uz}tZmicI&OA$U-K#t0z_@DJyeD}P1fD7HZ?gIQz zd$6)UHNNSW_FeIrVQPi|7>AEUcMLthY%Z8Ny;9ClXHc!>YzMxY_M}vlRC&67<fr)~ zVEDxUN+z?>_WT(XelE-LY2bZdc2!w{lH)2`U>vo&z~C4w!(}Y-PS9zeJO@iS7~AoS z3)#s2rvc5!Xw43P{EG*wH9#ShNo;czzlh*@cDyO?p83n>M%U`Lp83jCuR!#Y28`2S zjyAcX0Ddc`E1d338V<h1R}zHxT>9zUb7|^Z@FZ(pdgN}l_29hz&-B(Dw@f9c#k#Hy zFCH<{CBD`L?zaAHw&YL^$YdE(;Ka~I%C8~Fn!iCP{ttwzf5~6?C;4-JufY{i6aYYX z82Z(}s!w0@)1z_^@uAa<?bN4ykeGM#c)u@cuj`9GOe|Tl%S86&o7gZSh*wMVk(yv4 z#lfNf)ASyE{O0x|cv%`qWeyX{ZnWBT(5D;^qF^MlO4F?-GJU!l6N-eghl~3xFQd`0 z!G9=}UtlA2qCdK5q~E~M;Rw-asFM?}M%1ZqyCf*e<Ks=sX2hheFyu`obz(z;h+-1F z<cUaph-Bx0gJg}yvy)8{LAm8&<-H^|M%>faE%VLwB05{J(GzOrbs2@6gRge5+^5xZ zRdMYP)q@JX&yYd(>+5wzl0i54+e+iOJv*Dngv+bw<Knu}CaK4iVSLr^$txt0@G3Cw zl$9c51Tm}v@MD-ar#S-T=IKZYNb;<Djr8)Ky2@d?@<tu{L+YRGiTf_69RRwbm05^j z@Vvd@se#ENp82v(NR&v(!4hX7=)%ct`74GI`Jth&jr0ZZEN`-6q$`Bt>_lja*meRu z+X^|xre$*>`hp-~3L(^ys~_A3*+%fXsiTyi7%a4RYwUbgJ6cx*{~-(P%o98W0fzp@ zRhJe301o&~YZh3s7{=;Ciy<u>5lVunY$c<W)H(iLg80fbXQEfAW{8NLxWB4!c%rqi zv&35Nw?YgtQA-1^yAV-`ss$@!t+bz{)TB#~6rZjQm|C1jXL6RhJS;u^v&t29HujV< zP^-%BoLqpGwP?H}HJUZ;7BeW^wHDdhA;P^YHM2}C_rQ+XbwP%Sz}>NpbxM}cQ25EE zE5WSbON_yf=O;<_%-m{dik?4x?qOSd#PGc?v3*P26Z0n^V1$TMvDJ^ipi-!LwsM%g zMKswH4;hS8yl=nB#KR=|1#HtlU;+LAlB?}cay9-*E~ft_*Kb_kVGfJ9rVLv;lf@xI zg)u2OTq}g3e+8>FM^i4iXuNDJ)%DgRw#LoZxcV++t1Pj06Yn2XD-l3Tu@S0a=p+pu zt3NzAEZvE_9O}1{Hmgq*P-b;~gZJ<dxe44SwI!S5xp*I1Pb(Wr0{Qiv?1Me(cNHnF zSIey6J>5m^f&;oA_8qpvb>t5U9gbn`9&aUk1}cvH9g<|<g3}g#%Ob&k8s)Bqmi&tz zjz48*>93Blzjge5@hq6RVNUFA{I;Z~f@crXWpnn;hwCj}R&~k`XDjrzxwx}CEW8yu zr>LLI_0fIYhnb{<z)0=aHx)V5YTo{N!iS$csFAL(x;a$pwLO;W5yUd)l$T;;G0h#z zOQbn_XNZfHYuq|-a@Xa(h>Wku=I0*0ik3FtMEmGT@{O;=rKC0k@!p->XGG!Rz|%L& zKTUBP$@i@_OIw>mcEfT(H(H2P!VV!_o{nUy)^v#kK1v4=Idt-2YOd#f)oK|!#b{Ax z%Iqx*jDs4v?{D#j{)q>a{FgQYf6|8Qk9e2Lf6LBq@vu^HMefj+VSv@n;BaH(x!Imt zxg$;5SC%wH?@MIlWkUAPsd(4Ev`mjO3tymu@*GyTi9Aa(B);3KGYP+mkmV3OX+W(~ zHhuXLSC+A;y{IaxOC=gm<`Jp39bS_#Bqk>ELL#|&1hqU|fNGfu`zChmDTOrOR2pE> zn;QNoaqBm<ZvtuM&VjkH`sn|7Sh~>4D?GZm-lCm_)LlVVq%Fx<;->?X&*0s3SI)9) zLQY=GnSU|U&7s%KwRMzzF*Zf5{jiu;Uur*jOGQLPVTQrVaD_c+9_|W+p;D4KLO}=? zM<OxdmR#;?R}e%*(L(2^C#qpcrtL@TpG&pakM4Y`?j36ne%B?+IWZoXgq=Tl^uvq8 z!M}Xm-9@IDYwH2{DKh1)-R}Rx&lL!8_=lg&A<fM{w^M)TK&hw1-P48dUHFD}GJFu# zrI3m^5obd2tFj`XIpf<GDJ&}@>inj`2i-5$dLvfJ_6aPg7Ou}<Eia-zP+EhPMWR7f zY#z<a3^Dg*+nOz`H&F~~j9fySUGm<PveK`r$b~jV45m~+yImz}z|MVUQr$IFJ#XZj z!9IQ?0m|kBs?!RS<Z0fhJRsHP2BN<~xlbKKV4iO%JW~@V;AXaCjJ`N7NxvfQ$B}eQ z8W>P!AIc&LtdBJZX_kv<g`&&ng>_+W81$hxQ58H_7cc}Zz87tyWZ$RhPq_cl-}SqK zE&az7>p!Mw{xJ37H&fS2zwSW%zIOS|lvO!*U+SjbO}}RUjE}F58fQ$hnzYBfi@Km0 z!1d+j3zhMco@J4Pj!$ht3Ln>gz&8GMa#CE6pNc5@qFy;Gtv`^*V0T@%CqqI!U;Z8K z3iKkT5a+X-M9*!uGFvii##HeD&xgBxf~A@-@a6DMV%!;?x813mL||!J<<e35Db}et zN}GXFWH=2*0)`8reEAV^3x#SB<UQ+1kcZIDd_aK~>ztI&)uQF`>N6X0MW5~`m$D7w zW1S=sV!K6jKC~BT1<qJk!WI0y5=lgG9Rffmx5|m0z&B4E^yKewkZ8-h5eJeAZ8(|4 zk)*r%S5#kn$C`4bxx{bc!u5ckEDP1j>)~0D@N`uNJ-2}URGIQz{Z~i8KII7xfB=tw z`APlF&!0Myxo!=}oi!iM&y4y=3I|isK56oSw$bsk5Gs;U-jb=U6+Mrgo4hTyq~lwF zo0WM*o_f*o^42YSo==n&`J5WFiPB?;*lu20tLi@36&PI!;TQPAxR;1yg!gqLc0o5m z>LP;=?;|I|WU-uXJJ%I!Ot#1|qI8QSNV;irw%}LI@Po^?Iwa{XmojsnW5;mXN)@g3 z*x_jO&|B~GlkW?FiOCZ1iL755l&Sq6vDsK?8eVIDF>&}G6IuV5Nc_V@^q-s|)&KzT zoOKo<`iTI@QLKk|YwXMjaOlFTEaohQcM6}}lrv=w;KGd_7dt&%zfTcV3pf?M3-eI^ z`1Ex-<;Ae>&SJ|TZ}_!$ca^|wt!uq)<$^S*TEJKY`+S!hQafV=*CNq#){0hdRe{7d zE7D#^@jEr-wZXes#5B(fn^}sttvqGx%P7=v$RDdX@|_i$p)#Vt+CVrU6M+`)ZkMg? zMSUN8ZzeH^4QnX4JEzc0g+hgoYARJ0ccj(x_nNSPyRmaQl($L7IwupWnGAIV-Z<<o z>T8~pN_jSlG?r0C5->}y-UQt7*r|(p`7RsuW1bsEsnF0^FoGOx<#l9iZKh6!tAab6 zttkEoAUU8riB<U}*E3o~b{RGM_S^K}kxWDrZWNb@Hw=7M0hGE2iGyz*@&}0~LZLi- zC&Q9}tbxxj^q2$gx`>IZ<EgxcJJLvam7AIfRDukW5fI+n6$?ghT+5B#$xZTA1Z|@t zl-)N%mT!qz?#olJ>Xa)G%@;7uq~#<!g8#zHEKl$m1cd(!U!SHw0E%cDO!061Gn+HN zy`UXy0>XW@gqakx64GUbtn>9{4++r=O9gSmXvxKuC{7qc+J^+5Ra3qDknlzo-(~Cz zG*2GFJw!858A`9yQ~PQ=y_7X^r+E(Y=Pzcpq3wD#V3}I3VsK1R#(MwiAA0?c0plBv zjU<CM(bPkAI2_Avb+Ukg+VRH_e2a&fiT9|;>G%G;`QQ$RNqfhEv0shbQ#nIL$Dz@U zPhUnL#S3XHUfDcr?TnS*kVikN??XUjeB~D?xi3sL`8GbW*?mPowZN_w)A?cB$AGsO zG%X47zHJAEH1AoThENlD{5!@T|3g;uAF>L6kd^uqV?aHB0G4Cr$uCp>BKANV4n0EV z6aUmy2HJ)vk96hNJfUP|^?R@wz0rgom{TPi-l^mS_aaO1*ycH^@*q_1h^o+`(@O{6 zVnp_c_yhJ~qX%}ACW{NmcJvU(wSkAs7qteqyc&uYVr)Qd3intq(n()G)v`60Ih^*1 zp%IhRkc|y-_jfvBISYC8Nja+t1r$k6Scu|t#ZtL6_#cm3s2=qxK3JS#^Q*>`17hY^ za9^p1xP2!tFTp6*-;K*l#kCRiQqV;SjL#@%CjO+ws(9w0*_3c#e8`>En!I@Td46;0 z!hI4V>d@B;6kO#qfBWNuz;MlJOIAH!=x8VPj_|sO0sl1qpehgh<-Gvhz7W_X+xKd( zD;+IeesHNa+lTpzw$!o~gRmE&wZ@#JVJ}@~Xo^u-%3{ghY<D_tbZ;%b|7dg16G8(4 zasSemsF@3ZhS|XDTK#oXPYN?Hft%};P01~YYD=?FX?iYz2Y8dIIKn^x)<3$vSWCUT z^eTA@;S))EnWYz0N%`iu`raHLvhF4Y_T1mA4Ptp~WPV4Q-ZPDc;M+HM?7>mUr19P8 z*J`8S>11Qk#byDZvBGwX>7hWm!Ez|Rit_Vo^-^^brKgPOepeyjC5hT#l*d6<8~^)f zGCJ?Z#T{4qJGN62Z(*GZuW$LzeV9tJ>58z9D$Ej!TJ1>IK?XK_Zyl+qPl763M}x@w zqSnXn2^_7yKRb#5R%(9zdJD5SMIwN(iO{m2_%xLU0i>9hws11ov#=YW2c(cA#v1XC zI*Js#CcG~S!U%f`0K)$Vq3S;fW&S`Y_9r)mjQ-ZrUj!bX`UlfL3w<B17!tVhkFTm5 z?kP1$*q0gPLkh;a=o)QcXM~tq*XY;4&Rc+`oTz9ETYPmVRjj#C9B{T5&^7Gdw7e5} zq8*4hv_frl{I<JjVlBwNB^K$|=b^eCh_6<9GZROwE)ifUxLh~;5=!J=ZQkm_!&PQo zlEdX4?Z~2SeH;b7JMeKp7GHD4HkO}s?_iROXdeMB2bZVCS$v`0CpwLMKqY!&*o;g) z*@Jo*M&URN;aH~OyKpEr``xUzK<gSLoUau%f;$<+Vp71zoShX^&l}X)_AfOkKMkFv z4&}~SBF4x#?~7mD?s`N9m)$n4=WvV?wC4wzkqs-Wf2!d&8at=gtP4@M+Q$LFX1gLS z97{uq$F3mA)~ay2&UrG){da2GXe30zDD1v8IFDmE{ENGhJRwOCkoFINc$5F@^?$*a z`^A<_28eTS5j@{$I`!@ler#;wq^1o_SO~841tFS~{U^AECC(sQQcG^Hk^q`L?Zs{$ z;Rr}1NX*4{42Z#1h1O5vbG(w>z?SKeFb+=&XZ7suJ@R_8fw8geYE*RibP6x%QYi}} zVJVN#Lb>clRanE3OlWsgA=lP}XN#G~a{}jPXl?97a{A0Gt)rYmHF;;;hxw)RY4P<d zs^F){jO;zuun!l6Sybkw*Oy_04c}&7n%9G81NDgQF>&uboiETZKpgy|XVNSw>P_^^ zy~2Fak(%~X;+JcwtwAa(%wY@?q(&{6`+(_mx7TmzF&sJZ%TiUTMo9)KfCp~QU>bzC z1<6;s4;j4a&2Qkum3IB=Ic<m4B&8=O+#v@`F?(OD6;+IE-P4}ex%K34CIf1JMJEvV zKWd%+QTy=^wI;u*byPC-|I-2fqV|MfUSH4>N?rIu-Xtfe?8HtbbIG-TIvrht^62v} zvag+-^$b%z1zAvT9}TE(+}#H3h}ot7%xyhb0xzgcg;Od;Y{VK6-!oibH)7~$vl`A6 zzD|XuqA<v?+&xDxk)Tq!eRAn9kh@UqT!7e4t1bnev!uL1mrzg{^wX3$hnSv_n*rZX zii$A+-O=F3@{-hCtq`+1K%hV>xX-YvhcvqI8=bvleTM_3WUv>Tn;k3yAY<fMozG48 zeDg>&2(L*vCkitK9GlL5B|iaK_siC|u7ps-AG3k3(~y1&$pfpIq?5Ql@I`a-RyX=y zahbS$_o9_#M~9OYbFv&#akcmH5Zvr-x6Hz5ZY1Pe?+m6Au`QN1FVbjCZ3bX+>tYDw zB&{j@EXy<Pr(5YApC;|`y@>!WgggpZ50A$HENYuW4kvM*W-CKyFlk(bn*6x-f1wIa zn<pd;0`mQ3I#X-&*OPBV$S(gsnHrm>9C1T4BKC#46^nTJZ3u7x*`&QdJQjs=)le;0 z&NKxvLr%be7_<Tm#h1eK6_pY57bcanciHerXoFt$Do2FrvABvJt1L+sEo=kVjH@d_ zj;LJT>w$8Ez)qxk6Q-PZW=ZHqcq+p-F}Q5{zBajZOZ}ba?Id59ED4?su3)Vg%XQ=E zJDE<*8MQD{tGK^Q?2<~S^{Hzv#^sN9kkB(`r_n%l=@;>O_wNg-a+XV>KJ;g`26|Jp zMUpNqFt+v?dNkjva|w!7z&6r2U$Y_kJLDyVKR8*qnujC4n|Pf=6G$Vj>1toq_BHAz zRa}yyQ_WRNz{;t$!g9TNuAiAoW}k|{`l>?n0(%`gmC=b@v%WV)jvUV0jqCr3!X$AH zea^(lD|Gnxtyv)Le>5-sqj~ZV&EJ31>;(J>0AM-vvHa?ekfTJbcgP2GQt6+e#wj}v z$=@2#9^9jgkek@nw3Et+^+f{xmkVmi?gZ;R+h)nT_#DW{MosN49-sy}2*I4{7ceep z_!8S)Wt##CZi^PArz$w2M7c{QkJziY)tI&{O}IYm>z2RRr0{|fd>3}Cw9C68v_h|V z*wQVi*x4c;ggP<$VxRJXDsh6WrF2Py<Xs<=H+drar^+^5)QQAFicyAO1vpt!8TZ(0 zlT~q8f1YW2HPSq=!!#sDCVOga7brp}W$8$MwAW-SVa$q+wrbJhuU?D<UrTvs_KS74 zLV{?MDEAZ>?sA6p>pLEw^KMa5E*P{Pax29rvIrLf-*<k7Qr=X4Va>B>sB!93VxfAw zeHz@!TslU&;0Due+_zHkmuZtEm4zz2t}>!J)>#w{TUDjCX$tZD@%&00mP1lzG<`-O z2s2^RBkIVkO0wKP$w+Di)?I|G3B`XH*l%xHzeKqjrmLn`tOLc5-99yvFxgRr6%WJc zr;hqimIZd#^GWl_T&TcX>mD1^0J+=5I$IYsGb?(?d75^$q{Y2;tTX;hmRB&v9b-`H z{8@&B5S5%H#bM~*MHjeIo=_MFDEHSiv)Z`;1UI)_fZ4+r<SySo?MVI_fd>YSh>Zv0 zZnyr7udW9mkwMn>{C1<)NPNMK+2;oGM~u??iq&mYaC1$2{sCpX#7({s6y?);nx1uj z<L0w{X{EWCLM6%4!g)t{{aE{n$IAz*+$MzF)heTn0|XPLigP-Rn>|Va)l%4r*odlk zdv)hy;8#%Jth6y{HV8<_Stt?!lh!eo-URxAkaujZSgwhT2G+d{umt{W>TL38p>=$r z%_2K(*k!f$k=p$2UV;WfD0JJ_g)6744vEnrd9nlf7Vi(1O|Se})6V*cFE2P&WYbyS zXl)L|<Vnz$F;3*wff8OGs<PU~tI+)&Mm1kaRdE}Zo9Qt=K54DCA1I>Usgo0Mrc`*` z_kEsSqM_1gxOlOCBKhvp3%$94d@tWV(RlS)yGjWgONpeCUWIw~v~I3I*eu2`G!e_W z=&eh9wkaYdT!r1GBeeLFudphMZSngUhEZr3!xe)e=(e*qXr*-{BmZC4<NMEg&Ht=d z{l|Kxf2`N-^soI9v2DIu*#Y9(r{Y_$wcrM!o+z!HIJVR?3_J0CHwCx$wju~N5MuK4 zlDgPIuVgHSHgUq5-WEe!KtV?7TD~Py4C=|M%=6us-eOk=gVB3|pzB@}H;e{%*-v;; ztU4s)7)Mf@r3|qw=%Gvs>O-8o(=gZ>m9exj)=tB}O%f?tJ^sK|`t}n=UPzE{r08qh zeiQ@8K22b+s_o;1nA~?_+Tx6|a-k)i(#F!W-9C?E20R6t41x7|>iMg}aT2TY+?c^A z#HQdokRA|ZNzJ3buRwlqJU<DxgL2Lkp`UN|SSCor(}E$1JO?+bsZe>oX`Z>+ym2Dr z6wDqYXwv93X7v!dwSER0!jEK+2uzCX$4tZjI8Tr)bE;vuSI8p{79F)`-2L<|N)glB zfe1;6$aJ8`THqLRT^~XM(e$Vzin~e19;p|sY7KW#{^Dpept6yzz&`{fC4V?~PEDT_ z97*?avR_DOKu}!dGMIek(|Nc<A8Wf!u>#}jHyA<$QA9U^fyH{gZy<>20)gW!Bbjd{ zkDTB2dWrtmVu8!#2{nL#`hT63t4jocc3_}6D_Q(ikMPr|F^UU}*`a&FUGMg<%ff=; zAVLQUX?2VoBMx1Ysnhe@5LSe6`Y7dFw9TxFXKWks9)WOgXJG<b9@Q+>6J%lDK1B8n z0@0|@$s0>%)vamjMxl{-TWRq63tfHiHaFk7?9pupi7XK_Lipg~Lmb3P)O;oh>uVk^ z3?7QKN;}r(vIXS%Quqy*+09L1Uuj7a-dFarSNi%yz~dmWrxaZ0_O>DyAp?tP%4dUX zeRxon*mIFV7SXP%XsxJ>gbSF1La;){4++)c2rM+=jb==jx{GFF&YDu|jIe{Ls`<d; zbuR>`v<7?`Ypd|w@dFwWEpA?XO#j9?-C6O)rk@e7i1W%8{qw7MR-djMT^sucm9}LB zlRdqkOP=$q@|Ji<$AEt2bOU?SK#F&+P$L6*B@{^Q6W=2T)J-ZGX5g&V@P(WVv{gJG zy2p56SwKHT?-3+oLeh~0qlRO}*t*kWQTU$Po*IsDvwkjjw@*hW&4=}O+`*$$Dv!R~ z4cLzVME+>-W_U{O<>zgOgk~5f&NhJI8Hd#Ni1gcqa{sw7<ev+D{<zTXw+o$#JplkB z2h{$b>p;QZB{1XirSvKR_(>q!N2uA`2j40wDYqfv76LjF#t}Wv+|4!0ifG?&7emLw zBjyJ!;~~JHych}E9XHvBGdQh5qQ`#qE*L+Bw>|#B$ro1#`EVf5c^)N8-d7(!-dP_y z&_p;JmJ0*jKRl0G+4@<l_YQquoUTSX>`0LUk!&0)>KweRgq++pNxL3ezU#hdCv%g5 zXI7<#Xw%VhjV-W`*kTI9a7`Me>RAL>RA;~6fA#hxTGlGnj`YmLrKdOqcKK<)n(L*V zw->iVOD`m+ZDz_hO8e<&R>(Sf)#+%l?7hh`GBE?rN0&)A0`D3nl@Ylh!Zb-i#z-v) zgY!to3NafF`M7TztDc&CRJ;^>I^p^Q0`H7Gp2wj$(KVQs@dxaHz}ygdycj$V(+eT# z2&b>O^HHoHCl-Vgs;D9gp>CJM7ok;sgSTt@3dfvJ-BDGS@|3+X8N#o`XhkHI$XhNL z|K}-qK%R&l2x$MyQ@@^$y36MRh~3->zJBo&)#~yR==GZa^yM13<2T}+a_!2s4ZbPx z>kgu3xKv`i3o=qgN0rpKkEWwPDm)?Nvv9%i{jcR?i!b<tDx`w=Hm9ymux&m{FT8F@ z&@-(2ECnoXl(bS@s2+*9G!Q1xO_!UfwsSc~M|X94uvRX)<>OoOIgmEKap%nd*`X_G z(ZsJ7IXu5x9Rv`GiNw12Elzw-NAJuaJ(+;ws@E#EW=~Vof=pbfua!Pl6q8J8u%q@} z(WqQd0iiIJy~9MQX_U9VPJ+5;rxNkyT9W;O7F_H-V3M>~F8>XPvJP>&>tOB+@9Cg} zyxJHzx>^2XPC#rumO>V~nP1a@?;b7ubImtn)Cs{FG0~VP_>%7f>pvnRc4c002KgTg zVKI6W1zuaa6L_h#c&VIf!W>ZxS~G%t@xelLI+dS(%*En%BcxF8I@t_gxzRD%Nz!1u zrU9xuTi-vpdV{t;ayC~cRxuvGU<{DwAr*xpE~2}=WI6J1W=lM8GJshJ=S~syc~Wjh zKU<*mEE8Y=i$6Th&`eLKS+?LTUej*d85UvtlucEkzzvV-`Gd*m<z{p@^tjSyN5rqd z6<)+3(9FyQMJVe$b5@kcjqzUo7!$%sq-$^7E2V!Os3mMlTkV((5NIIOILtGzX2PnA z_ek&4Cm5F;I_Q<`tV?M?xXM=IR6HR`9Q$b#(DlUYV!enchH3z&@w}e<6!?y;YpDm5 z0ah_pLlYd|>#iAJUn%|R#<$Ma%q94`WHpsAcho@}l1^}KEhOgk+W@V64kJ=nawZ@7 z+O*n!TS7%vn>~%Skw+`xAW`>NGG`f>P_dZ`m-@0VNuol;E+U%=yn4k&c4ycG`yrY5 zgu_PAr1fF#>C2qsyyZ=Sbi%O#?#{8tdbW^?go=Y^=i>hTAeF}iu1+L}ZbF!MsL-W0 zV}1??*eE&XDlvJ5y!oYpu|*?^%tiqZmph*x;A&~C!!W=|RSE0Z$x9(2vjO0Tf-&qI zbqy7QyN9v~au%<iS1R&Z!T=?73ZoJ(xX|{TyB!1Azld8n+cM~R<X=A+6YiMrDOhuc zrKxY2MaO=ks;F<IMpvc9M619G42rz_83<RGC_r{b4Q>X5#tF_|IlpYGHJ<4tOn^@! zzXJRFazOuI8bX8qmxj>pztd2{>CXdtBW`~{qTj+3!K!y?BeEt*z)JYrCM@vjmOIt6 z{Iiq59>%)f?om^fAV8XlP?A?+aL3Q&M>XY-!>yM!*aXG(_)!np=xKb`Sqo^_Fo<v% z`^PVwOVoiJmLCh_E=a@)a8WCuzM71!Y&(+f&VQw>q8kQ^Y=`4=T2yAV_&PmvVkjS3 z^`7siAPV(Hu64OR&S5qU3J3G{!51W->1kyXzMhHHcUlmDl?T`ubudQnJZ)O8q5CRr zmx{QVPNu2iM>hZTFwc_H<ujYXTgxinM~t~|UrDSE+~G^pPZ$FtE%iHHu<DqAes1l5 zinz5V!o<rp*uoJo>4@{<jNN90|FY2*M%s0tNa_5sP5A}o?Ors%)-uOE4Lq)r<P^Z_ zEJ>HmiX4f&tlQ)_+>#!*1e&0Zuv$hN`s~<B7x&@3sZ0n_-LVzHi$8`P-AQc-A+n02 zkNmWeJP<GC5H_s&(%)JnUt>*G`JmP_OMmvzv5eUhl9_gDEZ(u2(0R%U)(J^$byGjG z>7&+{nE^i(^zS7IkW?WF?@q-!FDYYWE<&t39}loSGwktMWu$(*v2pQ(B5O=M2gIlb z<$D$!n_s@rD-|bs>q(8n6;B$%S7zSR+#a>Hj0r#!ub*YUtnqu=v_W71hpEp#Wmw7i zSu^d2LRzdFynOnYbuoMuDZMg8abo0%^|7y=`QG5C>Hv>I5)9!$yM@<Wfmy9sl=<a% z+YGKSH2G6=8TpS#sm}5!c8PG7Kb$SNVx!)SmC{}g*-crt<5r4q0IyPF?DM<+&<ZzO zHE_utmxzUqiMlJV17Z=&6mlt?F^}gtrY5HQt_f$bSj!`XNc<YhLO)&*ycsMzYhapi z$~<MvD`9k3$CT(keN0ZXV>cWPnJI)HMe6p_qb7%OaXdZB5Pmn;FZ>Rs{5AMA)IRI8 z#td6_iNiK~H85M$q702uPeb4`f#B&K@~ofpGo;7yZYCf^9<9garn6-kqEd$+wIE=0 zu3&AM?wiOKeai(+)p;6TTn&FT%LP(;0r*{0AR*Y4);lN}atA~`yw2%H>Bx^LD7xj$ zJ8hVF4Q%161Mka|YD!$6gBZ1NGtRb>=BZG*c4Al!UVglw*>+46VTm+)#GliUJ#>ae zYsx3e>@DS87&O>1-tVNnGsw7%C)+JeqCi!6(@B_L>p-H88{a#dt++;+Av5{erpbP@ zb~=@(LO~Xp9qc|fYBU*O`ix~@54xg?)W5}fbF}eNX0b=fKWRd~vzoUnB)!XGhkN=C z$soC-Z;j1%m2ZEiNVFpgPtOho4k-u@VCz!u_Z}Q-YZ*aw5$kcG;DTo}WHK5b)QmwW zI*}^v2+xKH$Bcq}RH)sdB_RZPa>JpvF1&*lE2N3^5oRodd2C-SE;PnXWx=-wn9dy0 zyl2J!G!-fBz*XqVMyR|9mha6!u)6`uLs8P%jD==;gPb1q);i#Wc`IN|GTLg6L=50F zv;awE=Hh4!9o^Y`!;7iPNkqjqe=#`hkmf*}c`-~pJa*ZSjBs*$hCzQmc{*57E*o46 zZLm%u;jZsul_VA~AAp5h&`Pk&UwIHRTkC)S*x79?m{>Z(2v_}sxK!5{D<?zV&HFsv zs$)Wa&ywlYDBr2t<3pcp1dVxN&H9h&9T24%qrU;JsFTspCbs6{lcmQedo!raG)_nZ z6JJ4vrU&kil3%qB6<LnPU~6GgDMi%LUV4~@azw~s0<++ckX#)mASVl*q(U^R+gZbf z5<xv5j5=ZsaGRD0HYd$q$dEovTJ>_9^rBFH=H_P^JNH<a_88GsfhxcmxQJn<J|Yy` zfymM9I;^gE?^yhqW*zbY@mr)W2@Jw6-tILzitlkeyW0`jntF-<KIx%+D$7sV;WFdX z+$6=HN<kk=k>?b5Gvk`2;2>+%BFk67;%`khv@D~gGOooDLTMeM`gkdT9&&_+F86I! z*kne2Bl)fIQNdjw!l}2==1-i#cM0*r`tN=0%0{j83c;B%AmpJJf{kO|%BPSctWgDu zkUoGZL+L6KoQP&sL_sO&^ijuV7U(F)2QCIQYop3OvJ5ztdu^4NGO|g_YiE^zMb$p~ z{Mq>{^oVZf4>)Z>R(*qHoW5+*x+@<^ds6mxMzB@62*!7QE!_I+_owYHXZoIm181+v zqNq1L!d3;YtP&qWvW`VaDde|XZB7Nmb$}iL^PLUfO=9=0<1D#9y6o0lcrDMS8Q3L7 z1up+`AWMwY3p6+y)lV(o_Ux}GdpTwnx+e9VHm!sC%yOA~T9UmE_<7I?@&3)1jgZU| zw#DjKUv;5PPDL>pJcs0(!!@Yy&gNf=Jn9ITBf}(+PxMZmWEI`6VWh=iRLNp;+{M~Y z1M9OavK&80-ynHehIYMo<Mv5kLN)__boLXXG}w-eGV!(vU;%@!Vcv4Z!gU!}m~?2D zW$riQo)Yf7V5Y$V^>|jC7}wrpPFa!2RGhj6H#^fkh;t&+(i%bcgBW(cPwt^OhzPIl z7dOSx8!Q_BuMvh&$P?ZM0sa17T!!iYdWh`iwUKk@kE$libo#ae0ALnvx?>^t7)dM& zlI*8HvAKE~2a%t~6RJhcO}m$o)ofvMPmThdI8+`$>SW@6<)6?_^FOv(>vKmEhSWph z^ecK_@{j*NMBM{po=vj=;MjI!TaBH@wr#VqZQEvJHMZ?Ewr%sIeNX%Sggp0LGrP01 z8wHwqgHBL!%iSJ|4K-#3z!)_t6&vZ?8O^3FJiW0rL-&F%QOc50O;`$yS2sWtu+2D< zQx%V#&tskk#iUJJ3PvcYGK<z}uFwo<(w;E~6%?*;0`BMW<V5@8{S!R{dbY-m^l{-V zgCTZiFQ%~-UP!ibv+tQ+%__OoPm_&H`c(c!9~v=z+COR=dZ2@JGh}(*j`{W<={u0) zDYtOXO9`KdU6<f)OvVC)xQRm3l0szTox>#!54C1JlW$H>0l97Io?Mi4yN_#hMJGvu zj$71OG*5Z`dB!HbM_pt`3G||7iM10vbSZL=&{zifcmm{WPlH&>43Dh3OUvWveqURP zq-KiPWjieR#^sv6jtbb3uF;UWTjto@Huvs}=@~(~j74^)VJ?XFT@G4Z0>8?7&POD! zneBao+->xhYtG=;8VV(DzdeUYKFNo7Eb(S#hd&eW#$HbaBfrzJO=(nx11_XFF41rz zE-+}Njtk&VE8A(r)V75DxBj!d1$R2M(G3#KR2TuKVDvIGp;5zifJ>)bfnIz0eVxPJ zgSOqiWK-!5+$wIT#r@8QH6|4yu6yhy805TfG`&#j(=J>V4c!RSPXW!kK`RF1DEr!@ z!4y`>KN|+E#SMzUQsiuXi1}6;G3M(L^heDs05ie`V{;$L#F!L>6`bq_LaZqYko#tr z>O+t&Td-q;a7{(arDCWkBgP_2#L{n%ZX3NS7jw%;)zwu{yk33=xY*CmmP^AX{q#)o zl`y3nk?KZ?K3MSa^5cbK(<n<sU!8qZ*#;pl6|UN%+a_J;b&~W>;gJSe|CnvE&NH+c zx(3t0(CP)E0*o_3{1te4gmLkE^=b2W^$Do)cP}pgXD=@KXD`m@{dp>FJDgXW10doU zMbq1;f{+ulnectf{JW085JgY0Wza6ek`Yp(+Kst?HV@4@D_YcLakY%i#WNszB9gJk z#7A=ZJClp@1VoUlosSJmw7-m_{~!&vOob25K>>yUet$K`C^R+`>gJ<+fV5epPPl9c zWFKjwM-*2j&KW=h)KD#G#pjhT)Ix{5_oeD886vhz9!><mTiVM?X#$T)Mon7Bop}-i zl@ba1^r$WCvGUL6*cxb3YJ0qrYuO{*fLU1&;usBqx=2JcjNb$zRR>Q_-nRZwb&-gO z{;N1cdzC{qY=6(k8K?i%0CLH~ll@iE6zETe?p*f8<i51-Eoo#`$6qj&ZL?l_F-1n_ zqc}`t7sh5S*F<Y4v>u#u2~s9au6ymPNliZ@SCMmIsh7J$bVPAG-KF{B&ZF_l{V9OS zfdA$d;GkT7Fkir!|MH5c&gSRUF=gF9*~EDt_!_4cTn~f9`f;p;GgnVHdu)%QBVZwR zz%XKM`e0~yHyFv~cw!S&=ZT#uPKIOvhDevBM}iPTXg`buBhmE*zWDJOR7}{r8cT)l zZqz5oMsjS{q3%)9fNRO&rlttO-6Dek--Q8|*-WQ`b^++SP4_9k;kn$9_b^=>YFE19 zi8w(4{B{-Ki8||w6JQ_vqM3p#*HVaq&~$w=ByNa3_TqTA%2F2!F)dWkoz@%k4PTmg zj!Tm6euXHY)yCb4WH$v3Ff@(&_o#jUUV<|8YDe;MP=7>EiKkbi1H}`JqyjXgV-EIs z28|xg<Qn5mMqZL=vko9(8xB$?7(^4VG-Bg6hP8+lN0IRaUYMMVE<f|z4<~EAyW5^X zGvhk%G6h#C&&gY>MGumEheT~|C%bCZt;o4#17>^WI~<SIJXOaO#KT-F&#RbVdwE*? zC&YmQz+8HQk^L8O)*ZKU=B{zLaD~DjWUC#OceeTF_Zc*hPXfvH2E2*lzf@~<uBJxz z)hU>5yMlU;2)b0<eWqaU$h^|!Tj~Xs&F8rAlUl00{nhQ?^B+?{A&i;iH`5t|snJFE zU=+3&D;<<q-Vq4w*a(#BQX{=*RP5RV_}df?`%*rBA{j6%@EY1C*4R-=y&dweLpK!A zbIX3x^ZrNA<}W?tKlF6}G^4+N()&HvCgNCfUoBeID-Uzr_m%o>#as;t=?$^I6$*NW z(E18DdTY=r5`OK6^rZ|~NVHUY>Jk8*w+%O&aLr{cI+YszbcD?9`bklY78$qHy248& znqE;G9thhCntP5rh@xl?**O<J5~v8SkZ(C9AT*0=u@I!B6aDV;w;+6_W(uU9N)6F{ z3KeImgyD=by8B=m{wI-h!H7_)Tb!ok+GCt<|G=bC{q`-*hISr*q)hCU({x589a73% zCTCc4)I`QAr*6Pf&;VHMZqL`&Q<6atOr6Ypb}^*a#z|bxq)gJTT~s)z8d0Cs42T-0 zf_Dv!j)deY|KzepiY?h(RbM;J0x;&y4&>nR+o(c&FYrAN`0q@5bcEuT-^Njmlc8?+ zW{`FoBtpA76gD4sc24IuTEx!^9aJ;(R$7$Hmr7=f^Wb>Ih%r#=iUrp1^&VwpQn_pX zoz5iX^1b;2=KjZ#?UN(8ZR#N%x6kkL?*8*#cV-IU_OLOs!%=I4vU8_l=vEY3;^!uV z78ACP6`omjE%?;ZyNL)+9Wvr6nCLs^a$I9{-~hfA`6|DGky3U9OY2$}yN!RgO<0E* zuI3XC+QOSx@)|*+J1$OEtpwl1?I}IxHKg3WF$&LF@mbnp=eE<TxakYC4LLaYII~{H z4d8j=z;<*47#cA_z!Fd`sk5u#a;>*#GW~b2uf0RilAYlu4(A@;uJ1+eY&qMrAiC2` zig3sJX=iFb?He#|<dlO|LoHWgByeDb=5`Vkg-)AEw8_=3LV~{e21$d4Q1FSeAspYA zA{FWou-+Gr(w}Xp#Yg(#*HK;-H^9I3T<Qx3i-tN$$0PFb)kx~r?4q3lu8-$M>$jo; zZef?m5~XUP7RWeq=~^@JtGCBkjQ*?wvjTOoO`ALv&2)P|Kmn06K8{Ez2^(d>06U;5 z1h>F|v>W?C5r&c{?aNJf`abSBaI_c9)R!X0F)hhF{L|?DN~Naz%T(E=5vOJty;hqT zY<OwK3y)`f<HZGCN?`{X&kP`AQ^4)#kb743oL`Vz_m=y{;hu|W{JEq6GG+wFbGhOb z6wZ+qxW@+dkFsueQ}ajOLx8g(|F?w-Cy#~n^N4z*QpCm6SS1cIgrdVwg)#pWhWu6N z{YRneZ-p?`pHcC9P+OeaiBhaWf-Zg_{eVg@?dg^b)hm_9*$VPRHQPj^dm8y_^>I(j z6mHZf`da{zg`huU32}l`yD&NTw*&QO3Qi`G*U2r1pd+IaB(N?6s%rY4Kur4dlTH@l zTu{}H6GKJKrapYSlc*oA?u9fVSld0>9VROw66~;EU!OTS0FaOXismH+IF1Hfl~st$ z9_gHYfKszfi4ioeI1s}%WZ>eaz7$X_$2d21_Np3&y@*T*{ea9|?QaCteSjV%g40}P z$sW}HP(Nc~gipa_FhhLtGu<nE8!;3>*XbuaL@Pe3cEJYL&+#+UtO&E6O;7z!<VITB zmJEK)ICo5?gQ}$N>cU!m2$i>rTH12gjXH~J;cW+1`Alwo|E_Z)eXbg?a|8>Y;$fM7 z3C5BtwsAG*yFA-DZsFc%wt3#ZAIlblMje!GFL6$7)fJh8jh;Q_+M#?-#x~O|CRx?A z>#9FRQx3<RG3*3y@$(<g`dofOU%;CGcyfJy2uRyOex_;i!QU0LbDt4gJ>h4WR>)Sj zYKa>9b=g^2M|X61242f-5;2<tneSzY=aTlEK$mxrC~1H2`bhAre28nM=NCfcUYUtH z+o3tlqM5g8uXs#Q2wdYwTz8k1E)O?MPt|fL0z}Pj_dsQ^C`lyoCw7g^;$PF)HPla3 zL64r;I2I0_SZ-^Fpekj{y2;m;vmI%^WM?{(H}<doT5hntlXi+J=n>qvK8KMA!tEtR z7)lOI!<mXz{#o4!nHq)?)G-ZJW)TCJ2;&+0Houz0tSNz)dm6NE-)WppNXrIc8C96u z%m}b}R^5$TE+RB=nxwj6<xR=l`SzF?k_U)A&@=1Ym*Pu^4<yhqX&(}lT5tm2T(!t; zY=d<eN{eJikGMTm9F#<0d#bXQOx~b*2N(1C1a>zTNZg*IxThJ*VfSr#Wl=VD^J8|Z z-X=)3Z~?tWT*vEPi1v&|3s8|!G=|>l{Low?r*kIdyv(MI#$OEJ+g&6|QfW!mi#<<q zVAsSz5MH~IVECaUf*uSEedhu8Yp$Wp8KB|Sl6)!`{rOhUOhz#G0kp&6EXcV<KyrvF zZ}%$VX{a#gTj(32eL8+62nh*BsKfv|TDHBvP%JEY3BR5rW?WNUuHkB4cfhp8Bj=~e z3=<NmA{tIoxLj*|togdLcQLpH)9dY%WgZ@szK+!QkrARO#}tP&<$M~>{b$(kuVL3e zhVB0t9{Oik7CnTlq$5AK#L`)Ee*lxGR16=&g?5zjD-K55K90|0KB1MapFMzfdka-B zFDY=-7`HdZ0Fp+_Td-uO2bd8=D%K*$i@r~B>VW__G{}1?Dtpk(riZ3?8>L6Jg%Yf= zp+S`L3DnYp%%WlY7%fzyOj5t{D+L26pz%P?I^26%))e7$jzxhu(2y&;9_T$k)at}L z{!{FXjIvWif=sR_I?|fk3~@ghqk^)Fc5anz-Bgf<gf;bW>l;g;?mqmMu!O-6?~kRm zpRVNwq$z-sKi5D=M+R6t9G@g>IuJpAf!^0~-ue0`eSKCO04OQcAu6DY#(J4<*z41w z`j|R_qre^yH<vGWI3nIzMc5fbS!4u`${s`ADxezzv3R57-*FFm#=qU^#>lI3a~uAO z9W$3Pfw<l&)Fgdlan<b<D0#!h3e?n@oyz7sff9j?@e579<!+IXUgq>Ww)eIsL)aPc zKfTSl{5ZaVJ^$%d{jFDb$UEj@X6m!N7ISbU94je2F-Sl*3ci77=Uc<40a*Mf$`>@# zsLog=t{Hfz_kF0N3C*w&X5NwSvOYp10<{+59&LL^u0Y$cJ_?xOlSQwsEZPZM{Dy7E ztyN{}LL7TPd{~13N35Hh#uMWayMx)kpWl3f)~nDlo^n4HSc=0d_vl_2Hrq;cUc4US zi{iYBbB9zY_p8=fC4#Z_;59WP%<W<yS6%k|MsE7b(Y^h9TMZDohi`)0ns6*-izvv3 z+F2@rLn^k(O~IJuyLJ<DV`^s;C*O_xWYx{BAXK*&6|x`BvhZElxAs>AmW`-2{Ct6V z@=7U(o5QV573Dtcub1-0(mvf~KhI%hF>53Y2e4988x>sXzvXZTK~;o_Kd7BB>G<0= zI?wLS`QTGSVR7LWVPxdeX8PRYLeO$WO#y8M0anh5dUH6%3|nf6Pj?zcu_&!+US&~J zs}*rDnk8DZfKj0rWST5KT($rrwc_>ZPhDlOt!GjJ{{WNu`4X`2MJ0}!4WWJT?n7}r zc7i$I`y~+im%T4aoa%jwP1e+ISkJii`~8(?c8h}^WH3hPQ1&|lX&_LLt95V~_WKoH z)UP|c7i2q5AXiB!JdyfWoh9m0eUcBXxKx&t=VlWD$$?!oga;N5=6keU_DDcKd;;;W z{LR|fo`r7`AY-UFPcOBiASg5gdz6=-aBKd-4gU+*?+;v$KX6k%qXx`77vOUuN}Su- zja;#ILl@{!q{-@~u`Z*wVH8_^=gXKtYz`iuH(P>b5l|B8mSYNO$&}7x_*iQdzZuSL z9{Ni$@c6tWo5vN3>agVnRpHW6M^CbP=bI>r%wt64yg0^U?7-x)p(!{U*@*^MNhdmT zIJ+)?rL%+cB5YuzzVv;ydiF*#AWbT|fVtzYOcqz9gAx%iG8Vh9UbV>(LD-mU$p_ad zX!scx{~R<fbImvJ;Mh@C3SC%t3-y>xCdaw4>>>jTkhT`$GPSR~j-tSMOw++bdPB{( zuay`E$^%;8Ia7n%vfe{4#B@#qc0lleK!rUZDJxvB+sJ-yPWCR|5|ZLo#3Ot@ay6tv z!Y5*NE0dZqZ6>K8lYVL%5ZCP=*%x!snzccE?-+h}aPR-2Vav;OT)EJXc-@)<f8*Y) z@}8bu0Tt;6%8%d?=Bmgz2zaMnPp&dJ5x9ue3I<VgS7%?MV13tQHPXqv;-8t0fd6;I zA~%;G))#R0KfwW?-vZp$dpw5xv-<uJMKcC-guU3AJk~}?hubSCcRF1ATmsqjn&m=k zq66D%6?9d|RK^AwM-+AO)@WuHc@s=HYe6Cds%&@58{CvB)@P<2<rR2jV(MMVZ(h$Z znt=N(MoXL|Q15{*JvWcOL2ws97AD3#eAXMQQxUC-(6q(a1UhLAM95ayO%fj$)&y7| zD(12?I!6fYKBTyJ>ER~>V)|}EqSM1F;YWR}<~A38|DFs$t3uR%W*P#N{Wo|QeotvV zOD=KH4MS3UNC5~t@-=G)RJFQ6l3u#;R6vP$t2$Y=G@wA@(_euxqDLz3(P{T<00-AT zD^OU^1ZemWBB|2n%LSL{l@6QC5J4O~SWzNo*|@L(j<d;ED6ZRC)Y6k=%fh>mfxw0q z-;8Ez!#>>DFC>p_i1zKx@@cjj(fi=;@@trH^)JC=hW3a7n%b4z%-s%Qf%;KPDT+tD zZ(yldZs7&+PHn<irzq#<s8uoPBxg8E12UllrkqphbgMhd?Y$SW55pvuy8Vz5E67MC zfTcmoL(OZrj(rgAlYipRYao)RsvNB6OSC!{bIA}H$>mGFCTPT9ZajoHw?{dfSZxkk zamYxNmxvlb<eWYQ9h}5HnQfnaY)+zd>DWUYuRrj+Da(4X2080jAs%-C+e)hXCpDll zW<YI(|DN6G`6t%@uUNM~Vjcd7o%&a5ox{2nWUpGx(dTpK9SoO)0va#PHgB@kCz80w zYGbITh8*Xq!#lE6PvoPJZb08tmrU@UgPvTVAaPx>UP4)PdQh~pJIv3>l+NX$$Vylh zsCVdIax#DBf_yi!;5`p5x>LEQ&0?Y?5?17Nz*P966D&wQ8$<o;b>Ll+ydW{uP?#pH z^V(3vOdk3D99a!ln9I8qA;6)U{v<mse`SD%MD2AZfz5n*!7V}MnjTH`=$2>)Wiq?w z1K}|O78#HX4Qi7<Rw*SCw0?5%B;WSg$JpNP^&KTRC%$a!E;<O29;V~Ci4+gtEzz_v zaV;_b5h5czM?cMZvuYTm#ZkLXF)hs2(%}+5MjaLRbfR=fd~^~=`wIqa;$%Oa&zs1i z@5g#ywNHK1Dj}-qltz@^OS8=Mj7oEcFM(fNHb`tBT=*5J&ImbjB-)Q|cI?W9#)9fx z8k$%kP{d=Z@4*vCPcu13+W%^8VJ<(4FW}C9QU(A28=w_UlWreA8_3Z}hqD5I&AX!g z2wgd^!kyEHPwNujmVaT4V_o1_ZHJ+!Dq<8cFGyEMEe|OP+J-`PEGMwSW=~Zf9^KU6 zn%;(!MGWFYDw1n}pcT87IMMMiRFO&zh#;EP?Ht>g0^YOnGik2LZgne%7$G^FZTw;8 zlBh__>^eiD1&~bkAPesA#>?ff$TxG9T-d1Sf88k3htO2AUAz`Wvm9cVWC0<u?>FpH z(K3uE)w$93&8f6F7uy@QE=l4^R7<NVnPrPBnRCoRCZ68^!%d+{LDhnw9+X7y;~6xp z+46a#UP3~#Dzei$<EB~7!hOEI0%2{FWS9nE=;<Nh1VSl+YRZhK5@V@4)43c?(oRQt zSp`6nul*^^0W3nl6p?ssY1wZEk;c<hly*{<>>do+1ekDnZV$j*m-!~SB>t`sIiy9A zCj2}gK9j(MpF}{3&l)`S>7!yU)jO}^4%+EeT9gX6g~(j=A?vP*^s1n@d%02dYMJs? zO$UX}QqGOHo3lk(<03O1zDXJW%v9EewO1aT(n_oY-9ktHCtH>9ZlDy~8VocvQ^K2$ zzt}lw)TM0Pg%U_o$NP80unFUk%kOyykgjNAC#LMJvcsGG_{Zn1PqtSzAq0?n?BgNP zwptAHUxGA5Vb*k(@)Evg%->?O)TQ@<N_r74>3)Kp{Rh_PFIeY4V88zXyZb+|e)yhB zazT)16oz`8`qv?@7#!WJvNf16Y=ncHU;W~3`JjW4e670s?JpK7M^|PZ=pusFEo-4o zR*wZs0^0Bsm=8<GOK*N`z1{FExA8|PzE5Ql;h*4mGc!<!s%-@+d0@t;DYPIeWI0C^ zNfkB7%80*>9}T=p{ZgtEp`5AUH`pk{#nkZ45z{$D3G3irtLVws((FCl^x<Sdou&-W zV@tHQV?8^TwGZ*pE2)9Hyi8+WBdhU5BmWM>Nii(Mvyuoa`)j8=U6l6<MSqAVTDidQ zt|Pn;XL$f-c}{1K+%cLLjjwa<mj_U{A7z;k78eeGis&5IQ%3ab10-XdG;i(=%C3|x z-me6FWOK3k&a=ks-iPjRaN)umY$sOTZW;v44pA*?zJc{u+&GY1(SgZ=@QMdHO3o9; zvRA+b?+zA%To?jLP>np!X$)(Pi}JGEZ$9*NEFx`<3bUA_vuuCsYIrU`urJ{4e_Cb# zX&o(D@mb=y3UN}c8Iut=?+{PhNk7LiM9)I{FqFHN!Q`$gsnrQdbZGAB#FBMMVu>S# zukREIv;5Ap_>SyX_oZ#W^b7A?%$d|=W6o0b`$PlI)NW(#CEv312@;N}S2zTXpsRgV z&bif4N3?&t@s+?Tl8$w<w4a)*CKO(K_BSO*IxuQkz@2(J2jy2}8Y!Oi-RyzReqQL} zA_uS}W)a<b^RB=H_L%WQ9X9*=ezJ&koVZs(GBuadBC_UVdVajiF73Gv>6q=%3?ZMs z1}C1iO){XkbH%4{G0RGQExyJ_g*4M8tlE8M1zD_w!EL<(QJFgWs-;^lV72*~=2Kh6 z20P3^kSf@~m!xlcP;S30?uGr2<|u}rEa#Gs=DD86((gf3iI23RM_N=+I8U1=lDW(r zV>#%1xjyp}Amkni!tx^h>4AreSGTZZA0{WE``*)uJr3zxCU{5~_lk#r3lg1jaWX(n zAt1;hNVvE#KyBlx=&#obH8|5G+G=I_dcgAO_bt~rbfCbtLlj3%7M8g>Z7F+d`T^(( z@iuAYNFG*us;@_{RUf=&knT>CsMNQ6p)s1jM2>>u204A9Pn1RB_&J56e!W7SA?tp< zsKR|}i9jFi8G6vg*0V2vp}<7ZWhfDA-%vZhR5$&^x$_UF^Ix3Se{h=q!CC%0Ha^b> z#JR<ynq0Mk#U`Fm?A-!fpQ8({6B9NYjz|O46^V6XX@Yrm5xY=@DETCJQ|{b_LTc6= z8jNo0DxWHLHPJQKMOJj-2G+j5<<k2LU9*jmrs0HrA#b@HE2SraUsfP3=p`vwtxBCT z51&h&C+M8^ByG@jY1At$D7cuO{dS?+CkF$xrT)v2vu)QF1OR3dA94IkeC-{`MOWA< z!a^tED$VQdjnw<{zCJy<1-9ZYzSksTph|r4g1y;Stsrm-r9l67AgS$o!!2J0b|cJd z0?b^QKDvu&!hs#Qbua*QSBO_U>Ezk;&YB|vg6YLc3?~M+&Zd*I&^;8U@#5sH(k}$d z7l)?3YH=sF9#h$)L~CeVY6tLNM*@aha?mhesbb{1WOlPCA^ZXJ+j?(Mbt#MlG{f`+ zKm|Z2^m_L38UgZfzdZ%WlC2^{FP}J8TTupQKFq%tA&l1ky|D!x{JRwl1p1%J-zPI* zwxm#RzdOO*eRdN37_23~cJ+2L^s9I8Z&#Ahw#JR<oU|iRQNOE#f-A$vMk;fT3*%x- zsV07VR#HVuC^Erq2cqDNI%mDJCd_zViMydFWVrvlx-gJW>Ob4^5IR_@REj-kX{Ppm z#C-KdI)dMFZwhK-D*9&>Q`U2;QUdIeRdVlhpf<(Mz7Y(V=?c^?ukGrnzTW}dF)*O6 zh}+XMr{bUlodpEzNMrRyPIATBrgCE2jof?Ul_K_|yZzQ|k);74B1_k<m=^0h*F8kA zoHaSi=}Dxr+k?@*9O3xjhIJdqR4k3@o#Dx}eVrFq%}*izK^M52g(i?$z{PzIRX2-$ zf~XMvgtuqnHXK($;N|1+*oG__?c9<#hU@o}-s)3FPNDYJX(ligXDWP~MrBOJR!iBj z^d9%ROf@qCl^f6&syKU|J}+k^gjky71pC8}iSi<H3u-I<dlQcBWDc!q9H;?Acv;}# z3|ey3<d(}dA(^l0!br*-<Tp4PZceU0vJSCpFutEHQj-p}fg-MC|KNz(@L?}$(lHRi zd!G6A^T^TSNb7CmNI<Sql!fs-TxM!DQ;Gx}+_s7&EefZS;@Ql%(MJDz4{X50I2dD? zM64CgA5XD1W|31P6P@g4B`V2JKhbd8h#C+=J~iI{)9CtFqwOD!=6^JHeMSYSEsXu2 z&8Xd*SfPLOv2P}csGvalFo)!uRk)TLkj9-bhQ@@@ulBJeN31nzwK#+%GktM)0HJq@ zY{HSxdg`M#Io#6-o!QlJR3aL$7L}*Es;_!t{`1Sl_-2;obM#YE+`d%HJDBqF4ly}P zNj!f~N9pP;Q-Hn^nchzqcpJInU>CB@r;)x@XfVp?nK3yr6{-p`V~VX~r<B$xFn~_U zf-w}MHY80%2g95GhvkNCEl}S3qI6%fyDi~w&4-iV;=PlhM)6}aEsy>FmXT6*nPOi) z!bsN$-=Ef}n1plTZP{4PoM@?-)YW(&>*TeTyL`bj1K8+Nd2z1g+o!$`o^H?@c>xd3 zte<QZPxZf~rnB%!$yeog1?4f*5{GhNb$K=qftEj8Me9PlE20b72oAr?Gukl$9pq2x zCW!3}eLj`f_v_xQMWieSwcGXc-PU5uCduyJa02AHR&T+-HBvv9Z{HUP^*@i2e|~wS z-ai~0`K7IHr`t`ELIQ1xZTjT3P)9Kc+r(6uJ(a%%RSxI($>(pgrht>yY$WeDP(vwt z^>^KQukMy_O5%%@2TGZ;N|Bs#DLO&|lQEYC+P7nwe}Rc<dvi}P_ElaQX$43sJu_Wx z%dtxr57)tPeJMuntx`c(XcuVu$wUNu7K(Ee!6)wqS8=%&c+`-frUTx9+)m%bxCS+Q zI7M(e7pGbY=qA!pmKBtKHE}BO^2NlbO8Y{Su{6Z7WB`co={i)j1&wpRw_C$u_DAem zdje=MMAM2lbuu7ly<HH5yhaZ!6LgCZl+vCw!$7^CUgLGAZ}Jx^G<^PoBd#Yq@RsEm zCov3zcIbBx-J}~8OQDwScAevAKk%o=6axHm+F5L1vpQU)s`ykkOXZyiTp8j5fBUO$ z*O|xE<&J)a%rSsdx1HRq&nMI1e@*V=;6kaG)00W+^)}+ZTiIhCPe1bv=&7)})qK}S zDT=qmZNRjsemJKptvDRZbAYz4V$8DeHKd3CVMD(!AXkbHh`a=NE&Ae~fnJ#-50$cn zBvx?aT82(~u}|=Q&RjdHJGVZ5Y)3IOR4BQK*2Cer1n+1^Jh{`Q?`J8!MDvj;Uno5y zz>6Oc=s$QCf8pu>fv5QgUd*4*uO$EH6vl-w>p(*Di*c<4tox2)(mZUiaSV&&;X3rH z1*e<lEI0aQBEoU7A>16ZHN!$N!WvfCwk?6*NA#l|j%wUK=?gYd#HE<tT)Q#YS&f*U z!F2gTHln+wluy6%QTA8MQ=m}4yGg#w%z4a5wic>1ZrvYO>@erAG0c{!VqJQEi-Gcd z!}v}y2rU3GJS>kRbKI1MzG0z)nvo_|OPKE?JlnBUD>Y}Gfx9Un+(PIvd~D~$^PNQu zemvxyW2hZK21z8&sw+LxB~ay0#2CO_=tNg&XGC*r*Yf58_2A!)bZ+6fTB@hXBnE?f z6=1-0kLecJA!|GYN>|~**7`G~ufxS_S-qw8ut-N=>^Wq^w3HM`8RqhBZ9iU*@7%hp z4N8d(*wPp48~IK0J+q|K<VZGFGu48hqe9?i=?-?SsxF%M{3^|JgK+*eY9U#21s;5X zNI$84PW>k+>V6J8@h0oa`2w$@R^w*zRDZU6ih$33jx{{3LuccvZ)QuWcz}dqMs<Tq z1GJGK@omv2@5-{!b|mf?(c+&{aj=ctD2kid9`-QtU>@ER!7#z0X!ZnGX?w`Xluewg z<eWMP@U%w5=z=G>>Lb2%)z+*j-BFezg6jyi6`GnGZIe3Jp_4ASdgs6tXCbW8f@`_a zdXF7r04&#qY_S(#);%l0Gqo`tN6DY!s3_vMNN@yD+LPu_7g+G`I;)%KT>3m5Zp+$b zv)2Byw_1yxL%o48*BHfbRYkRH^w@4e#_po^#CpO)Fvc$;YH-UK>uMN1AUjh~$aJb2 z0fb;iB`_lQr}dY<*KJr%#GDKJ>L!5_hN9ZMZY!pius`M{Ii0YQxpgi0Ag^DGEov_B z4Plx%B^lJ$I_I8-y+{Sseer|3W>dwTz84-uwO@OIG-BEcemwpn>WNbmGfUW&eMibA z%M41S^DFoLX}a}hQlsRLrQ3&x7hG0v=kKF)$?X<5LSzbw(`;_sd|b&+!;2umX{8s2 zKaX@`j^FO5)!kJ#$o!OraZ@y)4c_2aZ+bLmmfIN$UIzh~cy_w6aEtO(=M$CsFlM_4 zq8%%(w@3E%rCCSH^NC$?3z}qv581=-uW4PoAsa`m7EDpAs<^|*0j0F!a0We#Q#Z;G z!KvUDclaM3pb>Q;((W`H9OfC)sD<j)a>iI(h=JkpkbPD}TFb*>aN><@i7bLjSgfOB z50vd{iBP-`N8;EkR8!KY@pW76*d>f;*qy^g&x$jGVa_Pv6vd<}PY287>cL;Rkx!WK z?It(Y@lf76;$qO)Z;KYT00@Bke~pyXz$Hz{!nrPcFSK_e$)xXYXeH?=r|H{rXMIqp zc>wjsPv25a=!Fcaft@y8jX$G?Qy|Jgzd*CF8VqB^X5_uQ3y|ccHIF_ucdO><#<6+o z<+0PraQ_hQel2vf88Z23ZY=G+k=W7F3g_7UQa%aN%jZ2aa#W1&qrHxncs-VCah{i9 zet6E&Zkc_mxjZC}i7-m6MSzV^IPx-6L*_bxx<sa+<@;V6$dB@o&TrO}@#QBLQA>wy z+ELqco8~Y+?U}KKEs~bgwAw)ic4b<tXp8IT8KuU4)TX8%DnjWXpZu_yk4G5c8#A2l z50iC2$;0W~hiiPs=z8@w(8(_-c(}xqS{tiY?;L2hTY>U0_AqcVhm=EK!bK7XdFJ<# zk`RgWUJmDKHU?9_B|Er7j`AVk4gxidny2k7iguty_p7*rYY1hDTI@yC;*#;Afmi1n z(DqK-`69vtz@2-5=eos~4c(+}702~f$Zme-Uev$27nJt@b1x{#@7ybd_d6fl{C*kM z#XC0IDWQ47v<6}knDd=gVa|hfu<~$L*Q%%S^W{V_d}kw88;K6kJ!|!^Kqo$>a*5y+ zE5=)$Z?i>7BhFX|WzUO9R9F*68m2~a*0>;#_14753Hu&SemjXOI!{OHj`KJmPG=1Q zLEI?lhuWvtP3Zpe9AgWE-=kO^GMWiQ>ws2b>2k-jR2`k|enII{61kirGGM5bQpRtm zTCVLL^j$1}R3=w2xsTJM56&G!p-i0<GWC<yan=3`-nUqIp-&9KFP93zI3q)JLE=wl zJ7RR2sb4URGgM;Em)f$>7xEYgsObt3(oFU)oxybAPzo#s9|{Y;tIn34<Tbd`4$2ZK z;sPks>*;X*rE|Fp`BKMz@W91OT&Q@$8?1P2U(N-Qh><`v^1xTmoX~M3YrBXZIk-dI z%V$~F#PA&V46M8m{ECBBDud1`ynQ}Op6?-nv=s%zC3@9oWyzLVO~m0L<1x5pmqY_r z*TR%RL^oHleM*U~^^?im_7#8wrJ=z~16pq0aJ4PLCa2}L`7s!~dCEupTzyO4cxY3m zpix`)r26UZI4f+F*5sb(imSL8ePlA%qmAACMk*_LgNwl3%KcQL={ua+v?o4os=lMp zmyv~$>mt@bf)BObJdC}qdF@jXMc-!sCkQ~c`gd!tBJ51vYt=kgrKz{G4}Lr(LX2o= zPBqj~yJVNZSCwRh&FgjyBE4HayvKAJOhjBbo7Z+Ltl9kJ3bFlfg!YR4Xw&97$X$j9 zi$HA-Zzq=k351;4+mwfjUQ%6-PEd72^R~0WAVi|4F%t@Wx1${Dyr(fCHW#?^T>F6_ z5LtG8i~jmTz;l9e1k*Yal!`!3jy%;ovl(n)iLMdPW;#jw8gO)y@yt>*1H)i+o^=2@ zuF~a=rB4uywAJ#f0o)_`AKj-QT!A<IDCWeF=m|f*7G01A^_fwz5O>Q;xcxxzXex#E zx1ngzk1|Mf3>;>%M~vieoji(v;|P7C?$P>!i9>@EciMam0yF;dtAZa{6}^fUFUc@r zAS3vcOT$uXW>zLzsYq*A(S=-AE^E{U*Ef5*#NA-oQTxTvUy*bM*<m>WJV)VJkhf|Y zdI{0{Y7rz3=nC>fqYuu@A-VLb3x88#EtU}-68DLV<xTlf8chH&*Zw-x2A-&Ui@|P0 z^0u+OAEFA$|Jc9JnFlpw=m*0Sk>-WF)#<bli~YnS?ZRGmps_(MH089+lvVIPP0k>O z3SwGNFzAcL=x96(GUtf%#3&{)O-Y<&BA(5|1FQHs4{)UYa1TQj-99_~p@g~&q^Zb) zGOk-bLX_|P7G0II@XAO|fkICxHRaV{2u<2%iD<>_97|bI`Ds}At2w8cWh-})&93`T zF~+;1!F-W<6m5YptmkN*gdWzCP0t0`e0Ykq+KdkUo{wOWfol>K))cR}XGQVyaxUVu zFCjo~X_&!3>k6R8U^0a=qV?%V`UR9~%X=Y&a>5A9sKjkRMcFL{pOtahU5P51DAZvh zW_RA~CN!=Tl~rx5TN~CnqH&8R%Pb~e)TsN+^CScB_X=Ine3mFsp0;VVBc5`CPdh!D zNrvmTm53VQ3^}@Qhb!SNf@cNHXSAC`)Bw8$yKGS8(b;O|)P@(sD`IeLwll!0yQIM# zW>2lEYy;F9;pzcPO#3ZtyTGy7$0;CX$AufPTpKQ6As7;j_|&{IYA1nIqBtK;X8_BD z%QO1^_1=Hv@+12KvHowT0%1Ey$N?I)`MGXlaWbPS0P18r^wgZ~h>Kt(MedgLWP^Mz z;p7qHr1Uu-Dhj`%>Byp0o03XpN#aRp(h$I47?8r4O>uVknqGLR0K9O6x(O+pIS$nj z2{!Y}l3FmqANcKyE|njs*#i3@Zt|=`T-o{?62m=pG|hE$`uBFoa~1-?6Ul57v#%!v z<#!#abCYgZFc!1|v(H)gLgaB@#_&wxTPB=mJ$FOeW4;~G8O`^5D#dV_d{FlX>tf3$ zVLS;awFkIJ&?p0ux3G-V(pkP58+{uY<F2f_BZ)GWgwD(4lB2izhEEca5{pJmgIDuS zp;x%ZKQ#;dTN9k`Sbr2mBOkFN@+2s!&6B_3c7mjNHJyk~;QTav{fmD#kuLYc^H?}f zNRf`~w+yE?J*l8xotPom0;}g&>o#+8jGAU#g*HegC@gv!b{Q<g@ugHS`L|G<NL?2S z+>)>|xcrHpaKJBy-iY;3L0*HIBp!+1@J>9Gf&CQNQ%f#4!=H1DFOZBOE&8I?`%_QU zpbk*U284kzm^1fQh%h=^%x!TC35~AEtWOP!GAgcDb^G@i-KE6@pK|3OFW#Lg^-G(P zAd`|5`pptP4w#yJ3r)F;%o2NywT*kWXF{g8LKVHN2zHO?OlxP<a5Sl*IwAxp(r)0O zU>T&LZDegnbw;?Of_cAWe3n+yzoiv0;P1A^{m-_>@z1uV;7^ySFLurcK#Djrp>_yJ zq0Ykr_q0hQZ?5Z0=&+10axi9g=1dN117>=615R>(-ONtFNNq!6I;?d<x1J!`>Se4m z4p$u!aq<4D*CISNyF8)AzW?SFZ<>L(&-yp5D#!Q@rC8#5>cupx%mf<1d7hS5F!kk8 zOTnbGZr8oyOS+xM49Dh2gi!&9s;;-s=S8b1(=;6@42PM&jYcgT&kGWyZ~6Yn9-N&F z<t(;#UV_H_Wex+<Rp_3$qtXIXorZrMAJ|f>T*0kPI_~&kPFECLLy99i_iLOwl(Uaf z`c0jsL$?KoNq2p*$W?jpPKUtXF{Y!PwI4enVSEP?8{1^9Vie!WTDTP`VDzrk&>C;O ze|%qWY)8jzwJJR#c*aTuKz@j-MHXA%JEK@HRPu=7LL)otYlVvuH$LFz6J7(S6BEHg zZBWX5ylY9X0HiC<&tchb^{r(~NW`tnypE69!>tI8_YU^FjcfnF3gq%F`T~jk2ln@2 z8Mtj(Ftxff01^tfnrVI+rG@VL8z2z|n&Ul5imCCcH+Hp$0PmSDIV?yne!UVOSb!n8 zzYbF?EMDi4bBw)@M85vc=-Zd1R*)9skXz1#d$_M;g+vFSR1bbHXXUO<#{0c`TP-%$ z59*;vo#Iaw&Q$Fk*I_HpM0k&uLFf8p<+|Sc>{ih#0YpRlr)%$(q?<KISrlnLi(_b> z8mM<|yGC}6EZLkr-Bh)*9p6<0h<d=CTX4oO`@F=$>L@zR%4g(6w~D+4Xo~@)>H5Q~ z38=LCJw%OmBP7%A@9B`@2ibr2yeE2`@og*DQu<u#Arvomd_ZEI8&5-zXB~QWag|Fs zfyo({8I(|1(~PKm#k1I=Co1v)0PI@kjNxZ?F!PCNvYV=V>WcylZFol7d`TQdqI_H6 z11mFw4t>RA_5m=Z8UzYElArrk>`-d15|Pn}9h4sUd7!2|6(zE*bC=ZZq+9}%t!RNz zR2;3@7wVY{*JC4jVkD!X#UeP#@NAJb;Tt6~ocVSYmF;uj{qla7P7=V)1|+soE3%oj z-uGCn+b#7@80-)Eda)js?`8?bv-P9Gay7FcBMw2AHo=g&C@g8UU2T}h=TjZ)KXvMV z)ye%)C-Fz!;^zkk(G76<G#6xZ+0y3dSE%Tj5t|J>ve3H?+v&|OV-1Ux(6R?t!V7;W zdO8Ml?$%)z#%dD^hK;D9cG{TJKa?6TL=(f_<n4a|Z)+z*k2(Ij#o&1N-J!2Q|Ke04 zm7zByxSE4J<Z2rIV5NV6fpDDY`%IQ9c&a-CpZ_Ia=Hz7?b&Yif{`Z<%*g}qvbB(rI z5&d4l-m?O`pCA)YaC+hHAe6WUsGCk8f)eqGrr!rOi&eUc3W+W6itl~PRdckvdd6%{ zDgj!sws|B6&1DuNoAgeCTXkhNXV_gbEH0@UMJV&fKsEQFw<4nxp{l<sMiSbS{J3h6 zds1mtgdGw`F1;Hvo)GB$2`ssbPSCk-`3uY&31O6vhfra?fa+AmL6m_AWx$^0MBL$4 z0zlh-f5w`fnXfzVDE0WG3Y*Y<K=W^#&Ni3t-WN#qKTC$6Kke^X*-uA|NDCGlf!XBO z4Y2u@9eph8l%#L*v+_-DGW}0J+(W%WmyQ_~ny4Vg8yXR`vlKm<ed|l=l{{Oz`i*zi zt4udvK3|WNOc+UfbV2_mkmHuE3t-gW`s(pjPhQ{l$g!O5bVMXf?xK9k{$WNH5or{V z8u$*}%D^5W;OH9KSiNroTcS)?MCv<G9Y!S7zUmi)0`A9L;ezwSxQzFTU=&wGUNfH3 zCS8_l1cuF7)ln2s{xl>T0Kzp<k(ek6q8S{W4Ba={vw^E08B|zkseB7QmDqlhDFIwx zd%qO-dDK_+F~Bax_zHjAXG&Uv)T+WP2|Bo!lZ&j@@Q6Cjp?~B1xwQ4|n`ZCKP@C_Z ziCeHp0n)DOh|FXJO7K{?kSQ()3n-PHChvsti+e&L5FEcK!HV+!&5AhrD%fE#j^D%^ z5yWIeJy<M7Dyj0Jb}$oXdeD>%!UFDL*JS5qb;c5XO0?St!}Oy}mNHIJXVx2rtXE1j zyL@UFn0PhByhgwL%TCAAnV}Jc5bZp8BKNV?eayRT4R@ix7e%xuoH;MS6m3!HL}{eb zrM^Z~3+Jk>!!g4Lj5QX)7Jd>Ggh2ydv~CVt(#@V(^k|E5Em`E$Y4eibd<DYSJ2hQ) zo1wY#sJ-89JCT3V%>GK#{Uc5NUw!-Rmxul?Z+_KTR1Y!KmP1TC7gz2cGYD|ga;tS) zhmF_B^@^In>I*d(peG-Am35Dh+9D-hCc>gB>j&>_vX3QEWLKxJ;M?`W=dr+MsPodL z50t`z*3BV14UHwJt1p3giJRi7IXsSNqhBJ^zz9$=^k4w-;qfEZdPKkP4Dv^XY(6r} zG1{^YZFAhxOg<cBVJS(k+B{&pp0>OsrgGMP5tZ?)^9}Xb??+ZD;tqD|FY1X0Dd9Hv z;kecdVTb}G$wVA~y>*o5e)h`3$mdv$H>0mvI5qn||IlFr+~mwp5oLh5o~n8U^Am)? zF~rF`?s7=~++&GEI1;r;3>J7zYp*<)k>Z&ZfI}~Kf;W8=M=0vF$FE+h1TV^RFcbJB z=VXwWW5MveMy@jWWcA)HvY0IatlDZ8!O<Kfv22X<<4a}$7*ro@a3JKp@PN->c$&F< zd%i$s|66tb2an0IQG6*>R5rkZFgddjrrI%=r>yE@=MY8~&wVXmW@4=xUk+E5$kpNn zm6U(`M$VmM9(B;l{sJ&<wwA`v_KMSc_&_J+trMPPCogiW!KmA`G*vC7;yYOX_TAVr zZ8rwq_6L<Vd@8$;E)FKPY)CQ&Y5;yqe!&Tn3E+JspzS^m`v#jDb<E>PHr@ux8v9qa z#Th9pMK?~~Bxc;DuT5h|=qw=!CL#Iuj+JpSF6`sEYlOb7r1+_e<gez*V3#1!=SOn6 zCLP+Sp1gT{ICjqOMfPNF1D#|iu=VBRYm@jV(5c;m=VmYH#FQ@C;X=$Qfm-;0vw4fm z{c_||#gPL%NAINP;B!QzdEM#9-AxIU?pS9by2|Lzdu)!^p`o#v#h7Z~JLb<-{FO!+ zDxn2ZLii%4B_4->!vv$S#ME!~znU=;eN9Yc>IK^G+eWnrYrn{B!hF!iZYtf9(XhEj zTq^gl(p;5b>QsSj_%Pz=>bDh=!zI@u?Q`lYbMM5Z4=cA(P?HnfH|WH74?vFFz_nj7 zER~X(F0^sOdkG%Q=4TCa<+e0&KP%GRK`3Ica*LLy?>kdY`nOTBmW%n*R|3N3HJS8$ z{IbPg@LGZU-J((b=gj!8Gp#?)RQ@<?`v0^mMI4|gTSCoJP!@Xyeq#KZRgn__Q@wUr zhU4q+(ULWy#&Q+W;-z$-x^gptL<LH%^J~C<%ZjNryoKwFm4yg@9jYCbOiGaO=q>X$ zRVM3wE@GXm{nBc-y3Tp_M{f&X<JGqThqW@0IhKz3sM;6rVjA7*T~_sdB><H-1dB7G zEF0DJB8EG*B1kcj^|Czkj*IUyMUhNKUKz<MJ2o=F=*J?40qa!*;ucfrO>OC>c|!+- z2Tq*lEL|R03-wBDq0Mh8l%_>0+7ppCYQsM0p)3-hQ|(K9aYmV2x`i{A_C~1~nYQF} z7&ki``V^jVn<-)d+a4=-Zc#1u(>Nc=WcYY>g#`(6j#HGQsKnAI54c*}k#+u0vUy42 z`C^I9nA#Uj7IeT(!SWZp-Sx#nnvfg#ohgfODcEnD46n+{yqS|maUSPucHjOYW6I@Q z^96GK-%1h8)|o$s?X$oE_mo}=Rrb43DD<uxv=mGl@-my5Wdw3#0(rx<gRUwxW4z54 z99dzRUpIyKc4O{HF(o*O8MzgD=Xk`)f6LZvZ6Y_eBY$1(wb^AV;Lk_@GH*yY=FW#m zuQ!FrRE(~3IF+6Sq>PZ<d6bq?Rx8N9{aU8o+$r#tOlp_etwcPgN^V_5+D-fb{i`fS zrFvddekFnprAa>DMmXb(R9a4!4W5mErN)>l*@Q$oE(M-3lr)lfgH78#1<er(?p5A~ z_O0O{oFv54Lab<{;xYyy146I*>Ul)Fx?iwpeE%AUR6{$MBJwz(Xo>y<9Vlz&YQ=sO zES`b7Knhi0wfTLOjeY1~j%aY8g{g#>xU4>_BbWc4+z$(LMnP0gq-U3e_%xgf)L)ew z$bun4<Ly`Gr`DEO@VR5fv-lH7Rz|+`#y<c*2(=kQ8Ov7|Z4uoTu*A%ylf(zw8RUdc zR%R(LK&*24n#~7o^q9$J<Y-ubk~?;rinRfaT|_z3RCkjp)b2LQn>c)kL=U&sL;!E? zA}NU4U@0>{RyRdEAt-K09U|u{X<wYbmDFvSU41L!LZm%7FVD+9e*ha$BJes==G!K$ zr2hT7JdoKxT*7~GasR=^`Wu(s*Z;qTCx&lfRSrXE@wohyixX4x!B%&w^UG5-j)hmQ zFzt2$6?RNzS`g^Rqv-07qcwMMv*5j)sUkI3mPpD#GWW={_{|P;)mzhQc;?T)bG^GJ zz^)#g)D2kIg#j|{vUO$105(u(f1^&VpPYOwn>nSy)_Koq8=e&BC6GUYEJy?cX6=4R z<b<Jv`^!u*%xLW1ro-JH`_PMz(WU|6dP!s&(v}+=rwDC0#c0DFNS_1G7LZltp3;-} zZt3c0pY0&pXpSu+l#di&U#Wo1Nt>RQl~3bMd1WZi?n)=;?6P6whHOCF1jKS${(=NG zD2!Ihz$e$eGR%EgJx>?~!FJ8B^sBGIW~H&L7+A|*ku!5hiS4oRFKOw^fHDL)jjtvP zd60rP=oH(9OEG^d6wrJwUy3hK*#Gc=+9Ff?03ac65NSX6GZghjkRO%(guglEPcH9a zc_ZeYbg=4Ihnd3M(nLw+Gel|cbVMtJbi1GtX5(8prRsC;@?R~*L}uNs?hc8cSH|)< z><N{uTcZ2s_5;zuCyjuCFG)m?d5=)mn_1}~I4E$!L6wyYK)qh{u?dspy=r+Z>$PY{ zqZ)!Css(jMo7pYcIM;?~4kQIDS-Nb#!eqb0i~A640P?t`gBYbQ`O6Svx>R%CBjkco zU>&;fp6D-q?lvUh5I->p2;THiPZY7+iG1P7aYOcOv4D$dsns!c^Pd>XCVn7^wF@|A zXQ1tG`0yZgoROSSqhB5|3nlBv1>f}UvZ6^5B5qb9WDj@W6i3&z>c@yKwg?j!@V_i* z*8lwc@8&ItTe^(F(zmJQjzU%dgyg*tkp?;{welJU=gVxBA2Ki7WC)^wd93^BI=v$9 zq55Xl*e)-|1`y#XsS>B!EJ*z^U#IlkHDcB+(%2EjLZ^5E#nc#BD3Xt?bz^fWJiK%_ zN4HFV$Gz*nxTpCW_r!nV9`{e&|Gs^SqWjbZ03f6wUK_i?PUeZH{*GRnjtAovB7D*A z3P?)j0POTRRe5O&6@0%x)yV44e_MvBY<#He{`g_Eb7Zfz{Oph#c3?_;IX}E&Cs3D= z@146$f1O#60C`OP_=D$aTt)fF{^S;z5~VAiJ11bM7G39?fc>^VQZ{1yi5yaeY&yuB zTjAz3f<-?1<>#cTXvKQ(ocI|Ove{sf2(>U%8CI6GB=Trvi@rv@qLvrX<gMWkd6pNS zR_L0Q_5eQ4iRp73Wq=MRtsO*~SWo8{l_$Y*V!4FYg6>gjK~~<y@`DczYrw?`tn1+! z=Ke+)+ej~TsPsnUTRmhQ%GOI*LL~BdhmfX^=~87bmd&k}YeaP6zg+~Ng<QTWU!e5= z!u#9rE&^ci^6fk3?*In^jckn?vmVo<cZ?Sqi1*^pmRrGsF)=<n@=lNZisK0Brhvou zf`8jl(LT)&s}=X{+c?5Bji;cr+D-)od+5q*zN5$96dx=Hirss6%G6trabJ{!cv5i# z@K=bz6Tar~u}16;=lbs_FuJrtLU6?j9l|vu6{w;Q>)~qHF1KT{*#ZR~Z%d-+sZxl; z!>0bnG~#JO&JF%iDJw%xtq=)Fq_#=y-qvoV5!2pA!eQ}<pt3VrXBm)>IGn}ow_)8z zt{+`p4|*Lm-G<x4(rgU+VLM!){`3ixIs-+0oLjN@xYuEsCk?c}XoFE9sJO800HM6L z#09C01WEWelR2)GGqTo%7D9*FXiN1FKudx%Qq6!vUr}&Q9gkzaBDPQ)`eZ6qVylH4 zo{}NC+t02MkF7d^i&Emsw(|JLmrU1(dsWsb1kBsC5>~7)WSR~0@OK&&SNrGww1FyG zkQ!=<0J@c;%|xjXv#^4Tv4+s3k7-=@o=4}i*@T?)kKOMLU9k_+DMKzMi8aM<5E1^r zw$3sv3MN{>3y73-r?ix$G{Vv?ozjhTgGemh-Mt9X-3?NLAl+R80@7V~!4K~JarwW` znSJM-IcJ91nUac{IKa)Phf*r!*?Qb3>ro!9hkvl%ZsoyxTQtav(-7-RDy3V;O<wnE zC=|u}x^$%04sNL=@Ka&TVN7z_T`RE!<B)m_Q5HDn{V@LPwHQTESer;}HS;0BU|CMD zXF4B^v+TTr3ZtD-NSjstD-4x?|2`>`JrDd%g=^21Ck{7vc(K@&g7h-C#ZGC}>73K> z$)4Ge-KXz>`V5bSf(WI;AJ}L|ua=I7(H+9Wwy-PL-dh(S%VUtIib6MJ2ANnM+G}>X zu$!QohG?p^nm6mYP_+kkMY$(Ybde=oH&h4W91<MqZWp-CLThcKoQzX>3?2Iz7C5xj z9sPWD{ke+Yk2wYSiQ9HnY)imq35x65+1F0WY4EA`fsO_X+Jm5r{`sx-uxUaa1X<c+ zE*{*;-1NZ2BG!}A$#exS+=<%G#%HC%g2pq)M+<E3p<ZMKT}!?0e|a>tKcZT#VF7s~ zh7`6;o#%Xs043#2p|A2|cEHx;^(sFry%}-}d8Go!s#;tz9sfmf?GVE9s>bMy;5u2R zGAopcehYfD{q`Pae@oA)1kq=dO6w(o{yYM{UH7#S^!%Tr)@q4XEo>JWEhIQ!!HdzQ zLTWk%L9D+xKY+28gWfnN#qE_6fou!aSoJLOS&ij46td1sq7}oo*?*9^nW+)oM>FR% z>fyA6%kkCNB3%*ASpL3>!8}MkV&0I|lYobxv5r)7fG(V&K|wTb#e2zr9}((uY;2tz zp$e>84fq&Y868!t5Xb7P+mcd*&$5)r(1<S7O1xIbSUdkCO|7h4XHsItam7>bHs<@S zSBAfYnO{-1HSWR{5d3Q3INVw)IWx^+X&XCqWL$0U9`5IOvGw%B#GLx9D9V$fun&p? z?;jN%`L7^>2<l`K#^NlE+p$)xgIQx?7)oJL@Wc9sQeYWl${z!!v+({nO>+ffy<5*> zBTa>Ww<&BM09I+xz+&?r@g+p2QL@*1ixN43k{jncTI&_^20TB`rE4k>bHqm%({yqF zi5SyR;Cfupy=<p%&@;|LF{;5NmJJRU5JAB8>3vE4U)*|A!7~`Vx1Y(Ut6T|OckD|# zJ8Ui;xGGRozojuNT+H$zqc>C%t?NkIe^6sCTH;B$4@39Ooks1>)1`624w?B_au?bV zEHP5+Qzo?x^~Zc`@x*P1Zp+P1cEq@p?l=+k)W551q18?)Ccyjihv%7B04yj6f^Pn2 z=D(wwb|9j50PZJ_2{4({4~t1-y9)x!!vlx?;H7JtBL7Hj?A1iETjGxqI}z03=S4Zy zEMZo~_siA;OF^pI?B7;C=D2GAb_`8G-uV#xjzNY>maId5h_Fj{>V!w`ji4A6<K3Qg zp1HPy&TJOKEGfxLzj}?*h?HopUNmLZi(^6<B{HtdT33lkZE${5W<;K=A5qxU`a}|E zvrF4nxUZmFNz<EMk=cu`^b|LVnY}n))M&fXog_ZiumLpQW$c@u>7t5jG3&6fs~33O zSN=iB^QeiSERt`aRN`5N+o=;dG1H?_YJ|cD3F?V9iGg9DSI<ddy*<)MO4Mqu@ixj~ z8`E~_o~D?JJ^YN<l~TXXOdva>GpW{q-I>HUQm#;h)>O}p4>OI~O3K^OzXPK#PmY1K zYWqA9UGTU<+mR<t>JaUUp0ooj{ihvZ@=?3tNA2_>+L7wzvQan#yaA%7$Mw)iN{47M z7H7n7EQ9eb+~EQ{UMd}rdxR}J9V_akQ&!3neUPK^-^9xHagy%PIkeo+H1ae5Oy!@+ zi2<*YiwFF(8V+!-dsVRG@dn0YE9>;bApEW?VXM6z>jrAgw|+|bUH`C1xv8IAP7bsi z?!Oz8g4uY_sJ{?!NyRO}s3c{-x}?MBb8pKXyftaBfBSv?v>@Cn9a2k<`wD)I6*iSB z->Nh|Uq>c(&VHL>VruJ_{O1>-slw(Ko%Fxe9W*>xkQ)R&_<svjWJK==jn?opXv3Ld z<mHu#FsiE=nrV&8I8hp2neQ7HR*b|@m3HjO%6W4gB))-``Fn#o?ury-j~vA0;jR8& zBJjX$B)J3LG^%Dqb^c@wwUAu0Dum-|)a{d7tqH@WSbWO5eU_fYhaBadPY(N#-|{xZ z^D7jErX*wGF^Nkpaq~m1kz%*K_KPQV?v0Uvu3JP}4&6;0n>Z)|H~$%|eBszCZSbY| zE#AA3DFoeCXr+=<1=Y^#a-O3I296_Fh3WG$!9fKimd`rhOR>S%R&^+KRgrrc6B2eq zhcOCSh6?OM(`M+tI5NjSZ<C-_!RzME)N7SThr=GVpY+$Ey%!-*T<?=Jgr480jwjmg z@ZR#z)aV6;^g7wZkp~HDBby(_<yF}oHt9i(X?`}Q^~so;M`Ow!j3Huv*p|=(0L0{n zYeeR{lXcrjgykeCc7XSzMzCgLn23K99DNk4j&B_iiBha0I;9lsQ02a_tfz4M$h3_S zEsLv87do1Wsdp~Sxfi~^*0^MqIL0$jY50u@`;~}_yx4|7kvm{2W}{Y!Ng9}kL*=z8 zkWTD0=aOEO5?Kf0TeMO%M4v?4?dxjr{56C!+f=d`grEPnDw`ne26+B1pQkNH;!{Wc zz)5Y?e?q*h01H)vpcf!Qw8s=zD`x@F-G~j$YYtG%4~&Zd`3mog05sUaZ{Er0<op~z zISDw1=Y|Sq<jYsVfceHg+e1s?%jw9L_Cct-Ta|02Zw$f7XIE#EeI<3)G*m0j)LvXW zB{Z9H(Clr4tS)B#Mdn)GMHb%|07EW$9ln&b1yxAC&fshc$sa4u{YqH@F?$Xoo$~}& zxJ8qfSE6%n=qUpY3KuR!{gI_O#+t5XB46daP%T=a_Wgl_en$8V#$%Y5ZUt+FcE>^= zo$|5TIR`8<Tq1B3>Fwf57>HGb1tcRWHvNkJk_sVW{y8w@BAK&2?9l8;$1VCkhIL)e zMHuqoyS8e;WDeW!oHCXaS*F03NSg~@p8UNW!}?ZEEg&BP@2Xt2RJg16FGgU;lXKwk zk(@~8C~lJ}VAT+BSaxmvya}sx*Ix6;b^GJI72b1Kq=%2o<Whm%-$>Vv=C9I8osk{0 zX%e{431c=D8lvRQAA#+Qw#1!kSh*O}9o7FRpL|OdRMd66GC6SAQHNh4ZvHO05071s zdw~_TrZ$GQ4C!z-4*ercieZe#r<juy+1}u=XiDp*wvG+vrAmwaoeUB8P8wU`Z=UA% z+n&<#G>F>1M0$6+vRuFG!&l&B0;u7vQa|6tv`uO5cV<OgMz!nY{d#AwSMVaFA0@T& zRWIHLQGx)n1JM?i+4V|?a(8lr3@7I7pTDXZHLDj{c|AQts@6Uqsqwa<(4UAkFqAa^ z%I-Yu>-(ZyqRHN}9g}!_E0RNU(9wj)eQJK-!yQDQ^wj{`bsG?GY~5jlPAF^$4(e7* zq(s6U?&dR{KP|ssHC;zvojinfVL->r@}G1L066c)yjrPH94)kRATzAiI(@^x>vAt7 zu4rT_sJwmlZ5MeR-=>tg$%gs3#iA_!efwE%OcfqvEDk=6MVQ_H#v;tx!&nqvcs#`g z1v$lqXZvIL6abL;dr(V)#UTpWK1U!+pO$O!q=fa!P@gtjwsqk>`z3-A+J$0Z@s+GQ zHIG3S@dsKv!7A;-`$JWBW)bC!8wM1YJ%(P221A_S?eV*$Flpjr^b<bCKg(sgYLVpX zIvCUnCU;2*=(SC!+ng_3<dg+}C6D73w#t+QVO7x~+MmXY>Av(8z;6<$;(nKRnD)z? zkNdE5EPp6`04~y%A||cq%e$VU;R`cj7fPjoDkE{A0p+Dv1>!)Uf`HBs6*%mcbPQJ% zIa9Uzm0gqw!a7t3(yPEkKKQVzG^+t~)Xle!<nah+j`#R!WeOMvZk90bZ~Q#Ue3A~3 zj69N7t|Q4a%<=2!6jHXgCg)7T2Jq41c+IO6aFVMmPZrdR{-P9TxqR;sO<VfpnHv56 z%N-*7#Bh7%X5DOXL{A*A*{O|tDgNs6l#tJXA4_vAg;ID^PyYf&kc9fYG43bZ(kL!E z>(RtS3{k$y3Q4>xwxY!N`5Y}qDigDD)X=?^{mE~iemI&4Lpk{hE3bm`b#7OL`7{uy zz75T5#lOC5$yoCsBX=$6NaHCoHH%Ha`uko~W%)R?hOMY)H5mUpRnQ8{<*@glzgkZS z<3uEu+(Gb-dn2-*d*c_zbPUmO)!a)`(dBq#UnveaDg_@V2StaHHu5*Nx%~JWy%qrj z;*&SY=b;K6#j)lYz5AbFhvCtiK+XIHLgV;9W#e`Il+wwJB&a?cGoyiJLf3uM{SRnv z<JB~04?6`K$e7eOuHW-2OS#KMUkI)s-6Q0cgVb+&C5a`~xc_>E?t~AI`O2O*+}HcR z1x5X6aJ;PS6-9(~*fYK5C0U9t_pPqP&`#NZr4gd-u;_4LpSl(Fk|W&6ZwM7~k5om@ z#qU`3s-LzY>z_G14)RYqqzWg)A`~n&D3_CrNSpXh^|BDL(+QW_6k%mm85uus3u7*c zjWEl{qk0@<eXZIx>L8h!JCe?Mryv3C_=3!bgKg3~Mh`il{_5wzg7@vptDd>vq*T<N zUy#Nwnk!@tu5WeJ#pDmdw{q4{O>t(1hcTlXe+8wVYLMJHcC**kF~NwNhyeAj-)H-a zc_~Kjm$73CrC7!Ye9u@5L)&Y3>mMh2J+kyBC>0!4M=~zf1~iIcxpihJPwvl4K8BKU z4#fruPPHcDV9|Tfra~7wbJs;~+xs=U7C0$3o93xCMz##kcdClm&>b)7V=bUI*^aPL z(~+VMx_yBjlGL$pL<38aUd)t?PndiQFviPopS2<iO|6%UuEn^0_sgNkAnEmzr`t*T zmiK>|3kveQ-Vg}-@4r&!A@RcNoe1kp$azB&mNP}2fP~OZaPJhMNC&j5!dsIs`3y>j zXF!~ed&#rP`(~xp7&7>9sg#9dpxGguQk)^Ye+i}937Vh~;mnAZ<&0BI{kpwHBZ2le z5}c39$};-7Qk>n$Lt3>7MeKUei>uda(vW8jQR#lnAb#I%f+au_z2aZ`s_C_zw8jD2 z#O4{hps?E0NG3>Nd%dlWAk4~{zJmQ(te}+YAdRu;XA!-8v+p!khRwc<pkyzifIcak zbDZwu*6hO5qz3SRDloo0Ols$k^@SefYr^WG2><~yuA>!MZgZ$_roD<+oPL3_0L!=A z(Umqc)xIv>pTb(3(*e5`Uo<5K>2BIiW8rv@q%b=osOz@;b*^@eV9rKudzTRZMp^V- zE5q`Pd==0?Ju6oPqcv6`T9%;Z-bgWZ`>pv)Cx+cT(GCFvTS3tG|7brfKwwA#51@rs ze@|m`yd=CegzhA-Yy`9X>NdBwWxIgBo4i{m;V5rW9-`+nsQ!aPd5pe^lO({1W&NG$ zI8BCCdd7OLCnQzq#ri&U+UHzTi7}Bn3w9zyHB<%92Dx$2fdy1wfP=LEDF$YkT(gZ< z=8p*`*|o~utxi$J!MajF*w@RiB^AP^6sGnKONU;wR{AesuVa`~-{B3~C(*M{aHpbL zo2^CY2S~n>Up>;+dRS)ueTLig1h?|BdMkdUTdfOt{9itVZJZkJq)4PO=8PCk@#RE# z)>4L2I7wq!sDNT&ZIR#(o|@IQbkk_$!Kp?j$#{||%bB^*wW>0(3{7Fxp_uVHE7v!U zx5tWAhWbzQy|f%PlNyqBrIue6ep}!TljORL^anr2^Vr2t&EjwelP@;2sAFeXyJ_-; zyppgt@_*}1v{^+h5X<-7e7JZ^ZfC1@H&i+fW{!@CDq~LM7kcUvMKJIy2nO|Empq*5 z`L9ces~|<n+By=eU@hn1uX^19C<9F`-xLJPB83rj=~><`i7SHgnR2>0(<>i*Vhvzq zRCP%gJv;2%+D!>c8lZ6G2FvU1nqUp=k)3pyJ*J{+{l#HLb6AZAVnj3@{y)mZv<EF# zXaRb}kaaFDUj!v>d{Zt4ZK6+_^3kRJEOmhNOD6vc0(;|Q6Xx{s(TA$}{+WBm6ZiN> z?van&gLJ$ftfqUkI_|fWJ;w#-?jV92GqXj`;R_^usYOEp_Ep2E4!X^)ko+`pUh4`{ z_m*@##-v|eKi?mWb9OP72Hm*?@waHAHQe$LSJJV}PK(jk#fb<XhE3B%S`Hu>560rU zA!9C!$0j-34vxkae#Q928tJ{#Z__#3Y>wGb6L}Ln^eyKJtvnd$1%lvwY~DKv+85N{ z000K_eq^$Wr2u=~Iolm1Wm~1eRLwnC(+*Zpt`okKV}wB4L~Od(Q4eC4(wn=b92~}3 z1=yfH=YH>Y;WJKnzcUU)`$gK38uLke1)oqk*Jx_NeFNO)W6Q1VGMn!JTXRxP2M;Xp z3HI3W_Z*0>FsRSi+Mlr1Jz}ePXqP?6<=@Lakm{y1Z!ibmIqqIOt~HoYY(CG&G>wnx zlZHdSF!ak|wO*>YtWm|tt0W&dTOTu8+)|cIoH<^}Vle;P^FZ}25v*7Is?+Ci4%v;I zXjY*G;FXc7z}g09w}N>9Q~=Gfj3Ncaq99BQ?_VK|Ev`*C#xlVLp9S9!F6nlnh-%#k zVq;j##;FadA#V=S1H(U0-`a&)CC~0>O<%QkB-KL$@^dAhcG#fafq`HU49kDhh|WJ} zAzT%x?TwK`KAWWGXh|nw8+)I7&|Eo&X!ENVdO&BzHs!qfh!j!Sf&N1J2z?e0NYMRy z;O!N;;fb1Gc?R!w9QMrSyd>O_hS65x%!-aBg0yN#5fX<u!%Wp;_X%Hr*}8)X4x;Q7 zbv63o+3_%@a41crUR)PSr?Z{XFx`($Ms)8>T+ZxOGLnd>9n)$^Z3#pAjQ;6%Ex_aL zS|<<W?N*$;0cfO^>koxx!9f1-&sAFhZWy}6+FxHeor3_u;kM9#d<VsI)TZ>V3{Nap zSLv(qbfH@vaSdB-1zWXS#qgJZ;Sw)OYH5A?B4|nGa$OuWd_UWFV17<r{_TN8nl#K? zHz4^!k0(&f?He)tla;z)U^xgz@E<&&4iNByw43?CN(H7=yiPn-7kwH&kyS7~(vPa< z32ha>MNjXEQ}k)Ak7qJ>QkIl0ZN0gNbUpiVp5jff&K;0x%M+Cx%zmBk+koZ(wYdXF zJ4Zc3v4g8}D{`LUHo>hE3-3=}O8VXR4dvd+etTnp<SZXK+h8%tbt3usq?f#~9zVzs zRQD}-L_@!+%_CyozgVvgd)vuIez~#l`i#P*ER2&Ka^VpS%QMUWZ}i*iLrzb<f+Uj% zjUxpXY?8SW)}84yaB<eNUFMoZkN0M-qC1KYS8|q<x;(cIacflrsAJ!gxWArfAp10% zK6xJTJC)7iH)IEPJ#0rVe@_E{j3EUki>Z)JMlN--;x5s$V4tbCyH#FA4+$}ja3$Ra zOUc<_>ez%j`G-Zx%rXZo$M~eMTfkqmC(cG-U^NIv@gHYf?f;dOoDgwl=BVHQVi_sV z#j4GA?~ijO=9t0pmtN;upB0@+w{=K9zEp^0^wu&URojd_`9NzE6#mA<izZlqM8-Gh zF73JtFftEJ7jcN4DQ>~f&ZRJ2o*$c(t&0k+ni({@3IBnxL%FBpUuB@F0te6ar8?M9 z-C4DYyu&4KX8M(|cL3Kqe4W%3H46W>8!iuJ3K8>Nf(*yx-+i6FYKvtEYr$vMnNL$j z!sC<?^&qYTx+Ua(RmlDXgmoF&*TkL5oXlaH1!JgFnLpLdE1C$P?Zv4!>*!kAKQ@{P zC_PC>ht5Fg(eG872p0j!udp%e&iq|v>zIGb?JZD=(0C3&+4Kaa?LnS}4@ZcYi{#@* z0Yl?i<vU=UMK)B}jkvf_9b%E-CB2k3#WSN{GyCCcP?zc)W%6F@K)3e)z%B#982*E; ztnK}n#U7ld?|SFiI7FC3*+{jI=C^)N8=Jt?y!mo{ljStp-r2bbedj3o6W^WiH^X5d zIp(&WlX2^()w4Hj*ZblWQCgPk*Ixpl{8G5rJUI&zCePq5nRSkqIOBOl`%s0e@Yxl^ zvOGtx^J{)tDNN+kD|gLH4&{K%2qj`xUj*KUn_3Jl$E2lFN%{P6fajK3;U9@yFzj?V z4H86f#V3VuR($51^Tavzk#qdx)U03*;r!3(GP0^zMX8^BgnvKttp7I6wc7TqpmrtB zS79)^Y;`v!{vGbDQC9!9k;1MuHbeuV`v%7l3m*yn&ObNGU0;TOBgC{?=ljck+|hKY zWTFE*)@y2(w=8Wq)EQAec&!VH*Au~tZaboUTQd;}IryhTAF~^89Y!~n%+7&eB*GB? z%X&1Z;pdv!1q`eL!8rVbEu#$pyd)iJc{BVthwxaIG8CHT4S%j#@*Z$Z>11tVTikiS zV&FyZ+LkWfpp7-<K}(JqlH_*W0bpDZGOejqCCxWPT-7Fu61nzJAJ3A7E3%fRy2}5` zMFHzQ(d4D=F0*GzEYQH&VyovxuY)w3JRkKs)pLfi+bbuiY*VyArwl)kI8c`nx8@JM zA!nfDVsr1@jy)mPLF{aiozGPsTCYEgmY?0LC<t)FXW&&&zzZLN=R5!>lF`U|6bDke zCD2Q>)!e#czPpR|JjyG6MHUykA`{VV>hGYghDH1p?aOS~LFrNteIF?P#TsJWDSfyU z%K!@E7!Se~;sl%xTY9pS&iT<V;k0D=zX-Dos=_pR6i$;nuHq_<v#8bxm=Oqp%Pbm# zc4*QIvzU7v)mmmfMhj@i)KLea(Bbg03?G#gIq7@aDiqCYG?zss$#GCH08g^pf`LUK z7{7n~wY1s+5AV@G$j(q0xmm*{!kn2QGySK^rQnDa#^FyTQKrVKi8qndoA&wWWT+<C zF`RJ|xJ-;bT0y|V+W=GV_iLS{K@D-7RY(S*ny-bopjpa_5^|DWo<a{mVYmB@ZNBT; zm6gzyJ?9kMc1sQeS`B|(A&82Z!UFowgb&$@|D}=Q9G92vZJcYyfpUS40+gFlB8Dmc zrWy5`d>Q`bp$2hy=3f28z37p9?qeoYFoK8<`3{d0O7$77!EU5cZ`!_8RHe5M(x(3R za}3J}EHhwlkKNv_LpEG)3k$!>7fjy@{%MH<m67elY4Fc13H6QuUOh7VG<3H`<!$Ce zfh44`+0;{Uz<{sR(z)F$;nEDUc3XDbFV`X=IAkybYir@G*Mc39n<JKJGQHO=yg5v4 zaMZeKo9iN?)|bVY%ARAw$+{(;NN4R&;9>rP1<^n-@euHkZB7ZfEWiuEjrt>b8mVib z>#wmC9tXK_Sq`B~fzMqOjCNTmuCtAa%*?0roYwDDgE~;AA~!F#1FG`vXu?+USUlzC zylAvxH>!TP+9Lf(^;#&Q$7+Ld4ARuni?R7&yC&}j$Js`_o#9-5SD&29Wqrz%JlZB- zj)w^Am1CGW-^-J`i&UYYPHOO~TBP55FTCc2=IbKs9i|$y4S=;fD6!xYHMO&Ad<5}J z0Qj)Mu#=kIZfXhXYqPLmdd(d5HNNy^7q_9yVZ~`>xV9==BgRn1f|CYbO;^Ol4}7e) zOJ;<=mzxoZeCy`%SV(|u&1$r*&Ql*kxLmZ~78cs2B~wH06A!CR7{909g&zE`ccHr; zdRM6R0o0)#2LSS~VGtgqf4i}uu_-1LJSvY33F&kV+eVtdWzhoY3htKeI!<+U>%*9t zTpjZjrfglRg6Orc1j&UEb<+IojrvD@l2P#;GQH@!lzfnWNxu2RmKQ*E`|WH^S1}W% zCh?DwU<019h(Nt7+SF#D^9F(vn~6`j4ry2!q9tAB{2J<PJyC0*=pj+fCNq^B<#MKX zgG}q>yVEL6s|9>lMohEa&t|4n{+$~LK~0vo@10BN;PQ=dsAScs%P!i|-ZsHrRNp0U zTEY%NalSEj_6znDto&JRr00LKHT>OiLErFfNtPCQlx14~#hiPL2Zc2!x_g9aTltud zC`Yusx2&2d`5pT()jo+8f<gPTm%#;DW~$Kp4_%1U=!-Qv#%8h(hJ4>6eVNg0@2|K? z;h>H<DEre<+ImlE&vPy0%k4maNW%mNJMtR0DDE-i-$l|#YVd>~!jRAF5-hWxOP{@O z6C>j1rGh_F^Zuq_snSw~hda8zz0sR}<69wP_raK?O%4Cg2kSsV+OvUuvF@qP-Bqre zempPPXtv^*@=BrmfR3rn5soe(N4((4qC4)9=C5}3s}ntMqPRrc&P3^@y+p&l-W9Ur z*K3oF_b<Xtvb~j|3-=8M;(<<TKT(_Jht8eYsV51@6x5pDCVP=3xiPWJW47xiRU3OP z%YDNx_n#U*AGAYR4q=j)=4L*W7ru#ex#F`LS*B=q`UdudW}DGITV}U(6@kJ!=GI3t zu}{@rjHG~SbN(6<(5=fawh$zYURTo9@K-Q{U{uN1;ze~^AR=pJKz4aJl;Kk6Hwn07 zM@*Z2GH9)!B5ay*myWQ`s|rK%pM(kJM)4{51`Qbp$VX8dSRQ>1&5O%bCsCjXjX%J* zt+-76rP&r2e8l++6@}uZgQA~3mg2boBn-LRec^e|cQjyNA_yk;alU2X()!;@j-J~y zQ~fJPPJT*sH#)TK-NCjUiVoKftG3|U&gmz)qq1?^_*~tZOrW)hk`!H?N_;;%dqSBB z+I(>LS}T~P+r@Ol&gxy`wEt$nVMO!W%HHmJsBI{sdxODy6~Zzpb|To&5qxp|OiBO_ zcoo&Lkx-P}WL|vgQw>d8hGWi0F-Zo<=!<_EeSoKH$^eholpQ^$G&2q0Q%Z}S4kfls z8H$-w{+M8>WJ%3W@s2zFB2rwk6*kh>H&&Aj3z2i_3u80v-m=YW3yMqbnHPVS^YT>Y zQPSRGzV7<V&yK2-8kw_1`SE&w#oR-Znz|m5Um@B6ez_!_Y>syR@_C6N3kGI^U~2y* zC?hRM3my|x-yOk*6jTyPi!LUOi?*rW@R>4^-k*MnRi2!H<`ZbWo5RjIaU<`{Qa$ss z_V&I*{fN!}Qb39K{8=0lzK+W8WfehOiW(H&nV!5o#X!GYUeMbl(@wj~nJtw1MD!6g zIOf@})cC)79p3HT$NF=~PqItuQMK8_DmgUwPiuU<Fb$mk9vgBY1TWp*_b_keK9fs( z%1W`1St<MhU9qD&=@YsHdhPaO#0kD!-oif!f`#(ooZ0W+lGSwctS>`1<mnI8?=wZp z%Whz7(5<SC3MI`Yu_TzT{oKGJ3C}}iQH&i490E0Fv`*N3RRI?gi~YI<njS*gCvM=? z{SvGqQGEHUS8Y|z*hD#Nj#K>7awM9gM~bc3d>#2!n99)eu|Oy^FfafF)BBIA%twfZ z|I$9AKC`c?S<n>uXx~i<{;t3dN!ju?4U%BfM~t5(-Uza_%f7zC!H6!QOM7(jIc-gL z1s!04=nXT)Z^EXqB_&|j=o#u*oHybO-bWd$*V7sMwnJj^>h>2xMEyL@weiy)Nfo#6 zWqR?bbMaTjn#Dni5A156**)F(19-ggXXg=}x|%ltMi20?zZef>lAtUPV>%tGJnnO+ zUjHD*#HgxVT{7^Y-PEsQ)-&z84NKt-Gs@?@@?O_H*D)iq-)mMgPW0&1@7DYg*5szM zZX(qzQ3nT*c-LY{j+tDGCba}+3GUylxc*lU0mi`xAegCtT(mv{{;U1_?)2T91Zx}y z6j(kYr3qxv&|NEq6}+bXFj2s}3ul0RbxXpxxU@kRK2&HiH?|)mz30q}Lf{qiX;Ei- z%`Y|u^X0<sD}h!@16Tv`8?_HVOCmiaWea7S<bM7ecfHR9l%MR8ez2$Kk${Nmvplhc zC4`b#1x6FJ$p98D9IM*=VRKp*v_K1NHbd#{gQ|}A3HDY{$)^+tDx6?ghvD!h%}lbV zngiet&IQ42{rhst8ts4=$T9!`E0D-E%+D(@B&zSnWEyblFzBIArk-2$bRZY-cp$g_ zu|=dR&n=46E4wkJcJ<*fGe<!4DLGEtyBhD|kk==`UYdg;%xcTYbm4;h`uS-B1n7a2 zK`@t(Z76=B4txa63grAwJBIuack4MW=MxFW2NI7@Ll@&I|N8*Mg$Skc9ifwuU3>~; z342QmMszE9D+_nM5$30!{0Is30^wgEG&Q|{fdm!-KDMC`fi9l|u|5T&eF*eey%)by z@_rhx4vLBuq_xev6O+mG-LJFbT1`xspJK>@lRz&B{)?gd?<1@Nv+07UkPt5ro<mSQ zg&=wek@(0Epa`k?s0#rAMW1jiM=GCT0FhFY1r%f)LjKU3BC9}vx{z}a)S(ZQJ;cfX E0pPKgbN~PV literal 0 HcmV?d00001 diff --git a/appasar/canary/app_bootstrap/windowsUtils.js b/appasar/canary/app_bootstrap/windowsUtils.js new file mode 100644 index 0000000..85d0a46 --- /dev/null +++ b/appasar/canary/app_bootstrap/windowsUtils.js @@ -0,0 +1,89 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.spawn = spawn; +exports.spawnReg = spawnReg; +exports.addToRegistry = addToRegistry; + +var _child_process = require('child_process'); + +var _child_process2 = _interopRequireDefault(_child_process); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var regExe = process.env.SystemRoot ? _path2.default.join(process.env.SystemRoot, 'System32', 'reg.exe') : 'reg.exe'; + +// Spawn a command and invoke the callback when it completes with an error +// and the output from standard out. +function spawn(command, args, callback) { + var stdout = ''; + + var spawnedProcess = void 0; + try { + // TODO: contrary to below, it should not throw any error + spawnedProcess = _child_process2.default.spawn(command, args); + } catch (err) { + // Spawn can throw an error + process.nextTick(function () { + if (callback != null) { + callback(err, stdout); + } + }); + return; + } + + // TODO: we need to specify the encoding for the data if we're going to concat it as a string + spawnedProcess.stdout.on('data', function (data) { + stdout += data; + }); + + var err = null; + // TODO: close event might not get called, we should + // callback on error https://nodejs.org/api/child_process.html#child_process_event_error + spawnedProcess.on('error', function (err) { + // TODO: there should always be an error + if (err != null) { + err = err; + } + }); + + // TODO: don't listen to close, but listen to exit instead + spawnedProcess.on('close', function (code, signal) { + if (err === null && code !== 0) { + err = new Error('Command failed: ' + (signal || code)); + } + if (err != null) { + err.code = err.code || code; + err.stdout = err.stdout || stdout; + } + if (callback != null) { + callback(err, stdout); + } + }); +} + +// Spawn reg.exe and callback when it completes +function spawnReg(args, callback) { + return spawn(regExe, args, callback); +} + +// TODO: since we're doing this one by one, we could have a more graceful way of processing the queue +// rather than mutating the array +function addToRegistry(queue, callback) { + if (queue.length === 0) { + return callback && callback(); + } + + var args = queue.shift(); + args.unshift('add'); + args.push('/f'); + return spawnReg(args, function () { + return addToRegistry(queue, callback); + }); +} \ No newline at end of file diff --git a/appasar/canary/common/Backoff.js b/appasar/canary/common/Backoff.js new file mode 100644 index 0000000..65eb0fb --- /dev/null +++ b/appasar/canary/common/Backoff.js @@ -0,0 +1,127 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +// copied from discord_app/lib because including from there is broken. + +var Backoff = function () { + + /** + * Create a backoff instance can automatically backoff retries. + */ + function Backoff() { + var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500; + var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var jitter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + + _classCallCheck(this, Backoff); + + this.min = min; + this.max = max != null ? max : min * 10; + this.jitter = jitter; + + this._current = min; + this._timeoutId = null; + this._fails = 0; + } + + /** + * Return the number of failures. + */ + + + _createClass(Backoff, [{ + key: 'succeed', + + + /** + * Clear any pending callbacks and reset the backoff. + */ + value: function succeed() { + this.cancel(); + this._fails = 0; + this._current = this.min; + } + + /** + * Increment the backoff and schedule a callback if provided. + */ + + }, { + key: 'fail', + value: function fail(callback) { + var _this = this; + + this._fails += 1; + var delay = this._current * 2; + if (this.jitter) { + delay *= Math.random(); + } + this._current = Math.min(this._current + delay, this.max); + if (callback != null) { + if (this._timeoutId != null) { + throw new Error('callback already pending'); + } + this._timeoutId = setTimeout(function () { + try { + if (callback != null) { + callback(); + } + } finally { + _this._timeoutId = null; + } + }, this._current); + } + return this._current; + } + + /** + * Clear any pending callbacks. + */ + + }, { + key: 'cancel', + value: function cancel() { + if (this._timeoutId != null) { + clearTimeout(this._timeoutId); + this._timeoutId = null; + } + } + }, { + key: 'fails', + get: function get() { + return this._fails; + } + + /** + * Current backoff value in milliseconds. + */ + + }, { + key: 'current', + get: function get() { + return this._current; + } + + /** + * A callback is going to fire. + */ + + }, { + key: 'pending', + get: function get() { + return this._timeoutId != null; + } + }]); + + return Backoff; +}(); + +exports.default = Backoff; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/common/FeatureFlags.js b/appasar/canary/common/FeatureFlags.js new file mode 100644 index 0000000..b8f919e --- /dev/null +++ b/appasar/canary/common/FeatureFlags.js @@ -0,0 +1,44 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var FeatureFlags = function () { + function FeatureFlags() { + _classCallCheck(this, FeatureFlags); + + this.flags = new Set(); + } + + _createClass(FeatureFlags, [{ + key: 'getSupported', + value: function getSupported() { + return Array.from(this.flags); + } + }, { + key: 'supports', + value: function supports(feature) { + return this.flags.has(feature); + } + }, { + key: 'declareSupported', + value: function declareSupported(feature) { + if (this.supports(feature)) { + console.error('Feature redeclared; is this a duplicate flag? ', feature); + return; + } + + this.flags.add(feature); + } + }]); + + return FeatureFlags; +}(); + +exports.default = FeatureFlags; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/common/Settings.js b/appasar/canary/common/Settings.js new file mode 100644 index 0000000..7392ba0 --- /dev/null +++ b/appasar/canary/common/Settings.js @@ -0,0 +1,88 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _fs = require('fs'); + +var _fs2 = _interopRequireDefault(_fs); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +// TODO: sync fs operations could cause slowdown and/or freezes, depending on usage +// if this is fine, remove this todo +var Settings = function () { + function Settings(root) { + _classCallCheck(this, Settings); + + this.path = _path2.default.join(root, 'settings.json'); + try { + this.lastSaved = _fs2.default.readFileSync(this.path); + this.settings = JSON.parse(this.lastSaved); + } catch (e) { + this.lastSaved = ''; + this.settings = {}; + } + this.lastModified = this._lastModified(); + } + + _createClass(Settings, [{ + key: '_lastModified', + value: function _lastModified() { + try { + return _fs2.default.statSync(this.path).mtime.getTime(); + } catch (e) { + return 0; + } + } + }, { + key: 'get', + value: function get(key) { + var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (this.settings.hasOwnProperty(key)) { + return this.settings[key]; + } + + return defaultValue; + } + }, { + key: 'set', + value: function set(key, value) { + this.settings[key] = value; + } + }, { + key: 'save', + value: function save() { + if (this.lastModified && this.lastModified !== this._lastModified()) { + console.warn('Not saving settings, it has been externally modified.'); + return; + } + + try { + var toSave = JSON.stringify(this.settings, null, 2); + if (this.lastSaved != toSave) { + this.lastSaved = toSave; + _fs2.default.writeFileSync(this.path, toSave); + this.lastModified = this._lastModified(); + } + } catch (err) { + console.warn('Failed saving settings with error: ', err); + } + } + }]); + + return Settings; +}(); + +exports.default = Settings; +module.exports = exports['default']; \ No newline at end of file diff --git a/appasar/canary/common/moduleUpdater.js b/appasar/canary/common/moduleUpdater.js new file mode 100644 index 0000000..be30997 --- /dev/null +++ b/appasar/canary/common/moduleUpdater.js @@ -0,0 +1,944 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.events = exports.NO_PENDING_UPDATES = exports.INSTALLING_MODULE_PROGRESS = exports.INSTALLING_MODULE = exports.INSTALLING_MODULES_FINISHED = exports.DOWNLOADED_MODULE = exports.UPDATE_MANUALLY = exports.DOWNLOADING_MODULES_FINISHED = exports.DOWNLOADING_MODULE_PROGRESS = exports.DOWNLOADING_MODULE = exports.UPDATE_CHECK_FINISHED = exports.INSTALLED_MODULE = exports.CHECKING_FOR_UPDATES = undefined; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +exports.initPathsOnly = initPathsOnly; +exports.init = init; +exports.checkForUpdates = checkForUpdates; +exports.quitAndInstallUpdates = quitAndInstallUpdates; +exports.isInstalled = isInstalled; +exports.getInstalled = getInstalled; +exports.install = install; +exports.installPendingUpdates = installPendingUpdates; + +var _fs = require('fs'); + +var _fs2 = _interopRequireDefault(_fs); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _module = require('module'); + +var _module2 = _interopRequireDefault(_module); + +var _events = require('events'); + +var _mkdirp = require('mkdirp'); + +var _mkdirp2 = _interopRequireDefault(_mkdirp); + +var _yauzl = require('yauzl'); + +var _yauzl2 = _interopRequireDefault(_yauzl); + +var _paths = require('./paths'); + +var paths = _interopRequireWildcard(_paths); + +var _Backoff = require('./Backoff'); + +var _Backoff2 = _interopRequireDefault(_Backoff); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Manages additional module installation and management. +// We add the module folder path to require() lookup paths here. + +// undocumented node API + + +var originalFs = require('original-fs'); + +var Events = function (_EventEmitter) { + _inherits(Events, _EventEmitter); + + function Events() { + _classCallCheck(this, Events); + + return _possibleConstructorReturn(this, (Events.__proto__ || Object.getPrototypeOf(Events)).apply(this, arguments)); + } + + _createClass(Events, [{ + key: 'emit', + value: function emit() { + var _this2 = this; + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + process.nextTick(function () { + return _get(Events.prototype.__proto__ || Object.getPrototypeOf(Events.prototype), 'emit', _this2).apply(_this2, args); + }); + } + }]); + + return Events; +}(_events.EventEmitter); + +var LogStream = function () { + function LogStream(logPath) { + _classCallCheck(this, LogStream); + + try { + this.logStream = _fs2.default.createWriteStream(logPath, { flags: 'a' }); + } catch (e) { + console.error('Failed to create ' + logPath + ': ' + String(e)); + } + } + + _createClass(LogStream, [{ + key: 'log', + value: function log(message) { + message = '[Modules] ' + message; + console.log(message); + if (this.logStream) { + this.logStream.write(message); + this.logStream.write('\r\n'); + } + } + }, { + key: 'end', + value: function end() { + if (this.logStream) { + this.logStream.end(); + this.logStream = null; + } + } + }]); + + return LogStream; +}(); + +// events + + +var CHECKING_FOR_UPDATES = exports.CHECKING_FOR_UPDATES = 'checking-for-updates'; +var INSTALLED_MODULE = exports.INSTALLED_MODULE = 'installed-module'; +var UPDATE_CHECK_FINISHED = exports.UPDATE_CHECK_FINISHED = 'update-check-finished'; +var DOWNLOADING_MODULE = exports.DOWNLOADING_MODULE = 'downloading-module'; +var DOWNLOADING_MODULE_PROGRESS = exports.DOWNLOADING_MODULE_PROGRESS = 'downloading-module-progress'; +var DOWNLOADING_MODULES_FINISHED = exports.DOWNLOADING_MODULES_FINISHED = 'downloading-modules-finished'; +var UPDATE_MANUALLY = exports.UPDATE_MANUALLY = 'update-manually'; +var DOWNLOADED_MODULE = exports.DOWNLOADED_MODULE = 'downloaded-module'; +var INSTALLING_MODULES_FINISHED = exports.INSTALLING_MODULES_FINISHED = 'installing-modules-finished'; +var INSTALLING_MODULE = exports.INSTALLING_MODULE = 'installing-module'; +var INSTALLING_MODULE_PROGRESS = exports.INSTALLING_MODULE_PROGRESS = 'installing-module-progress'; +var NO_PENDING_UPDATES = exports.NO_PENDING_UPDATES = 'no-pending-updates'; + +// settings +var ALWAYS_ALLOW_UPDATES = 'ALWAYS_ALLOW_UPDATES'; +var SKIP_HOST_UPDATE = 'SKIP_HOST_UPDATE'; +var SKIP_MODULE_UPDATE = 'SKIP_MODULE_UPDATE'; +var ALWAYS_BOOTSTRAP_MODULES = 'ALWAYS_BOOTSTRAP_MODULES'; +var USE_LOCAL_MODULE_VERSIONS = 'USE_LOCAL_MODULE_VERSIONS'; + +var request = require('../app_bootstrap/request'); +var REQUEST_TIMEOUT = 15000; +var backoff = new _Backoff2.default(1000, 20000); +var events = exports.events = new Events(); + +var logger = void 0; +var locallyInstalledModules = void 0; +var moduleInstallPath = void 0; +var installedModulesFilePath = void 0; +var moduleDownloadPath = void 0; +var bootstrapping = void 0; +var hostUpdater = void 0; +var hostUpdateAvailable = void 0; +var skipHostUpdate = void 0; +var skipModuleUpdate = void 0; +var checkingForUpdates = void 0; +var remoteBaseURL = void 0; +var remoteQuery = void 0; +var settings = void 0; +var remoteModuleVersions = void 0; +var installedModules = void 0; +var download = void 0; +var unzip = void 0; +var newInstallInProgress = void 0; +var localModuleVersionsFilePath = void 0; +var updatable = void 0; +var bootstrapManifestFilePath = void 0; + +function initPathsOnly(_buildInfo) { + if (locallyInstalledModules || moduleInstallPath) { + return; + } + + // If we have `localModulesRoot` in our buildInfo file, we do not fetch modules + // from remote, and rely on our locally bundled ones. + // Typically used for development mode, or private builds. + locallyInstalledModules = _buildInfo.localModulesRoot != null; + + if (locallyInstalledModules) { + if (_module2.default.globalPaths.indexOf(_buildInfo.localModulesRoot) === -1) { + _module2.default.globalPaths.push(_buildInfo.localModulesRoot); + } + } else { + moduleInstallPath = _path2.default.join(paths.getUserDataVersioned(), 'modules'); + if (_module2.default.globalPaths.indexOf(moduleInstallPath) === -1) { + _module2.default.globalPaths.push(moduleInstallPath); + } + } +} + +function init(_endpoint, _settings, _buildInfo) { + var endpoint = _endpoint; + settings = _settings; + var buildInfo = _buildInfo; + updatable = buildInfo.version != '0.0.0' && !buildInfo.debug || settings.get(ALWAYS_ALLOW_UPDATES); + + initPathsOnly(buildInfo); + + logger = new LogStream(_path2.default.join(paths.getUserData(), 'modules.log')); + bootstrapping = false; + hostUpdateAvailable = false; + checkingForUpdates = false; + skipHostUpdate = settings.get(SKIP_HOST_UPDATE) || !updatable; + skipModuleUpdate = settings.get(SKIP_MODULE_UPDATE) || locallyInstalledModules || !updatable; + localModuleVersionsFilePath = _path2.default.join(paths.getUserData(), 'local_module_versions.json'); + bootstrapManifestFilePath = _path2.default.join(paths.getResources(), 'bootstrap', 'manifest.json'); + installedModules = {}; + remoteModuleVersions = {}; + newInstallInProgress = {}; + + download = { + // currently downloading + active: false, + // {name, version} + queue: [], + // current queue index being downloaded + next: 0, + // download failure count + failures: 0 + }; + + unzip = { + // currently unzipping + active: false, + // {name, version, zipfile} + queue: [], + // current queue index being unzipped + next: 0, + // unzip failure count + failures: 0 + }; + + logger.log('Modules initializing'); + logger.log('Distribution: ' + (locallyInstalledModules ? 'local' : 'remote')); + logger.log('Host updates: ' + (skipHostUpdate ? 'disabled' : 'enabled')); + logger.log('Module updates: ' + (skipModuleUpdate ? 'disabled' : 'enabled')); + + if (!locallyInstalledModules) { + installedModulesFilePath = _path2.default.join(moduleInstallPath, 'installed.json'); + moduleDownloadPath = _path2.default.join(moduleInstallPath, 'pending'); + _mkdirp2.default.sync(moduleDownloadPath); + + logger.log('Module install path: ' + moduleInstallPath); + logger.log('Module installed file path: ' + installedModulesFilePath); + logger.log('Module download path: ' + moduleDownloadPath); + + var failedLoadingInstalledModules = false; + try { + installedModules = JSON.parse(_fs2.default.readFileSync(installedModulesFilePath)); + } catch (err) { + failedLoadingInstalledModules = true; + } + + cleanDownloadedModules(installedModules); + + bootstrapping = failedLoadingInstalledModules || settings.get(ALWAYS_BOOTSTRAP_MODULES); + } + + hostUpdater = require('../app_bootstrap/hostUpdater'); + // TODO: hostUpdater constants + hostUpdater.on('checking-for-update', function () { + return events.emit(CHECKING_FOR_UPDATES); + }); + hostUpdater.on('update-available', function () { + return hostOnUpdateAvailable(); + }); + hostUpdater.on('update-progress', function (progress) { + return hostOnUpdateProgress(progress); + }); + hostUpdater.on('update-not-available', function () { + return hostOnUpdateNotAvailable(); + }); + hostUpdater.on('update-manually', function (newVersion) { + return hostOnUpdateManually(newVersion); + }); + hostUpdater.on('update-downloaded', function () { + return hostOnUpdateDownloaded(); + }); + hostUpdater.on('error', function (err) { + return hostOnError(err); + }); + var setFeedURL = hostUpdater.setFeedURL.bind(hostUpdater); + + remoteBaseURL = endpoint + '/modules/' + buildInfo.releaseChannel; + // eslint-disable-next-line camelcase + remoteQuery = { host_version: buildInfo.version }; + + switch (process.platform) { + case 'darwin': + setFeedURL(endpoint + '/updates/' + buildInfo.releaseChannel + '?platform=osx&version=' + buildInfo.version); + remoteQuery.platform = 'osx'; + break; + case 'win32': + // Squirrel for Windows can't handle query params + // https://github.com/Squirrel/Squirrel.Windows/issues/132 + setFeedURL(endpoint + '/updates/' + buildInfo.releaseChannel); + remoteQuery.platform = 'win'; + break; + case 'linux': + setFeedURL(endpoint + '/updates/' + buildInfo.releaseChannel + '?platform=linux&version=' + buildInfo.version); + remoteQuery.platform = 'linux'; + break; + } +} + +function cleanDownloadedModules(installedModules) { + try { + var entries = _fs2.default.readdirSync(moduleDownloadPath) || []; + entries.forEach(function (entry) { + var entryPath = _path2.default.join(moduleDownloadPath, entry); + var isStale = true; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = Object.keys(installedModules)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var moduleName = _step.value; + + if (entryPath === installedModules[moduleName].updateZipfile) { + isStale = false; + break; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + if (isStale) { + _fs2.default.unlinkSync(_path2.default.join(moduleDownloadPath, entry)); + } + }); + } catch (err) { + logger.log('Could not clean downloaded modules'); + logger.log(err.stack); + } +} + +function hostOnUpdateAvailable() { + logger.log('Host update is available.'); + hostUpdateAvailable = true; + events.emit(UPDATE_CHECK_FINISHED, true, 1, false); + events.emit(DOWNLOADING_MODULE, 'host', 1, 1); +} + +function hostOnUpdateProgress(progress) { + logger.log('Host update progress: ' + progress + '%'); + events.emit(DOWNLOADING_MODULE_PROGRESS, 'host', progress); +} + +function hostOnUpdateNotAvailable() { + logger.log('Host is up to date.'); + if (!skipModuleUpdate) { + checkForModuleUpdates(); + } else { + events.emit(UPDATE_CHECK_FINISHED, true, 0, false); + } +} + +function hostOnUpdateManually(newVersion) { + logger.log('Host update is available. Manual update required!'); + hostUpdateAvailable = true; + checkingForUpdates = false; + events.emit(UPDATE_MANUALLY, newVersion); + events.emit(UPDATE_CHECK_FINISHED, true, 1, true); +} + +function hostOnUpdateDownloaded() { + logger.log('Host update downloaded.'); + checkingForUpdates = false; + events.emit(DOWNLOADED_MODULE, 'host', 1, 1, true); + events.emit(DOWNLOADING_MODULES_FINISHED, 1, 0); +} + +function hostOnError(err) { + logger.log('Host update failed: ' + err); + + // [adill] osx unsigned builds will fire this code signing error inside setFeedURL and + // if we don't do anything about it hostUpdater.checkForUpdates() will never respond. + if (err && String(err).indexOf('Could not get code signature for running application') !== -1) { + console.warn('Skipping host updates due to code signing failure.'); + skipHostUpdate = true; + } + + checkingForUpdates = false; + if (!hostUpdateAvailable) { + events.emit(UPDATE_CHECK_FINISHED, false, 0, false); + } else { + events.emit(DOWNLOADED_MODULE, 'host', 1, 1, false); + events.emit(DOWNLOADING_MODULES_FINISHED, 0, 1); + } +} + +function checkForUpdates() { + if (checkingForUpdates) return; + + checkingForUpdates = true; + hostUpdateAvailable = false; + if (skipHostUpdate) { + events.emit(CHECKING_FOR_UPDATES); + hostOnUpdateNotAvailable(); + } else { + logger.log('Checking for host updates.'); + hostUpdater.checkForUpdates(); + } +} + +function getRemoteModuleName(name) { + if (process.platform === 'win32' && process.arch === 'x64') { + return name + '.x64'; + } + + return name; +} + +function checkForModuleUpdates() { + var query = _extends({}, remoteQuery, { _: Math.floor(Date.now() / 1000 / 60 / 5) }); + var url = remoteBaseURL + '/versions.json'; + logger.log('Checking for module updates at ' + url); + + request.get({ + url: url, + agent: false, + encoding: null, + qs: query, + timeout: REQUEST_TIMEOUT, + strictSSL: false + }, function (err, response, body) { + checkingForUpdates = false; + + if (!err && response.statusCode !== 200) { + err = new Error('Non-200 response code: ' + response.statusCode); + } + + if (err) { + logger.log('Failed fetching module versions: ' + String(err)); + events.emit(UPDATE_CHECK_FINISHED, false, 0, false); + return; + } + + remoteModuleVersions = JSON.parse(body); + if (settings.get(USE_LOCAL_MODULE_VERSIONS)) { + try { + remoteModuleVersions = JSON.parse(_fs2.default.readFileSync(localModuleVersionsFilePath)); + console.log('Using local module versions: ', remoteModuleVersions); + } catch (err) { + console.warn('Failed to parse local module versions: ', err); + } + } + + var updatesToDownload = []; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = Object.keys(installedModules)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var moduleName = _step2.value; + + var installedModule = installedModules[moduleName]; + var installed = installedModule.installedVersion; + if (installed === null) { + continue; + } + + var update = installedModule.updateVersion || 0; + var remote = remoteModuleVersions[getRemoteModuleName(moduleName)] || 0; + // TODO: strict equality? + if (installed != remote && update != remote) { + logger.log('Module update available: ' + moduleName + '@' + remote + ' [installed: ' + installed + ']'); + updatesToDownload.push({ name: moduleName, version: remote }); + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + + events.emit(UPDATE_CHECK_FINISHED, true, updatesToDownload.length, false); + if (updatesToDownload.length === 0) { + logger.log('No module updates available.'); + } else { + updatesToDownload.forEach(function (e) { + return addModuleToDownloadQueue(e.name, e.version); + }); + } + }); +} + +function addModuleToDownloadQueue(name, version, authToken) { + download.queue.push({ name: name, version: version, authToken: authToken }); + process.nextTick(function () { + return processDownloadQueue(); + }); +} + +function processDownloadQueue() { + if (download.active) return; + if (download.queue.length === 0) return; + + download.active = true; + + var queuedModule = download.queue[download.next]; + download.next += 1; + + events.emit(DOWNLOADING_MODULE, queuedModule.name, download.next, download.queue.length); + + var totalBytes = 1; + var receivedBytes = 0; + var progress = 0; + var hasErrored = false; + + var url = remoteBaseURL + '/' + getRemoteModuleName(queuedModule.name) + '/' + queuedModule.version; + logger.log('Fetching ' + queuedModule.name + '@' + queuedModule.version + ' from ' + url); + var headers = {}; + if (queuedModule.authToken) { + headers['Authorization'] = queuedModule.authToken; + } + request.get({ + url: url, + agent: false, + encoding: null, + followAllRedirects: true, + qs: remoteQuery, + timeout: REQUEST_TIMEOUT, + strictSSL: false, + headers: headers + }).on('error', function (err) { + if (hasErrored) return; + hasErrored = true; + logger.log('Failed fetching ' + queuedModule.name + '@' + queuedModule.version + ': ' + String(err)); + finishModuleDownload(queuedModule.name, queuedModule.version, null, false); + }).on('response', function (response) { + totalBytes = response.headers['content-length'] || 1; + + var moduleZipPath = _path2.default.join(moduleDownloadPath, queuedModule.name + '-' + queuedModule.version + '.zip'); + logger.log('Streaming ' + queuedModule.name + '@' + queuedModule.version + ' [' + totalBytes + ' bytes] to ' + moduleZipPath); + + var stream = _fs2.default.createWriteStream(moduleZipPath); + stream.on('finish', function () { + return finishModuleDownload(queuedModule.name, queuedModule.version, moduleZipPath, response.statusCode === 200); + }); + + response.on('data', function (chunk) { + receivedBytes += chunk.length; + stream.write(chunk); + + var fraction = receivedBytes / totalBytes; + var newProgress = Math.min(Math.floor(100 * fraction), 100); + if (progress != newProgress) { + progress = newProgress; + events.emit(DOWNLOADING_MODULE_PROGRESS, queuedModule.name, progress); + } + }); + + // TODO: on response error + // TODO: on stream error + + response.on('end', function () { + return stream.end(); + }); + }); +} + +function commitInstalledModules() { + var data = JSON.stringify(installedModules, null, 2); + _fs2.default.writeFileSync(installedModulesFilePath, data); +} + +function finishModuleDownload(name, version, zipfile, succeeded) { + if (!installedModules[name]) { + installedModules[name] = {}; + } + + if (succeeded) { + installedModules[name].updateVersion = version; + installedModules[name].updateZipfile = zipfile; + commitInstalledModules(); + } else { + download.failures += 1; + } + + events.emit(DOWNLOADED_MODULE, name, download.next, download.queue.length, succeeded); + + if (download.next >= download.queue.length) { + var successes = download.queue.length - download.failures; + logger.log('Finished module downloads. [success: ' + successes + '] [failure: ' + download.failures + ']'); + events.emit(DOWNLOADING_MODULES_FINISHED, successes, download.failures); + download.queue = []; + download.next = 0; + download.failures = 0; + download.active = false; + } else { + var continueDownloads = function continueDownloads() { + download.active = false; + processDownloadQueue(); + }; + + if (succeeded) { + backoff.succeed(); + process.nextTick(continueDownloads); + } else { + logger.log('Waiting ' + Math.floor(backoff.current) + 'ms before next download.'); + backoff.fail(continueDownloads); + } + } + + if (newInstallInProgress[name]) { + addModuleToUnzipQueue(name, version, zipfile); + } +} + +function addModuleToUnzipQueue(name, version, zipfile) { + unzip.queue.push({ name: name, version: version, zipfile: zipfile }); + process.nextTick(function () { + return processUnzipQueue(); + }); +} + +function processUnzipQueue() { + if (unzip.active) return; + if (unzip.queue.length === 0) return; + + unzip.active = true; + + var queuedModule = unzip.queue[unzip.next]; + unzip.next += 1; + + events.emit(INSTALLING_MODULE, queuedModule.name, unzip.next, unzip.queue.length); + + var hasErrored = false; + var onError = function onError(error, zipfile) { + if (hasErrored) return; + hasErrored = true; + + logger.log('Failed installing ' + queuedModule.name + '@' + queuedModule.version + ': ' + String(error)); + succeeded = false; + if (zipfile) { + zipfile.close(); + } + finishModuleUnzip(queuedModule, succeeded); + }; + + var succeeded = true; + var extractRoot = _path2.default.join(moduleInstallPath, queuedModule.name); + logger.log('Installing ' + queuedModule.name + '@' + queuedModule.version + ' from ' + queuedModule.zipfile); + + var processZipfile = function processZipfile(err, zipfile) { + if (err) { + onError(err, null); + return; + } + + var totalEntries = zipfile.entryCount; + var processedEntries = 0; + + zipfile.on('entry', function (entry) { + processedEntries += 1; + var percent = Math.min(Math.floor(processedEntries / totalEntries * 100), 100); + events.emit(INSTALLING_MODULE_PROGRESS, queuedModule.name, percent); + + // skip directories + if (/\/$/.test(entry.fileName)) { + zipfile.readEntry(); + return; + } + + zipfile.openReadStream(entry, function (err, stream) { + if (err) { + onError(err, zipfile); + return; + } + + stream.on('error', function (e) { + return onError(e, zipfile); + }); + + (0, _mkdirp2.default)(_path2.default.join(extractRoot, _path2.default.dirname(entry.fileName)), function (err) { + if (err) { + onError(err, zipfile); + return; + } + + // [adill] createWriteStream via original-fs is broken in Electron 4.0.0-beta.6 with .asar files + // so we unzip to a temporary filename and rename it afterwards + var tempFileName = _path2.default.join(extractRoot, entry.fileName + '.tmp'); + var finalFileName = _path2.default.join(extractRoot, entry.fileName); + var writeStream = originalFs.createWriteStream(tempFileName); + + writeStream.on('error', function (e) { + stream.destroy(); + try { + originalFs.unlinkSync(tempFileName); + } catch (err) {} + onError(e, zipfile); + }); + + writeStream.on('finish', function () { + try { + originalFs.unlinkSync(finalFileName); + } catch (err) {} + try { + originalFs.renameSync(tempFileName, finalFileName); + } catch (err) { + onError(err, zipfile); + return; + } + zipfile.readEntry(); + }); + + stream.pipe(writeStream); + }); + }); + }); + + zipfile.on('error', function (err) { + onError(err, zipfile); + }); + + zipfile.on('end', function () { + if (!succeeded) return; + + installedModules[queuedModule.name].installedVersion = queuedModule.version; + finishModuleUnzip(queuedModule, succeeded); + }); + + zipfile.readEntry(); + }; + + try { + _yauzl2.default.open(queuedModule.zipfile, { lazyEntries: true, autoClose: true }, processZipfile); + } catch (err) { + onError(err, null); + } +} + +function finishModuleUnzip(unzippedModule, succeeded) { + delete newInstallInProgress[unzippedModule.name]; + delete installedModules[unzippedModule.name].updateZipfile; + delete installedModules[unzippedModule.name].updateVersion; + commitInstalledModules(); + + if (!succeeded) { + unzip.failures += 1; + } + + events.emit(INSTALLED_MODULE, unzippedModule.name, unzip.next, unzip.queue.length, succeeded); + + if (unzip.next >= unzip.queue.length) { + var successes = unzip.queue.length - unzip.failures; + bootstrapping = false; + logger.log('Finished module installations. [success: ' + successes + '] [failure: ' + unzip.failures + ']'); + unzip.queue = []; + unzip.next = 0; + unzip.failures = 0; + unzip.active = false; + events.emit(INSTALLING_MODULES_FINISHED, successes, unzip.failures); + return; + } + + process.nextTick(function () { + unzip.active = false; + processUnzipQueue(); + }); +} + +function quitAndInstallUpdates() { + logger.log('Relaunching to install ' + (hostUpdateAvailable ? 'host' : 'module') + ' updates...'); + if (hostUpdateAvailable) { + hostUpdater.quitAndInstall(); + } else { + relaunch(); + } +} + +function relaunch() { + logger.end(); + + var _require = require('electron'), + app = _require.app; + + app.relaunch(); + app.quit(); +} + +function isInstalled(name, version) { + var metadata = installedModules[name]; + if (locallyInstalledModules) return true; + if (metadata && metadata.installedVersion > 0) { + if (!version) return true; + if (metadata.installedVersion === version) return true; + } + return false; +} + +function getInstalled() { + return _extends({}, installedModules); +} + +function install(name, defer, options) { + var _ref = options || {}, + version = _ref.version, + authToken = _ref.authToken; + + if (isInstalled(name, version)) { + if (!defer) { + events.emit(INSTALLED_MODULE, name, 1, 1, true); + } + return; + } + + if (newInstallInProgress[name]) return; + + if (!updatable) { + logger.log('Not updatable; ignoring request to install ' + name + '...'); + return; + } + + if (defer) { + if (version) { + throw new Error('Cannot defer install for a specific version module (' + name + ', ' + version + ')'); + } + logger.log('Deferred install for ' + name + '...'); + installedModules[name] = { installedVersion: 0 }; + commitInstalledModules(); + } else { + logger.log('Starting to install ' + name + '...'); + if (!version) { + version = remoteModuleVersions[name] || 0; + } + newInstallInProgress[name] = version; + addModuleToDownloadQueue(name, version, authToken); + } +} + +function installPendingUpdates() { + var updatesToInstall = []; + + if (bootstrapping) { + var modules = {}; + try { + modules = JSON.parse(_fs2.default.readFileSync(bootstrapManifestFilePath)); + } catch (err) {} + + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = Object.keys(modules)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var moduleName = _step3.value; + + installedModules[moduleName] = { installedVersion: 0 }; + var zipfile = _path2.default.join(paths.getResources(), 'bootstrap', moduleName + '.zip'); + updatesToInstall.push({ moduleName: moduleName, update: modules[moduleName], zipfile: zipfile }); + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + } + + var _iteratorNormalCompletion4 = true; + var _didIteratorError4 = false; + var _iteratorError4 = undefined; + + try { + for (var _iterator4 = Object.keys(installedModules)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + var _moduleName = _step4.value; + + var update = installedModules[_moduleName].updateVersion || 0; + var _zipfile = installedModules[_moduleName].updateZipfile; + if (update > 0 && _zipfile != null) { + updatesToInstall.push({ moduleName: _moduleName, update: update, zipfile: _zipfile }); + } + } + } catch (err) { + _didIteratorError4 = true; + _iteratorError4 = err; + } finally { + try { + if (!_iteratorNormalCompletion4 && _iterator4.return) { + _iterator4.return(); + } + } finally { + if (_didIteratorError4) { + throw _iteratorError4; + } + } + } + + if (updatesToInstall.length > 0) { + logger.log((bootstrapping ? 'Bootstrapping' : 'Installing updates') + '...'); + updatesToInstall.forEach(function (e) { + return addModuleToUnzipQueue(e.moduleName, e.update, e.zipfile); + }); + } else { + logger.log('No updates to install'); + events.emit(NO_PENDING_UPDATES); + } +} \ No newline at end of file diff --git a/appasar/canary/common/paths.js b/appasar/canary/common/paths.js new file mode 100644 index 0000000..8cc9069 --- /dev/null +++ b/appasar/canary/common/paths.js @@ -0,0 +1,100 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.cleanOldVersions = cleanOldVersions; +exports.init = init; +exports.getUserData = getUserData; +exports.getUserDataVersioned = getUserDataVersioned; +exports.getResources = getResources; +exports.getModulePath = getModulePath; + +var _fs = require('fs'); + +var _fs2 = _interopRequireDefault(_fs); + +var _mkdirp = require('mkdirp'); + +var _mkdirp2 = _interopRequireDefault(_mkdirp); + +var _path = require('path'); + +var _path2 = _interopRequireDefault(_path); + +var _rimraf = require('rimraf'); + +var _rimraf2 = _interopRequireDefault(_rimraf); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Determines environment-specific paths based on info provided +var originalFs = require('original-fs'); + +var userDataPath = null; +var userDataVersionedPath = null; +var resourcesPath = null; +var modulePath = null; + +function determineAppUserDataRoot() { + var _require = require('electron'), + app = _require.app; + + return app.getPath('appData'); +} + +function determineUserData(userDataRoot, buildInfo) { + return _path2.default.join(userDataRoot, 'discord' + (buildInfo.releaseChannel == 'stable' ? '' : buildInfo.releaseChannel)); +} + +// cleans old version data in the background +function cleanOldVersions(buildInfo) { + var entries = _fs2.default.readdirSync(userDataPath) || []; + entries.forEach(function (entry) { + var fullPath = _path2.default.join(userDataPath, entry); + if (_fs2.default.statSync(fullPath).isDirectory() && entry.indexOf(buildInfo.version) === -1) { + if (entry.match('^[0-9]+.[0-9]+.[0-9]+') != null) { + console.log('Removing old directory ', entry); + (0, _rimraf2.default)(fullPath, originalFs, function (error) { + if (error) { + console.warn('...failed with error: ', error); + } + }); + } + } + }); +} + +function init(buildInfo) { + resourcesPath = _path2.default.join(require.main.filename, '..', '..', '..'); + + var userDataRoot = determineAppUserDataRoot(); + + userDataPath = determineUserData(userDataRoot, buildInfo); + + var _require2 = require('electron'), + app = _require2.app; + + app.setPath('userData', userDataPath); + + userDataVersionedPath = _path2.default.join(userDataPath, buildInfo.version); + _mkdirp2.default.sync(userDataVersionedPath); + + modulePath = buildInfo.localModulesRoot ? buildInfo.localModulesRoot : _path2.default.join(userDataVersionedPath, 'modules'); +} + +function getUserData() { + return userDataPath; +} + +function getUserDataVersioned() { + return userDataVersionedPath; +} + +function getResources() { + return resourcesPath; +} + +function getModulePath() { + return modulePath; +} \ No newline at end of file diff --git a/appasar/canary/node_modules/.bin/mkdirp b/appasar/canary/node_modules/.bin/mkdirp new file mode 120000 index 0000000..017896c --- /dev/null +++ b/appasar/canary/node_modules/.bin/mkdirp @@ -0,0 +1 @@ +../mkdirp/bin/cmd.js \ No newline at end of file diff --git a/appasar/canary/node_modules/.bin/rimraf b/appasar/canary/node_modules/.bin/rimraf new file mode 120000 index 0000000..4cd49a4 --- /dev/null +++ b/appasar/canary/node_modules/.bin/rimraf @@ -0,0 +1 @@ +../rimraf/bin.js \ No newline at end of file diff --git a/appasar/canary/node_modules/.bin/sshpk-conv b/appasar/canary/node_modules/.bin/sshpk-conv new file mode 120000 index 0000000..a2a295c --- /dev/null +++ b/appasar/canary/node_modules/.bin/sshpk-conv @@ -0,0 +1 @@ +../sshpk/bin/sshpk-conv \ No newline at end of file diff --git a/appasar/canary/node_modules/.bin/sshpk-sign b/appasar/canary/node_modules/.bin/sshpk-sign new file mode 120000 index 0000000..766b9b3 --- /dev/null +++ b/appasar/canary/node_modules/.bin/sshpk-sign @@ -0,0 +1 @@ +../sshpk/bin/sshpk-sign \ No newline at end of file diff --git a/appasar/canary/node_modules/.bin/sshpk-verify b/appasar/canary/node_modules/.bin/sshpk-verify new file mode 120000 index 0000000..bfd7e3a --- /dev/null +++ b/appasar/canary/node_modules/.bin/sshpk-verify @@ -0,0 +1 @@ +../sshpk/bin/sshpk-verify \ No newline at end of file diff --git a/appasar/canary/node_modules/.bin/uuid b/appasar/canary/node_modules/.bin/uuid new file mode 120000 index 0000000..b3e45bc --- /dev/null +++ b/appasar/canary/node_modules/.bin/uuid @@ -0,0 +1 @@ +../uuid/bin/uuid \ No newline at end of file diff --git a/appasar/canary/node_modules/.yarn-integrity b/appasar/canary/node_modules/.yarn-integrity new file mode 100644 index 0000000..5334b64 --- /dev/null +++ b/appasar/canary/node_modules/.yarn-integrity @@ -0,0 +1,101 @@ +{ + "systemParams": "linux-x64-57", + "modulesFolders": [ + "node_modules" + ], + "flags": [ + "production" + ], + "linkedModules": [], + "topLevelPatterns": [ + "devtron@1.4.0", + "mkdirp@^0.5.1", + "request@2.83.0", + "rimraf@^2.5.2", + "yauzl@^2.5.0" + ], + "lockfileEntries": { + "accessibility-developer-tools@^2.11.0": "https://registry.yarnpkg.com/accessibility-developer-tools/-/accessibility-developer-tools-2.12.0.tgz#3da0cce9d6ec6373964b84f35db7cfc3df7ab514", + "ajv@^5.1.0": "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965", + "asn1@~0.2.3": "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86", + "assert-plus@1.0.0": "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525", + "assert-plus@^1.0.0": "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525", + "asynckit@^0.4.0": "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79", + "aws-sign2@~0.7.0": "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8", + "aws4@^1.6.0": "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e", + "balanced-match@^1.0.0": "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767", + "bcrypt-pbkdf@^1.0.0": "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d", + "boom@4.x.x": "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31", + "boom@5.x.x": "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02", + "brace-expansion@^1.1.7": "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292", + "buffer-crc32@~0.2.3": "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242", + "caseless@~0.12.0": "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc", + "co@^4.6.0": "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184", + "combined-stream@1.0.6": "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818", + "combined-stream@~1.0.5": "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009", + "concat-map@0.0.1": "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "core-util-is@1.0.2": "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7", + "cryptiles@3.x.x": "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe", + "dashdash@^1.12.0": "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0", + "delayed-stream@~1.0.0": "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619", + "devtron@1.4.0": "https://registry.yarnpkg.com/devtron/-/devtron-1.4.0.tgz#b5e748bd6e95bbe70bfcc68aae6fe696119441e1", + "ecc-jsbn@~0.1.1": "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505", + "extend@~3.0.1": "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444", + "extsprintf@1.3.0": "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05", + "extsprintf@^1.2.0": "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f", + "fast-deep-equal@^1.0.0": "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614", + "fast-json-stable-stringify@^2.0.0": "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2", + "fd-slicer@~1.0.1": "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65", + "forever-agent@~0.6.1": "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91", + "form-data@~2.3.1": "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099", + "fs.realpath@^1.0.0": "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f", + "getpass@^0.1.1": "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa", + "glob@^7.0.5": "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15", + "har-schema@^2.0.0": "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92", + "har-validator@~5.0.3": "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd", + "hawk@~6.0.2": "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038", + "highlight.js@^9.3.0": "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e", + "hoek@4.x.x": "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb", + "http-signature@~1.2.0": "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1", + "humanize-plus@^1.8.1": "https://registry.yarnpkg.com/humanize-plus/-/humanize-plus-1.8.2.tgz#a65b34459ad6367adbb3707a82a3c9f916167030", + "inflight@^1.0.4": "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9", + "inherits@2": "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de", + "is-typedarray@~1.0.0": "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a", + "isstream@~0.1.2": "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a", + "jsbn@~0.1.0": "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513", + "json-schema-traverse@^0.3.0": "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340", + "json-schema@0.2.3": "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13", + "json-stringify-safe@~5.0.1": "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb", + "jsprim@^1.2.2": "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2", + "mime-db@~1.33.0": "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db", + "mime-types@^2.1.12": "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8", + "mime-types@~2.1.17": "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8", + "minimatch@^3.0.4": "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083", + "minimist@0.0.8": "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d", + "mkdirp@^0.5.1": "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903", + "oauth-sign@~0.8.2": "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43", + "once@^1.3.0": "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1", + "path-is-absolute@^1.0.0": "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f", + "pend@~1.2.0": "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50", + "performance-now@^2.1.0": "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b", + "punycode@^1.4.1": "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e", + "qs@~6.5.1": "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8", + "request@2.83.0": "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356", + "rimraf@^2.5.2": "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36", + "safe-buffer@^5.0.1": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853", + "safe-buffer@^5.1.1": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853", + "sntp@2.x.x": "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8", + "sshpk@^1.7.0": "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3", + "stringstream@~0.0.5": "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878", + "tough-cookie@~2.3.3": "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655", + "tunnel-agent@^0.6.0": "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd", + "tweetnacl@^0.14.3": "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64", + "tweetnacl@~0.14.0": "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64", + "uuid@^3.1.0": "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14", + "verror@1.10.0": "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400", + "wrappy@1": "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f", + "yauzl@^2.5.0": "https://registry.yarnpkg.com/yauzl/-/yauzl-2.9.1.tgz#a81981ea70a57946133883f029c5821a89359a7f" + }, + "files": [], + "artifacts": {} +} \ No newline at end of file diff --git a/appasar/canary/node_modules/ajv/.tonic_example.js b/appasar/canary/node_modules/ajv/.tonic_example.js new file mode 100644 index 0000000..aa11812 --- /dev/null +++ b/appasar/canary/node_modules/ajv/.tonic_example.js @@ -0,0 +1,20 @@ +var Ajv = require('ajv'); +var ajv = new Ajv({allErrors: true}); + +var schema = { + "properties": { + "foo": { "type": "string" }, + "bar": { "type": "number", "maximum": 3 } + } +}; + +var validate = ajv.compile(schema); + +test({"foo": "abc", "bar": 2}); +test({"foo": 2, "bar": 4}); + +function test(data) { + var valid = validate(data); + if (valid) console.log('Valid!'); + else console.log('Invalid: ' + ajv.errorsText(validate.errors)); +} \ No newline at end of file diff --git a/appasar/canary/node_modules/ajv/LICENSE b/appasar/canary/node_modules/ajv/LICENSE new file mode 100644 index 0000000..8105396 --- /dev/null +++ b/appasar/canary/node_modules/ajv/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/appasar/canary/node_modules/ajv/README.md b/appasar/canary/node_modules/ajv/README.md new file mode 100644 index 0000000..387c81d --- /dev/null +++ b/appasar/canary/node_modules/ajv/README.md @@ -0,0 +1,1327 @@ +<img align="right" alt="Ajv logo" width="160" src="http://epoberezkin.github.io/ajv/images/ajv_logo.png"> + +# Ajv: Another JSON Schema Validator + +The fastest JSON Schema validator for Node.js and browser with draft 6 support. + + +[![Build Status](https://travis-ci.org/epoberezkin/ajv.svg?branch=master)](https://travis-ci.org/epoberezkin/ajv) +[![npm version](https://badge.fury.io/js/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm@beta](https://img.shields.io/npm/v/ajv/beta.svg)](https://github.com/epoberezkin/ajv/tree/beta) +[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) +[![Coverage Status](https://coveralls.io/repos/epoberezkin/ajv/badge.svg?branch=master&service=github)](https://coveralls.io/github/epoberezkin/ajv?branch=master) +[![Greenkeeper badge](https://badges.greenkeeper.io/epoberezkin/ajv.svg)](https://greenkeeper.io/) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) + + +__Please note__: Ajv [version 6](https://github.com/epoberezkin/ajv/tree/beta) with [JSON Schema draft-07](http://json-schema.org/work-in-progress) support is released. Use `npm install ajv@beta` to install. + + +## Using version 5 + +[JSON Schema draft-06](https://trac.tools.ietf.org/html/draft-wright-json-schema-validation-01) is published. + +[Ajv version 5.0.0](https://github.com/epoberezkin/ajv/releases/tag/5.0.0) that supports draft-06 is released. It may require either migrating your schemas or updating your code (to continue using draft-04 and v5 schemas). + +__Please note__: To use Ajv with draft-04 schemas you need to explicitly add meta-schema to the validator instance: + +```javascript +ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json')); +``` + + +## Contents + +- [Performance](#performance) +- [Features](#features) +- [Getting started](#getting-started) +- [Frequently Asked Questions](https://github.com/epoberezkin/ajv/blob/master/FAQ.md) +- [Using in browser](#using-in-browser) +- [Command line interface](#command-line-interface) +- Validation + - [Keywords](#validation-keywords) + - [Formats](#formats) + - [Combining schemas with $ref](#ref) + - [$data reference](#data-reference) + - NEW: [$merge and $patch keywords](#merge-and-patch-keywords) + - [Defining custom keywords](#defining-custom-keywords) + - [Asynchronous schema compilation](#asynchronous-schema-compilation) + - [Asynchronous validation](#asynchronous-validation) +- Modifying data during validation + - [Filtering data](#filtering-data) + - [Assigning defaults](#assigning-defaults) + - [Coercing data types](#coercing-data-types) +- API + - [Methods](#api) + - [Options](#options) + - [Validation errors](#validation-errors) +- [Related packages](#related-packages) +- [Packages using Ajv](#some-packages-using-ajv) +- [Tests, Contributing, History, License](#tests) + + +## Performance + +Ajv generates code using [doT templates](https://github.com/olado/doT) to turn JSON schemas into super-fast validation functions that are efficient for v8 optimization. + +Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks: + +- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place +- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster +- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) +- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) + + +Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark): + +[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=32,4,1&chs=600x416&chxl=-1:|djv|ajv|json-schema-validator-generator|jsen|is-my-json-valid|themis|z-schema|jsck|skeemas|json-schema-library|tv4&chd=t:100,98,72.1,66.8,50.1,15.1,6.1,3.8,1.2,0.7,0.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) + + +## Features + +- Ajv implements full JSON Schema [draft 6](http://json-schema.org/) and draft 4 standards: + - all validation keywords (see [JSON Schema validation keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md)) + - full support of remote refs (remote schemas have to be added with `addSchema` or compiled to be available) + - support of circular references between schemas + - correct string lengths for strings with unicode pairs (can be turned off) + - [formats](#formats) defined by JSON Schema draft 4 standard and custom formats (can be turned off) + - [validates schemas against meta-schema](#api-validateschema) +- supports [browsers](#using-in-browser) and Node.js 0.10-8.x +- [asynchronous loading](#asynchronous-schema-compilation) of referenced schemas during compilation +- "All errors" validation mode with [option allErrors](#options) +- [error messages with parameters](#validation-errors) describing error reasons to allow creating custom error messages +- i18n error messages support with [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) package +- [filtering data](#filtering-data) from additional properties +- [assigning defaults](#assigning-defaults) to missing properties and items +- [coercing data](#coercing-data-types) to the types specified in `type` keywords +- [custom keywords](#defining-custom-keywords) +- draft-6 keywords `const`, `contains` and `propertyNames` +- draft-6 boolean schemas (`true`/`false` as a schema to always pass/fail). +- keywords `switch`, `patternRequired`, `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` from [JSON-schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) with [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package +- [$data reference](#data-reference) to use values from the validated data as values for the schema keywords +- [asynchronous validation](#asynchronous-validation) of custom formats and keywords + +Currently Ajv is the only validator that passes all the tests from [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) (according to [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark), apart from the test that requires that `1.0` is not an integer that is impossible to satisfy in JavaScript). + + +## Install + +``` +npm install ajv +``` + +or to install [version 6](https://github.com/epoberezkin/ajv/tree/beta): + +``` +npm install ajv@beta +``` + + +## <a name="usage"></a>Getting started + +Try it in the Node.js REPL: https://tonicdev.com/npm/ajv + + +The fastest validation call: + +```javascript +var Ajv = require('ajv'); +var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true} +var validate = ajv.compile(schema); +var valid = validate(data); +if (!valid) console.log(validate.errors); +``` + +or with less code + +```javascript +// ... +var valid = ajv.validate(schema, data); +if (!valid) console.log(ajv.errors); +// ... +``` + +or + +```javascript +// ... +var valid = ajv.addSchema(schema, 'mySchema') + .validate('mySchema', data); +if (!valid) console.log(ajv.errorsText()); +// ... +``` + +See [API](#api) and [Options](#options) for more details. + +Ajv compiles schemas to functions and caches them in all cases (using schema serialized with [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) or a custom function as a key), so that the next time the same schema is used (not necessarily the same object instance) it won't be compiled again. + +The best performance is achieved when using compiled functions returned by `compile` or `getSchema` methods (there is no additional function call). + +__Please note__: every time a validation function or `ajv.validate` are called `errors` property is overwritten. You need to copy `errors` array reference to another variable if you want to use it later (e.g., in the callback). See [Validation errors](#validation-errors) + + +## Using in browser + +You can require Ajv directly from the code you browserify - in this case Ajv will be a part of your bundle. + +If you need to use Ajv in several bundles you can create a separate UMD bundle using `npm run bundle` script (thanks to [siddo420](https://github.com/siddo420)). + +Then you need to load Ajv in the browser: +```html +<script src="ajv.min.js"></script> +``` + +This bundle can be used with different module systems; it creates global `Ajv` if no module system is found. + +The browser bundle is available on [cdnjs](https://cdnjs.com/libraries/ajv). + +Ajv is tested with these browsers: + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/epoberezkin.svg)](https://saucelabs.com/u/epoberezkin) + +__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/epoberezkin/ajv/issues/234)). + + +## Command line interface + +CLI is available as a separate npm package [ajv-cli](https://github.com/jessedc/ajv-cli). It supports: + +- compiling JSON-schemas to test their validity +- BETA: generating standalone module exporting a validation function to be used without Ajv (using [ajv-pack](https://github.com/epoberezkin/ajv-pack)) +- migrate schemas to draft-06 (using [json-schema-migrate](https://github.com/epoberezkin/json-schema-migrate)) +- validating data file(s) against JSON-schema +- testing expected validity of data against JSON-schema +- referenced schemas +- custom meta-schemas +- files in JSON and JavaScript format +- all Ajv options +- reporting changes in data after validation in [JSON-patch](https://tools.ietf.org/html/rfc6902) format + + +## Validation keywords + +Ajv supports all validation keywords from draft 4 of JSON-schema standard: + +- [type](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#type) +- [for numbers](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-numbers) - maximum, minimum, exclusiveMaximum, exclusiveMinimum, multipleOf +- [for strings](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-strings) - maxLength, minLength, pattern, format +- [for arrays](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-arrays) - maxItems, minItems, uniqueItems, items, additionalItems, [contains](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#contains) +- [for objects](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-objects) - maxProperties, minProperties, required, properties, patternProperties, additionalProperties, dependencies, [propertyNames](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#propertynames) +- [for all types](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#keywords-for-all-types) - enum, [const](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#const) +- [compound keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#compound-keywords) - not, oneOf, anyOf, allOf + +With [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package Ajv also supports validation keywords from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) for JSON-schema standard: + +- [switch](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#switch-proposed) - conditional validation with a sequence of if/then clauses +- [patternRequired](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#patternrequired-proposed) - like `required` but with patterns that some property should match. +- [formatMaximum, formatMinimum, formatExclusiveMaximum, formatExclusiveMinimum](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#formatmaximum--formatminimum-and-exclusiveformatmaximum--exclusiveformatminimum-proposed) - setting limits for date, time, etc. + +See [JSON Schema validation keywords](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md) for more details. + + +## Formats + +The following formats are supported for string validation with "format" keyword: + +- _date_: full-date according to [RFC3339](http://tools.ietf.org/html/rfc3339#section-5.6). +- _time_: time with optional time-zone. +- _date-time_: date-time from the same source (time-zone is mandatory). `date`, `time` and `date-time` validate ranges in `full` mode and only regexp in `fast` mode (see [options](#options)). +- _uri_: full uri with optional protocol. +- _url_: [URL record](https://url.spec.whatwg.org/#concept-url). +- _uri-template_: URI template according to [RFC6570](https://tools.ietf.org/html/rfc6570) +- _email_: email address. +- _hostname_: host name according to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5). +- _ipv4_: IP address v4. +- _ipv6_: IP address v6. +- _regex_: tests whether a string is a valid regular expression by passing it to RegExp constructor. +- _uuid_: Universally Unique IDentifier according to [RFC4122](http://tools.ietf.org/html/rfc4122). +- _json-pointer_: JSON-pointer according to [RFC6901](https://tools.ietf.org/html/rfc6901). +- _relative-json-pointer_: relative JSON-pointer according to [this draft](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00). + +There are two modes of format validation: `fast` and `full`. This mode affects formats `date`, `time`, `date-time`, `uri`, `email`, and `hostname`. See [Options](#options) for details. + +You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method. + +The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can whitelist specific format(s) to be ignored. See [Options](#options) for details. + +You can find patterns used for format validation and the sources that were used in [formats.js](https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js). + + +## <a name="ref"></a>Combining schemas with $ref + +You can structure your validation logic across multiple schema files and have schemas reference each other using `$ref` keyword. + +Example: + +```javascript +var schema = { + "$id": "http://example.com/schemas/schema.json", + "type": "object", + "properties": { + "foo": { "$ref": "defs.json#/definitions/int" }, + "bar": { "$ref": "defs.json#/definitions/str" } + } +}; + +var defsSchema = { + "$id": "http://example.com/schemas/defs.json", + "definitions": { + "int": { "type": "integer" }, + "str": { "type": "string" } + } +}; +``` + +Now to compile your schema you can either pass all schemas to Ajv instance: + +```javascript +var ajv = new Ajv({schemas: [schema, defsSchema]}); +var validate = ajv.getSchema('http://example.com/schemas/schema.json'); +``` + +or use `addSchema` method: + +```javascript +var ajv = new Ajv; +var validate = ajv.addSchema(defsSchema) + .compile(schema); +``` + +See [Options](#options) and [addSchema](#api) method. + +__Please note__: +- `$ref` is resolved as the uri-reference using schema $id as the base URI (see the example). +- References can be recursive (and mutually recursive) to implement the schemas for different data structures (such as linked lists, trees, graphs, etc.). +- You don't have to host your schema files at the URIs that you use as schema $id. These URIs are only used to identify the schemas, and according to JSON Schema specification validators should not expect to be able to download the schemas from these URIs. +- The actual location of the schema file in the file system is not used. +- You can pass the identifier of the schema as the second parameter of `addSchema` method or as a property name in `schemas` option. This identifier can be used instead of (or in addition to) schema $id. +- You cannot have the same $id (or the schema identifier) used for more than one schema - the exception will be thrown. +- You can implement dynamic resolution of the referenced schemas using `compileAsync` method. In this way you can store schemas in any system (files, web, database, etc.) and reference them without explicitly adding to Ajv instance. See [Asynchronous schema compilation](#asynchronous-schema-compilation). + + +## $data reference + +With `$data` option you can use values from the validated data as the values for the schema keywords. See [proposal](https://github.com/json-schema/json-schema/wiki/$data-(v5-proposal)) for more information about how it works. + +`$data` reference is supported in the keywords: const, enum, format, maximum/minimum, exclusiveMaximum / exclusiveMinimum, maxLength / minLength, maxItems / minItems, maxProperties / minProperties, formatMaximum / formatMinimum, formatExclusiveMaximum / formatExclusiveMinimum, multipleOf, pattern, required, uniqueItems. + +The value of "$data" should be a [JSON-pointer](https://tools.ietf.org/html/rfc6901) to the data (the root is always the top level data object, even if the $data reference is inside a referenced subschema) or a [relative JSON-pointer](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00) (it is relative to the current point in data; if the $data reference is inside a referenced subschema it cannot point to the data outside of the root level for this subschema). + +Examples. + +This schema requires that the value in property `smaller` is less or equal than the value in the property larger: + +```javascript +var ajv = new Ajv({$data: true}); + +var schema = { + "properties": { + "smaller": { + "type": "number", + "maximum": { "$data": "1/larger" } + }, + "larger": { "type": "number" } + } +}; + +var validData = { + smaller: 5, + larger: 7 +}; + +ajv.validate(schema, validData); // true +``` + +This schema requires that the properties have the same format as their field names: + +```javascript +var schema = { + "additionalProperties": { + "type": "string", + "format": { "$data": "0#" } + } +}; + +var validData = { + 'date-time': '1963-06-19T08:30:06.283185Z', + email: 'joe.bloggs@example.com' +} +``` + +`$data` reference is resolved safely - it won't throw even if some property is undefined. If `$data` resolves to `undefined` the validation succeeds (with the exclusion of `const` keyword). If `$data` resolves to incorrect type (e.g. not "number" for maximum keyword) the validation fails. + + +## $merge and $patch keywords + +With the package [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) you can use the keywords `$merge` and `$patch` that allow extending JSON-schemas with patches using formats [JSON Merge Patch (RFC 7396)](https://tools.ietf.org/html/rfc7396) and [JSON Patch (RFC 6902)](https://tools.ietf.org/html/rfc6902). + +To add keywords `$merge` and `$patch` to Ajv instance use this code: + +```javascript +require('ajv-merge-patch')(ajv); +``` + +Examples. + +Using `$merge`: + +```json +{ + "$merge": { + "source": { + "type": "object", + "properties": { "p": { "type": "string" } }, + "additionalProperties": false + }, + "with": { + "properties": { "q": { "type": "number" } } + } + } +} +``` + +Using `$patch`: + +```json +{ + "$patch": { + "source": { + "type": "object", + "properties": { "p": { "type": "string" } }, + "additionalProperties": false + }, + "with": [ + { "op": "add", "path": "/properties/q", "value": { "type": "number" } } + ] + } +} +``` + +The schemas above are equivalent to this schema: + +```json +{ + "type": "object", + "properties": { + "p": { "type": "string" }, + "q": { "type": "number" } + }, + "additionalProperties": false +} +``` + +The properties `source` and `with` in the keywords `$merge` and `$patch` can use absolute or relative `$ref` to point to other schemas previously added to the Ajv instance or to the fragments of the current schema. + +See the package [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) for more information. + + +## Defining custom keywords + +The advantages of using custom keywords are: + +- allow creating validation scenarios that cannot be expressed using JSON Schema +- simplify your schemas +- help bringing a bigger part of the validation logic to your schemas +- make your schemas more expressive, less verbose and closer to your application domain +- implement custom data processors that modify your data (`modifying` option MUST be used in keyword definition) and/or create side effects while the data is being validated + +If a keyword is used only for side-effects and its validation result is pre-defined, use option `valid: true/false` in keyword definition to simplify both generated code (no error handling in case of `valid: true`) and your keyword functions (no need to return any validation result). + +The concerns you have to be aware of when extending JSON-schema standard with custom keywords are the portability and understanding of your schemas. You will have to support these custom keywords on other platforms and to properly document these keywords so that everybody can understand them in your schemas. + +You can define custom keywords with [addKeyword](#api-addkeyword) method. Keywords are defined on the `ajv` instance level - new instances will not have previously defined keywords. + +Ajv allows defining keywords with: +- validation function +- compilation function +- macro function +- inline compilation function that should return code (as string) that will be inlined in the currently compiled schema. + +Example. `range` and `exclusiveRange` keywords using compiled schema: + +```javascript +ajv.addKeyword('range', { + type: 'number', + compile: function (sch, parentSchema) { + var min = sch[0]; + var max = sch[1]; + + return parentSchema.exclusiveRange === true + ? function (data) { return data > min && data < max; } + : function (data) { return data >= min && data <= max; } + } +}); + +var schema = { "range": [2, 4], "exclusiveRange": true }; +var validate = ajv.compile(schema); +console.log(validate(2.01)); // true +console.log(validate(3.99)); // true +console.log(validate(2)); // false +console.log(validate(4)); // false +``` + +Several custom keywords (typeof, instanceof, range and propertyNames) are defined in [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package - they can be used for your schemas and as a starting point for your own custom keywords. + +See [Defining custom keywords](https://github.com/epoberezkin/ajv/blob/master/CUSTOM.md) for more details. + + +## Asynchronous schema compilation + +During asynchronous compilation remote references are loaded using supplied function. See `compileAsync` [method](#api-compileAsync) and `loadSchema` [option](#options). + +Example: + +```javascript +var ajv = new Ajv({ loadSchema: loadSchema }); + +ajv.compileAsync(schema).then(function (validate) { + var valid = validate(data); + // ... +}); + +function loadSchema(uri) { + return request.json(uri).then(function (res) { + if (res.statusCode >= 400) + throw new Error('Loading error: ' + res.statusCode); + return res.body; + }); +} +``` + +__Please note__: [Option](#options) `missingRefs` should NOT be set to `"ignore"` or `"fail"` for asynchronous compilation to work. + + +## Asynchronous validation + +Example in Node.js REPL: https://tonicdev.com/esp/ajv-asynchronous-validation + +You can define custom formats and keywords that perform validation asynchronously by accessing database or some other service. You should add `async: true` in the keyword or format definition (see [addFormat](#api-addformat), [addKeyword](#api-addkeyword) and [Defining custom keywords](#defining-custom-keywords)). + +If your schema uses asynchronous formats/keywords or refers to some schema that contains them it should have `"$async": true` keyword so that Ajv can compile it correctly. If asynchronous format/keyword or reference to asynchronous schema is used in the schema without `$async` keyword Ajv will throw an exception during schema compilation. + +__Please note__: all asynchronous subschemas that are referenced from the current or other schemas should have `"$async": true` keyword as well, otherwise the schema compilation will fail. + +Validation function for an asynchronous custom format/keyword should return a promise that resolves with `true` or `false` (or rejects with `new Ajv.ValidationError(errors)` if you want to return custom errors from the keyword function). Ajv compiles asynchronous schemas to either [es7 async functions](http://tc39.github.io/ecmascript-asyncawait/) that can optionally be transpiled with [nodent](https://github.com/MatAtBread/nodent) or with [regenerator](https://github.com/facebook/regenerator) or to [generator functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) that can be optionally transpiled with regenerator as well. You can also supply any other transpiler as a function. See [Options](#options). + +The compiled validation function has `$async: true` property (if the schema is asynchronous), so you can differentiate these functions if you are using both synchronous and asynchronous schemas. + +If you are using generators, the compiled validation function can be either wrapped with [co](https://github.com/tj/co) (default) or returned as generator function, that can be used directly, e.g. in [koa](http://koajs.com/) 1.0. `co` is a small library, it is included in Ajv (both as npm dependency and in the browser bundle). + +Async functions are currently supported in Chrome 55, Firefox 52, Node.js 7 (with --harmony-async-await) and MS Edge 13 (with flag). + +Generator functions are currently supported in Chrome, Firefox and Node.js. + +If you are using Ajv in other browsers or in older versions of Node.js you should use one of available transpiling options. All provided async modes use global Promise class. If your platform does not have Promise you should use a polyfill that defines it. + +Validation result will be a promise that resolves with validated data or rejects with an exception `Ajv.ValidationError` that contains the array of validation errors in `errors` property. + + +Example: + +```javascript +/** + * Default mode is non-transpiled generator function wrapped with `co`. + * Using package ajv-async (https://github.com/epoberezkin/ajv-async) + * you can auto-detect the best async mode. + * In this case, without "async" and "transpile" options + * (or with option {async: true}) + * Ajv will choose the first supported/installed option in this order: + * 1. native async function + * 2. native generator function wrapped with co + * 3. es7 async functions transpiled with nodent + * 4. es7 async functions transpiled with regenerator + */ + +var setupAsync = require('ajv-async'); +var ajv = setupAsync(new Ajv); + +ajv.addKeyword('idExists', { + async: true, + type: 'number', + validate: checkIdExists +}); + + +function checkIdExists(schema, data) { + return knex(schema.table) + .select('id') + .where('id', data) + .then(function (rows) { + return !!rows.length; // true if record is found + }); +} + +var schema = { + "$async": true, + "properties": { + "userId": { + "type": "integer", + "idExists": { "table": "users" } + }, + "postId": { + "type": "integer", + "idExists": { "table": "posts" } + } + } +}; + +var validate = ajv.compile(schema); + +validate({ userId: 1, postId: 19 }) +.then(function (data) { + console.log('Data is valid', data); // { userId: 1, postId: 19 } +}) +.catch(function (err) { + if (!(err instanceof Ajv.ValidationError)) throw err; + // data is invalid + console.log('Validation errors:', err.errors); +}); +``` + +### Using transpilers with asynchronous validation functions. + +To use a transpiler you should separately install it (or load its bundle in the browser). + +Ajv npm package includes minified browser bundles of regenerator and nodent in dist folder. + + +#### Using nodent + +```javascript +var setupAsync = require('ajv-async'); +var ajv = new Ajv({ /* async: 'es7', */ transpile: 'nodent' }); +setupAsync(ajv); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` + +`npm install nodent` or use `nodent.min.js` from dist folder of npm package. + + +#### Using regenerator + +```javascript +var setupAsync = require('ajv-async'); +var ajv = new Ajv({ /* async: 'es7', */ transpile: 'regenerator' }); +setupAsync(ajv); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` + +`npm install regenerator` or use `regenerator.min.js` from dist folder of npm package. + + +#### Using other transpilers + +```javascript +var ajv = new Ajv({ async: 'es7', processCode: transpileFunc }); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` + +See [Options](#options). + + +#### Comparison of async modes + +|mode|transpile<br>speed*|run-time<br>speed*|bundle<br>size| +|---|:-:|:-:|:-:| +|es7 async<br>(native)|-|0.75|-| +|generators<br>(native)|-|1.0|-| +|es7.nodent|1.35|1.1|215Kb| +|es7.regenerator|1.0|2.7|1109Kb| +|regenerator|1.0|3.2|1109Kb| + +\* Relative performance in Node.js 7.x — smaller is better. + +[nodent](https://github.com/MatAtBread/nodent) has several advantages: + +- much smaller browser bundle than regenerator +- almost the same performance of generated code as native generators in Node.js and the latest Chrome +- much better performance than native generators in other browsers +- works in IE 9 (regenerator does not) + + +## Filtering data + +With [option `removeAdditional`](#options) (added by [andyscott](https://github.com/andyscott)) you can filter data during the validation. + +This option modifies original data. + +Example: + +```javascript +var ajv = new Ajv({ removeAdditional: true }); +var schema = { + "additionalProperties": false, + "properties": { + "foo": { "type": "number" }, + "bar": { + "additionalProperties": { "type": "number" }, + "properties": { + "baz": { "type": "string" } + } + } + } +} + +var data = { + "foo": 0, + "additional1": 1, // will be removed; `additionalProperties` == false + "bar": { + "baz": "abc", + "additional2": 2 // will NOT be removed; `additionalProperties` != false + }, +} + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 0, "bar": { "baz": "abc", "additional2": 2 } +``` + +If `removeAdditional` option in the example above were `"all"` then both `additional1` and `additional2` properties would have been removed. + +If the option were `"failing"` then property `additional1` would have been removed regardless of its value and property `additional2` would have been removed only if its value were failing the schema in the inner `additionalProperties` (so in the example above it would have stayed because it passes the schema, but any non-number would have been removed). + +__Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example: + +```json +{ + "type": "object", + "oneOf": [ + { + "properties": { + "foo": { "type": "string" } + }, + "required": [ "foo" ], + "additionalProperties": false + }, + { + "properties": { + "bar": { "type": "integer" } + }, + "required": [ "bar" ], + "additionalProperties": false + } + ] +} +``` + +The intention of the schema above is to allow objects with either the string property "foo" or the integer property "bar", but not with both and not with any other properties. + +With the option `removeAdditional: true` the validation will pass for the object `{ "foo": "abc"}` but will fail for the object `{"bar": 1}`. It happens because while the first subschema in `oneOf` is validated, the property `bar` is removed because it is an additional property according to the standard (because it is not included in `properties` keyword in the same schema). + +While this behaviour is unexpected (issues [#129](https://github.com/epoberezkin/ajv/issues/129), [#134](https://github.com/epoberezkin/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way: + +```json +{ + "type": "object", + "properties": { + "foo": { "type": "string" }, + "bar": { "type": "integer" } + }, + "additionalProperties": false, + "oneOf": [ + { "required": [ "foo" ] }, + { "required": [ "bar" ] } + ] +} +``` + +The schema above is also more efficient - it will compile into a faster function. + + +## Assigning defaults + +With [option `useDefaults`](#options) Ajv will assign values from `default` keyword in the schemas of `properties` and `items` (when it is the array of schemas) to the missing properties and items. + +This option modifies original data. + +__Please note__: by default the default value is inserted in the generated validation code as a literal (starting from v4.0), so the value inserted in the data will be the deep clone of the default in the schema. + +If you need to insert the default value in the data by reference pass the option `useDefaults: "shared"`. + +Inserting defaults by reference can be faster (in case you have an object in `default`) and it allows to have dynamic values in defaults, e.g. timestamp, without recompiling the schema. The side effect is that modifying the default value in any validated data instance will change the default in the schema and in other validated data instances. See example 3 below. + + +Example 1 (`default` in `properties`): + +```javascript +var ajv = new Ajv({ useDefaults: true }); +var schema = { + "type": "object", + "properties": { + "foo": { "type": "number" }, + "bar": { "type": "string", "default": "baz" } + }, + "required": [ "foo", "bar" ] +}; + +var data = { "foo": 1 }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 1, "bar": "baz" } +``` + +Example 2 (`default` in `items`): + +```javascript +var schema = { + "type": "array", + "items": [ + { "type": "number" }, + { "type": "string", "default": "foo" } + ] +} + +var data = [ 1 ]; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // [ 1, "foo" ] +``` + +Example 3 (inserting "defaults" by reference): + +```javascript +var ajv = new Ajv({ useDefaults: 'shared' }); + +var schema = { + properties: { + foo: { + default: { bar: 1 } + } + } +} + +var validate = ajv.compile(schema); + +var data = {}; +console.log(validate(data)); // true +console.log(data); // { foo: { bar: 1 } } + +data.foo.bar = 2; + +var data2 = {}; +console.log(validate(data2)); // true +console.log(data2); // { foo: { bar: 2 } } +``` + +`default` keywords in other cases are ignored: + +- not in `properties` or `items` subschemas +- in schemas inside `anyOf`, `oneOf` and `not` (see [#42](https://github.com/epoberezkin/ajv/issues/42)) +- in `if` subschema of `switch` keyword +- in schemas generated by custom macro keywords + + +## Coercing data types + +When you are validating user inputs all your data properties are usually strings. The option `coerceTypes` allows you to have your data types coerced to the types specified in your schema `type` keywords, both to pass the validation and to use the correctly typed data afterwards. + +This option modifies original data. + +__Please note__: if you pass a scalar value to the validating function its type will be coerced and it will pass the validation, but the value of the variable you pass won't be updated because scalars are passed by value. + + +Example 1: + +```javascript +var ajv = new Ajv({ coerceTypes: true }); +var schema = { + "type": "object", + "properties": { + "foo": { "type": "number" }, + "bar": { "type": "boolean" } + }, + "required": [ "foo", "bar" ] +}; + +var data = { "foo": "1", "bar": "false" }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 1, "bar": false } +``` + +Example 2 (array coercions): + +```javascript +var ajv = new Ajv({ coerceTypes: 'array' }); +var schema = { + "properties": { + "foo": { "type": "array", "items": { "type": "number" } }, + "bar": { "type": "boolean" } + } +}; + +var data = { "foo": "1", "bar": ["false"] }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": [1], "bar": false } +``` + +The coercion rules, as you can see from the example, are different from JavaScript both to validate user input as expected and to have the coercion reversible (to correctly validate cases where different types are defined in subschemas of "anyOf" and other compound keywords). + +See [Coercion rules](https://github.com/epoberezkin/ajv/blob/master/COERCION.md) for details. + + +## API + +##### new Ajv(Object options) -> Object + +Create Ajv instance. + + +##### .compile(Object schema) -> Function<Object data> + +Generate validating function and cache the compiled schema for future use. + +Validating function returns boolean and has properties `errors` with the errors from the last validation (`null` if there were no errors) and `schema` with the reference to the original schema. + +Unless the option `validateSchema` is false, the schema will be validated against meta-schema and if schema is invalid the error will be thrown. See [options](#options). + + +##### <a name="api-compileAsync"></a>.compileAsync(Object schema [, Boolean meta] [, Function callback]) -> Promise + +Asynchronous version of `compile` method that loads missing remote schemas using asynchronous function in `options.loadSchema`. This function returns a Promise that resolves to a validation function. An optional callback passed to `compileAsync` will be called with 2 parameters: error (or null) and validating function. The returned promise will reject (and the callback will be called with an error) when: + +- missing schema can't be loaded (`loadSchema` returns a Promise that rejects). +- a schema containing a missing reference is loaded, but the reference cannot be resolved. +- schema (or some loaded/referenced schema) is invalid. + +The function compiles schema and loads the first missing schema (or meta-schema) until all missing schemas are loaded. + +You can asynchronously compile meta-schema by passing `true` as the second parameter. + +See example in [Asynchronous compilation](#asynchronous-schema-compilation). + + +##### .validate(Object schema|String key|String ref, data) -> Boolean + +Validate data using passed schema (it will be compiled and cached). + +Instead of the schema you can use the key that was previously passed to `addSchema`, the schema id if it was present in the schema or any previously resolved reference. + +Validation errors will be available in the `errors` property of Ajv instance (`null` if there were no errors). + +__Please note__: every time this method is called the errors are overwritten so you need to copy them to another variable if you want to use them later. + +If the schema is asynchronous (has `$async` keyword on the top level) this method returns a Promise. See [Asynchronous validation](#asynchronous-validation). + + +##### .addSchema(Array<Object>|Object schema [, String key]) -> Ajv + +Add schema(s) to validator instance. This method does not compile schemas (but it still validates them). Because of that dependencies can be added in any order and circular dependencies are supported. It also prevents unnecessary compilation of schemas that are containers for other schemas but not used as a whole. + +Array of schemas can be passed (schemas should have ids), the second parameter will be ignored. + +Key can be passed that can be used to reference the schema and will be used as the schema id if there is no id inside the schema. If the key is not passed, the schema id will be used as the key. + + +Once the schema is added, it (and all the references inside it) can be referenced in other schemas and used to validate data. + +Although `addSchema` does not compile schemas, explicit compilation is not required - the schema will be compiled when it is used first time. + +By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option. + +__Please note__: Ajv uses the [method chaining syntax](https://en.wikipedia.org/wiki/Method_chaining) for all methods with the prefix `add*` and `remove*`. +This allows you to do nice things like the following. + +```javascript +var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri); +``` + +##### .addMetaSchema(Array<Object>|Object schema [, String key]) -> Ajv + +Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option). + +There is no need to explicitly add draft 6 meta schema (http://json-schema.org/draft-06/schema and http://json-schema.org/schema) - it is added by default, unless option `meta` is set to `false`. You only need to use it if you have a changed meta-schema that you want to use to validate your schemas. See `validateSchema`. + + +##### <a name="api-validateschema"></a>.validateSchema(Object schema) -> Boolean + +Validates schema. This method should be used to validate schemas rather than `validate` due to the inconsistency of `uri` format in JSON Schema standard. + +By default this method is called automatically when the schema is added, so you rarely need to use it directly. + +If schema doesn't have `$schema` property, it is validated against draft 6 meta-schema (option `meta` should not be false). + +If schema has `$schema` property, then the schema with this id (that should be previously added) is used to validate passed schema. + +Errors will be available at `ajv.errors`. + + +##### .getSchema(String key) -> Function<Object data> + +Retrieve compiled schema previously added with `addSchema` by the key passed to `addSchema` or by its full reference (id). The returned validating function has `schema` property with the reference to the original schema. + + +##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) -> Ajv + +Remove added/cached schema. Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references. + +Schema can be removed using: +- key passed to `addSchema` +- it's full reference (id) +- RegExp that should match schema id or key (meta-schemas won't be removed) +- actual schema object that will be stable-stringified to remove schema from cache + +If no parameter is passed all schemas but meta-schemas will be removed and the cache will be cleared. + + +##### <a name="api-addformat"></a>.addFormat(String name, String|RegExp|Function|Object format) -> Ajv + +Add custom format to validate strings or numbers. It can also be used to replace pre-defined formats for Ajv instance. + +Strings are converted to RegExp. + +Function should return validation result as `true` or `false`. + +If object is passed it should have properties `validate`, `compare` and `async`: + +- _validate_: a string, RegExp or a function as described above. +- _compare_: an optional comparison function that accepts two strings and compares them according to the format meaning. This function is used with keywords `formatMaximum`/`formatMinimum` (defined in [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) package). It should return `1` if the first value is bigger than the second value, `-1` if it is smaller and `0` if it is equal. +- _async_: an optional `true` value if `validate` is an asynchronous function; in this case it should return a promise that resolves with a value `true` or `false`. +- _type_: an optional type of data that the format applies to. It can be `"string"` (default) or `"number"` (see https://github.com/epoberezkin/ajv/issues/291#issuecomment-259923858). If the type of data is different, the validation will pass. + +Custom formats can be also added via `formats` option. + + +##### <a name="api-addkeyword"></a>.addKeyword(String keyword, Object definition) -> Ajv + +Add custom validation keyword to Ajv instance. + +Keyword should be different from all standard JSON schema keywords and different from previously defined keywords. There is no way to redefine keywords or to remove keyword definition from the instance. + +Keyword must start with a letter, `_` or `$`, and may continue with letters, numbers, `_`, `$`, or `-`. +It is recommended to use an application-specific prefix for keywords to avoid current and future name collisions. + +Example Keywords: +- `"xyz-example"`: valid, and uses prefix for the xyz project to avoid name collisions. +- `"example"`: valid, but not recommended as it could collide with future versions of JSON schema etc. +- `"3-example"`: invalid as numbers are not allowed to be the first character in a keyword + +Keyword definition is an object with the following properties: + +- _type_: optional string or array of strings with data type(s) that the keyword applies to. If not present, the keyword will apply to all types. +- _validate_: validating function +- _compile_: compiling function +- _macro_: macro function +- _inline_: compiling function that returns code (as string) +- _schema_: an optional `false` value used with "validate" keyword to not pass schema +- _metaSchema_: an optional meta-schema for keyword schema +- _modifying_: `true` MUST be passed if keyword modifies data +- _valid_: pass `true`/`false` to pre-define validation result, the result returned from validation function will be ignored. This option cannot be used with macro keywords. +- _$data_: an optional `true` value to support [$data reference](#data-reference) as the value of custom keyword. The reference will be resolved at validation time. If the keyword has meta-schema it would be extended to allow $data and it will be used to validate the resolved value. Supporting $data reference requires that keyword has validating function (as the only option or in addition to compile, macro or inline function). +- _async_: an optional `true` value if the validation function is asynchronous (whether it is compiled or passed in _validate_ property); in this case it should return a promise that resolves with a value `true` or `false`. This option is ignored in case of "macro" and "inline" keywords. +- _errors_: an optional boolean indicating whether keyword returns errors. If this property is not set Ajv will determine if the errors were set in case of failed validation. + +_compile_, _macro_ and _inline_ are mutually exclusive, only one should be used at a time. _validate_ can be used separately or in addition to them to support $data reference. + +__Please note__: If the keyword is validating data type that is different from the type(s) in its definition, the validation function will not be called (and expanded macro will not be used), so there is no need to check for data type inside validation function or inside schema returned by macro function (unless you want to enforce a specific type and for some reason do not want to use a separate `type` keyword for that). In the same way as standard keywords work, if the keyword does not apply to the data type being validated, the validation of this keyword will succeed. + +See [Defining custom keywords](#defining-custom-keywords) for more details. + + +##### .getKeyword(String keyword) -> Object|Boolean + +Returns custom keyword definition, `true` for pre-defined keywords and `false` if the keyword is unknown. + + +##### .removeKeyword(String keyword) -> Ajv + +Removes custom or pre-defined keyword so you can redefine them. + +While this method can be used to extend pre-defined keywords, it can also be used to completely change their meaning - it may lead to unexpected results. + +__Please note__: schemas compiled before the keyword is removed will continue to work without changes. To recompile schemas use `removeSchema` method and compile them again. + + +##### .errorsText([Array<Object> errors [, Object options]]) -> String + +Returns the text with all errors in a String. + +Options can have properties `separator` (string used to separate errors, ", " by default) and `dataVar` (the variable name that dataPaths are prefixed with, "data" by default). + + +## Options + +Defaults: + +```javascript +{ + // validation and reporting options: + $data: false, + allErrors: false, + verbose: false, + jsonPointers: false, + uniqueItems: true, + unicode: true, + format: 'fast', + formats: {}, + unknownFormats: true, + schemas: {}, + logger: undefined, + // referenced schema options: + schemaId: undefined // recommended '$id' + missingRefs: true, + extendRefs: 'ignore', // recommended 'fail' + loadSchema: undefined, // function(uri: string): Promise {} + // options to modify validated data: + removeAdditional: false, + useDefaults: false, + coerceTypes: false, + // asynchronous validation options: + async: 'co*', + transpile: undefined, // requires ajv-async package + // advanced options: + meta: true, + validateSchema: true, + addUsedSchema: true, + inlineRefs: true, + passContext: false, + loopRequired: Infinity, + ownProperties: false, + multipleOfPrecision: false, + errorDataPath: 'object', + messages: true, + sourceCode: false, + processCode: undefined, // function (str: string): string {} + cache: new Cache, + serialize: undefined +} +``` + +##### Validation and reporting options + +- _$data_: support [$data references](#data-reference). Draft 6 meta-schema that is added by default will be extended to allow them. If you want to use another meta-schema you need to use $dataMetaSchema method to add support for $data reference. See [API](#api). +- _allErrors_: check all rules collecting all errors. Default is to return after the first error. +- _verbose_: include the reference to the part of the schema (`schema` and `parentSchema`) and validated data in errors (false by default). +- _jsonPointers_: set `dataPath` property of errors using [JSON Pointers](https://tools.ietf.org/html/rfc6901) instead of JavaScript property access notation. +- _uniqueItems_: validate `uniqueItems` keyword (true by default). +- _unicode_: calculate correct length of strings with unicode pairs (true by default). Pass `false` to use `.length` of strings that is faster, but gives "incorrect" lengths of strings with unicode pairs - each unicode pair is counted as two characters. +- _format_: formats validation mode ('fast' by default). Pass 'full' for more correct and slow validation or `false` not to validate formats at all. E.g., 25:00:00 and 2015/14/33 will be invalid time and date in 'full' mode but it will be valid in 'fast' mode. +- _formats_: an object with custom formats. Keys and values will be passed to `addFormat` method. +- _unknownFormats_: handling of unknown formats. Option values: + - `true` (default) - if an unknown format is encountered the exception is thrown during schema compilation. If `format` keyword value is [$data reference](#data-reference) and it is unknown the validation will fail. + - `[String]` - an array of unknown format names that will be ignored. This option can be used to allow usage of third party schemas with format(s) for which you don't have definitions, but still fail if another unknown format is used. If `format` keyword value is [$data reference](#data-reference) and it is not in this array the validation will fail. + - `"ignore"` - to log warning during schema compilation and always pass validation (the default behaviour in versions before 5.0.0). This option is not recommended, as it allows to mistype format name and it won't be validated without any error message. This behaviour is required by JSON-schema specification. +- _schemas_: an array or object of schemas that will be added to the instance. In case you pass the array the schemas must have IDs in them. When the object is passed the method `addSchema(value, key)` will be called for each schema in this object. +- _logger_: sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. Option values: + - custom logger - it should have methods `log`, `warn` and `error`. If any of these methods is missing an exception will be thrown. + - `false` - logging is disabled. + + +##### Referenced schema options + +- _schemaId_: this option defines which keywords are used as schema URI. Option value: + - `"$id"` (recommended) - only use `$id` keyword as schema URI (as specified in JSON Schema draft-06), ignore `id` keyword (if it is present a warning will be logged). + - `"id"` - only use `id` keyword as schema URI (as specified in JSON Schema draft-04), ignore `$id` keyword (if it is present a warning will be logged). + - `undefined` (default) - use both `$id` and `id` keywords as schema URI. If both are present (in the same schema object) and different the exception will be thrown during schema compilation. +- _missingRefs_: handling of missing referenced schemas. Option values: + - `true` (default) - if the reference cannot be resolved during compilation the exception is thrown. The thrown error has properties `missingRef` (with hash fragment) and `missingSchema` (without it). Both properties are resolved relative to the current base id (usually schema id, unless it was substituted). + - `"ignore"` - to log error during compilation and always pass validation. + - `"fail"` - to log error and successfully compile schema but fail validation if this rule is checked. +- _extendRefs_: validation of other keywords when `$ref` is present in the schema. Option values: + - `"ignore"` (default) - when `$ref` is used other keywords are ignored (as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03#section-3) standard). A warning will be logged during the schema compilation. + - `"fail"` (recommended) - if other validation keywords are used together with `$ref` the exception will be thrown when the schema is compiled. This option is recommended to make sure schema has no keywords that are ignored, which can be confusing. + - `true` - validate all keywords in the schemas with `$ref` (the default behaviour in versions before 5.0.0). +- _loadSchema_: asynchronous function that will be used to load remote schemas when `compileAsync` [method](#api-compileAsync) is used and some reference is missing (option `missingRefs` should NOT be 'fail' or 'ignore'). This function should accept remote schema uri as a parameter and return a Promise that resolves to a schema. See example in [Asynchronous compilation](#asynchronous-schema-compilation). + + +##### Options to modify validated data + +- _removeAdditional_: remove additional properties - see example in [Filtering data](#filtering-data). This option is not used if schema is added with `addMetaSchema` method. Option values: + - `false` (default) - not to remove additional properties + - `"all"` - all additional properties are removed, regardless of `additionalProperties` keyword in schema (and no validation is made for them). + - `true` - only additional properties with `additionalProperties` keyword equal to `false` are removed. + - `"failing"` - additional properties that fail schema validation will be removed (where `additionalProperties` keyword is `false` or schema). +- _useDefaults_: replace missing properties and items with the values from corresponding `default` keywords. Default behaviour is to ignore `default` keywords. This option is not used if schema is added with `addMetaSchema` method. See examples in [Assigning defaults](#assigning-defaults). Option values: + - `false` (default) - do not use defaults + - `true` - insert defaults by value (safer and slower, object literal is used). + - `"shared"` - insert defaults by reference (faster). If the default is an object, it will be shared by all instances of validated data. If you modify the inserted default in the validated data, it will be modified in the schema as well. +- _coerceTypes_: change data type of data to match `type` keyword. See the example in [Coercing data types](#coercing-data-types) and [coercion rules](https://github.com/epoberezkin/ajv/blob/master/COERCION.md). Option values: + - `false` (default) - no type coercion. + - `true` - coerce scalar data types. + - `"array"` - in addition to coercions between scalar types, coerce scalar data to an array with one element and vice versa (as required by the schema). + + +##### Asynchronous validation options + +- _async_: determines how Ajv compiles asynchronous schemas (see [Asynchronous validation](#asynchronous-validation)) to functions. Option values: + - `"*"` / `"co*"` (default) - compile to generator function ("co*" - wrapped with `co.wrap`). If generators are not supported and you don't provide `processCode` option (or `transpile` option if you use [ajv-async](https://github.com/epoberezkin/ajv-async) package), the exception will be thrown when async schema is compiled. + - `"es7"` - compile to es7 async function. Unless your platform supports them you need to provide `processCode` or `transpile` option. According to [compatibility table](http://kangax.github.io/compat-table/es7/)) async functions are supported by: + - Firefox 52, + - Chrome 55, + - Node.js 7 (with `--harmony-async-await`), + - MS Edge 13 (with flag). + - `undefined`/`true` - auto-detect async mode. It requires [ajv-async](https://github.com/epoberezkin/ajv-async) package. If `transpile` option is not passed, ajv-async will choose the first of supported/installed async/transpile modes in this order: + - "es7" (native async functions), + - "co*" (native generators with co.wrap), + - "es7"/"nodent", + - "co*"/"regenerator" during the creation of the Ajv instance. + + If none of the options is available the exception will be thrown. +- _transpile_: Requires [ajv-async](https://github.com/epoberezkin/ajv-async) package. It determines whether Ajv transpiles compiled asynchronous validation function. Option values: + - `"nodent"` - transpile with [nodent](https://github.com/MatAtBread/nodent). If nodent is not installed, the exception will be thrown. nodent can only transpile es7 async functions; it will enforce this mode. + - `"regenerator"` - transpile with [regenerator](https://github.com/facebook/regenerator). If regenerator is not installed, the exception will be thrown. + - a function - this function should accept the code of validation function as a string and return transpiled code. This option allows you to use any other transpiler you prefer. If you are passing a function, you can simply pass it to `processCode` option without using ajv-async. + + +##### Advanced options + +- _meta_: add [meta-schema](http://json-schema.org/documentation.html) so it can be used by other schemas (true by default). If an object is passed, it will be used as the default meta-schema for schemas that have no `$schema` keyword. This default meta-schema MUST have `$schema` keyword. +- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can either be http://json-schema.org/schema or http://json-schema.org/draft-04/schema or absent (draft-4 meta-schema will be used) or can be a reference to the schema previously added with `addMetaSchema` method. Option values: + - `true` (default) - if the validation fails, throw the exception. + - `"log"` - if the validation fails, log error. + - `false` - skip schema validation. +- _addUsedSchema_: by default methods `compile` and `validate` add schemas to the instance if they have `$id` (or `id`) property that doesn't start with "#". If `$id` is present and it is not unique the exception will be thrown. Set this option to `false` to skip adding schemas to the instance and the `$id` uniqueness check when these methods are used. This option does not affect `addSchema` method. +- _inlineRefs_: Affects compilation of referenced schemas. Option values: + - `true` (default) - the referenced schemas that don't have refs in them are inlined, regardless of their size - that substantially improves performance at the cost of the bigger size of compiled schema functions. + - `false` - to not inline referenced schemas (they will be compiled as separate functions). + - integer number - to limit the maximum number of keywords of the schema that will be inlined. +- _passContext_: pass validation context to custom keyword functions. If this option is `true` and you pass some context to the compiled validation function with `validate.call(context, data)`, the `context` will be available as `this` in your custom keywords. By default `this` is Ajv instance. +- _loopRequired_: by default `required` keyword is compiled into a single expression (or a sequence of statements in `allErrors` mode). In case of a very large number of properties in this keyword it may result in a very big validation function. Pass integer to set the number of properties above which `required` keyword will be validated in a loop - smaller validation function size but also worse performance. +- _ownProperties_: by default Ajv iterates over all enumerable object properties; when this option is `true` only own enumerable object properties (i.e. found directly on the object rather than on its prototype) are iterated. Contributed by @mbroadst. +- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/epoberezkin/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations). +- _errorDataPath_: set `dataPath` to point to 'object' (default) or to 'property' when validating keywords `required`, `additionalProperties` and `dependencies`. +- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/epoberezkin/ajv-i18n)). +- _sourceCode_: add `sourceCode` property to validating function (for debugging; this code can be different from the result of toString call). +- _processCode_: an optional function to process generated code before it is passed to Function constructor. It can be used to either beautify (the validating function is generated without line-breaks) or to transpile code. Starting from version 5.0.0 this option replaced options: + - `beautify` that formatted the generated function using [js-beautify](https://github.com/beautify-web/js-beautify). If you want to beautify the generated code pass `require('js-beautify').js_beautify`. + - `transpile` that transpiled asynchronous validation function. You can still use `transpile` option with [ajv-async](https://github.com/epoberezkin/ajv-async) package. See [Asynchronous validation](#asynchronous-validation) for more information. +- _cache_: an optional instance of cache to store compiled schemas using stable-stringified schema as a key. For example, set-associative cache [sacjs](https://github.com/epoberezkin/sacjs) can be used. If not passed then a simple hash is used which is good enough for the common use case (a limited number of statically defined schemas). Cache should have methods `put(key, value)`, `get(key)`, `del(key)` and `clear()`. +- _serialize_: an optional function to serialize schema to cache key. Pass `false` to use schema itself as a key (e.g., if WeakMap used as a cache). By default [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used. + + +## Validation errors + +In case of validation failure, Ajv assigns the array of errors to `errors` property of validation function (or to `errors` property of Ajv instance when `validate` or `validateSchema` methods were called). In case of [asynchronous validation](#asynchronous-validation), the returned promise is rejected with exception `Ajv.ValidationError` that has `errors` property. + + +### Error objects + +Each error is an object with the following properties: + +- _keyword_: validation keyword. +- _dataPath_: the path to the part of the data that was validated. By default `dataPath` uses JavaScript property access notation (e.g., `".prop[1].subProp"`). When the option `jsonPointers` is true (see [Options](#options)) `dataPath` will be set using JSON pointer standard (e.g., `"/prop/1/subProp"`). +- _schemaPath_: the path (JSON-pointer as a URI fragment) to the schema of the keyword that failed validation. +- _params_: the object with the additional information about error that can be used to create custom error messages (e.g., using [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) package). See below for parameters set by all keywords. +- _message_: the standard error message (can be excluded with option `messages` set to false). +- _schema_: the schema of the keyword (added with `verbose` option). +- _parentSchema_: the schema containing the keyword (added with `verbose` option) +- _data_: the data validated by the keyword (added with `verbose` option). + +__Please note__: `propertyNames` keyword schema validation errors have an additional property `propertyName`, `dataPath` points to the object. After schema validation for each property name, if it is invalid an additional error is added with the property `keyword` equal to `"propertyNames"`. + + +### Error parameters + +Properties of `params` object in errors depend on the keyword that failed validation. + +- `maxItems`, `minItems`, `maxLength`, `minLength`, `maxProperties`, `minProperties` - property `limit` (number, the schema of the keyword). +- `additionalItems` - property `limit` (the maximum number of allowed items in case when `items` keyword is an array of schemas and `additionalItems` is false). +- `additionalProperties` - property `additionalProperty` (the property not used in `properties` and `patternProperties` keywords). +- `dependencies` - properties: + - `property` (dependent property), + - `missingProperty` (required missing dependency - only the first one is reported currently) + - `deps` (required dependencies, comma separated list as a string), + - `depsCount` (the number of required dependencies). +- `format` - property `format` (the schema of the keyword). +- `maximum`, `minimum` - properties: + - `limit` (number, the schema of the keyword), + - `exclusive` (boolean, the schema of `exclusiveMaximum` or `exclusiveMinimum`), + - `comparison` (string, comparison operation to compare the data to the limit, with the data on the left and the limit on the right; can be "<", "<=", ">", ">=") +- `multipleOf` - property `multipleOf` (the schema of the keyword) +- `pattern` - property `pattern` (the schema of the keyword) +- `required` - property `missingProperty` (required property that is missing). +- `propertyNames` - property `propertyName` (an invalid property name). +- `patternRequired` (in ajv-keywords) - property `missingPattern` (required pattern that did not match any property). +- `type` - property `type` (required type(s), a string, can be a comma-separated list) +- `uniqueItems` - properties `i` and `j` (indices of duplicate items). +- `enum` - property `allowedValues` pointing to the array of values (the schema of the keyword). +- `$ref` - property `ref` with the referenced schema URI. +- custom keywords (in case keyword definition doesn't create errors) - property `keyword` (the keyword name). + + +## Related packages + +- [ajv-async](https://github.com/epoberezkin/ajv-async) - configure async validation mode +- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface +- [ajv-errors](https://github.com/epoberezkin/ajv-errors) - custom error messages +- [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) - internationalised error messages +- [ajv-istanbul](https://github.com/epoberezkin/ajv-istanbul) - instrument generated validation code to measure test coverage of your schemas +- [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) - custom validation keywords (if/then/else, select, typeof, etc.) +- [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) - keywords $merge and $patch +- [ajv-pack](https://github.com/epoberezkin/ajv-pack) - produces a compact module exporting validation functions + + +## Some packages using Ajv + +- [webpack](https://github.com/webpack/webpack) - a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser +- [jsonscript-js](https://github.com/JSONScript/jsonscript-js) - the interpreter for [JSONScript](http://www.jsonscript.org) - scripted processing of existing endpoints and services +- [osprey-method-handler](https://github.com/mulesoft-labs/osprey-method-handler) - Express middleware for validating requests and responses based on a RAML method object, used in [osprey](https://github.com/mulesoft/osprey) - validating API proxy generated from a RAML definition +- [har-validator](https://github.com/ahmadnassri/har-validator) - HTTP Archive (HAR) validator +- [jsoneditor](https://github.com/josdejong/jsoneditor) - a web-based tool to view, edit, format, and validate JSON http://jsoneditoronline.org +- [JSON Schema Lint](https://github.com/nickcmaynard/jsonschemalint) - a web tool to validate JSON/YAML document against a single JSON-schema http://jsonschemalint.com +- [objection](https://github.com/vincit/objection.js) - SQL-friendly ORM for Node.js +- [table](https://github.com/gajus/table) - formats data into a string table +- [ripple-lib](https://github.com/ripple/ripple-lib) - a JavaScript API for interacting with [Ripple](https://ripple.com) in Node.js and the browser +- [restbase](https://github.com/wikimedia/restbase) - distributed storage with REST API & dispatcher for backend services built to provide a low-latency & high-throughput API for Wikipedia / Wikimedia content +- [hippie-swagger](https://github.com/CacheControl/hippie-swagger) - [Hippie](https://github.com/vesln/hippie) wrapper that provides end to end API testing with swagger validation +- [react-form-controlled](https://github.com/seeden/react-form-controlled) - React controlled form components with validation +- [rabbitmq-schema](https://github.com/tjmehta/rabbitmq-schema) - a schema definition module for RabbitMQ graphs and messages +- [@query/schema](https://www.npmjs.com/package/@query/schema) - stream filtering with a URI-safe query syntax parsing to JSON Schema +- [chai-ajv-json-schema](https://github.com/peon374/chai-ajv-json-schema) - chai plugin to us JSON-schema with expect in mocha tests +- [grunt-jsonschema-ajv](https://github.com/SignpostMarv/grunt-jsonschema-ajv) - Grunt plugin for validating files against JSON Schema +- [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) - extract text from bundle into a file +- [electron-builder](https://github.com/electron-userland/electron-builder) - a solution to package and build a ready for distribution Electron app +- [addons-linter](https://github.com/mozilla/addons-linter) - Mozilla Add-ons Linter +- [gh-pages-generator](https://github.com/epoberezkin/gh-pages-generator) - multi-page site generator converting markdown files to GitHub pages + + +## Tests + +``` +npm install +git submodule update --init +npm test +``` + +## Contributing + +All validation functions are generated using doT templates in [dot](https://github.com/epoberezkin/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency. + +`npm run build` - compiles templates to [dotjs](https://github.com/epoberezkin/ajv/tree/master/lib/dotjs) folder. + +`npm run watch` - automatically compiles templates when files in dot folder change + +Please see [Contributing guidelines](https://github.com/epoberezkin/ajv/blob/master/CONTRIBUTING.md) + + +## Changes history + +See https://github.com/epoberezkin/ajv/releases + +__Please note__: [Changes in version 5.0.0](https://github.com/epoberezkin/ajv/releases/tag/5.0.0). + +[Changes in version 4.6.0](https://github.com/epoberezkin/ajv/releases/tag/4.6.0). + +[Changes in version 4.0.0](https://github.com/epoberezkin/ajv/releases/tag/4.0.0). + +[Changes in version 3.0.0](https://github.com/epoberezkin/ajv/releases/tag/3.0.0). + +[Changes in version 2.0.0](https://github.com/epoberezkin/ajv/releases/tag/2.0.0). + + +## License + +[MIT](https://github.com/epoberezkin/ajv/blob/master/LICENSE) diff --git a/appasar/canary/node_modules/ajv/dist/ajv.bundle.js b/appasar/canary/node_modules/ajv/dist/ajv.bundle.js new file mode 100644 index 0000000..01d5632 --- /dev/null +++ b/appasar/canary/node_modules/ajv/dist/ajv.bundle.js @@ -0,0 +1,7345 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Ajv = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ +'use strict'; + +var KEYWORDS = [ + 'multipleOf', + 'maximum', + 'exclusiveMaximum', + 'minimum', + 'exclusiveMinimum', + 'maxLength', + 'minLength', + 'pattern', + 'additionalItems', + 'maxItems', + 'minItems', + 'uniqueItems', + 'maxProperties', + 'minProperties', + 'required', + 'additionalProperties', + 'enum', + 'format', + 'const' +]; + +module.exports = function (metaSchema, keywordsJsonPointers) { + for (var i=0; i<keywordsJsonPointers.length; i++) { + metaSchema = JSON.parse(JSON.stringify(metaSchema)); + var segments = keywordsJsonPointers[i].split('/'); + var keywords = metaSchema; + var j; + for (j=1; j<segments.length; j++) + keywords = keywords[segments[j]]; + + for (j=0; j<KEYWORDS.length; j++) { + var key = KEYWORDS[j]; + var schema = keywords[key]; + if (schema) { + keywords[key] = { + anyOf: [ + schema, + { $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#' } + ] + }; + } + } + } + + return metaSchema; +}; + +},{}],2:[function(require,module,exports){ +'use strict'; + + +var Cache = module.exports = function Cache() { + this._cache = {}; +}; + + +Cache.prototype.put = function Cache_put(key, value) { + this._cache[key] = value; +}; + + +Cache.prototype.get = function Cache_get(key) { + return this._cache[key]; +}; + + +Cache.prototype.del = function Cache_del(key) { + delete this._cache[key]; +}; + + +Cache.prototype.clear = function Cache_clear() { + this._cache = {}; +}; + +},{}],3:[function(require,module,exports){ +'use strict'; + +//all requires must be explicit because browserify won't work with dynamic requires +module.exports = { + '$ref': require('../dotjs/ref'), + allOf: require('../dotjs/allOf'), + anyOf: require('../dotjs/anyOf'), + const: require('../dotjs/const'), + contains: require('../dotjs/contains'), + dependencies: require('../dotjs/dependencies'), + 'enum': require('../dotjs/enum'), + format: require('../dotjs/format'), + items: require('../dotjs/items'), + maximum: require('../dotjs/_limit'), + minimum: require('../dotjs/_limit'), + maxItems: require('../dotjs/_limitItems'), + minItems: require('../dotjs/_limitItems'), + maxLength: require('../dotjs/_limitLength'), + minLength: require('../dotjs/_limitLength'), + maxProperties: require('../dotjs/_limitProperties'), + minProperties: require('../dotjs/_limitProperties'), + multipleOf: require('../dotjs/multipleOf'), + not: require('../dotjs/not'), + oneOf: require('../dotjs/oneOf'), + pattern: require('../dotjs/pattern'), + properties: require('../dotjs/properties'), + propertyNames: require('../dotjs/propertyNames'), + required: require('../dotjs/required'), + uniqueItems: require('../dotjs/uniqueItems'), + validate: require('../dotjs/validate') +}; + +},{"../dotjs/_limit":13,"../dotjs/_limitItems":14,"../dotjs/_limitLength":15,"../dotjs/_limitProperties":16,"../dotjs/allOf":17,"../dotjs/anyOf":18,"../dotjs/const":19,"../dotjs/contains":20,"../dotjs/dependencies":22,"../dotjs/enum":23,"../dotjs/format":24,"../dotjs/items":25,"../dotjs/multipleOf":26,"../dotjs/not":27,"../dotjs/oneOf":28,"../dotjs/pattern":29,"../dotjs/properties":30,"../dotjs/propertyNames":31,"../dotjs/ref":32,"../dotjs/required":33,"../dotjs/uniqueItems":34,"../dotjs/validate":35}],4:[function(require,module,exports){ +'use strict'; + +var MissingRefError = require('./error_classes').MissingRef; + +module.exports = compileAsync; + + +/** + * Creates validating function for passed schema with asynchronous loading of missing schemas. + * `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. + * @this Ajv + * @param {Object} schema schema object + * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped + * @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function. + * @return {Promise} promise that resolves with a validating function. + */ +function compileAsync(schema, meta, callback) { + /* eslint no-shadow: 0 */ + /* global Promise */ + /* jshint validthis: true */ + var self = this; + if (typeof this._opts.loadSchema != 'function') + throw new Error('options.loadSchema should be a function'); + + if (typeof meta == 'function') { + callback = meta; + meta = undefined; + } + + var p = loadMetaSchemaOf(schema).then(function () { + var schemaObj = self._addSchema(schema, undefined, meta); + return schemaObj.validate || _compileAsync(schemaObj); + }); + + if (callback) { + p.then( + function(v) { callback(null, v); }, + callback + ); + } + + return p; + + + function loadMetaSchemaOf(sch) { + var $schema = sch.$schema; + return $schema && !self.getSchema($schema) + ? compileAsync.call(self, { $ref: $schema }, true) + : Promise.resolve(); + } + + + function _compileAsync(schemaObj) { + try { return self._compile(schemaObj); } + catch(e) { + if (e instanceof MissingRefError) return loadMissingSchema(e); + throw e; + } + + + function loadMissingSchema(e) { + var ref = e.missingSchema; + if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved'); + + var schemaPromise = self._loadingSchemas[ref]; + if (!schemaPromise) { + schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref); + schemaPromise.then(removePromise, removePromise); + } + + return schemaPromise.then(function (sch) { + if (!added(ref)) { + return loadMetaSchemaOf(sch).then(function () { + if (!added(ref)) self.addSchema(sch, ref, undefined, meta); + }); + } + }).then(function() { + return _compileAsync(schemaObj); + }); + + function removePromise() { + delete self._loadingSchemas[ref]; + } + + function added(ref) { + return self._refs[ref] || self._schemas[ref]; + } + } + } +} + +},{"./error_classes":5}],5:[function(require,module,exports){ +'use strict'; + +var resolve = require('./resolve'); + +module.exports = { + Validation: errorSubclass(ValidationError), + MissingRef: errorSubclass(MissingRefError) +}; + + +function ValidationError(errors) { + this.message = 'validation failed'; + this.errors = errors; + this.ajv = this.validation = true; +} + + +MissingRefError.message = function (baseId, ref) { + return 'can\'t resolve reference ' + ref + ' from id ' + baseId; +}; + + +function MissingRefError(baseId, ref, message) { + this.message = message || MissingRefError.message(baseId, ref); + this.missingRef = resolve.url(baseId, ref); + this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef)); +} + + +function errorSubclass(Subclass) { + Subclass.prototype = Object.create(Error.prototype); + Subclass.prototype.constructor = Subclass; + return Subclass; +} + +},{"./resolve":8}],6:[function(require,module,exports){ +'use strict'; + +var util = require('./util'); + +var DATE = /^\d\d\d\d-(\d\d)-(\d\d)$/; +var DAYS = [0,31,29,31,30,31,30,31,31,30,31,30,31]; +var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i; +var HOSTNAME = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i; +var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +// uri-template: https://tools.ietf.org/html/rfc6570 +var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; +// For the source: https://gist.github.com/dperini/729294 +// For test cases: https://mathiasbynens.be/demo/url-regex +// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. +// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; +var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; +var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; +var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$|^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; +var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; + + +module.exports = formats; + +function formats(mode) { + mode = mode == 'full' ? 'full' : 'fast'; + return util.copy(formats[mode]); +} + + +formats.fast = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: /^[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i, + 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i, + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+-.]*)(?::|\/)\/?[^\s]*$/i, + 'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i, + 'uri-template': URITEMPLATE, + url: URL, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') + email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, + hostname: HOSTNAME, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses + ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, + regex: regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: UUID, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + 'json-pointer': JSON_POINTER, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + 'relative-json-pointer': RELATIVE_JSON_POINTER +}; + + +formats.full = { + date: date, + time: time, + 'date-time': date_time, + uri: uri, + 'uri-reference': URIREF, + 'uri-template': URITEMPLATE, + url: URL, + email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: hostname, + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, + regex: regex, + uuid: UUID, + 'json-pointer': JSON_POINTER, + 'relative-json-pointer': RELATIVE_JSON_POINTER +}; + + +function date(str) { + // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 + var matches = str.match(DATE); + if (!matches) return false; + + var month = +matches[1]; + var day = +matches[2]; + return month >= 1 && month <= 12 && day >= 1 && day <= DAYS[month]; +} + + +function time(str, full) { + var matches = str.match(TIME); + if (!matches) return false; + + var hour = matches[1]; + var minute = matches[2]; + var second = matches[3]; + var timeZone = matches[5]; + return hour <= 23 && minute <= 59 && second <= 59 && (!full || timeZone); +} + + +var DATE_TIME_SEPARATOR = /t|\s/i; +function date_time(str) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + var dateTime = str.split(DATE_TIME_SEPARATOR); + return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); +} + + +function hostname(str) { + // https://tools.ietf.org/html/rfc1034#section-3.5 + // https://tools.ietf.org/html/rfc1123#section-2 + return str.length <= 255 && HOSTNAME.test(str); +} + + +var NOT_URI_FRAGMENT = /\/|:/; +function uri(str) { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str); +} + + +var Z_ANCHOR = /[^\\]\\Z/; +function regex(str) { + if (Z_ANCHOR.test(str)) return false; + try { + new RegExp(str); + return true; + } catch(e) { + return false; + } +} + +},{"./util":12}],7:[function(require,module,exports){ +'use strict'; + +var resolve = require('./resolve') + , util = require('./util') + , errorClasses = require('./error_classes') + , stableStringify = require('fast-json-stable-stringify'); + +var validateGenerator = require('../dotjs/validate'); + +/** + * Functions below are used inside compiled validations function + */ + +var co = require('co'); +var ucs2length = util.ucs2length; +var equal = require('fast-deep-equal'); + +// this error is thrown by async schemas to return validation errors via exception +var ValidationError = errorClasses.Validation; + +module.exports = compile; + + +/** + * Compiles schema to validation function + * @this Ajv + * @param {Object} schema schema object + * @param {Object} root object with information about the root schema for this schema + * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution + * @param {String} baseId base ID for IDs in the schema + * @return {Function} validation function + */ +function compile(schema, root, localRefs, baseId) { + /* jshint validthis: true, evil: true */ + /* eslint no-shadow: 0 */ + var self = this + , opts = this._opts + , refVal = [ undefined ] + , refs = {} + , patterns = [] + , patternsHash = {} + , defaults = [] + , defaultsHash = {} + , customRules = []; + + root = root || { schema: schema, refVal: refVal, refs: refs }; + + var c = checkCompiling.call(this, schema, root, baseId); + var compilation = this._compilations[c.index]; + if (c.compiling) return (compilation.callValidate = callValidate); + + var formats = this._formats; + var RULES = this.RULES; + + try { + var v = localCompile(schema, root, localRefs, baseId); + compilation.validate = v; + var cv = compilation.callValidate; + if (cv) { + cv.schema = v.schema; + cv.errors = null; + cv.refs = v.refs; + cv.refVal = v.refVal; + cv.root = v.root; + cv.$async = v.$async; + if (opts.sourceCode) cv.source = v.source; + } + return v; + } finally { + endCompiling.call(this, schema, root, baseId); + } + + function callValidate() { + var validate = compilation.validate; + var result = validate.apply(null, arguments); + callValidate.errors = validate.errors; + return result; + } + + function localCompile(_schema, _root, localRefs, baseId) { + var isRoot = !_root || (_root && _root.schema == _schema); + if (_root.schema != root.schema) + return compile.call(self, _schema, _root, localRefs, baseId); + + var $async = _schema.$async === true; + + var sourceCode = validateGenerator({ + isTop: true, + schema: _schema, + isRoot: isRoot, + baseId: baseId, + root: _root, + schemaPath: '', + errSchemaPath: '#', + errorPath: '""', + MissingRefError: errorClasses.MissingRef, + RULES: RULES, + validate: validateGenerator, + util: util, + resolve: resolve, + resolveRef: resolveRef, + usePattern: usePattern, + useDefault: useDefault, + useCustomRule: useCustomRule, + opts: opts, + formats: formats, + logger: self.logger, + self: self + }); + + sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) + + vars(defaults, defaultCode) + vars(customRules, customRuleCode) + + sourceCode; + + if (opts.processCode) sourceCode = opts.processCode(sourceCode); + // console.log('\n\n\n *** \n', JSON.stringify(sourceCode)); + var validate; + try { + var makeValidate = new Function( + 'self', + 'RULES', + 'formats', + 'root', + 'refVal', + 'defaults', + 'customRules', + 'co', + 'equal', + 'ucs2length', + 'ValidationError', + sourceCode + ); + + validate = makeValidate( + self, + RULES, + formats, + root, + refVal, + defaults, + customRules, + co, + equal, + ucs2length, + ValidationError + ); + + refVal[0] = validate; + } catch(e) { + self.logger.error('Error compiling schema, function code:', sourceCode); + throw e; + } + + validate.schema = _schema; + validate.errors = null; + validate.refs = refs; + validate.refVal = refVal; + validate.root = isRoot ? validate : _root; + if ($async) validate.$async = true; + if (opts.sourceCode === true) { + validate.source = { + code: sourceCode, + patterns: patterns, + defaults: defaults + }; + } + + return validate; + } + + function resolveRef(baseId, ref, isRoot) { + ref = resolve.url(baseId, ref); + var refIndex = refs[ref]; + var _refVal, refCode; + if (refIndex !== undefined) { + _refVal = refVal[refIndex]; + refCode = 'refVal[' + refIndex + ']'; + return resolvedRef(_refVal, refCode); + } + if (!isRoot && root.refs) { + var rootRefId = root.refs[ref]; + if (rootRefId !== undefined) { + _refVal = root.refVal[rootRefId]; + refCode = addLocalRef(ref, _refVal); + return resolvedRef(_refVal, refCode); + } + } + + refCode = addLocalRef(ref); + var v = resolve.call(self, localCompile, root, ref); + if (v === undefined) { + var localSchema = localRefs && localRefs[ref]; + if (localSchema) { + v = resolve.inlineRef(localSchema, opts.inlineRefs) + ? localSchema + : compile.call(self, localSchema, root, localRefs, baseId); + } + } + + if (v === undefined) { + removeLocalRef(ref); + } else { + replaceLocalRef(ref, v); + return resolvedRef(v, refCode); + } + } + + function addLocalRef(ref, v) { + var refId = refVal.length; + refVal[refId] = v; + refs[ref] = refId; + return 'refVal' + refId; + } + + function removeLocalRef(ref) { + delete refs[ref]; + } + + function replaceLocalRef(ref, v) { + var refId = refs[ref]; + refVal[refId] = v; + } + + function resolvedRef(refVal, code) { + return typeof refVal == 'object' || typeof refVal == 'boolean' + ? { code: code, schema: refVal, inline: true } + : { code: code, $async: refVal && refVal.$async }; + } + + function usePattern(regexStr) { + var index = patternsHash[regexStr]; + if (index === undefined) { + index = patternsHash[regexStr] = patterns.length; + patterns[index] = regexStr; + } + return 'pattern' + index; + } + + function useDefault(value) { + switch (typeof value) { + case 'boolean': + case 'number': + return '' + value; + case 'string': + return util.toQuotedString(value); + case 'object': + if (value === null) return 'null'; + var valueStr = stableStringify(value); + var index = defaultsHash[valueStr]; + if (index === undefined) { + index = defaultsHash[valueStr] = defaults.length; + defaults[index] = value; + } + return 'default' + index; + } + } + + function useCustomRule(rule, schema, parentSchema, it) { + var validateSchema = rule.definition.validateSchema; + if (validateSchema && self._opts.validateSchema !== false) { + var valid = validateSchema(schema); + if (!valid) { + var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); + if (self._opts.validateSchema == 'log') self.logger.error(message); + else throw new Error(message); + } + } + + var compile = rule.definition.compile + , inline = rule.definition.inline + , macro = rule.definition.macro; + + var validate; + if (compile) { + validate = compile.call(self, schema, parentSchema, it); + } else if (macro) { + validate = macro.call(self, schema, parentSchema, it); + if (opts.validateSchema !== false) self.validateSchema(validate, true); + } else if (inline) { + validate = inline.call(self, it, rule.keyword, schema, parentSchema); + } else { + validate = rule.definition.validate; + if (!validate) return; + } + + if (validate === undefined) + throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); + + var index = customRules.length; + customRules[index] = validate; + + return { + code: 'customRule' + index, + validate: validate + }; + } +} + + +/** + * Checks if the schema is currently compiled + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean) + */ +function checkCompiling(schema, root, baseId) { + /* jshint validthis: true */ + var index = compIndex.call(this, schema, root, baseId); + if (index >= 0) return { index: index, compiling: true }; + index = this._compilations.length; + this._compilations[index] = { + schema: schema, + root: root, + baseId: baseId + }; + return { index: index, compiling: false }; +} + + +/** + * Removes the schema from the currently compiled list + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + */ +function endCompiling(schema, root, baseId) { + /* jshint validthis: true */ + var i = compIndex.call(this, schema, root, baseId); + if (i >= 0) this._compilations.splice(i, 1); +} + + +/** + * Index of schema compilation in the currently compiled list + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + * @return {Integer} compilation index + */ +function compIndex(schema, root, baseId) { + /* jshint validthis: true */ + for (var i=0; i<this._compilations.length; i++) { + var c = this._compilations[i]; + if (c.schema == schema && c.root == root && c.baseId == baseId) return i; + } + return -1; +} + + +function patternCode(i, patterns) { + return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');'; +} + + +function defaultCode(i) { + return 'var default' + i + ' = defaults[' + i + '];'; +} + + +function refValCode(i, refVal) { + return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];'; +} + + +function customRuleCode(i) { + return 'var customRule' + i + ' = customRules[' + i + '];'; +} + + +function vars(arr, statement) { + if (!arr.length) return ''; + var code = ''; + for (var i=0; i<arr.length; i++) + code += statement(i, arr); + return code; +} + +},{"../dotjs/validate":35,"./error_classes":5,"./resolve":8,"./util":12,"co":40,"fast-deep-equal":41,"fast-json-stable-stringify":42}],8:[function(require,module,exports){ +'use strict'; + +var url = require('url') + , equal = require('fast-deep-equal') + , util = require('./util') + , SchemaObject = require('./schema_obj') + , traverse = require('json-schema-traverse'); + +module.exports = resolve; + +resolve.normalizeId = normalizeId; +resolve.fullPath = getFullPath; +resolve.url = resolveUrl; +resolve.ids = resolveIds; +resolve.inlineRef = inlineRef; +resolve.schema = resolveSchema; + +/** + * [resolve and compile the references ($ref)] + * @this Ajv + * @param {Function} compile reference to schema compilation funciton (localCompile) + * @param {Object} root object with information about the root schema for the current schema + * @param {String} ref reference to resolve + * @return {Object|Function} schema object (if the schema can be inlined) or validation function + */ +function resolve(compile, root, ref) { + /* jshint validthis: true */ + var refVal = this._refs[ref]; + if (typeof refVal == 'string') { + if (this._refs[refVal]) refVal = this._refs[refVal]; + else return resolve.call(this, compile, root, refVal); + } + + refVal = refVal || this._schemas[ref]; + if (refVal instanceof SchemaObject) { + return inlineRef(refVal.schema, this._opts.inlineRefs) + ? refVal.schema + : refVal.validate || this._compile(refVal); + } + + var res = resolveSchema.call(this, root, ref); + var schema, v, baseId; + if (res) { + schema = res.schema; + root = res.root; + baseId = res.baseId; + } + + if (schema instanceof SchemaObject) { + v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId); + } else if (schema !== undefined) { + v = inlineRef(schema, this._opts.inlineRefs) + ? schema + : compile.call(this, schema, root, undefined, baseId); + } + + return v; +} + + +/** + * Resolve schema, its root and baseId + * @this Ajv + * @param {Object} root root object with properties schema, refVal, refs + * @param {String} ref reference to resolve + * @return {Object} object with properties schema, root, baseId + */ +function resolveSchema(root, ref) { + /* jshint validthis: true */ + var p = url.parse(ref, false, true) + , refPath = _getFullPath(p) + , baseId = getFullPath(this._getId(root.schema)); + if (refPath !== baseId) { + var id = normalizeId(refPath); + var refVal = this._refs[id]; + if (typeof refVal == 'string') { + return resolveRecursive.call(this, root, refVal, p); + } else if (refVal instanceof SchemaObject) { + if (!refVal.validate) this._compile(refVal); + root = refVal; + } else { + refVal = this._schemas[id]; + if (refVal instanceof SchemaObject) { + if (!refVal.validate) this._compile(refVal); + if (id == normalizeId(ref)) + return { schema: refVal, root: root, baseId: baseId }; + root = refVal; + } else { + return; + } + } + if (!root.schema) return; + baseId = getFullPath(this._getId(root.schema)); + } + return getJsonPointer.call(this, p, baseId, root.schema, root); +} + + +/* @this Ajv */ +function resolveRecursive(root, ref, parsedRef) { + /* jshint validthis: true */ + var res = resolveSchema.call(this, root, ref); + if (res) { + var schema = res.schema; + var baseId = res.baseId; + root = res.root; + var id = this._getId(schema); + if (id) baseId = resolveUrl(baseId, id); + return getJsonPointer.call(this, parsedRef, baseId, schema, root); + } +} + + +var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']); +/* @this Ajv */ +function getJsonPointer(parsedRef, baseId, schema, root) { + /* jshint validthis: true */ + parsedRef.hash = parsedRef.hash || ''; + if (parsedRef.hash.slice(0,2) != '#/') return; + var parts = parsedRef.hash.split('/'); + + for (var i = 1; i < parts.length; i++) { + var part = parts[i]; + if (part) { + part = util.unescapeFragment(part); + schema = schema[part]; + if (schema === undefined) break; + var id; + if (!PREVENT_SCOPE_CHANGE[part]) { + id = this._getId(schema); + if (id) baseId = resolveUrl(baseId, id); + if (schema.$ref) { + var $ref = resolveUrl(baseId, schema.$ref); + var res = resolveSchema.call(this, root, $ref); + if (res) { + schema = res.schema; + root = res.root; + baseId = res.baseId; + } + } + } + } + } + if (schema !== undefined && schema !== root.schema) + return { schema: schema, root: root, baseId: baseId }; +} + + +var SIMPLE_INLINED = util.toHash([ + 'type', 'format', 'pattern', + 'maxLength', 'minLength', + 'maxProperties', 'minProperties', + 'maxItems', 'minItems', + 'maximum', 'minimum', + 'uniqueItems', 'multipleOf', + 'required', 'enum' +]); +function inlineRef(schema, limit) { + if (limit === false) return false; + if (limit === undefined || limit === true) return checkNoRef(schema); + else if (limit) return countKeys(schema) <= limit; +} + + +function checkNoRef(schema) { + var item; + if (Array.isArray(schema)) { + for (var i=0; i<schema.length; i++) { + item = schema[i]; + if (typeof item == 'object' && !checkNoRef(item)) return false; + } + } else { + for (var key in schema) { + if (key == '$ref') return false; + item = schema[key]; + if (typeof item == 'object' && !checkNoRef(item)) return false; + } + } + return true; +} + + +function countKeys(schema) { + var count = 0, item; + if (Array.isArray(schema)) { + for (var i=0; i<schema.length; i++) { + item = schema[i]; + if (typeof item == 'object') count += countKeys(item); + if (count == Infinity) return Infinity; + } + } else { + for (var key in schema) { + if (key == '$ref') return Infinity; + if (SIMPLE_INLINED[key]) { + count++; + } else { + item = schema[key]; + if (typeof item == 'object') count += countKeys(item) + 1; + if (count == Infinity) return Infinity; + } + } + } + return count; +} + + +function getFullPath(id, normalize) { + if (normalize !== false) id = normalizeId(id); + var p = url.parse(id, false, true); + return _getFullPath(p); +} + + +function _getFullPath(p) { + var protocolSeparator = p.protocol || p.href.slice(0,2) == '//' ? '//' : ''; + return (p.protocol||'') + protocolSeparator + (p.host||'') + (p.path||'') + '#'; +} + + +var TRAILING_SLASH_HASH = /#\/?$/; +function normalizeId(id) { + return id ? id.replace(TRAILING_SLASH_HASH, '') : ''; +} + + +function resolveUrl(baseId, id) { + id = normalizeId(id); + return url.resolve(baseId, id); +} + + +/* @this Ajv */ +function resolveIds(schema) { + var schemaId = normalizeId(this._getId(schema)); + var baseIds = {'': schemaId}; + var fullPaths = {'': getFullPath(schemaId, false)}; + var localRefs = {}; + var self = this; + + traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (jsonPtr === '') return; + var id = self._getId(sch); + var baseId = baseIds[parentJsonPtr]; + var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword; + if (keyIndex !== undefined) + fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex)); + + if (typeof id == 'string') { + id = baseId = normalizeId(baseId ? url.resolve(baseId, id) : id); + + var refVal = self._refs[id]; + if (typeof refVal == 'string') refVal = self._refs[refVal]; + if (refVal && refVal.schema) { + if (!equal(sch, refVal.schema)) + throw new Error('id "' + id + '" resolves to more than one schema'); + } else if (id != normalizeId(fullPath)) { + if (id[0] == '#') { + if (localRefs[id] && !equal(sch, localRefs[id])) + throw new Error('id "' + id + '" resolves to more than one schema'); + localRefs[id] = sch; + } else { + self._refs[id] = fullPath; + } + } + } + baseIds[jsonPtr] = baseId; + fullPaths[jsonPtr] = fullPath; + }); + + return localRefs; +} + +},{"./schema_obj":10,"./util":12,"fast-deep-equal":41,"json-schema-traverse":43,"url":48}],9:[function(require,module,exports){ +'use strict'; + +var ruleModules = require('./_rules') + , toHash = require('./util').toHash; + +module.exports = function rules() { + var RULES = [ + { type: 'number', + rules: [ { 'maximum': ['exclusiveMaximum'] }, + { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] }, + { type: 'string', + rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] }, + { type: 'array', + rules: [ 'maxItems', 'minItems', 'uniqueItems', 'contains', 'items' ] }, + { type: 'object', + rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames', + { 'properties': ['additionalProperties', 'patternProperties'] } ] }, + { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf' ] } + ]; + + var ALL = [ 'type' ]; + var KEYWORDS = [ + 'additionalItems', '$schema', '$id', 'id', 'title', + 'description', 'default', 'definitions' + ]; + var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ]; + RULES.all = toHash(ALL); + RULES.types = toHash(TYPES); + + RULES.forEach(function (group) { + group.rules = group.rules.map(function (keyword) { + var implKeywords; + if (typeof keyword == 'object') { + var key = Object.keys(keyword)[0]; + implKeywords = keyword[key]; + keyword = key; + implKeywords.forEach(function (k) { + ALL.push(k); + RULES.all[k] = true; + }); + } + ALL.push(keyword); + var rule = RULES.all[keyword] = { + keyword: keyword, + code: ruleModules[keyword], + implements: implKeywords + }; + return rule; + }); + + if (group.type) RULES.types[group.type] = group; + }); + + RULES.keywords = toHash(ALL.concat(KEYWORDS)); + RULES.custom = {}; + + return RULES; +}; + +},{"./_rules":3,"./util":12}],10:[function(require,module,exports){ +'use strict'; + +var util = require('./util'); + +module.exports = SchemaObject; + +function SchemaObject(obj) { + util.copy(obj, this); +} + +},{"./util":12}],11:[function(require,module,exports){ +'use strict'; + +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +module.exports = function ucs2length(str) { + var length = 0 + , len = str.length + , pos = 0 + , value; + while (pos < len) { + length++; + value = str.charCodeAt(pos++); + if (value >= 0xD800 && value <= 0xDBFF && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos); + if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate + } + } + return length; +}; + +},{}],12:[function(require,module,exports){ +'use strict'; + + +module.exports = { + copy: copy, + checkDataType: checkDataType, + checkDataTypes: checkDataTypes, + coerceToTypes: coerceToTypes, + toHash: toHash, + getProperty: getProperty, + escapeQuotes: escapeQuotes, + equal: require('fast-deep-equal'), + ucs2length: require('./ucs2length'), + varOccurences: varOccurences, + varReplace: varReplace, + cleanUpCode: cleanUpCode, + finalCleanUpCode: finalCleanUpCode, + schemaHasRules: schemaHasRules, + schemaHasRulesExcept: schemaHasRulesExcept, + toQuotedString: toQuotedString, + getPathExpr: getPathExpr, + getPath: getPath, + getData: getData, + unescapeFragment: unescapeFragment, + unescapeJsonPointer: unescapeJsonPointer, + escapeFragment: escapeFragment, + escapeJsonPointer: escapeJsonPointer +}; + + +function copy(o, to) { + to = to || {}; + for (var key in o) to[key] = o[key]; + return to; +} + + +function checkDataType(dataType, data, negate) { + var EQUAL = negate ? ' !== ' : ' === ' + , AND = negate ? ' || ' : ' && ' + , OK = negate ? '!' : '' + , NOT = negate ? '' : '!'; + switch (dataType) { + case 'null': return data + EQUAL + 'null'; + case 'array': return OK + 'Array.isArray(' + data + ')'; + case 'object': return '(' + OK + data + AND + + 'typeof ' + data + EQUAL + '"object"' + AND + + NOT + 'Array.isArray(' + data + '))'; + case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + + NOT + '(' + data + ' % 1)' + + AND + data + EQUAL + data + ')'; + default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; + } +} + + +function checkDataTypes(dataTypes, data) { + switch (dataTypes.length) { + case 1: return checkDataType(dataTypes[0], data, true); + default: + var code = ''; + var types = toHash(dataTypes); + if (types.array && types.object) { + code = types.null ? '(': '(!' + data + ' || '; + code += 'typeof ' + data + ' !== "object")'; + delete types.null; + delete types.array; + delete types.object; + } + if (types.number) delete types.integer; + for (var t in types) + code += (code ? ' && ' : '' ) + checkDataType(t, data, true); + + return code; + } +} + + +var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); +function coerceToTypes(optionCoerceTypes, dataTypes) { + if (Array.isArray(dataTypes)) { + var types = []; + for (var i=0; i<dataTypes.length; i++) { + var t = dataTypes[i]; + if (COERCE_TO_TYPES[t]) types[types.length] = t; + else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t; + } + if (types.length) return types; + } else if (COERCE_TO_TYPES[dataTypes]) { + return [dataTypes]; + } else if (optionCoerceTypes === 'array' && dataTypes === 'array') { + return ['array']; + } +} + + +function toHash(arr) { + var hash = {}; + for (var i=0; i<arr.length; i++) hash[arr[i]] = true; + return hash; +} + + +var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; +var SINGLE_QUOTE = /'|\\/g; +function getProperty(key) { + return typeof key == 'number' + ? '[' + key + ']' + : IDENTIFIER.test(key) + ? '.' + key + : "['" + escapeQuotes(key) + "']"; +} + + +function escapeQuotes(str) { + return str.replace(SINGLE_QUOTE, '\\$&') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\f/g, '\\f') + .replace(/\t/g, '\\t'); +} + + +function varOccurences(str, dataVar) { + dataVar += '[^0-9]'; + var matches = str.match(new RegExp(dataVar, 'g')); + return matches ? matches.length : 0; +} + + +function varReplace(str, dataVar, expr) { + dataVar += '([^0-9])'; + expr = expr.replace(/\$/g, '$$$$'); + return str.replace(new RegExp(dataVar, 'g'), expr + '$1'); +} + + +var EMPTY_ELSE = /else\s*{\s*}/g + , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g + , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g; +function cleanUpCode(out) { + return out.replace(EMPTY_ELSE, '') + .replace(EMPTY_IF_NO_ELSE, '') + .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))'); +} + + +var ERRORS_REGEXP = /[^v.]errors/g + , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g + , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g + , RETURN_VALID = 'return errors === 0;' + , RETURN_TRUE = 'validate.errors = null; return true;' + , RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/ + , RETURN_DATA_ASYNC = 'return data;' + , ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g + , REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/; + +function finalCleanUpCode(out, async) { + var matches = out.match(ERRORS_REGEXP); + if (matches && matches.length == 2) { + out = async + ? out.replace(REMOVE_ERRORS_ASYNC, '') + .replace(RETURN_ASYNC, RETURN_DATA_ASYNC) + : out.replace(REMOVE_ERRORS, '') + .replace(RETURN_VALID, RETURN_TRUE); + } + + matches = out.match(ROOTDATA_REGEXP); + if (!matches || matches.length !== 3) return out; + return out.replace(REMOVE_ROOTDATA, ''); +} + + +function schemaHasRules(schema, rules) { + if (typeof schema == 'boolean') return !schema; + for (var key in schema) if (rules[key]) return true; +} + + +function schemaHasRulesExcept(schema, rules, exceptKeyword) { + if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not'; + for (var key in schema) if (key != exceptKeyword && rules[key]) return true; +} + + +function toQuotedString(str) { + return '\'' + escapeQuotes(str) + '\''; +} + + +function getPathExpr(currentPath, expr, jsonPointers, isNumber) { + var path = jsonPointers // false by default + ? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')') + : (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\''); + return joinPaths(currentPath, path); +} + + +function getPath(currentPath, prop, jsonPointers) { + var path = jsonPointers // false by default + ? toQuotedString('/' + escapeJsonPointer(prop)) + : toQuotedString(getProperty(prop)); + return joinPaths(currentPath, path); +} + + +var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; +var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function getData($data, lvl, paths) { + var up, jsonPointer, data, matches; + if ($data === '') return 'rootData'; + if ($data[0] == '/') { + if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data); + jsonPointer = $data; + data = 'rootData'; + } else { + matches = $data.match(RELATIVE_JSON_POINTER); + if (!matches) throw new Error('Invalid JSON-pointer: ' + $data); + up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer == '#') { + if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); + return paths[lvl - up]; + } + + if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); + data = 'data' + ((lvl - up) || ''); + if (!jsonPointer) return data; + } + + var expr = data; + var segments = jsonPointer.split('/'); + for (var i=0; i<segments.length; i++) { + var segment = segments[i]; + if (segment) { + data += getProperty(unescapeJsonPointer(segment)); + expr += ' && ' + data; + } + } + return expr; +} + + +function joinPaths (a, b) { + if (a == '""') return b; + return (a + ' + ' + b).replace(/' \+ '/g, ''); +} + + +function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); +} + + +function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); +} + + +function escapeJsonPointer(str) { + return str.replace(/~/g, '~0').replace(/\//g, '~1'); +} + + +function unescapeJsonPointer(str) { + return str.replace(/~1/g, '/').replace(/~0/g, '~'); +} + +},{"./ucs2length":11,"fast-deep-equal":41}],13:[function(require,module,exports){ +'use strict'; +module.exports = function generate__limit(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $isMax = $keyword == 'maximum', + $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum', + $schemaExcl = it.schema[$exclusiveKeyword], + $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, + $op = $isMax ? '<' : '>', + $notOp = $isMax ? '>' : '<', + $errorKeyword = undefined; + if ($isDataExcl) { + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), + $exclusive = 'exclusive' + $lvl, + $exclType = 'exclType' + $lvl, + $exclIsNumber = 'exclIsNumber' + $lvl, + $opExpr = 'op' + $lvl, + $opStr = '\' + ' + $opExpr + ' + \''; + out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; + $schemaValueExcl = 'schemaExcl' + $lvl; + out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; + var $errorKeyword = $exclusiveKeyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';'; + } else { + var $exclIsNumber = typeof $schemaExcl == 'number', + $opStr = $op; + if ($exclIsNumber && $isData) { + var $opExpr = '\'' + $opStr + '\''; + out += ' if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; + } else { + if ($exclIsNumber && $schema === undefined) { + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; + $schemaValue = $schemaExcl; + $notOp += '='; + } else { + if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); + if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; + $notOp += '='; + } else { + $exclusive = false; + $opStr += '='; + } + } + var $opExpr = '\'' + $opStr + '\''; + out += ' if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; + } + } + $errorKeyword = $errorKeyword || $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be ' + ($opStr) + ' '; + if ($isData) { + out += '\' + ' + ($schemaValue); + } else { + out += '' + ($schemaValue) + '\''; + } + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],14:[function(require,module,exports){ +'use strict'; +module.exports = function generate__limitItems(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxItems' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have '; + if ($keyword == 'maxItems') { + out += 'more'; + } else { + out += 'less'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' items\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],15:[function(require,module,exports){ +'use strict'; +module.exports = function generate__limitLength(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxLength' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + if (it.opts.unicode === false) { + out += ' ' + ($data) + '.length '; + } else { + out += ' ucs2length(' + ($data) + ') '; + } + out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be '; + if ($keyword == 'maxLength') { + out += 'longer'; + } else { + out += 'shorter'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' characters\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],16:[function(require,module,exports){ +'use strict'; +module.exports = function generate__limitProperties(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxProperties' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have '; + if ($keyword == 'maxProperties') { + out += 'more'; + } else { + out += 'less'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' properties\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],17:[function(require,module,exports){ +'use strict'; +module.exports = function generate_allOf(it, $keyword, $ruleType) { + var out = ' '; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $currentBaseId = $it.baseId, + $allSchemasEmpty = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $allSchemasEmpty = false; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if ($breakOnError) { + if ($allSchemasEmpty) { + out += ' if (true) { '; + } else { + out += ' ' + ($closingBraces.slice(0, -1)) + ' '; + } + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],18:[function(require,module,exports){ +'use strict'; +module.exports = function generate_anyOf(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $noEmptySchema = $schema.every(function($sch) { + return it.util.schemaHasRules($sch, it.RULES.all); + }); + if ($noEmptySchema) { + var $currentBaseId = $it.baseId; + out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; + $closingBraces += '}'; + } + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should match some schema in anyOf\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; return false; '; + } + } + out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + if (it.opts.allErrors) { + out += ' } '; + } + out = it.util.cleanUpCode(out); + } else { + if ($breakOnError) { + out += ' if (true) { '; + } + } + return out; +} + +},{}],19:[function(require,module,exports){ +'use strict'; +module.exports = function generate_const(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + if (!$isData) { + out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; + } + out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should be equal to constant\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' }'; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],20:[function(require,module,exports){ +'use strict'; +module.exports = function generate_contains(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $idx = 'i' + $lvl, + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt, + $currentBaseId = it.baseId, + $nonEmptySchema = it.util.schemaHasRules($schema, it.RULES.all); + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; + if ($nonEmptySchema) { + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + out += ' if (' + ($nextValid) + ') break; } '; + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; + } else { + out += ' if (' + ($data) + '.length == 0) {'; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should contain a valid item\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + if ($nonEmptySchema) { + out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + } + if (it.opts.allErrors) { + out += ' } '; + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],21:[function(require,module,exports){ +'use strict'; +module.exports = function generate_custom(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $rule = this, + $definition = 'definition' + $lvl, + $rDef = $rule.definition, + $closingBraces = ''; + var $compile, $inline, $macro, $ruleValidate, $validateCode; + if ($isData && $rDef.$data) { + $validateCode = 'keywordValidate' + $lvl; + var $validateSchema = $rDef.validateSchema; + out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; + } else { + $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); + if (!$ruleValidate) return; + $schemaValue = 'validate.schema' + $schemaPath; + $validateCode = $ruleValidate.code; + $compile = $rDef.compile; + $inline = $rDef.inline; + $macro = $rDef.macro; + } + var $ruleErrs = $validateCode + '.errors', + $i = 'i' + $lvl, + $ruleErr = 'ruleErr' + $lvl, + $asyncKeyword = $rDef.async; + if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); + if (!($inline || $macro)) { + out += '' + ($ruleErrs) + ' = null;'; + } + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; + if ($isData && $rDef.$data) { + $closingBraces += '}'; + out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; + if ($validateSchema) { + $closingBraces += '}'; + out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; + } + } + if ($inline) { + if ($rDef.statements) { + out += ' ' + ($ruleValidate.validate) + ' '; + } else { + out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; + } + } else if ($macro) { + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + $it.schema = $ruleValidate.validate; + $it.schemaPath = ''; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($code); + } else { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + out += ' ' + ($validateCode) + '.call( '; + if (it.opts.passContext) { + out += 'this'; + } else { + out += 'self'; + } + if ($compile || $rDef.schema === false) { + out += ' , ' + ($data) + ' '; + } else { + out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; + } + out += ' , (dataPath || \'\')'; + if (it.errorPath != '""') { + out += ' + ' + (it.errorPath); + } + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; + var def_callRuleValidate = out; + out = $$outStack.pop(); + if ($rDef.errors === false) { + out += ' ' + ($valid) + ' = '; + if ($asyncKeyword) { + out += '' + (it.yieldAwait); + } + out += '' + (def_callRuleValidate) + '; '; + } else { + if ($asyncKeyword) { + $ruleErrs = 'customErrors' + $lvl; + out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = ' + (it.yieldAwait) + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; + } else { + out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; + } + } + } + if ($rDef.modifying) { + out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; + } + out += '' + ($closingBraces); + if ($rDef.valid) { + if ($breakOnError) { + out += ' if (true) { '; + } + } else { + out += ' if ( '; + if ($rDef.valid === undefined) { + out += ' !'; + if ($macro) { + out += '' + ($nextValid); + } else { + out += '' + ($valid); + } + } else { + out += ' ' + (!$rDef.valid) + ' '; + } + out += ') { '; + $errorKeyword = $rule.keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + var def_customError = out; + out = $$outStack.pop(); + if ($inline) { + if ($rDef.errors) { + if ($rDef.errors != 'full') { + out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } '; + if (it.opts.verbose) { + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; + } + out += ' } '; + } + } else { + if ($rDef.errors === false) { + out += ' ' + (def_customError) + ' '; + } else { + out += ' if (' + ($errs) + ' == errors) { ' + (def_customError) + ' } else { for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } '; + if (it.opts.verbose) { + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; + } + out += ' } } '; + } + } + } else if ($macro) { + out += ' var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; return false; '; + } + } + } else { + if ($rDef.errors === false) { + out += ' ' + (def_customError) + ' '; + } else { + out += ' if (Array.isArray(' + ($ruleErrs) + ')) { if (vErrors === null) vErrors = ' + ($ruleErrs) + '; else vErrors = vErrors.concat(' + ($ruleErrs) + '); errors = vErrors.length; for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; '; + if (it.opts.verbose) { + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; + } + out += ' } } else { ' + (def_customError) + ' } '; + } + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + } + return out; +} + +},{}],22:[function(require,module,exports){ +'use strict'; +module.exports = function generate_dependencies(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $schemaDeps = {}, + $propertyDeps = {}, + $ownProperties = it.opts.ownProperties; + for ($property in $schema) { + var $sch = $schema[$property]; + var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; + $deps[$property] = $sch; + } + out += 'var ' + ($errs) + ' = errors;'; + var $currentErrorPath = it.errorPath; + out += 'var missing' + ($lvl) + ';'; + for (var $property in $propertyDeps) { + $deps = $propertyDeps[$property]; + if ($deps.length) { + out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; + if ($ownProperties) { + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; + } + if ($breakOnError) { + out += ' && ( '; + var arr1 = $deps; + if (arr1) { + var $propertyKey, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $propertyKey = arr1[$i += 1]; + if ($i) { + out += ' || '; + } + var $prop = it.util.getProperty($propertyKey), + $useData = $data + $prop; + out += ' ( ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; + } + } + out += ')) { '; + var $propertyPath = 'missing' + $lvl, + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should have '; + if ($deps.length == 1) { + out += 'property ' + (it.util.escapeQuotes($deps[0])); + } else { + out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))); + } + out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } else { + out += ' ) { '; + var arr2 = $deps; + if (arr2) { + var $propertyKey, i2 = -1, + l2 = arr2.length - 1; + while (i2 < l2) { + $propertyKey = arr2[i2 += 1]; + var $prop = it.util.getProperty($propertyKey), + $missingProperty = it.util.escapeQuotes($propertyKey), + $useData = $data + $prop; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + out += ' if ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should have '; + if ($deps.length == 1) { + out += 'property ' + (it.util.escapeQuotes($deps[0])); + } else { + out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))); + } + out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; + } + } + } + out += ' } '; + if ($breakOnError) { + $closingBraces += '}'; + out += ' else { '; + } + } + } + it.errorPath = $currentErrorPath; + var $currentBaseId = $it.baseId; + for (var $property in $schemaDeps) { + var $sch = $schemaDeps[$property]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; + if ($ownProperties) { + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; + } + out += ') { '; + $it.schema = $sch; + $it.schemaPath = $schemaPath + it.util.getProperty($property); + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],23:[function(require,module,exports){ +'use strict'; +module.exports = function generate_enum(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $i = 'i' + $lvl, + $vSchema = 'schema' + $lvl; + if (!$isData) { + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';'; + } + out += 'var ' + ($valid) + ';'; + if ($isData) { + out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; + } + out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }'; + if ($isData) { + out += ' } '; + } + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be equal to one of the allowed values\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' }'; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],24:[function(require,module,exports){ +'use strict'; +module.exports = function generate_format(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + if (it.opts.format === false) { + if ($breakOnError) { + out += ' if (true) { '; + } + return out; + } + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $unknownFormats = it.opts.unknownFormats, + $allowUnknown = Array.isArray($unknownFormats); + if ($isData) { + var $format = 'format' + $lvl, + $isObject = 'isObject' + $lvl, + $formatType = 'formatType' + $lvl; + out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { '; + if (it.async) { + out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; '; + } + out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; + } + out += ' ('; + if ($unknownFormats != 'ignore') { + out += ' (' + ($schemaValue) + ' && !' + ($format) + ' '; + if ($allowUnknown) { + out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 '; + } + out += ') || '; + } + out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? '; + if (it.async) { + out += ' (async' + ($lvl) + ' ? ' + (it.yieldAwait) + ' ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) '; + } else { + out += ' ' + ($format) + '(' + ($data) + ') '; + } + out += ' : ' + ($format) + '.test(' + ($data) + '))))) {'; + } else { + var $format = it.formats[$schema]; + if (!$format) { + if ($unknownFormats == 'ignore') { + it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); + if ($breakOnError) { + out += ' if (true) { '; + } + return out; + } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) { + if ($breakOnError) { + out += ' if (true) { '; + } + return out; + } else { + throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); + } + } + var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; + var $formatType = $isObject && $format.type || 'string'; + if ($isObject) { + var $async = $format.async === true; + $format = $format.validate; + } + if ($formatType != $ruleType) { + if ($breakOnError) { + out += ' if (true) { '; + } + return out; + } + if ($async) { + if (!it.async) throw new Error('async format in sync schema'); + var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; + out += ' if (!(' + (it.yieldAwait) + ' ' + ($formatRef) + '(' + ($data) + '))) { '; + } else { + out += ' if (! '; + var $formatRef = 'formats' + it.util.getProperty($schema); + if ($isObject) $formatRef += '.validate'; + if (typeof $format == 'function') { + out += ' ' + ($formatRef) + '(' + ($data) + ') '; + } else { + out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; + } + out += ') { '; + } + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should match format "'; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + (it.util.escapeQuotes($schema)); + } + out += '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],25:[function(require,module,exports){ +'use strict'; +module.exports = function generate_items(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $idx = 'i' + $lvl, + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt, + $currentBaseId = it.baseId; + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; + if (Array.isArray($schema)) { + var $additionalItems = it.schema.additionalItems; + if ($additionalItems === false) { + out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; '; + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + '/additionalItems'; + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' '; + } + if (it.opts.verbose) { + out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + $closingBraces += '}'; + out += ' else { '; + } + } + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; + var $passData = $data + '[' + $i + ']'; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); + $it.dataPathArr[$dataNxt] = $i; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) { + $it.schema = $additionalItems; + $it.schemaPath = it.schemaPath + '.additionalItems'; + $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; + out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } else if (it.util.schemaHasRules($schema, it.RULES.all)) { + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' }'; + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],26:[function(require,module,exports){ +'use strict'; +module.exports = function generate_multipleOf(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + out += 'var division' + ($lvl) + ';if ('; + if ($isData) { + out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || '; + } + out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', '; + if (it.opts.multipleOfPrecision) { + out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' '; + } else { + out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') '; + } + out += ' ) '; + if ($isData) { + out += ' ) '; + } + out += ' ) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be multiple of '; + if ($isData) { + out += '\' + ' + ($schemaValue); + } else { + out += '' + ($schemaValue) + '\''; + } + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],27:[function(require,module,exports){ +'use strict'; +module.exports = function generate_not(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + $it.level++; + var $nextValid = 'valid' + $it.level; + if (it.util.schemaHasRules($schema, it.RULES.all)) { + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += ' var ' + ($errs) + ' = errors; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.createErrors = false; + var $allErrorsOption; + if ($it.opts.allErrors) { + $allErrorsOption = $it.opts.allErrors; + $it.opts.allErrors = false; + } + out += ' ' + (it.validate($it)) + ' '; + $it.createErrors = true; + if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' if (' + ($nextValid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be valid\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + if (it.opts.allErrors) { + out += ' } '; + } + } else { + out += ' var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be valid\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if ($breakOnError) { + out += ' if (false) { '; + } + } + return out; +} + +},{}],28:[function(require,module,exports){ +'use strict'; +module.exports = function generate_oneOf(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + out += 'var ' + ($errs) + ' = errors;var prevValid' + ($lvl) + ' = false;var ' + ($valid) + ' = false;'; + var $currentBaseId = $it.baseId; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + } else { + out += ' var ' + ($nextValid) + ' = true; '; + } + if ($i) { + out += ' if (' + ($nextValid) + ' && prevValid' + ($lvl) + ') ' + ($valid) + ' = false; else { '; + $closingBraces += '}'; + } + out += ' if (' + ($nextValid) + ') ' + ($valid) + ' = prevValid' + ($lvl) + ' = true;'; + } + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should match exactly one schema in oneOf\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; return false; '; + } + } + out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }'; + if (it.opts.allErrors) { + out += ' } '; + } + return out; +} + +},{}],29:[function(require,module,exports){ +'use strict'; +module.exports = function generate_pattern(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema); + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; + } + out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should match pattern "'; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + (it.util.escapeQuotes($schema)); + } + out += '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + +},{}],30:[function(require,module,exports){ +'use strict'; +module.exports = function generate_properties(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $key = 'key' + $lvl, + $idx = 'idx' + $lvl, + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt, + $dataProperties = 'dataProperties' + $lvl; + var $schemaKeys = Object.keys($schema || {}), + $pProperties = it.schema.patternProperties || {}, + $pPropertyKeys = Object.keys($pProperties), + $aProperties = it.schema.additionalProperties, + $someProperties = $schemaKeys.length || $pPropertyKeys.length, + $noAdditional = $aProperties === false, + $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, + $removeAdditional = it.opts.removeAdditional, + $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, + $ownProperties = it.opts.ownProperties, + $currentBaseId = it.baseId; + var $required = it.schema.required; + if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required); + if (it.opts.patternGroups) { + var $pgProperties = it.schema.patternGroups || {}, + $pgPropertyKeys = Object.keys($pgProperties); + } + out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; + if ($ownProperties) { + out += ' var ' + ($dataProperties) + ' = undefined;'; + } + if ($checkAdditional) { + if ($ownProperties) { + out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; + } else { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + } + if ($someProperties) { + out += ' var isAdditional' + ($lvl) + ' = !(false '; + if ($schemaKeys.length) { + if ($schemaKeys.length > 5) { + out += ' || validate.schema' + ($schemaPath) + '[' + ($key) + '] '; + } else { + var arr1 = $schemaKeys; + if (arr1) { + var $propertyKey, i1 = -1, + l1 = arr1.length - 1; + while (i1 < l1) { + $propertyKey = arr1[i1 += 1]; + out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; + } + } + } + } + if ($pPropertyKeys.length) { + var arr2 = $pPropertyKeys; + if (arr2) { + var $pProperty, $i = -1, + l2 = arr2.length - 1; + while ($i < l2) { + $pProperty = arr2[$i += 1]; + out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; + } + } + } + if (it.opts.patternGroups && $pgPropertyKeys.length) { + var arr3 = $pgPropertyKeys; + if (arr3) { + var $pgProperty, $i = -1, + l3 = arr3.length - 1; + while ($i < l3) { + $pgProperty = arr3[$i += 1]; + out += ' || ' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ') '; + } + } + } + out += ' ); if (isAdditional' + ($lvl) + ') { '; + } + if ($removeAdditional == 'all') { + out += ' delete ' + ($data) + '[' + ($key) + ']; '; + } else { + var $currentErrorPath = it.errorPath; + var $additionalProperty = '\' + ' + $key + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + } + if ($noAdditional) { + if ($removeAdditional) { + out += ' delete ' + ($data) + '[' + ($key) + ']; '; + } else { + out += ' ' + ($nextValid) + ' = false; '; + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + '/additionalProperties'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have additional properties\' '; + } + if (it.opts.verbose) { + out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + out += ' break; '; + } + } + } else if ($additionalIsSchema) { + if ($removeAdditional == 'failing') { + out += ' var ' + ($errs) + ' = errors; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + '.additionalProperties'; + $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; + $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; + it.compositeRule = $it.compositeRule = $wasComposite; + } else { + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + '.additionalProperties'; + $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; + $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + } + } + it.errorPath = $currentErrorPath; + } + if ($someProperties) { + out += ' } '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + var $useDefaults = it.opts.useDefaults && !it.compositeRule; + if ($schemaKeys.length) { + var arr4 = $schemaKeys; + if (arr4) { + var $propertyKey, i4 = -1, + l4 = arr4.length - 1; + while (i4 < l4) { + $propertyKey = arr4[i4 += 1]; + var $sch = $schema[$propertyKey]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + var $prop = it.util.getProperty($propertyKey), + $passData = $data + $prop, + $hasDefault = $useDefaults && $sch.default !== undefined; + $it.schema = $sch; + $it.schemaPath = $schemaPath + $prop; + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); + $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); + $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + $code = it.util.varReplace($code, $nextData, $passData); + var $useData = $passData; + } else { + var $useData = $nextData; + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; + } + if ($hasDefault) { + out += ' ' + ($code) + ' '; + } else { + if ($requiredHash && $requiredHash[$propertyKey]) { + out += ' if ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') { ' + ($nextValid) + ' = false; '; + var $currentErrorPath = it.errorPath, + $currErrSchemaPath = $errSchemaPath, + $missingProperty = it.util.escapeQuotes($propertyKey); + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + $errSchemaPath = it.errSchemaPath + '/required'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + $errSchemaPath = $currErrSchemaPath; + it.errorPath = $currentErrorPath; + out += ' } else { '; + } else { + if ($breakOnError) { + out += ' if ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') { ' + ($nextValid) + ' = true; } else { '; + } else { + out += ' if (' + ($useData) + ' !== undefined '; + if ($ownProperties) { + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ' ) { '; + } + } + out += ' ' + ($code) + ' } '; + } + } + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if ($pPropertyKeys.length) { + var arr5 = $pPropertyKeys; + if (arr5) { + var $pProperty, i5 = -1, + l5 = arr5.length - 1; + while (i5 < l5) { + $pProperty = arr5[i5 += 1]; + var $sch = $pProperties[$pProperty]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); + $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); + if ($ownProperties) { + out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; + } else { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + } + out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else ' + ($nextValid) + ' = true; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + } + if (it.opts.patternGroups && $pgPropertyKeys.length) { + var arr6 = $pgPropertyKeys; + if (arr6) { + var $pgProperty, i6 = -1, + l6 = arr6.length - 1; + while (i6 < l6) { + $pgProperty = arr6[i6 += 1]; + var $pgSchema = $pgProperties[$pgProperty], + $sch = $pgSchema.schema; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema'; + $it.errSchemaPath = it.errSchemaPath + '/patternGroups/' + it.util.escapeFragment($pgProperty) + '/schema'; + out += ' var pgPropCount' + ($lvl) + ' = 0; '; + if ($ownProperties) { + out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; + } else { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + } + out += ' if (' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ')) { pgPropCount' + ($lvl) + '++; '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else ' + ($nextValid) + ' = true; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + var $pgMin = $pgSchema.minimum, + $pgMax = $pgSchema.maximum; + if ($pgMin !== undefined || $pgMax !== undefined) { + out += ' var ' + ($valid) + ' = true; '; + var $currErrSchemaPath = $errSchemaPath; + if ($pgMin !== undefined) { + var $limit = $pgMin, + $reason = 'minimum', + $moreOrLess = 'less'; + out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' >= ' + ($pgMin) + '; '; + $errSchemaPath = it.errSchemaPath + '/patternGroups/minimum'; + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($pgMax !== undefined) { + out += ' else '; + } + } + if ($pgMax !== undefined) { + var $limit = $pgMax, + $reason = 'maximum', + $moreOrLess = 'more'; + out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' <= ' + ($pgMax) + '; '; + $errSchemaPath = it.errSchemaPath + '/patternGroups/maximum'; + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + } + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + out += ' if (' + ($valid) + ') { '; + $closingBraces += '}'; + } + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],31:[function(require,module,exports){ +'use strict'; +module.exports = function generate_propertyNames(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + if (it.util.schemaHasRules($schema, it.RULES.all)) { + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + var $key = 'key' + $lvl, + $idx = 'idx' + $lvl, + $i = 'i' + $lvl, + $invalidName = '\' + ' + $key + ' + \'', + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt, + $dataProperties = 'dataProperties' + $lvl, + $ownProperties = it.opts.ownProperties, + $currentBaseId = it.baseId; + out += ' var ' + ($errs) + ' = errors; '; + if ($ownProperties) { + out += ' var ' + ($dataProperties) + ' = undefined; '; + } + if ($ownProperties) { + out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; + } else { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + } + out += ' var startErrs' + ($lvl) + ' = errors; '; + var $passData = $key; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + '<errors; ' + ($i) + '++) { vErrors[' + ($i) + '].propertyName = ' + ($key) + '; } var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('propertyNames') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { propertyName: \'' + ($invalidName) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'property name \\\'' + ($invalidName) + '\\\' is invalid\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; return false; '; + } + } + if ($breakOnError) { + out += ' break; '; + } + out += ' } }'; + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} + +},{}],32:[function(require,module,exports){ +'use strict'; +module.exports = function generate_ref(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $async, $refCode; + if ($schema == '#' || $schema == '#/') { + if (it.isRoot) { + $async = it.async; + $refCode = 'validate'; + } else { + $async = it.root.schema.$async === true; + $refCode = 'root.refVal[0]'; + } + } else { + var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); + if ($refVal === undefined) { + var $message = it.MissingRefError.message(it.baseId, $schema); + if (it.opts.missingRefs == 'fail') { + it.logger.error($message); + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' '; + } + if (it.opts.verbose) { + out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + if ($breakOnError) { + out += ' if (false) { '; + } + } else if (it.opts.missingRefs == 'ignore') { + it.logger.warn($message); + if ($breakOnError) { + out += ' if (true) { '; + } + } else { + throw new it.MissingRefError(it.baseId, $schema, $message); + } + } else if ($refVal.inline) { + var $it = it.util.copy(it); + $it.level++; + var $nextValid = 'valid' + $it.level; + $it.schema = $refVal.schema; + $it.schemaPath = ''; + $it.errSchemaPath = $schema; + var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); + out += ' ' + ($code) + ' '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + } + } else { + $async = $refVal.$async === true; + $refCode = $refVal.code; + } + } + if ($refCode) { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + if (it.opts.passContext) { + out += ' ' + ($refCode) + '.call(this, '; + } else { + out += ' ' + ($refCode) + '( '; + } + out += ' ' + ($data) + ', (dataPath || \'\')'; + if (it.errorPath != '""') { + out += ' + ' + (it.errorPath); + } + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) '; + var __callValidate = out; + out = $$outStack.pop(); + if ($async) { + if (!it.async) throw new Error('async schema referenced by sync schema'); + if ($breakOnError) { + out += ' var ' + ($valid) + '; '; + } + out += ' try { ' + (it.yieldAwait) + ' ' + (__callValidate) + '; '; + if ($breakOnError) { + out += ' ' + ($valid) + ' = true; '; + } + out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; '; + if ($breakOnError) { + out += ' ' + ($valid) + ' = false; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($valid) + ') { '; + } + } else { + out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } '; + if ($breakOnError) { + out += ' else { '; + } + } + } + return out; +} + +},{}],33:[function(require,module,exports){ +'use strict'; +module.exports = function generate_required(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $vSchema = 'schema' + $lvl; + if (!$isData) { + if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) { + var $required = []; + var arr1 = $schema; + if (arr1) { + var $property, i1 = -1, + l1 = arr1.length - 1; + while (i1 < l1) { + $property = arr1[i1 += 1]; + var $propertySch = it.schema.properties[$property]; + if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) { + $required[$required.length] = $property; + } + } + } + } else { + var $required = $schema; + } + } + if ($isData || $required.length) { + var $currentErrorPath = it.errorPath, + $loopRequired = $isData || $required.length >= it.opts.loopRequired, + $ownProperties = it.opts.ownProperties; + if ($breakOnError) { + out += ' var missing' + ($lvl) + '; '; + if ($loopRequired) { + if (!$isData) { + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; + } + var $i = 'i' + $lvl, + $propertyPath = 'schema' + $lvl + '[' + $i + ']', + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + out += ' var ' + ($valid) + ' = true; '; + if ($isData) { + out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; + } + out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined '; + if ($ownProperties) { + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; + } + out += '; if (!' + ($valid) + ') break; } '; + if ($isData) { + out += ' } '; + } + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + } else { + out += ' if ( '; + var arr2 = $required; + if (arr2) { + var $propertyKey, $i = -1, + l2 = arr2.length - 1; + while ($i < l2) { + $propertyKey = arr2[$i += 1]; + if ($i) { + out += ' || '; + } + var $prop = it.util.getProperty($propertyKey), + $useData = $data + $prop; + out += ' ( ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; + } + } + out += ') { '; + var $propertyPath = 'missing' + $lvl, + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + } + } else { + if ($loopRequired) { + if (!$isData) { + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; + } + var $i = 'i' + $lvl, + $propertyPath = 'schema' + $lvl + '[' + $i + ']', + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + if ($isData) { + out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; + } + out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; + } + out += ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; + if ($isData) { + out += ' } '; + } + } else { + var arr3 = $required; + if (arr3) { + var $propertyKey, i3 = -1, + l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $prop = it.util.getProperty($propertyKey), + $missingProperty = it.util.escapeQuotes($propertyKey), + $useData = $data + $prop; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + out += ' if ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; + } + } + } + } + it.errorPath = $currentErrorPath; + } else if ($breakOnError) { + out += ' if (true) {'; + } + return out; +} + +},{}],34:[function(require,module,exports){ +'use strict'; +module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + if (($schema || $isData) && it.opts.uniqueItems !== false) { + if ($isData) { + out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; + } + out += ' var ' + ($valid) + ' = true; if (' + ($data) + '.length > 1) { var i = ' + ($data) + '.length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } } '; + if ($isData) { + out += ' } '; + } + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + } else { + if ($breakOnError) { + out += ' if (true) { '; + } + } + return out; +} + +},{}],35:[function(require,module,exports){ +'use strict'; +module.exports = function generate_validate(it, $keyword, $ruleType) { + var out = ''; + var $async = it.schema.$async === true, + $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'), + $id = it.self._getId(it.schema); + if (it.isTop) { + if ($async) { + it.async = true; + var $es7 = it.opts.async == 'es7'; + it.yieldAwait = $es7 ? 'await' : 'yield'; + } + out += ' var validate = '; + if ($async) { + if ($es7) { + out += ' (async function '; + } else { + if (it.opts.async != '*') { + out += 'co.wrap'; + } + out += '(function* '; + } + } else { + out += ' (function '; + } + out += ' (data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; '; + if ($id && (it.opts.sourceCode || it.opts.processCode)) { + out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' '; + } + } + if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) { + var $keyword = 'false schema'; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + if (it.schema === false) { + if (it.isTop) { + $breakOnError = true; + } else { + out += ' var ' + ($valid) + ' = false; '; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'boolean schema is false\' '; + } + if (it.opts.verbose) { + out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } else { + if (it.isTop) { + if ($async) { + out += ' return data; '; + } else { + out += ' validate.errors = null; return true; '; + } + } else { + out += ' var ' + ($valid) + ' = true; '; + } + } + if (it.isTop) { + out += ' }); return validate; '; + } + return out; + } + if (it.isTop) { + var $top = it.isTop, + $lvl = it.level = 0, + $dataLvl = it.dataLevel = 0, + $data = 'data'; + it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); + it.baseId = it.baseId || it.rootId; + delete it.isTop; + it.dataPathArr = [undefined]; + out += ' var vErrors = null; '; + out += ' var errors = 0; '; + out += ' if (rootData === undefined) rootData = data; '; + } else { + var $lvl = it.level, + $dataLvl = it.dataLevel, + $data = 'data' + ($dataLvl || ''); + if ($id) it.baseId = it.resolve.url(it.baseId, $id); + if ($async && !it.async) throw new Error('async schema in sync schema'); + out += ' var errs_' + ($lvl) + ' = errors;'; + } + var $valid = 'valid' + $lvl, + $breakOnError = !it.opts.allErrors, + $closingBraces1 = '', + $closingBraces2 = ''; + var $errorKeyword; + var $typeSchema = it.schema.type, + $typeIsArray = Array.isArray($typeSchema); + if ($typeIsArray && $typeSchema.length == 1) { + $typeSchema = $typeSchema[0]; + $typeIsArray = false; + } + if (it.schema.$ref && $refKeywords) { + if (it.opts.extendRefs == 'fail') { + throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); + } else if (it.opts.extendRefs !== true) { + $refKeywords = false; + it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); + } + } + if ($typeSchema) { + if (it.opts.coerceTypes) { + var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); + } + var $rulesGroup = it.RULES.types[$typeSchema]; + if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) { + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type'; + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type', + $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; + out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { '; + if ($coerceToTypes) { + var $dataType = 'dataType' + $lvl, + $coerced = 'coerced' + $lvl; + out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; '; + if (it.opts.coerceTypes == 'array') { + out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; '; + } + out += ' var ' + ($coerced) + ' = undefined; '; + var $bracesCoercion = ''; + var arr1 = $coerceToTypes; + if (arr1) { + var $type, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $type = arr1[$i += 1]; + if ($i) { + out += ' if (' + ($coerced) + ' === undefined) { '; + $bracesCoercion += '}'; + } + if (it.opts.coerceTypes == 'array' && $type != 'array') { + out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } '; + } + if ($type == 'string') { + out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; + } else if ($type == 'number' || $type == 'integer') { + out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; + if ($type == 'integer') { + out += ' && !(' + ($data) + ' % 1)'; + } + out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; + } else if ($type == 'boolean') { + out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; + } else if ($type == 'null') { + out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; + } else if (it.opts.coerceTypes == 'array' && $type == 'array') { + out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; + } + } + } + out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' ' + ($data) + ' = ' + ($coerced) + '; '; + if (!$dataLvl) { + out += 'if (' + ($parentData) + ' !== undefined)'; + } + out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } '; + } else { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } + out += ' } '; + } + } + if (it.schema.$ref && !$refKeywords) { + out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; + if ($breakOnError) { + out += ' } if (errors === '; + if ($top) { + out += '0'; + } else { + out += 'errs_' + ($lvl); + } + out += ') { '; + $closingBraces2 += '}'; + } + } else { + if (it.opts.v5 && it.schema.patternGroups) { + it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); + } + var arr2 = it.RULES; + if (arr2) { + var $rulesGroup, i2 = -1, + l2 = arr2.length - 1; + while (i2 < l2) { + $rulesGroup = arr2[i2 += 1]; + if ($shouldUseGroup($rulesGroup)) { + if ($rulesGroup.type) { + out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { '; + } + if (it.opts.useDefaults && !it.compositeRule) { + if ($rulesGroup.type == 'object' && it.schema.properties) { + var $schema = it.schema.properties, + $schemaKeys = Object.keys($schema); + var arr3 = $schemaKeys; + if (arr3) { + var $propertyKey, i3 = -1, + l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $sch = $schema[$propertyKey]; + if ($sch.default !== undefined) { + var $passData = $data + it.util.getProperty($propertyKey); + out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; + if (it.opts.useDefaults == 'shared') { + out += ' ' + (it.useDefault($sch.default)) + ' '; + } else { + out += ' ' + (JSON.stringify($sch.default)) + ' '; + } + out += '; '; + } + } + } + } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { + var arr4 = it.schema.items; + if (arr4) { + var $sch, $i = -1, + l4 = arr4.length - 1; + while ($i < l4) { + $sch = arr4[$i += 1]; + if ($sch.default !== undefined) { + var $passData = $data + '[' + $i + ']'; + out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; + if (it.opts.useDefaults == 'shared') { + out += ' ' + (it.useDefault($sch.default)) + ' '; + } else { + out += ' ' + (JSON.stringify($sch.default)) + ' '; + } + out += '; '; + } + } + } + } + } + var arr5 = $rulesGroup.rules; + if (arr5) { + var $rule, i5 = -1, + l5 = arr5.length - 1; + while (i5 < l5) { + $rule = arr5[i5 += 1]; + if ($shouldUseRule($rule)) { + var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); + if ($code) { + out += ' ' + ($code) + ' '; + if ($breakOnError) { + $closingBraces1 += '}'; + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces1) + ' '; + $closingBraces1 = ''; + } + if ($rulesGroup.type) { + out += ' } '; + if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { + out += ' else { '; + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + } + } + if ($breakOnError) { + out += ' if (errors === '; + if ($top) { + out += '0'; + } else { + out += 'errs_' + ($lvl); + } + out += ') { '; + $closingBraces2 += '}'; + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces2) + ' '; + } + if ($top) { + if ($async) { + out += ' if (errors === 0) return data; '; + out += ' else throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; '; + out += ' return errors === 0; '; + } + out += ' }); return validate;'; + } else { + out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; + } + out = it.util.cleanUpCode(out); + if ($top) { + out = it.util.finalCleanUpCode(out, $async); + } + + function $shouldUseGroup($rulesGroup) { + var rules = $rulesGroup.rules; + for (var i = 0; i < rules.length; i++) + if ($shouldUseRule(rules[i])) return true; + } + + function $shouldUseRule($rule) { + return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); + } + + function $ruleImplementsSomeKeyword($rule) { + var impl = $rule.implements; + for (var i = 0; i < impl.length; i++) + if (it.schema[impl[i]] !== undefined) return true; + } + return out; +} + +},{}],36:[function(require,module,exports){ +'use strict'; + +var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; +var customRuleCode = require('./dotjs/custom'); + +module.exports = { + add: addKeyword, + get: getKeyword, + remove: removeKeyword +}; + +/** + * Define custom keyword + * @this Ajv + * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). + * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. + * @return {Ajv} this for method chaining + */ +function addKeyword(keyword, definition) { + /* jshint validthis: true */ + /* eslint no-shadow: 0 */ + var RULES = this.RULES; + + if (RULES.keywords[keyword]) + throw new Error('Keyword ' + keyword + ' is already defined'); + + if (!IDENTIFIER.test(keyword)) + throw new Error('Keyword ' + keyword + ' is not a valid identifier'); + + if (definition) { + if (definition.macro && definition.valid !== undefined) + throw new Error('"valid" option cannot be used with macro keywords'); + + var dataType = definition.type; + if (Array.isArray(dataType)) { + var i, len = dataType.length; + for (i=0; i<len; i++) checkDataType(dataType[i]); + for (i=0; i<len; i++) _addRule(keyword, dataType[i], definition); + } else { + if (dataType) checkDataType(dataType); + _addRule(keyword, dataType, definition); + } + + var $data = definition.$data === true && this._opts.$data; + if ($data && !definition.validate) + throw new Error('$data support: "validate" function is not defined'); + + var metaSchema = definition.metaSchema; + if (metaSchema) { + if ($data) { + metaSchema = { + anyOf: [ + metaSchema, + { '$ref': 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#' } + ] + }; + } + definition.validateSchema = this.compile(metaSchema, true); + } + } + + RULES.keywords[keyword] = RULES.all[keyword] = true; + + + function _addRule(keyword, dataType, definition) { + var ruleGroup; + for (var i=0; i<RULES.length; i++) { + var rg = RULES[i]; + if (rg.type == dataType) { + ruleGroup = rg; + break; + } + } + + if (!ruleGroup) { + ruleGroup = { type: dataType, rules: [] }; + RULES.push(ruleGroup); + } + + var rule = { + keyword: keyword, + definition: definition, + custom: true, + code: customRuleCode, + implements: definition.implements + }; + ruleGroup.rules.push(rule); + RULES.custom[keyword] = rule; + } + + + function checkDataType(dataType) { + if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType); + } + + return this; +} + + +/** + * Get keyword + * @this Ajv + * @param {String} keyword pre-defined or custom keyword. + * @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise. + */ +function getKeyword(keyword) { + /* jshint validthis: true */ + var rule = this.RULES.custom[keyword]; + return rule ? rule.definition : this.RULES.keywords[keyword] || false; +} + + +/** + * Remove keyword + * @this Ajv + * @param {String} keyword pre-defined or custom keyword. + * @return {Ajv} this for method chaining + */ +function removeKeyword(keyword) { + /* jshint validthis: true */ + var RULES = this.RULES; + delete RULES.keywords[keyword]; + delete RULES.all[keyword]; + delete RULES.custom[keyword]; + for (var i=0; i<RULES.length; i++) { + var rules = RULES[i].rules; + for (var j=0; j<rules.length; j++) { + if (rules[j].keyword == keyword) { + rules.splice(j, 1); + break; + } + } + } + return this; +} + +},{"./dotjs/custom":21}],37:[function(require,module,exports){ +'use strict'; + +var META_SCHEMA_ID = 'http://json-schema.org/draft-06/schema'; + +module.exports = function (ajv) { + var defaultMeta = ajv._opts.defaultMeta; + var metaSchemaRef = typeof defaultMeta == 'string' + ? { $ref: defaultMeta } + : ajv.getSchema(META_SCHEMA_ID) + ? { $ref: META_SCHEMA_ID } + : {}; + + ajv.addKeyword('patternGroups', { + // implemented in properties.jst + metaSchema: { + type: 'object', + additionalProperties: { + type: 'object', + required: [ 'schema' ], + properties: { + maximum: { + type: 'integer', + minimum: 0 + }, + minimum: { + type: 'integer', + minimum: 0 + }, + schema: metaSchemaRef + }, + additionalProperties: false + } + } + }); + ajv.RULES.all.properties.implements.push('patternGroups'); +}; + +},{}],38:[function(require,module,exports){ +module.exports={ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#", + "description": "Meta-schema for $data reference (JSON-schema extension proposal)", + "type": "object", + "required": [ "$data" ], + "properties": { + "$data": { + "type": "string", + "anyOf": [ + { "format": "relative-json-pointer" }, + { "format": "json-pointer" } + ] + } + }, + "additionalProperties": false +} + +},{}],39:[function(require,module,exports){ +module.exports={ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": {} +} + +},{}],40:[function(require,module,exports){ + +/** + * slice() reference. + */ + +var slice = Array.prototype.slice; + +/** + * Expose `co`. + */ + +module.exports = co['default'] = co.co = co; + +/** + * Wrap the given generator `fn` into a + * function that returns a promise. + * This is a separate function so that + * every `co()` call doesn't create a new, + * unnecessary closure. + * + * @param {GeneratorFunction} fn + * @return {Function} + * @api public + */ + +co.wrap = function (fn) { + createPromise.__generatorFunction__ = fn; + return createPromise; + function createPromise() { + return co.call(this, fn.apply(this, arguments)); + } +}; + +/** + * Execute the generator function or a generator + * and return a promise. + * + * @param {Function} fn + * @return {Promise} + * @api public + */ + +function co(gen) { + var ctx = this; + var args = slice.call(arguments, 1) + + // we wrap everything in a promise to avoid promise chaining, + // which leads to memory leak errors. + // see https://github.com/tj/co/issues/180 + return new Promise(function(resolve, reject) { + if (typeof gen === 'function') gen = gen.apply(ctx, args); + if (!gen || typeof gen.next !== 'function') return resolve(gen); + + onFulfilled(); + + /** + * @param {Mixed} res + * @return {Promise} + * @api private + */ + + function onFulfilled(res) { + var ret; + try { + ret = gen.next(res); + } catch (e) { + return reject(e); + } + next(ret); + } + + /** + * @param {Error} err + * @return {Promise} + * @api private + */ + + function onRejected(err) { + var ret; + try { + ret = gen.throw(err); + } catch (e) { + return reject(e); + } + next(ret); + } + + /** + * Get the next value in the generator, + * return a promise. + * + * @param {Object} ret + * @return {Promise} + * @api private + */ + + function next(ret) { + if (ret.done) return resolve(ret.value); + var value = toPromise.call(ctx, ret.value); + if (value && isPromise(value)) return value.then(onFulfilled, onRejected); + return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, ' + + 'but the following object was passed: "' + String(ret.value) + '"')); + } + }); +} + +/** + * Convert a `yield`ed value into a promise. + * + * @param {Mixed} obj + * @return {Promise} + * @api private + */ + +function toPromise(obj) { + if (!obj) return obj; + if (isPromise(obj)) return obj; + if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj); + if ('function' == typeof obj) return thunkToPromise.call(this, obj); + if (Array.isArray(obj)) return arrayToPromise.call(this, obj); + if (isObject(obj)) return objectToPromise.call(this, obj); + return obj; +} + +/** + * Convert a thunk to a promise. + * + * @param {Function} + * @return {Promise} + * @api private + */ + +function thunkToPromise(fn) { + var ctx = this; + return new Promise(function (resolve, reject) { + fn.call(ctx, function (err, res) { + if (err) return reject(err); + if (arguments.length > 2) res = slice.call(arguments, 1); + resolve(res); + }); + }); +} + +/** + * Convert an array of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Array} obj + * @return {Promise} + * @api private + */ + +function arrayToPromise(obj) { + return Promise.all(obj.map(toPromise, this)); +} + +/** + * Convert an object of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Object} obj + * @return {Promise} + * @api private + */ + +function objectToPromise(obj){ + var results = new obj.constructor(); + var keys = Object.keys(obj); + var promises = []; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var promise = toPromise.call(this, obj[key]); + if (promise && isPromise(promise)) defer(promise, key); + else results[key] = obj[key]; + } + return Promise.all(promises).then(function () { + return results; + }); + + function defer(promise, key) { + // predefine the key in the result + results[key] = undefined; + promises.push(promise.then(function (res) { + results[key] = res; + })); + } +} + +/** + * Check if `obj` is a promise. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + +function isPromise(obj) { + return 'function' == typeof obj.then; +} + +/** + * Check if `obj` is a generator. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ + +function isGenerator(obj) { + return 'function' == typeof obj.next && 'function' == typeof obj.throw; +} + +/** + * Check if `obj` is a generator function. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ +function isGeneratorFunction(obj) { + var constructor = obj.constructor; + if (!constructor) return false; + if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true; + return isGenerator(constructor.prototype); +} + +/** + * Check for plain object. + * + * @param {Mixed} val + * @return {Boolean} + * @api private + */ + +function isObject(val) { + return Object == val.constructor; +} + +},{}],41:[function(require,module,exports){ +'use strict'; + +module.exports = function equal(a, b) { + if (a === b) return true; + + var arrA = Array.isArray(a) + , arrB = Array.isArray(b) + , i; + + if (arrA && arrB) { + if (a.length != b.length) return false; + for (i = 0; i < a.length; i++) + if (!equal(a[i], b[i])) return false; + return true; + } + + if (arrA != arrB) return false; + + if (a && b && typeof a === 'object' && typeof b === 'object') { + var keys = Object.keys(a); + if (keys.length !== Object.keys(b).length) return false; + + var dateA = a instanceof Date + , dateB = b instanceof Date; + if (dateA && dateB) return a.getTime() == b.getTime(); + if (dateA != dateB) return false; + + var regexpA = a instanceof RegExp + , regexpB = b instanceof RegExp; + if (regexpA && regexpB) return a.toString() == b.toString(); + if (regexpA != regexpB) return false; + + for (i = 0; i < keys.length; i++) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = 0; i < keys.length; i++) + if(!equal(a[keys[i]], b[keys[i]])) return false; + + return true; + } + + return false; +}; + +},{}],42:[function(require,module,exports){ +'use strict'; + +module.exports = function (data, opts) { + if (!opts) opts = {}; + if (typeof opts === 'function') opts = { cmp: opts }; + var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; + + var cmp = opts.cmp && (function (f) { + return function (node) { + return function (a, b) { + var aobj = { key: a, value: node[a] }; + var bobj = { key: b, value: node[b] }; + return f(aobj, bobj); + }; + }; + })(opts.cmp); + + var seen = []; + return (function stringify (node) { + if (node && node.toJSON && typeof node.toJSON === 'function') { + node = node.toJSON(); + } + + if (node === undefined) return; + if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; + if (typeof node !== 'object') return JSON.stringify(node); + + var i, out; + if (Array.isArray(node)) { + out = '['; + for (i = 0; i < node.length; i++) { + if (i) out += ','; + out += stringify(node[i]) || 'null'; + } + return out + ']'; + } + + if (node === null) return 'null'; + + if (seen.indexOf(node) !== -1) { + if (cycles) return JSON.stringify('__cycle__'); + throw new TypeError('Converting circular structure to JSON'); + } + + var seenIndex = seen.push(node) - 1; + var keys = Object.keys(node).sort(cmp && cmp(node)); + out = ''; + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = stringify(node[key]); + + if (!value) continue; + if (out) out += ','; + out += JSON.stringify(key) + ':' + value; + } + seen.splice(seenIndex, 1); + return '{' + out + '}'; + })(data); +}; + +},{}],43:[function(require,module,exports){ +'use strict'; + +var traverse = module.exports = function (schema, opts, cb) { + if (typeof opts == 'function') { + cb = opts; + opts = {}; + } + _traverse(opts, cb, schema, '', schema); +}; + + +traverse.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true +}; + +traverse.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true +}; + +traverse.propsKeywords = { + definitions: true, + properties: true, + patternProperties: true, + dependencies: true +}; + +traverse.skipKeywords = { + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true +}; + + +function _traverse(opts, cb, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (schema && typeof schema == 'object' && !Array.isArray(schema)) { + cb(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse.arrayKeywords) { + for (var i=0; i<sch.length; i++) + _traverse(opts, cb, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i); + } + } else if (key in traverse.propsKeywords) { + if (sch && typeof sch == 'object') { + for (var prop in sch) + _traverse(opts, cb, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop); + } + } else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) { + _traverse(opts, cb, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema); + } + } + } +} + + +function escapeJsonPtr(str) { + return str.replace(/~/g, '~0').replace(/\//g, '~1'); +} + +},{}],44:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see <https://mathiasbynens.be/notes/javascript-encoding> + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see <https://mathiasbynens.be/notes/javascript-encoding> + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],45:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +},{}],46:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{}],47:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":45,"./encode":46}],48:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var punycode = require('punycode'); +var util = require('./util'); + +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; + +exports.Url = Url; + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); + +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); +} + +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; +}; + +},{"./util":49,"punycode":44,"querystring":47}],49:[function(require,module,exports){ +'use strict'; + +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } +}; + +},{}],"ajv":[function(require,module,exports){ +'use strict'; + +var compileSchema = require('./compile') + , resolve = require('./compile/resolve') + , Cache = require('./cache') + , SchemaObject = require('./compile/schema_obj') + , stableStringify = require('fast-json-stable-stringify') + , formats = require('./compile/formats') + , rules = require('./compile/rules') + , $dataMetaSchema = require('./$data') + , patternGroups = require('./patternGroups') + , util = require('./compile/util') + , co = require('co'); + +module.exports = Ajv; + +Ajv.prototype.validate = validate; +Ajv.prototype.compile = compile; +Ajv.prototype.addSchema = addSchema; +Ajv.prototype.addMetaSchema = addMetaSchema; +Ajv.prototype.validateSchema = validateSchema; +Ajv.prototype.getSchema = getSchema; +Ajv.prototype.removeSchema = removeSchema; +Ajv.prototype.addFormat = addFormat; +Ajv.prototype.errorsText = errorsText; + +Ajv.prototype._addSchema = _addSchema; +Ajv.prototype._compile = _compile; + +Ajv.prototype.compileAsync = require('./compile/async'); +var customKeyword = require('./keyword'); +Ajv.prototype.addKeyword = customKeyword.add; +Ajv.prototype.getKeyword = customKeyword.get; +Ajv.prototype.removeKeyword = customKeyword.remove; + +var errorClasses = require('./compile/error_classes'); +Ajv.ValidationError = errorClasses.Validation; +Ajv.MissingRefError = errorClasses.MissingRef; +Ajv.$dataMetaSchema = $dataMetaSchema; + +var META_SCHEMA_ID = 'http://json-schema.org/draft-06/schema'; + +var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes' ]; +var META_SUPPORT_DATA = ['/properties']; + +/** + * Creates validator instance. + * Usage: `Ajv(opts)` + * @param {Object} opts optional options + * @return {Object} ajv instance + */ +function Ajv(opts) { + if (!(this instanceof Ajv)) return new Ajv(opts); + opts = this._opts = util.copy(opts) || {}; + setLogger(this); + this._schemas = {}; + this._refs = {}; + this._fragments = {}; + this._formats = formats(opts.format); + var schemaUriFormat = this._schemaUriFormat = this._formats['uri-reference']; + this._schemaUriFormatFunc = function (str) { return schemaUriFormat.test(str); }; + + this._cache = opts.cache || new Cache; + this._loadingSchemas = {}; + this._compilations = []; + this.RULES = rules(); + this._getId = chooseGetId(opts); + + opts.loopRequired = opts.loopRequired || Infinity; + if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true; + if (opts.serialize === undefined) opts.serialize = stableStringify; + this._metaOpts = getMetaSchemaOptions(this); + + if (opts.formats) addInitialFormats(this); + addDraft6MetaSchema(this); + if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta); + addInitialSchemas(this); + if (opts.patternGroups) patternGroups(this); +} + + + +/** + * Validate data using schema + * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize. + * @this Ajv + * @param {String|Object} schemaKeyRef key, ref or schema object + * @param {Any} data to be validated + * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). + */ +function validate(schemaKeyRef, data) { + var v; + if (typeof schemaKeyRef == 'string') { + v = this.getSchema(schemaKeyRef); + if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"'); + } else { + var schemaObj = this._addSchema(schemaKeyRef); + v = schemaObj.validate || this._compile(schemaObj); + } + + var valid = v(data); + if (v.$async === true) + return this._opts.async == '*' ? co(valid) : valid; + this.errors = v.errors; + return valid; +} + + +/** + * Create validating function for passed schema. + * @this Ajv + * @param {Object} schema schema object + * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. + * @return {Function} validating function + */ +function compile(schema, _meta) { + var schemaObj = this._addSchema(schema, undefined, _meta); + return schemaObj.validate || this._compile(schemaObj); +} + + +/** + * Adds schema to the instance. + * @this Ajv + * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. + * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. + * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + * @return {Ajv} this for method chaining + */ +function addSchema(schema, key, _skipValidation, _meta) { + if (Array.isArray(schema)){ + for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta); + return this; + } + var id = this._getId(schema); + if (id !== undefined && typeof id != 'string') + throw new Error('schema id must be string'); + key = resolve.normalizeId(key || id); + checkUnique(this, key); + this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true); + return this; +} + + +/** + * Add schema that will be used to validate other schemas + * options in META_IGNORE_OPTIONS are alway set to false + * @this Ajv + * @param {Object} schema schema object + * @param {String} key optional schema key + * @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema + * @return {Ajv} this for method chaining + */ +function addMetaSchema(schema, key, skipValidation) { + this.addSchema(schema, key, skipValidation, true); + return this; +} + + +/** + * Validate schema + * @this Ajv + * @param {Object} schema schema to validate + * @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid + * @return {Boolean} true if schema is valid + */ +function validateSchema(schema, throwOrLogError) { + var $schema = schema.$schema; + if ($schema !== undefined && typeof $schema != 'string') + throw new Error('$schema must be a string'); + $schema = $schema || this._opts.defaultMeta || defaultMeta(this); + if (!$schema) { + this.logger.warn('meta-schema not available'); + this.errors = null; + return true; + } + var currentUriFormat = this._formats.uri; + this._formats.uri = typeof currentUriFormat == 'function' + ? this._schemaUriFormatFunc + : this._schemaUriFormat; + var valid; + try { valid = this.validate($schema, schema); } + finally { this._formats.uri = currentUriFormat; } + if (!valid && throwOrLogError) { + var message = 'schema is invalid: ' + this.errorsText(); + if (this._opts.validateSchema == 'log') this.logger.error(message); + else throw new Error(message); + } + return valid; +} + + +function defaultMeta(self) { + var meta = self._opts.meta; + self._opts.defaultMeta = typeof meta == 'object' + ? self._getId(meta) || meta + : self.getSchema(META_SCHEMA_ID) + ? META_SCHEMA_ID + : undefined; + return self._opts.defaultMeta; +} + + +/** + * Get compiled schema from the instance by `key` or `ref`. + * @this Ajv + * @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id). + * @return {Function} schema validating function (with property `schema`). + */ +function getSchema(keyRef) { + var schemaObj = _getSchemaObj(this, keyRef); + switch (typeof schemaObj) { + case 'object': return schemaObj.validate || this._compile(schemaObj); + case 'string': return this.getSchema(schemaObj); + case 'undefined': return _getSchemaFragment(this, keyRef); + } +} + + +function _getSchemaFragment(self, ref) { + var res = resolve.schema.call(self, { schema: {} }, ref); + if (res) { + var schema = res.schema + , root = res.root + , baseId = res.baseId; + var v = compileSchema.call(self, schema, root, undefined, baseId); + self._fragments[ref] = new SchemaObject({ + ref: ref, + fragment: true, + schema: schema, + root: root, + baseId: baseId, + validate: v + }); + return v; + } +} + + +function _getSchemaObj(self, keyRef) { + keyRef = resolve.normalizeId(keyRef); + return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef]; +} + + +/** + * Remove cached schema(s). + * If no parameter is passed all schemas but meta-schemas are removed. + * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + * Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + * @this Ajv + * @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object + * @return {Ajv} this for method chaining + */ +function removeSchema(schemaKeyRef) { + if (schemaKeyRef instanceof RegExp) { + _removeAllSchemas(this, this._schemas, schemaKeyRef); + _removeAllSchemas(this, this._refs, schemaKeyRef); + return this; + } + switch (typeof schemaKeyRef) { + case 'undefined': + _removeAllSchemas(this, this._schemas); + _removeAllSchemas(this, this._refs); + this._cache.clear(); + return this; + case 'string': + var schemaObj = _getSchemaObj(this, schemaKeyRef); + if (schemaObj) this._cache.del(schemaObj.cacheKey); + delete this._schemas[schemaKeyRef]; + delete this._refs[schemaKeyRef]; + return this; + case 'object': + var serialize = this._opts.serialize; + var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef; + this._cache.del(cacheKey); + var id = this._getId(schemaKeyRef); + if (id) { + id = resolve.normalizeId(id); + delete this._schemas[id]; + delete this._refs[id]; + } + } + return this; +} + + +function _removeAllSchemas(self, schemas, regex) { + for (var keyRef in schemas) { + var schemaObj = schemas[keyRef]; + if (!schemaObj.meta && (!regex || regex.test(keyRef))) { + self._cache.del(schemaObj.cacheKey); + delete schemas[keyRef]; + } + } +} + + +/* @this Ajv */ +function _addSchema(schema, skipValidation, meta, shouldAddSchema) { + if (typeof schema != 'object' && typeof schema != 'boolean') + throw new Error('schema should be object or boolean'); + var serialize = this._opts.serialize; + var cacheKey = serialize ? serialize(schema) : schema; + var cached = this._cache.get(cacheKey); + if (cached) return cached; + + shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false; + + var id = resolve.normalizeId(this._getId(schema)); + if (id && shouldAddSchema) checkUnique(this, id); + + var willValidate = this._opts.validateSchema !== false && !skipValidation; + var recursiveMeta; + if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema))) + this.validateSchema(schema, true); + + var localRefs = resolve.ids.call(this, schema); + + var schemaObj = new SchemaObject({ + id: id, + schema: schema, + localRefs: localRefs, + cacheKey: cacheKey, + meta: meta + }); + + if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj; + this._cache.put(cacheKey, schemaObj); + + if (willValidate && recursiveMeta) this.validateSchema(schema, true); + + return schemaObj; +} + + +/* @this Ajv */ +function _compile(schemaObj, root) { + if (schemaObj.compiling) { + schemaObj.validate = callValidate; + callValidate.schema = schemaObj.schema; + callValidate.errors = null; + callValidate.root = root ? root : callValidate; + if (schemaObj.schema.$async === true) + callValidate.$async = true; + return callValidate; + } + schemaObj.compiling = true; + + var currentOpts; + if (schemaObj.meta) { + currentOpts = this._opts; + this._opts = this._metaOpts; + } + + var v; + try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); } + finally { + schemaObj.compiling = false; + if (schemaObj.meta) this._opts = currentOpts; + } + + schemaObj.validate = v; + schemaObj.refs = v.refs; + schemaObj.refVal = v.refVal; + schemaObj.root = v.root; + return v; + + + function callValidate() { + var _validate = schemaObj.validate; + var result = _validate.apply(null, arguments); + callValidate.errors = _validate.errors; + return result; + } +} + + +function chooseGetId(opts) { + switch (opts.schemaId) { + case '$id': return _get$Id; + case 'id': return _getId; + default: return _get$IdOrId; + } +} + +/* @this Ajv */ +function _getId(schema) { + if (schema.$id) this.logger.warn('schema $id ignored', schema.$id); + return schema.id; +} + +/* @this Ajv */ +function _get$Id(schema) { + if (schema.id) this.logger.warn('schema id ignored', schema.id); + return schema.$id; +} + + +function _get$IdOrId(schema) { + if (schema.$id && schema.id && schema.$id != schema.id) + throw new Error('schema $id is different from id'); + return schema.$id || schema.id; +} + + +/** + * Convert array of error message objects to string + * @this Ajv + * @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used. + * @param {Object} options optional options with properties `separator` and `dataVar`. + * @return {String} human readable string with all errors descriptions + */ +function errorsText(errors, options) { + errors = errors || this.errors; + if (!errors) return 'No errors'; + options = options || {}; + var separator = options.separator === undefined ? ', ' : options.separator; + var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; + + var text = ''; + for (var i=0; i<errors.length; i++) { + var e = errors[i]; + if (e) text += dataVar + e.dataPath + ' ' + e.message + separator; + } + return text.slice(0, -separator.length); +} + + +/** + * Add custom format + * @this Ajv + * @param {String} name format name + * @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) + * @return {Ajv} this for method chaining + */ +function addFormat(name, format) { + if (typeof format == 'string') format = new RegExp(format); + this._formats[name] = format; + return this; +} + + +function addDraft6MetaSchema(self) { + var $dataSchema; + if (self._opts.$data) { + $dataSchema = require('./refs/$data.json'); + self.addMetaSchema($dataSchema, $dataSchema.$id, true); + } + if (self._opts.meta === false) return; + var metaSchema = require('./refs/json-schema-draft-06.json'); + if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA); + self.addMetaSchema(metaSchema, META_SCHEMA_ID, true); + self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID; +} + + +function addInitialSchemas(self) { + var optsSchemas = self._opts.schemas; + if (!optsSchemas) return; + if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas); + else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key); +} + + +function addInitialFormats(self) { + for (var name in self._opts.formats) { + var format = self._opts.formats[name]; + self.addFormat(name, format); + } +} + + +function checkUnique(self, id) { + if (self._schemas[id] || self._refs[id]) + throw new Error('schema with key or id "' + id + '" already exists'); +} + + +function getMetaSchemaOptions(self) { + var metaOpts = util.copy(self._opts); + for (var i=0; i<META_IGNORE_OPTIONS.length; i++) + delete metaOpts[META_IGNORE_OPTIONS[i]]; + return metaOpts; +} + + +function setLogger(self) { + var logger = self._opts.logger; + if (logger === false) { + self.logger = {log: noop, warn: noop, error: noop}; + } else { + if (logger === undefined) logger = console; + if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error)) + throw new Error('logger must implement log, warn and error methods'); + self.logger = logger; + } +} + + +function noop() {} + +},{"./$data":1,"./cache":2,"./compile":7,"./compile/async":4,"./compile/error_classes":5,"./compile/formats":6,"./compile/resolve":8,"./compile/rules":9,"./compile/schema_obj":10,"./compile/util":12,"./keyword":36,"./patternGroups":37,"./refs/$data.json":38,"./refs/json-schema-draft-06.json":39,"co":40,"fast-json-stable-stringify":42}]},{},[])("ajv") +}); \ No newline at end of file diff --git a/appasar/canary/node_modules/ajv/dist/ajv.min.js b/appasar/canary/node_modules/ajv/dist/ajv.min.js new file mode 100644 index 0000000..f5267c9 --- /dev/null +++ b/appasar/canary/node_modules/ajv/dist/ajv.min.js @@ -0,0 +1,3 @@ +/* ajv 5.5.2: Another JSON Schema Validator */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Ajv=e()}}(function(){return function e(r,t,a){function s(i,n){if(!t[i]){if(!r[i]){var l="function"==typeof require&&require;if(!n&&l)return l(i,!0);if(o)return o(i,!0);var h=new Error("Cannot find module '"+i+"'");throw h.code="MODULE_NOT_FOUND",h}var u=t[i]={exports:{}};r[i][0].call(u.exports,function(e){var t=r[i][1][e];return s(t||e)},u,u.exports,e,r,t,a)}return t[i].exports}for(var o="function"==typeof require&&require,i=0;i<a.length;i++)s(a[i]);return s}({1:[function(e,r,t){"use strict";var a=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];r.exports=function(e,r){for(var t=0;t<r.length;t++){e=JSON.parse(JSON.stringify(e));var s,o=r[t].split("/"),i=e;for(s=1;s<o.length;s++)i=i[o[s]];for(s=0;s<a.length;s++){var n=a[s],l=i[n];l&&(i[n]={anyOf:[l,{$ref:"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#"}]})}}return e}},{}],2:[function(e,r,t){"use strict";var a=r.exports=function(){this._cache={}};a.prototype.put=function(e,r){this._cache[e]=r},a.prototype.get=function(e){return this._cache[e]},a.prototype.del=function(e){delete this._cache[e]},a.prototype.clear=function(){this._cache={}}},{}],3:[function(e,r,t){"use strict";r.exports={$ref:e("../dotjs/ref"),allOf:e("../dotjs/allOf"),anyOf:e("../dotjs/anyOf"),const:e("../dotjs/const"),contains:e("../dotjs/contains"),dependencies:e("../dotjs/dependencies"),enum:e("../dotjs/enum"),format:e("../dotjs/format"),items:e("../dotjs/items"),maximum:e("../dotjs/_limit"),minimum:e("../dotjs/_limit"),maxItems:e("../dotjs/_limitItems"),minItems:e("../dotjs/_limitItems"),maxLength:e("../dotjs/_limitLength"),minLength:e("../dotjs/_limitLength"),maxProperties:e("../dotjs/_limitProperties"),minProperties:e("../dotjs/_limitProperties"),multipleOf:e("../dotjs/multipleOf"),not:e("../dotjs/not"),oneOf:e("../dotjs/oneOf"),pattern:e("../dotjs/pattern"),properties:e("../dotjs/properties"),propertyNames:e("../dotjs/propertyNames"),required:e("../dotjs/required"),uniqueItems:e("../dotjs/uniqueItems"),validate:e("../dotjs/validate")}},{"../dotjs/_limit":13,"../dotjs/_limitItems":14,"../dotjs/_limitLength":15,"../dotjs/_limitProperties":16,"../dotjs/allOf":17,"../dotjs/anyOf":18,"../dotjs/const":19,"../dotjs/contains":20,"../dotjs/dependencies":22,"../dotjs/enum":23,"../dotjs/format":24,"../dotjs/items":25,"../dotjs/multipleOf":26,"../dotjs/not":27,"../dotjs/oneOf":28,"../dotjs/pattern":29,"../dotjs/properties":30,"../dotjs/propertyNames":31,"../dotjs/ref":32,"../dotjs/required":33,"../dotjs/uniqueItems":34,"../dotjs/validate":35}],4:[function(e,r,t){"use strict";function a(e,r,t){function o(e){var r=e.$schema;return r&&!n.getSchema(r)?a.call(n,{$ref:r},!0):Promise.resolve()}function i(e){try{return n._compile(e)}catch(t){if(t instanceof s)return function(t){function a(){delete n._loadingSchemas[l]}function s(e){return n._refs[e]||n._schemas[e]}var l=t.missingSchema;if(s(l))throw new Error("Schema "+l+" is loaded but "+t.missingRef+" cannot be resolved");var h=n._loadingSchemas[l];return h||(h=n._loadingSchemas[l]=n._opts.loadSchema(l)).then(a,a),h.then(function(e){if(!s(l))return o(e).then(function(){s(l)||n.addSchema(e,l,void 0,r)})}).then(function(){return i(e)})}(t);throw t}}var n=this;if("function"!=typeof this._opts.loadSchema)throw new Error("options.loadSchema should be a function");"function"==typeof r&&(t=r,r=void 0);var l=o(e).then(function(){var t=n._addSchema(e,void 0,r);return t.validate||i(t)});return t&&l.then(function(e){t(null,e)},t),l}var s=e("./error_classes").MissingRef;r.exports=a},{"./error_classes":5}],5:[function(e,r,t){"use strict";function a(e,r,t){this.message=t||a.message(e,r),this.missingRef=o.url(e,r),this.missingSchema=o.normalizeId(o.fullPath(this.missingRef))}function s(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var o=e("./resolve");r.exports={Validation:s(function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0}),MissingRef:s(a)},a.message=function(e,r){return"can't resolve reference "+r+" from id "+e}},{"./resolve":8}],6:[function(e,r,t){"use strict";function a(e){return e="full"==e?"full":"fast",n.copy(a[e])}function s(e){var r=e.match(l);if(!r)return!1;var t=+r[1],a=+r[2];return t>=1&&t<=12&&a>=1&&a<=h[t]}function o(e,r){var t=e.match(u);if(!t)return!1;return t[1]<=23&&t[2]<=59&&t[3]<=59&&(!r||t[5])}function i(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}var n=e("./util"),l=/^\d\d\d\d-(\d\d)-(\d\d)$/,h=[0,31,29,31,30,31,30,31,31,30,31,30,31],u=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i,c=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,f=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,p=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,m=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,v=/^(?:\/(?:[^~/]|~0|~1)*)*$|^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,y=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;r.exports=a,a.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i,uri:/^(?:[a-z][a-z0-9+-.]*)(?::|\/)\/?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i,"uri-template":f,url:p,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:c,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:i,uuid:m,"json-pointer":v,"relative-json-pointer":y},a.full={date:s,time:o,"date-time":function(e){var r=e.split(g);return 2==r.length&&s(r[0])&&o(r[1],!0)},uri:function(e){return P.test(e)&&d.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":f,url:p,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:function(e){return e.length<=255&&c.test(e)},ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:i,uuid:m,"json-pointer":v,"relative-json-pointer":y};var g=/t|\s/i,P=/\/|:/,E=/[^\\]\\Z/},{"./util":12}],7:[function(e,r,t){"use strict";function a(e,r,t,P){function E(){var e=C.validate,r=e.apply(null,arguments);return E.errors=e.errors,r}function w(e,t,s,f){var P=!t||t&&t.schema==e;if(t.schema!=r.schema)return a.call($,e,t,s,f);var E=!0===e.$async,w=p({isTop:!0,schema:e,isRoot:P,baseId:f,root:t,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:d.MissingRef,RULES:U,validate:p,util:c,resolve:u,resolveRef:b,usePattern:_,useDefault:x,useCustomRule:F,opts:R,formats:Q,logger:$.logger,self:$});w=h(O,n)+h(I,o)+h(k,i)+h(L,l)+w,R.processCode&&(w=R.processCode(w));var S;try{S=new Function("self","RULES","formats","root","refVal","defaults","customRules","co","equal","ucs2length","ValidationError",w)($,U,Q,r,O,k,L,m,y,v,g),O[0]=S}catch(e){throw $.logger.error("Error compiling schema, function code:",w),e}return S.schema=e,S.errors=null,S.refs=D,S.refVal=O,S.root=P?S:t,E&&(S.$async=!0),!0===R.sourceCode&&(S.source={code:w,patterns:I,defaults:k}),S}function b(e,s,o){s=u.url(e,s);var i,n,l=D[s];if(void 0!==l)return i=O[l],n="refVal["+l+"]",j(i,n);if(!o&&r.refs){var h=r.refs[s];if(void 0!==h)return i=r.refVal[h],n=S(s,i),j(i,n)}n=S(s);var c=u.call($,w,r,s);if(void 0===c){var d=t&&t[s];d&&(c=u.inlineRef(d,R.inlineRefs)?d:a.call($,d,r,t,e))}if(void 0!==c)return function(e,r){O[D[e]]=r}(s,c),j(c,n);!function(e){delete D[e]}(s)}function S(e,r){var t=O.length;return O[t]=r,D[e]=t,"refVal"+t}function j(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&e.$async}}function _(e){var r=A[e];return void 0===r&&(r=A[e]=I.length,I[r]=e),"pattern"+r}function x(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return c.toQuotedString(e);case"object":if(null===e)return"null";var r=f(e),t=q[r];return void 0===t&&(t=q[r]=k.length,k[t]=e),"default"+t}}function F(e,r,t,a){var s=e.definition.validateSchema;if(s&&!1!==$._opts.validateSchema){if(!s(r)){var o="keyword schema is invalid: "+$.errorsText(s.errors);if("log"!=$._opts.validateSchema)throw new Error(o);$.logger.error(o)}}var i,n=e.definition.compile,l=e.definition.inline,h=e.definition.macro;if(n)i=n.call($,r,t,a);else if(h)i=h.call($,r,t,a),!1!==R.validateSchema&&$.validateSchema(i,!0);else if(l)i=l.call($,a,e.keyword,r,t);else if(!(i=e.definition.validate))return;if(void 0===i)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var u=L.length;return L[u]=i,{code:"customRule"+u,validate:i}}var $=this,R=this._opts,O=[void 0],D={},I=[],A={},k=[],q={},L=[],z=function(e,r,t){var a=s.call(this,e,r,t);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:r,baseId:t},{index:a,compiling:!1})}.call(this,e,r=r||{schema:e,refVal:O,refs:D},P),C=this._compilations[z.index];if(z.compiling)return C.callValidate=E;var Q=this._formats,U=this.RULES;try{var V=w(e,r,t,P);C.validate=V;var N=C.callValidate;return N&&(N.schema=V.schema,N.errors=null,N.refs=V.refs,N.refVal=V.refVal,N.root=V.root,N.$async=V.$async,R.sourceCode&&(N.source=V.source)),V}finally{(function(e,r,t){var a=s.call(this,e,r,t);a>=0&&this._compilations.splice(a,1)}).call(this,e,r,P)}}function s(e,r,t){for(var a=0;a<this._compilations.length;a++){var s=this._compilations[a];if(s.schema==e&&s.root==r&&s.baseId==t)return a}return-1}function o(e,r){return"var pattern"+e+" = new RegExp("+c.toQuotedString(r[e])+");"}function i(e){return"var default"+e+" = defaults["+e+"];"}function n(e,r){return void 0===r[e]?"":"var refVal"+e+" = refVal["+e+"];"}function l(e){return"var customRule"+e+" = customRules["+e+"];"}function h(e,r){if(!e.length)return"";for(var t="",a=0;a<e.length;a++)t+=r(a,e);return t}var u=e("./resolve"),c=e("./util"),d=e("./error_classes"),f=e("fast-json-stable-stringify"),p=e("../dotjs/validate"),m=e("co"),v=c.ucs2length,y=e("fast-deep-equal"),g=d.Validation;r.exports=a},{"../dotjs/validate":35,"./error_classes":5,"./resolve":8,"./util":12,co:40,"fast-deep-equal":41,"fast-json-stable-stringify":42}],8:[function(e,r,t){"use strict";function a(e,r,t){var o=this._refs[t];if("string"==typeof o){if(!this._refs[o])return a.call(this,e,r,o);o=this._refs[o]}if((o=o||this._schemas[t])instanceof v)return i(o.schema,this._opts.inlineRefs)?o.schema:o.validate||this._compile(o);var n,l,h,u=s.call(this,r,t);return u&&(n=u.schema,r=u.root,h=u.baseId),n instanceof v?l=n.validate||e.call(this,n.schema,r,void 0,h):void 0!==n&&(l=i(n,this._opts.inlineRefs)?n:e.call(this,n,r,void 0,h)),l}function s(e,r){var t=f.parse(r,!1,!0),a=u(t),i=h(this._getId(e.schema));if(a!==i){var n=c(a),l=this._refs[n];if("string"==typeof l)return function(e,r,t){var a=s.call(this,e,r);if(a){var i=a.schema,n=a.baseId;e=a.root;var l=this._getId(i);return l&&(n=d(n,l)),o.call(this,t,n,i,e)}}.call(this,e,l,t);if(l instanceof v)l.validate||this._compile(l),e=l;else{if(!((l=this._schemas[n])instanceof v))return;if(l.validate||this._compile(l),n==c(r))return{schema:l,root:e,baseId:i};e=l}if(!e.schema)return;i=h(this._getId(e.schema))}return o.call(this,t,i,e.schema,e)}function o(e,r,t,a){if(e.hash=e.hash||"","#/"==e.hash.slice(0,2)){for(var o=e.hash.split("/"),i=1;i<o.length;i++){var n=o[i];if(n){if(n=m.unescapeFragment(n),void 0===(t=t[n]))break;var l;if(!g[n]&&((l=this._getId(t))&&(r=d(r,l)),t.$ref)){var h=d(r,t.$ref),u=s.call(this,a,h);u&&(t=u.schema,a=u.root,r=u.baseId)}}}return void 0!==t&&t!==a.schema?{schema:t,root:a,baseId:r}:void 0}}function i(e,r){return!1!==r&&(void 0===r||!0===r?n(e):r?l(e)<=r:void 0)}function n(e){var r;if(Array.isArray(e)){for(var t=0;t<e.length;t++)if("object"==typeof(r=e[t])&&!n(r))return!1}else for(var a in e){if("$ref"==a)return!1;if("object"==typeof(r=e[a])&&!n(r))return!1}return!0}function l(e){var r,t=0;if(Array.isArray(e)){for(var a=0;a<e.length;a++)if("object"==typeof(r=e[a])&&(t+=l(r)),t==1/0)return 1/0}else for(var s in e){if("$ref"==s)return 1/0;if(P[s])t++;else if("object"==typeof(r=e[s])&&(t+=l(r)+1),t==1/0)return 1/0}return t}function h(e,r){!1!==r&&(e=c(e));return u(f.parse(e,!1,!0))}function u(e){var r=e.protocol||"//"==e.href.slice(0,2)?"//":"";return(e.protocol||"")+r+(e.host||"")+(e.path||"")+"#"}function c(e){return e?e.replace(E,""):""}function d(e,r){return r=c(r),f.resolve(e,r)}var f=e("url"),p=e("fast-deep-equal"),m=e("./util"),v=e("./schema_obj"),y=e("json-schema-traverse");r.exports=a,a.normalizeId=c,a.fullPath=h,a.url=d,a.ids=function(e){var r=c(this._getId(e)),t={"":r},a={"":h(r,!1)},s={},o=this;return y(e,{allKeys:!0},function(e,r,i,n,l,h,u){if(""!==r){var d=o._getId(e),v=t[n],y=a[n]+"/"+l;if(void 0!==u&&(y+="/"+("number"==typeof u?u:m.escapeFragment(u))),"string"==typeof d){d=v=c(v?f.resolve(v,d):d);var g=o._refs[d];if("string"==typeof g&&(g=o._refs[g]),g&&g.schema){if(!p(e,g.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=c(y))if("#"==d[0]){if(s[d]&&!p(e,s[d]))throw new Error('id "'+d+'" resolves to more than one schema');s[d]=e}else o._refs[d]=y}t[r]=v,a[r]=y}}),s},a.inlineRef=i,a.schema=s;var g=m.toHash(["properties","patternProperties","enum","dependencies","definitions"]),P=m.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]),E=/#\/?$/},{"./schema_obj":10,"./util":12,"fast-deep-equal":41,"json-schema-traverse":43,url:48}],9:[function(e,r,t){"use strict";var a=e("./_rules"),s=e("./util").toHash;r.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","uniqueItems","contains","items"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf"]}],r=["type"];return e.all=s(r),e.types=s(["number","integer","string","array","object","boolean","null"]),e.forEach(function(t){t.rules=t.rules.map(function(t){var s;if("object"==typeof t){var o=Object.keys(t)[0];s=t[o],t=o,s.forEach(function(t){r.push(t),e.all[t]=!0})}r.push(t);return e.all[t]={keyword:t,code:a[t],implements:s}}),t.type&&(e.types[t.type]=t)}),e.keywords=s(r.concat(["additionalItems","$schema","$id","id","title","description","default","definitions"])),e.custom={},e}},{"./_rules":3,"./util":12}],10:[function(e,r,t){"use strict";var a=e("./util");r.exports=function(e){a.copy(e,this)}},{"./util":12}],11:[function(e,r,t){"use strict";r.exports=function(e){for(var r,t=0,a=e.length,s=0;s<a;)t++,(r=e.charCodeAt(s++))>=55296&&r<=56319&&s<a&&56320==(64512&(r=e.charCodeAt(s)))&&s++;return t}},{}],12:[function(e,r,t){"use strict";function a(e,r,t){var a=t?" !== ":" === ",s=t?" || ":" && ",o=t?"!":"",i=t?"":"!";switch(e){case"null":return r+a+"null";case"array":return o+"Array.isArray("+r+")";case"object":return"("+o+r+s+"typeof "+r+a+'"object"'+s+i+"Array.isArray("+r+"))";case"integer":return"(typeof "+r+a+'"number"'+s+i+"("+r+" % 1)"+s+r+a+r+")";default:return"typeof "+r+a+'"'+e+'"'}}function s(e){for(var r={},t=0;t<e.length;t++)r[e[t]]=!0;return r}function o(e){return"number"==typeof e?"["+e+"]":d.test(e)?"."+e:"['"+i(e)+"']"}function i(e){return e.replace(f,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function n(e){return"'"+i(e)+"'"}function l(e,r){return'""'==e?r:(e+" + "+r).replace(/' \+ '/g,"")}function h(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function u(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}r.exports={copy:function(e,r){r=r||{};for(var t in e)r[t]=e[t];return r},checkDataType:a,checkDataTypes:function(e,r){switch(e.length){case 1:return a(e[0],r,!0);default:var t="",o=s(e);o.array&&o.object&&(t=o.null?"(":"(!"+r+" || ",t+="typeof "+r+' !== "object")',delete o.null,delete o.array,delete o.object),o.number&&delete o.integer;for(var i in o)t+=(t?" && ":"")+a(i,r,!0);return t}},coerceToTypes:function(e,r){if(Array.isArray(r)){for(var t=[],a=0;a<r.length;a++){var s=r[a];c[s]?t[t.length]=s:"array"===e&&"array"===s&&(t[t.length]=s)}if(t.length)return t}else{if(c[r])return[r];if("array"===e&&"array"===r)return["array"]}},toHash:s,getProperty:o,escapeQuotes:i,equal:e("fast-deep-equal"),ucs2length:e("./ucs2length"),varOccurences:function(e,r){r+="[^0-9]";var t=e.match(new RegExp(r,"g"));return t?t.length:0},varReplace:function(e,r,t){return r+="([^0-9])",t=t.replace(/\$/g,"$$$$"),e.replace(new RegExp(r,"g"),t+"$1")},cleanUpCode:function(e){return e.replace(p,"").replace(m,"").replace(v,"if (!($1))")},finalCleanUpCode:function(e,r){var t=e.match(y);return t&&2==t.length&&(e=r?e.replace(P,"").replace(b,S):e.replace(g,"").replace(E,w)),(t=e.match(j))&&3===t.length?e.replace(_,""):e},schemaHasRules:function(e,r){if("boolean"==typeof e)return!e;for(var t in e)if(r[t])return!0},schemaHasRulesExcept:function(e,r,t){if("boolean"==typeof e)return!e&&"not"!=t;for(var a in e)if(a!=t&&r[a])return!0},toQuotedString:n,getPathExpr:function(e,r,t,a){return l(e,t?"'/' + "+r+(a?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):a?"'[' + "+r+" + ']'":"'[\\'' + "+r+" + '\\']'")},getPath:function(e,r,t){return l(e,n(t?"/"+h(r):o(r)))},getData:function(e,r,t){var a,s,i,n;if(""===e)return"rootData";if("/"==e[0]){if(!x.test(e))throw new Error("Invalid JSON-pointer: "+e);s=e,i="rootData"}else{if(!(n=e.match(F)))throw new Error("Invalid JSON-pointer: "+e);if(a=+n[1],"#"==(s=n[2])){if(a>=r)throw new Error("Cannot access property/index "+a+" levels up, current level is "+r);return t[r-a]}if(a>r)throw new Error("Cannot access data "+a+" levels up, current level is "+r);if(i="data"+(r-a||""),!s)return i}for(var l=i,h=s.split("/"),c=0;c<h.length;c++){var d=h[c];d&&(l+=" && "+(i+=o(u(d))))}return l},unescapeFragment:function(e){return u(decodeURIComponent(e))},unescapeJsonPointer:u,escapeFragment:function(e){return encodeURIComponent(h(e))},escapeJsonPointer:h};var c=s(["string","number","integer","boolean","null"]),d=/^[a-z$_][a-z$_0-9]*$/i,f=/'|\\/g,p=/else\s*{\s*}/g,m=/if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g,v=/if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g,y=/[^v.]errors/g,g=/var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g,P=/var errors = 0;|var vErrors = null;/g,E="return errors === 0;",w="validate.errors = null; return true;",b=/if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/,S="return data;",j=/[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g,_=/if \(rootData === undefined\) rootData = data;/,x=/^\/(?:[^~]|~0|~1)*$/,F=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/},{"./ucs2length":11,"fast-deep-equal":41}],13:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var f="maximum"==r,p=f?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[p],v=f?"<":">",y=f?">":"<",g=void 0;if(e.opts.$data&&m&&m.$data){var P=e.util.getData(m.$data,i,e.dataPathArr),E="exclusive"+o,w="exclType"+o,b="exclIsNumber"+o,S="' + "+(_="op"+o)+" + '";s+=" var schemaExcl"+o+" = "+P+"; ",s+=" var "+E+"; var "+w+" = typeof "+(P="schemaExcl"+o)+"; if ("+w+" != 'boolean' && "+w+" != 'undefined' && "+w+" != 'number') { ";g=p;(x=x||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(g||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var j=s;s=x.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+j+"]); ":" validate.errors = ["+j+"]; return false; ":" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+w+" == 'number' ? ( ("+E+" = "+a+" === undefined || "+P+" "+v+"= "+a+") ? "+c+" "+y+"= "+P+" : "+c+" "+y+" "+a+" ) : ( ("+E+" = "+P+" === true) ? "+c+" "+y+"= "+a+" : "+c+" "+y+" "+a+" ) || "+c+" !== "+c+") { var op"+o+" = "+E+" ? '"+v+"' : '"+v+"=';"}else{S=v;if((b="number"==typeof m)&&d){var _="'"+S+"'";s+=" if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ( "+a+" === undefined || "+m+" "+v+"= "+a+" ? "+c+" "+y+"= "+m+" : "+c+" "+y+" "+a+" ) || "+c+" !== "+c+") { "}else{b&&void 0===n?(E=!0,g=p,h=e.errSchemaPath+"/"+p,a=m,y+="="):(b&&(a=Math[f?"min":"max"](m,n)),m===(!b||a)?(E=!0,g=p,h=e.errSchemaPath+"/"+p,y+="="):(E=!1,S+="="));_="'"+S+"'";s+=" if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+c+" "+y+" "+a+" || "+c+" !== "+c+") { "}}g=g||r;var x;(x=x||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(g||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { comparison: "+_+", limit: "+a+", exclusive: "+E+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+S+" ",s+=d?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";j=s;return s=x.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+j+"]); ":" validate.errors = ["+j+"]; return false; ":" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+c+".length "+("maxItems"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==r?"more":"less",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ",s+=" "+("maxLength"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==r?"longer":"shorter",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==r?"more":"less",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.schema[r],o=e.schemaPath+e.util.getProperty(r),i=e.errSchemaPath+"/"+r,n=!e.opts.allErrors,l=e.util.copy(e),h="";l.level++;var u="valid"+l.level,c=l.baseId,d=!0,f=s;if(f)for(var p,m=-1,v=f.length-1;m<v;)p=f[m+=1],e.util.schemaHasRules(p,e.RULES.all)&&(d=!1,l.schema=p,l.schemaPath=o+"["+m+"]",l.errSchemaPath=i+"/"+m,a+=" "+e.validate(l)+" ",l.baseId=c,n&&(a+=" if ("+u+") { ",h+="}"));return n&&(a+=d?" if (true) { ":" "+h.slice(0,-1)+" "),a=e.util.cleanUpCode(a)}},{}],18:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level;if(i.every(function(r){return e.util.schemaHasRules(r,e.RULES.all)})){var v=f.baseId;a+=" var "+d+" = errors; var "+c+" = false; ";var y=e.compositeRule;e.compositeRule=f.compositeRule=!0;var g=i;if(g)for(var P,E=-1,w=g.length-1;E<w;)P=g[E+=1],f.schema=P,f.schemaPath=n+"["+E+"]",f.errSchemaPath=l+"/"+E,a+=" "+e.validate(f)+" ",f.baseId=v,a+=" "+c+" = "+c+" || "+m+"; if (!"+c+") { ",p+="}";e.compositeRule=f.compositeRule=y,a+=" "+p+" if (!"+c+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(a+=e.async?" throw new ValidationError(vErrors); ":" validate.errors = vErrors; return false; "),a+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } "),a=e.util.cleanUpCode(a)}else h&&(a+=" if (true) { ");return a}},{}],19:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d=e.opts.$data&&i&&i.$data;d&&(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; "),d||(a+=" var schema"+s+" = validate.schema"+n+";"),a+="var "+c+" = equal("+u+", schema"+s+"); if (!"+c+") { ";var f=f||[];f.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var p=a;return a=f.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",h&&(a+=" else { "),a}},{}],20:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e);f.level++;var p="valid"+f.level,m="i"+s,v=f.dataLevel=e.dataLevel+1,y="data"+v,g=e.baseId,P=e.util.schemaHasRules(i,e.RULES.all);if(a+="var "+d+" = errors;var "+c+";",P){var E=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=i,f.schemaPath=n,f.errSchemaPath=l,a+=" var "+p+" = false; for (var "+m+" = 0; "+m+" < "+u+".length; "+m+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0);var w=u+"["+m+"]";f.dataPathArr[v]=m;var b=e.validate(f);f.baseId=g,e.util.varOccurences(b,y)<2?a+=" "+e.util.varReplace(b,y,w)+" ":a+=" var "+y+" = "+w+"; "+b+" ",a+=" if ("+p+") break; } ",e.compositeRule=f.compositeRule=E,a+=" if (!"+p+") {"}else a+=" if ("+u+".length == 0) {";var S=S||[];S.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var j=a;return a=S.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+j+"]); ":" validate.errors = ["+j+"]; return false; ":" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",P&&(a+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a=e.util.cleanUpCode(a)}},{}],21:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s,o=" ",i=e.level,n=e.dataLevel,l=e.schema[r],h=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,d="data"+(n||""),f="valid"+i,p="errs__"+i,m=e.opts.$data&&l&&l.$data;m?(o+=" var schema"+i+" = "+e.util.getData(l.$data,n,e.dataPathArr)+"; ",s="schema"+i):s=l;var v,y,g,P,E,w="definition"+i,b=this.definition,S="";if(m&&b.$data){var j=b.validateSchema;o+=" var "+w+" = RULES.custom['"+r+"'].definition; var "+(E="keywordValidate"+i)+" = "+w+".validate;"}else{if(!(P=e.useCustomRule(this,l,e.schema,e)))return;s="validate.schema"+h,E=P.code,v=b.compile,y=b.inline,g=b.macro}var _=E+".errors",x="i"+i,F="ruleErr"+i,$=b.async;if($&&!e.async)throw new Error("async keyword in sync schema");if(y||g||(o+=_+" = null;"),o+="var "+p+" = errors;var "+f+";",m&&b.$data&&(S+="}",o+=" if ("+s+" === undefined) { "+f+" = true; } else { ",j&&(S+="}",o+=" "+f+" = "+w+".validateSchema("+s+"); if ("+f+") { ")),y)o+=b.statements?" "+P.validate+" ":" "+f+" = "+P.validate+"; ";else if(g){var R=e.util.copy(e);S="";R.level++;var O="valid"+R.level;R.schema=P.validate,R.schemaPath="";var D=e.compositeRule;e.compositeRule=R.compositeRule=!0;var I=e.validate(R).replace(/validate\.schema/g,E);e.compositeRule=R.compositeRule=D,o+=" "+I}else{(L=L||[]).push(o),o="",o+=" "+E+".call( ",o+=e.opts.passContext?"this":"self",o+=v||!1===b.schema?" , "+d+" ":" , "+s+" , "+d+" , validate.schema"+e.schemaPath+" ",o+=" , (dataPath || '')",'""'!=e.errorPath&&(o+=" + "+e.errorPath);var A=n?"data"+(n-1||""):"parentData",k=n?e.dataPathArr[n]:"parentDataProperty",q=o+=" , "+A+" , "+k+" , rootData ) ";o=L.pop(),!1===b.errors?(o+=" "+f+" = ",$&&(o+=""+e.yieldAwait),o+=q+"; "):o+=$?" var "+(_="customErrors"+i)+" = null; try { "+f+" = "+e.yieldAwait+q+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+_+" = e.errors; else throw e; } ":" "+_+" = null; "+f+" = "+q+"; "}if(b.modifying&&(o+=" if ("+A+") "+d+" = "+A+"["+k+"];"),o+=""+S,b.valid)c&&(o+=" if (true) { ");else{o+=" if ( ",void 0===b.valid?(o+=" !",o+=g?""+O:""+f):o+=" "+!b.valid+" ",o+=") { ",a=this.keyword;(L=L||[]).push(o),o="";var L;(L=L||[]).push(o),o="",!1!==e.createErrors?(o+=" { keyword: '"+(a||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+this.keyword+"' } ",!1!==e.opts.messages&&(o+=" , message: 'should pass \""+this.keyword+"\" keyword validation' "),e.opts.verbose&&(o+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),o+=" } "):o+=" {} ";var z=o;o=L.pop();var C=o+=!e.compositeRule&&c?e.async?" throw new ValidationError(["+z+"]); ":" validate.errors = ["+z+"]; return false; ":" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";o=L.pop(),y?b.errors?"full"!=b.errors&&(o+=" for (var "+x+"="+p+"; "+x+"<errors; "+x+"++) { var "+F+" = vErrors["+x+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(o+=" "+F+".schema = "+s+"; "+F+".data = "+d+"; "),o+=" } "):!1===b.errors?o+=" "+C+" ":(o+=" if ("+p+" == errors) { "+C+" } else { for (var "+x+"="+p+"; "+x+"<errors; "+x+"++) { var "+F+" = vErrors["+x+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+F+".schemaPath === undefined) { "+F+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(o+=" "+F+".schema = "+s+"; "+F+".data = "+d+"; "),o+=" } } "):g?(o+=" var err = ",!1!==e.createErrors?(o+=" { keyword: '"+(a||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+this.keyword+"' } ",!1!==e.opts.messages&&(o+=" , message: 'should pass \""+this.keyword+"\" keyword validation' "),e.opts.verbose&&(o+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),o+=" } "):o+=" {} ",o+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(o+=e.async?" throw new ValidationError(vErrors); ":" validate.errors = vErrors; return false; ")):!1===b.errors?o+=" "+C+" ":(o+=" if (Array.isArray("+_+")) { if (vErrors === null) vErrors = "+_+"; else vErrors = vErrors.concat("+_+"); errors = vErrors.length; for (var "+x+"="+p+"; "+x+"<errors; "+x+"++) { var "+F+" = vErrors["+x+"]; if ("+F+".dataPath === undefined) "+F+".dataPath = (dataPath || '') + "+e.errorPath+"; "+F+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(o+=" "+F+".schema = "+s+"; "+F+".data = "+d+"; "),o+=" } } else { "+C+" } "),o+=" } ",c&&(o+=" else { ")}return o}},{}],22:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="errs__"+s,d=e.util.copy(e),f="";d.level++;var p="valid"+d.level,m={},v={},y=e.opts.ownProperties;for(w in i){var g=i[w],P=Array.isArray(g)?v:m;P[w]=g}a+="var "+c+" = errors;";var E=e.errorPath;a+="var missing"+s+";";for(var w in v)if((P=v[w]).length){if(a+=" if ( "+u+e.util.getProperty(w)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(w)+"') "),h){a+=" && ( ";var b=P;if(b)for(var S=-1,j=b.length-1;S<j;){O=b[S+=1],S&&(a+=" || ");a+=" ( ( "+(k=u+(A=e.util.getProperty(O)))+" === undefined ",y&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(O)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?O:A)+") ) "}a+=")) { ";var _="missing"+s,x="' + "+_+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,_,!0):E+" + "+_);var F=F||[];F.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(w)+"', missingProperty: '"+x+"', depsCount: "+P.length+", deps: '"+e.util.escapeQuotes(1==P.length?P[0]:P.join(", "))+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should have ",a+=1==P.length?"property "+e.util.escapeQuotes(P[0]):"properties "+e.util.escapeQuotes(P.join(", ")),a+=" when property "+e.util.escapeQuotes(w)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var $=a;a=F.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+$+"]); ":" validate.errors = ["+$+"]; return false; ":" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var R=P;if(R)for(var O,D=-1,I=R.length-1;D<I;){O=R[D+=1];var A=e.util.getProperty(O),k=(x=e.util.escapeQuotes(O),u+A);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,O,e.opts.jsonPointers)),a+=" if ( "+k+" === undefined ",y&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(O)+"') "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { property: '"+e.util.escapeQuotes(w)+"', missingProperty: '"+x+"', depsCount: "+P.length+", deps: '"+e.util.escapeQuotes(1==P.length?P[0]:P.join(", "))+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should have ",a+=1==P.length?"property "+e.util.escapeQuotes(P[0]):"properties "+e.util.escapeQuotes(P.join(", ")),a+=" when property "+e.util.escapeQuotes(w)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" } ",h&&(f+="}",a+=" else { ")}e.errorPath=E;var q=d.baseId;for(var w in m){e.util.schemaHasRules(g=m[w],e.RULES.all)&&(a+=" "+p+" = true; if ( "+u+e.util.getProperty(w)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(w)+"') "),a+=") { ",d.schema=g,d.schemaPath=n+e.util.getProperty(w),d.errSchemaPath=l+"/"+e.util.escapeFragment(w),a+=" "+e.validate(d)+" ",d.baseId=q,a+=" } ",h&&(a+=" if ("+p+") { ",f+="}"))}return h&&(a+=" "+f+" if ("+c+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],23:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d=e.opts.$data&&i&&i.$data;d&&(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var f="i"+s,p="schema"+s;d||(a+=" var "+p+" = validate.schema"+n+";"),a+="var "+c+";",d&&(a+=" if (schema"+s+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+s+")) "+c+" = false; else {"),a+=c+" = false;for (var "+f+"=0; "+f+"<"+p+".length; "+f+"++) if (equal("+u+", "+p+"["+f+"])) { "+c+" = true; break; }",d&&(a+=" } "),a+=" if (!"+c+") { ";var m=m||[];m.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValues: schema"+s+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var v=a;return a=m.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+v+"]); ":" validate.errors = ["+v+"]; return false; ":" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",h&&(a+=" else { "),a}},{}],24:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||"");if(!1===e.opts.format)return h&&(a+=" if (true) { "),a;var c,d=e.opts.$data&&i&&i.$data;d?(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",c="schema"+s):c=i;var f=e.opts.unknownFormats,p=Array.isArray(f);if(d){a+=" var "+(m="format"+s)+" = formats["+c+"]; var "+(v="isObject"+s)+" = typeof "+m+" == 'object' && !("+m+" instanceof RegExp) && "+m+".validate; var "+(y="formatType"+s)+" = "+v+" && "+m+".type || 'string'; if ("+v+") { ",e.async&&(a+=" var async"+s+" = "+m+".async; "),a+=" "+m+" = "+m+".validate; } if ( ",d&&(a+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),a+=" (","ignore"!=f&&(a+=" ("+c+" && !"+m+" ",p&&(a+=" && self._opts.unknownFormats.indexOf("+c+") == -1 "),a+=") || "),a+=" ("+m+" && "+y+" == '"+t+"' && !(typeof "+m+" == 'function' ? ",a+=e.async?" (async"+s+" ? "+e.yieldAwait+" "+m+"("+u+") : "+m+"("+u+")) ":" "+m+"("+u+") ",a+=" : "+m+".test("+u+"))))) {"}else{var m;if(!(m=e.formats[i])){if("ignore"==f)return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),h&&(a+=" if (true) { "),a;if(p&&f.indexOf(i)>=0)return h&&(a+=" if (true) { "),a;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var v,y=(v="object"==typeof m&&!(m instanceof RegExp)&&m.validate)&&m.type||"string";if(v){var g=!0===m.async;m=m.validate}if(y!=t)return h&&(a+=" if (true) { "),a;if(g){if(!e.async)throw new Error("async format in sync schema");var P="formats"+e.util.getProperty(i)+".validate";a+=" if (!("+e.yieldAwait+" "+P+"("+u+"))) { "}else{a+=" if (! ";P="formats"+e.util.getProperty(i);v&&(P+=".validate"),a+="function"==typeof m?" "+P+"("+u+") ":" "+P+".test("+u+") ",a+=") { "}}var E=E||[];E.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",a+=d?""+c:""+e.util.toQuotedString(i),a+=" } ",!1!==e.opts.messages&&(a+=" , message: 'should match format \"",a+=d?"' + "+c+" + '":""+e.util.escapeQuotes(i),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=d?"validate.schema"+n:""+e.util.toQuotedString(i),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var w=a;return a=E.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+w+"]); ":" validate.errors = ["+w+"]; return false; ":" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { "),a}},{}],25:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level,v="i"+s,y=f.dataLevel=e.dataLevel+1,g="data"+y,P=e.baseId;if(a+="var "+d+" = errors;var "+c+";",Array.isArray(i)){var E=e.schema.additionalItems;if(!1===E){a+=" "+c+" = "+u+".length <= "+i.length+"; ";var w=l;l=e.errSchemaPath+"/additionalItems",a+=" if (!"+c+") { ";var b=b||[];b.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+i.length+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var S=a;a=b.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l=w,h&&(p+="}",a+=" else { ")}var j=i;if(j)for(var _,x=-1,F=j.length-1;x<F;)if(_=j[x+=1],e.util.schemaHasRules(_,e.RULES.all)){a+=" "+m+" = true; if ("+u+".length > "+x+") { ";var $=u+"["+x+"]";f.schema=_,f.schemaPath=n+"["+x+"]",f.errSchemaPath=l+"/"+x,f.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0),f.dataPathArr[y]=x;var R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",a+=" } ",h&&(a+=" if ("+m+") { ",p+="}")}if("object"==typeof E&&e.util.schemaHasRules(E,e.RULES.all)){f.schema=E,f.schemaPath=e.schemaPath+".additionalItems",f.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+m+" = true; if ("+u+".length > "+i.length+") { for (var "+v+" = "+i.length+"; "+v+" < "+u+".length; "+v+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);$=u+"["+v+"]";f.dataPathArr[y]=v;R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",h&&(a+=" if (!"+m+") break; "),a+=" } } ",h&&(a+=" if ("+m+") { ",p+="}")}}else if(e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=n,f.errSchemaPath=l,a+=" for (var "+v+" = 0; "+v+" < "+u+".length; "+v+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);$=u+"["+v+"]";f.dataPathArr[y]=v;R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",h&&(a+=" if (!"+m+") break; "),a+=" }"}return h&&(a+=" "+p+" if ("+d+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],26:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n,s+="var division"+o+";if (",d&&(s+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),s+=" (division"+o+" = "+c+" / "+a+", ",s+=e.opts.multipleOfPrecision?" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":" division"+o+" !== parseInt(division"+o+") ",s+=" ) ",d&&(s+=" ) "),s+=" ) { ";var f=f||[];f.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { multipleOf: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be multiple of ",s+=d?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var p=s;return s=f.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],27:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="errs__"+s,d=e.util.copy(e);d.level++;var f="valid"+d.level;if(e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=n,d.errSchemaPath=l,a+=" var "+c+" = errors; ";var p=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var m;d.opts.allErrors&&(m=d.opts.allErrors,d.opts.allErrors=!1),a+=" "+e.validate(d)+" ",d.createErrors=!0,m&&(d.opts.allErrors=m),e.compositeRule=d.compositeRule=p,a+=" if ("+f+") { ";var v=v||[];v.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var y=a;a=v.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+y+"]); ":" validate.errors = ["+y+"]; return false; ":" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(a+=" if (false) { ");return a}},{}],28:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level;a+="var "+d+" = errors;var prevValid"+s+" = false;var "+c+" = false;";var v=f.baseId,y=e.compositeRule;e.compositeRule=f.compositeRule=!0;var g=i;if(g)for(var P,E=-1,w=g.length-1;E<w;)P=g[E+=1],e.util.schemaHasRules(P,e.RULES.all)?(f.schema=P,f.schemaPath=n+"["+E+"]",f.errSchemaPath=l+"/"+E,a+=" "+e.validate(f)+" ",f.baseId=v):a+=" var "+m+" = true; ",E&&(a+=" if ("+m+" && prevValid"+s+") "+c+" = false; else { ",p+="}"),a+=" if ("+m+") "+c+" = prevValid"+s+" = true;";return e.compositeRule=f.compositeRule=y,a+=p+"if (!"+c+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(a+=e.async?" throw new ValidationError(vErrors); ":" validate.errors = vErrors; return false; "),a+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}},{}],29:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;var f=d?"(new RegExp("+a+"))":e.usePattern(n);s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'string') || "),s+=" !"+f+".test("+c+") ) { ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { pattern: ",s+=d?""+a:""+e.util.toQuotedString(n),s+=" } ",!1!==e.opts.messages&&(s+=" , message: 'should match pattern \"",s+=d?"' + "+a+" + '":""+e.util.escapeQuotes(n),s+="\"' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+e.util.toQuotedString(n),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],30:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level,v="key"+s,y="idx"+s,g=f.dataLevel=e.dataLevel+1,P="data"+g,E="dataProperties"+s,w=Object.keys(i||{}),b=e.schema.patternProperties||{},S=Object.keys(b),j=e.schema.additionalProperties,_=w.length||S.length,x=!1===j,F="object"==typeof j&&Object.keys(j).length,$=e.opts.removeAdditional,R=x||F||$,O=e.opts.ownProperties,D=e.baseId,I=e.schema.required;if(I&&(!e.opts.v5||!I.$data)&&I.length<e.opts.loopRequired)var A=e.util.toHash(I);if(e.opts.patternGroups)var k=e.schema.patternGroups||{},q=Object.keys(k);if(a+="var "+d+" = errors;var "+m+" = true;",O&&(a+=" var "+E+" = undefined;"),R){if(a+=O?" "+E+" = "+E+" || Object.keys("+u+"); for (var "+y+"=0; "+y+"<"+E+".length; "+y+"++) { var "+v+" = "+E+"["+y+"]; ":" for (var "+v+" in "+u+") { ",_){if(a+=" var isAdditional"+s+" = !(false ",w.length)if(w.length>5)a+=" || validate.schema"+n+"["+v+"] ";else{var L=w;if(L)for(var z=-1,C=L.length-1;z<C;)X=L[z+=1],a+=" || "+v+" == "+e.util.toQuotedString(X)+" "}if(S.length){var Q=S;if(Q)for(var U=-1,V=Q.length-1;U<V;)ne=Q[U+=1],a+=" || "+e.usePattern(ne)+".test("+v+") "}if(e.opts.patternGroups&&q.length){var N=q;if(N){U=-1;for(var T=N.length-1;U<T;)ce=N[U+=1],a+=" || "+e.usePattern(ce)+".test("+v+") "}}a+=" ); if (isAdditional"+s+") { "}if("all"==$)a+=" delete "+u+"["+v+"]; ";else{var M=e.errorPath,H="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),x)if($)a+=" delete "+u+"["+v+"]; ";else{a+=" "+m+" = false; ";var K=l;l=e.errSchemaPath+"/additionalProperties";(we=we||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { additionalProperty: '"+H+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have additional properties' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var B=a;a=we.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+B+"]); ":" validate.errors = ["+B+"]; return false; ":" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=K,h&&(a+=" break; ")}else if(F)if("failing"==$){a+=" var "+d+" = errors; ";var G=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=j,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var J=u+"["+v+"]";f.dataPathArr[g]=v;var Z=e.validate(f);f.baseId=D,e.util.varOccurences(Z,P)<2?a+=" "+e.util.varReplace(Z,P,J)+" ":a+=" var "+P+" = "+J+"; "+Z+" ",a+=" if (!"+m+") { errors = "+d+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+u+"["+v+"]; } ",e.compositeRule=f.compositeRule=G}else{f.schema=j,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);J=u+"["+v+"]";f.dataPathArr[g]=v;Z=e.validate(f);f.baseId=D,e.util.varOccurences(Z,P)<2?a+=" "+e.util.varReplace(Z,P,J)+" ":a+=" var "+P+" = "+J+"; "+Z+" ",h&&(a+=" if (!"+m+") break; ")}e.errorPath=M}_&&(a+=" } "),a+=" } ",h&&(a+=" if ("+m+") { ",p+="}")}var Y=e.opts.useDefaults&&!e.compositeRule;if(w.length){var W=w;if(W)for(var X,ee=-1,re=W.length-1;ee<re;){X=W[ee+=1];if(e.util.schemaHasRules(pe=i[X],e.RULES.all)){var te=e.util.getProperty(X),ae=(J=u+te,Y&&void 0!==pe.default);f.schema=pe,f.schemaPath=n+te,f.errSchemaPath=l+"/"+e.util.escapeFragment(X),f.errorPath=e.util.getPath(e.errorPath,X,e.opts.jsonPointers),f.dataPathArr[g]=e.util.toQuotedString(X);Z=e.validate(f);if(f.baseId=D,e.util.varOccurences(Z,P)<2){Z=e.util.varReplace(Z,P,J);var se=J}else{se=P;a+=" var "+P+" = "+J+"; "}if(ae)a+=" "+Z+" ";else{if(A&&A[X]){a+=" if ( "+se+" === undefined ",O&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(X)+"') "),a+=") { "+m+" = false; ";M=e.errorPath,K=l;var oe=e.util.escapeQuotes(X);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(M,X,e.opts.jsonPointers)),l=e.errSchemaPath+"/required";(we=we||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+oe+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+oe+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";B=a;a=we.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+B+"]); ":" validate.errors = ["+B+"]; return false; ":" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=K,e.errorPath=M,a+=" } else { "}else h?(a+=" if ( "+se+" === undefined ",O&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(X)+"') "),a+=") { "+m+" = true; } else { "):(a+=" if ("+se+" !== undefined ",O&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(X)+"') "),a+=" ) { ");a+=" "+Z+" } "}}h&&(a+=" if ("+m+") { ",p+="}")}}if(S.length){var ie=S;if(ie)for(var ne,le=-1,he=ie.length-1;le<he;){ne=ie[le+=1];if(e.util.schemaHasRules(pe=b[ne],e.RULES.all)){f.schema=pe,f.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),f.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),a+=O?" "+E+" = "+E+" || Object.keys("+u+"); for (var "+y+"=0; "+y+"<"+E+".length; "+y+"++) { var "+v+" = "+E+"["+y+"]; ":" for (var "+v+" in "+u+") { ",a+=" if ("+e.usePattern(ne)+".test("+v+")) { ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);J=u+"["+v+"]";f.dataPathArr[g]=v;Z=e.validate(f);f.baseId=D,e.util.varOccurences(Z,P)<2?a+=" "+e.util.varReplace(Z,P,J)+" ":a+=" var "+P+" = "+J+"; "+Z+" ",h&&(a+=" if (!"+m+") break; "),a+=" } ",h&&(a+=" else "+m+" = true; "),a+=" } ",h&&(a+=" if ("+m+") { ",p+="}")}}}if(e.opts.patternGroups&&q.length){var ue=q;if(ue)for(var ce,de=-1,fe=ue.length-1;de<fe;){var pe,me=k[ce=ue[de+=1]];if(e.util.schemaHasRules(pe=me.schema,e.RULES.all)){f.schema=pe,f.schemaPath=e.schemaPath+".patternGroups"+e.util.getProperty(ce)+".schema",f.errSchemaPath=e.errSchemaPath+"/patternGroups/"+e.util.escapeFragment(ce)+"/schema",a+=" var pgPropCount"+s+" = 0; ",a+=O?" "+E+" = "+E+" || Object.keys("+u+"); for (var "+y+"=0; "+y+"<"+E+".length; "+y+"++) { var "+v+" = "+E+"["+y+"]; ":" for (var "+v+" in "+u+") { ",a+=" if ("+e.usePattern(ce)+".test("+v+")) { pgPropCount"+s+"++; ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);J=u+"["+v+"]";f.dataPathArr[g]=v;Z=e.validate(f);f.baseId=D,e.util.varOccurences(Z,P)<2?a+=" "+e.util.varReplace(Z,P,J)+" ":a+=" var "+P+" = "+J+"; "+Z+" ",h&&(a+=" if (!"+m+") break; "),a+=" } ",h&&(a+=" else "+m+" = true; "),a+=" } ",h&&(a+=" if ("+m+") { ",p+="}");var ve=me.minimum,ye=me.maximum;if(void 0!==ve||void 0!==ye){a+=" var "+c+" = true; ";K=l;if(void 0!==ve){var ge=ve,Pe="minimum",Ee="less";a+=" "+c+" = pgPropCount"+s+" >= "+ve+"; ",l=e.errSchemaPath+"/patternGroups/minimum",a+=" if (!"+c+") { ";(we=we||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { reason: '"+Pe+"', limit: "+ge+", pattern: '"+e.util.escapeQuotes(ce)+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have "+Ee+" than "+ge+' properties matching pattern "'+e.util.escapeQuotes(ce)+"\"' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";B=a;a=we.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+B+"]); ":" validate.errors = ["+B+"]; return false; ":" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",void 0!==ye&&(a+=" else ")}if(void 0!==ye){ge=ye,Pe="maximum",Ee="more";a+=" "+c+" = pgPropCount"+s+" <= "+ye+"; ",l=e.errSchemaPath+"/patternGroups/maximum",a+=" if (!"+c+") { ";var we;(we=we||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { reason: '"+Pe+"', limit: "+ge+", pattern: '"+e.util.escapeQuotes(ce)+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have "+Ee+" than "+ge+' properties matching pattern "'+e.util.escapeQuotes(ce)+"\"' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";B=a;a=we.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+B+"]); ":" validate.errors = ["+B+"]; return false; ":" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}l=K,h&&(a+=" if ("+c+") { ",p+="}")}}}}return h&&(a+=" "+p+" if ("+d+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],31:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="errs__"+s,d=e.util.copy(e);d.level++;var f="valid"+d.level;if(e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=n,d.errSchemaPath=l;var p="key"+s,m="idx"+s,v="i"+s,y="' + "+p+" + '",g="data"+(d.dataLevel=e.dataLevel+1),P="dataProperties"+s,E=e.opts.ownProperties,w=e.baseId;a+=" var "+c+" = errors; ",E&&(a+=" var "+P+" = undefined; "),a+=E?" "+P+" = "+P+" || Object.keys("+u+"); for (var "+m+"=0; "+m+"<"+P+".length; "+m+"++) { var "+p+" = "+P+"["+m+"]; ":" for (var "+p+" in "+u+") { ",a+=" var startErrs"+s+" = errors; ";var b=p,S=e.compositeRule;e.compositeRule=d.compositeRule=!0;var j=e.validate(d);d.baseId=w,e.util.varOccurences(j,g)<2?a+=" "+e.util.varReplace(j,g,b)+" ":a+=" var "+g+" = "+b+"; "+j+" ",e.compositeRule=d.compositeRule=S,a+=" if (!"+f+") { for (var "+v+"=startErrs"+s+"; "+v+"<errors; "+v+"++) { vErrors["+v+"].propertyName = "+p+"; } var err = ",!1!==e.createErrors?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { propertyName: '"+y+"' } ",!1!==e.opts.messages&&(a+=" , message: 'property name \\'"+y+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(a+=e.async?" throw new ValidationError(vErrors); ":" validate.errors = vErrors; return false; "),h&&(a+=" break; "),a+=" } }"}return h&&(a+=" if ("+c+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],32:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s,o=" ",i=e.dataLevel,n=e.schema[r],l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(i||""),c="valid"+e.level;if("#"==n||"#/"==n)e.isRoot?(a=e.async,s="validate"):(a=!0===e.root.schema.$async,s="root.refVal[0]");else{var d=e.resolveRef(e.baseId,n,e.isRoot);if(void 0===d){var f=e.MissingRefError.message(e.baseId,n);if("fail"==e.opts.missingRefs){e.logger.error(f);(y=y||[]).push(o),o="",!1!==e.createErrors?(o+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(n)+"' } ",!1!==e.opts.messages&&(o+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(n)+"' "),e.opts.verbose&&(o+=" , schema: "+e.util.toQuotedString(n)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),o+=" } "):o+=" {} ";var p=o;o=y.pop(),o+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(o+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs)throw new e.MissingRefError(e.baseId,n,f);e.logger.warn(f),h&&(o+=" if (true) { ")}}else if(d.inline){var m=e.util.copy(e);m.level++;var v="valid"+m.level;m.schema=d.schema,m.schemaPath="",m.errSchemaPath=n;o+=" "+e.validate(m).replace(/validate\.schema/g,d.code)+" ",h&&(o+=" if ("+v+") { ")}else a=!0===d.$async,s=d.code}if(s){var y;(y=y||[]).push(o),o="",o+=e.opts.passContext?" "+s+".call(this, ":" "+s+"( ",o+=" "+u+", (dataPath || '')",'""'!=e.errorPath&&(o+=" + "+e.errorPath);var g=o+=" , "+(i?"data"+(i-1||""):"parentData")+" , "+(i?e.dataPathArr[i]:"parentDataProperty")+", rootData) ";if(o=y.pop(),a){if(!e.async)throw new Error("async schema referenced by sync schema");h&&(o+=" var "+c+"; "),o+=" try { "+e.yieldAwait+" "+g+"; ",h&&(o+=" "+c+" = true; "),o+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",h&&(o+=" "+c+" = false; "),o+=" } ",h&&(o+=" if ("+c+") { ")}else o+=" if (!"+g+") { if (vErrors === null) vErrors = "+s+".errors; else vErrors = vErrors.concat("+s+".errors); errors = vErrors.length; } ",h&&(o+=" else { ")}return o}},{}],33:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d=e.opts.$data&&i&&i.$data;d&&(a+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var f="schema"+s;if(!d)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var p=[],m=i;if(m)for(var v,y=-1,g=m.length-1;y<g;){v=m[y+=1];var P=e.schema.properties[v];P&&e.util.schemaHasRules(P,e.RULES.all)||(p[p.length]=v)}}else p=i;if(d||p.length){var E=e.errorPath,w=d||p.length>=e.opts.loopRequired,b=e.opts.ownProperties;if(h)if(a+=" var missing"+s+"; ",w){d||(a+=" var "+f+" = validate.schema"+n+"; ");var S="' + "+(R="schema"+s+"["+(x="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,R,e.opts.jsonPointers)),a+=" var "+c+" = true; ",d&&(a+=" if (schema"+s+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+s+")) "+c+" = false; else {"),a+=" for (var "+x+" = 0; "+x+" < "+f+".length; "+x+"++) { "+c+" = "+u+"["+f+"["+x+"]] !== undefined ",b&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", "+f+"["+x+"]) "),a+="; if (!"+c+") break; } ",d&&(a+=" } "),a+=" if (!"+c+") { ";($=$||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+S+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+S+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var j=a;a=$.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+j+"]); ":" validate.errors = ["+j+"]; return false; ":" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var _=p;if(_)for(var x=-1,F=_.length-1;x<F;){D=_[x+=1],x&&(a+=" || ");a+=" ( ( "+(q=u+(k=e.util.getProperty(D)))+" === undefined ",b&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(D)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?D:k)+") ) "}a+=") { ";S="' + "+(R="missing"+s)+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,R,!0):E+" + "+R);var $;($=$||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+S+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+S+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";j=a;a=$.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+j+"]); ":" validate.errors = ["+j+"]; return false; ":" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(w){d||(a+=" var "+f+" = validate.schema"+n+"; ");var R;S="' + "+(R="schema"+s+"["+(x="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,R,e.opts.jsonPointers)),d&&(a+=" if ("+f+" && !Array.isArray("+f+")) { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+S+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+S+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+f+" !== undefined) { "),a+=" for (var "+x+" = 0; "+x+" < "+f+".length; "+x+"++) { if ("+u+"["+f+"["+x+"]] === undefined ",b&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", "+f+"["+x+"]) "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+S+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+S+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(a+=" } ")}else{var O=p;if(O)for(var D,I=-1,A=O.length-1;I<A;){D=O[I+=1];var k=e.util.getProperty(D),q=(S=e.util.escapeQuotes(D),u+k);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(E,D,e.opts.jsonPointers)),a+=" if ( "+q+" === undefined ",b&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(D)+"') "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+S+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+S+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=E}else h&&(a+=" if (true) {");return a}},{}],34:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d="valid"+o,f=e.opts.$data&&n&&n.$data;if(f?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n,(n||f)&&!1!==e.opts.uniqueItems){f&&(s+=" var "+d+"; if ("+a+" === false || "+a+" === undefined) "+d+" = true; else if (typeof "+a+" != 'boolean') "+d+" = false; else { "),s+=" var "+d+" = true; if ("+c+".length > 1) { var i = "+c+".length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal("+c+"[i], "+c+"[j])) { "+d+" = false; break outer; } } } } ",f&&(s+=" } "),s+=" if (!"+d+") { ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}},{}],35:[function(e,r,t){"use strict";r.exports=function(e,r,t){function a(e){for(var r=e.rules,t=0;t<r.length;t++)if(s(r[t]))return!0}function s(r){return void 0!==e.schema[r.keyword]||r.implements&&function(r){for(var t=r.implements,a=0;a<t.length;a++)if(void 0!==e.schema[t[a]])return!0}(r)}var o="",i=!0===e.schema.$async,n=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),l=e.self._getId(e.schema);if(e.isTop){if(i){e.async=!0;var h="es7"==e.opts.async;e.yieldAwait=h?"await":"yield"}o+=" var validate = ",i?h?o+=" (async function ":("*"!=e.opts.async&&(o+="co.wrap"),o+="(function* "):o+=" (function ",o+=" (data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",l&&(e.opts.sourceCode||e.opts.processCode)&&(o+=" /*# sourceURL="+l+" */ ")}if("boolean"==typeof e.schema||!n&&!e.schema.$ref){var u=e.level,c=e.dataLevel,d=e.schema[r="false schema"],f=e.schemaPath+e.util.getProperty(r),p=e.errSchemaPath+"/"+r,m=!e.opts.allErrors,v="data"+(c||""),y="valid"+u;if(!1===e.schema){e.isTop?m=!0:o+=" var "+y+" = false; ";(Y=Y||[]).push(o),o="",!1!==e.createErrors?(o+=" { keyword: '"+(E||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: {} ",!1!==e.opts.messages&&(o+=" , message: 'boolean schema is false' "),e.opts.verbose&&(o+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),o+=" } "):o+=" {} ";var g=o;o=Y.pop(),o+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+g+"]); ":" validate.errors = ["+g+"]; return false; ":" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else o+=e.isTop?i?" return data; ":" validate.errors = null; return true; ":" var "+y+" = true; ";return e.isTop&&(o+=" }); return validate; "),o}if(e.isTop){var P=e.isTop;u=e.level=0,c=e.dataLevel=0,v="data";e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[void 0],o+=" var vErrors = null; ",o+=" var errors = 0; ",o+=" if (rootData === undefined) rootData = data; "}else{u=e.level,v="data"+((c=e.dataLevel)||"");if(l&&(e.baseId=e.resolve.url(e.baseId,l)),i&&!e.async)throw new Error("async schema in sync schema");o+=" var errs_"+u+" = errors;"}y="valid"+u,m=!e.opts.allErrors;var E,w="",b="",S=e.schema.type,j=Array.isArray(S);if(j&&1==S.length&&(S=S[0],j=!1),e.schema.$ref&&n){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(n=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(S){if(e.opts.coerceTypes)var _=e.util.coerceToTypes(e.opts.coerceTypes,S);var x=e.RULES.types[S];if(_||j||!0===x||x&&!a(x)){f=e.schemaPath+".type",p=e.errSchemaPath+"/type",f=e.schemaPath+".type",p=e.errSchemaPath+"/type";if(o+=" if ("+e.util[j?"checkDataTypes":"checkDataType"](S,v,!0)+") { ",_){var F="dataType"+u,$="coerced"+u;o+=" var "+F+" = typeof "+v+"; ","array"==e.opts.coerceTypes&&(o+=" if ("+F+" == 'object' && Array.isArray("+v+")) "+F+" = 'array'; "),o+=" var "+$+" = undefined; ";var R="",O=_;if(O)for(var D,I=-1,A=O.length-1;I<A;)D=O[I+=1],I&&(o+=" if ("+$+" === undefined) { ",R+="}"),"array"==e.opts.coerceTypes&&"array"!=D&&(o+=" if ("+F+" == 'array' && "+v+".length == 1) { "+$+" = "+v+" = "+v+"[0]; "+F+" = typeof "+v+"; } "),"string"==D?o+=" if ("+F+" == 'number' || "+F+" == 'boolean') "+$+" = '' + "+v+"; else if ("+v+" === null) "+$+" = ''; ":"number"==D||"integer"==D?(o+=" if ("+F+" == 'boolean' || "+v+" === null || ("+F+" == 'string' && "+v+" && "+v+" == +"+v+" ","integer"==D&&(o+=" && !("+v+" % 1)"),o+=")) "+$+" = +"+v+"; "):"boolean"==D?o+=" if ("+v+" === 'false' || "+v+" === 0 || "+v+" === null) "+$+" = false; else if ("+v+" === 'true' || "+v+" === 1) "+$+" = true; ":"null"==D?o+=" if ("+v+" === '' || "+v+" === 0 || "+v+" === false) "+$+" = null; ":"array"==e.opts.coerceTypes&&"array"==D&&(o+=" if ("+F+" == 'string' || "+F+" == 'number' || "+F+" == 'boolean' || "+v+" == null) "+$+" = ["+v+"]; ");o+=" "+R+" if ("+$+" === undefined) { ";(Y=Y||[]).push(o),o="",!1!==e.createErrors?(o+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",o+=j?""+S.join(","):""+S,o+="' } ",!1!==e.opts.messages&&(o+=" , message: 'should be ",o+=j?""+S.join(","):""+S,o+="' "),e.opts.verbose&&(o+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),o+=" } "):o+=" {} ";g=o;o=Y.pop(),o+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+g+"]); ":" validate.errors = ["+g+"]; return false; ":" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",o+=" } else { ";var k=c?"data"+(c-1||""):"parentData";o+=" "+v+" = "+$+"; ",c||(o+="if ("+k+" !== undefined)"),o+=" "+k+"["+(c?e.dataPathArr[c]:"parentDataProperty")+"] = "+$+"; } "}else{(Y=Y||[]).push(o),o="",!1!==e.createErrors?(o+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",o+=j?""+S.join(","):""+S,o+="' } ",!1!==e.opts.messages&&(o+=" , message: 'should be ",o+=j?""+S.join(","):""+S,o+="' "),e.opts.verbose&&(o+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),o+=" } "):o+=" {} ";g=o;o=Y.pop(),o+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+g+"]); ":" validate.errors = ["+g+"]; return false; ":" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}o+=" } "}}if(e.schema.$ref&&!n)o+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",m&&(o+=" } if (errors === ",o+=P?"0":"errs_"+u,o+=") { ",b+="}");else{e.opts.v5&&e.schema.patternGroups&&e.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.');var q=e.RULES;if(q)for(var L=-1,z=q.length-1;L<z;)if(x=q[L+=1],a(x)){if(x.type&&(o+=" if ("+e.util.checkDataType(x.type,v)+") { "),e.opts.useDefaults&&!e.compositeRule)if("object"==x.type&&e.schema.properties){d=e.schema.properties;var C=Object.keys(d);if(C)for(var Q,U=-1,V=C.length-1;U<V;){if(void 0!==(T=d[Q=C[U+=1]]).default){o+=" if ("+(H=v+e.util.getProperty(Q))+" === undefined) "+H+" = ",o+="shared"==e.opts.useDefaults?" "+e.useDefault(T.default)+" ":" "+JSON.stringify(T.default)+" ",o+="; "}}}else if("array"==x.type&&Array.isArray(e.schema.items)){var N=e.schema.items;if(N){I=-1;for(var T,M=N.length-1;I<M;)if(void 0!==(T=N[I+=1]).default){var H;o+=" if ("+(H=v+"["+I+"]")+" === undefined) "+H+" = ",o+="shared"==e.opts.useDefaults?" "+e.useDefault(T.default)+" ":" "+JSON.stringify(T.default)+" ",o+="; "}}}var K=x.rules;if(K)for(var B,G=-1,J=K.length-1;G<J;)if(B=K[G+=1],s(B)){var Z=B.code(e,B.keyword,x.type);Z&&(o+=" "+Z+" ",m&&(w+="}"))}if(m&&(o+=" "+w+" ",w=""),x.type&&(o+=" } ",S&&S===x.type&&!_)){o+=" else { ";var Y;f=e.schemaPath+".type",p=e.errSchemaPath+"/type";(Y=Y||[]).push(o),o="",!1!==e.createErrors?(o+=" { keyword: '"+(E||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",o+=j?""+S.join(","):""+S,o+="' } ",!1!==e.opts.messages&&(o+=" , message: 'should be ",o+=j?""+S.join(","):""+S,o+="' "),e.opts.verbose&&(o+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),o+=" } "):o+=" {} ";g=o;o=Y.pop(),o+=!e.compositeRule&&m?e.async?" throw new ValidationError(["+g+"]); ":" validate.errors = ["+g+"]; return false; ":" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",o+=" } "}m&&(o+=" if (errors === ",o+=P?"0":"errs_"+u,o+=") { ",b+="}")}}return m&&(o+=" "+b+" "),P?(i?(o+=" if (errors === 0) return data; ",o+=" else throw new ValidationError(vErrors); "):(o+=" validate.errors = vErrors; ",o+=" return errors === 0; "),o+=" }); return validate;"):o+=" var "+y+" = errors === errs_"+u+";",o=e.util.cleanUpCode(o),P&&(o=e.util.finalCleanUpCode(o,i)),o}},{}],36:[function(e,r,t){"use strict";var a=/^[a-z_$][a-z0-9_$-]*$/i,s=e("./dotjs/custom");r.exports={add:function(e,r){function t(e,r,t){for(var a,o=0;o<i.length;o++){var n=i[o];if(n.type==r){a=n;break}}a||i.push(a={type:r,rules:[]});var l={keyword:e,definition:t,custom:!0,code:s,implements:t.implements};a.rules.push(l),i.custom[e]=l}function o(e){if(!i.types[e])throw new Error("Unknown type "+e)}var i=this.RULES;if(i.keywords[e])throw new Error("Keyword "+e+" is already defined");if(!a.test(e))throw new Error("Keyword "+e+" is not a valid identifier");if(r){if(r.macro&&void 0!==r.valid)throw new Error('"valid" option cannot be used with macro keywords');var n=r.type;if(Array.isArray(n)){var l,h=n.length;for(l=0;l<h;l++)o(n[l]);for(l=0;l<h;l++)t(e,n[l],r)}else n&&o(n),t(e,n,r);var u=!0===r.$data&&this._opts.$data;if(u&&!r.validate)throw new Error('$data support: "validate" function is not defined');var c=r.metaSchema;c&&(u&&(c={anyOf:[c,{$ref:"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#"}]}),r.validateSchema=this.compile(c,!0))}return i.keywords[e]=i.all[e]=!0,this},get:function(e){var r=this.RULES.custom[e];return r?r.definition:this.RULES.keywords[e]||!1},remove:function(e){var r=this.RULES;delete r.keywords[e],delete r.all[e],delete r.custom[e];for(var t=0;t<r.length;t++)for(var a=r[t].rules,s=0;s<a.length;s++)if(a[s].keyword==e){a.splice(s,1);break}return this}}},{"./dotjs/custom":21}],37:[function(e,r,t){"use strict";var a="http://json-schema.org/draft-06/schema";r.exports=function(e){var r=e._opts.defaultMeta,t="string"==typeof r?{$ref:r}:e.getSchema(a)?{$ref:a}:{};e.addKeyword("patternGroups",{metaSchema:{type:"object",additionalProperties:{type:"object",required:["schema"],properties:{maximum:{type:"integer",minimum:0},minimum:{type:"integer",minimum:0},schema:t},additionalProperties:!1}}}),e.RULES.all.properties.implements.push("patternGroups")}},{}],38:[function(e,r,t){r.exports={$schema:"http://json-schema.org/draft-06/schema#",$id:"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#",description:"Meta-schema for $data reference (JSON-schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}},{}],39:[function(e,r,t){r.exports={$schema:"http://json-schema.org/draft-06/schema#",$id:"http://json-schema.org/draft-06/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},title:{type:"string"},description:{type:"string"},default:{},examples:{type:"array",items:{}},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:{},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:{}}},{}],40:[function(e,r,t){function a(e){var r=this,t=n.call(arguments,1);return new Promise(function(a,i){function n(r){var t;try{t=e.next(r)}catch(e){return i(e)}h(t)}function l(r){var t;try{t=e.throw(r)}catch(e){return i(e)}h(t)}function h(e){if(e.done)return a(e.value);var t=s.call(r,e.value);return t&&o(t)?t.then(n,l):l(new TypeError('You may only yield a function, promise, generator, array, or object, but the following object was passed: "'+String(e.value)+'"'))}if("function"==typeof e&&(e=e.apply(r,t)),!e||"function"!=typeof e.next)return a(e);n()})}function s(e){return e?o(e)?e:function(e){var r=e.constructor;return!!r&&("GeneratorFunction"===r.name||"GeneratorFunction"===r.displayName||i(r.prototype))}(e)||i(e)?a.call(this,e):"function"==typeof e?function(e){var r=this;return new Promise(function(t,a){e.call(r,function(e,r){if(e)return a(e);arguments.length>2&&(r=n.call(arguments,1)),t(r)})})}.call(this,e):Array.isArray(e)?function(e){return Promise.all(e.map(s,this))}.call(this,e):function(e){return Object==e.constructor}(e)?function(e){for(var r=new e.constructor,t=Object.keys(e),a=[],i=0;i<t.length;i++){var n=t[i],l=s.call(this,e[n]);l&&o(l)?function(e,t){r[t]=void 0,a.push(e.then(function(e){r[t]=e}))}(l,n):r[n]=e[n]}return Promise.all(a).then(function(){return r})}.call(this,e):e:e}function o(e){return"function"==typeof e.then}function i(e){return"function"==typeof e.next&&"function"==typeof e.throw}var n=Array.prototype.slice;r.exports=a.default=a.co=a,a.wrap=function(e){function r(){return a.call(this,e.apply(this,arguments))}return r.__generatorFunction__=e,r}},{}],41:[function(e,r,t){"use strict";r.exports=function e(r,t){if(r===t)return!0;var a,s=Array.isArray(r),o=Array.isArray(t);if(s&&o){if(r.length!=t.length)return!1;for(a=0;a<r.length;a++)if(!e(r[a],t[a]))return!1;return!0}if(s!=o)return!1;if(r&&t&&"object"==typeof r&&"object"==typeof t){var i=Object.keys(r);if(i.length!==Object.keys(t).length)return!1;var n=r instanceof Date,l=t instanceof Date;if(n&&l)return r.getTime()==t.getTime();if(n!=l)return!1;var h=r instanceof RegExp,u=t instanceof RegExp;if(h&&u)return r.toString()==t.toString();if(h!=u)return!1;for(a=0;a<i.length;a++)if(!Object.prototype.hasOwnProperty.call(t,i[a]))return!1;for(a=0;a<i.length;a++)if(!e(r[i[a]],t[i[a]]))return!1;return!0}return!1}},{}],42:[function(e,r,t){"use strict";r.exports=function(e,r){r||(r={}),"function"==typeof r&&(r={cmp:r});var t="boolean"==typeof r.cycles&&r.cycles,a=r.cmp&&function(e){return function(r){return function(t,a){return e({key:t,value:r[t]},{key:a,value:r[a]})}}}(r.cmp),s=[];return function e(r){if(r&&r.toJSON&&"function"==typeof r.toJSON&&(r=r.toJSON()),void 0!==r){if("number"==typeof r)return isFinite(r)?""+r:"null";if("object"!=typeof r)return JSON.stringify(r);var o,i;if(Array.isArray(r)){for(i="[",o=0;o<r.length;o++)o&&(i+=","),i+=e(r[o])||"null";return i+"]"}if(null===r)return"null";if(-1!==s.indexOf(r)){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var n=s.push(r)-1,l=Object.keys(r).sort(a&&a(r));for(i="",o=0;o<l.length;o++){var h=l[o],u=e(r[h]);u&&(i&&(i+=","),i+=JSON.stringify(h)+":"+u)}return s.splice(n,1),"{"+i+"}"}}(e)}},{}],43:[function(e,r,t){"use strict";function a(e,r,t,o,i,n,l,h,u){if(t&&"object"==typeof t&&!Array.isArray(t)){r(t,o,i,n,l,h,u);for(var c in t){var d=t[c];if(Array.isArray(d)){if(c in s.arrayKeywords)for(var f=0;f<d.length;f++)a(e,r,d[f],o+"/"+c+"/"+f,i,o,c,t,f)}else if(c in s.propsKeywords){if(d&&"object"==typeof d)for(var p in d)a(e,r,d[p],o+"/"+c+"/"+function(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}(p),i,o,c,t,p)}else(c in s.keywords||e.allKeys&&!(c in s.skipKeywords))&&a(e,r,d,o+"/"+c,i,o,c,t)}}}var s=r.exports=function(e,r,t){"function"==typeof r&&(t=r,r={}),a(r,t,e,"",e)};s.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},s.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},s.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},s.skipKeywords={enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},{}],44:[function(e,r,t){(function(e){!function(a){function s(e){throw new RangeError(D[e])}function o(e,r){for(var t=e.length,a=[];t--;)a[t]=r(e[t]);return a}function i(e,r){var t=e.split("@"),a="";t.length>1&&(a=t[0]+"@",e=t[1]);return a+o((e=e.replace(O,".")).split("."),r).join(".")}function n(e){for(var r,t,a=[],s=0,o=e.length;s<o;)(r=e.charCodeAt(s++))>=55296&&r<=56319&&s<o?56320==(64512&(t=e.charCodeAt(s++)))?a.push(((1023&r)<<10)+(1023&t)+65536):(a.push(r),s--):a.push(r);return a}function l(e){return o(e,function(e){var r="";return e>65535&&(r+=k((e-=65536)>>>10&1023|55296),e=56320|1023&e),r+=k(e)}).join("")}function h(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:E}function u(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function c(e,r,t){var a=0;for(e=t?A(e/j):e>>1,e+=A(e/r);e>I*b>>1;a+=E)e=A(e/I);return A(a+(I+1)*e/(e+S))}function d(e){var r,t,a,o,i,n,u,d,f,p,m=[],v=e.length,y=0,g=x,S=_;for((t=e.lastIndexOf(F))<0&&(t=0),a=0;a<t;++a)e.charCodeAt(a)>=128&&s("not-basic"),m.push(e.charCodeAt(a));for(o=t>0?t+1:0;o<v;){for(i=y,n=1,u=E;o>=v&&s("invalid-input"),((d=h(e.charCodeAt(o++)))>=E||d>A((P-y)/n))&&s("overflow"),y+=d*n,f=u<=S?w:u>=S+b?b:u-S,!(d<f);u+=E)n>A(P/(p=E-f))&&s("overflow"),n*=p;S=c(y-i,r=m.length+1,0==i),A(y/r)>P-g&&s("overflow"),g+=A(y/r),y%=r,m.splice(y++,0,g)}return l(m)}function f(e){var r,t,a,o,i,l,h,d,f,p,m,v,y,g,S,j=[];for(v=(e=n(e)).length,r=x,t=0,i=_,l=0;l<v;++l)(m=e[l])<128&&j.push(k(m));for(a=o=j.length,o&&j.push(F);a<v;){for(h=P,l=0;l<v;++l)(m=e[l])>=r&&m<h&&(h=m);for(h-r>A((P-t)/(y=a+1))&&s("overflow"),t+=(h-r)*y,r=h,l=0;l<v;++l)if((m=e[l])<r&&++t>P&&s("overflow"),m==r){for(d=t,f=E;p=f<=i?w:f>=i+b?b:f-i,!(d<p);f+=E)j.push(k(u(p+(S=d-p)%(g=E-p),0))),d=A(S/g);j.push(k(u(d,0))),i=c(t,y,a==o),t=0,++a}++t,++r}return j.join("")}var p="object"==typeof t&&t&&!t.nodeType&&t,m="object"==typeof r&&r&&!r.nodeType&&r,v="object"==typeof e&&e;v.global!==v&&v.window!==v&&v.self!==v||(a=v);var y,g,P=2147483647,E=36,w=1,b=26,S=38,j=700,_=72,x=128,F="-",$=/^xn--/,R=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,D={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=E-w,A=Math.floor,k=String.fromCharCode;if(y={version:"1.4.1",ucs2:{decode:n,encode:l},decode:d,encode:f,toASCII:function(e){return i(e,function(e){return R.test(e)?"xn--"+f(e):e})},toUnicode:function(e){return i(e,function(e){return $.test(e)?d(e.slice(4).toLowerCase()):e})}},p&&m)if(r.exports==p)m.exports=y;else for(g in y)y.hasOwnProperty(g)&&(p[g]=y[g]);else a.punycode=y}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(e,r,t){"use strict";function a(e,r){return Object.prototype.hasOwnProperty.call(e,r)}r.exports=function(e,r,t,o){r=r||"&",t=t||"=";var i={};if("string"!=typeof e||0===e.length)return i;var n=/\+/g;e=e.split(r);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var u=0;u<h;++u){var c,d,f,p,m=e[u].replace(n,"%20"),v=m.indexOf(t);v>=0?(c=m.substr(0,v),d=m.substr(v+1)):(c=m,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),a(i,f)?s(i[f])?i[f].push(p):i[f]=[i[f],p]:i[f]=p}return i};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],46:[function(e,r,t){"use strict";function a(e,r){if(e.map)return e.map(r);for(var t=[],a=0;a<e.length;a++)t.push(r(e[a],a));return t}var s=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};r.exports=function(e,r,t,n){return r=r||"&",t=t||"=",null===e&&(e=void 0),"object"==typeof e?a(i(e),function(i){var n=encodeURIComponent(s(i))+t;return o(e[i])?a(e[i],function(e){return n+encodeURIComponent(s(e))}).join(r):n+encodeURIComponent(s(e[i]))}).join(r):n?encodeURIComponent(s(n))+t+encodeURIComponent(s(e)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=Object.keys||function(e){var r=[];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r}},{}],47:[function(e,r,t){"use strict";t.decode=t.parse=e("./decode"),t.encode=t.stringify=e("./encode")},{"./decode":45,"./encode":46}],48:[function(e,r,t){"use strict";function a(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function s(e,r,t){if(e&&i.isObject(e)&&e instanceof a)return e;var s=new a;return s.parse(e,r,t),s}var o=e("punycode"),i=e("./util");t.parse=s,t.resolve=function(e,r){return s(e,!1,!0).resolve(r)},t.resolveObject=function(e,r){return e?s(e,!1,!0).resolveObject(r):r},t.format=function(e){return i.isString(e)&&(e=s(e)),e instanceof a?e.format():a.prototype.format.call(e)},t.Url=a;var n=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),f=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},P=e("querystring");a.prototype.parse=function(e,r,t){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),s=-1!==a&&a<e.indexOf("#")?"?":"#",l=e.split(s);l[0]=l[0].replace(/\\/g,"/");var u=e=l.join(s);if(u=u.trim(),!t&&1===e.split("#").length){var E=h.exec(u);if(E)return this.path=u,this.href=u,this.pathname=E[1],E[2]?(this.search=E[2],this.query=r?P.parse(this.search.substr(1)):this.search.substr(1)):r&&(this.search="",this.query={}),this}var w=n.exec(u);if(w){var b=(w=w[0]).toLowerCase();this.protocol=b,u=u.substr(w.length)}if(t||w||u.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===u.substr(0,2);!S||w&&y[w]||(u=u.substr(2),this.slashes=!0)}if(!y[w]&&(S||w&&!g[w])){for(var j=-1,_=0;_<f.length;_++){-1!==($=u.indexOf(f[_]))&&(-1===j||$<j)&&(j=$)}var x,F;-1!==(F=-1===j?u.lastIndexOf("@"):u.lastIndexOf("@",j))&&(x=u.slice(0,F),u=u.slice(F+1),this.auth=decodeURIComponent(x)),j=-1;for(_=0;_<d.length;_++){var $;-1!==($=u.indexOf(d[_]))&&(-1===j||$<j)&&(j=$)}-1===j&&(j=u.length),this.host=u.slice(0,j),u=u.slice(j),this.parseHost(),this.hostname=this.hostname||"";var R="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!R)for(var O=this.hostname.split(/\./),D=(_=0,O.length);_<D;_++){var I=O[_];if(I&&!I.match(p)){for(var A="",k=0,q=I.length;k<q;k++)I.charCodeAt(k)>127?A+="x":A+=I[k];if(!A.match(p)){var L=O.slice(0,_),z=O.slice(_+1),C=I.match(m);C&&(L.push(C[1]),z.unshift(C[2])),z.length&&(u="/"+z.join(".")+u),this.hostname=L.join(".");break}}}this.hostname=this.hostname.length>255?"":this.hostname.toLowerCase(),R||(this.hostname=o.toASCII(this.hostname));var Q=this.port?":"+this.port:"";this.host=(this.hostname||"")+Q,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!v[b])for(_=0,D=c.length;_<D;_++){var U=c[_];if(-1!==u.indexOf(U)){var V=encodeURIComponent(U);V===U&&(V=escape(U)),u=u.split(U).join(V)}}var N=u.indexOf("#");-1!==N&&(this.hash=u.substr(N),u=u.slice(0,N));var T=u.indexOf("?");if(-1!==T?(this.search=u.substr(T),this.query=u.substr(T+1),r&&(this.query=P.parse(this.query)),u=u.slice(0,T)):r&&(this.search="",this.query={}),u&&(this.pathname=u),g[b]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){this.path=(Q=this.pathname||"")+(this.search||"")}return this.href=this.format(),this},a.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var r=this.protocol||"",t=this.pathname||"",a=this.hash||"",s=!1,o="";this.host?s=e+this.host:this.hostname&&(s=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(o=P.stringify(this.query));var n=this.search||o&&"?"+o||"";return r&&":"!==r.substr(-1)&&(r+=":"),this.slashes||(!r||g[r])&&!1!==s?(s="//"+(s||""),t&&"/"!==t.charAt(0)&&(t="/"+t)):s||(s=""),a&&"#"!==a.charAt(0)&&(a="#"+a),n&&"?"!==n.charAt(0)&&(n="?"+n),t=t.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),n=n.replace("#","%23"),r+s+t+n+a},a.prototype.resolve=function(e){return this.resolveObject(s(e,!1,!0)).format()},a.prototype.resolveObject=function(e){if(i.isString(e)){var r=new a;r.parse(e,!1,!0),e=r}for(var t=new a,s=Object.keys(this),o=0;o<s.length;o++){var n=s[o];t[n]=this[n]}if(t.hash=e.hash,""===e.href)return t.href=t.format(),t;if(e.slashes&&!e.protocol){for(var l=Object.keys(e),h=0;h<l.length;h++){var u=l[h];"protocol"!==u&&(t[u]=e[u])}return g[t.protocol]&&t.hostname&&!t.pathname&&(t.path=t.pathname="/"),t.href=t.format(),t}if(e.protocol&&e.protocol!==t.protocol){if(!g[e.protocol]){for(var c=Object.keys(e),d=0;d<c.length;d++){var f=c[d];t[f]=e[f]}return t.href=t.format(),t}if(t.protocol=e.protocol,e.host||y[e.protocol])t.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),t.pathname=p.join("/")}if(t.search=e.search,t.query=e.query,t.host=e.host||"",t.auth=e.auth,t.hostname=e.hostname||e.host,t.port=e.port,t.pathname||t.search){t.path=(t.pathname||"")+(t.search||"")}return t.slashes=t.slashes||e.slashes,t.href=t.format(),t}var m=t.pathname&&"/"===t.pathname.charAt(0),v=e.host||e.pathname&&"/"===e.pathname.charAt(0),P=v||m||t.host&&e.pathname,E=P,w=t.pathname&&t.pathname.split("/")||[],b=(p=e.pathname&&e.pathname.split("/")||[],t.protocol&&!g[t.protocol]);if(b&&(t.hostname="",t.port=null,t.host&&(""===w[0]?w[0]=t.host:w.unshift(t.host)),t.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),P=P&&(""===p[0]||""===w[0])),v)t.host=e.host||""===e.host?e.host:t.host,t.hostname=e.hostname||""===e.hostname?e.hostname:t.hostname,t.search=e.search,t.query=e.query,w=p;else if(p.length)w||(w=[]),w.pop(),w=w.concat(p),t.search=e.search,t.query=e.query;else if(!i.isNullOrUndefined(e.search)){if(b){t.hostname=t.host=w.shift();($=!!(t.host&&t.host.indexOf("@")>0)&&t.host.split("@"))&&(t.auth=$.shift(),t.host=t.hostname=$.shift())}return t.search=e.search,t.query=e.query,i.isNull(t.pathname)&&i.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!w.length)return t.pathname=null,t.path=t.search?"/"+t.search:null,t.href=t.format(),t;for(var S=w.slice(-1)[0],j=(t.host||e.host||w.length>1)&&("."===S||".."===S)||""===S,_=0,x=w.length;x>=0;x--)"."===(S=w[x])?w.splice(x,1):".."===S?(w.splice(x,1),_++):_&&(w.splice(x,1),_--);if(!P&&!E)for(;_--;_)w.unshift("..");!P||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),j&&"/"!==w.join("/").substr(-1)&&w.push("");var F=""===w[0]||w[0]&&"/"===w[0].charAt(0);if(b){t.hostname=t.host=F?"":w.length?w.shift():"";var $;($=!!(t.host&&t.host.indexOf("@")>0)&&t.host.split("@"))&&(t.auth=$.shift(),t.host=t.hostname=$.shift())}return(P=P||t.host&&w.length)&&!F&&w.unshift(""),w.length?t.pathname=w.join("/"):(t.pathname=null,t.path=null),i.isNull(t.pathname)&&i.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t},a.prototype.parseHost=function(){var e=this.host,r=l.exec(e);r&&(":"!==(r=r[0])&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)}},{"./util":49,punycode:44,querystring:47}],49:[function(e,r,t){"use strict";r.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],ajv:[function(e,r,t){"use strict";function a(r){if(!(this instanceof a))return new a(r);r=this._opts=E.copy(r)||{},function(e){var r=e._opts.logger;if(!1===r)e.logger={log:u,warn:u,error:u};else{if(void 0===r&&(r=console),!("object"==typeof r&&r.log&&r.warn&&r.error))throw new Error("logger must implement log, warn and error methods");e.logger=r}}(this),this._schemas={},this._refs={},this._fragments={},this._formats=v(r.format);var t=this._schemaUriFormat=this._formats["uri-reference"];this._schemaUriFormatFunc=function(e){return t.test(e)},this._cache=r.cache||new f,this._loadingSchemas={},this._compilations=[],this.RULES=y(),this._getId=function(e){switch(e.schemaId){case"$id":return n;case"id":return i;default:return l}}(r),r.loopRequired=r.loopRequired||1/0,"property"==r.errorDataPath&&(r._errorDataPathProperty=!0),void 0===r.serialize&&(r.serialize=m),this._metaOpts=function(e){for(var r=E.copy(e._opts),t=0;t<_.length;t++)delete r[_[t]];return r}(this),r.formats&&function(e){for(var r in e._opts.formats){var t=e._opts.formats[r];e.addFormat(r,t)}}(this),function(r){var t;r._opts.$data&&(t=e("./refs/$data.json"),r.addMetaSchema(t,t.$id,!0));if(!1===r._opts.meta)return;var a=e("./refs/json-schema-draft-06.json");r._opts.$data&&(a=g(a,x));r.addMetaSchema(a,j,!0),r._refs["http://json-schema.org/schema"]=j}(this),"object"==typeof r.meta&&this.addMetaSchema(r.meta),function(e){var r=e._opts.schemas;if(!r)return;if(Array.isArray(r))e.addSchema(r);else for(var t in r)e.addSchema(r[t],t)}(this),r.patternGroups&&P(this)}function s(e,r){return r=d.normalizeId(r),e._schemas[r]||e._refs[r]||e._fragments[r]}function o(e,r,t){for(var a in r){var s=r[a];s.meta||t&&!t.test(a)||(e._cache.del(s.cacheKey),delete r[a])}}function i(e){return e.$id&&this.logger.warn("schema $id ignored",e.$id),e.id}function n(e){return e.id&&this.logger.warn("schema id ignored",e.id),e.$id}function l(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function h(e,r){if(e._schemas[r]||e._refs[r])throw new Error('schema with key or id "'+r+'" already exists')}function u(){}var c=e("./compile"),d=e("./compile/resolve"),f=e("./cache"),p=e("./compile/schema_obj"),m=e("fast-json-stable-stringify"),v=e("./compile/formats"),y=e("./compile/rules"),g=e("./$data"),P=e("./patternGroups"),E=e("./compile/util"),w=e("co");r.exports=a,a.prototype.validate=function(e,r){var t;if("string"==typeof e){if(!(t=this.getSchema(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var a=this._addSchema(e);t=a.validate||this._compile(a)}var s=t(r);return!0===t.$async?"*"==this._opts.async?w(s):s:(this.errors=t.errors,s)},a.prototype.compile=function(e,r){var t=this._addSchema(e,void 0,r);return t.validate||this._compile(t)},a.prototype.addSchema=function(e,r,t,a){if(Array.isArray(e)){for(var s=0;s<e.length;s++)this.addSchema(e[s],void 0,t,a);return this}var o=this._getId(e);if(void 0!==o&&"string"!=typeof o)throw new Error("schema id must be string");return r=d.normalizeId(r||o),h(this,r),this._schemas[r]=this._addSchema(e,t,a,!0),this},a.prototype.addMetaSchema=function(e,r,t){return this.addSchema(e,r,t,!0),this},a.prototype.validateSchema=function(e,r){var t=e.$schema;if(void 0!==t&&"string"!=typeof t)throw new Error("$schema must be a string");if(!(t=t||this._opts.defaultMeta||function(e){var r=e._opts.meta;return e._opts.defaultMeta="object"==typeof r?e._getId(r)||r:e.getSchema(j)?j:void 0,e._opts.defaultMeta}(this)))return this.logger.warn("meta-schema not available"),this.errors=null,!0;var a=this._formats.uri;this._formats.uri="function"==typeof a?this._schemaUriFormatFunc:this._schemaUriFormat;var s;try{s=this.validate(t,e)}finally{this._formats.uri=a}if(!s&&r){var o="schema is invalid: "+this.errorsText();if("log"!=this._opts.validateSchema)throw new Error(o);this.logger.error(o)}return s},a.prototype.getSchema=function(e){var r=s(this,e);switch(typeof r){case"object":return r.validate||this._compile(r);case"string":return this.getSchema(r);case"undefined":return function(e,r){var t=d.schema.call(e,{schema:{}},r);if(t){var a=t.schema,s=t.root,o=t.baseId,i=c.call(e,a,s,void 0,o);return e._fragments[r]=new p({ref:r,fragment:!0,schema:a,root:s,baseId:o,validate:i}),i}}(this,e)}},a.prototype.removeSchema=function(e){if(e instanceof RegExp)return o(this,this._schemas,e),o(this,this._refs,e),this;switch(typeof e){case"undefined":return o(this,this._schemas),o(this,this._refs),this._cache.clear(),this;case"string":var r=s(this,e);return r&&this._cache.del(r.cacheKey),delete this._schemas[e],delete this._refs[e],this;case"object":var t=this._opts.serialize,a=t?t(e):e;this._cache.del(a);var i=this._getId(e);i&&(i=d.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this},a.prototype.addFormat=function(e,r){return"string"==typeof r&&(r=new RegExp(r)),this._formats[e]=r,this},a.prototype.errorsText=function(e,r){if(!(e=e||this.errors))return"No errors";for(var t=void 0===(r=r||{}).separator?", ":r.separator,a=void 0===r.dataVar?"data":r.dataVar,s="",o=0;o<e.length;o++){var i=e[o];i&&(s+=a+i.dataPath+" "+i.message+t)}return s.slice(0,-t.length)},a.prototype._addSchema=function(e,r,t,a){if("object"!=typeof e&&"boolean"!=typeof e)throw new Error("schema should be object or boolean");var s=this._opts.serialize,o=s?s(e):e,i=this._cache.get(o);if(i)return i;a=a||!1!==this._opts.addUsedSchema;var n=d.normalizeId(this._getId(e));n&&a&&h(this,n);var l,u=!1!==this._opts.validateSchema&&!r;u&&!(l=n&&n==d.normalizeId(e.$schema))&&this.validateSchema(e,!0);var c=d.ids.call(this,e),f=new p({id:n,schema:e,localRefs:c,cacheKey:o,meta:t});return"#"!=n[0]&&a&&(this._refs[n]=f),this._cache.put(o,f),u&&l&&this.validateSchema(e,!0),f},a.prototype._compile=function(e,r){function t(){var r=e.validate,a=r.apply(null,arguments);return t.errors=r.errors,a}if(e.compiling)return e.validate=t,t.schema=e.schema,t.errors=null,t.root=r||t,!0===e.schema.$async&&(t.$async=!0),t;e.compiling=!0;var a;e.meta&&(a=this._opts,this._opts=this._metaOpts);var s;try{s=c.call(this,e.schema,r,e.localRefs)}finally{e.compiling=!1,e.meta&&(this._opts=a)}return e.validate=s,e.refs=s.refs,e.refVal=s.refVal,e.root=s.root,s},a.prototype.compileAsync=e("./compile/async");var b=e("./keyword");a.prototype.addKeyword=b.add,a.prototype.getKeyword=b.get,a.prototype.removeKeyword=b.remove;var S=e("./compile/error_classes");a.ValidationError=S.Validation,a.MissingRefError=S.MissingRef,a.$dataMetaSchema=g;var j="http://json-schema.org/draft-06/schema",_=["removeAdditional","useDefaults","coerceTypes"],x=["/properties"]},{"./$data":1,"./cache":2,"./compile":7,"./compile/async":4,"./compile/error_classes":5,"./compile/formats":6,"./compile/resolve":8,"./compile/rules":9,"./compile/schema_obj":10,"./compile/util":12,"./keyword":36,"./patternGroups":37,"./refs/$data.json":38,"./refs/json-schema-draft-06.json":39,co:40,"fast-json-stable-stringify":42}]},{},[])("ajv")}); +//# sourceMappingURL=ajv.min.js.map \ No newline at end of file diff --git a/appasar/canary/node_modules/ajv/dist/ajv.min.js.map b/appasar/canary/node_modules/ajv/dist/ajv.min.js.map new file mode 100644 index 0000000..e591b58 --- /dev/null +++ b/appasar/canary/node_modules/ajv/dist/ajv.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["0"],"names":["f","exports","module","define","amd","window","global","self","this","Ajv","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length","1","KEYWORDS","metaSchema","keywordsJsonPointers","JSON","parse","stringify","j","segments","split","keywords","key","schema","anyOf","$ref","2","Cache","_cache","prototype","put","value","get","del","clear","3","allOf","const","contains","dependencies","enum","format","items","maximum","minimum","maxItems","minItems","maxLength","minLength","maxProperties","minProperties","multipleOf","not","oneOf","pattern","properties","propertyNames","required","uniqueItems","validate","../dotjs/_limit","../dotjs/_limitItems","../dotjs/_limitLength","../dotjs/_limitProperties","../dotjs/allOf","../dotjs/anyOf","../dotjs/const","../dotjs/contains","../dotjs/dependencies","../dotjs/enum","../dotjs/format","../dotjs/items","../dotjs/multipleOf","../dotjs/not","../dotjs/oneOf","../dotjs/pattern","../dotjs/properties","../dotjs/propertyNames","../dotjs/ref","../dotjs/required","../dotjs/uniqueItems","../dotjs/validate","4","compileAsync","meta","callback","loadMetaSchemaOf","sch","$schema","getSchema","Promise","resolve","_compileAsync","schemaObj","_compile","MissingRefError","removePromise","_loadingSchemas","ref","added","_refs","_schemas","missingSchema","missingRef","schemaPromise","_opts","loadSchema","then","addSchema","undefined","loadMissingSchema","p","_addSchema","v","MissingRef","./error_classes","5","baseId","message","url","normalizeId","fullPath","errorSubclass","Subclass","Object","create","constructor","Validation","errors","ajv","validation","./resolve","6","formats","mode","util","copy","date","str","matches","match","DATE","month","day","DAYS","time","full","TIME","regex","Z_ANCHOR","test","RegExp","HOSTNAME","URI","URITEMPLATE","URL","UUID","JSON_POINTER","RELATIVE_JSON_POINTER","fast","date-time","uri","uri-reference","uri-template","email","hostname","ipv4","ipv6","uuid","json-pointer","relative-json-pointer","dateTime","DATE_TIME_SEPARATOR","NOT_URI_FRAGMENT","./util","7","compile","root","localRefs","callValidate","compilation","result","apply","arguments","localCompile","_schema","_root","isRoot","$async","sourceCode","validateGenerator","isTop","schemaPath","errSchemaPath","errorPath","errorClasses","RULES","resolveRef","usePattern","useDefault","useCustomRule","opts","logger","vars","refVal","refValCode","patterns","patternCode","defaults","defaultCode","customRules","customRuleCode","processCode","Function","makeValidate","co","equal","ucs2length","ValidationError","error","refs","source","_refVal","refCode","refIndex","resolvedRef","rootRefId","addLocalRef","localSchema","inlineRef","inlineRefs","replaceLocalRef","removeLocalRef","refId","inline","regexStr","index","patternsHash","toQuotedString","valueStr","stableStringify","defaultsHash","rule","parentSchema","it","validateSchema","definition","errorsText","macro","keyword","c","compIndex","compiling","_compilations","_formats","cv","splice","arr","statement","fast-deep-equal","fast-json-stable-stringify","8","SchemaObject","res","resolveSchema","refPath","_getFullPath","getFullPath","_getId","id","parsedRef","resolveUrl","getJsonPointer","hash","slice","parts","part","unescapeFragment","PREVENT_SCOPE_CHANGE","limit","checkNoRef","countKeys","item","Array","isArray","count","Infinity","SIMPLE_INLINED","normalize","protocolSeparator","protocol","href","host","path","replace","TRAILING_SLASH_HASH","traverse","ids","schemaId","baseIds","","fullPaths","allKeys","jsonPtr","rootSchema","parentJsonPtr","parentKeyword","keyIndex","escapeFragment","toHash","./schema_obj","json-schema-traverse","9","ruleModules","type","rules","ALL","all","types","forEach","group","map","implKeywords","keys","k","push","implements","concat","custom","./_rules","10","obj","11","len","pos","charCodeAt","12","checkDataType","dataType","data","negate","EQUAL","AND","OK","NOT","getProperty","IDENTIFIER","escapeQuotes","SINGLE_QUOTE","joinPaths","b","escapeJsonPointer","unescapeJsonPointer","to","checkDataTypes","dataTypes","array","object","null","number","integer","coerceToTypes","optionCoerceTypes","COERCE_TO_TYPES","varOccurences","dataVar","varReplace","expr","cleanUpCode","out","EMPTY_ELSE","EMPTY_IF_NO_ELSE","EMPTY_IF_WITH_ELSE","finalCleanUpCode","async","ERRORS_REGEXP","REMOVE_ERRORS_ASYNC","RETURN_ASYNC","RETURN_DATA_ASYNC","REMOVE_ERRORS","RETURN_VALID","RETURN_TRUE","ROOTDATA_REGEXP","REMOVE_ROOTDATA","schemaHasRules","schemaHasRulesExcept","exceptKeyword","getPathExpr","currentPath","jsonPointers","isNumber","getPath","prop","getData","$data","lvl","paths","up","jsonPointer","segment","decodeURIComponent","encodeURIComponent","./ucs2length","13","$keyword","$ruleType","$schemaValue","$lvl","level","$dataLvl","dataLevel","$schemaPath","$errSchemaPath","$breakOnError","allErrors","$isData","dataPathArr","$isMax","$exclusiveKeyword","$schemaExcl","$op","$notOp","$errorKeyword","$schemaValueExcl","$exclusive","$exclType","$exclIsNumber","$opStr","$opExpr","$$outStack","createErrors","messages","verbose","__err","pop","compositeRule","Math","14","15","unicode","16","17","$it","$closingBraces","$nextValid","$currentBaseId","$allSchemasEmpty","arr1","$sch","$i","l1","18","$valid","$errs","every","$wasComposite","19","20","$idx","$dataNxt","$nextData","$nonEmptySchema","$passData","$code","21","$compile","$inline","$macro","$ruleValidate","$validateCode","$definition","$rDef","$validateSchema","$ruleErrs","$ruleErr","$asyncKeyword","statements","passContext","$parentData","$parentDataProperty","def_callRuleValidate","modifying","valid","def_customError","22","$schemaDeps","$propertyDeps","$ownProperties","ownProperties","$property","$deps","$currentErrorPath","$propertyKey","$useData","$prop","$propertyPath","$missingProperty","_errorDataPathProperty","join","arr2","i2","l2","23","$vSchema","24","$unknownFormats","unknownFormats","$allowUnknown","$format","$isObject","$formatType","warn","indexOf","$formatRef","25","$additionalItems","additionalItems","$currErrSchemaPath","26","multipleOfPrecision","27","$allErrorsOption","28","29","$regexp","30","$key","$dataProperties","$schemaKeys","$pProperties","patternProperties","$pPropertyKeys","$aProperties","additionalProperties","$someProperties","$noAdditional","$additionalIsSchema","$removeAdditional","removeAdditional","$checkAdditional","$required","v5","loopRequired","$requiredHash","patternGroups","$pgProperties","$pgPropertyKeys","i1","$pProperty","arr3","l3","$pgProperty","$additionalProperty","$useDefaults","useDefaults","arr4","i4","l4","$hasDefault","default","arr5","i5","l5","arr6","i6","l6","$pgSchema","$pgMin","$pgMax","$limit","$reason","$moreOrLess","31","$invalidName","32","$refCode","$refVal","$message","missingRefs","__callValidate","33","$propertySch","$loopRequired","i3","34","35","$shouldUseGroup","$rulesGroup","$shouldUseRule","$rule","impl","$ruleImplementsSomeKeyword","$refKeywords","$id","$es7","yieldAwait","$top","rootId","$closingBraces1","$closingBraces2","$typeSchema","$typeIsArray","extendRefs","coerceTypes","$coerceToTypes","$dataType","$coerced","$bracesCoercion","$type","36","add","_addRule","ruleGroup","rg","remove","./dotjs/custom","37","META_SCHEMA_ID","defaultMeta","metaSchemaRef","addKeyword","38","description","39","title","definitions","schemaArray","nonNegativeInteger","nonNegativeIntegerDefault0","simpleTypes","stringArray","examples","exclusiveMinimum","exclusiveMaximum","40","gen","ctx","args","reject","onFulfilled","ret","next","onRejected","err","throw","done","toPromise","isPromise","TypeError","String","name","displayName","isGenerator","isGeneratorFunction","fn","val","isObject","results","promises","promise","defer","wrap","createPromise","__generatorFunction__","41","arrA","arrB","dateA","Date","dateB","getTime","regexpA","regexpB","toString","hasOwnProperty","42","cmp","cycles","node","seen","toJSON","isFinite","seenIndex","sort","43","_traverse","cb","arrayKeywords","propsKeywords","escapeJsonPtr","skipKeywords","44","RangeError","mapDomain","string","regexSeparators","ucs2decode","extra","output","counter","ucs2encode","stringFromCharCode","basicToDigit","codePoint","base","digitToBasic","digit","flag","adapt","delta","numPoints","firstTime","floor","damp","baseMinusTMin","tMax","skew","decode","input","basic","oldi","w","baseMinusT","inputLength","initialN","bias","initialBias","lastIndexOf","delimiter","maxInt","tMin","encode","handledCPCount","basicLength","m","q","currentValue","handledCPCountPlusOne","qMinusT","freeExports","nodeType","freeModule","freeGlobal","punycode","regexPunycode","regexNonASCII","overflow","not-basic","invalid-input","fromCharCode","version","ucs2","toASCII","toUnicode","toLowerCase","45","qs","sep","eq","options","regexp","maxKeys","kstr","vstr","x","idx","substr","xs","46","stringifyPrimitive","objectKeys","ks","47","./decode","./encode","48","Url","slashes","auth","port","search","query","pathname","urlParse","parseQueryString","slashesDenoteHost","relative","resolveObject","isString","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","unsafeProtocol","javascript","javascript:","hostlessProtocol","slashedProtocol","http","https","ftp","gopher","file","http:","https:","ftp:","gopher:","file:","querystring","queryIndex","splitter","uSplit","rest","trim","simplePath","exec","proto","lowerProto","hostEnd","hec","atSign","parseHost","ipv6Hostname","hostparts","newpart","validParts","notHost","bit","unshift","ae","esc","escape","qm","charAt","rel","tkeys","tk","tkey","rkeys","rk","rkey","relPath","shift","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","isNullOrUndefined","authInHost","isNull","last","hasTrailingSlash","isAbsolute","49","arg","log","noop","console","setLogger","_fragments","schemaUriFormat","_schemaUriFormat","_schemaUriFormatFunc","cache","_get$Id","_get$IdOrId","chooseGetId","errorDataPath","serialize","_metaOpts","metaOpts","META_IGNORE_OPTIONS","getMetaSchemaOptions","addFormat","addInitialFormats","$dataSchema","addMetaSchema","$dataMetaSchema","META_SUPPORT_DATA","addDraft6MetaSchema","optsSchemas","schemas","addInitialSchemas","_getSchemaObj","keyRef","_removeAllSchemas","cacheKey","checkUnique","compileSchema","schemaKeyRef","_meta","_skipValidation","skipValidation","throwOrLogError","currentUriFormat","fragment","_getSchemaFragment","removeSchema","separator","text","dataPath","shouldAddSchema","cached","addUsedSchema","recursiveMeta","willValidate","_validate","currentOpts","customKeyword","getKeyword","removeKeyword","./$data","./cache","./compile","./compile/async","./compile/error_classes","./compile/formats","./compile/resolve","./compile/rules","./compile/schema_obj","./compile/util","./keyword","./patternGroups","./refs/$data.json","./refs/json-schema-draft-06.json"],"mappings":";CAAA,SAAUA,GAAG,GAAoB,iBAAVC,SAAoC,oBAATC,OAAsBA,OAAOD,QAAQD,SAAS,GAAmB,mBAATG,QAAqBA,OAAOC,IAAKD,UAAUH,OAAO,EAA0B,oBAATK,OAAwBA,OAA+B,oBAATC,OAAwBA,OAA6B,oBAAPC,KAAsBA,KAAYC,MAAOC,IAAMT,KAAxT,CAA+T,WAAqC,OAAO,SAAUU,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAkB,mBAATC,SAAqBA,QAAQ,IAAIF,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGI,EAAE,OAAOA,EAAEJ,GAAE,GAAI,IAAIf,EAAE,IAAIoB,MAAM,uBAAuBL,EAAE,KAAK,MAAMf,EAAEqB,KAAK,mBAAmBrB,EAAE,IAAIsB,EAAEV,EAAEG,IAAId,YAAYU,EAAEI,GAAG,GAAGQ,KAAKD,EAAErB,QAAQ,SAASS,GAAG,IAAIE,EAAED,EAAEI,GAAG,GAAGL,GAAG,OAAOI,EAAEF,GAAIF,IAAIY,EAAEA,EAAErB,QAAQS,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGd,QAAkD,IAAI,IAA1CkB,EAAkB,mBAATD,SAAqBA,QAAgBH,EAAE,EAAEA,EAAEF,EAAEW,OAAOT,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAAvb,EAA4bW,GAAG,SAASP,EAAQhB,EAAOD,GACl0B,aAEA,IAAIyB,GACF,aACA,UACA,mBACA,UACA,mBACA,YACA,YACA,UACA,kBACA,WACA,WACA,cACA,gBACA,gBACA,WACA,uBACA,OACA,SACA,SAGFxB,EAAOD,QAAU,SAAU0B,EAAYC,GACrC,IAAK,IAAIT,EAAE,EAAGA,EAAES,EAAqBJ,OAAQL,IAAK,CAChDQ,EAAaE,KAAKC,MAAMD,KAAKE,UAAUJ,IACvC,IAEIK,EAFAC,EAAWL,EAAqBT,GAAGe,MAAM,KACzCC,EAAWR,EAEf,IAAKK,EAAE,EAAGA,EAAEC,EAAST,OAAQQ,IAC3BG,EAAWA,EAASF,EAASD,IAE/B,IAAKA,EAAE,EAAGA,EAAEN,EAASF,OAAQQ,IAAK,CAChC,IAAII,EAAMV,EAASM,GACfK,EAASF,EAASC,GAClBC,IACFF,EAASC,IACPE,OACED,GACEE,KAAM,qFAOlB,OAAOZ,QAGHa,GAAG,SAAStB,EAAQhB,EAAOD,GACjC,aAGA,IAAIwC,EAAQvC,EAAOD,QAAU,WAC3BO,KAAKkC,WAIPD,EAAME,UAAUC,IAAM,SAAmBR,EAAKS,GAC5CrC,KAAKkC,OAAON,GAAOS,GAIrBJ,EAAME,UAAUG,IAAM,SAAmBV,GACvC,OAAO5B,KAAKkC,OAAON,IAIrBK,EAAME,UAAUI,IAAM,SAAmBX,UAChC5B,KAAKkC,OAAON,IAIrBK,EAAME,UAAUK,MAAQ,WACtBxC,KAAKkC,gBAGDO,GAAG,SAAS/B,EAAQhB,EAAOD,GACjC,aAGAC,EAAOD,SACLsC,KAAQrB,EAAQ,gBAChBgC,MAAOhC,EAAQ,kBACfoB,MAAOpB,EAAQ,kBACfiC,MAAOjC,EAAQ,kBACfkC,SAAUlC,EAAQ,qBAClBmC,aAAcnC,EAAQ,yBACtBoC,KAAQpC,EAAQ,iBAChBqC,OAAQrC,EAAQ,mBAChBsC,MAAOtC,EAAQ,kBACfuC,QAASvC,EAAQ,mBACjBwC,QAASxC,EAAQ,mBACjByC,SAAUzC,EAAQ,wBAClB0C,SAAU1C,EAAQ,wBAClB2C,UAAW3C,EAAQ,yBACnB4C,UAAW5C,EAAQ,yBACnB6C,cAAe7C,EAAQ,6BACvB8C,cAAe9C,EAAQ,6BACvB+C,WAAY/C,EAAQ,uBACpBgD,IAAKhD,EAAQ,gBACbiD,MAAOjD,EAAQ,kBACfkD,QAASlD,EAAQ,oBACjBmD,WAAYnD,EAAQ,uBACpBoD,cAAepD,EAAQ,0BACvBqD,SAAUrD,EAAQ,qBAClBsD,YAAatD,EAAQ,wBACrBuD,SAAUvD,EAAQ,wBAGjBwD,kBAAkB,GAAGC,uBAAuB,GAAGC,wBAAwB,GAAGC,4BAA4B,GAAGC,iBAAiB,GAAGC,iBAAiB,GAAGC,iBAAiB,GAAGC,oBAAoB,GAAGC,wBAAwB,GAAGC,gBAAgB,GAAGC,kBAAkB,GAAGC,iBAAiB,GAAGC,sBAAsB,GAAGC,eAAe,GAAGC,iBAAiB,GAAGC,mBAAmB,GAAGC,sBAAsB,GAAGC,yBAAyB,GAAGC,eAAe,GAAGC,oBAAoB,GAAGC,uBAAuB,GAAGC,oBAAoB,KAAKC,GAAG,SAAS9E,EAAQhB,EAAOD,GACvhB,aAgBA,SAASgG,EAAa5D,EAAQ6D,EAAMC,GA4BlC,SAASC,EAAiBC,GACxB,IAAIC,EAAUD,EAAIC,QAClB,OAAOA,IAAY/F,EAAKgG,UAAUD,GACxBL,EAAa1E,KAAKhB,GAAQgC,KAAM+D,IAAW,GAC3CE,QAAQC,UAIpB,SAASC,EAAcC,GACrB,IAAM,OAAOpG,EAAKqG,SAASD,GAC3B,MAAMjG,GACJ,GAAIA,aAAamG,EAAiB,OAKpC,SAA2BnG,GAoBzB,SAASoG,WACAvG,EAAKwG,gBAAgBC,GAG9B,SAASC,EAAMD,GACb,OAAOzG,EAAK2G,MAAMF,IAAQzG,EAAK4G,SAASH,GAxB1C,IAAIA,EAAMtG,EAAE0G,cACZ,GAAIH,EAAMD,GAAM,MAAM,IAAI5F,MAAM,UAAY4F,EAAM,kBAAoBtG,EAAE2G,WAAa,uBAErF,IAAIC,EAAgB/G,EAAKwG,gBAAgBC,GAMzC,OALKM,IACHA,EAAgB/G,EAAKwG,gBAAgBC,GAAOzG,EAAKgH,MAAMC,WAAWR,IACpDS,KAAKX,EAAeA,GAG7BQ,EAAcG,KAAK,SAAUpB,GAClC,IAAKY,EAAMD,GACT,OAAOZ,EAAiBC,GAAKoB,KAAK,WAC3BR,EAAMD,IAAMzG,EAAKmH,UAAUrB,EAAKW,OAAKW,EAAWzB,OAGxDuB,KAAK,WACN,OAAOf,EAAcC,KAtBkBiB,CAAkBlH,GAC3D,MAAMA,GApCV,IAAIH,EAAOC,KACX,GAAoC,mBAAzBA,KAAK+G,MAAMC,WACpB,MAAM,IAAIpG,MAAM,2CAEC,mBAAR8E,IACTC,EAAWD,EACXA,OAAOyB,GAGT,IAAIE,EAAIzB,EAAiB/D,GAAQoF,KAAK,WACpC,IAAId,EAAYpG,EAAKuH,WAAWzF,OAAQsF,EAAWzB,GACnD,OAAOS,EAAUlC,UAAYiC,EAAcC,KAU7C,OAPIR,GACF0B,EAAEJ,KACA,SAASM,GAAK5B,EAAS,KAAM4B,IAC7B5B,GAIG0B,EAvCT,IAAIhB,EAAkB3F,EAAQ,mBAAmB8G,WAEjD9H,EAAOD,QAAUgG,IAuFdgC,kBAAkB,IAAIC,GAAG,SAAShH,EAAQhB,EAAOD,GACpD,aAsBA,SAAS4G,EAAgBsB,EAAQnB,EAAKoB,GACpC5H,KAAK4H,QAAUA,GAAWvB,EAAgBuB,QAAQD,EAAQnB,GAC1DxG,KAAK6G,WAAaZ,EAAQ4B,IAAIF,EAAQnB,GACtCxG,KAAK4G,cAAgBX,EAAQ6B,YAAY7B,EAAQ8B,SAAS/H,KAAK6G,aAIjE,SAASmB,EAAcC,GAGrB,OAFAA,EAAS9F,UAAY+F,OAAOC,OAAOvH,MAAMuB,WACzC8F,EAAS9F,UAAUiG,YAAcH,EAC1BA,EA9BT,IAAIhC,EAAUvF,EAAQ,aAEtBhB,EAAOD,SACL4I,WAAYL,EAKd,SAAyBM,GACvBtI,KAAK4H,QAAU,oBACf5H,KAAKsI,OAASA,EACdtI,KAAKuI,IAAMvI,KAAKwI,YAAa,IAP7BhB,WAAYQ,EAAc3B,IAW5BA,EAAgBuB,QAAU,SAAUD,EAAQnB,GAC1C,MAAO,2BAA8BA,EAAM,YAAcmB,KAiBxDc,YAAY,IAAIC,GAAG,SAAShI,EAAQhB,EAAOD,GAC9C,aAwBA,SAASkJ,EAAQC,GAEf,OADAA,EAAe,QAARA,EAAiB,OAAS,OAC1BC,EAAKC,KAAKH,EAAQC,IAsD3B,SAASG,EAAKC,GAEZ,IAAIC,EAAUD,EAAIE,MAAMC,GACxB,IAAKF,EAAS,OAAO,EAErB,IAAIG,GAASH,EAAQ,GACjBI,GAAOJ,EAAQ,GACnB,OAAOG,GAAS,GAAKA,GAAS,IAAMC,GAAO,GAAKA,GAAOC,EAAKF,GAI9D,SAASG,EAAKP,EAAKQ,GACjB,IAAIP,EAAUD,EAAIE,MAAMO,GACxB,IAAKR,EAAS,OAAO,EAMrB,OAJWA,EAAQ,IAIJ,IAHFA,EAAQ,IAGU,IAFlBA,EAAQ,IAE0B,MAAQO,GADxCP,EAAQ,IA4BzB,SAASS,EAAMV,GACb,GAAIW,EAASC,KAAKZ,GAAM,OAAO,EAC/B,IAEE,OADA,IAAIa,OAAOb,IACJ,EACP,MAAM9I,GACN,OAAO,GAlIX,IAAI2I,EAAOnI,EAAQ,UAEfyI,EAAO,2BACPG,GAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAC3CG,EAAO,oDACPK,EAAW,qFACXC,EAAM,+nCAGNC,EAAc,oLAKdC,EAAM,4rDACNC,EAAO,+DACPC,EAAe,yFACfC,EAAwB,mDAG5B1K,EAAOD,QAAUkJ,EAQjBA,EAAQ0B,MAENtB,KAAM,6BAENQ,KAAM,2DACNe,YAAa,uFAEbC,IAAK,4CACLC,gBAAiB,4CACjBC,eAAgBT,EAChBnC,IAAKoC,EAILS,MAAO,mHACPC,SAAUb,EAEVc,KAAM,4EAENC,KAAM,qpCACNnB,MAAOA,EAEPoB,KAAMZ,EAGNa,eAAgBZ,EAEhBa,wBAAyBZ,GAI3BzB,EAAQa,MACNT,KAAMA,EACNQ,KAAMA,EACNe,YAwCF,SAAmBtB,GAEjB,IAAIiC,EAAWjC,EAAItH,MAAMwJ,GACzB,OAA0B,GAAnBD,EAASjK,QAAe+H,EAAKkC,EAAS,KAAO1B,EAAK0B,EAAS,IAAI,IA1CtEV,IAsDF,SAAavB,GAEX,OAAOmC,EAAiBvB,KAAKZ,IAAQe,EAAIH,KAAKZ,IAvD9CwB,gBAzDW,yoCA0DXC,eAAgBT,EAChBnC,IAAKoC,EACLS,MAAO,4IACPC,SAyCF,SAAkB3B,GAGhB,OAAOA,EAAIhI,QAAU,KAAO8I,EAASF,KAAKZ,IA3C1C4B,KAAM,4EACNC,KAAM,qpCACNnB,MAAOA,EACPoB,KAAMZ,EACNa,eAAgBZ,EAChBa,wBAAyBZ,GA2B3B,IAAIc,EAAsB,QAetBC,EAAmB,OAOnBxB,EAAW,aAWZyB,SAAS,KAAKC,GAAG,SAAS3K,EAAQhB,EAAOD,GAC5C,aAgCA,SAAS6L,EAAQzJ,EAAQ0J,EAAMC,EAAW7D,GAwCxC,SAAS8D,IACP,IAAIxH,EAAWyH,EAAYzH,SACvB0H,EAAS1H,EAAS2H,MAAM,KAAMC,WAElC,OADAJ,EAAanD,OAASrE,EAASqE,OACxBqD,EAGT,SAASG,EAAaC,EAASC,EAAOR,EAAW7D,GAC/C,IAAIsE,GAAUD,GAAUA,GAASA,EAAMnK,QAAUkK,EACjD,GAAIC,EAAMnK,QAAU0J,EAAK1J,OACvB,OAAOyJ,EAAQvK,KAAKhB,EAAMgM,EAASC,EAAOR,EAAW7D,GAEvD,IAAIuE,GAA4B,IAAnBH,EAAQG,OAEjBC,EAAaC,GACfC,OAAO,EACPxK,OAAQkK,EACRE,OAAQA,EACRtE,OAAQA,EACR4D,KAAMS,EACNM,WAAY,GACZC,cAAe,IACfC,UAAW,KACXnG,gBAAiBoG,EAAajF,WAC9BkF,MAAOA,EACPzI,SAAUmI,EACVvD,KAAMA,EACN5C,QAASA,EACT0G,WAAYA,EACZC,WAAYA,EACZC,WAAYA,EACZC,cAAeA,EACfC,KAAMA,EACNpE,QAASA,EACTqE,OAAQjN,EAAKiN,OACbjN,KAAMA,IAGRoM,EAAac,EAAKC,EAAQC,GAAcF,EAAKG,EAAUC,GACtCJ,EAAKK,EAAUC,GAAeN,EAAKO,EAAaC,GAChDtB,EAEbY,EAAKW,cAAavB,EAAaY,EAAKW,YAAYvB,IAEpD,IAAIlI,EACJ,IAgBEA,EAfmB,IAAI0J,SACrB,OACA,QACA,UACA,OACA,SACA,WACA,cACA,KACA,QACA,aACA,kBACAxB,EAGSyB,CACT7N,EACA2M,EACA/D,EACA4C,EACA2B,EACAI,EACAE,EACAK,EACAC,EACAC,EACAC,GAGFd,EAAO,GAAKjJ,EACZ,MAAM/D,GAEN,MADAH,EAAKiN,OAAOiB,MAAM,yCAA0C9B,GACtDjM,EAiBR,OAdA+D,EAASpC,OAASkK,EAClB9H,EAASqE,OAAS,KAClBrE,EAASiK,KAAOA,EAChBjK,EAASiJ,OAASA,EAClBjJ,EAASsH,KAAOU,EAAShI,EAAW+H,EAChCE,IAAQjI,EAASiI,QAAS,IACN,IAApBa,EAAKZ,aACPlI,EAASkK,QACPtN,KAAMsL,EACNiB,SAAUA,EACVE,SAAUA,IAIPrJ,EAGT,SAAS0I,EAAWhF,EAAQnB,EAAKyF,GAC/BzF,EAAMP,EAAQ4B,IAAIF,EAAQnB,GAC1B,IACI4H,EAASC,EADTC,EAAWJ,EAAK1H,GAEpB,QAAiBW,IAAbmH,EAGF,OAFAF,EAAUlB,EAAOoB,GACjBD,EAAU,UAAYC,EAAW,IAC1BC,EAAYH,EAASC,GAE9B,IAAKpC,GAAUV,EAAK2C,KAAM,CACxB,IAAIM,EAAYjD,EAAK2C,KAAK1H,GAC1B,QAAkBW,IAAdqH,EAGF,OAFAJ,EAAU7C,EAAK2B,OAAOsB,GACtBH,EAAUI,EAAYjI,EAAK4H,GACpBG,EAAYH,EAASC,GAIhCA,EAAUI,EAAYjI,GACtB,IAAIe,EAAItB,EAAQlF,KAAKhB,EAAM+L,EAAcP,EAAM/E,GAC/C,QAAUW,IAANI,EAAiB,CACnB,IAAImH,EAAclD,GAAaA,EAAUhF,GACrCkI,IACFnH,EAAItB,EAAQ0I,UAAUD,EAAa3B,EAAK6B,YAClCF,EACApD,EAAQvK,KAAKhB,EAAM2O,EAAanD,EAAMC,EAAW7D,IAI3D,QAAUR,IAANI,EAIF,OAeJ,SAAyBf,EAAKe,GAE5B2F,EADYgB,EAAK1H,IACDe,EAlBdsH,CAAgBrI,EAAKe,GACdgH,EAAYhH,EAAG8G,IAW1B,SAAwB7H,UACf0H,EAAK1H,GAfVsI,CAAetI,GAOnB,SAASiI,EAAYjI,EAAKe,GACxB,IAAIwH,EAAQ7B,EAAOlM,OAGnB,OAFAkM,EAAO6B,GAASxH,EAChB2G,EAAK1H,GAAOuI,EACL,SAAWA,EAYpB,SAASR,EAAYrB,EAAQrM,GAC3B,MAAwB,iBAAVqM,GAAuC,kBAAVA,GAC/BrM,KAAMA,EAAMgB,OAAQqL,EAAQ8B,QAAQ,IACpCnO,KAAMA,EAAMqL,OAAQgB,GAAUA,EAAOhB,QAGnD,SAASU,EAAWqC,GAClB,IAAIC,EAAQC,EAAaF,GAKzB,YAJc9H,IAAV+H,IACFA,EAAQC,EAAaF,GAAY7B,EAASpM,OAC1CoM,EAAS8B,GAASD,GAEb,UAAYC,EAGrB,SAASrC,EAAWxK,GAClB,cAAeA,GACb,IAAK,UACL,IAAK,SACH,MAAO,GAAKA,EACd,IAAK,SACH,OAAOwG,EAAKuG,eAAe/M,GAC7B,IAAK,SACH,GAAc,OAAVA,EAAgB,MAAO,OAC3B,IAAIgN,EAAWC,EAAgBjN,GAC3B6M,EAAQK,EAAaF,GAKzB,YAJclI,IAAV+H,IACFA,EAAQK,EAAaF,GAAY/B,EAAStM,OAC1CsM,EAAS4B,GAAS7M,GAEb,UAAY6M,GAIzB,SAASpC,EAAc0C,EAAM3N,EAAQ4N,EAAcC,GACjD,IAAIC,EAAiBH,EAAKI,WAAWD,eACrC,GAAIA,IAAgD,IAA9B5P,EAAKgH,MAAM4I,eAA0B,CAEzD,IADYA,EAAe9N,GACf,CACV,IAAI+F,EAAU,8BAAgC7H,EAAK8P,WAAWF,EAAerH,QAC7E,GAAiC,OAA7BvI,EAAKgH,MAAM4I,eACV,MAAM,IAAI/O,MAAMgH,GADmB7H,EAAKiN,OAAOiB,MAAMrG,IAK9D,IAII3D,EAJAqH,EAAUkE,EAAKI,WAAWtE,QAC1B0D,EAASQ,EAAKI,WAAWZ,OACzBc,EAAQN,EAAKI,WAAWE,MAG5B,GAAIxE,EACFrH,EAAWqH,EAAQvK,KAAKhB,EAAM8B,EAAQ4N,EAAcC,QAC/C,GAAII,EACT7L,EAAW6L,EAAM/O,KAAKhB,EAAM8B,EAAQ4N,EAAcC,IACtB,IAAxB3C,EAAK4C,gBAA0B5P,EAAK4P,eAAe1L,GAAU,QAC5D,GAAI+K,EACT/K,EAAW+K,EAAOjO,KAAKhB,EAAM2P,EAAIF,EAAKO,QAASlO,EAAQ4N,QAGvD,KADAxL,EAAWuL,EAAKI,WAAW3L,UACZ,OAGjB,QAAiBkD,IAAblD,EACF,MAAM,IAAIrD,MAAM,mBAAqB4O,EAAKO,QAAU,sBAEtD,IAAIb,EAAQ1B,EAAYxM,OAGxB,OAFAwM,EAAY0B,GAASjL,GAGnBpD,KAAM,aAAeqO,EACrBjL,SAAUA,GAlQd,IAAIlE,EAAOC,KACP+M,EAAO/M,KAAK+G,MACZmG,QAAW/F,GACX+G,KACAd,KACA+B,KACA7B,KACAiC,KACA/B,KAIAwC,EAoQN,SAAwBnO,EAAQ0J,EAAM5D,GAEpC,IAAIuH,EAAQe,EAAUlP,KAAKf,KAAM6B,EAAQ0J,EAAM5D,GAC/C,OAAIuH,GAAS,GAAYA,MAAOA,EAAOgB,WAAW,IAClDhB,EAAQlP,KAAKmQ,cAAcnP,OAC3BhB,KAAKmQ,cAAcjB,IACjBrN,OAAQA,EACR0J,KAAMA,EACN5D,OAAQA,IAEDuH,MAAOA,EAAOgB,WAAW,KA9QXnP,KAAKf,KAAM6B,EAFlC0J,EAAOA,IAAU1J,OAAQA,EAAQqL,OAAQA,EAAQgB,KAAMA,GAEPvG,GAC5C+D,EAAc1L,KAAKmQ,cAAcH,EAAEd,OACvC,GAAIc,EAAEE,UAAW,OAAQxE,EAAYD,aAAeA,EAEpD,IAAI9C,EAAU3I,KAAKoQ,SACf1D,EAAQ1M,KAAK0M,MAEjB,IACE,IAAInF,EAAIuE,EAAajK,EAAQ0J,EAAMC,EAAW7D,GAC9C+D,EAAYzH,SAAWsD,EACvB,IAAI8I,EAAK3E,EAAYD,aAUrB,OATI4E,IACFA,EAAGxO,OAAS0F,EAAE1F,OACdwO,EAAG/H,OAAS,KACZ+H,EAAGnC,KAAO3G,EAAE2G,KACZmC,EAAGnD,OAAS3F,EAAE2F,OACdmD,EAAG9E,KAAOhE,EAAEgE,KACZ8E,EAAGnE,OAAS3E,EAAE2E,OACVa,EAAKZ,aAAYkE,EAAGlC,OAAS5G,EAAE4G,SAE9B5G,EACP,SAoQJ,SAAsB1F,EAAQ0J,EAAM5D,GAElC,IAAIhH,EAAIsP,EAAUlP,KAAKf,KAAM6B,EAAQ0J,EAAM5D,GACvChH,GAAK,GAAGX,KAAKmQ,cAAcG,OAAO3P,EAAG,KAtQ1BI,KAAKf,KAAM6B,EAAQ0J,EAAM5D,IAkR1C,SAASsI,EAAUpO,EAAQ0J,EAAM5D,GAE/B,IAAK,IAAIhH,EAAE,EAAGA,EAAEX,KAAKmQ,cAAcnP,OAAQL,IAAK,CAC9C,IAAIqP,EAAIhQ,KAAKmQ,cAAcxP,GAC3B,GAAIqP,EAAEnO,QAAUA,GAAUmO,EAAEzE,MAAQA,GAAQyE,EAAErI,QAAUA,EAAQ,OAAOhH,EAEzE,OAAQ,EAIV,SAAS0M,EAAY1M,EAAGyM,GACtB,MAAO,cAAgBzM,EAAI,iBAAmBkI,EAAKuG,eAAehC,EAASzM,IAAM,KAInF,SAAS4M,EAAY5M,GACnB,MAAO,cAAgBA,EAAI,eAAiBA,EAAI,KAIlD,SAASwM,EAAWxM,EAAGuM,GACrB,YAAqB/F,IAAd+F,EAAOvM,GAAmB,GAAK,aAAeA,EAAI,aAAeA,EAAI,KAI9E,SAAS8M,EAAe9M,GACtB,MAAO,iBAAmBA,EAAI,kBAAoBA,EAAI,KAIxD,SAASsM,EAAKsD,EAAKC,GACjB,IAAKD,EAAIvP,OAAQ,MAAO,GAExB,IAAK,IADDH,EAAO,GACFF,EAAE,EAAGA,EAAE4P,EAAIvP,OAAQL,IAC1BE,GAAQ2P,EAAU7P,EAAG4P,GACvB,OAAO1P,EAxXT,IAAIoF,EAAUvF,EAAQ,aAClBmI,EAAOnI,EAAQ,UACf+L,EAAe/L,EAAQ,mBACvB4O,EAAkB5O,EAAQ,8BAE1B0L,EAAoB1L,EAAQ,qBAM5BmN,EAAKnN,EAAQ,MACbqN,EAAalF,EAAKkF,WAClBD,EAAQpN,EAAQ,mBAGhBsN,EAAkBvB,EAAapE,WAEnC3I,EAAOD,QAAU6L,IAyWd/F,oBAAoB,GAAGkC,kBAAkB,EAAEgB,YAAY,EAAE2C,SAAS,GAAGyC,GAAK,GAAG4C,kBAAkB,GAAGC,6BAA6B,KAAKC,GAAG,SAASjQ,EAAQhB,EAAOD,GAClK,aAyBA,SAASwG,EAAQqF,EAASC,EAAM/E,GAE9B,IAAI0G,EAASlN,KAAK0G,MAAMF,GACxB,GAAqB,iBAAV0G,EAAoB,CAC7B,IAAIlN,KAAK0G,MAAMwG,GACV,OAAOjH,EAAQlF,KAAKf,KAAMsL,EAASC,EAAM2B,GADtBA,EAASlN,KAAK0G,MAAMwG,GAK9C,IADAA,EAASA,GAAUlN,KAAK2G,SAASH,cACXoK,EACpB,OAAOjC,EAAUzB,EAAOrL,OAAQ7B,KAAK+G,MAAM6H,YACjC1B,EAAOrL,OACPqL,EAAOjJ,UAAYjE,KAAKoG,SAAS8G,GAG7C,IACIrL,EAAQ0F,EAAGI,EADXkJ,EAAMC,EAAc/P,KAAKf,KAAMuL,EAAM/E,GAgBzC,OAdIqK,IACFhP,EAASgP,EAAIhP,OACb0J,EAAOsF,EAAItF,KACX5D,EAASkJ,EAAIlJ,QAGX9F,aAAkB+O,EACpBrJ,EAAI1F,EAAOoC,UAAYqH,EAAQvK,KAAKf,KAAM6B,EAAOA,OAAQ0J,OAAMpE,EAAWQ,QACtDR,IAAXtF,IACT0F,EAAIoH,EAAU9M,EAAQ7B,KAAK+G,MAAM6H,YAC3B/M,EACAyJ,EAAQvK,KAAKf,KAAM6B,EAAQ0J,OAAMpE,EAAWQ,IAG7CJ,EAWT,SAASuJ,EAAcvF,EAAM/E,GAE3B,IAAIa,EAAIQ,EAAIvG,MAAMkF,GAAK,GAAO,GAC1BuK,EAAUC,EAAa3J,GACvBM,EAASsJ,EAAYjR,KAAKkR,OAAO3F,EAAK1J,SAC1C,GAAIkP,IAAYpJ,EAAQ,CACtB,IAAIwJ,EAAKrJ,EAAYiJ,GACjB7D,EAASlN,KAAK0G,MAAMyK,GACxB,GAAqB,iBAAVjE,EACT,OAuBN,SAA0B3B,EAAM/E,EAAK4K,GAEnC,IAAIP,EAAMC,EAAc/P,KAAKf,KAAMuL,EAAM/E,GACzC,GAAIqK,EAAK,CACP,IAAIhP,EAASgP,EAAIhP,OACb8F,EAASkJ,EAAIlJ,OACjB4D,EAAOsF,EAAItF,KACX,IAAI4F,EAAKnR,KAAKkR,OAAOrP,GAErB,OADIsP,IAAIxJ,EAAS0J,EAAW1J,EAAQwJ,IAC7BG,EAAevQ,KAAKf,KAAMoR,EAAWzJ,EAAQ9F,EAAQ0J,KAhClCxK,KAAKf,KAAMuL,EAAM2B,EAAQ7F,GAC5C,GAAI6F,aAAkB0D,EACtB1D,EAAOjJ,UAAUjE,KAAKoG,SAAS8G,GACpC3B,EAAO2B,MACF,CAEL,MADAA,EAASlN,KAAK2G,SAASwK,cACDP,GAMpB,OAJA,GADK1D,EAAOjJ,UAAUjE,KAAKoG,SAAS8G,GAChCiE,GAAMrJ,EAAYtB,GACpB,OAAS3E,OAAQqL,EAAQ3B,KAAMA,EAAM5D,OAAQA,GAC/C4D,EAAO2B,EAKX,IAAK3B,EAAK1J,OAAQ,OAClB8F,EAASsJ,EAAYjR,KAAKkR,OAAO3F,EAAK1J,SAExC,OAAOyP,EAAevQ,KAAKf,KAAMqH,EAAGM,EAAQ4D,EAAK1J,OAAQ0J,GAqB3D,SAAS+F,EAAeF,EAAWzJ,EAAQ9F,EAAQ0J,GAGjD,GADA6F,EAAUG,KAAOH,EAAUG,MAAQ,GACF,MAA7BH,EAAUG,KAAKC,MAAM,EAAE,GAA3B,CAGA,IAAK,IAFDC,EAAQL,EAAUG,KAAK7P,MAAM,KAExBf,EAAI,EAAGA,EAAI8Q,EAAMzQ,OAAQL,IAAK,CACrC,IAAI+Q,EAAOD,EAAM9Q,GACjB,GAAI+Q,EAAM,CAGR,GAFAA,EAAO7I,EAAK8I,iBAAiBD,QAEdvK,KADftF,EAASA,EAAO6P,IACU,MAC1B,IAAIP,EACJ,IAAKS,EAAqBF,MACxBP,EAAKnR,KAAKkR,OAAOrP,MACT8F,EAAS0J,EAAW1J,EAAQwJ,IAChCtP,EAAOE,MAAM,CACf,IAAIA,EAAOsP,EAAW1J,EAAQ9F,EAAOE,MACjC8O,EAAMC,EAAc/P,KAAKf,KAAMuL,EAAMxJ,GACrC8O,IACFhP,EAASgP,EAAIhP,OACb0J,EAAOsF,EAAItF,KACX5D,EAASkJ,EAAIlJ,UAMvB,YAAeR,IAAXtF,GAAwBA,IAAW0J,EAAK1J,QACjCA,OAAQA,EAAQ0J,KAAMA,EAAM5D,OAAQA,QAD/C,GAcF,SAASgH,EAAU9M,EAAQgQ,GACzB,OAAc,IAAVA,SACU1K,IAAV0K,IAAiC,IAAVA,EAAuBC,EAAWjQ,GACpDgQ,EAAcE,EAAUlQ,IAAWgQ,OAAvC,GAIP,SAASC,EAAWjQ,GAClB,IAAImQ,EACJ,GAAIC,MAAMC,QAAQrQ,IAChB,IAAK,IAAIlB,EAAE,EAAGA,EAAEkB,EAAOb,OAAQL,IAE7B,GAAmB,iBADnBqR,EAAOnQ,EAAOlB,MACkBmR,EAAWE,GAAO,OAAO,OAG3D,IAAK,IAAIpQ,KAAOC,EAAQ,CACtB,GAAW,QAAPD,EAAe,OAAO,EAE1B,GAAmB,iBADnBoQ,EAAOnQ,EAAOD,MACkBkQ,EAAWE,GAAO,OAAO,EAG7D,OAAO,EAIT,SAASD,EAAUlQ,GACjB,IAAemQ,EAAXG,EAAQ,EACZ,GAAIF,MAAMC,QAAQrQ,IAChB,IAAK,IAAIlB,EAAE,EAAGA,EAAEkB,EAAOb,OAAQL,IAG7B,GADmB,iBADnBqR,EAAOnQ,EAAOlB,MACewR,GAASJ,EAAUC,IAC5CG,GAASC,EAAAA,EAAU,OAAOA,EAAAA,OAGhC,IAAK,IAAIxQ,KAAOC,EAAQ,CACtB,GAAW,QAAPD,EAAe,OAAOwQ,EAAAA,EAC1B,GAAIC,EAAezQ,GACjBuQ,SAIA,GADmB,iBADnBH,EAAOnQ,EAAOD,MACeuQ,GAASJ,EAAUC,GAAQ,GACpDG,GAASC,EAAAA,EAAU,OAAOA,EAAAA,EAIpC,OAAOD,EAIT,SAASlB,EAAYE,EAAImB,IACL,IAAdA,IAAqBnB,EAAKrJ,EAAYqJ,IAE1C,OAAOH,EADCnJ,EAAIvG,MAAM6P,GAAI,GAAO,IAK/B,SAASH,EAAa3J,GACpB,IAAIkL,EAAoBlL,EAAEmL,UAAiC,MAArBnL,EAAEoL,KAAKjB,MAAM,EAAE,GAAa,KAAO,GACzE,OAAQnK,EAAEmL,UAAU,IAAMD,GAAqBlL,EAAEqL,MAAM,KAAOrL,EAAEsL,MAAM,IAAO,IAK/E,SAAS7K,EAAYqJ,GACnB,OAAOA,EAAKA,EAAGyB,QAAQC,EAAqB,IAAM,GAIpD,SAASxB,EAAW1J,EAAQwJ,GAE1B,OADAA,EAAKrJ,EAAYqJ,GACVtJ,EAAI5B,QAAQ0B,EAAQwJ,GAjO7B,IAAItJ,EAAMnH,EAAQ,OACdoN,EAAQpN,EAAQ,mBAChBmI,EAAOnI,EAAQ,UACfkQ,EAAelQ,EAAQ,gBACvBoS,EAAWpS,EAAQ,wBAEvBhB,EAAOD,QAAUwG,EAEjBA,EAAQ6B,YAAcA,EACtB7B,EAAQ8B,SAAWkJ,EACnBhL,EAAQ4B,IAAMwJ,EACdpL,EAAQ8M,IA2NR,SAAoBlR,GAClB,IAAImR,EAAWlL,EAAY9H,KAAKkR,OAAOrP,IACnCoR,GAAWC,GAAIF,GACfG,GAAaD,GAAIjC,EAAY+B,GAAU,IACvCxH,KACAzL,EAAOC,KAgCX,OA9BA8S,EAASjR,GAASuR,SAAS,GAAO,SAASvN,EAAKwN,EAASC,EAAYC,EAAeC,EAAe/D,EAAcgE,GAC/G,GAAgB,KAAZJ,EAAJ,CACA,IAAIlC,EAAKpR,EAAKmR,OAAOrL,GACjB8B,EAASsL,EAAQM,GACjBxL,EAAWoL,EAAUI,GAAiB,IAAMC,EAIhD,QAHiBrM,IAAbsM,IACF1L,GAAY,KAA0B,iBAAZ0L,EAAuBA,EAAW5K,EAAK6K,eAAeD,KAEjE,iBAANtC,EAAgB,CACzBA,EAAKxJ,EAASG,EAAYH,EAASE,EAAI5B,QAAQ0B,EAAQwJ,GAAMA,GAE7D,IAAIjE,EAASnN,EAAK2G,MAAMyK,GAExB,GADqB,iBAAVjE,IAAoBA,EAASnN,EAAK2G,MAAMwG,IAC/CA,GAAUA,EAAOrL,QACnB,IAAKiM,EAAMjI,EAAKqH,EAAOrL,QACrB,MAAM,IAAIjB,MAAM,OAASuQ,EAAK,2CAC3B,GAAIA,GAAMrJ,EAAYC,GAC3B,GAAa,KAAToJ,EAAG,GAAW,CAChB,GAAI3F,EAAU2F,KAAQrD,EAAMjI,EAAK2F,EAAU2F,IACzC,MAAM,IAAIvQ,MAAM,OAASuQ,EAAK,sCAChC3F,EAAU2F,GAAMtL,OAEhB9F,EAAK2G,MAAMyK,GAAMpJ,EAIvBkL,EAAQI,GAAW1L,EACnBwL,EAAUE,GAAWtL,KAGhByD,GA/PTvF,EAAQ0I,UAAYA,EACpB1I,EAAQpE,OAASiP,EAkGjB,IAAIc,EAAuB/I,EAAK8K,QAAQ,aAAc,oBAAqB,OAAQ,eAAgB,gBAmC/FtB,EAAiBxJ,EAAK8K,QACxB,OAAQ,SAAU,UAClB,YAAa,YACb,gBAAiB,gBACjB,WAAY,WACZ,UAAW,UACX,cAAe,aACf,WAAY,SAgEVd,EAAsB,UAqDvBe,eAAe,GAAGxI,SAAS,GAAGqF,kBAAkB,GAAGoD,uBAAuB,GAAGhM,IAAM,KAAKiM,GAAG,SAASpT,EAAQhB,EAAOD,GACtH,aAEA,IAAIsU,EAAcrT,EAAQ,YACtBiT,EAASjT,EAAQ,UAAUiT,OAE/BjU,EAAOD,QAAU,WACf,IAAIiN,IACAsH,KAAM,SACNC,QAAWhR,SAAY,sBACZC,SAAY,qBAAuB,aAAc,YAC5D8Q,KAAM,SACNC,OAAS,YAAa,YAAa,UAAW,YAC9CD,KAAM,QACNC,OAAS,WAAY,WAAY,cAAe,WAAY,WAC5DD,KAAM,SACNC,OAAS,gBAAiB,gBAAiB,WAAY,eAAgB,iBAC5DpQ,YAAe,uBAAwB,yBAClDoQ,OAAS,OAAQ,QAAS,OAAQ,MAAO,QAAS,QAAS,WAG3DC,GAAQ,QAoCZ,OA9BAxH,EAAMyH,IAAMR,EAAOO,GACnBxH,EAAM0H,MAAQT,GAFA,SAAU,UAAW,SAAU,QAAS,SAAU,UAAW,SAI3EjH,EAAM2H,QAAQ,SAAUC,GACtBA,EAAML,MAAQK,EAAML,MAAMM,IAAI,SAAUxE,GACtC,IAAIyE,EACJ,GAAsB,iBAAXzE,EAAqB,CAC9B,IAAInO,EAAMsG,OAAOuM,KAAK1E,GAAS,GAC/ByE,EAAezE,EAAQnO,GACvBmO,EAAUnO,EACV4S,EAAaH,QAAQ,SAAUK,GAC7BR,EAAIS,KAAKD,GACThI,EAAMyH,IAAIO,IAAK,IAGnBR,EAAIS,KAAK5E,GAMT,OALWrD,EAAMyH,IAAIpE,IACnBA,QAASA,EACTlP,KAAMkT,EAAYhE,GAClB6E,WAAYJ,KAKZF,EAAMN,OAAMtH,EAAM0H,MAAME,EAAMN,MAAQM,KAG5C5H,EAAM/K,SAAWgS,EAAOO,EAAIW,QA/B1B,kBAAmB,UAAW,MAAO,KAAM,QAC3C,cAAe,UAAW,iBA+B5BnI,EAAMoI,UAECpI,KAGNqI,WAAW,EAAE3J,SAAS,KAAK4J,IAAI,SAAStU,EAAQhB,EAAOD,GAC1D,aAEA,IAAIoJ,EAAOnI,EAAQ,UAEnBhB,EAAOD,QAEP,SAAsBwV,GACpBpM,EAAKC,KAAKmM,EAAKjV,SAGdoL,SAAS,KAAK8J,IAAI,SAASxU,EAAQhB,EAAOD,GAC7C,aAIAC,EAAOD,QAAU,SAAoBuJ,GAKnC,IAJA,IAGI3G,EAHArB,EAAS,EACTmU,EAAMnM,EAAIhI,OACVoU,EAAM,EAEHA,EAAMD,GACXnU,KACAqB,EAAQ2G,EAAIqM,WAAWD,OACV,OAAU/S,GAAS,OAAU+S,EAAMD,GAGtB,QAAX,OADb9S,EAAQ2G,EAAIqM,WAAWD,MACSA,IAGpC,OAAOpU,QAGHsU,IAAI,SAAS5U,EAAQhB,EAAOD,GAClC,aAqCA,SAAS8V,EAAcC,EAAUC,EAAMC,GACrC,IAAIC,EAAQD,EAAS,QAAU,QAC3BE,EAAMF,EAAS,OAAS,OACxBG,EAAKH,EAAS,IAAM,GACpBI,EAAMJ,EAAS,GAAK,IACxB,OAAQF,GACN,IAAK,OAAQ,OAAOC,EAAOE,EAAQ,OACnC,IAAK,QAAS,OAAOE,EAAK,iBAAmBJ,EAAO,IACpD,IAAK,SAAU,MAAO,IAAMI,EAAKJ,EAAOG,EAClB,UAAYH,EAAOE,EAAQ,WAAaC,EACxCE,EAAM,iBAAmBL,EAAO,KACtD,IAAK,UAAW,MAAO,WAAaA,EAAOE,EAAQ,WAAaC,EACzCE,EAAM,IAAML,EAAO,QACnBG,EAAMH,EAAOE,EAAQF,EAAO,IACnD,QAAS,MAAO,UAAYA,EAAOE,EAAQ,IAAMH,EAAW,KA6ChE,SAAS7B,EAAOpD,GAEd,IAAK,IADDgB,KACK5Q,EAAE,EAAGA,EAAE4P,EAAIvP,OAAQL,IAAK4Q,EAAKhB,EAAI5P,KAAM,EAChD,OAAO4Q,EAMT,SAASwE,EAAYnU,GACnB,MAAqB,iBAAPA,EACJ,IAAMA,EAAM,IACZoU,EAAWpM,KAAKhI,GACd,IAAMA,EACN,KAAOqU,EAAarU,GAAO,KAIzC,SAASqU,EAAajN,GACpB,OAAOA,EAAI4J,QAAQsD,EAAc,QACtBtD,QAAQ,MAAO,OACfA,QAAQ,MAAO,OACfA,QAAQ,MAAO,OACfA,QAAQ,MAAO,OAkE5B,SAASxD,EAAepG,GACtB,MAAO,IAAOiN,EAAajN,GAAO,IAyDpC,SAASmN,EAAW1V,EAAG2V,GACrB,MAAS,MAAL3V,EAAkB2V,GACd3V,EAAI,MAAQ2V,GAAGxD,QAAQ,UAAW,IAc5C,SAASyD,EAAkBrN,GACzB,OAAOA,EAAI4J,QAAQ,KAAM,MAAMA,QAAQ,MAAO,MAIhD,SAAS0D,EAAoBtN,GAC3B,OAAOA,EAAI4J,QAAQ,MAAO,KAAKA,QAAQ,MAAO,KAtQhDlT,EAAOD,SACLqJ,KA0BF,SAAcvI,EAAGgW,GACfA,EAAKA,MACL,IAAK,IAAI3U,KAAOrB,EAAGgW,EAAG3U,GAAOrB,EAAEqB,GAC/B,OAAO2U,GA5BPhB,cAAeA,EACfiB,eAkDF,SAAwBC,EAAWhB,GACjC,OAAQgB,EAAUzV,QAChB,KAAK,EAAG,OAAOuU,EAAckB,EAAU,GAAIhB,GAAM,GACjD,QACE,IAAI5U,EAAO,GACPuT,EAAQT,EAAO8C,GACfrC,EAAMsC,OAAStC,EAAMuC,SACvB9V,EAAOuT,EAAMwC,KAAO,IAAK,KAAOnB,EAAO,OACvC5U,GAAQ,UAAY4U,EAAO,wBACpBrB,EAAMwC,YACNxC,EAAMsC,aACNtC,EAAMuC,QAEXvC,EAAMyC,eAAezC,EAAM0C,QAC/B,IAAK,IAAI3W,KAAKiU,EACZvT,IAASA,EAAO,OAAS,IAAO0U,EAAcpV,EAAGsV,GAAM,GAEzD,OAAO5U,IAlEXkW,cAwEF,SAAuBC,EAAmBP,GACxC,GAAIxE,MAAMC,QAAQuE,GAAY,CAE5B,IAAK,IADDrC,KACKzT,EAAE,EAAGA,EAAE8V,EAAUzV,OAAQL,IAAK,CACrC,IAAIR,EAAIsW,EAAU9V,GACdsW,EAAgB9W,GAAIiU,EAAMA,EAAMpT,QAAUb,EACf,UAAtB6W,GAAuC,UAAN7W,IAAeiU,EAAMA,EAAMpT,QAAUb,GAEjF,GAAIiU,EAAMpT,OAAQ,OAAOoT,MACpB,CAAA,GAAI6C,EAAgBR,GACzB,OAAQA,GACH,GAA0B,UAAtBO,GAA+C,UAAdP,EAC1C,OAAQ,WAnFV9C,OAAQA,EACRoC,YAAaA,EACbE,aAAcA,EACdnI,MAAOpN,EAAQ,mBACfqN,WAAYrN,EAAQ,gBACpBwW,cA8GF,SAAuBlO,EAAKmO,GAC1BA,GAAW,SACX,IAAIlO,EAAUD,EAAIE,MAAM,IAAIW,OAAOsN,EAAS,MAC5C,OAAOlO,EAAUA,EAAQjI,OAAS,GAhHlCoW,WAoHF,SAAoBpO,EAAKmO,EAASE,GAGhC,OAFAF,GAAW,WACXE,EAAOA,EAAKzE,QAAQ,MAAO,QACpB5J,EAAI4J,QAAQ,IAAI/I,OAAOsN,EAAS,KAAME,EAAO,OAtHpDC,YA6HF,SAAqBC,GACnB,OAAOA,EAAI3E,QAAQ4E,EAAY,IACpB5E,QAAQ6E,EAAkB,IAC1B7E,QAAQ8E,EAAoB,eA/HvCC,iBA6IF,SAA0BJ,EAAKK,GAC7B,IAAI3O,EAAUsO,EAAIrO,MAAM2O,GAUxB,OATI5O,GAA6B,GAAlBA,EAAQjI,SACrBuW,EAAMK,EACEL,EAAI3E,QAAQkF,EAAqB,IAC7BlF,QAAQmF,EAAcC,GAC1BT,EAAI3E,QAAQqF,EAAe,IACvBrF,QAAQsF,EAAcC,KAGpClP,EAAUsO,EAAIrO,MAAMkP,KACe,IAAnBnP,EAAQjI,OACjBuW,EAAI3E,QAAQyF,EAAiB,IADSd,GAvJ7Ce,eA4JF,SAAwBzW,EAAQoS,GAC9B,GAAqB,kBAAVpS,EAAqB,OAAQA,EACxC,IAAK,IAAID,KAAOC,EAAQ,GAAIoS,EAAMrS,GAAM,OAAO,GA7J/C2W,qBAiKF,SAA8B1W,EAAQoS,EAAOuE,GAC3C,GAAqB,kBAAV3W,EAAqB,OAAQA,GAA2B,OAAjB2W,EAClD,IAAK,IAAI5W,KAAOC,EAAQ,GAAID,GAAO4W,GAAiBvE,EAAMrS,GAAM,OAAO,GAlKvEwN,eAAgBA,EAChBqJ,YA0KF,SAAqBC,EAAarB,EAAMsB,EAAcC,GAIpD,OAAOzC,EAAUuC,EAHNC,EACG,SAAatB,GAAQuB,EAAW,GAAK,8CACpCA,EAAW,SAAavB,EAAO,SAAa,YAAiBA,EAAO,cA5KnFwB,QAiLF,SAAiBH,EAAaI,EAAMH,GAIlC,OAAOxC,EAAUuC,EAFHtJ,EADHuJ,EACkB,IAAMtC,EAAkByC,GACxB/C,EAAY+C,MAnLzCC,QA0LF,SAAiBC,EAAOC,EAAKC,GAC3B,IAAIC,EAAIC,EAAa3D,EAAMxM,EAC3B,GAAc,KAAV+P,EAAc,MAAO,WACzB,GAAgB,KAAZA,EAAM,GAAW,CACnB,IAAK7O,EAAaP,KAAKoP,GAAQ,MAAM,IAAIpY,MAAM,yBAA2BoY,GAC1EI,EAAcJ,EACdvD,EAAO,eACF,CAEL,KADAxM,EAAU+P,EAAM9P,MAAMkB,IACR,MAAM,IAAIxJ,MAAM,yBAA2BoY,GAGzD,GAFAG,GAAMlQ,EAAQ,GAEK,MADnBmQ,EAAcnQ,EAAQ,IACE,CACtB,GAAIkQ,GAAMF,EAAK,MAAM,IAAIrY,MAAM,gCAAkCuY,EAAK,gCAAkCF,GACxG,OAAOC,EAAMD,EAAME,GAGrB,GAAIA,EAAKF,EAAK,MAAM,IAAIrY,MAAM,sBAAwBuY,EAAK,gCAAkCF,GAE7F,GADAxD,EAAO,QAAWwD,EAAME,GAAO,KAC1BC,EAAa,OAAO3D,EAK3B,IAAK,IAFD4B,EAAO5B,EACPhU,EAAW2X,EAAY1X,MAAM,KACxBf,EAAE,EAAGA,EAAEc,EAAST,OAAQL,IAAK,CACpC,IAAI0Y,EAAU5X,EAASd,GACnB0Y,IAEFhC,GAAQ,QADR5B,GAAQM,EAAYO,EAAoB+C,MAI5C,OAAOhC,GAxNP1F,iBAkOF,SAA0B3I,GACxB,OAAOsN,EAAoBgD,mBAAmBtQ,KAlO9CsN,oBAAqBA,EACrB5C,eAqOF,SAAwB1K,GACtB,OAAOuQ,mBAAmBlD,EAAkBrN,KArO5CqN,kBAAmBA,GAoDrB,IAAIY,EAAkBtD,GAAS,SAAU,SAAU,UAAW,UAAW,SAyBrEqC,EAAa,wBACbE,EAAe,QAiCfsB,EAAa,gBACbC,EAAmB,uCACnBC,EAAqB,8CAQrBG,EAAgB,eAChBI,EAAgB,kEAChBH,EAAsB,uCACtBI,EAAe,uBACfC,EAAc,uCACdJ,EAAe,gFACfC,EAAoB,eACpBI,EAAkB,qCAClBC,EAAkB,iDAmDlBlO,EAAe,sBACfC,EAAwB,qCA6DzBoP,eAAe,GAAG/I,kBAAkB,KAAKgJ,IAAI,SAAS/Y,EAAQhB,EAAOD,GACxE,aACAC,EAAOD,QAAU,SAAyBiQ,EAAIgK,EAAUC,GACtD,IAUEC,EAVErC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UAEzBpB,EAAQ,QAAUe,GAAY,IAC9BM,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,EAEjB,IAAIyU,EAAqB,WAAZb,EACXc,EAAoBD,EAAS,mBAAqB,mBAClDE,EAAc/K,EAAG7N,OAAO2Y,GAExBE,EAAMH,EAAS,IAAM,IACrBI,EAASJ,EAAS,IAAM,IACxBK,OAAgBzT,EAClB,GAJgBuI,EAAG3C,KAAKiM,OAASyB,GAAeA,EAAYzB,MAI3C,CACf,IAAI6B,EAAmBnL,EAAG7G,KAAKkQ,QAAQ0B,EAAYzB,MAAOe,EAAUrK,EAAG4K,aACrEQ,EAAa,YAAcjB,EAC3BkB,EAAY,WAAalB,EACzBmB,EAAgB,eAAiBnB,EAEjCoB,EAAS,QADTC,EAAU,KAAOrB,GACY,OAC/BtC,GAAO,kBAAoB,EAAS,MAAQ,EAAqB,KAEjEA,GAAO,QAAU,EAAe,SAAW,EAAc,cADzDsD,EAAmB,aAAehB,GAC2D,SAAW,EAAc,oBAAwB,EAAc,sBAA0B,EAAc,mBAChMe,EAAgBJ,GAChBW,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,mBAAqB,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kBACjK,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gBAAmB,EAAsB,wBAE9C7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,gBACH8C,IACF9C,GAAO,KAAO,EAAiB,4BAA8B,EAAiB,qBAEhFA,GAAO,IAAM,EAAc,qBAAyB,EAAe,MAAQ,EAAiB,qBAAuB,EAAqB,IAAM,EAAQ,KAAO,EAAiB,OAAS,EAAU,IAAM,EAAW,KAAO,EAAqB,MAAQ,EAAU,IAAM,EAAW,IAAM,EAAiB,WAAa,EAAe,MAAQ,EAAqB,gBAAkB,EAAU,IAAM,EAAW,KAAO,EAAiB,MAAQ,EAAU,IAAM,EAAW,IAAM,EAAiB,SAAW,EAAU,QAAU,EAAU,aAAe,EAAS,MAAQ,EAAe,OAAU,EAAQ,QAAY,EAAQ,UACzlB,CAEH0D,EAASP,EACX,IAFIM,EAAsC,iBAAfP,IAENJ,EAAS,CAC5B,IAAIa,EAAU,IAAOD,EAAS,IAC9B1D,GAAO,SACH8C,IACF9C,GAAO,KAAO,EAAiB,4BAA8B,EAAiB,qBAEhFA,GAAO,MAAQ,EAAiB,qBAAuB,EAAgB,IAAM,EAAQ,KAAO,EAAiB,MAAQ,EAAU,IAAM,EAAW,KAAO,EAAgB,MAAQ,EAAU,IAAM,EAAW,IAAM,EAAiB,SAAW,EAAU,QAAU,EAAU,WACrQ,CACDyD,QAA6B7T,IAAZrB,GACnBgV,GAAa,EACbF,EAAgBJ,EAChBN,EAAiBxK,EAAGnD,cAAgB,IAAMiO,EAC1CZ,EAAea,EACfE,GAAU,MAENK,IAAepB,EAAe8B,KAAKnB,EAAS,MAAQ,OAAOE,EAAa3U,IACxE2U,MAAiBO,GAAgBpB,IACnCkB,GAAa,EACbF,EAAgBJ,EAChBN,EAAiBxK,EAAGnD,cAAgB,IAAMiO,EAC1CG,GAAU,MAEVG,GAAa,EACbG,GAAU,MAGVC,EAAU,IAAOD,EAAS,IAC9B1D,GAAO,SACH8C,IACF9C,GAAO,KAAO,EAAiB,4BAA8B,EAAiB,qBAEhFA,GAAO,IAAM,EAAU,IAAM,EAAW,IAAM,EAAiB,OAAS,EAAU,QAAU,EAAU,QAG1GqD,EAAgBA,GAAiBlB,EACjC,IAAIyB,GAAAA,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,UAAY,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,4BAA8B,EAAY,YAAc,EAAiB,gBAAkB,EAAe,OAClQ,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,0BAA6B,EAAW,IAE7CA,GADE8C,EACK,OAAU,EAEL,EAAiB,KAG7B3K,EAAG3C,KAAKuO,UACV/D,GAAO,eAELA,GADE8C,EACK,kBAAoB,EAEpB,GAAK,EAEd9C,GAAO,2CAA8C7H,EAAa,WAAI,YAAc,EAAU,KAEhG6H,GAAO,OAEPA,GAAO,OAELgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,MACH4C,IACF5C,GAAO,YAEFA,QAGHoE,IAAI,SAASjb,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA8BiQ,EAAIgK,EAAUC,GAC3D,IAUEC,EAVErC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UAEzBpB,EAAQ,QAAUe,GAAY,IAC9BM,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,EAGjByR,GAAO,QACH8C,IACF9C,GAAO,KAAO,EAAiB,4BAA8B,EAAiB,qBAEhFA,GAAO,IAAM,EAAU,YALD,YAAZmC,EAAyB,IAAM,KAKG,IAAM,EAAiB,OACnE,IAAIkB,EAAgBlB,EAChByB,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,eAAiB,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,uBAAyB,EAAiB,OACvM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gCAELA,GADc,YAAZmC,EACK,OAEA,OAETnC,GAAO,SAELA,GADE8C,EACK,OAAU,EAAiB,OAE3B,GAAK,EAEd9C,GAAO,YAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,eAELA,GADE8C,EACK,kBAAoB,EAEpB,GAAK,EAEd9C,GAAO,2CAA8C7H,EAAa,WAAI,YAAc,EAAU,KAEhG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,KACH4C,IACF5C,GAAO,YAEFA,QAGHqE,IAAI,SAASlb,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA+BiQ,EAAIgK,EAAUC,GAC5D,IAUEC,EAVErC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UAEzBpB,EAAQ,QAAUe,GAAY,IAC9BM,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,EAGjByR,GAAO,QACH8C,IACF9C,GAAO,KAAO,EAAiB,4BAA8B,EAAiB,qBAG9EA,IADsB,IAApB7H,EAAG3C,KAAK8O,QACH,IAAM,EAAU,WAEhB,eAAiB,EAAU,KAEpCtE,GAAO,KAVe,aAAZmC,EAA0B,IAAM,KAUrB,IAAM,EAAiB,OAC5C,IAAIkB,EAAgBlB,EAChByB,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,gBAAkB,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,uBAAyB,EAAiB,OACxM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,8BAELA,GADc,aAAZmC,EACK,SAEA,UAETnC,GAAO,SAELA,GADE8C,EACK,OAAU,EAAiB,OAE3B,GAAK,EAEd9C,GAAO,iBAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,eAELA,GADE8C,EACK,kBAAoB,EAEpB,GAAK,EAEd9C,GAAO,2CAA8C7H,EAAa,WAAI,YAAc,EAAU,KAEhG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,KACH4C,IACF5C,GAAO,YAEFA,QAGHuE,IAAI,SAASpb,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAmCiQ,EAAIgK,EAAUC,GAChE,IAUEC,EAVErC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UAEzBpB,EAAQ,QAAUe,GAAY,IAC9BM,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,EAGjByR,GAAO,QACH8C,IACF9C,GAAO,KAAO,EAAiB,4BAA8B,EAAiB,qBAEhFA,GAAO,gBAAkB,EAAU,aALb,iBAAZmC,EAA8B,IAAM,KAKW,IAAM,EAAiB,OAChF,IAAIkB,EAAgBlB,EAChByB,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,oBAAsB,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,uBAAyB,EAAiB,OAC5M,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gCAELA,GADc,iBAAZmC,EACK,OAEA,OAETnC,GAAO,SAELA,GADE8C,EACK,OAAU,EAAiB,OAE3B,GAAK,EAEd9C,GAAO,iBAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,eAELA,GADE8C,EACK,kBAAoB,EAEpB,GAAK,EAEd9C,GAAO,2CAA8C7H,EAAa,WAAI,YAAc,EAAU,KAEhG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,KACH4C,IACF5C,GAAO,YAEFA,QAGHwE,IAAI,SAASrb,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAwBiQ,EAAIgK,EAAUC,GACrD,IAAIpC,EAAM,IACNzR,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzB4B,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACnBuM,EAAiB,GACrBD,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC3BqC,EAAiBH,EAAIrU,OACvByU,GAAmB,EACjBC,EAAOvW,EACX,GAAIuW,EAGF,IAFA,IAAIC,EAAMC,GAAM,EACdC,EAAKH,EAAKrb,OAAS,EACdub,EAAKC,GACVF,EAAOD,EAAKE,GAAM,GACd7M,EAAG7G,KAAKyP,eAAegE,EAAM5M,EAAGhD,MAAMyH,OACxCiI,GAAmB,EACnBJ,EAAIna,OAASya,EACbN,EAAI1P,WAAa2N,EAAc,IAAMsC,EAAK,IAC1CP,EAAIzP,cAAgB2N,EAAiB,IAAMqC,EAC3ChF,GAAO,KAAQ7H,EAAGzL,SAAS+X,GAAQ,IACnCA,EAAIrU,OAASwU,EACThC,IACF5C,GAAO,QAAU,EAAe,OAChC0E,GAAkB,MAa1B,OARI9B,IAEA5C,GADE6E,EACK,gBAEA,IAAOH,EAAezK,MAAM,GAAI,GAAM,KAGjD+F,EAAM7H,EAAG7G,KAAKyO,YAAYC,SAItBkF,IAAI,SAAS/b,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAwBiQ,EAAIgK,EAAUC,GACrD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnB8C,EAAQ,SAAW9C,EACnBmC,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACnBuM,EAAiB,GACrBD,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAI/B,GAHqBhU,EAAQ8W,MAAM,SAASN,GAC1C,OAAO5M,EAAG7G,KAAKyP,eAAegE,EAAM5M,EAAGhD,MAAMyH,OAE3B,CAClB,IAAIgI,EAAiBH,EAAIrU,OACzB4P,GAAO,QAAU,EAAU,kBAAoB,EAAW,cAC1D,IAAIsF,EAAgBnN,EAAG+L,cACvB/L,EAAG+L,cAAgBO,EAAIP,eAAgB,EACvC,IAAIY,EAAOvW,EACX,GAAIuW,EAGF,IAFA,IAAIC,EAAMC,GAAM,EACdC,EAAKH,EAAKrb,OAAS,EACdub,EAAKC,GACVF,EAAOD,EAAKE,GAAM,GAClBP,EAAIna,OAASya,EACbN,EAAI1P,WAAa2N,EAAc,IAAMsC,EAAK,IAC1CP,EAAIzP,cAAgB2N,EAAiB,IAAMqC,EAC3ChF,GAAO,KAAQ7H,EAAGzL,SAAS+X,GAAQ,IACnCA,EAAIrU,OAASwU,EACb5E,GAAO,IAAM,EAAW,MAAQ,EAAW,OAAS,EAAe,UAAY,EAAW,OAC1F0E,GAAkB,IAGtBvM,EAAG+L,cAAgBO,EAAIP,cAAgBoB,EACvCtF,GAAO,IAAM,EAAmB,SAAW,EAAW,sBAC9B,IAApB7H,EAAG0L,cACL7D,GAAO,sDAAyE7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kBACtI,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,oDAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,gFACF7H,EAAG+L,eAAiBtB,IAErB5C,GADE7H,EAAGkI,MACE,wCAEA,8CAGXL,GAAO,uBAAyB,EAAU,iCAAmC,EAAU,sBAAwB,EAAU,4BACrH7H,EAAG3C,KAAKqN,YACV7C,GAAO,OAETA,EAAM7H,EAAG7G,KAAKyO,YAAYC,QAEtB4C,IACF5C,GAAO,iBAGX,OAAOA,QAGHuF,IAAI,SAASpc,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAwBiQ,EAAIgK,EAAUC,GACrD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnBQ,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,IACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,MAKlGD,IACH9C,GAAO,cAAgB,EAAS,qBAAuB,EAAgB,KAEzEA,GAAO,OAAS,EAAW,YAAc,EAAU,WAAa,EAAS,WAAa,EAAW,SACjG,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,sDAAyE7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kBACtI,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,8CAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,KACH4C,IACF5C,GAAO,YAEFA,QAGHwF,IAAI,SAASrc,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA2BiQ,EAAIgK,EAAUC,GACxD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnB8C,EAAQ,SAAW9C,EACnBmC,EAAMtM,EAAG7G,KAAKC,KAAK4G,GAEvBsM,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC3BkD,EAAO,IAAMnD,EACfoD,EAAWjB,EAAIhC,UAAYtK,EAAGsK,UAAY,EAC1CkD,EAAY,OAASD,EACrBd,EAAiBzM,EAAG/H,OACpBwV,EAAkBzN,EAAG7G,KAAKyP,eAAexS,EAAS4J,EAAGhD,MAAMyH,KAE7D,GADAoD,GAAO,OAAS,EAAU,iBAAmB,EAAW,IACpD4F,EAAiB,CACnB,IAAIN,EAAgBnN,EAAG+L,cACvB/L,EAAG+L,cAAgBO,EAAIP,eAAgB,EACvCO,EAAIna,OAASiE,EACbkW,EAAI1P,WAAa2N,EACjB+B,EAAIzP,cAAgB2N,EACpB3C,GAAO,QAAU,EAAe,sBAAwB,EAAS,SAAW,EAAS,MAAQ,EAAU,YAAc,EAAS,SAC9HyE,EAAIxP,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAWwQ,EAAMtN,EAAG3C,KAAK4L,cAAc,GAC9E,IAAIyE,EAAYpE,EAAQ,IAAMgE,EAAO,IACrChB,EAAI1B,YAAY2C,GAAYD,EAC5B,IAAIK,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAExEA,GAAO,QAAU,EAAe,eAChC7H,EAAG+L,cAAgBO,EAAIP,cAAgBoB,EACvCtF,GAAO,UAAoC,EAAe,WAE1DA,GAAO,QAAU,EAAU,kBAE7B,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,yDAA4E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kBACzI,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,8CAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAmBZ,OAlBAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,aACH4F,IACF5F,GAAO,cAAgB,EAAU,iCAAmC,EAAU,sBAAwB,EAAU,6BAE9G7H,EAAG3C,KAAKqN,YACV7C,GAAO,OAETA,EAAM7H,EAAG7G,KAAKyO,YAAYC,SAItB+F,IAAI,SAAS5c,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAyBiQ,EAAIgK,EAAUC,GACtD,IAOIiB,EAKFhB,EAZErC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UAEzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnB8C,EAAQ,SAAW9C,EACnBQ,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,EAEjB,IAIIyX,EAAUC,EAASC,EAAQC,EAAeC,EAH5CC,EAAc,aAAe/D,EAC7BgE,EAFU7d,KAEI4P,WACdqM,EAAiB,GAEnB,GAAI5B,GAAWwD,EAAM7E,MAAO,CAE1B,IAAI8E,EAAkBD,EAAMlO,eAC5B4H,GAAO,QAAU,EAAgB,oBAAuB,EAAa,uBAFrEoG,EAAgB,kBAAoB9D,GAE4E,MAAQ,EAAgB,iBACnI,CAEL,KADA6D,EAAgBhO,EAAG5C,cAVT9M,KAU8B8F,EAAS4J,EAAG7N,OAAQ6N,IACxC,OACpBkK,EAAe,kBAAoBK,EACnC0D,EAAgBD,EAAc7c,KAC9B0c,EAAWM,EAAMvS,QACjBkS,EAAUK,EAAM7O,OAChByO,EAASI,EAAM/N,MAEjB,IAAIiO,EAAYJ,EAAgB,UAC9BpB,EAAK,IAAM1C,EACXmE,EAAW,UAAYnE,EACvBoE,EAAgBJ,EAAMjG,MACxB,GAAIqG,IAAkBvO,EAAGkI,MAAO,MAAM,IAAIhX,MAAM,gCAahD,GAZM4c,GAAWC,IACflG,GAAY,EAAc,YAE5BA,GAAO,OAAS,EAAU,iBAAmB,EAAW,IACpD8C,GAAWwD,EAAM7E,QACnBiD,GAAkB,IAClB1E,GAAO,QAAU,EAAiB,qBAAuB,EAAW,qBAChEuG,IACF7B,GAAkB,IAClB1E,GAAO,IAAM,EAAW,MAAQ,EAAgB,mBAAqB,EAAiB,UAAY,EAAW,SAG7GiG,EAEAjG,GADEsG,EAAMK,WACD,IAAOR,EAAsB,SAAI,IAEjC,IAAM,EAAW,MAASA,EAAsB,SAAI,UAExD,GAAID,EAAQ,CACjB,IAAIzB,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACnBuM,EAAiB,GACrBD,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC/BkC,EAAIna,OAAS6b,EAAczZ,SAC3B+X,EAAI1P,WAAa,GACjB,IAAIuQ,EAAgBnN,EAAG+L,cACvB/L,EAAG+L,cAAgBO,EAAIP,eAAgB,EACvC,IAAI4B,EAAQ3N,EAAGzL,SAAS+X,GAAKpJ,QAAQ,oBAAqB+K,GAC1DjO,EAAG+L,cAAgBO,EAAIP,cAAgBoB,EACvCtF,GAAO,IAAM,MACR,EACD4D,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,GACNA,GAAO,KAAO,EAAkB,UAE9BA,GADE7H,EAAG3C,KAAKoR,YACH,OAEA,OAGP5G,GADEgG,IAA6B,IAAjBM,EAAMhc,OACb,MAAQ,EAAU,IAElB,MAAQ,EAAiB,MAAQ,EAAU,qBAAwB6N,EAAa,WAAI,IAE7F6H,GAAO,sBACa,MAAhB7H,EAAGlD,YACL+K,GAAO,MAAS7H,EAAY,WAE9B,IAAI0O,EAAcrE,EAAW,QAAWA,EAAW,GAAM,IAAM,aAC7DsE,EAAsBtE,EAAWrK,EAAG4K,YAAYP,GAAY,qBAE1DuE,EADJ/G,GAAO,MAAQ,EAAgB,MAAQ,EAAwB,kBAE/DA,EAAM4D,EAAWK,OACI,IAAjBqC,EAAMvV,QACRiP,GAAO,IAAM,EAAW,MACpB0G,IACF1G,GAAO,GAAM7H,EAAa,YAE5B6H,GAAY,EAAyB,MAInCA,GAFE0G,EAEK,SADPF,EAAY,eAAiBlE,GACE,kBAAoB,EAAW,MAASnK,EAAa,WAAI,EAAyB,mBAAqB,EAAW,+CAAiD,EAAc,gCAEzM,IAAM,EAAc,YAAc,EAAW,MAAQ,EAAyB,KAQ3F,GAJImO,EAAMU,YACRhH,GAAO,QAAU,EAAgB,KAAO,EAAU,MAAQ,EAAgB,IAAM,EAAwB,MAE1GA,GAAO,GAAK,EACRsG,EAAMW,MACJrE,IACF5C,GAAO,qBAEJ,CACLA,GAAO,cACapQ,IAAhB0W,EAAMW,OACRjH,GAAO,KAELA,GADEkG,EACK,GAAK,EAEL,GAAK,GAGdlG,GAAO,KAAQsG,EAAMW,MAAS,IAEhCjH,GAAO,OACPqD,EAjHU5a,KAiHY+P,SAClBoL,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,GACN,IAAI4D,GAAAA,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,UAAY,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,0BAzHzKla,KAyHoN,QAAI,QACvM,IAArB0P,EAAG3C,KAAKsO,WACV9D,GAAO,8BA3HDvX,KA2H+C,QAAI,2BAEvD0P,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAUjB,IAAIiD,EAPAlH,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAGnCL,EAAM4D,EAAWK,MACbgC,EACEK,EAAMvV,OACY,QAAhBuV,EAAMvV,SACRiP,GAAO,cAAgB,EAAO,IAAM,EAAU,KAAO,EAAO,YAAc,EAAO,aAAe,EAAa,cAAgB,EAAO,UAAY,EAAa,4BAA8B,EAAa,kCAAuC7H,EAAY,UAAI,SAAW,EAAa,gCAAkC,EAAa,kBAAoB,EAAmB,QACzWA,EAAG3C,KAAKuO,UACV/D,GAAO,IAAM,EAAa,aAAe,EAAiB,KAAO,EAAa,WAAa,EAAU,MAEvGA,GAAO,QAGY,IAAjBsG,EAAMvV,OACRiP,GAAO,IAAM,EAAoB,KAEjCA,GAAO,QAAU,EAAU,iBAAmB,EAAoB,uBAAyB,EAAO,IAAM,EAAU,KAAO,EAAO,YAAc,EAAO,aAAe,EAAa,cAAgB,EAAO,UAAY,EAAa,4BAA8B,EAAa,kCAAuC7H,EAAY,UAAI,SAAW,EAAa,gCAAkC,EAAa,kBAAoB,EAAmB,QAC7aA,EAAG3C,KAAKuO,UACV/D,GAAO,IAAM,EAAa,aAAe,EAAiB,KAAO,EAAa,WAAa,EAAU,MAEvGA,GAAO,SAGFkG,GACTlG,GAAO,mBACiB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,UAAY,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,0BAxK3Kla,KAwKsN,QAAI,QACvM,IAArB0P,EAAG3C,KAAKsO,WACV9D,GAAO,8BA1KHvX,KA0KiD,QAAI,2BAEvD0P,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,gFACF7H,EAAG+L,eAAiBtB,IAErB5C,GADE7H,EAAGkI,MACE,wCAEA,gDAIU,IAAjBiG,EAAMvV,OACRiP,GAAO,IAAM,EAAoB,KAEjCA,GAAO,sBAAwB,EAAc,wCAA0C,EAAc,mCAAqC,EAAc,yCAA2C,EAAO,IAAM,EAAU,KAAO,EAAO,YAAc,EAAO,aAAe,EAAa,cAAgB,EAAO,UAAY,EAAa,4BAA8B,EAAa,kCAAuC7H,EAAY,UAAI,MAAQ,EAAa,kBAAoB,EAAmB,OACneA,EAAG3C,KAAKuO,UACV/D,GAAO,IAAM,EAAa,aAAe,EAAiB,KAAO,EAAa,WAAa,EAAU,MAEvGA,GAAO,eAAiB,EAAoB,OAGhDA,GAAO,MACH4C,IACF5C,GAAO,YAGX,OAAOA,QAGHmH,IAAI,SAAShe,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA+BiQ,EAAIgK,EAAUC,GAC5D,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B4C,EAAQ,SAAW9C,EACnBmC,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACnBuM,EAAiB,GACrBD,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC3B6E,KACFC,KACAC,EAAiBnP,EAAG3C,KAAK+R,cAC3B,IAAKC,KAAajZ,EAAS,CACzB,IAAIwW,EAAOxW,EAAQiZ,GACfC,EAAQ/M,MAAMC,QAAQoK,GAAQsC,EAAgBD,EAClDK,EAAMD,GAAazC,EAErB/E,GAAO,OAAS,EAAU,aAC1B,IAAI0H,EAAoBvP,EAAGlD,UAC3B+K,GAAO,cAAgB,EAAS,IAChC,IAAK,IAAIwH,KAAaH,EAEpB,IADAI,EAAQJ,EAAcG,IACZ/d,OAAQ,CAKhB,GAJAuW,GAAO,SAAW,EAAW7H,EAAG7G,KAAKkN,YAAYgJ,GAAc,kBAC3DF,IACFtH,GAAO,4CAA8C,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAa8I,GAAc,OAE1G5E,EAAe,CACjB5C,GAAO,SACP,IAAI8E,EAAO2C,EACX,GAAI3C,EAGF,IAFA,IAAkBE,GAAM,EACtBC,EAAKH,EAAKrb,OAAS,EACdub,EAAKC,GAAI,CACd0C,EAAe7C,EAAKE,GAAM,GACtBA,IACFhF,GAAO,QAITA,GAAO,SADL4H,EAAWnG,GADToG,EAAQ1P,EAAG7G,KAAKkN,YAAYmJ,KAEF,kBAC1BL,IACFtH,GAAO,8CAAgD,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAaiJ,GAAiB,OAEnH3H,GAAO,gBAAkB,EAAS,MAAS7H,EAAG7G,KAAKuG,eAAeM,EAAG3C,KAAK4L,aAAeuG,EAAeE,GAAU,OAGtH7H,GAAO,SACP,IAAI8H,EAAgB,UAAYxF,EAC9ByF,EAAmB,OAAUD,EAAgB,OAC3C3P,EAAG3C,KAAKwS,yBACV7P,EAAGlD,UAAYkD,EAAG3C,KAAK4L,aAAejJ,EAAG7G,KAAK4P,YAAYwG,EAAmBI,GAAe,GAAQJ,EAAoB,MAAQI,GAElI,IAAIlE,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,6DAAgF7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,2BAA+BxK,EAAG7G,KAAKoN,aAAa8I,GAAc,wBAA4B,EAAqB,iBAAqBC,EAAY,OAAI,YAAgBtP,EAAG7G,KAAKoN,aAA6B,GAAhB+I,EAAMhe,OAAcge,EAAM,GAAKA,EAAMQ,KAAK,OAAU,QAC9X,IAArB9P,EAAG3C,KAAKsO,WACV9D,GAAO,4BAELA,GADkB,GAAhByH,EAAMhe,OACD,YAAe0O,EAAG7G,KAAKoN,aAAa+I,EAAM,IAE1C,cAAiBtP,EAAG7G,KAAKoN,aAAa+I,EAAMQ,KAAK,OAE1DjI,GAAO,kBAAqB7H,EAAG7G,KAAKoN,aAAa8I,GAAc,iBAE7DrP,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,mFAE9B,CACLL,GAAO,QACP,IAAIkI,EAAOT,EACX,GAAIS,EAGF,IAFA,IAAIP,EAAcQ,GAAM,EACtBC,EAAKF,EAAKze,OAAS,EACd0e,EAAKC,GAAI,CACdT,EAAeO,EAAKC,GAAM,GAC1B,IAAIN,EAAQ1P,EAAG7G,KAAKkN,YAAYmJ,GAE9BC,GADAG,EAAmB5P,EAAG7G,KAAKoN,aAAaiJ,GAC7BlG,EAAQoG,GACjB1P,EAAG3C,KAAKwS,yBACV7P,EAAGlD,UAAYkD,EAAG7G,KAAKgQ,QAAQoG,EAAmBC,EAAcxP,EAAG3C,KAAK4L,eAE1EpB,GAAO,SAAW,EAAa,kBAC3BsH,IACFtH,GAAO,8CAAgD,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAaiJ,GAAiB,OAEnH3H,GAAO,qBACiB,IAApB7H,EAAG0L,cACL7D,GAAO,6DAAgF7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,2BAA+BxK,EAAG7G,KAAKoN,aAAa8I,GAAc,wBAA4B,EAAqB,iBAAqBC,EAAY,OAAI,YAAgBtP,EAAG7G,KAAKoN,aAA6B,GAAhB+I,EAAMhe,OAAcge,EAAM,GAAKA,EAAMQ,KAAK,OAAU,QAC9X,IAArB9P,EAAG3C,KAAKsO,WACV9D,GAAO,4BAELA,GADkB,GAAhByH,EAAMhe,OACD,YAAe0O,EAAG7G,KAAKoN,aAAa+I,EAAM,IAE1C,cAAiBtP,EAAG7G,KAAKoN,aAAa+I,EAAMQ,KAAK,OAE1DjI,GAAO,kBAAqB7H,EAAG7G,KAAKoN,aAAa8I,GAAc,iBAE7DrP,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,kFAIbA,GAAO,QACH4C,IACF8B,GAAkB,IAClB1E,GAAO,YAIb7H,EAAGlD,UAAYyS,EACf,IAAI9C,EAAiBH,EAAIrU,OACzB,IAAK,IAAIoX,KAAaJ,EAAa,CAE7BjP,EAAG7G,KAAKyP,eADRgE,EAAOqC,EAAYI,GACUrP,EAAGhD,MAAMyH,OACxCoD,GAAO,IAAM,EAAe,iBAAmB,EAAW7H,EAAG7G,KAAKkN,YAAYgJ,GAAc,kBACxFF,IACFtH,GAAO,4CAA8C,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAa8I,GAAc,OAE9GxH,GAAO,OACPyE,EAAIna,OAASya,EACbN,EAAI1P,WAAa2N,EAAcvK,EAAG7G,KAAKkN,YAAYgJ,GACnD/C,EAAIzP,cAAgB2N,EAAiB,IAAMxK,EAAG7G,KAAK6K,eAAeqL,GAClExH,GAAO,KAAQ7H,EAAGzL,SAAS+X,GAAQ,IACnCA,EAAIrU,OAASwU,EACb5E,GAAO,OACH4C,IACF5C,GAAO,QAAU,EAAe,OAChC0E,GAAkB,MAQxB,OAJI9B,IACF5C,GAAO,MAAQ,EAAmB,QAAU,EAAU,iBAExDA,EAAM7H,EAAG7G,KAAKyO,YAAYC,SAItBqI,IAAI,SAASlf,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAuBiQ,EAAIgK,EAAUC,GACpD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnBQ,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,IACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,MAKvG,IAAIiC,EAAK,IAAM1C,EACbgG,EAAW,SAAWhG,EACnBQ,IACH9C,GAAO,QAAU,EAAa,qBAAuB,EAAgB,KAEvEA,GAAO,OAAS,EAAW,IACvB8C,IACF9C,GAAO,cAAgB,EAAS,mBAAqB,EAAW,0CAA4C,EAAS,MAAQ,EAAW,oBAE1IA,GAAY,EAAW,qBAAuB,EAAO,OAAS,EAAO,IAAM,EAAa,YAAc,EAAO,iBAAmB,EAAU,KAAO,EAAa,IAAM,EAAO,SAAW,EAAW,oBAC7L8C,IACF9C,GAAO,SAETA,GAAO,SAAW,EAAW,SAC7B,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,qDAAwE7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,qCAAuC,EAAS,OACrL,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,+DAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,KACH4C,IACF5C,GAAO,YAEFA,QAGHuI,IAAI,SAASpf,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAyBiQ,EAAIgK,EAAUC,GACtD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAClC,IAAuB,IAAnBrK,EAAG3C,KAAKhK,OAIV,OAHIoX,IACF5C,GAAO,iBAEFA,EAET,IACEqC,EADES,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,EAEjB,IAAIia,EAAkBrQ,EAAG3C,KAAKiT,eAC5BC,EAAgBhO,MAAMC,QAAQ6N,GAChC,GAAI1F,EAAS,CAIX9C,GAAO,SAHH2I,EAAU,SAAWrG,GAGI,cAAgB,EAAiB,WAF5DsG,EAAY,WAAatG,GAE6D,aAAe,EAAY,qBAAyB,EAAY,0BAA4B,EAAY,mBAD9LuG,EAAc,aAAevG,GACqM,MAAQ,EAAc,OAAS,EAAY,0BAA8B,EAAc,OACvTnK,EAAGkI,QACLL,GAAO,aAAe,EAAS,MAAQ,EAAY,YAErDA,GAAO,IAAM,EAAY,MAAQ,EAAY,sBACzC8C,IACF9C,GAAO,KAAO,EAAiB,4BAA8B,EAAiB,qBAEhFA,GAAO,KACgB,UAAnBwI,IACFxI,GAAO,KAAO,EAAiB,QAAU,EAAY,IACjD0I,IACF1I,GAAO,yCAA2C,EAAiB,YAErEA,GAAO,SAETA,GAAO,KAAO,EAAY,OAAS,EAAgB,QAAW,EAAc,iBAAoB,EAAY,oBAE1GA,GADE7H,EAAGkI,MACE,UAAY,EAAS,MAASlI,EAAa,WAAI,IAAM,EAAY,IAAM,EAAU,OAAS,EAAY,IAAM,EAAU,MAEtH,IAAM,EAAY,IAAM,EAAU,KAE3C6H,GAAO,MAAQ,EAAY,SAAW,EAAU,cAC3C,CACL,IAAI2I,EACJ,KADIA,EAAUxQ,EAAG/G,QAAQ7C,IACX,CACZ,GAAuB,UAAnBia,EAKF,OAJArQ,EAAG1C,OAAOqT,KAAK,mBAAqBva,EAAU,gCAAkC4J,EAAGnD,cAAgB,KAC/F4N,IACF5C,GAAO,iBAEFA,EACF,GAAI0I,GAAiBF,EAAgBO,QAAQxa,IAAY,EAI9D,OAHIqU,IACF5C,GAAO,iBAEFA,EAEP,MAAM,IAAI3W,MAAM,mBAAqBkF,EAAU,gCAAkC4J,EAAGnD,cAAgB,KAGxG,IAAI4T,EACAC,GADAD,EAA8B,iBAAXD,KAAyBA,aAAmBrW,SAAWqW,EAAQjc,WACvDic,EAAQlM,MAAQ,SAC/C,GAAImM,EAAW,CACb,IAAIjU,GAA2B,IAAlBgU,EAAQtI,MACrBsI,EAAUA,EAAQjc,SAEpB,GAAImc,GAAezG,EAIjB,OAHIQ,IACF5C,GAAO,iBAEFA,EAET,GAAIrL,EAAQ,CACV,IAAKwD,EAAGkI,MAAO,MAAM,IAAIhX,MAAM,+BAC/B,IAAI2f,EAAa,UAAY7Q,EAAG7G,KAAKkN,YAAYjQ,GAAW,YAC5DyR,GAAO,UAAa7H,EAAa,WAAI,IAAM,EAAe,IAAM,EAAU,aACrE,CACL6H,GAAO,UACHgJ,EAAa,UAAY7Q,EAAG7G,KAAKkN,YAAYjQ,GAC7Cqa,IAAWI,GAAc,aAE3BhJ,GADoB,mBAAX2I,EACF,IAAM,EAAe,IAAM,EAAU,KAErC,IAAM,EAAe,SAAW,EAAU,KAEnD3I,GAAO,QAGX,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,uDAA0E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,yBAE9J3C,GADE8C,EACK,GAAK,EAEL,GAAM3K,EAAG7G,KAAKuG,eAAetJ,GAEtCyR,GAAO,QACkB,IAArB7H,EAAG3C,KAAKsO,WACV9D,GAAO,sCAELA,GADE8C,EACK,OAAU,EAAiB,OAE3B,GAAM3K,EAAG7G,KAAKoN,aAAanQ,GAEpCyR,GAAO,QAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,eAELA,GADE8C,EACK,kBAAoB,EAEpB,GAAM3K,EAAG7G,KAAKuG,eAAetJ,GAEtCyR,GAAO,2CAA8C7H,EAAa,WAAI,YAAc,EAAU,KAEhG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,MACH4C,IACF5C,GAAO,YAEFA,QAGHiJ,IAAI,SAAS9f,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAwBiQ,EAAIgK,EAAUC,GACrD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnB8C,EAAQ,SAAW9C,EACnBmC,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACnBuM,EAAiB,GACrBD,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC3BkD,EAAO,IAAMnD,EACfoD,EAAWjB,EAAIhC,UAAYtK,EAAGsK,UAAY,EAC1CkD,EAAY,OAASD,EACrBd,EAAiBzM,EAAG/H,OAEtB,GADA4P,GAAO,OAAS,EAAU,iBAAmB,EAAW,IACpDtF,MAAMC,QAAQpM,GAAU,CAC1B,IAAI2a,EAAmB/Q,EAAG7N,OAAO6e,gBACjC,IAAyB,IAArBD,EAA4B,CAC9BlJ,GAAO,IAAM,EAAW,MAAQ,EAAU,cAAiBzR,EAAc,OAAI,KAC7E,IAAI6a,EAAqBzG,EACzBA,EAAiBxK,EAAGnD,cAAgB,mBACpCgL,GAAO,UAAY,EAAW,SAC9B,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,gEAAmF7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,uBAA0BpU,EAAc,OAAI,OAC5L,IAArB4J,EAAG3C,KAAKsO,WACV9D,GAAO,0CAA8CzR,EAAc,OAAI,YAErE4J,EAAG3C,KAAKuO,UACV/D,GAAO,mDAAsD7H,EAAa,WAAI,YAAc,EAAU,KAExG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,MACP2C,EAAiByG,EACbxG,IACF8B,GAAkB,IAClB1E,GAAO,YAGX,IAAI8E,EAAOvW,EACX,GAAIuW,EAGF,IAFA,IAAIC,EAAMC,GAAM,EACdC,EAAKH,EAAKrb,OAAS,EACdub,EAAKC,GAEV,GADAF,EAAOD,EAAKE,GAAM,GACd7M,EAAG7G,KAAKyP,eAAegE,EAAM5M,EAAGhD,MAAMyH,KAAM,CAC9CoD,GAAO,IAAM,EAAe,gBAAkB,EAAU,aAAe,EAAO,OAC9E,IAAI6F,EAAYpE,EAAQ,IAAMuD,EAAK,IACnCP,EAAIna,OAASya,EACbN,EAAI1P,WAAa2N,EAAc,IAAMsC,EAAK,IAC1CP,EAAIzP,cAAgB2N,EAAiB,IAAMqC,EAC3CP,EAAIxP,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAW+P,EAAI7M,EAAG3C,KAAK4L,cAAc,GAC5EqD,EAAI1B,YAAY2C,GAAYV,EAC5B,IAAIc,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAExEA,GAAO,OACH4C,IACF5C,GAAO,QAAU,EAAe,OAChC0E,GAAkB,KAK1B,GAA+B,iBAApBwE,GAAgC/Q,EAAG7G,KAAKyP,eAAemI,EAAkB/Q,EAAGhD,MAAMyH,KAAM,CACjG6H,EAAIna,OAAS4e,EACbzE,EAAI1P,WAAaoD,EAAGpD,WAAa,mBACjC0P,EAAIzP,cAAgBmD,EAAGnD,cAAgB,mBACvCgL,GAAO,IAAM,EAAe,gBAAkB,EAAU,aAAgBzR,EAAc,OAAI,iBAAmB,EAAS,MAASA,EAAc,OAAI,KAAO,EAAS,MAAQ,EAAU,YAAc,EAAS,SAC1MkW,EAAIxP,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAWwQ,EAAMtN,EAAG3C,KAAK4L,cAAc,GAC1EyE,EAAYpE,EAAQ,IAAMgE,EAAO,IACrChB,EAAI1B,YAAY2C,GAAYD,EACxBK,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAEpE4C,IACF5C,GAAO,SAAW,EAAe,aAEnCA,GAAO,SACH4C,IACF5C,GAAO,QAAU,EAAe,OAChC0E,GAAkB,WAGjB,GAAIvM,EAAG7G,KAAKyP,eAAexS,EAAS4J,EAAGhD,MAAMyH,KAAM,CACxD6H,EAAIna,OAASiE,EACbkW,EAAI1P,WAAa2N,EACjB+B,EAAIzP,cAAgB2N,EACpB3C,GAAO,cAAgB,EAAS,SAAqB,EAAS,MAAQ,EAAU,YAAc,EAAS,SACvGyE,EAAIxP,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAWwQ,EAAMtN,EAAG3C,KAAK4L,cAAc,GAC1EyE,EAAYpE,EAAQ,IAAMgE,EAAO,IACrChB,EAAI1B,YAAY2C,GAAYD,EACxBK,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAEpE4C,IACF5C,GAAO,SAAW,EAAe,aAEnCA,GAAO,KAMT,OAJI4C,IACF5C,GAAO,IAAM,EAAmB,QAAU,EAAU,iBAEtDA,EAAM7H,EAAG7G,KAAKyO,YAAYC,SAItBqJ,IAAI,SAASlgB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA6BiQ,EAAIgK,EAAUC,GAC1D,IASEC,EATErC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9BM,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,EAEjByR,GAAO,eAAiB,EAAS,QAC7B8C,IACF9C,GAAO,IAAM,EAAiB,8BAAgC,EAAiB,oBAEjFA,GAAO,aAAe,EAAS,MAAQ,EAAU,MAAQ,EAAiB,KAExEA,GADE7H,EAAG3C,KAAK8T,oBACH,gCAAkC,EAAS,eAAiB,EAAS,UAAanR,EAAG3C,KAAwB,oBAAI,IAEjH,YAAc,EAAS,yBAA2B,EAAS,KAEpEwK,GAAO,MACH8C,IACF9C,GAAO,SAETA,GAAO,UACP,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,2DAA8E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,4BAA8B,EAAiB,OAC1L,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,sCAELA,GADE8C,EACK,OAAU,EAEL,EAAiB,KAG7B3K,EAAG3C,KAAKuO,UACV/D,GAAO,eAELA,GADE8C,EACK,kBAAoB,EAEpB,GAAK,EAEd9C,GAAO,2CAA8C7H,EAAa,WAAI,YAAc,EAAU,KAEhG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,KACH4C,IACF5C,GAAO,YAEFA,QAGHuJ,IAAI,SAASpgB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAsBiQ,EAAIgK,EAAUC,GACnD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B4C,EAAQ,SAAW9C,EACnBmC,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACvBsM,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC/B,GAAIpK,EAAG7G,KAAKyP,eAAexS,EAAS4J,EAAGhD,MAAMyH,KAAM,CACjD6H,EAAIna,OAASiE,EACbkW,EAAI1P,WAAa2N,EACjB+B,EAAIzP,cAAgB2N,EACpB3C,GAAO,QAAU,EAAU,eAC3B,IAAIsF,EAAgBnN,EAAG+L,cACvB/L,EAAG+L,cAAgBO,EAAIP,eAAgB,EACvCO,EAAIZ,cAAe,EACnB,IAAI2F,EACA/E,EAAIjP,KAAKqN,YACX2G,EAAmB/E,EAAIjP,KAAKqN,UAC5B4B,EAAIjP,KAAKqN,WAAY,GAEvB7C,GAAO,IAAO7H,EAAGzL,SAAS+X,GAAQ,IAClCA,EAAIZ,cAAe,EACf2F,IAAkB/E,EAAIjP,KAAKqN,UAAY2G,GAC3CrR,EAAG+L,cAAgBO,EAAIP,cAAgBoB,EACvCtF,GAAO,QAAU,EAAe,SAChC,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,oDAAuE7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kBACpI,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,sCAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,uBAAyB,EAAU,iCAAmC,EAAU,sBAAwB,EAAU,4BACrH7H,EAAG3C,KAAKqN,YACV7C,GAAO,YAGTA,GAAO,kBACiB,IAApB7H,EAAG0L,cACL7D,GAAO,oDAAuE7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kBACpI,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,sCAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,+EACH4C,IACF5C,GAAO,kBAGX,OAAOA,QAGHyJ,IAAI,SAAStgB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAwBiQ,EAAIgK,EAAUC,GACrD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnB8C,EAAQ,SAAW9C,EACnBmC,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACnBuM,EAAiB,GACrBD,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC/BvC,GAAO,OAAS,EAAU,0BAA4B,EAAS,gBAAkB,EAAW,YAC5F,IAAI4E,EAAiBH,EAAIrU,OACrBkV,EAAgBnN,EAAG+L,cACvB/L,EAAG+L,cAAgBO,EAAIP,eAAgB,EACvC,IAAIY,EAAOvW,EACX,GAAIuW,EAGF,IAFA,IAAIC,EAAMC,GAAM,EACdC,EAAKH,EAAKrb,OAAS,EACdub,EAAKC,GACVF,EAAOD,EAAKE,GAAM,GACd7M,EAAG7G,KAAKyP,eAAegE,EAAM5M,EAAGhD,MAAMyH,MACxC6H,EAAIna,OAASya,EACbN,EAAI1P,WAAa2N,EAAc,IAAMsC,EAAK,IAC1CP,EAAIzP,cAAgB2N,EAAiB,IAAMqC,EAC3ChF,GAAO,KAAQ7H,EAAGzL,SAAS+X,GAAQ,IACnCA,EAAIrU,OAASwU,GAEb5E,GAAO,QAAU,EAAe,YAE9BgF,IACFhF,GAAO,QAAU,EAAe,gBAAkB,EAAS,KAAO,EAAW,oBAC7E0E,GAAkB,KAEpB1E,GAAO,QAAU,EAAe,KAAO,EAAW,eAAiB,EAAS,WA6BhF,OA1BA7H,EAAG+L,cAAgBO,EAAIP,cAAgBoB,EACvCtF,GAAY,EAAmB,QAAU,EAAW,sBAC5B,IAApB7H,EAAG0L,cACL7D,GAAO,sDAAyE7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kBACtI,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,2DAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,gFACF7H,EAAG+L,eAAiBtB,IAErB5C,GADE7H,EAAGkI,MACE,wCAEA,8CAGXL,GAAO,sBAAwB,EAAU,iCAAmC,EAAU,sBAAwB,EAAU,2BACpH7H,EAAG3C,KAAKqN,YACV7C,GAAO,OAEFA,QAGH0J,IAAI,SAASvgB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA0BiQ,EAAIgK,EAAUC,GACvD,IASEC,EATErC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9BM,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,EAEjB,IAAIob,EAAU7G,EAAU,eAAiBT,EAAe,KAAOlK,EAAG9C,WAAW9G,GAC7EyR,GAAO,QACH8C,IACF9C,GAAO,KAAO,EAAiB,4BAA8B,EAAiB,qBAEhFA,GAAO,KAAO,EAAY,SAAW,EAAU,WAC/C,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,wDAA2E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,0BAE/J3C,GADE8C,EACK,GAAK,EAEL,GAAM3K,EAAG7G,KAAKuG,eAAetJ,GAEtCyR,GAAO,QACkB,IAArB7H,EAAG3C,KAAKsO,WACV9D,GAAO,uCAELA,GADE8C,EACK,OAAU,EAAiB,OAE3B,GAAM3K,EAAG7G,KAAKoN,aAAanQ,GAEpCyR,GAAO,QAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,eAELA,GADE8C,EACK,kBAAoB,EAEpB,GAAM3K,EAAG7G,KAAKuG,eAAetJ,GAEtCyR,GAAO,2CAA8C7H,EAAa,WAAI,YAAc,EAAU,KAEhG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EAeZ,OAdAA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,KACH4C,IACF5C,GAAO,YAEFA,QAGH4J,IAAI,SAASzgB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA6BiQ,EAAIgK,EAAUC,GAC1D,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnB8C,EAAQ,SAAW9C,EACnBmC,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACnBuM,EAAiB,GACrBD,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC3BsH,EAAO,MAAQvH,EACjBmD,EAAO,MAAQnD,EACfoD,EAAWjB,EAAIhC,UAAYtK,EAAGsK,UAAY,EAC1CkD,EAAY,OAASD,EACrBoE,EAAkB,iBAAmBxH,EACnCyH,EAAcpZ,OAAOuM,KAAK3O,OAC5Byb,EAAe7R,EAAG7N,OAAO2f,sBACzBC,EAAiBvZ,OAAOuM,KAAK8M,GAC7BG,EAAehS,EAAG7N,OAAO8f,qBACzBC,EAAkBN,EAAYtgB,QAAUygB,EAAezgB,OACvD6gB,GAAiC,IAAjBH,EAChBI,EAA6C,iBAAhBJ,GAA4BxZ,OAAOuM,KAAKiN,GAAc1gB,OACnF+gB,EAAoBrS,EAAG3C,KAAKiV,iBAC5BC,EAAmBJ,GAAiBC,GAAuBC,EAC3DlD,EAAiBnP,EAAG3C,KAAK+R,cACzB3C,EAAiBzM,EAAG/H,OAClBua,EAAYxS,EAAG7N,OAAOkC,SAC1B,GAAIme,KAAexS,EAAG3C,KAAKoV,KAAMD,EAAUlJ,QAAUkJ,EAAUlhB,OAAS0O,EAAG3C,KAAKqV,aAAc,IAAIC,EAAgB3S,EAAG7G,KAAK8K,OAAOuO,GACjI,GAAIxS,EAAG3C,KAAKuV,cACV,IAAIC,EAAgB7S,EAAG7N,OAAOygB,kBAC5BE,EAAkBta,OAAOuM,KAAK8N,GAMlC,GAJAhL,GAAO,OAAS,EAAU,iBAAmB,EAAe,WACxDsH,IACFtH,GAAO,QAAU,EAAoB,iBAEnC0K,EAAkB,CAMpB,GAJE1K,GADEsH,EACK,IAAM,EAAoB,MAAQ,EAAoB,mBAAqB,EAAU,eAAiB,EAAS,OAAS,EAAS,IAAM,EAAoB,YAAc,EAAS,aAAe,EAAS,MAAQ,EAAoB,IAAM,EAAS,MAErP,aAAe,EAAS,OAAS,EAAU,OAEhD+C,EAAiB,CAEnB,GADArK,GAAO,oBAAsB,EAAS,cAClC+J,EAAYtgB,OACd,GAAIsgB,EAAYtgB,OAAS,EACvBuW,GAAO,sBAAwB,EAAgB,IAAM,EAAS,SACzD,CACL,IAAI8E,EAAOiF,EACX,GAAIjF,EAGF,IAFA,IAAkBoG,GAAM,EACtBjG,EAAKH,EAAKrb,OAAS,EACdyhB,EAAKjG,GACV0C,EAAe7C,EAAKoG,GAAM,GAC1BlL,GAAO,OAAS,EAAS,OAAU7H,EAAG7G,KAAKuG,eAAe8P,GAAiB,IAKnF,GAAIuC,EAAezgB,OAAQ,CACzB,IAAIye,EAAOgC,EACX,GAAIhC,EAGF,IAFA,IAAgBlD,GAAM,EACpBoD,EAAKF,EAAKze,OAAS,EACdub,EAAKoD,GACV+C,GAAajD,EAAKlD,GAAM,GACxBhF,GAAO,OAAU7H,EAAG9C,WAAW8V,IAAe,SAAW,EAAS,KAIxE,GAAIhT,EAAG3C,KAAKuV,eAAiBE,EAAgBxhB,OAAQ,CACnD,IAAI2hB,EAAOH,EACX,GAAIG,EACF,CAAiBpG,GAAM,EAEvB,IAFA,IACEqG,EAAKD,EAAK3hB,OAAS,EACdub,EAAKqG,GACVC,GAAcF,EAAKpG,GAAM,GACzBhF,GAAO,OAAU7H,EAAG9C,WAAWiW,IAAgB,SAAW,EAAS,MAIzEtL,GAAO,uBAAyB,EAAS,OAE3C,GAAyB,OAArBwK,EACFxK,GAAO,WAAa,EAAU,IAAM,EAAS,UACxC,CACL,IAAI0H,EAAoBvP,EAAGlD,UACvBsW,EAAsB,OAAU1B,EAAO,OAI3C,GAHI1R,EAAG3C,KAAKwS,yBACV7P,EAAGlD,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAW4U,EAAM1R,EAAG3C,KAAK4L,eAE7DkJ,EACF,GAAIE,EACFxK,GAAO,WAAa,EAAU,IAAM,EAAS,UACxC,CACLA,GAAO,IAAM,EAAe,aAC5B,IAAIoJ,EAAqBzG,EACzBA,EAAiBxK,EAAGnD,cAAgB,yBAChC4O,GAAaA,QACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,qEAAwF7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,qCAAwC,EAAwB,QACrN,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,wDAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,mDAAsD7H,EAAa,WAAI,YAAc,EAAU,KAExG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,GAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCsC,EAAiByG,EACbxG,IACF5C,GAAO,iBAGN,GAAIuK,EACT,GAAyB,WAArBC,EAAgC,CAClCxK,GAAO,QAAU,EAAU,eAC3B,IAAIsF,EAAgBnN,EAAG+L,cACvB/L,EAAG+L,cAAgBO,EAAIP,eAAgB,EACvCO,EAAIna,OAAS6f,EACb1F,EAAI1P,WAAaoD,EAAGpD,WAAa,wBACjC0P,EAAIzP,cAAgBmD,EAAGnD,cAAgB,wBACvCyP,EAAIxP,UAAYkD,EAAG3C,KAAKwS,uBAAyB7P,EAAGlD,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAW4U,EAAM1R,EAAG3C,KAAK4L,cAChH,IAAIyE,EAAYpE,EAAQ,IAAMoI,EAAO,IACrCpF,EAAI1B,YAAY2C,GAAYmE,EAC5B,IAAI/D,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAExEA,GAAO,SAAW,EAAe,gBAAkB,EAAU,wHAA0H,EAAU,IAAM,EAAS,SAChN7H,EAAG+L,cAAgBO,EAAIP,cAAgBoB,MAClC,CACLb,EAAIna,OAAS6f,EACb1F,EAAI1P,WAAaoD,EAAGpD,WAAa,wBACjC0P,EAAIzP,cAAgBmD,EAAGnD,cAAgB,wBACvCyP,EAAIxP,UAAYkD,EAAG3C,KAAKwS,uBAAyB7P,EAAGlD,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAW4U,EAAM1R,EAAG3C,KAAK4L,cAC5GyE,EAAYpE,EAAQ,IAAMoI,EAAO,IACrCpF,EAAI1B,YAAY2C,GAAYmE,EACxB/D,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAEpE4C,IACF5C,GAAO,SAAW,EAAe,aAIvC7H,EAAGlD,UAAYyS,EAEb2C,IACFrK,GAAO,OAETA,GAAO,OACH4C,IACF5C,GAAO,QAAU,EAAe,OAChC0E,GAAkB,KAGtB,IAAI8G,EAAerT,EAAG3C,KAAKiW,cAAgBtT,EAAG+L,cAC9C,GAAI6F,EAAYtgB,OAAQ,CACtB,IAAIiiB,EAAO3B,EACX,GAAI2B,EAGF,IAFA,IAAI/D,EAAcgE,IAAM,EACtBC,GAAKF,EAAKjiB,OAAS,EACdkiB,GAAKC,IAAI,CACdjE,EAAe+D,EAAKC,IAAM,GAE1B,GAAIxT,EAAG7G,KAAKyP,eADRgE,GAAOxW,EAAQoZ,GACcxP,EAAGhD,MAAMyH,KAAM,CAC9C,IAAIiL,GAAQ1P,EAAG7G,KAAKkN,YAAYmJ,GAE9BkE,IADAhG,EAAYpE,EAAQoG,GACN2D,QAAiC5b,IAAjBmV,GAAK+G,SACrCrH,EAAIna,OAASya,GACbN,EAAI1P,WAAa2N,EAAcmF,GAC/BpD,EAAIzP,cAAgB2N,EAAiB,IAAMxK,EAAG7G,KAAK6K,eAAewL,GAClElD,EAAIxP,UAAYkD,EAAG7G,KAAKgQ,QAAQnJ,EAAGlD,UAAW0S,EAAcxP,EAAG3C,KAAK4L,cACpEqD,EAAI1B,YAAY2C,GAAYvN,EAAG7G,KAAKuG,eAAe8P,GAC/C7B,EAAQ3N,EAAGzL,SAAS+X,GAExB,GADAA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAAG,CAC/CG,EAAQ3N,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAC7C,IAAI+B,GAAW/B,MACV,CACD+B,GAAWjC,EACf3F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAEvD,GAAI6L,GACF7L,GAAO,IAAM,EAAU,QAClB,CACL,GAAI8K,GAAiBA,EAAcnD,GAAe,CAChD3H,GAAO,SAAW,GAAa,kBAC3BsH,IACFtH,GAAO,8CAAgD,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAaiJ,GAAiB,OAEnH3H,GAAO,OAAS,EAAe,aAC3B0H,EAAoBvP,EAAGlD,UACzBmU,EAAqBzG,EADvB,IAEEoF,GAAmB5P,EAAG7G,KAAKoN,aAAaiJ,GACtCxP,EAAG3C,KAAKwS,yBACV7P,EAAGlD,UAAYkD,EAAG7G,KAAKgQ,QAAQoG,EAAmBC,EAAcxP,EAAG3C,KAAK4L,eAE1EuB,EAAiBxK,EAAGnD,cAAgB,aAChC4O,GAAaA,QACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,yDAA4E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kCAAqC,GAAqB,QACnM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gBAELA,GADE7H,EAAG3C,KAAKwS,uBACH,yBAEA,oCAAuC,GAAqB,MAErEhI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAELgE,EAAQhE,EACZA,EAAM4D,GAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCsC,EAAiByG,EACjBjR,EAAGlD,UAAYyS,EACf1H,GAAO,kBAEH4C,GACF5C,GAAO,SAAW,GAAa,kBAC3BsH,IACFtH,GAAO,8CAAgD,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAaiJ,GAAiB,OAEnH3H,GAAO,OAAS,EAAe,uBAE/BA,GAAO,QAAU,GAAa,kBAC1BsH,IACFtH,GAAO,8CAAgD,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAaiJ,GAAiB,OAEnH3H,GAAO,SAGXA,GAAO,IAAM,EAAU,OAGvB4C,IACF5C,GAAO,QAAU,EAAe,OAChC0E,GAAkB,MAK1B,GAAIwF,EAAezgB,OAAQ,CACzB,IAAIsiB,GAAO7B,EACX,GAAI6B,GAGF,IAFA,IAAIZ,GAAYa,IAAM,EACpBC,GAAKF,GAAKtiB,OAAS,EACduiB,GAAKC,IAAI,CACdd,GAAaY,GAAKC,IAAM,GAExB,GAAI7T,EAAG7G,KAAKyP,eADRgE,GAAOiF,EAAamB,IACShT,EAAGhD,MAAMyH,KAAM,CAC9C6H,EAAIna,OAASya,GACbN,EAAI1P,WAAaoD,EAAGpD,WAAa,qBAAuBoD,EAAG7G,KAAKkN,YAAY2M,IAC5E1G,EAAIzP,cAAgBmD,EAAGnD,cAAgB,sBAAwBmD,EAAG7G,KAAK6K,eAAegP,IAEpFnL,GADEsH,EACK,IAAM,EAAoB,MAAQ,EAAoB,mBAAqB,EAAU,eAAiB,EAAS,OAAS,EAAS,IAAM,EAAoB,YAAc,EAAS,aAAe,EAAS,MAAQ,EAAoB,IAAM,EAAS,MAErP,aAAe,EAAS,OAAS,EAAU,OAEpDtH,GAAO,QAAW7H,EAAG9C,WAAW8V,IAAe,SAAW,EAAS,QACnE1G,EAAIxP,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAW4U,EAAM1R,EAAG3C,KAAK4L,cAC5DyE,EAAYpE,EAAQ,IAAMoI,EAAO,IACrCpF,EAAI1B,YAAY2C,GAAYmE,EACxB/D,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAEpE4C,IACF5C,GAAO,SAAW,EAAe,aAEnCA,GAAO,MACH4C,IACF5C,GAAO,SAAW,EAAe,aAEnCA,GAAO,OACH4C,IACF5C,GAAO,QAAU,EAAe,OAChC0E,GAAkB,OAM5B,GAAIvM,EAAG3C,KAAKuV,eAAiBE,EAAgBxhB,OAAQ,CACnD,IAAIyiB,GAAOjB,EACX,GAAIiB,GAGF,IAFA,IAAIZ,GAAaa,IAAM,EACrBC,GAAKF,GAAKziB,OAAS,EACd0iB,GAAKC,IAAI,CAEd,IACErH,GADEsH,GAAYrB,EADhBM,GAAcY,GAAKC,IAAM,IAGzB,GAAIhU,EAAG7G,KAAKyP,eADVgE,GAAOsH,GAAU/hB,OACc6N,EAAGhD,MAAMyH,KAAM,CAC9C6H,EAAIna,OAASya,GACbN,EAAI1P,WAAaoD,EAAGpD,WAAa,iBAAmBoD,EAAG7G,KAAKkN,YAAY8M,IAAe,UACvF7G,EAAIzP,cAAgBmD,EAAGnD,cAAgB,kBAAoBmD,EAAG7G,KAAK6K,eAAemP,IAAe,UACjGtL,GAAO,mBAAqB,EAAS,UAEnCA,GADEsH,EACK,IAAM,EAAoB,MAAQ,EAAoB,mBAAqB,EAAU,eAAiB,EAAS,OAAS,EAAS,IAAM,EAAoB,YAAc,EAAS,aAAe,EAAS,MAAQ,EAAoB,IAAM,EAAS,MAErP,aAAe,EAAS,OAAS,EAAU,OAEpDtH,GAAO,QAAW7H,EAAG9C,WAAWiW,IAAgB,SAAW,EAAS,mBAAqB,EAAS,OAClG7G,EAAIxP,UAAYkD,EAAG7G,KAAK4P,YAAY/I,EAAGlD,UAAW4U,EAAM1R,EAAG3C,KAAK4L,cAC5DyE,EAAYpE,EAAQ,IAAMoI,EAAO,IACrCpF,EAAI1B,YAAY2C,GAAYmE,EACxB/D,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAEpE4C,IACF5C,GAAO,SAAW,EAAe,aAEnCA,GAAO,MACH4C,IACF5C,GAAO,SAAW,EAAe,aAEnCA,GAAO,OACH4C,IACF5C,GAAO,QAAU,EAAe,OAChC0E,GAAkB,KAEpB,IAAI4H,GAASD,GAAU1gB,QACrB4gB,GAASF,GAAU3gB,QACrB,QAAekE,IAAX0c,SAAmC1c,IAAX2c,GAAsB,CAChDvM,GAAO,QAAU,EAAW,YACxBoJ,EAAqBzG,EACzB,QAAe/S,IAAX0c,GAAsB,CACxB,IAAIE,GAASF,GACXG,GAAU,UACVC,GAAc,OAChB1M,GAAO,IAAM,EAAW,iBAAmB,EAAS,OAAS,GAAW,KACxE2C,EAAiBxK,EAAGnD,cAAgB,yBACpCgL,GAAO,UAAY,EAAW,UAC1B4D,GAAaA,QACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,8DAAiF7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,yBAA4B,GAAY,aAAgB,GAAW,eAAmBxK,EAAG7G,KAAKoN,aAAa4M,IAAgB,QACzQ,IAArBnT,EAAG3C,KAAKsO,WACV9D,GAAO,gCAAmC,GAAgB,SAAW,GAAW,iCAAoC7H,EAAG7G,KAAKoN,aAAa4M,IAAgB,QAEvJnT,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAELgE,EAAQhE,EACZA,EAAM4D,GAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,WACQpQ,IAAX2c,KACFvM,GAAO,UAGX,QAAepQ,IAAX2c,GAAsB,CACpBC,GAASD,GACXE,GAAU,UACVC,GAAc,OAChB1M,GAAO,IAAM,EAAW,iBAAmB,EAAS,OAAS,GAAW,KACxE2C,EAAiBxK,EAAGnD,cAAgB,yBACpCgL,GAAO,UAAY,EAAW,SAC9B,IAAI4D,IAAAA,GAAaA,QACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,8DAAiF7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,yBAA4B,GAAY,aAAgB,GAAW,eAAmBxK,EAAG7G,KAAKoN,aAAa4M,IAAgB,QACzQ,IAArBnT,EAAG3C,KAAKsO,WACV9D,GAAO,gCAAmC,GAAgB,SAAW,GAAW,iCAAoC7H,EAAG7G,KAAKoN,aAAa4M,IAAgB,QAEvJnT,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAELgE,EAAQhE,EACZA,EAAM4D,GAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,MAET2C,EAAiByG,EACbxG,IACF5C,GAAO,QAAU,EAAW,OAC5B0E,GAAkB,QAW9B,OAJI9B,IACF5C,GAAO,IAAM,EAAmB,QAAU,EAAU,iBAEtDA,EAAM7H,EAAG7G,KAAKyO,YAAYC,SAItB2M,IAAI,SAASxjB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAgCiQ,EAAIgK,EAAUC,GAC7D,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B4C,EAAQ,SAAW9C,EACnBmC,EAAMtM,EAAG7G,KAAKC,KAAK4G,GAEvBsM,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC/B,GAAIpK,EAAG7G,KAAKyP,eAAexS,EAAS4J,EAAGhD,MAAMyH,KAAM,CACjD6H,EAAIna,OAASiE,EACbkW,EAAI1P,WAAa2N,EACjB+B,EAAIzP,cAAgB2N,EACpB,IAAIkH,EAAO,MAAQvH,EACjBmD,EAAO,MAAQnD,EACf0C,EAAK,IAAM1C,EACXsK,EAAe,OAAU/C,EAAO,OAEhClE,EAAY,QADDlB,EAAIhC,UAAYtK,EAAGsK,UAAY,GAE1CqH,EAAkB,iBAAmBxH,EACrCgF,EAAiBnP,EAAG3C,KAAK+R,cACzB3C,EAAiBzM,EAAG/H,OACtB4P,GAAO,QAAU,EAAU,cACvBsH,IACFtH,GAAO,QAAU,EAAoB,kBAGrCA,GADEsH,EACK,IAAM,EAAoB,MAAQ,EAAoB,mBAAqB,EAAU,eAAiB,EAAS,OAAS,EAAS,IAAM,EAAoB,YAAc,EAAS,aAAe,EAAS,MAAQ,EAAoB,IAAM,EAAS,MAErP,aAAe,EAAS,OAAS,EAAU,OAEpDtH,GAAO,iBAAmB,EAAS,cACnC,IAAI6F,EAAYgE,EACZvE,EAAgBnN,EAAG+L,cACvB/L,EAAG+L,cAAgBO,EAAIP,eAAgB,EACvC,IAAI4B,EAAQ3N,EAAGzL,SAAS+X,GACxBA,EAAIrU,OAASwU,EACTzM,EAAG7G,KAAKqO,cAAcmG,EAAOH,GAAa,EAC5C3F,GAAO,IAAO7H,EAAG7G,KAAKuO,WAAWiG,EAAOH,EAAWE,GAAc,IAEjE7F,GAAO,QAAU,EAAc,MAAQ,EAAc,KAAO,EAAU,IAExE7H,EAAG+L,cAAgBO,EAAIP,cAAgBoB,EACvCtF,GAAO,SAAW,EAAe,gBAAkB,EAAO,aAAe,EAAS,KAAO,EAAO,YAAc,EAAO,iBAAmB,EAAO,oBAAsB,EAAS,sBACtJ,IAApB7H,EAAG0L,cACL7D,GAAO,8DAAiF7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,+BAAkC,EAAiB,QACjM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,iCAAqC,EAAiB,oBAE3D7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,gFACF7H,EAAG+L,eAAiBtB,IAErB5C,GADE7H,EAAGkI,MACE,wCAEA,8CAGPuC,IACF5C,GAAO,YAETA,GAAO,OAMT,OAJI4C,IACF5C,GAAO,SAAmC,EAAU,iBAEtDA,EAAM7H,EAAG7G,KAAKyO,YAAYC,SAItB6M,IAAI,SAAS1jB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAAsBiQ,EAAIgK,EAAUC,GACnD,IAQIzN,EAAQmY,EARR9M,EAAM,IAENwC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QANFhN,EAAGoK,MAQd,GAAe,KAAXhU,GAA6B,MAAXA,EAChB4J,EAAGzD,QACLC,EAASwD,EAAGkI,MACZyM,EAAW,aAEXnY,GAAmC,IAA1BwD,EAAGnE,KAAK1J,OAAOqK,OACxBmY,EAAW,sBAER,CACL,IAAIC,EAAU5U,EAAG/C,WAAW+C,EAAG/H,OAAQ7B,EAAS4J,EAAGzD,QACnD,QAAgB9E,IAAZmd,EAAuB,CACzB,IAAIC,EAAW7U,EAAGrJ,gBAAgBuB,QAAQ8H,EAAG/H,OAAQ7B,GACrD,GAA2B,QAAvB4J,EAAG3C,KAAKyX,YAAuB,CACjC9U,EAAG1C,OAAOiB,MAAMsW,IACZpJ,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,qDAAwE7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,sBAA0BxK,EAAG7G,KAAKoN,aAAanQ,GAAY,QAChM,IAArB4J,EAAG3C,KAAKsO,WACV9D,GAAO,0CAA+C7H,EAAG7G,KAAKoN,aAAanQ,GAAY,MAErF4J,EAAG3C,KAAKuO,UACV/D,GAAO,cAAiB7H,EAAG7G,KAAKuG,eAAetJ,GAAY,mCAAsC4J,EAAa,WAAI,YAAc,EAAU,KAE5I6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAE/BuC,IACF5C,GAAO,sBAEJ,CAAA,GAA2B,UAAvB7H,EAAG3C,KAAKyX,YAMjB,MAAM,IAAI9U,EAAGrJ,gBAAgBqJ,EAAG/H,OAAQ7B,EAASye,GALjD7U,EAAG1C,OAAOqT,KAAKkE,GACXpK,IACF5C,GAAO,uBAKN,GAAI+M,EAAQtV,OAAQ,CACzB,IAAIgN,EAAMtM,EAAG7G,KAAKC,KAAK4G,GACvBsM,EAAIlC,QACJ,IAAIoC,EAAa,QAAUF,EAAIlC,MAC/BkC,EAAIna,OAASyiB,EAAQziB,OACrBma,EAAI1P,WAAa,GACjB0P,EAAIzP,cAAgBzG,EAEpByR,GAAO,IADK7H,EAAGzL,SAAS+X,GAAKpJ,QAAQ,oBAAqB0R,EAAQzjB,MAC3C,IACnBsZ,IACF5C,GAAO,QAAU,EAAe,aAGlCrL,GAA4B,IAAnBoY,EAAQpY,OACjBmY,EAAWC,EAAQzjB,KAGvB,GAAIwjB,EAAU,CACZ,IAAIlJ,GAAAA,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,GAEJA,GADE7H,EAAG3C,KAAKoR,YACH,IAAM,EAAa,eAEnB,IAAM,EAAa,KAE5B5G,GAAO,IAAM,EAAU,qBACH,MAAhB7H,EAAGlD,YACL+K,GAAO,MAAS7H,EAAY,WAE9B,IAGI+U,EADJlN,GAAO,OAFWwC,EAAW,QAAWA,EAAW,GAAM,IAAM,cAEhC,OADPA,EAAWrK,EAAG4K,YAAYP,GAAY,sBACC,gBAG/D,GADAxC,EAAM4D,EAAWK,MACbtP,EAAQ,CACV,IAAKwD,EAAGkI,MAAO,MAAM,IAAIhX,MAAM,0CAC3BuZ,IACF5C,GAAO,QAAU,EAAW,MAE9BA,GAAO,UAAa7H,EAAa,WAAI,IAAM,EAAmB,KAC1DyK,IACF5C,GAAO,IAAM,EAAW,aAE1BA,GAAO,4KACH4C,IACF5C,GAAO,IAAM,EAAW,cAE1BA,GAAO,MACH4C,IACF5C,GAAO,QAAU,EAAW,aAG9BA,GAAO,SAAW,EAAmB,uCAAyC,EAAa,0CAA4C,EAAa,wCAChJ4C,IACF5C,GAAO,YAIb,OAAOA,QAGHmN,IAAI,SAAShkB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA2BiQ,EAAIgK,EAAUC,GACxD,IAAIpC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnBQ,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAE9CqB,IACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,MAKvG,IAAIuF,EAAW,SAAWhG,EAC1B,IAAKQ,EACH,GAAIvU,EAAQ9E,OAAS0O,EAAG3C,KAAKqV,cAAgB1S,EAAG7N,OAAOgC,YAAcqE,OAAOuM,KAAK/E,EAAG7N,OAAOgC,YAAY7C,OAAQ,CAC7G,IAAIkhB,KACA7F,EAAOvW,EACX,GAAIuW,EAGF,IAFA,IAAI0C,EAAW0D,GAAM,EACnBjG,EAAKH,EAAKrb,OAAS,EACdyhB,EAAKjG,GAAI,CACduC,EAAY1C,EAAKoG,GAAM,GACvB,IAAIkC,EAAejV,EAAG7N,OAAOgC,WAAWkb,GAClC4F,GAAgBjV,EAAG7G,KAAKyP,eAAeqM,EAAcjV,EAAGhD,MAAMyH,OAClE+N,EAAUA,EAAUlhB,QAAU+d,SAKhCmD,EAAYpc,EAGpB,GAAIuU,GAAW6H,EAAUlhB,OAAQ,CAC/B,IAAIie,EAAoBvP,EAAGlD,UACzBoY,EAAgBvK,GAAW6H,EAAUlhB,QAAU0O,EAAG3C,KAAKqV,aACvDvD,EAAiBnP,EAAG3C,KAAK+R,cAC3B,GAAI3E,EAEF,GADA5C,GAAO,eAAiB,EAAS,KAC7BqN,EAAe,CACZvK,IACH9C,GAAO,QAAU,EAAa,qBAAuB,EAAgB,MAEvE,IAEE+H,EAAmB,QADnBD,EAAgB,SAAWxF,EAAO,KADhC0C,EAAK,IAAM1C,GACgC,KACA,OAC3CnK,EAAG3C,KAAKwS,yBACV7P,EAAGlD,UAAYkD,EAAG7G,KAAK4P,YAAYwG,EAAmBI,EAAe3P,EAAG3C,KAAK4L,eAE/EpB,GAAO,QAAU,EAAW,YACxB8C,IACF9C,GAAO,cAAgB,EAAS,mBAAqB,EAAW,0CAA4C,EAAS,MAAQ,EAAW,oBAE1IA,GAAO,aAAe,EAAO,SAAW,EAAO,MAAQ,EAAa,YAAc,EAAO,SAAW,EAAW,MAAQ,EAAU,IAAM,EAAa,IAAM,EAAO,oBAC7JsH,IACFtH,GAAO,8CAAgD,EAAU,KAAO,EAAa,IAAM,EAAO,OAEpGA,GAAO,UAAY,EAAW,cAC1B8C,IACF9C,GAAO,SAETA,GAAO,UAAY,EAAW,UAC1B4D,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,yDAA4E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kCAAqC,EAAqB,QACnM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gBAELA,GADE7H,EAAG3C,KAAKwS,uBACH,yBAEA,oCAAuC,EAAqB,MAErEhI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,iBACF,CACLA,GAAO,SACP,IAAIkI,EAAOyC,EACX,GAAIzC,EAGF,IAFA,IAAkBlD,GAAM,EACtBoD,EAAKF,EAAKze,OAAS,EACdub,EAAKoD,GAAI,CACdT,EAAeO,EAAKlD,GAAM,GACtBA,IACFhF,GAAO,QAITA,GAAO,SADL4H,EAAWnG,GADToG,EAAQ1P,EAAG7G,KAAKkN,YAAYmJ,KAEF,kBAC1BL,IACFtH,GAAO,8CAAgD,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAaiJ,GAAiB,OAEnH3H,GAAO,gBAAkB,EAAS,MAAS7H,EAAG7G,KAAKuG,eAAeM,EAAG3C,KAAK4L,aAAeuG,EAAeE,GAAU,OAGtH7H,GAAO,QAEL+H,EAAmB,QADjBD,EAAgB,UAAYxF,GACe,OAC3CnK,EAAG3C,KAAKwS,yBACV7P,EAAGlD,UAAYkD,EAAG3C,KAAK4L,aAAejJ,EAAG7G,KAAK4P,YAAYwG,EAAmBI,GAAe,GAAQJ,EAAoB,MAAQI,GAElI,IAAIlE,GAAAA,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,yDAA4E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kCAAqC,EAAqB,QACnM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gBAELA,GADE7H,EAAG3C,KAAKwS,uBACH,yBAEA,oCAAuC,EAAqB,MAErEhI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAELgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,kBAGT,GAAIqN,EAAe,CACZvK,IACH9C,GAAO,QAAU,EAAa,qBAAuB,EAAgB,MAEvE,IACE8H,EACAC,EAAmB,QADnBD,EAAgB,SAAWxF,EAAO,KADhC0C,EAAK,IAAM1C,GACgC,KACA,OAC3CnK,EAAG3C,KAAKwS,yBACV7P,EAAGlD,UAAYkD,EAAG7G,KAAK4P,YAAYwG,EAAmBI,EAAe3P,EAAG3C,KAAK4L,eAE3E0B,IACF9C,GAAO,QAAU,EAAa,sBAAwB,EAAa,sBAC3C,IAApB7H,EAAG0L,cACL7D,GAAO,yDAA4E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kCAAqC,EAAqB,QACnM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gBAELA,GADE7H,EAAG3C,KAAKwS,uBACH,yBAEA,oCAAuC,EAAqB,MAErEhI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,0FAA4F,EAAa,sBAElHA,GAAO,aAAe,EAAO,SAAW,EAAO,MAAQ,EAAa,YAAc,EAAO,aAAe,EAAU,IAAM,EAAa,IAAM,EAAO,oBAC9IsH,IACFtH,GAAO,8CAAgD,EAAU,KAAO,EAAa,IAAM,EAAO,OAEpGA,GAAO,qBACiB,IAApB7H,EAAG0L,cACL7D,GAAO,yDAA4E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kCAAqC,EAAqB,QACnM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gBAELA,GADE7H,EAAG3C,KAAKwS,uBACH,yBAEA,oCAAuC,EAAqB,MAErEhI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,mFACH8C,IACF9C,GAAO,aAEJ,CACL,IAAIoL,EAAOT,EACX,GAAIS,EAGF,IAFA,IAAIzD,EAAc2F,GAAM,EACtBjC,EAAKD,EAAK3hB,OAAS,EACd6jB,EAAKjC,GAAI,CACd1D,EAAeyD,EAAKkC,GAAM,GAC1B,IAAIzF,EAAQ1P,EAAG7G,KAAKkN,YAAYmJ,GAE9BC,GADAG,EAAmB5P,EAAG7G,KAAKoN,aAAaiJ,GAC7BlG,EAAQoG,GACjB1P,EAAG3C,KAAKwS,yBACV7P,EAAGlD,UAAYkD,EAAG7G,KAAKgQ,QAAQoG,EAAmBC,EAAcxP,EAAG3C,KAAK4L,eAE1EpB,GAAO,SAAW,EAAa,kBAC3BsH,IACFtH,GAAO,8CAAgD,EAAU,MAAU7H,EAAG7G,KAAKoN,aAAaiJ,GAAiB,OAEnH3H,GAAO,qBACiB,IAApB7H,EAAG0L,cACL7D,GAAO,yDAA4E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kCAAqC,EAAqB,QACnM,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,gBAELA,GADE7H,EAAG3C,KAAKwS,uBACH,yBAEA,oCAAuC,EAAqB,MAErEhI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAETA,GAAO,kFAKf7H,EAAGlD,UAAYyS,OACN9E,IACT5C,GAAO,gBAET,OAAOA,QAGHuN,IAAI,SAASpkB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA8BiQ,EAAIgK,EAAUC,GAC3D,IAUEC,EAVErC,EAAM,IACNsC,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAAO6X,GACpBO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UACzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACnBQ,EAAU3K,EAAG3C,KAAKiM,OAASlT,GAAWA,EAAQkT,MAQlD,GANIqB,GACF9C,GAAO,cAAgB,EAAS,MAAS7H,EAAG7G,KAAKkQ,QAAQjT,EAAQkT,MAAOe,EAAUrK,EAAG4K,aAAgB,KACrGV,EAAe,SAAWC,GAE1BD,EAAe9T,GAEZA,GAAWuU,KAAoC,IAAxB3K,EAAG3C,KAAK/I,YAAuB,CACrDqW,IACF9C,GAAO,QAAU,EAAW,SAAW,EAAiB,iBAAmB,EAAiB,mBAAqB,EAAW,4BAA8B,EAAiB,kBAAsB,EAAW,qBAE9MA,GAAO,QAAU,EAAW,gBAAkB,EAAU,0BAA4B,EAAU,kEAAoE,EAAU,QAAU,EAAU,WAAa,EAAW,kCACpN8C,IACF9C,GAAO,SAETA,GAAO,SAAW,EAAW,SAC7B,IAAI4D,EAAaA,MACjBA,EAAWxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,4DAA+E7H,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,8BAC5I,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,mGAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,eAELA,GADE8C,EACK,kBAAoB,EAEpB,GAAK,EAEd9C,GAAO,2CAA8C7H,EAAa,WAAI,YAAc,EAAU,KAEhG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,MACH4C,IACF5C,GAAO,iBAGL4C,IACF5C,GAAO,iBAGX,OAAOA,QAGHwN,IAAI,SAASrkB,EAAQhB,EAAOD,GAClC,aACAC,EAAOD,QAAU,SAA2BiQ,EAAIgK,EAAUC,GAwbxD,SAASqL,EAAgBC,GAEvB,IAAK,IADDhR,EAAQgR,EAAYhR,MACftT,EAAI,EAAGA,EAAIsT,EAAMjT,OAAQL,IAChC,GAAIukB,EAAejR,EAAMtT,IAAK,OAAO,EAGzC,SAASukB,EAAeC,GACtB,YAAoChe,IAA7BuI,EAAG7N,OAAOsjB,EAAMpV,UAA2BoV,EAAMvQ,YAG1D,SAAoCuQ,GAElC,IAAK,IADDC,EAAOD,EAAMvQ,WACRjU,EAAI,EAAGA,EAAIykB,EAAKpkB,OAAQL,IAC/B,QAA2BwG,IAAvBuI,EAAG7N,OAAOujB,EAAKzkB,IAAmB,OAAO,EANuB0kB,CAA2BF,GA9bnG,IAAI5N,EAAM,GACNrL,GAA8B,IAArBwD,EAAG7N,OAAOqK,OACrBoZ,EAAe5V,EAAG7G,KAAK0P,qBAAqB7I,EAAG7N,OAAQ6N,EAAGhD,MAAMyH,IAAK,QACrEoR,EAAM7V,EAAG3P,KAAKmR,OAAOxB,EAAG7N,QAC1B,GAAI6N,EAAGrD,MAAO,CACZ,GAAIH,EAAQ,CACVwD,EAAGkI,OAAQ,EACX,IAAI4N,EAAwB,OAAjB9V,EAAG3C,KAAK6K,MACnBlI,EAAG+V,WAAaD,EAAO,QAAU,QAEnCjO,GAAO,mBACHrL,EACEsZ,EACFjO,GAAO,qBAEc,KAAjB7H,EAAG3C,KAAK6K,QACVL,GAAO,WAETA,GAAO,eAGTA,GAAO,cAETA,GAAO,+EACHgO,IAAQ7V,EAAG3C,KAAKZ,YAAcuD,EAAG3C,KAAKW,eACxC6J,GAAO,kBAA2BgO,EAAM,QAG5C,GAAwB,kBAAb7V,EAAG7N,SAAyByjB,IAAgB5V,EAAG7N,OAAOE,KAAO,CACtE,IACI8X,EAAOnK,EAAGoK,MACVC,EAAWrK,EAAGsK,UACdlU,EAAU4J,EAAG7N,OAHb6X,EAAW,gBAIXO,EAAcvK,EAAGpD,WAAaoD,EAAG7G,KAAKkN,YAAY2D,GAClDQ,EAAiBxK,EAAGnD,cAAgB,IAAMmN,EAC1CS,GAAiBzK,EAAG3C,KAAKqN,UAEzBpB,EAAQ,QAAUe,GAAY,IAC9B2C,EAAS,QAAU7C,EACvB,IAAkB,IAAdnK,EAAG7N,OAAkB,CACnB6N,EAAGrD,MACL8N,GAAgB,EAEhB5C,GAAO,QAAU,EAAW,cAE1B4D,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,gBAAkB,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,kBAC9J,IAArBxK,EAAG3C,KAAKsO,WACV9D,GAAO,0CAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,mDAAsD7H,EAAa,WAAI,YAAc,EAAU,KAExG6H,GAAO,OAEPA,GAAO,OAET,IAAIgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,oFAK/BL,GAFA7H,EAAGrD,MACDH,EACK,iBAEA,yCAGF,QAAU,EAAW,YAMhC,OAHIwD,EAAGrD,QACLkL,GAAO,0BAEFA,EAET,GAAI7H,EAAGrD,MAAO,CACZ,IAAIqZ,EAAOhW,EAAGrD,MACZwN,EAAOnK,EAAGoK,MAAQ,EAClBC,EAAWrK,EAAGsK,UAAY,EAC1BhB,EAAQ,OACVtJ,EAAGiW,OAASjW,EAAGzJ,QAAQ8B,SAAS2H,EAAG3P,KAAKmR,OAAOxB,EAAGnE,KAAK1J,SACvD6N,EAAG/H,OAAS+H,EAAG/H,QAAU+H,EAAGiW,cACrBjW,EAAGrD,MACVqD,EAAG4K,kBAAenT,GAClBoQ,GAAO,wBACPA,GAAO,wBACPA,GAAO,qDACF,CACDsC,EAAOnK,EAAGoK,MAEZd,EAAQ,SADRe,EAAWrK,EAAGsK,YACgB,IAEhC,GADIuL,IAAK7V,EAAG/H,OAAS+H,EAAGzJ,QAAQ4B,IAAI6H,EAAG/H,OAAQ4d,IAC3CrZ,IAAWwD,EAAGkI,MAAO,MAAM,IAAIhX,MAAM,+BACzC2W,GAAO,aAAe,EAAS,aAE7BmF,EAAS,QAAU7C,EACrBM,GAAiBzK,EAAG3C,KAAKqN,UAD3B,IAIIQ,EAFFgL,EAAkB,GAClBC,EAAkB,GAEhBC,EAAcpW,EAAG7N,OAAOmS,KAC1B+R,EAAe9T,MAAMC,QAAQ4T,GAK/B,GAJIC,GAAsC,GAAtBD,EAAY9kB,SAC9B8kB,EAAcA,EAAY,GAC1BC,GAAe,GAEbrW,EAAG7N,OAAOE,MAAQujB,EAAc,CAClC,GAA0B,QAAtB5V,EAAG3C,KAAKiZ,WACV,MAAM,IAAIplB,MAAM,qDAAuD8O,EAAGnD,cAAgB,8BAC1D,IAAvBmD,EAAG3C,KAAKiZ,aACjBV,GAAe,EACf5V,EAAG1C,OAAOqT,KAAK,6CAA+C3Q,EAAGnD,cAAgB,MAGrF,GAAIuZ,EAAa,CACf,GAAIpW,EAAG3C,KAAKkZ,YACV,IAAIC,EAAiBxW,EAAG7G,KAAKkO,cAAcrH,EAAG3C,KAAKkZ,YAAaH,GAElE,IAAIb,EAAcvV,EAAGhD,MAAM0H,MAAM0R,GACjC,GAAII,GAAkBH,IAAgC,IAAhBd,GAAyBA,IAAgBD,EAAgBC,GAAe,CACxGhL,EAAcvK,EAAGpD,WAAa,QAChC4N,EAAiBxK,EAAGnD,cAAgB,QAClC0N,EAAcvK,EAAGpD,WAAa,QAChC4N,EAAiBxK,EAAGnD,cAAgB,QAGtC,GADAgL,GAAO,QAAW7H,EAAG7G,KADTkd,EAAe,iBAAmB,iBACXD,EAAa9M,GAAO,GAAS,OAC5DkN,EAAgB,CAClB,IAAIC,EAAY,WAAatM,EAC3BuM,EAAW,UAAYvM,EACzBtC,GAAO,QAAU,EAAc,aAAe,EAAU,KAC7B,SAAvB7H,EAAG3C,KAAKkZ,cACV1O,GAAO,QAAU,EAAc,iCAAqC,EAAU,MAAQ,EAAc,gBAEtGA,GAAO,QAAU,EAAa,iBAC9B,IAAI8O,EAAkB,GAClBhK,EAAO6J,EACX,GAAI7J,EAGF,IAFA,IAAIiK,EAAO/J,GAAM,EACfC,EAAKH,EAAKrb,OAAS,EACdub,EAAKC,GACV8J,EAAQjK,EAAKE,GAAM,GACfA,IACFhF,GAAO,QAAU,EAAa,qBAC9B8O,GAAmB,KAEM,SAAvB3W,EAAG3C,KAAKkZ,aAAmC,SAATK,IACpC/O,GAAO,QAAU,EAAc,kBAAsB,EAAU,mBAAqB,EAAa,MAAQ,EAAU,MAAQ,EAAU,QAAU,EAAc,aAAe,EAAU,SAE3K,UAAT+O,EACF/O,GAAO,QAAU,EAAc,mBAAuB,EAAc,kBAAsB,EAAa,WAAe,EAAU,cAAgB,EAAU,cAAgB,EAAa,UACrK,UAAT+O,GAA8B,WAATA,GAC9B/O,GAAO,QAAU,EAAc,oBAAwB,EAAU,iBAAmB,EAAc,mBAAuB,EAAU,OAAS,EAAU,QAAU,EAAU,IAC7J,WAAT+O,IACF/O,GAAO,SAAW,EAAU,SAE9BA,GAAO,MAAQ,EAAa,OAAS,EAAU,MAC7B,WAAT+O,EACT/O,GAAO,QAAU,EAAU,mBAAuB,EAAU,aAAe,EAAU,cAAgB,EAAa,sBAAwB,EAAU,kBAAsB,EAAU,WAAa,EAAa,YAC5L,QAAT+O,EACT/O,GAAO,QAAU,EAAU,cAAkB,EAAU,aAAe,EAAU,eAAiB,EAAa,YAC9E,SAAvB7H,EAAG3C,KAAKkZ,aAAmC,SAATK,IAC3C/O,GAAO,QAAU,EAAc,mBAAuB,EAAc,mBAAuB,EAAc,oBAAwB,EAAU,aAAe,EAAa,OAAS,EAAU,OAIhMA,GAAO,IAAM,EAAoB,QAAU,EAAa,wBACpD4D,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,QAAU,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,uBAE7K3C,GADEwO,EACK,GAAMD,EAAYtG,KAAK,KAEvB,GAAK,EAEdjI,GAAO,QACkB,IAArB7H,EAAG3C,KAAKsO,WACV9D,GAAO,0BAELA,GADEwO,EACK,GAAMD,EAAYtG,KAAK,KAEvB,GAAK,EAEdjI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAELgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,cACP,IAAI6G,EAAcrE,EAAW,QAAWA,EAAW,GAAM,IAAM,aAE/DxC,GAAO,IAAM,EAAU,MAAQ,EAAa,KACvCwC,IACHxC,GAAO,OAAS,EAAgB,mBAElCA,GAAO,IAAM,EAAgB,KALLwC,EAAWrK,EAAG4K,YAAYP,GAAY,sBAKH,OAAS,EAAa,WAC5E,EACDoB,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,QAAU,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,uBAE7K3C,GADEwO,EACK,GAAMD,EAAYtG,KAAK,KAEvB,GAAK,EAEdjI,GAAO,QACkB,IAArB7H,EAAG3C,KAAKsO,WACV9D,GAAO,0BAELA,GADEwO,EACK,GAAMD,EAAYtG,KAAK,KAEvB,GAAK,EAEdjI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAELgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAGrCL,GAAO,OAGX,GAAI7H,EAAG7N,OAAOE,OAASujB,EACrB/N,GAAO,IAAO7H,EAAGhD,MAAMyH,IAAIpS,KAAKlB,KAAK6O,EAAI,QAAW,IAChDyK,IACF5C,GAAO,qBAELA,GADEmO,EACK,IAEA,QAAU,EAEnBnO,GAAO,OACPsO,GAAmB,SAEhB,CACDnW,EAAG3C,KAAKoV,IAAMzS,EAAG7N,OAAOygB,eAC1B5S,EAAG1C,OAAOqT,KAAK,iGAEjB,IAAIZ,EAAO/P,EAAGhD,MACd,GAAI+S,EAGF,IAFA,IAAiBC,GAAM,EACrBC,EAAKF,EAAKze,OAAS,EACd0e,EAAKC,GAEV,GADAsF,EAAcxF,EAAKC,GAAM,GACrBsF,EAAgBC,GAAc,CAIhC,GAHIA,EAAYjR,OACduD,GAAO,QAAW7H,EAAG7G,KAAK0M,cAAc0P,EAAYjR,KAAMgF,GAAU,QAElEtJ,EAAG3C,KAAKiW,cAAgBtT,EAAG+L,cAC7B,GAAwB,UAApBwJ,EAAYjR,MAAoBtE,EAAG7N,OAAOgC,WAAY,CACpDiC,EAAU4J,EAAG7N,OAAOgC,WAAxB,IAEI8e,EADYza,OAAOuM,KAAK3O,GAE5B,GAAI6c,EAGF,IAFA,IAAIzD,EAAc2F,GAAM,EACtBjC,EAAKD,EAAK3hB,OAAS,EACd6jB,EAAKjC,GAAI,CAGd,QAAqBzb,KADjBmV,EAAOxW,EADXoZ,EAAeyD,EAAKkC,GAAM,KAEjBxB,QAAuB,CAE9B9L,GAAO,UADH6F,EAAYpE,EAAQtJ,EAAG7G,KAAKkN,YAAYmJ,IACZ,mBAAqB,EAAc,MAEjE3H,GADyB,UAAvB7H,EAAG3C,KAAKiW,YACH,IAAOtT,EAAG7C,WAAWyP,EAAK+G,SAAY,IAEtC,IAAOhiB,KAAKE,UAAU+a,EAAK+G,SAAY,IAEhD9L,GAAO,YAIR,GAAwB,SAApB0N,EAAYjR,MAAmB/B,MAAMC,QAAQxC,EAAG7N,OAAOmB,OAAQ,CACxE,IAAIigB,EAAOvT,EAAG7N,OAAOmB,MACrB,GAAIigB,EACF,CAAU1G,GAAM,EAEhB,IAFA,IAAID,EACF6G,EAAKF,EAAKjiB,OAAS,EACdub,EAAK4G,GAEV,QAAqBhc,KADrBmV,EAAO2G,EAAK1G,GAAM,IACT8G,QAAuB,CAC9B,IAAIjG,EACJ7F,GAAO,UADH6F,EAAYpE,EAAQ,IAAMuD,EAAK,KACH,mBAAqB,EAAc,MAEjEhF,GADyB,UAAvB7H,EAAG3C,KAAKiW,YACH,IAAOtT,EAAG7C,WAAWyP,EAAK+G,SAAY,IAEtC,IAAOhiB,KAAKE,UAAU+a,EAAK+G,SAAY,IAEhD9L,GAAO,OAMjB,IAAI+L,EAAO2B,EAAYhR,MACvB,GAAIqP,EAGF,IAFA,IAAI6B,EAAO5B,GAAM,EACfC,EAAKF,EAAKtiB,OAAS,EACduiB,EAAKC,GAEV,GADA2B,EAAQ7B,EAAKC,GAAM,GACf2B,EAAeC,GAAQ,CACzB,IAAI9H,EAAQ8H,EAAMtkB,KAAK6O,EAAIyV,EAAMpV,QAASkV,EAAYjR,MAClDqJ,IACF9F,GAAO,IAAM,EAAU,IACnB4C,IACFyL,GAAmB,MAU7B,GAJIzL,IACF5C,GAAO,IAAM,EAAoB,IACjCqO,EAAkB,IAEhBX,EAAYjR,OACduD,GAAO,MACHuO,GAAeA,IAAgBb,EAAYjR,OAASkS,GAAgB,CACtE3O,GAAO,WACP,IAEI4D,EAFAlB,EAAcvK,EAAGpD,WAAa,QAChC4N,EAAiBxK,EAAGnD,cAAgB,SAClC4O,EAAaA,OACNxG,KAAK4C,GAChBA,EAAM,IACkB,IAApB7H,EAAG0L,cACL7D,GAAO,iBAAoBqD,GAAiB,QAAU,oCAA0ClL,EAAY,UAAI,kBAAqBA,EAAG7G,KAAKuG,eAAe8K,GAAmB,uBAE7K3C,GADEwO,EACK,GAAMD,EAAYtG,KAAK,KAEvB,GAAK,EAEdjI,GAAO,QACkB,IAArB7H,EAAG3C,KAAKsO,WACV9D,GAAO,0BAELA,GADEwO,EACK,GAAMD,EAAYtG,KAAK,KAEvB,GAAK,EAEdjI,GAAO,MAEL7H,EAAG3C,KAAKuO,UACV/D,GAAO,6BAA+B,EAAgB,mCAAsC7H,EAAa,WAAI,YAAc,EAAU,KAEvI6H,GAAO,OAEPA,GAAO,OAELgE,EAAQhE,EACZA,EAAM4D,EAAWK,MAGbjE,IAFC7H,EAAG+L,eAAiBtB,EACnBzK,EAAGkI,MACE,+BAAiC,EAAU,OAE3C,uBAAyB,EAAU,oBAGrC,cAAgB,EAAU,+EAEnCL,GAAO,MAGP4C,IACF5C,GAAO,mBAELA,GADEmO,EACK,IAEA,QAAU,EAEnBnO,GAAO,OACPsO,GAAmB,MAyC7B,OAnCI1L,IACF5C,GAAO,IAAM,EAAoB,KAE/BmO,GACExZ,GACFqL,GAAO,6CACPA,GAAO,+CAEPA,GAAO,+BACPA,GAAO,gCAETA,GAAO,yBAEPA,GAAO,QAAU,EAAW,sBAAwB,EAAS,IAE/DA,EAAM7H,EAAG7G,KAAKyO,YAAYC,GACtBmO,IACFnO,EAAM7H,EAAG7G,KAAK8O,iBAAiBJ,EAAKrL,IAkB/BqL,QAGHgP,IAAI,SAAS7lB,EAAQhB,EAAOD,GAClC,aAEA,IAAIuW,EAAa,yBACbvI,EAAiB/M,EAAQ,kBAE7BhB,EAAOD,SACL+mB,IAYF,SAAoBzW,EAASH,GA8C3B,SAAS6W,EAAS1W,EAASyF,EAAU5F,GAEnC,IAAK,IADD8W,EACK/lB,EAAE,EAAGA,EAAE+L,EAAM1L,OAAQL,IAAK,CACjC,IAAIgmB,EAAKja,EAAM/L,GACf,GAAIgmB,EAAG3S,MAAQwB,EAAU,CACvBkR,EAAYC,EACZ,OAICD,GAEHha,EAAMiI,KADN+R,GAAc1S,KAAMwB,EAAUvB,WAIhC,IAAIzE,GACFO,QAASA,EACTH,WAAYA,EACZkF,QAAQ,EACRjU,KAAM4M,EACNmH,WAAYhF,EAAWgF,YAEzB8R,EAAUzS,MAAMU,KAAKnF,GACrB9C,EAAMoI,OAAO/E,GAAWP,EAI1B,SAAS+F,EAAcC,GACrB,IAAK9I,EAAM0H,MAAMoB,GAAW,MAAM,IAAI5U,MAAM,gBAAkB4U,GAvEhE,IAAI9I,EAAQ1M,KAAK0M,MAEjB,GAAIA,EAAM/K,SAASoO,GACjB,MAAM,IAAInP,MAAM,WAAamP,EAAU,uBAEzC,IAAKiG,EAAWpM,KAAKmG,GACnB,MAAM,IAAInP,MAAM,WAAamP,EAAU,8BAEzC,GAAIH,EAAY,CACd,GAAIA,EAAWE,YAA8B3I,IAArByI,EAAW4O,MACjC,MAAM,IAAI5d,MAAM,qDAElB,IAAI4U,EAAW5F,EAAWoE,KAC1B,GAAI/B,MAAMC,QAAQsD,GAAW,CAC3B,IAAI7U,EAAGwU,EAAMK,EAASxU,OACtB,IAAKL,EAAE,EAAGA,EAAEwU,EAAKxU,IAAK4U,EAAcC,EAAS7U,IAC7C,IAAKA,EAAE,EAAGA,EAAEwU,EAAKxU,IAAK8lB,EAAS1W,EAASyF,EAAS7U,GAAIiP,QAEjD4F,GAAUD,EAAcC,GAC5BiR,EAAS1W,EAASyF,EAAU5F,GAG9B,IAAIoJ,GAA6B,IAArBpJ,EAAWoJ,OAAkBhZ,KAAK+G,MAAMiS,MACpD,GAAIA,IAAUpJ,EAAW3L,SACvB,MAAM,IAAIrD,MAAM,qDAElB,IAAIO,EAAayO,EAAWzO,WACxBA,IACE6X,IACF7X,GACEW,OACEX,GACEY,KAAQ,oFAIhB6N,EAAWD,eAAiB3P,KAAKsL,QAAQnK,GAAY,IAsCzD,OAlCAuL,EAAM/K,SAASoO,GAAWrD,EAAMyH,IAAIpE,IAAW,EAkCxC/P,MAxFPsC,IAkGF,SAAoByN,GAElB,IAAIP,EAAOxP,KAAK0M,MAAMoI,OAAO/E,GAC7B,OAAOP,EAAOA,EAAKI,WAAa5P,KAAK0M,MAAM/K,SAASoO,KAAY,GApGhE6W,OA8GF,SAAuB7W,GAErB,IAAIrD,EAAQ1M,KAAK0M,aACVA,EAAM/K,SAASoO,UACfrD,EAAMyH,IAAIpE,UACVrD,EAAMoI,OAAO/E,GACpB,IAAK,IAAIpP,EAAE,EAAGA,EAAE+L,EAAM1L,OAAQL,IAE5B,IAAK,IADDsT,EAAQvH,EAAM/L,GAAGsT,MACZzS,EAAE,EAAGA,EAAEyS,EAAMjT,OAAQQ,IAC5B,GAAIyS,EAAMzS,GAAGuO,SAAWA,EAAS,CAC/BkE,EAAM3D,OAAO9O,EAAG,GAChB,MAIN,OAAOxB,SAGN6mB,iBAAiB,KAAKC,IAAI,SAASpmB,EAAQhB,EAAOD,GACrD,aAEA,IAAIsnB,EAAiB,yCAErBrnB,EAAOD,QAAU,SAAU8I,GACzB,IAAIye,EAAcze,EAAIxB,MAAMigB,YACxBC,EAAsC,iBAAfD,GACHjlB,KAAMilB,GACRze,EAAIxC,UAAUghB,IACVhlB,KAAMglB,MAGhCxe,EAAI2e,WAAW,iBAEb/lB,YACE6S,KAAM,SACN2N,sBACE3N,KAAM,SACNjQ,UAAY,UACZF,YACEZ,SACE+Q,KAAM,UACN9Q,QAAS,GAEXA,SACE8Q,KAAM,UACN9Q,QAAS,GAEXrB,OAAQolB,GAEVtF,sBAAsB,MAI5BpZ,EAAImE,MAAMyH,IAAItQ,WAAW+Q,WAAWD,KAAK,uBAGrCwS,IAAI,SAASzmB,EAAQhB,EAAOD,GAClCC,EAAOD,SACHqG,QAAW,0CACXyf,IAAO,gFACP6B,YAAe,mEACfpT,KAAQ,SACRjQ,UAAc,SACdF,YACImV,OACIhF,KAAQ,SACRlS,QACMiB,OAAU,0BACVA,OAAU,mBAIxB4e,sBAAwB,QAGtB0F,IAAI,SAAS3mB,EAAQhB,EAAOD,GAClCC,EAAOD,SACHqG,QAAW,0CACXyf,IAAO,0CACP+B,MAAS,0BACTC,aACIC,aACIxT,KAAQ,QACR5Q,SAAY,EACZJ,OAAWjB,KAAQ,MAEvB0lB,oBACIzT,KAAQ,UACR9Q,QAAW,GAEfwkB,4BACIhlB,QACMX,KAAQ,qCACRshB,QAAW,KAGrBsE,aACI7kB,MACI,QACA,UACA,UACA,OACA,SACA,SACA,WAGR8kB,aACI5T,KAAQ,QACRhR,OAAWgR,KAAQ,UACnBhQ,aAAe,EACfqf,aAGRrP,MAAS,SAAU,WACnBnQ,YACI0hB,KACIvR,KAAQ,SACRjR,OAAU,iBAEd+C,SACIkO,KAAQ,SACRjR,OAAU,OAEdhB,MACIiS,KAAQ,SACRjR,OAAU,iBAEdukB,OACItT,KAAQ,UAEZoT,aACIpT,KAAQ,UAEZqP,WACAwE,UACI7T,KAAQ,QACRhR,UAEJS,YACIuQ,KAAQ,SACR8T,iBAAoB,GAExB7kB,SACI+Q,KAAQ,UAEZ+T,kBACI/T,KAAQ,UAEZ9Q,SACI8Q,KAAQ,UAEZ8T,kBACI9T,KAAQ,UAEZ3Q,WAAetB,KAAQ,oCACvBuB,WAAevB,KAAQ,4CACvB6B,SACIoQ,KAAQ,SACRjR,OAAU,SAEd2d,iBAAqB3e,KAAQ,KAC7BiB,OACIlB,QACMC,KAAQ,MACRA,KAAQ,8BAEdshB,YAEJlgB,UAAcpB,KAAQ,oCACtBqB,UAAcrB,KAAQ,4CACtBiC,aACIgQ,KAAQ,UACRqP,SAAW,GAEfzgB,UAAcb,KAAQ,KACtBwB,eAAmBxB,KAAQ,oCAC3ByB,eAAmBzB,KAAQ,4CAC3BgC,UAAchC,KAAQ,6BACtB4f,sBAA0B5f,KAAQ,KAClCwlB,aACIvT,KAAQ,SACR2N,sBAA0B5f,KAAQ,KAClCshB,YAEJxf,YACImQ,KAAQ,SACR2N,sBAA0B5f,KAAQ,KAClCshB,YAEJ7B,mBACIxN,KAAQ,SACR2N,sBAA0B5f,KAAQ,KAClCshB,YAEJxgB,cACImR,KAAQ,SACR2N,sBACI7f,QACMC,KAAQ,MACRA,KAAQ,gCAItB+B,eAAmB/B,KAAQ,KAC3BY,SACAG,MACIkR,KAAQ,QACR5Q,SAAY,EACZY,aAAe,GAEnBgQ,MACIlS,QACMC,KAAQ,8BAENiS,KAAQ,QACRhR,OAAWjB,KAAQ,6BACnBqB,SAAY,EACZY,aAAe,KAI3BjB,QAAYiR,KAAQ,UACpBtR,OAAWX,KAAQ,6BACnBD,OAAWC,KAAQ,6BACnB4B,OAAW5B,KAAQ,6BACnB2B,KAAS3B,KAAQ,MAErBshB,iBAGE2E,IAAI,SAAStnB,EAAQhB,EAAOD,GA2ClC,SAASoO,EAAGoa,GACV,IAAIC,EAAMloB,KACNmoB,EAAO3W,EAAMzQ,KAAK8K,UAAW,GAKjC,OAAO,IAAI7F,QAAQ,SAASC,EAASmiB,GAYnC,SAASC,EAAYxX,GACnB,IAAIyX,EACJ,IACEA,EAAML,EAAIM,KAAK1X,GACf,MAAO3Q,GACP,OAAOkoB,EAAOloB,GAEhBqoB,EAAKD,GASP,SAASE,EAAWC,GAClB,IAAIH,EACJ,IACEA,EAAML,EAAIS,MAAMD,GAChB,MAAOvoB,GACP,OAAOkoB,EAAOloB,GAEhBqoB,EAAKD,GAYP,SAASC,EAAKD,GACZ,GAAIA,EAAIK,KAAM,OAAO1iB,EAAQqiB,EAAIjmB,OACjC,IAAIA,EAAQumB,EAAU7nB,KAAKmnB,EAAKI,EAAIjmB,OACpC,OAAIA,GAASwmB,EAAUxmB,GAAeA,EAAM4E,KAAKohB,EAAaG,GACvDA,EAAW,IAAIM,UAAU,8GACeC,OAAOT,EAAIjmB,OAAS,MAlDrE,GADmB,mBAAR4lB,IAAoBA,EAAMA,EAAIrc,MAAMsc,EAAKC,KAC/CF,GAA2B,mBAAbA,EAAIM,KAAqB,OAAOtiB,EAAQgiB,GAE3DI,MA6DJ,SAASO,EAAU3T,GACjB,OAAKA,EACD4T,EAAU5T,GAAaA,EAuG7B,SAA6BA,GAC3B,IAAI7M,EAAc6M,EAAI7M,YACtB,QAAKA,IACD,sBAAwBA,EAAY4gB,MAAQ,sBAAwB5gB,EAAY6gB,aAC7EC,EAAY9gB,EAAYjG,YA1G3BgnB,CAAoBlU,IAAQiU,EAAYjU,GAAapH,EAAG9M,KAAKf,KAAMiV,GACnE,mBAAqBA,EAc3B,SAAwBmU,GACtB,IAAIlB,EAAMloB,KACV,OAAO,IAAIgG,QAAQ,SAAUC,EAASmiB,GACpCgB,EAAGroB,KAAKmnB,EAAK,SAAUO,EAAK5X,GAC1B,GAAI4X,EAAK,OAAOL,EAAOK,GACnB5c,UAAU7K,OAAS,IAAG6P,EAAMW,EAAMzQ,KAAK8K,UAAW,IACtD5F,EAAQ4K,QApBwC9P,KAAKf,KAAMiV,GAC3DhD,MAAMC,QAAQ+C,GAiCpB,SAAwBA,GACtB,OAAOjP,QAAQmO,IAAIc,EAAIV,IAAIqU,EAAW5oB,QAlCQe,KAAKf,KAAMiV,GAmH3D,SAAkBoU,GAChB,OAAOnhB,QAAUmhB,EAAIjhB,YAnHjBkhB,CAASrU,GA6Cf,SAAyBA,GAIvB,IAAK,IAHDsU,EAAU,IAAItU,EAAI7M,YAClBqM,EAAOvM,OAAOuM,KAAKQ,GACnBuU,KACK7oB,EAAI,EAAGA,EAAI8T,EAAKzT,OAAQL,IAAK,CACpC,IAAIiB,EAAM6S,EAAK9T,GACX8oB,EAAUb,EAAU7nB,KAAKf,KAAMiV,EAAIrT,IACnC6nB,GAAWZ,EAAUY,GAO3B,SAAeA,EAAS7nB,GAEtB2nB,EAAQ3nB,QAAOuF,EACfqiB,EAAS7U,KAAK8U,EAAQxiB,KAAK,SAAU4J,GACnC0Y,EAAQ3nB,GAAOiP,KAXkB6Y,CAAMD,EAAS7nB,GAC7C2nB,EAAQ3nB,GAAOqT,EAAIrT,GAE1B,OAAOoE,QAAQmO,IAAIqV,GAAUviB,KAAK,WAChC,OAAOsiB,KAxDiCxoB,KAAKf,KAAMiV,GAC9CA,EANUA,EAiFnB,SAAS4T,EAAU5T,GACjB,MAAO,mBAAqBA,EAAIhO,KAWlC,SAASiiB,EAAYjU,GACnB,MAAO,mBAAqBA,EAAIsT,MAAQ,mBAAqBtT,EAAIyT,MA5MnE,IAAIlX,EAAQS,MAAM9P,UAAUqP,MAM5B9R,EAAOD,QAAUoO,EAAY,QAAIA,EAAGA,GAAKA,EAczCA,EAAG8b,KAAO,SAAUP,GAGlB,SAASQ,IACP,OAAO/b,EAAG9M,KAAKf,KAAMopB,EAAGxd,MAAM5L,KAAM6L,YAFtC,OADA+d,EAAcC,sBAAwBT,EAC/BQ,QAmNHE,IAAI,SAASppB,EAAQhB,EAAOD,GAClC,aAEAC,EAAOD,QAAU,SAASqO,EAAMrN,EAAG2V,GACjC,GAAI3V,IAAM2V,EAAG,OAAO,EAEpB,IAEIzV,EAFAopB,EAAO9X,MAAMC,QAAQzR,GACrBupB,EAAO/X,MAAMC,QAAQkE,GAGzB,GAAI2T,GAAQC,EAAM,CAChB,GAAIvpB,EAAEO,QAAUoV,EAAEpV,OAAQ,OAAO,EACjC,IAAKL,EAAI,EAAGA,EAAIF,EAAEO,OAAQL,IACxB,IAAKmN,EAAMrN,EAAEE,GAAIyV,EAAEzV,IAAK,OAAO,EACjC,OAAO,EAGT,GAAIopB,GAAQC,EAAM,OAAO,EAEzB,GAAIvpB,GAAK2V,GAAkB,iBAAN3V,GAA+B,iBAAN2V,EAAgB,CAC5D,IAAI3B,EAAOvM,OAAOuM,KAAKhU,GACvB,GAAIgU,EAAKzT,SAAWkH,OAAOuM,KAAK2B,GAAGpV,OAAQ,OAAO,EAElD,IAAIipB,EAAQxpB,aAAaypB,KACrBC,EAAQ/T,aAAa8T,KACzB,GAAID,GAASE,EAAO,OAAO1pB,EAAE2pB,WAAahU,EAAEgU,UAC5C,GAAIH,GAASE,EAAO,OAAO,EAE3B,IAAIE,EAAU5pB,aAAaoJ,OACvBygB,EAAUlU,aAAavM,OAC3B,GAAIwgB,GAAWC,EAAS,OAAO7pB,EAAE8pB,YAAcnU,EAAEmU,WACjD,GAAIF,GAAWC,EAAS,OAAO,EAE/B,IAAK3pB,EAAI,EAAGA,EAAI8T,EAAKzT,OAAQL,IAC3B,IAAKuH,OAAO/F,UAAUqoB,eAAezpB,KAAKqV,EAAG3B,EAAK9T,IAAK,OAAO,EAEhE,IAAKA,EAAI,EAAGA,EAAI8T,EAAKzT,OAAQL,IAC3B,IAAImN,EAAMrN,EAAEgU,EAAK9T,IAAKyV,EAAE3B,EAAK9T,KAAM,OAAO,EAE5C,OAAO,EAGT,OAAO,QAGH8pB,IAAI,SAAS/pB,EAAQhB,EAAOD,GAClC,aAEAC,EAAOD,QAAU,SAAUgW,EAAM1I,GACxBA,IAAMA,MACS,mBAATA,IAAqBA,GAAS2d,IAAK3d,IAC9C,IAAI4d,EAAiC,kBAAhB5d,EAAK4d,QAAwB5d,EAAK4d,OAEnDD,EAAM3d,EAAK2d,KAAO,SAAWlrB,GAC7B,OAAO,SAAUorB,GACb,OAAO,SAAUnqB,EAAG2V,GAGhB,OAAO5W,GAFMoC,IAAKnB,EAAG4B,MAAOuoB,EAAKnqB,KACpBmB,IAAKwU,EAAG/T,MAAOuoB,EAAKxU,OAJvB,CAQnBrJ,EAAK2d,KAEJG,KACJ,OAAO,SAAUtpB,EAAWqpB,GAKxB,GAJIA,GAAQA,EAAKE,QAAiC,mBAAhBF,EAAKE,SACnCF,EAAOA,EAAKE,eAGH3jB,IAATyjB,EAAJ,CACA,GAAmB,iBAARA,EAAkB,OAAOG,SAASH,GAAQ,GAAKA,EAAO,OACjE,GAAoB,iBAATA,EAAmB,OAAOvpB,KAAKE,UAAUqpB,GAEpD,IAAIjqB,EAAG4W,EACP,GAAItF,MAAMC,QAAQ0Y,GAAO,CAErB,IADArT,EAAM,IACD5W,EAAI,EAAGA,EAAIiqB,EAAK5pB,OAAQL,IACrBA,IAAG4W,GAAO,KACdA,GAAOhW,EAAUqpB,EAAKjqB,KAAO,OAEjC,OAAO4W,EAAM,IAGjB,GAAa,OAATqT,EAAe,MAAO,OAE1B,IAA4B,IAAxBC,EAAKvK,QAAQsK,GAAc,CAC3B,GAAID,EAAQ,OAAOtpB,KAAKE,UAAU,aAClC,MAAM,IAAIunB,UAAU,yCAGxB,IAAIkC,EAAYH,EAAKlW,KAAKiW,GAAQ,EAC9BnW,EAAOvM,OAAOuM,KAAKmW,GAAMK,KAAKP,GAAOA,EAAIE,IAE7C,IADArT,EAAM,GACD5W,EAAI,EAAGA,EAAI8T,EAAKzT,OAAQL,IAAK,CAC9B,IAAIiB,EAAM6S,EAAK9T,GACX0B,EAAQd,EAAUqpB,EAAKhpB,IAEtBS,IACDkV,IAAKA,GAAO,KAChBA,GAAOlW,KAAKE,UAAUK,GAAO,IAAMS,GAGvC,OADAwoB,EAAKva,OAAO0a,EAAW,GAChB,IAAMzT,EAAM,KAtChB,CAuCJ9B,SAGDyV,IAAI,SAASxqB,EAAQhB,EAAOD,GAClC,aAuDA,SAAS0rB,EAAUpe,EAAMqe,EAAIvpB,EAAQwR,EAASC,EAAYC,EAAeC,EAAe/D,EAAcgE,GACpG,GAAI5R,GAA2B,iBAAVA,IAAuBoQ,MAAMC,QAAQrQ,GAAS,CACjEupB,EAAGvpB,EAAQwR,EAASC,EAAYC,EAAeC,EAAe/D,EAAcgE,GAC5E,IAAK,IAAI7R,KAAOC,EAAQ,CACtB,IAAIgE,EAAMhE,EAAOD,GACjB,GAAIqQ,MAAMC,QAAQrM,IAChB,GAAIjE,KAAOkR,EAASuY,cAClB,IAAK,IAAI1qB,EAAE,EAAGA,EAAEkF,EAAI7E,OAAQL,IAC1BwqB,EAAUpe,EAAMqe,EAAIvlB,EAAIlF,GAAI0S,EAAU,IAAMzR,EAAM,IAAMjB,EAAG2S,EAAYD,EAASzR,EAAKC,EAAQlB,QAE5F,GAAIiB,KAAOkR,EAASwY,eACzB,GAAIzlB,GAAqB,iBAAPA,EAChB,IAAK,IAAIiT,KAAQjT,EACfslB,EAAUpe,EAAMqe,EAAIvlB,EAAIiT,GAAOzF,EAAU,IAAMzR,EAAM,IAUjE,SAAuBoH,GACrB,OAAOA,EAAI4J,QAAQ,KAAM,MAAMA,QAAQ,MAAO,MAXuB2Y,CAAczS,GAAOxF,EAAYD,EAASzR,EAAKC,EAAQiX,QAE7GlX,KAAOkR,EAASnR,UAAaoL,EAAKqG,WAAaxR,KAAOkR,EAAS0Y,gBACxEL,EAAUpe,EAAMqe,EAAIvlB,EAAKwN,EAAU,IAAMzR,EAAK0R,EAAYD,EAASzR,EAAKC,KArEhF,IAAIiR,EAAWpT,EAAOD,QAAU,SAAUoC,EAAQkL,EAAMqe,GACnC,mBAARre,IACTqe,EAAKre,EACLA,MAEFoe,EAAUpe,EAAMqe,EAAIvpB,EAAQ,GAAIA,IAIlCiR,EAASnR,UACP+e,iBAAiB,EACjB1d,OAAO,EACPJ,UAAU,EACV+e,sBAAsB,EACtB7d,eAAe,EACfJ,KAAK,GAGPoP,EAASuY,eACProB,OAAO,EACPN,OAAO,EACPZ,OAAO,EACP6B,OAAO,GAGTmP,EAASwY,eACP/D,aAAa,EACb1jB,YAAY,EACZ2d,mBAAmB,EACnB3e,cAAc,GAGhBiQ,EAAS0Y,cACP1oB,MAAM,EACNH,OAAO,EACPoB,UAAU,EACVd,SAAS,EACTC,SAAS,EACT6kB,kBAAkB,EAClBD,kBAAkB,EAClBrkB,YAAY,EACZJ,WAAW,EACXC,WAAW,EACXM,SAAS,EACTb,QAAQ,EACRI,UAAU,EACVC,UAAU,EACVY,aAAa,EACbT,eAAe,EACfC,eAAe,QA+BXioB,IAAI,SAAS/qB,EAAQhB,EAAOD,IAClC,SAAWK,IAET,SAASyL,GAgEV,SAAS0C,EAAM+F,GACd,MAAM,IAAI0X,WAAWpjB,EAAO0L,IAW7B,SAASO,EAAImC,EAAO0S,GAGnB,IAFA,IAAIpoB,EAAS0V,EAAM1V,OACf2K,KACG3K,KACN2K,EAAO3K,GAAUooB,EAAG1S,EAAM1V,IAE3B,OAAO2K,EAaR,SAASggB,EAAUC,EAAQxC,GAC1B,IAAI3X,EAAQma,EAAOlqB,MAAM,KACrBiK,EAAS,GACT8F,EAAMzQ,OAAS,IAGlB2K,EAAS8F,EAAM,GAAK,IACpBma,EAASna,EAAM,IAMhB,OAAO9F,EADO4I,GAFdqX,EAASA,EAAOhZ,QAAQiZ,EAAiB,MACrBnqB,MAAM,KACA0nB,GAAI5J,KAAK,KAiBpC,SAASsM,EAAWF,GAMnB,IALA,IAGIvpB,EACA0pB,EAJAC,KACAC,EAAU,EACVjrB,EAAS4qB,EAAO5qB,OAGbirB,EAAUjrB,IAChBqB,EAAQupB,EAAOvW,WAAW4W,OACb,OAAU5pB,GAAS,OAAU4pB,EAAUjrB,EAG3B,QAAX,OADb+qB,EAAQH,EAAOvW,WAAW4W,OAEzBD,EAAOrX,OAAe,KAARtS,IAAkB,KAAe,KAAR0pB,GAAiB,QAIxDC,EAAOrX,KAAKtS,GACZ4pB,KAGDD,EAAOrX,KAAKtS,GAGd,OAAO2pB,EAWR,SAASE,EAAWxV,GACnB,OAAOnC,EAAImC,EAAO,SAASrU,GAC1B,IAAI2pB,EAAS,GAOb,OANI3pB,EAAQ,QAEX2pB,GAAUG,GADV9pB,GAAS,SAC8B,GAAK,KAAQ,OACpDA,EAAQ,MAAiB,KAARA,GAElB2pB,GAAUG,EAAmB9pB,KAE3Bmd,KAAK,IAYT,SAAS4M,EAAaC,GACrB,OAAIA,EAAY,GAAK,GACbA,EAAY,GAEhBA,EAAY,GAAK,GACbA,EAAY,GAEhBA,EAAY,GAAK,GACbA,EAAY,GAEbC,EAcR,SAASC,EAAaC,EAAOC,GAG5B,OAAOD,EAAQ,GAAK,IAAMA,EAAQ,MAAgB,GAARC,IAAc,GAQzD,SAASC,EAAMC,EAAOC,EAAWC,GAChC,IAAInY,EAAI,EAGR,IAFAiY,EAAQE,EAAYC,EAAMH,EAAQI,GAAQJ,GAAS,EACnDA,GAASG,EAAMH,EAAQC,GACOD,EAAQK,EAAgBC,GAAQ,EAAGvY,GAAK4X,EACrEK,EAAQG,EAAMH,EAAQK,GAEvB,OAAOF,EAAMpY,GAAKsY,EAAgB,GAAKL,GAASA,EAAQO,IAUzD,SAASC,EAAOC,GAEf,IAEI7V,EAIA8V,EACA7rB,EACA0N,EACAoe,EACAC,EACA7Y,EACA8X,EACArsB,EAEAqtB,EAfAxB,KACAyB,EAAcL,EAAMpsB,OAEpBL,EAAI,EACJP,EAAIstB,EACJC,EAAOC,EAqBX,KALAP,EAAQD,EAAMS,YAAYC,IACd,IACXT,EAAQ,GAGJ7rB,EAAI,EAAGA,EAAI6rB,IAAS7rB,EAEpB4rB,EAAM/X,WAAW7T,IAAM,KAC1ByM,EAAM,aAEP+d,EAAOrX,KAAKyY,EAAM/X,WAAW7T,IAM9B,IAAK0N,EAAQme,EAAQ,EAAIA,EAAQ,EAAI,EAAGne,EAAQue,GAAwC,CAOvF,IAAKH,EAAO3sB,EAAG4sB,EAAI,EAAG7Y,EAAI4X,EAErBpd,GAASue,GACZxf,EAAM,mBAGPue,EAAQJ,EAAagB,EAAM/X,WAAWnG,QAEzBod,GAAQE,EAAQM,GAAOiB,EAASptB,GAAK4sB,KACjDtf,EAAM,YAGPtN,GAAK6rB,EAAQe,EACbptB,EAAIuU,GAAKiZ,EAAOK,EAAQtZ,GAAKiZ,EAAOV,EAAOA,EAAOvY,EAAIiZ,IAElDnB,EAAQrsB,GAfuCuU,GAAK4X,EAoBpDiB,EAAIT,EAAMiB,GADdP,EAAalB,EAAOnsB,KAEnB8N,EAAM,YAGPsf,GAAKC,EAKNG,EAAOjB,EAAM/rB,EAAI2sB,EADjB/V,EAAMyU,EAAOhrB,OAAS,EACc,GAARssB,GAIxBR,EAAMnsB,EAAI4W,GAAOwW,EAAS3tB,GAC7B6N,EAAM,YAGP7N,GAAK0sB,EAAMnsB,EAAI4W,GACf5W,GAAK4W,EAGLyU,EAAO1b,OAAO3P,IAAK,EAAGP,GAIvB,OAAO8rB,EAAWF,GAUnB,SAASiC,EAAOb,GACf,IAAIhtB,EACAusB,EACAuB,EACAC,EACAR,EACAnsB,EACA4sB,EACAC,EACA3Z,EACAvU,EACAmuB,EAGAb,EAEAc,EACAf,EACAgB,EANAxC,KAoBJ,IARAyB,GAHAL,EAAQtB,EAAWsB,IAGCpsB,OAGpBZ,EAAIstB,EACJf,EAAQ,EACRgB,EAAOC,EAGFpsB,EAAI,EAAGA,EAAIisB,IAAejsB,GAC9B8sB,EAAelB,EAAM5rB,IACF,KAClBwqB,EAAOrX,KAAKwX,EAAmBmC,IAejC,IAXAJ,EAAiBC,EAAcnC,EAAOhrB,OAMlCmtB,GACHnC,EAAOrX,KAAKmZ,GAINI,EAAiBT,GAAa,CAIpC,IAAKW,EAAIL,EAAQvsB,EAAI,EAAGA,EAAIisB,IAAejsB,GAC1C8sB,EAAelB,EAAM5rB,KACDpB,GAAKkuB,EAAeF,IACvCA,EAAIE,GAcN,IAPIF,EAAIhuB,EAAI0sB,GAAOiB,EAASpB,IAD5B4B,EAAwBL,EAAiB,KAExCjgB,EAAM,YAGP0e,IAAUyB,EAAIhuB,GAAKmuB,EACnBnuB,EAAIguB,EAEC5sB,EAAI,EAAGA,EAAIisB,IAAejsB,EAO9B,IANA8sB,EAAelB,EAAM5rB,IAEFpB,KAAOusB,EAAQoB,GACjC9f,EAAM,YAGHqgB,GAAgBluB,EAAG,CAEtB,IAAKiuB,EAAI1B,EAAOjY,EAAI4X,EACnBnsB,EAAIuU,GAAKiZ,EAAOK,EAAQtZ,GAAKiZ,EAAOV,EAAOA,EAAOvY,EAAIiZ,IAClDU,EAAIluB,GAFqCuU,GAAK4X,EAOlDN,EAAOrX,KACNwX,EAAmBI,EAAapsB,GAHjCquB,EAAUH,EAAIluB,IACdqtB,EAAalB,EAAOnsB,GAEuC,KAE3DkuB,EAAIvB,EAAM0B,EAAUhB,GAGrBxB,EAAOrX,KAAKwX,EAAmBI,EAAa8B,EAAG,KAC/CV,EAAOjB,EAAMC,EAAO4B,EAAuBL,GAAkBC,GAC7DxB,EAAQ,IACNuB,IAIFvB,IACAvsB,EAGH,OAAO4rB,EAAOxM,KAAK,IAlbpB,IAAIiP,EAAgC,iBAAXhvB,GAAuBA,IAC9CA,EAAQivB,UAAYjvB,EAClBkvB,EAA8B,iBAAVjvB,GAAsBA,IAC5CA,EAAOgvB,UAAYhvB,EACjBkvB,EAA8B,iBAAV9uB,GAAsBA,EAE7C8uB,EAAW9uB,SAAW8uB,GACtBA,EAAW/uB,SAAW+uB,GACtBA,EAAW7uB,OAAS6uB,IAEpBrjB,EAAOqjB,GAQR,IAAIC,EAiCJjtB,EA9BAmsB,EAAS,WAGTzB,EAAO,GACP0B,EAAO,EACPf,EAAO,GACPC,EAAO,GACPH,EAAO,IACPa,EAAc,GACdF,EAAW,IACXI,EAAY,IAGZgB,EAAgB,QAChBC,EAAgB,eAChBlD,EAAkB,4BAGlBvjB,GACC0mB,SAAY,kDACZC,YAAa,iDACbC,gBAAiB,iBAIlBlC,EAAgBV,EAAO0B,EACvBlB,EAAQpR,KAAKoR,MACbX,EAAqBpD,OAAOoG,aAidrB,GAnCPN,GAMCO,QAAW,QAQXC,MACClC,OAAUrB,EACVmC,OAAU/B,GAEXiB,OAAUA,EACVc,OAAUA,EACVqB,QA/BD,SAAiBlC,GAChB,OAAOzB,EAAUyB,EAAO,SAASxB,GAChC,OAAOmD,EAAcnlB,KAAKgiB,GACvB,OAASqC,EAAOrC,GAChBA,KA4BJ2D,UAnDD,SAAmBnC,GAClB,OAAOzB,EAAUyB,EAAO,SAASxB,GAChC,OAAOkD,EAAcllB,KAAKgiB,GACvBuB,EAAOvB,EAAOpa,MAAM,GAAGge,eACvB5D,MA6DM6C,GAAeE,EACzB,GAAIjvB,EAAOD,SAAWgvB,EAErBE,EAAWlvB,QAAUovB,OAGrB,IAAKjtB,KAAOitB,EACXA,EAASrE,eAAe5oB,KAAS6sB,EAAY7sB,GAAOitB,EAASjtB,SAK/D2J,EAAKsjB,SAAWA,EAhhBjB,CAmhBC7uB,QAECe,KAAKf,KAAuB,oBAAXF,OAAyBA,OAAyB,oBAATC,KAAuBA,KAAyB,oBAAXF,OAAyBA,gBACrH4vB,IAAI,SAAS/uB,EAAQhB,EAAOD,GAsBlC,aAKA,SAAS+qB,EAAevV,EAAK6D,GAC3B,OAAO5Q,OAAO/F,UAAUqoB,eAAezpB,KAAKkU,EAAK6D,GAGnDpZ,EAAOD,QAAU,SAASiwB,EAAIC,EAAKC,EAAIC,GACrCF,EAAMA,GAAO,IACbC,EAAKA,GAAM,IACX,IAAI3a,KAEJ,GAAkB,iBAAPya,GAAiC,IAAdA,EAAG1uB,OAC/B,OAAOiU,EAGT,IAAI6a,EAAS,MACbJ,EAAKA,EAAGhuB,MAAMiuB,GAEd,IAAII,EAAU,IACVF,GAAsC,iBAApBA,EAAQE,UAC5BA,EAAUF,EAAQE,SAGpB,IAAI5a,EAAMua,EAAG1uB,OAET+uB,EAAU,GAAK5a,EAAM4a,IACvB5a,EAAM4a,GAGR,IAAK,IAAIpvB,EAAI,EAAGA,EAAIwU,IAAOxU,EAAG,CAC5B,IAEIqvB,EAAMC,EAAMvb,EAAGnN,EAFf2oB,EAAIR,EAAG/uB,GAAGiS,QAAQkd,EAAQ,OAC1BK,EAAMD,EAAE5P,QAAQsP,GAGhBO,GAAO,GACTH,EAAOE,EAAEE,OAAO,EAAGD,GACnBF,EAAOC,EAAEE,OAAOD,EAAM,KAEtBH,EAAOE,EACPD,EAAO,IAGTvb,EAAI4E,mBAAmB0W,GACvBzoB,EAAI+R,mBAAmB2W,GAElBzF,EAAevV,EAAKP,GAEdxC,EAAQ+C,EAAIP,IACrBO,EAAIP,GAAGC,KAAKpN,GAEZ0N,EAAIP,IAAMO,EAAIP,GAAInN,GAJlB0N,EAAIP,GAAKnN,EAQb,OAAO0N,GAGT,IAAI/C,EAAUD,MAAMC,SAAW,SAAUme,GACvC,MAA8C,mBAAvCnoB,OAAO/F,UAAUooB,SAASxpB,KAAKsvB,SAGlCC,IAAI,SAAS5vB,EAAQhB,EAAOD,GAsBlC,aAgDA,SAAS8U,EAAK8b,EAAI7wB,GAChB,GAAI6wB,EAAG9b,IAAK,OAAO8b,EAAG9b,IAAI/U,GAE1B,IAAK,IADDqR,KACKlQ,EAAI,EAAGA,EAAI0vB,EAAGrvB,OAAQL,IAC7BkQ,EAAI8D,KAAKnV,EAAE6wB,EAAG1vB,GAAIA,IAEpB,OAAOkQ,EApDT,IAAI0f,EAAqB,SAAShpB,GAChC,cAAeA,GACb,IAAK,SACH,OAAOA,EAET,IAAK,UACH,OAAOA,EAAI,OAAS,QAEtB,IAAK,SACH,OAAOwjB,SAASxjB,GAAKA,EAAI,GAE3B,QACE,MAAO,KAIb7H,EAAOD,QAAU,SAASwV,EAAK0a,EAAKC,EAAI5G,GAOtC,OANA2G,EAAMA,GAAO,IACbC,EAAKA,GAAM,IACC,OAAR3a,IACFA,OAAM9N,GAGW,iBAAR8N,EACFV,EAAIic,EAAWvb,GAAM,SAASP,GACnC,IAAI+b,EAAKlX,mBAAmBgX,EAAmB7b,IAAMkb,EACrD,OAAI1d,EAAQ+C,EAAIP,IACPH,EAAIU,EAAIP,GAAI,SAASnN,GAC1B,OAAOkpB,EAAKlX,mBAAmBgX,EAAmBhpB,MACjDiY,KAAKmQ,GAEDc,EAAKlX,mBAAmBgX,EAAmBtb,EAAIP,OAEvD8K,KAAKmQ,GAIL3G,EACEzP,mBAAmBgX,EAAmBvH,IAAS4G,EAC/CrW,mBAAmBgX,EAAmBtb,IAF3B,IAKpB,IAAI/C,EAAUD,MAAMC,SAAW,SAAUme,GACvC,MAA8C,mBAAvCnoB,OAAO/F,UAAUooB,SAASxpB,KAAKsvB,IAYpCG,EAAatoB,OAAOuM,MAAQ,SAAUQ,GACxC,IAAIpE,KACJ,IAAK,IAAIjP,KAAOqT,EACV/M,OAAO/F,UAAUqoB,eAAezpB,KAAKkU,EAAKrT,IAAMiP,EAAI8D,KAAK/S,GAE/D,OAAOiP,QAGH6f,IAAI,SAAShwB,EAAQhB,EAAOD,GAClC,aAEAA,EAAQ0tB,OAAS1tB,EAAQ6B,MAAQZ,EAAQ,YACzCjB,EAAQwuB,OAASxuB,EAAQ8B,UAAYb,EAAQ,cAE1CiwB,WAAW,GAAGC,WAAW,KAAKC,IAAI,SAASnwB,EAAQhB,EAAOD,GAsB7D,aAYA,SAASqxB,IACP9wB,KAAKwS,SAAW,KAChBxS,KAAK+wB,QAAU,KACf/wB,KAAKgxB,KAAO,KACZhxB,KAAK0S,KAAO,KACZ1S,KAAKixB,KAAO,KACZjxB,KAAK2K,SAAW,KAChB3K,KAAKuR,KAAO,KACZvR,KAAKkxB,OAAS,KACdlxB,KAAKmxB,MAAQ,KACbnxB,KAAKoxB,SAAW,KAChBpxB,KAAK2S,KAAO,KACZ3S,KAAKyS,KAAO,KAwDd,SAAS4e,EAASxpB,EAAKypB,EAAkBC,GACvC,GAAI1pB,GAAOgB,EAAKygB,SAASzhB,IAAQA,aAAeipB,EAAK,OAAOjpB,EAE5D,IAAIrH,EAAI,IAAIswB,EAEZ,OADAtwB,EAAEc,MAAMuG,EAAKypB,EAAkBC,GACxB/wB,EAnFT,IAAIquB,EAAWnuB,EAAQ,YACnBmI,EAAOnI,EAAQ,UAEnBjB,EAAQ6B,MAAQ+vB,EAChB5xB,EAAQwG,QA0ZR,SAAoBkI,EAAQqjB,GAC1B,OAAOH,EAASljB,GAAQ,GAAO,GAAMlI,QAAQurB,IA1Z/C/xB,EAAQgyB,cAiaR,SAA0BtjB,EAAQqjB,GAChC,OAAKrjB,EACEkjB,EAASljB,GAAQ,GAAO,GAAMsjB,cAAcD,GAD/BA,GAjatB/xB,EAAQsD,OAsVR,SAAmBkS,GAMjB,OADIpM,EAAK6oB,SAASzc,KAAMA,EAAMoc,EAASpc,IACjCA,aAAe6b,EACd7b,EAAIlS,SADuB+tB,EAAI3uB,UAAUY,OAAOhC,KAAKkU,IA1V9DxV,EAAQqxB,IAAMA,EAqBd,IAAIa,EAAkB,oBAClBC,EAAc,WAGdC,EAAoB,qCAOpBC,GAAU,IAAK,IAAK,IAAK,KAAM,IAAK,KAAKjd,QAH/B,IAAK,IAAK,IAAK,IAAK,IAAK,KAAM,KAAM,OAM/Ckd,GAAc,KAAMld,OAAOid,GAK3BE,GAAgB,IAAK,IAAK,IAAK,IAAK,KAAKnd,OAAOkd,GAChDE,GAAmB,IAAK,IAAK,KAE7BC,EAAsB,yBACtBC,EAAoB,+BAEpBC,GACEC,YAAc,EACdC,eAAe,GAGjBC,GACEF,YAAc,EACdC,eAAe,GAGjBE,GACEC,MAAQ,EACRC,OAAS,EACTC,KAAO,EACPC,QAAU,EACVC,MAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,WAAW,EACXC,SAAS,GAEXC,EAAczyB,EAAQ,eAU1BowB,EAAI3uB,UAAUb,MAAQ,SAASuG,EAAKypB,EAAkBC,GACpD,IAAK1oB,EAAK6oB,SAAS7pB,GACjB,MAAM,IAAIihB,UAAU,gDAAkDjhB,GAMxE,IAAIurB,EAAavrB,EAAIyY,QAAQ,KACzB+S,GACqB,IAAhBD,GAAqBA,EAAavrB,EAAIyY,QAAQ,KAAQ,IAAM,IACjEgT,EAASzrB,EAAInG,MAAM2xB,GAEvBC,EAAO,GAAKA,EAAO,GAAG1gB,QADL,MACyB,KAG1C,IAAI2gB,EAFJ1rB,EAAMyrB,EAAO9T,KAAK6T,GAQlB,GAFAE,EAAOA,EAAKC,QAEPjC,GAA+C,IAA1B1pB,EAAInG,MAAM,KAAKV,OAAc,CAErD,IAAIyyB,EAAa5B,EAAkB6B,KAAKH,GACxC,GAAIE,EAeF,OAdAzzB,KAAK2S,KAAO4gB,EACZvzB,KAAKyS,KAAO8gB,EACZvzB,KAAKoxB,SAAWqC,EAAW,GACvBA,EAAW,IACbzzB,KAAKkxB,OAASuC,EAAW,GAEvBzzB,KAAKmxB,MADHG,EACW6B,EAAY7xB,MAAMtB,KAAKkxB,OAAOd,OAAO,IAErCpwB,KAAKkxB,OAAOd,OAAO,IAEzBkB,IACTtxB,KAAKkxB,OAAS,GACdlxB,KAAKmxB,UAEAnxB,KAIX,IAAI2zB,EAAQhC,EAAgB+B,KAAKH,GACjC,GAAII,EAAO,CAET,IAAIC,GADJD,EAAQA,EAAM,IACSnE,cACvBxvB,KAAKwS,SAAWohB,EAChBL,EAAOA,EAAKnD,OAAOuD,EAAM3yB,QAO3B,GAAIuwB,GAAqBoC,GAASJ,EAAKrqB,MAAM,wBAAyB,CACpE,IAAI6nB,EAAgC,OAAtBwC,EAAKnD,OAAO,EAAG,IACzBW,GAAa4C,GAASpB,EAAiBoB,KACzCJ,EAAOA,EAAKnD,OAAO,GACnBpwB,KAAK+wB,SAAU,GAInB,IAAKwB,EAAiBoB,KACjB5C,GAAY4C,IAAUnB,EAAgBmB,IAAU,CAmBnD,IAAK,IADDE,GAAW,EACNlzB,EAAI,EAAGA,EAAIsxB,EAAgBjxB,OAAQL,IAAK,EAElC,KADTmzB,EAAMP,EAAKjT,QAAQ2R,EAAgBtxB,QACP,IAAbkzB,GAAkBC,EAAMD,KACzCA,EAAUC,GAKd,IAAI9C,EAAM+C,GAYM,KATdA,GAFe,IAAbF,EAEON,EAAK1F,YAAY,KAIjB0F,EAAK1F,YAAY,IAAKgG,MAM/B7C,EAAOuC,EAAK/hB,MAAM,EAAGuiB,GACrBR,EAAOA,EAAK/hB,MAAMuiB,EAAS,GAC3B/zB,KAAKgxB,KAAO1X,mBAAmB0X,IAIjC6C,GAAW,EACX,IAASlzB,EAAI,EAAGA,EAAIqxB,EAAahxB,OAAQL,IAAK,CAC5C,IAAImzB,GACS,KADTA,EAAMP,EAAKjT,QAAQ0R,EAAarxB,QACJ,IAAbkzB,GAAkBC,EAAMD,KACzCA,EAAUC,IAGG,IAAbD,IACFA,EAAUN,EAAKvyB,QAEjBhB,KAAK0S,KAAO6gB,EAAK/hB,MAAM,EAAGqiB,GAC1BN,EAAOA,EAAK/hB,MAAMqiB,GAGlB7zB,KAAKg0B,YAILh0B,KAAK2K,SAAW3K,KAAK2K,UAAY,GAIjC,IAAIspB,EAAoC,MAArBj0B,KAAK2K,SAAS,IACe,MAA5C3K,KAAK2K,SAAS3K,KAAK2K,SAAS3J,OAAS,GAGzC,IAAKizB,EAEH,IAAK,IADDC,EAAYl0B,KAAK2K,SAASjJ,MAAM,MACpBZ,GAAPH,EAAI,EAAOuzB,EAAUlzB,QAAQL,EAAIG,EAAGH,IAAK,CAChD,IAAI+Q,EAAOwiB,EAAUvzB,GACrB,GAAK+Q,IACAA,EAAKxI,MAAMgpB,GAAsB,CAEpC,IAAK,IADDiC,EAAU,GACL3yB,EAAI,EAAGkT,EAAIhD,EAAK1Q,OAAQQ,EAAIkT,EAAGlT,IAClCkQ,EAAK2D,WAAW7T,GAAK,IAIvB2yB,GAAW,IAEXA,GAAWziB,EAAKlQ,GAIpB,IAAK2yB,EAAQjrB,MAAMgpB,GAAsB,CACvC,IAAIkC,EAAaF,EAAU1iB,MAAM,EAAG7Q,GAChC0zB,EAAUH,EAAU1iB,MAAM7Q,EAAI,GAC9B2zB,EAAM5iB,EAAKxI,MAAMipB,GACjBmC,IACFF,EAAWzf,KAAK2f,EAAI,IACpBD,EAAQE,QAAQD,EAAI,KAElBD,EAAQrzB,SACVuyB,EAAO,IAAMc,EAAQ7U,KAAK,KAAO+T,GAEnCvzB,KAAK2K,SAAWypB,EAAW5U,KAAK,KAChC,QAONxf,KAAK2K,SADH3K,KAAK2K,SAAS3J,OAjND,IAkNC,GAGAhB,KAAK2K,SAAS6kB,cAG3ByE,IAKHj0B,KAAK2K,SAAWkkB,EAASS,QAAQtvB,KAAK2K,WAGxC,IAAItD,EAAIrH,KAAKixB,KAAO,IAAMjxB,KAAKixB,KAAO,GAEtCjxB,KAAK0S,MADG1S,KAAK2K,UAAY,IACTtD,EAChBrH,KAAKyS,MAAQzS,KAAK0S,KAIduhB,IACFj0B,KAAK2K,SAAW3K,KAAK2K,SAASylB,OAAO,EAAGpwB,KAAK2K,SAAS3J,OAAS,GAC/C,MAAZuyB,EAAK,KACPA,EAAO,IAAMA,IAOnB,IAAKnB,EAAewB,GAKlB,IAASjzB,EAAI,EAAGG,EAAIixB,EAAW/wB,OAAQL,EAAIG,EAAGH,IAAK,CACjD,IAAI6zB,EAAKzC,EAAWpxB,GACpB,IAA0B,IAAtB4yB,EAAKjT,QAAQkU,GAAjB,CAEA,IAAIC,EAAMlb,mBAAmBib,GACzBC,IAAQD,IACVC,EAAMC,OAAOF,IAEfjB,EAAOA,EAAK7xB,MAAM8yB,GAAIhV,KAAKiV,IAM/B,IAAIljB,EAAOgiB,EAAKjT,QAAQ,MACV,IAAV/O,IAEFvR,KAAKuR,KAAOgiB,EAAKnD,OAAO7e,GACxBgiB,EAAOA,EAAK/hB,MAAM,EAAGD,IAEvB,IAAIojB,EAAKpB,EAAKjT,QAAQ,KAoBtB,IAnBY,IAARqU,GACF30B,KAAKkxB,OAASqC,EAAKnD,OAAOuE,GAC1B30B,KAAKmxB,MAAQoC,EAAKnD,OAAOuE,EAAK,GAC1BrD,IACFtxB,KAAKmxB,MAAQgC,EAAY7xB,MAAMtB,KAAKmxB,QAEtCoC,EAAOA,EAAK/hB,MAAM,EAAGmjB,IACZrD,IAETtxB,KAAKkxB,OAAS,GACdlxB,KAAKmxB,UAEHoC,IAAMvzB,KAAKoxB,SAAWmC,GACtBf,EAAgBoB,IAChB5zB,KAAK2K,WAAa3K,KAAKoxB,WACzBpxB,KAAKoxB,SAAW,KAIdpxB,KAAKoxB,UAAYpxB,KAAKkxB,OAAQ,CAGhClxB,KAAK2S,MAFDtL,EAAIrH,KAAKoxB,UAAY,KACjBpxB,KAAKkxB,QAAU,IAMzB,OADAlxB,KAAKyS,KAAOzS,KAAK+C,SACV/C,MAcT8wB,EAAI3uB,UAAUY,OAAS,WACrB,IAAIiuB,EAAOhxB,KAAKgxB,MAAQ,GACpBA,IAEFA,GADAA,EAAOzX,mBAAmByX,IACdpe,QAAQ,OAAQ,KAC5Boe,GAAQ,KAGV,IAAIxe,EAAWxS,KAAKwS,UAAY,GAC5B4e,EAAWpxB,KAAKoxB,UAAY,GAC5B7f,EAAOvR,KAAKuR,MAAQ,GACpBmB,GAAO,EACPye,EAAQ,GAERnxB,KAAK0S,KACPA,EAAOse,EAAOhxB,KAAK0S,KACV1S,KAAK2K,WACd+H,EAAOse,IAAwC,IAAhChxB,KAAK2K,SAAS2V,QAAQ,KACjCtgB,KAAK2K,SACL,IAAM3K,KAAK2K,SAAW,KACtB3K,KAAKixB,OACPve,GAAQ,IAAM1S,KAAKixB,OAInBjxB,KAAKmxB,OACLtoB,EAAKygB,SAAStpB,KAAKmxB,QACnBjpB,OAAOuM,KAAKzU,KAAKmxB,OAAOnwB,SAC1BmwB,EAAQgC,EAAY5xB,UAAUvB,KAAKmxB,QAGrC,IAAID,EAASlxB,KAAKkxB,QAAWC,GAAU,IAAMA,GAAW,GAsBxD,OApBI3e,GAAoC,MAAxBA,EAAS4d,QAAQ,KAAY5d,GAAY,KAIrDxS,KAAK+wB,WACHve,GAAYggB,EAAgBhgB,MAAuB,IAATE,GAC9CA,EAAO,MAAQA,GAAQ,IACnB0e,GAAmC,MAAvBA,EAASwD,OAAO,KAAYxD,EAAW,IAAMA,IACnD1e,IACVA,EAAO,IAGLnB,GAA2B,MAAnBA,EAAKqjB,OAAO,KAAYrjB,EAAO,IAAMA,GAC7C2f,GAA+B,MAArBA,EAAO0D,OAAO,KAAY1D,EAAS,IAAMA,GAEvDE,EAAWA,EAASxe,QAAQ,QAAS,SAAS1J,GAC5C,OAAOqQ,mBAAmBrQ,KAE5BgoB,EAASA,EAAOte,QAAQ,IAAK,OAEtBJ,EAAWE,EAAO0e,EAAWF,EAAS3f,GAO/Cuf,EAAI3uB,UAAU8D,QAAU,SAASurB,GAC/B,OAAOxxB,KAAKyxB,cAAcJ,EAASG,GAAU,GAAO,IAAOzuB,UAQ7D+tB,EAAI3uB,UAAUsvB,cAAgB,SAASD,GACrC,GAAI3oB,EAAK6oB,SAASF,GAAW,CAC3B,IAAIqD,EAAM,IAAI/D,EACd+D,EAAIvzB,MAAMkwB,GAAU,GAAO,GAC3BA,EAAWqD,EAKb,IAAK,IAFDlpB,EAAS,IAAImlB,EACbgE,EAAQ5sB,OAAOuM,KAAKzU,MACf+0B,EAAK,EAAGA,EAAKD,EAAM9zB,OAAQ+zB,IAAM,CACxC,IAAIC,EAAOF,EAAMC,GACjBppB,EAAOqpB,GAAQh1B,KAAKg1B,GAQtB,GAHArpB,EAAO4F,KAAOigB,EAASjgB,KAGD,KAAlBigB,EAAS/e,KAEX,OADA9G,EAAO8G,KAAO9G,EAAO5I,SACd4I,EAIT,GAAI6lB,EAAST,UAAYS,EAAShf,SAAU,CAG1C,IAAK,IADDyiB,EAAQ/sB,OAAOuM,KAAK+c,GACf0D,EAAK,EAAGA,EAAKD,EAAMj0B,OAAQk0B,IAAM,CACxC,IAAIC,EAAOF,EAAMC,GACJ,aAATC,IACFxpB,EAAOwpB,GAAQ3D,EAAS2D,IAU5B,OANI3C,EAAgB7mB,EAAO6G,WACvB7G,EAAOhB,WAAagB,EAAOylB,WAC7BzlB,EAAOgH,KAAOhH,EAAOylB,SAAW,KAGlCzlB,EAAO8G,KAAO9G,EAAO5I,SACd4I,EAGT,GAAI6lB,EAAShf,UAAYgf,EAAShf,WAAa7G,EAAO6G,SAAU,CAS9D,IAAKggB,EAAgBhB,EAAShf,UAAW,CAEvC,IAAK,IADDiC,EAAOvM,OAAOuM,KAAK+c,GACdjqB,EAAI,EAAGA,EAAIkN,EAAKzT,OAAQuG,IAAK,CACpC,IAAImN,EAAID,EAAKlN,GACboE,EAAO+I,GAAK8c,EAAS9c,GAGvB,OADA/I,EAAO8G,KAAO9G,EAAO5I,SACd4I,EAIT,GADAA,EAAO6G,SAAWgf,EAAShf,SACtBgf,EAAS9e,MAAS6f,EAAiBf,EAAShf,UAS/C7G,EAAOylB,SAAWI,EAASJ,aAT+B,CAE1D,IADA,IAAIgE,GAAW5D,EAASJ,UAAY,IAAI1vB,MAAM,KACvC0zB,EAAQp0B,UAAYwwB,EAAS9e,KAAO0iB,EAAQC,WAC9C7D,EAAS9e,OAAM8e,EAAS9e,KAAO,IAC/B8e,EAAS7mB,WAAU6mB,EAAS7mB,SAAW,IACzB,KAAfyqB,EAAQ,IAAWA,EAAQb,QAAQ,IACnCa,EAAQp0B,OAAS,GAAGo0B,EAAQb,QAAQ,IACxC5oB,EAAOylB,SAAWgE,EAAQ5V,KAAK,KAWjC,GAPA7T,EAAOulB,OAASM,EAASN,OACzBvlB,EAAOwlB,MAAQK,EAASL,MACxBxlB,EAAO+G,KAAO8e,EAAS9e,MAAQ,GAC/B/G,EAAOqlB,KAAOQ,EAASR,KACvBrlB,EAAOhB,SAAW6mB,EAAS7mB,UAAY6mB,EAAS9e,KAChD/G,EAAOslB,KAAOO,EAASP,KAEnBtlB,EAAOylB,UAAYzlB,EAAOulB,OAAQ,CAGpCvlB,EAAOgH,MAFChH,EAAOylB,UAAY,KACnBzlB,EAAOulB,QAAU,IAK3B,OAFAvlB,EAAOolB,QAAUplB,EAAOolB,SAAWS,EAAST,QAC5CplB,EAAO8G,KAAO9G,EAAO5I,SACd4I,EAGT,IAAI2pB,EAAe3pB,EAAOylB,UAA0C,MAA9BzlB,EAAOylB,SAASwD,OAAO,GACzDW,EACI/D,EAAS9e,MACT8e,EAASJ,UAA4C,MAAhCI,EAASJ,SAASwD,OAAO,GAElDY,EAAcD,GAAYD,GACX3pB,EAAO+G,MAAQ8e,EAASJ,SACvCqE,EAAgBD,EAChBE,EAAU/pB,EAAOylB,UAAYzlB,EAAOylB,SAAS1vB,MAAM,SAEnDi0B,GADAP,EAAU5D,EAASJ,UAAYI,EAASJ,SAAS1vB,MAAM,SAC3CiK,EAAO6G,WAAaggB,EAAgB7mB,EAAO6G,WA2B3D,GApBImjB,IACFhqB,EAAOhB,SAAW,GAClBgB,EAAOslB,KAAO,KACVtlB,EAAO+G,OACU,KAAfgjB,EAAQ,GAAWA,EAAQ,GAAK/pB,EAAO+G,KACtCgjB,EAAQnB,QAAQ5oB,EAAO+G,OAE9B/G,EAAO+G,KAAO,GACV8e,EAAShf,WACXgf,EAAS7mB,SAAW,KACpB6mB,EAASP,KAAO,KACZO,EAAS9e,OACQ,KAAf0iB,EAAQ,GAAWA,EAAQ,GAAK5D,EAAS9e,KACxC0iB,EAAQb,QAAQ/C,EAAS9e,OAEhC8e,EAAS9e,KAAO,MAElB8iB,EAAaA,IAA8B,KAAfJ,EAAQ,IAA4B,KAAfM,EAAQ,KAGvDH,EAEF5pB,EAAO+G,KAAQ8e,EAAS9e,MAA0B,KAAlB8e,EAAS9e,KAC3B8e,EAAS9e,KAAO/G,EAAO+G,KACrC/G,EAAOhB,SAAY6mB,EAAS7mB,UAAkC,KAAtB6mB,EAAS7mB,SAC/B6mB,EAAS7mB,SAAWgB,EAAOhB,SAC7CgB,EAAOulB,OAASM,EAASN,OACzBvlB,EAAOwlB,MAAQK,EAASL,MACxBuE,EAAUN,OAEL,GAAIA,EAAQp0B,OAGZ00B,IAASA,MACdA,EAAQla,MACRka,EAAUA,EAAQ7gB,OAAOugB,GACzBzpB,EAAOulB,OAASM,EAASN,OACzBvlB,EAAOwlB,MAAQK,EAASL,WACnB,IAAKtoB,EAAK+sB,kBAAkBpE,EAASN,QAAS,CAInD,GAAIyE,EAAW,CACbhqB,EAAOhB,SAAWgB,EAAO+G,KAAOgjB,EAAQL,SAIpCQ,KAAalqB,EAAO+G,MAAQ/G,EAAO+G,KAAK4N,QAAQ,KAAO,IAC1C3U,EAAO+G,KAAKhR,MAAM,QAEjCiK,EAAOqlB,KAAO6E,EAAWR,QACzB1pB,EAAO+G,KAAO/G,EAAOhB,SAAWkrB,EAAWR,SAW/C,OARA1pB,EAAOulB,OAASM,EAASN,OACzBvlB,EAAOwlB,MAAQK,EAASL,MAEnBtoB,EAAKitB,OAAOnqB,EAAOylB,WAAcvoB,EAAKitB,OAAOnqB,EAAOulB,UACvDvlB,EAAOgH,MAAQhH,EAAOylB,SAAWzlB,EAAOylB,SAAW,KACpCzlB,EAAOulB,OAASvlB,EAAOulB,OAAS,KAEjDvlB,EAAO8G,KAAO9G,EAAO5I,SACd4I,EAGT,IAAK+pB,EAAQ10B,OAWX,OARA2K,EAAOylB,SAAW,KAGhBzlB,EAAOgH,KADLhH,EAAOulB,OACK,IAAMvlB,EAAOulB,OAEb,KAEhBvlB,EAAO8G,KAAO9G,EAAO5I,SACd4I,EAcT,IAAK,IARDoqB,EAAOL,EAAQlkB,OAAO,GAAG,GACzBwkB,GACCrqB,EAAO+G,MAAQ8e,EAAS9e,MAAQgjB,EAAQ10B,OAAS,KACxC,MAAT+0B,GAAyB,OAATA,IAA2B,KAATA,EAInC5c,EAAK,EACAxY,EAAI+0B,EAAQ10B,OAAQL,GAAK,EAAGA,IAEtB,OADbo1B,EAAOL,EAAQ/0B,IAEb+0B,EAAQplB,OAAO3P,EAAG,GACA,OAATo1B,GACTL,EAAQplB,OAAO3P,EAAG,GAClBwY,KACSA,IACTuc,EAAQplB,OAAO3P,EAAG,GAClBwY,KAKJ,IAAKqc,IAAeC,EAClB,KAAOtc,IAAMA,EACXuc,EAAQnB,QAAQ,OAIhBiB,GAA6B,KAAfE,EAAQ,IACpBA,EAAQ,IAA+B,MAAzBA,EAAQ,GAAGd,OAAO,IACpCc,EAAQnB,QAAQ,IAGdyB,GAAsD,MAAjCN,EAAQlW,KAAK,KAAK4Q,QAAQ,IACjDsF,EAAQ/gB,KAAK,IAGf,IAAIshB,EAA4B,KAAfP,EAAQ,IACpBA,EAAQ,IAA+B,MAAzBA,EAAQ,GAAGd,OAAO,GAGrC,GAAIe,EAAW,CACbhqB,EAAOhB,SAAWgB,EAAO+G,KAAOujB,EAAa,GACbP,EAAQ10B,OAAS00B,EAAQL,QAAU,GAInE,IAAIQ,GAAAA,KAAalqB,EAAO+G,MAAQ/G,EAAO+G,KAAK4N,QAAQ,KAAO,IAC1C3U,EAAO+G,KAAKhR,MAAM,QAEjCiK,EAAOqlB,KAAO6E,EAAWR,QACzB1pB,EAAO+G,KAAO/G,EAAOhB,SAAWkrB,EAAWR,SAyB/C,OArBAG,EAAaA,GAAe7pB,EAAO+G,MAAQgjB,EAAQ10B,UAEhCi1B,GACjBP,EAAQnB,QAAQ,IAGbmB,EAAQ10B,OAIX2K,EAAOylB,SAAWsE,EAAQlW,KAAK,MAH/B7T,EAAOylB,SAAW,KAClBzlB,EAAOgH,KAAO,MAMX9J,EAAKitB,OAAOnqB,EAAOylB,WAAcvoB,EAAKitB,OAAOnqB,EAAOulB,UACvDvlB,EAAOgH,MAAQhH,EAAOylB,SAAWzlB,EAAOylB,SAAW,KACpCzlB,EAAOulB,OAASvlB,EAAOulB,OAAS,KAEjDvlB,EAAOqlB,KAAOQ,EAASR,MAAQrlB,EAAOqlB,KACtCrlB,EAAOolB,QAAUplB,EAAOolB,SAAWS,EAAST,QAC5CplB,EAAO8G,KAAO9G,EAAO5I,SACd4I,GAGTmlB,EAAI3uB,UAAU6xB,UAAY,WACxB,IAAIthB,EAAO1S,KAAK0S,KACZue,EAAOW,EAAY8B,KAAKhhB,GACxBue,IAEW,OADbA,EAAOA,EAAK,MAEVjxB,KAAKixB,KAAOA,EAAKb,OAAO,IAE1B1d,EAAOA,EAAK0d,OAAO,EAAG1d,EAAK1R,OAASiwB,EAAKjwB,SAEvC0R,IAAM1S,KAAK2K,SAAW+H,MAGzBtH,SAAS,GAAGyjB,SAAW,GAAGsE,YAAc,KAAK+C,IAAI,SAASx1B,EAAQhB,EAAOD,GAC5E,aAEAC,EAAOD,SACLiyB,SAAU,SAASyE,GACjB,MAAuB,iBAAV,GAEf7M,SAAU,SAAS6M,GACjB,MAAuB,iBAAV,GAA8B,OAARA,GAErCL,OAAQ,SAASK,GACf,OAAe,OAARA,GAETP,kBAAmB,SAASO,GAC1B,OAAc,MAAPA,SAIL5tB,KAAO,SAAS7H,EAAQhB,EAAOD,GACrC,aAmDA,SAASQ,EAAI8M,GACX,KAAM/M,gBAAgBC,GAAM,OAAO,IAAIA,EAAI8M,GAC3CA,EAAO/M,KAAK+G,MAAQ8B,EAAKC,KAAKiE,OAmbhC,SAAmBhN,GACjB,IAAIiN,EAASjN,EAAKgH,MAAMiG,OACxB,IAAe,IAAXA,EACFjN,EAAKiN,QAAUopB,IAAKC,EAAMhW,KAAMgW,EAAMpoB,MAAOooB,OACxC,CAEL,QADelvB,IAAX6F,IAAsBA,EAASspB,WACZ,iBAAVtpB,GAAsBA,EAAOopB,KAAOppB,EAAOqT,MAAQrT,EAAOiB,OACrE,MAAM,IAAIrN,MAAM,qDAClBb,EAAKiN,OAASA,GA1bhBupB,CAAUv2B,MACVA,KAAK2G,YACL3G,KAAK0G,SACL1G,KAAKw2B,cACLx2B,KAAKoQ,SAAWzH,EAAQoE,EAAKhK,QAC7B,IAAI0zB,EAAkBz2B,KAAK02B,iBAAmB12B,KAAKoQ,SAAS,iBAC5DpQ,KAAK22B,qBAAuB,SAAU3tB,GAAO,OAAOytB,EAAgB7sB,KAAKZ,IAEzEhJ,KAAKkC,OAAS6K,EAAK6pB,OAAS,IAAI30B,EAChCjC,KAAKuG,mBACLvG,KAAKmQ,iBACLnQ,KAAK0M,MAAQuH,IACbjU,KAAKkR,OAyTP,SAAqBnE,GACnB,OAAQA,EAAKiG,UACX,IAAK,MAAO,OAAO6jB,EACnB,IAAK,KAAM,OAAO3lB,EAClB,QAAS,OAAO4lB,GA7TJC,CAAYhqB,GAE1BA,EAAKqV,aAAerV,EAAKqV,cAAgBhQ,EAAAA,EACf,YAAtBrF,EAAKiqB,gBAA6BjqB,EAAKwS,wBAAyB,QAC7CpY,IAAnB4F,EAAKkqB,YAAyBlqB,EAAKkqB,UAAY3nB,GACnDtP,KAAKk3B,UAyZP,SAA8Bn3B,GAE5B,IAAK,IADDo3B,EAAWtuB,EAAKC,KAAK/I,EAAKgH,OACrBpG,EAAE,EAAGA,EAAEy2B,EAAoBp2B,OAAQL,WACnCw2B,EAASC,EAAoBz2B,IACtC,OAAOw2B,EA7ZUE,CAAqBr3B,MAElC+M,EAAKpE,SAyYX,SAA2B5I,GACzB,IAAK,IAAIipB,KAAQjpB,EAAKgH,MAAM4B,QAAS,CACnC,IAAI5F,EAAShD,EAAKgH,MAAM4B,QAAQqgB,GAChCjpB,EAAKu3B,UAAUtO,EAAMjmB,IA5YLw0B,CAAkBv3B,MAmXtC,SAA6BD,GAC3B,IAAIy3B,EACAz3B,EAAKgH,MAAMiS,QACbwe,EAAc92B,EAAQ,qBACtBX,EAAK03B,cAAcD,EAAaA,EAAYjS,KAAK,IAEnD,IAAwB,IAApBxlB,EAAKgH,MAAMrB,KAAgB,OAC/B,IAAIvE,EAAaT,EAAQ,oCACrBX,EAAKgH,MAAMiS,QAAO7X,EAAau2B,EAAgBv2B,EAAYw2B,IAC/D53B,EAAK03B,cAAct2B,EAAY4lB,GAAgB,GAC/ChnB,EAAK2G,MAAM,iCAAmCqgB,EA5X9C6Q,CAAoB53B,MACI,iBAAb+M,EAAKrH,MAAkB1F,KAAKy3B,cAAc1qB,EAAKrH,MA+X5D,SAA2B3F,GACzB,IAAI83B,EAAc93B,EAAKgH,MAAM+wB,QAC7B,IAAKD,EAAa,OAClB,GAAI5lB,MAAMC,QAAQ2lB,GAAc93B,EAAKmH,UAAU2wB,QAC1C,IAAK,IAAIj2B,KAAOi2B,EAAa93B,EAAKmH,UAAU2wB,EAAYj2B,GAAMA,GAlYnEm2B,CAAkB/3B,MACd+M,EAAKuV,eAAeA,EAActiB,MAmKxC,SAASg4B,EAAcj4B,EAAMk4B,GAE3B,OADAA,EAAShyB,EAAQ6B,YAAYmwB,GACtBl4B,EAAK4G,SAASsxB,IAAWl4B,EAAK2G,MAAMuxB,IAAWl4B,EAAKy2B,WAAWyB,GA8CxE,SAASC,EAAkBn4B,EAAM+3B,EAASpuB,GACxC,IAAK,IAAIuuB,KAAUH,EAAS,CAC1B,IAAI3xB,EAAY2xB,EAAQG,GACnB9xB,EAAUT,MAAUgE,IAASA,EAAME,KAAKquB,KAC3Cl4B,EAAKmC,OAAOK,IAAI4D,EAAUgyB,iBACnBL,EAAQG,KA+FrB,SAAS/mB,EAAOrP,GAEd,OADIA,EAAO0jB,KAAKvlB,KAAKgN,OAAOqT,KAAK,qBAAsBxe,EAAO0jB,KACvD1jB,EAAOsP,GAIhB,SAAS0lB,EAAQh1B,GAEf,OADIA,EAAOsP,IAAInR,KAAKgN,OAAOqT,KAAK,oBAAqBxe,EAAOsP,IACrDtP,EAAO0jB,IAIhB,SAASuR,EAAYj1B,GACnB,GAAIA,EAAO0jB,KAAO1jB,EAAOsP,IAAMtP,EAAO0jB,KAAO1jB,EAAOsP,GAClD,MAAM,IAAIvQ,MAAM,mCAClB,OAAOiB,EAAO0jB,KAAO1jB,EAAOsP,GAuE9B,SAASinB,EAAYr4B,EAAMoR,GACzB,GAAIpR,EAAK4G,SAASwK,IAAOpR,EAAK2G,MAAMyK,GAClC,MAAM,IAAIvQ,MAAM,0BAA4BuQ,EAAK,oBAyBrD,SAASklB,KAnfT,IAAIgC,EAAgB33B,EAAQ,aACxBuF,EAAUvF,EAAQ,qBAClBuB,EAAQvB,EAAQ,WAChBkQ,EAAelQ,EAAQ,wBACvB4O,EAAkB5O,EAAQ,8BAC1BiI,EAAUjI,EAAQ,qBAClBuT,EAAQvT,EAAQ,mBAChBg3B,EAAkBh3B,EAAQ,WAC1B4hB,EAAgB5hB,EAAQ,mBACxBmI,EAAOnI,EAAQ,kBACfmN,EAAKnN,EAAQ,MAEjBhB,EAAOD,QAAUQ,EAEjBA,EAAIkC,UAAU8B,SA0Ed,SAAkBq0B,EAAc7iB,GAC9B,IAAIlO,EACJ,GAA2B,iBAAhB+wB,GAET,KADA/wB,EAAIvH,KAAK+F,UAAUuyB,IACX,MAAM,IAAI13B,MAAM,8BAAgC03B,EAAe,SAClE,CACL,IAAInyB,EAAYnG,KAAKsH,WAAWgxB,GAChC/wB,EAAIpB,EAAUlC,UAAYjE,KAAKoG,SAASD,GAG1C,IAAIqY,EAAQjX,EAAEkO,GACd,OAAiB,IAAblO,EAAE2E,OACuB,KAApBlM,KAAK+G,MAAM6Q,MAAe/J,EAAG2Q,GAASA,GAC/Cxe,KAAKsI,OAASf,EAAEe,OACTkW,IAvFTve,EAAIkC,UAAUmJ,QAkGd,SAAiBzJ,EAAQ02B,GACvB,IAAIpyB,EAAYnG,KAAKsH,WAAWzF,OAAQsF,EAAWoxB,GACnD,OAAOpyB,EAAUlC,UAAYjE,KAAKoG,SAASD,IAnG7ClG,EAAIkC,UAAU+E,UAgHd,SAAmBrF,EAAQD,EAAK42B,EAAiBD,GAC/C,GAAItmB,MAAMC,QAAQrQ,GAAQ,CACxB,IAAK,IAAIlB,EAAE,EAAGA,EAAEkB,EAAOb,OAAQL,IAAKX,KAAKkH,UAAUrF,EAAOlB,QAAIwG,EAAWqxB,EAAiBD,GAC1F,OAAOv4B,KAET,IAAImR,EAAKnR,KAAKkR,OAAOrP,GACrB,QAAWsF,IAAPgK,GAAiC,iBAANA,EAC7B,MAAM,IAAIvQ,MAAM,4BAIlB,OAHAgB,EAAMqE,EAAQ6B,YAAYlG,GAAOuP,GACjCinB,EAAYp4B,KAAM4B,GAClB5B,KAAK2G,SAAS/E,GAAO5B,KAAKsH,WAAWzF,EAAQ22B,EAAiBD,GAAO,GAC9Dv4B,MA1HTC,EAAIkC,UAAUs1B,cAuId,SAAuB51B,EAAQD,EAAK62B,GAElC,OADAz4B,KAAKkH,UAAUrF,EAAQD,EAAK62B,GAAgB,GACrCz4B,MAxITC,EAAIkC,UAAUwN,eAmJd,SAAwB9N,EAAQ62B,GAC9B,IAAI5yB,EAAUjE,EAAOiE,QACrB,QAAgBqB,IAAZrB,GAA2C,iBAAXA,EAClC,MAAM,IAAIlF,MAAM,4BAElB,KADAkF,EAAUA,GAAW9F,KAAK+G,MAAMigB,aAsBlC,SAAqBjnB,GACnB,IAAI2F,EAAO3F,EAAKgH,MAAMrB,KAMtB,OALA3F,EAAKgH,MAAMigB,YAA6B,iBAARthB,EACJ3F,EAAKmR,OAAOxL,IAASA,EACrB3F,EAAKgG,UAAUghB,GACbA,OACA5f,EACvBpH,EAAKgH,MAAMigB,YA7B6BA,CAAYhnB,OAIzD,OAFAA,KAAKgN,OAAOqT,KAAK,6BACjBrgB,KAAKsI,OAAS,MACP,EAET,IAAIqwB,EAAmB34B,KAAKoQ,SAAS7F,IACrCvK,KAAKoQ,SAAS7F,IAAiC,mBAApBouB,EACL34B,KAAK22B,qBACL32B,KAAK02B,iBAC3B,IAAIlY,EACJ,IAAMA,EAAQxe,KAAKiE,SAAS6B,EAASjE,GACrC,QAAU7B,KAAKoQ,SAAS7F,IAAMouB,EAC9B,IAAKna,GAASka,EAAiB,CAC7B,IAAI9wB,EAAU,sBAAwB5H,KAAK6P,aAC3C,GAAiC,OAA7B7P,KAAK+G,MAAM4I,eACV,MAAM,IAAI/O,MAAMgH,GADmB5H,KAAKgN,OAAOiB,MAAMrG,GAG5D,OAAO4W,GAxKTve,EAAIkC,UAAU4D,UA6Ld,SAAmBkyB,GACjB,IAAI9xB,EAAY6xB,EAAch4B,KAAMi4B,GACpC,cAAe9xB,GACb,IAAK,SAAU,OAAOA,EAAUlC,UAAYjE,KAAKoG,SAASD,GAC1D,IAAK,SAAU,OAAOnG,KAAK+F,UAAUI,GACrC,IAAK,YAAa,OAKtB,SAA4BpG,EAAMyG,GAChC,IAAIqK,EAAM5K,EAAQpE,OAAOd,KAAKhB,GAAQ8B,WAAc2E,GACpD,GAAIqK,EAAK,CACP,IAAIhP,EAASgP,EAAIhP,OACb0J,EAAOsF,EAAItF,KACX5D,EAASkJ,EAAIlJ,OACbJ,EAAI8wB,EAAct3B,KAAKhB,EAAM8B,EAAQ0J,OAAMpE,EAAWQ,GAS1D,OARA5H,EAAKy2B,WAAWhwB,GAAO,IAAIoK,GACzBpK,IAAKA,EACLoyB,UAAU,EACV/2B,OAAQA,EACR0J,KAAMA,EACN5D,OAAQA,EACR1D,SAAUsD,IAELA,GApBkBsxB,CAAmB74B,KAAMi4B,KAjMtDh4B,EAAIkC,UAAU22B,aAyOd,SAAsBR,GACpB,GAAIA,aAAwBzuB,OAG1B,OAFAquB,EAAkBl4B,KAAMA,KAAK2G,SAAU2xB,GACvCJ,EAAkBl4B,KAAMA,KAAK0G,MAAO4xB,GAC7Bt4B,KAET,cAAes4B,GACb,IAAK,YAIH,OAHAJ,EAAkBl4B,KAAMA,KAAK2G,UAC7BuxB,EAAkBl4B,KAAMA,KAAK0G,OAC7B1G,KAAKkC,OAAOM,QACLxC,KACT,IAAK,SACH,IAAImG,EAAY6xB,EAAch4B,KAAMs4B,GAIpC,OAHInyB,GAAWnG,KAAKkC,OAAOK,IAAI4D,EAAUgyB,iBAClCn4B,KAAK2G,SAAS2xB,UACdt4B,KAAK0G,MAAM4xB,GACXt4B,KACT,IAAK,SACH,IAAIi3B,EAAYj3B,KAAK+G,MAAMkwB,UACvBkB,EAAWlB,EAAYA,EAAUqB,GAAgBA,EACrDt4B,KAAKkC,OAAOK,IAAI41B,GAChB,IAAIhnB,EAAKnR,KAAKkR,OAAOonB,GACjBnnB,IACFA,EAAKlL,EAAQ6B,YAAYqJ,UAClBnR,KAAK2G,SAASwK,UACdnR,KAAK0G,MAAMyK,IAGxB,OAAOnR,MArQTC,EAAIkC,UAAUm1B,UA8Zd,SAAmBtO,EAAMjmB,GAGvB,MAFqB,iBAAVA,IAAoBA,EAAS,IAAI8G,OAAO9G,IACnD/C,KAAKoQ,SAAS4Y,GAAQjmB,EACf/C,MAhaTC,EAAIkC,UAAU0N,WAsYd,SAAoBvH,EAAQunB,GAE1B,KADAvnB,EAASA,GAAUtI,KAAKsI,QACX,MAAO,YAMpB,IAAK,IAJDywB,OAAkC5xB,KADtC0oB,EAAUA,OACckJ,UAA0B,KAAOlJ,EAAQkJ,UAC7D5hB,OAA8BhQ,IAApB0oB,EAAQ1Y,QAAwB,OAAS0Y,EAAQ1Y,QAE3D6hB,EAAO,GACFr4B,EAAE,EAAGA,EAAE2H,EAAOtH,OAAQL,IAAK,CAClC,IAAIT,EAAIoI,EAAO3H,GACXT,IAAG84B,GAAQ7hB,EAAUjX,EAAE+4B,SAAW,IAAM/4B,EAAE0H,QAAUmxB,GAE1D,OAAOC,EAAKxnB,MAAM,GAAIunB,EAAU/3B,SAhZlCf,EAAIkC,UAAUmF,WAkRd,SAAoBzF,EAAQ42B,EAAgB/yB,EAAMwzB,GAChD,GAAqB,iBAAVr3B,GAAuC,kBAAVA,EACtC,MAAM,IAAIjB,MAAM,sCAClB,IAAIq2B,EAAYj3B,KAAK+G,MAAMkwB,UACvBkB,EAAWlB,EAAYA,EAAUp1B,GAAUA,EAC3Cs3B,EAASn5B,KAAKkC,OAAOI,IAAI61B,GAC7B,GAAIgB,EAAQ,OAAOA,EAEnBD,EAAkBA,IAAgD,IAA7Bl5B,KAAK+G,MAAMqyB,cAEhD,IAAIjoB,EAAKlL,EAAQ6B,YAAY9H,KAAKkR,OAAOrP,IACrCsP,GAAM+nB,GAAiBd,EAAYp4B,KAAMmR,GAE7C,IACIkoB,EADAC,GAA6C,IAA9Bt5B,KAAK+G,MAAM4I,iBAA6B8oB,EAEvDa,KAAkBD,EAAgBloB,GAAMA,GAAMlL,EAAQ6B,YAAYjG,EAAOiE,WAC3E9F,KAAK2P,eAAe9N,GAAQ,GAE9B,IAAI2J,EAAYvF,EAAQ8M,IAAIhS,KAAKf,KAAM6B,GAEnCsE,EAAY,IAAIyK,GAClBO,GAAIA,EACJtP,OAAQA,EACR2J,UAAWA,EACX2sB,SAAUA,EACVzyB,KAAMA,IAQR,MALa,KAATyL,EAAG,IAAa+nB,IAAiBl5B,KAAK0G,MAAMyK,GAAMhL,GACtDnG,KAAKkC,OAAOE,IAAI+1B,EAAUhyB,GAEtBmzB,GAAgBD,GAAer5B,KAAK2P,eAAe9N,GAAQ,GAExDsE,GAlTTlG,EAAIkC,UAAUiE,SAuTd,SAAkBD,EAAWoF,GAgC3B,SAASE,IACP,IAAI8tB,EAAYpzB,EAAUlC,SACtB0H,EAAS4tB,EAAU3tB,MAAM,KAAMC,WAEnC,OADAJ,EAAanD,OAASixB,EAAUjxB,OACzBqD,EAnCT,GAAIxF,EAAU+J,UAOZ,OANA/J,EAAUlC,SAAWwH,EACrBA,EAAa5J,OAASsE,EAAUtE,OAChC4J,EAAanD,OAAS,KACtBmD,EAAaF,KAAOA,GAAcE,GACF,IAA5BtF,EAAUtE,OAAOqK,SACnBT,EAAaS,QAAS,GACjBT,EAETtF,EAAU+J,WAAY,EAEtB,IAAIspB,EACArzB,EAAUT,OACZ8zB,EAAcx5B,KAAK+G,MACnB/G,KAAK+G,MAAQ/G,KAAKk3B,WAGpB,IAAI3vB,EACJ,IAAMA,EAAI8wB,EAAct3B,KAAKf,KAAMmG,EAAUtE,OAAQ0J,EAAMpF,EAAUqF,WACrE,QACErF,EAAU+J,WAAY,EAClB/J,EAAUT,OAAM1F,KAAK+G,MAAQyyB,GAOnC,OAJArzB,EAAUlC,SAAWsD,EACrBpB,EAAU+H,KAAO3G,EAAE2G,KACnB/H,EAAU+G,OAAS3F,EAAE2F,OACrB/G,EAAUoF,KAAOhE,EAAEgE,KACZhE,GAlVTtH,EAAIkC,UAAUsD,aAAe/E,EAAQ,mBACrC,IAAI+4B,EAAgB/4B,EAAQ,aAC5BT,EAAIkC,UAAU+kB,WAAauS,EAAcjT,IACzCvmB,EAAIkC,UAAUu3B,WAAaD,EAAcn3B,IACzCrC,EAAIkC,UAAUw3B,cAAgBF,EAAc7S,OAE5C,IAAIna,EAAe/L,EAAQ,2BAC3BT,EAAI+N,gBAAkBvB,EAAapE,WACnCpI,EAAIoG,gBAAkBoG,EAAajF,WACnCvH,EAAIy3B,gBAAkBA,EAEtB,IAAI3Q,EAAiB,yCAEjBqQ,GAAwB,mBAAoB,cAAe,eAC3DO,GAAqB,iBA4ctBiC,UAAU,EAAEC,UAAU,EAAEC,YAAY,EAAEC,kBAAkB,EAAEC,0BAA0B,EAAEC,oBAAoB,EAAEC,oBAAoB,EAAEC,kBAAkB,EAAEC,uBAAuB,GAAGC,iBAAiB,GAAGC,YAAY,GAAGC,kBAAkB,GAAGC,oBAAoB,GAAGC,mCAAmC,GAAG5sB,GAAK,GAAG6C,6BAA6B,YA/qO8B,CA+qOjB","file":"ajv.min.js"} \ No newline at end of file diff --git a/appasar/canary/node_modules/ajv/dist/nodent.min.js b/appasar/canary/node_modules/ajv/dist/nodent.min.js new file mode 100644 index 0000000..3300055 --- /dev/null +++ b/appasar/canary/node_modules/ajv/dist/nodent.min.js @@ -0,0 +1,2 @@ +/* nodent 3.1.5: NoDent - Asynchronous Javascript language extensions */ +require=function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){t.exports=function(t){switch(parseInt(t.version)){case 2:case 3:t.plugins.asyncawait=e("./acorn-v3");break;case 4:case 5:t.plugins.asyncawait=e("./acorn-v4");break;default:throw new Error("acorn-es7-plugin requires Acorn v2, 3, 4 or 5")}return t}},{"./acorn-v3":2,"./acorn-v4":3}],2:[function(e,t,n){function r(e,t){return e.lineStart>=t}function i(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(l,"$1 $3")),e.test(r)}function s(e,t,n,r){var i=new e.constructor(e.options,e.input,t);if(n)for(var s in n)i[s]=n[s];var o=e,a=i;return["inFunction","inAsyncFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in o&&(a[e]=o[e])}),r&&(i.options.preserveParens=!0),i.nextToken(),i}var o={},a=/^async[\t ]+(return|throw)/,u=/^async[\t ]+function/,c=/^\s*[():;]/,l=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g,p=/\s*(get|set)\s*\(/;t.exports=function(e,t){var n=function(){};e.extend("initialContext",function(r){return function(){return this.options.ecmaVersion<7&&(n=function(t){e.raise(t.start,"async/await keywords only available when ecmaVersion>=7")}),this.reservedWords=new RegExp(this.reservedWords.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrict=new RegExp(this.reservedWordsStrict.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrictBind=new RegExp(this.reservedWordsStrictBind.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.inAsyncFunction=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),r.apply(this,arguments)}}),e.extend("shouldParseExportStatement",function(e){return function(){return!("name"!==this.type.label||"async"!==this.value||!i(u,this))||e.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,o=this.startLoc;if("name"===this.type.label)if(i(u,this,!0)){var c=this.inAsyncFunction;try{return this.inAsyncFunction=!0,this.next(),(l=this.parseStatement(n,r)).async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}finally{this.inAsyncFunction=c}}else if("object"==typeof t&&t.asyncExits&&i(a,this)){this.next();var l;return(l=this.parseStatement(n,r)).async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(t){var n=e.apply(this,arguments);return this.inAsyncFunction&&"await"===n.name&&0===arguments.length&&this.raise(n.start,"'await' is reserved within async functions"),n}}),e.extend("parseExprAtom",function(e){return function(i){var a,u=this.start,l=this.startLoc,p=e.apply(this,arguments);if("Identifier"===p.type)if("async"!==p.name||r(this,p.end)){if("await"===p.name){var h=this.startNodeAt(p.start,p.loc&&p.loc.start);if(this.inAsyncFunction)return a=this.parseExprSubscripts(),h.operator="await",h.argument=a,h=this.finishNodeAt(h,"AwaitExpression",a.end,a.loc&&a.loc.end),n(h),h;if(this.input.slice(p.end).match(c))return t.awaitAnywhere||"module"!==this.options.sourceType?p:this.raise(p.start,"'await' is reserved within modules");if("object"==typeof t&&t.awaitAnywhere&&(u=this.start,(a=s(this,u-4).parseExprSubscripts()).end<=u))return a=s(this,u).parseExprSubscripts(),h.operator="await",h.argument=a,h=this.finishNodeAt(h,"AwaitExpression",a.end,a.loc&&a.loc.end),this.pos=a.end,this.end=a.end,this.endLoc=a.endLoc,this.next(),n(h),h;if(!t.awaitAnywhere&&"module"===this.options.sourceType)return this.raise(p.start,"'await' is reserved within modules")}}else{var f=this.inAsyncFunction;try{this.inAsyncFunction=!0;var d=this,y=!1,m={parseFunctionBody:function(e,t){try{var n=y;return y=!0,d.parseFunctionBody.apply(this,arguments)}finally{y=n}},raise:function(){try{return d.raise.apply(this,arguments)}catch(e){throw y?e:o}}};if("SequenceExpression"===(a=s(this,this.start,m,!0).parseExpression()).type&&(a=a.expressions[0]),"CallExpression"===a.type&&(a=a.callee),"FunctionExpression"===a.type||"FunctionDeclaration"===a.type||"ArrowFunctionExpression"===a.type)return"SequenceExpression"===(a=s(this,this.start,m).parseExpression()).type&&(a=a.expressions[0]),"CallExpression"===a.type&&(a=a.callee),a.async=!0,a.start=u,a.loc&&(a.loc.start=l),a.range&&(a.range[0]=u),this.pos=a.end,this.end=a.end,this.endLoc=a.endLoc,this.next(),n(a),a}catch(e){if(e!==o)throw e}finally{this.inAsyncFunction=f}}return p}}),e.extend("finishNodeAt",function(e){return function(t,n,r,i){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}}),e.extend("finishNode",function(e){return function(t,n){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}}),e.extend("parsePropertyName",function(e){return function(t){t.key&&t.key.name;var i=e.apply(this,arguments);return"Identifier"!==i.type||"async"!==i.name||r(this,i.end)||this.input.slice(i.end).match(c)||(p.test(this.input.slice(i.end))?(i=e.apply(this,arguments),t.__asyncValue=!0):(n(t),"set"===t.kind&&this.raise(i.start,"'set <member>(value)' cannot be be async"),"Identifier"===(i=e.apply(this,arguments)).type&&"set"===i.name&&this.raise(i.start,"'set <member>(value)' cannot be be async"),t.__asyncValue=!0)),i}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i;n.__asyncValue&&("constructor"===n.kind&&this.raise(n.start,"class constructor() cannot be be async"),i=this.inAsyncFunction,this.inAsyncFunction=!0);var s=e.apply(this,arguments);return this.inAsyncFunction=i,s}}),e.extend("parseMethod",function(e){return function(t){var n;this.__currentProperty&&this.__currentProperty.__asyncValue&&(n=this.inAsyncFunction,this.inAsyncFunction=!0);var r=e.apply(this,arguments);return this.inAsyncFunction=n,r}}),e.extend("parsePropertyValue",function(e){return function(t,n,r,i,s,o){var a=this.__currentProperty;this.__currentProperty=t;var u;t.__asyncValue&&(u=this.inAsyncFunction,this.inAsyncFunction=!0);var c=e.apply(this,arguments);return this.inAsyncFunction=u,this.__currentProperty=a,c}})}},{}],3:[function(e,t,n){function r(e,t,n){var r=new e.constructor(e.options,e.input,t);if(n)for(var i in n)r[i]=n[i];var s=e,o=r;return["inFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in s&&(o[e]=s[e])}),r.nextToken(),r}var i=/^async[\t ]+(return|throw)/,s=/^\s*[):;]/,o=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g;t.exports=function(e,t){t&&"object"==typeof t||(t={}),e.extend("parse",function(n){return function(){return this.inAsync=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),n.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,a=this.startLoc;if("name"===this.type.label&&t.asyncExits&&function(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(o,"$1 $3")),e.test(r)}(i,this)){this.next();var u=this.parseStatement(n,r);return u.async=!0,u.start=s,u.loc&&(u.loc.start=a),u.range&&(u.range[0]=s),u}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(n){return"module"===this.options.sourceType&&this.options.ecmaVersion>=8&&t.awaitAnywhere?e.call(this,!0):e.apply(this,arguments)}}),e.extend("parseExprAtom",function(e){var n={};return function(i){var s,o=this.start,a=(this.startLoc,e.apply(this,arguments));if("Identifier"===a.type&&"await"===a.name&&!this.inAsync&&t.awaitAnywhere){var u=this.startNodeAt(a.start,a.loc&&a.loc.start);o=this.start;var c={raise:function(){try{return pp.raise.apply(this,arguments)}catch(e){throw n}}};try{if((s=r(this,o-4,c).parseExprSubscripts()).end<=o)return s=r(this,o,c).parseExprSubscripts(),u.argument=s,u=this.finishNodeAt(u,"AwaitExpression",s.end,s.loc&&s.loc.end),this.pos=s.end,this.end=s.end,this.endLoc=s.endLoc,this.next(),u}catch(e){if(e===n)return a;throw e}}return a}});var n={undefined:!0,get:!0,set:!0,static:!0,async:!0,constructor:!0};e.extend("parsePropertyName",function(e){return function(t){var r=t.key&&t.key.name,i=e.apply(this,arguments);return"get"===this.value&&(t.__maybeStaticAsyncGetter=!0),n[this.value]?i:("Identifier"!==i.type||"async"!==i.name&&"async"!==r||function(e,t){return e.lineStart>=t}(this,i.end)||this.input.slice(i.end).match(s)?delete t.__maybeStaticAsyncGetter:"set"===t.kind||"set"===i.name?this.raise(i.start,"'set <member>(value)' cannot be be async"):(this.__isAsyncProp=!0,"Identifier"===(i=e.apply(this,arguments)).type&&"set"===i.name&&this.raise(i.start,"'set <member>(value)' cannot be be async")),i)}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i=e.apply(this,arguments);return n.__maybeStaticAsyncGetter&&(delete n.__maybeStaticAsyncGetter,"get"!==n.key.name&&(n.kind="get")),i}}),e.extend("parseFunctionBody",function(e){return function(t,n){var r=this.inAsync;this.__isAsyncProp&&(t.async=!0,this.inAsync=!0,delete this.__isAsyncProp);var i=e.apply(this,arguments);return this.inAsync=r,i}})}},{}],4:[function(e,t,n){!function(e,r){"object"==typeof n&&void 0!==t?r(n):"function"==typeof define&&define.amd?define(["exports"],r):r(e.acorn=e.acorn||{})}(this,function(e){"use strict";function t(e,t){for(var n=65536,r=0;r<t.length;r+=2){if((n+=t[r])>e)return!1;if((n+=t[r+1])>=e)return!0}}function n(e,n){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&x.test(String.fromCharCode(e)):!1!==n&&t(e,E)))}function r(e,n){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&w.test(String.fromCharCode(e)):!1!==n&&(t(e,E)||t(e,S)))))}function i(e,t){return new k(e,{beforeExpr:!0,binop:t})}function s(e,t){return void 0===t&&(t={}),t.keyword=e,_[e]=new k(e,t)}function o(e){return 10===e||13===e||8232===e||8233===e}function a(e,t){return $.call(e,t)}function u(e,t){for(var n=1,r=0;;){T.lastIndex=r;var i=T.exec(e);if(!(i&&i.index<t))return new I(n,t-r);++n,r=i.index+i[0].length}}function c(e){var t={};for(var n in D)t[n]=e&&a(e,n)?e[n]:D[n];if(t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),R(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return R(t.onComment)&&(t.onComment=function(e,t){return function(n,r,i,s,o,a){var u={type:n?"Block":"Line",value:r,start:i,end:s};e.locations&&(u.loc=new j(this,o,a)),e.ranges&&(u.range=[i,s]),t.push(u)}}(t,t.onComment)),t}function l(e){return new RegExp("^(?:"+e.replace(/ /g,"|")+")$")}function p(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=-1}function h(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}function f(e,t,n,r){try{return new RegExp(e,t)}catch(e){if(void 0!==n)throw e instanceof SyntaxError&&r.raise(n,"Error parsing regular expression: "+e.message),e}}function d(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var y={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},m="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",g={5:m,6:m+" const class extends export import super"},v="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",b="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",x=new RegExp("["+v+"]"),w=new RegExp("["+v+b+"]");v=b=null;var E=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],S=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],k=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null},A={beforeExpr:!0},C={startsExpr:!0},_={},L={num:new k("num",C),regexp:new k("regexp",C),string:new k("string",C),name:new k("name",C),eof:new k("eof"),bracketL:new k("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new k("]"),braceL:new k("{",{beforeExpr:!0,startsExpr:!0}),braceR:new k("}"),parenL:new k("(",{beforeExpr:!0,startsExpr:!0}),parenR:new k(")"),comma:new k(",",A),semi:new k(";",A),colon:new k(":",A),dot:new k("."),question:new k("?",A),arrow:new k("=>",A),template:new k("template"),invalidTemplate:new k("invalidTemplate"),ellipsis:new k("...",A),backQuote:new k("`",C),dollarBraceL:new k("${",{beforeExpr:!0,startsExpr:!0}),eq:new k("=",{beforeExpr:!0,isAssign:!0}),assign:new k("_=",{beforeExpr:!0,isAssign:!0}),incDec:new k("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new k("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=/===/!==",6),relational:i("</>/<=/>=",7),bitShift:i("<</>>/>>>",8),plusMin:new k("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),starstar:new k("**",{beforeExpr:!0}),_break:s("break"),_case:s("case",A),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",A),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",A),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",C),_if:s("if"),_return:s("return",A),_switch:s("switch"),_throw:s("throw",A),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",C),_super:s("super",C),_class:s("class",C),_extends:s("extends",A),_export:s("export"),_import:s("import"),_null:s("null",C),_true:s("true",C),_false:s("false",C),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},O=/\r\n?|\n|\u2028|\u2029/,T=new RegExp(O.source,"g"),N=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,P=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,F=Object.prototype,$=F.hasOwnProperty,B=F.toString,R=Array.isArray||function(e){return"[object Array]"===B.call(e)},I=function(e,t){this.line=e,this.column=t};I.prototype.offset=function(e){return new I(this.line,this.column+e)};var j=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)},D={ecmaVersion:7,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1,plugins:{}},M={},V=function(e,t,n){this.options=e=c(e),this.sourceFile=e.sourceFile,this.keywords=l(g[e.ecmaVersion>=6?6:5]);var r="";if(!e.allowReserved){for(var i=e.ecmaVersion;!(r=y[i]);i--);"module"==e.sourceType&&(r+=" await")}this.reservedWords=l(r);var s=(r?r+" ":"")+y.strict;this.reservedWordsStrict=l(s),this.reservedWordsStrictBind=l(s+" "+y.strictBind),this.input=String(t),this.containsEsc=!1,this.loadPlugins(e.plugins),n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(O).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=L.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.inFunction=this.inGenerator=this.inAsync=!1,this.yieldPos=this.awaitPos=0,this.labels=[],0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterFunctionScope()};V.prototype.isKeyword=function(e){return this.keywords.test(e)},V.prototype.isReservedWord=function(e){return this.reservedWords.test(e)},V.prototype.extend=function(e,t){this[e]=t(this[e])},V.prototype.loadPlugins=function(e){for(var t in e){var n=M[t];if(!n)throw new Error("Plugin '"+t+"' not found");n(this,e[t])}},V.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};var q=V.prototype,U=/^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/;q.strictDirective=function(e){for(;;){P.lastIndex=e,e+=P.exec(this.input)[0].length;var t=U.exec(this.input.slice(e));if(!t)return!1;if("use strict"==(t[1]||t[2]))return!0;e+=t[0].length}},q.eat=function(e){return this.type===e&&(this.next(),!0)},q.isContextual=function(e){return this.type===L.name&&this.value===e},q.eatContextual=function(e){return this.value===e&&this.eat(L.name)},q.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},q.canInsertSemicolon=function(){return this.type===L.eof||this.type===L.braceR||O.test(this.input.slice(this.lastTokEnd,this.start))},q.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},q.semicolon=function(){this.eat(L.semi)||this.insertSemicolon()||this.unexpected()},q.afterTrailingComma=function(e,t){if(this.type==e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},q.expect=function(e){this.eat(e)||this.unexpected()},q.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")},q.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,"Parenthesized pattern")}},q.checkExpressionErrors=function(e,t){var n=e?e.shorthandAssign:-1;if(!t)return n>=0;n>-1&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns")},q.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},q.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var z=V.prototype;z.parseTopLevel=function(e){var t={};for(e.body||(e.body=[]);this.type!==L.eof;){var n=this.parseStatement(!0,!0,t);e.body.push(n)}return this.adaptDirectivePrologue(e.body),this.next(),this.options.ecmaVersion>=6&&(e.sourceType=this.options.sourceType),this.finishNode(e,"Program")};var W={kind:"loop"},G={kind:"switch"};z.isLet=function(){if(this.type!==L.name||this.options.ecmaVersion<6||"let"!=this.value)return!1;P.lastIndex=this.pos;var e=P.exec(this.input),t=this.pos+e[0].length,i=this.input.charCodeAt(t);if(91===i||123==i)return!0;if(n(i,!0)){for(var s=t+1;r(this.input.charCodeAt(s),!0);)++s;var o=this.input.slice(t,s);if(!this.isKeyword(o))return!0}return!1},z.isAsyncFunction=function(){if(this.type!==L.name||this.options.ecmaVersion<8||"async"!=this.value)return!1;P.lastIndex=this.pos;var e=P.exec(this.input),t=this.pos+e[0].length;return!(O.test(this.input.slice(this.pos,t))||"function"!==this.input.slice(t,t+8)||t+8!=this.input.length&&r(this.input.charAt(t+8)))},z.parseStatement=function(e,t,n){var r,i=this.type,s=this.startNode();switch(this.isLet()&&(i=L._var,r="let"),i){case L._break:case L._continue:return this.parseBreakContinueStatement(s,i.keyword);case L._debugger:return this.parseDebuggerStatement(s);case L._do:return this.parseDoStatement(s);case L._for:return this.parseForStatement(s);case L._function:return!e&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1);case L._class:return e||this.unexpected(),this.parseClass(s,!0);case L._if:return this.parseIfStatement(s);case L._return:return this.parseReturnStatement(s);case L._switch:return this.parseSwitchStatement(s);case L._throw:return this.parseThrowStatement(s);case L._try:return this.parseTryStatement(s);case L._const:case L._var:return r=r||this.value,e||"var"==r||this.unexpected(),this.parseVarStatement(s,r);case L._while:return this.parseWhileStatement(s);case L._with:return this.parseWithStatement(s);case L.braceL:return this.parseBlock();case L.semi:return this.parseEmptyStatement(s);case L._export:case L._import:return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===L._import?this.parseImport(s):this.parseExport(s,n);default:if(this.isAsyncFunction()&&e)return this.next(),this.parseFunctionStatement(s,!0);var o=this.value,a=this.parseExpression();return i===L.name&&"Identifier"===a.type&&this.eat(L.colon)?this.parseLabeledStatement(s,o,a):this.parseExpressionStatement(s,a)}},z.parseBreakContinueStatement=function(e,t){var n="break"==t;this.next(),this.eat(L.semi)||this.insertSemicolon()?e.label=null:this.type!==L.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if(null==e.label||i.name===e.label.name){if(null!=i.kind&&(n||"loop"===i.kind))break;if(e.label&&n)break}}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,n?"BreakStatement":"ContinueStatement")},z.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},z.parseDoStatement=function(e){return this.next(),this.labels.push(W),e.body=this.parseStatement(!1),this.labels.pop(),this.expect(L._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(L.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},z.parseForStatement=function(e){if(this.next(),this.labels.push(W),this.enterLexicalScope(),this.expect(L.parenL),this.type===L.semi)return this.parseFor(e,null);var t=this.isLet();if(this.type===L._var||this.type===L._const||t){var n=this.startNode(),r=t?"let":this.value;return this.next(),this.parseVar(n,!0,r),this.finishNode(n,"VariableDeclaration"),!(this.type===L._in||this.options.ecmaVersion>=6&&this.isContextual("of"))||1!==n.declarations.length||"var"!==r&&n.declarations[0].init?this.parseFor(e,n):this.parseForIn(e,n)}var i=new p,s=this.parseExpression(!0,i);return this.type===L._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.toAssignable(s),this.checkLVal(s),this.checkPatternErrors(i,!0),this.parseForIn(e,s)):(this.checkExpressionErrors(i,!0),this.parseFor(e,s))},z.parseFunctionStatement=function(e,t){return this.next(),this.parseFunction(e,!0,!1,t)},z.isFunction=function(){return this.type===L._function||this.isAsyncFunction()},z.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!this.strict&&this.isFunction()),e.alternate=this.eat(L._else)?this.parseStatement(!this.strict&&this.isFunction()):null,this.finishNode(e,"IfStatement")},z.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(L.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},z.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(L.braceL),this.labels.push(G),this.enterLexicalScope();for(var t,n=!1;this.type!=L.braceR;)if(this.type===L._case||this.type===L._default){var r=this.type===L._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,t.test=null),this.expect(L.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(!0));return this.exitLexicalScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},z.parseThrowStatement=function(e){return this.next(),O.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var J=[];z.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===L._catch){var t=this.startNode();this.next(),this.expect(L.parenL),t.param=this.parseBindingAtom(),this.enterLexicalScope(),this.checkLVal(t.param,"let"),this.expect(L.parenR),t.body=this.parseBlock(!1),this.exitLexicalScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(L._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},z.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},z.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(W),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"WhileStatement")},z.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},z.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},z.parseLabeledStatement=function(e,t,n){for(var r=0,i=this.labels;r<i.length;r+=1){i[r].name===t&&this.raise(n.start,"Label '"+t+"' is already declared")}for(var s=this.type.isLoop?"loop":this.type===L._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var a=this.labels[o];if(a.statementStart!=e.start)break;a.statementStart=this.start,a.kind=s}return this.labels.push({name:t,kind:s,statementStart:this.start}),e.body=this.parseStatement(!0),("ClassDeclaration"==e.body.type||"VariableDeclaration"==e.body.type&&"var"!=e.body.kind||"FunctionDeclaration"==e.body.type&&(this.strict||e.body.generator))&&this.raiseRecoverable(e.body.start,"Invalid labeled declaration"),this.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},z.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},z.parseBlock=function(e){void 0===e&&(e=!0);var t=this.startNode();for(t.body=[],this.expect(L.braceL),e&&this.enterLexicalScope();!this.eat(L.braceR);){var n=this.parseStatement(!0);t.body.push(n)}return e&&this.exitLexicalScope(),this.finishNode(t,"BlockStatement")},z.parseFor=function(e,t){return e.init=t,this.expect(L.semi),e.test=this.type===L.semi?null:this.parseExpression(),this.expect(L.semi),e.update=this.type===L.parenR?null:this.parseExpression(),this.expect(L.parenR),this.exitLexicalScope(),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"ForStatement")},z.parseForIn=function(e,t){var n=this.type===L._in?"ForInStatement":"ForOfStatement";return this.next(),e.left=t,e.right=this.parseExpression(),this.expect(L.parenR),this.exitLexicalScope(),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,n)},z.parseVar=function(e,t,n){for(e.declarations=[],e.kind=n;;){var r=this.startNode();if(this.parseVarId(r,n),this.eat(L.eq)?r.init=this.parseMaybeAssign(t):"const"!==n||this.type===L._in||this.options.ecmaVersion>=6&&this.isContextual("of")?"Identifier"==r.id.type||t&&(this.type===L._in||this.isContextual("of"))?r.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(L.comma))break}return e},z.parseVarId=function(e,t){e.id=this.parseBindingAtom(t),this.checkLVal(e.id,t,!1)},z.parseFunction=function(e,t,n,r){this.initFunction(e),this.options.ecmaVersion>=6&&!r&&(e.generator=this.eat(L.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&&(e.id="nullableID"===t&&this.type!=L.name?null:this.parseIdent(),e.id&&this.checkLVal(e.id,"var"));var i=this.inGenerator,s=this.inAsync,o=this.yieldPos,a=this.awaitPos,u=this.inFunction;return this.inGenerator=e.generator,this.inAsync=e.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),t||(e.id=this.type==L.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n),this.inGenerator=i,this.inAsync=s,this.yieldPos=o,this.awaitPos=a,this.inFunction=u,this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},z.parseFunctionParams=function(e){this.expect(L.parenL),e.params=this.parseBindingList(L.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},z.parseClass=function(e,t){this.next(),this.parseClassId(e,t),this.parseClassSuper(e);var n=this.startNode(),r=!1;for(n.body=[],this.expect(L.braceL);!this.eat(L.braceR);)if(!this.eat(L.semi)){var i=this.startNode(),s=this.eat(L.star),o=!1,a=this.type===L.name&&"static"===this.value;this.parsePropertyName(i),i.static=a&&this.type!==L.parenL,i.static&&(s&&this.unexpected(),s=this.eat(L.star),this.parsePropertyName(i)),this.options.ecmaVersion>=8&&!s&&!i.computed&&"Identifier"===i.key.type&&"async"===i.key.name&&this.type!==L.parenL&&!this.canInsertSemicolon()&&(o=!0,this.parsePropertyName(i)),i.kind="method";var u=!1;if(!i.computed){var c=i.key;s||o||"Identifier"!==c.type||this.type===L.parenL||"get"!==c.name&&"set"!==c.name||(u=!0,i.kind=c.name,c=this.parsePropertyName(i)),!i.static&&("Identifier"===c.type&&"constructor"===c.name||"Literal"===c.type&&"constructor"===c.value)&&(r&&this.raise(c.start,"Duplicate constructor in the same class"),u&&this.raise(c.start,"Constructor can't have get/set modifier"),s&&this.raise(c.start,"Constructor can't be a generator"),o&&this.raise(c.start,"Constructor can't be an async method"),i.kind="constructor",r=!0)}if(this.parseClassMethod(n,i,s,o),u){var l="get"===i.kind?0:1;if(i.value.params.length!==l){var p=i.value.start;"get"===i.kind?this.raiseRecoverable(p,"getter should have no params"):this.raiseRecoverable(p,"setter should have exactly one param")}else"set"===i.kind&&"RestElement"===i.value.params[0].type&&this.raiseRecoverable(i.value.params[0].start,"Setter cannot use rest params")}}return e.body=this.finishNode(n,"ClassBody"),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},z.parseClassMethod=function(e,t,n,r){t.value=this.parseMethod(n,r),e.body.push(this.finishNode(t,"MethodDefinition"))},z.parseClassId=function(e,t){e.id=this.type===L.name?this.parseIdent():!0===t?this.unexpected():null},z.parseClassSuper=function(e){e.superClass=this.eat(L._extends)?this.parseExprSubscripts():null},z.parseExport=function(e,t){if(this.next(),this.eat(L.star))return this.expectContextual("from"),e.source=this.type===L.string?this.parseExprAtom():this.unexpected(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration");if(this.eat(L._default)){this.checkExport(t,"default",this.lastTokStart);var n;if(this.type===L._function||(n=this.isAsyncFunction())){var r=this.startNode();this.next(),n&&this.next(),e.declaration=this.parseFunction(r,"nullableID",!1,n)}else if(this.type===L._class){var i=this.startNode();e.declaration=this.parseClass(i,"nullableID")}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(!0),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id.name,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))e.source=this.type===L.string?this.parseExprAtom():this.unexpected();else{for(var s=0,o=e.specifiers;s<o.length;s+=1){var a=o[s];this.checkUnreserved(a.local)}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},z.checkExport=function(e,t,n){e&&(a(e,t)&&this.raiseRecoverable(n,"Duplicate export '"+t+"'"),e[t]=!0)},z.checkPatternExport=function(e,t){var n=t.type;if("Identifier"==n)this.checkExport(e,t.name,t.start);else if("ObjectPattern"==n)for(var r=0,i=t.properties;r<i.length;r+=1){var s=i[r];this.checkPatternExport(e,s.value)}else if("ArrayPattern"==n)for(var o=0,a=t.elements;o<a.length;o+=1){var u=a[o];u&&this.checkPatternExport(e,u)}else"AssignmentPattern"==n?this.checkPatternExport(e,t.left):"ParenthesizedExpression"==n&&this.checkPatternExport(e,t.expression)},z.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},z.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},z.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(L.braceL);!this.eat(L.braceR);){if(n)n=!1;else if(this.expect(L.comma),this.afterTrailingComma(L.braceR))break;var r=this.startNode();r.local=this.parseIdent(!0),r.exported=this.eatContextual("as")?this.parseIdent(!0):r.local,this.checkExport(e,r.exported.name,r.exported.start),t.push(this.finishNode(r,"ExportSpecifier"))}return t},z.parseImport=function(e){return this.next(),this.type===L.string?(e.specifiers=J,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===L.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},z.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===L.name){var n=this.startNode();if(n.local=this.parseIdent(),this.checkLVal(n.local,"let"),e.push(this.finishNode(n,"ImportDefaultSpecifier")),!this.eat(L.comma))return e}if(this.type===L.star){var r=this.startNode();return this.next(),this.expectContextual("as"),r.local=this.parseIdent(),this.checkLVal(r.local,"let"),e.push(this.finishNode(r,"ImportNamespaceSpecifier")),e}for(this.expect(L.braceL);!this.eat(L.braceR);){if(t)t=!1;else if(this.expect(L.comma),this.afterTrailingComma(L.braceR))break;var i=this.startNode();i.imported=this.parseIdent(!0),this.eatContextual("as")?i.local=this.parseIdent():(this.checkUnreserved(i.imported),i.local=i.imported),this.checkLVal(i.local,"let"),e.push(this.finishNode(i,"ImportSpecifier"))}return e},z.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},z.isDirectiveCandidate=function(e){return"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var H=V.prototype;H.toAssignable=function(e,t){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Can not use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var n=0,r=e.properties;n<r.length;n+=1){var i=r[n];"init"!==i.kind&&this.raise(i.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(i.value,t)}break;case"ArrayExpression":e.type="ArrayPattern",this.toAssignableList(e.elements,t);break;case"AssignmentExpression":if("="!==e.operator){this.raise(e.left.end,"Only '=' operator can be used for specifying default value.");break}e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);case"AssignmentPattern":break;case"ParenthesizedExpression":this.toAssignable(e.expression,t);break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}return e},H.toAssignableList=function(e,t){var n=e.length;if(n){var r=e[n-1];if(r&&"RestElement"==r.type)--n;else if(r&&"SpreadElement"==r.type){r.type="RestElement";var i=r.argument;this.toAssignable(i,t),--n}6===this.options.ecmaVersion&&t&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}for(var s=0;s<n;s++){var o=e[s];o&&this.toAssignable(o,t)}return e},H.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},H.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==L.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},H.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case L.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(L.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case L.braceL:return this.parseObj(!0)}return this.parseIdent()},H.parseBindingList=function(e,t,n){for(var r=[],i=!0;!this.eat(e);)if(i?i=!1:this.expect(L.comma),t&&this.type===L.comma)r.push(null);else{if(n&&this.afterTrailingComma(e))break;if(this.type===L.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),r.push(s),this.type===L.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}var o=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(o),r.push(o)}return r},H.parseBindingListItem=function(e){return e},H.parseMaybeDefault=function(e,t,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(L.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},H.checkLVal=function(e,t,n){switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(t?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(a(n,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),n[e.name]=!0),t&&"none"!==t&&(("var"===t&&!this.canDeclareVarName(e.name)||"var"!==t&&!this.canDeclareLexicalName(e.name))&&this.raiseRecoverable(e.start,"Identifier '"+e.name+"' has already been declared"),"var"===t?this.declareVarName(e.name):this.declareLexicalName(e.name));break;case"MemberExpression":t&&this.raiseRecoverable(e.start,(t?"Binding":"Assigning to")+" member expression");break;case"ObjectPattern":for(var r=0,i=e.properties;r<i.length;r+=1){var s=i[r];this.checkLVal(s.value,t,n)}break;case"ArrayPattern":for(var o=0,u=e.elements;o<u.length;o+=1){var c=u[o];c&&this.checkLVal(c,t,n)}break;case"AssignmentPattern":this.checkLVal(e.left,t,n);break;case"RestElement":this.checkLVal(e.argument,t,n);break;case"ParenthesizedExpression":this.checkLVal(e.expression,t,n);break;default:this.raise(e.start,(t?"Binding":"Assigning to")+" rvalue")}};var Y=V.prototype;Y.checkPropClash=function(e,t){if(!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n,r=e.key;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var i=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===n&&"init"===i&&(t.proto&&this.raiseRecoverable(r.start,"Redefinition of __proto__ property"),t.proto=!0);else{var s=t[n="$"+n];if(s){("init"===i?this.strict&&s.init||s.get||s.set:s.init||s[i])&&this.raiseRecoverable(r.start,"Redefinition of property")}else s=t[n]={init:!1,get:!1,set:!1};s[i]=!0}}},Y.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===L.comma){var s=this.startNodeAt(n,r);for(s.expressions=[i];this.eat(L.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(s,"SequenceExpression")}return i},Y.parseMaybeAssign=function(e,t,n){if(this.inGenerator&&this.isContextual("yield"))return this.parseYield();var r=!1,i=-1,s=-1;t?(i=t.parenthesizedAssign,s=t.trailingComma,t.parenthesizedAssign=t.trailingComma=-1):(t=new p,r=!0);var o=this.start,a=this.startLoc;this.type!=L.parenL&&this.type!=L.name||(this.potentialArrowAt=this.start);var u=this.parseMaybeConditional(e,t);if(n&&(u=n.call(this,u,o,a)),this.type.isAssign){this.checkPatternErrors(t,!0),r||p.call(t);var c=this.startNodeAt(o,a);return c.operator=this.value,c.left=this.type===L.eq?this.toAssignable(u):u,t.shorthandAssign=-1,this.checkLVal(u),this.next(),c.right=this.parseMaybeAssign(e),this.finishNode(c,"AssignmentExpression")}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),s>-1&&(t.trailingComma=s),u},Y.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(L.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(L.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return i},Y.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1);return this.checkExpressionErrors(t)?i:i.start==n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,r,-1,e)},Y.parseExprOp=function(e,t,n,r,i){var s=this.type.binop;if(null!=s&&(!i||this.type!==L._in)&&s>r){var o=this.type===L.logicalOR||this.type===L.logicalAND,a=this.value;this.next();var u=this.start,c=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1),u,c,s,i),p=this.buildBinary(t,n,e,l,a,o);return this.parseExprOp(p,t,n,r,i)}return e},Y.buildBinary=function(e,t,n,r,i,s){var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")},Y.parseMaybeUnary=function(e,t){var n,r=this.start,i=this.startLoc;if(this.inAsync&&this.isContextual("await"))n=this.parseAwait(),t=!0;else if(this.type.prefix){var s=this.startNode(),o=this.type===L.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),o?this.checkLVal(s.argument):this.strict&&"delete"===s.operator&&"Identifier"===s.argument.type?this.raiseRecoverable(s.start,"Deleting local variable in strict mode"):t=!0,n=this.finishNode(s,o?"UpdateExpression":"UnaryExpression")}else{if(n=this.parseExprSubscripts(e),this.checkExpressionErrors(e))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var a=this.startNodeAt(r,i);a.operator=this.value,a.prefix=!1,a.argument=n,this.checkLVal(n),this.next(),n=this.finishNode(a,"UpdateExpression")}}return!t&&this.eat(L.starstar)?this.buildBinary(r,i,n,this.parseMaybeUnary(null,!1),"**",!1):n},Y.parseExprSubscripts=function(e){var t=this.start,n=this.startLoc,r=this.parseExprAtom(e),i="ArrowFunctionExpression"===r.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd);if(this.checkExpressionErrors(e)||i)return r;var s=this.parseSubscripts(r,t,n);return e&&"MemberExpression"===s.type&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1)),s},Y.parseSubscripts=function(e,t,n,r){for(var i=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd==e.end&&!this.canInsertSemicolon(),s=void 0;;)if((s=this.eat(L.bracketL))||this.eat(L.dot)){var o=this.startNodeAt(t,n);o.object=e,o.property=s?this.parseExpression():this.parseIdent(!0),o.computed=!!s,s&&this.expect(L.bracketR),e=this.finishNode(o,"MemberExpression")}else if(!r&&this.eat(L.parenL)){var a=new p,u=this.yieldPos,c=this.awaitPos;this.yieldPos=0,this.awaitPos=0;var l=this.parseExprList(L.parenR,this.options.ecmaVersion>=8,!1,a);if(i&&!this.canInsertSemicolon()&&this.eat(L.arrow))return this.checkPatternErrors(a,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=u,this.awaitPos=c,this.parseArrowExpression(this.startNodeAt(t,n),l,!0);this.checkExpressionErrors(a,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=c||this.awaitPos;var h=this.startNodeAt(t,n);h.callee=e,h.arguments=l,e=this.finishNode(h,"CallExpression")}else{if(this.type!==L.backQuote)return e;var f=this.startNodeAt(t,n);f.tag=e,f.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(f,"TaggedTemplateExpression")}},Y.parseExprAtom=function(e){var t,n=this.potentialArrowAt==this.start;switch(this.type){case L._super:return this.inFunction||this.raise(this.start,"'super' outside of function or class"),t=this.startNode(),this.next(),this.type!==L.dot&&this.type!==L.bracketL&&this.type!==L.parenL&&this.unexpected(),this.finishNode(t,"Super");case L._this:return t=this.startNode(),this.next(),this.finishNode(t,"ThisExpression");case L.name:var r=this.start,i=this.startLoc,s=this.parseIdent(this.type!==L.name);if(this.options.ecmaVersion>=8&&"async"===s.name&&!this.canInsertSemicolon()&&this.eat(L._function))return this.parseFunction(this.startNodeAt(r,i),!1,!1,!0);if(n&&!this.canInsertSemicolon()){if(this.eat(L.arrow))return this.parseArrowExpression(this.startNodeAt(r,i),[s],!1);if(this.options.ecmaVersion>=8&&"async"===s.name&&this.type===L.name)return s=this.parseIdent(),!this.canInsertSemicolon()&&this.eat(L.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,i),[s],!0)}return s;case L.regexp:var o=this.value;return t=this.parseLiteral(o.value),t.regex={pattern:o.pattern,flags:o.flags},t;case L.num:case L.string:return this.parseLiteral(this.value);case L._null:case L._true:case L._false:return t=this.startNode(),t.value=this.type===L._null?null:this.type===L._true,t.raw=this.type.keyword,this.next(),this.finishNode(t,"Literal");case L.parenL:var a=this.start,u=this.parseParenAndDistinguishExpression(n);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(e.parenthesizedAssign=a),e.parenthesizedBind<0&&(e.parenthesizedBind=a)),u;case L.bracketL:return t=this.startNode(),this.next(),t.elements=this.parseExprList(L.bracketR,!0,!0,e),this.finishNode(t,"ArrayExpression");case L.braceL:return this.parseObj(!1,e);case L._function:return t=this.startNode(),this.next(),this.parseFunction(t,!1);case L._class:return this.parseClass(this.startNode(),!1);case L._new:return this.parseNew();case L.backQuote:return this.parseTemplate();default:this.unexpected()}},Y.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),this.next(),this.finishNode(t,"Literal")},Y.parseParenExpression=function(){this.expect(L.parenL);var e=this.parseExpression();return this.expect(L.parenR),e},Y.parseParenAndDistinguishExpression=function(e){var t,n=this.start,r=this.startLoc,i=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var s,o,a=this.start,u=this.startLoc,c=[],l=!0,h=!1,f=new p,d=this.yieldPos,y=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==L.parenR;){if(l?l=!1:this.expect(L.comma),i&&this.afterTrailingComma(L.parenR,!0)){h=!0;break}if(this.type===L.ellipsis){s=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===L.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}this.type!==L.parenL||o||(o=this.start),c.push(this.parseMaybeAssign(!1,f,this.parseParenItem))}var m=this.start,g=this.startLoc;if(this.expect(L.parenR),e&&!this.canInsertSemicolon()&&this.eat(L.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),o&&this.unexpected(o),this.yieldPos=d,this.awaitPos=y,this.parseParenArrowList(n,r,c);c.length&&!h||this.unexpected(this.lastTokStart),s&&this.unexpected(s),this.checkExpressionErrors(f,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=y||this.awaitPos,c.length>1?((t=this.startNodeAt(a,u)).expressions=c,this.finishNodeAt(t,"SequenceExpression",m,g)):t=c[0]}else t=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(n,r);return v.expression=t,this.finishNode(v,"ParenthesizedExpression")}return t},Y.parseParenItem=function(e){return e},Y.parseParenArrowList=function(e,t,n){return this.parseArrowExpression(this.startNodeAt(e,t),n)};var Q=[];Y.parseNew=function(){var e=this.startNode(),t=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(L.dot))return e.meta=t,e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is new.target"),this.inFunction||this.raiseRecoverable(e.start,"new.target can only be used in functions"),this.finishNode(e,"MetaProperty");var n=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(),n,r,!0),this.eat(L.parenL)?e.arguments=this.parseExprList(L.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Q,this.finishNode(e,"NewExpression")},Y.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===L.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value,cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===L.backQuote,this.finishNode(n,"TemplateElement")},Y.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.expect(L.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(L.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,"TemplateLiteral")},Y.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===L.name||this.type===L.num||this.type===L.string||this.type===L.bracketL||this.type.keyword)&&!O.test(this.input.slice(this.lastTokEnd,this.start))},Y.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(L.braceR);){if(r)r=!1;else if(this.expect(L.comma),this.afterTrailingComma(L.braceR))break;var s=this.parseProperty(e,t);this.checkPropClash(s,i),n.properties.push(s)}return this.finishNode(n,e?"ObjectPattern":"ObjectExpression")},Y.parseProperty=function(e,t){var n,r,i,s,o=this.startNode();return this.options.ecmaVersion>=6&&(o.method=!1,o.shorthand=!1,(e||t)&&(i=this.start,s=this.startLoc),e||(n=this.eat(L.star))),this.parsePropertyName(o),!e&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(o)?(r=!0,this.parsePropertyName(o,t)):r=!1,this.parsePropertyValue(o,e,n,r,i,s,t),this.finishNode(o,"Property")},Y.parsePropertyValue=function(e,t,n,r,i,s,o){if((n||r)&&this.type===L.colon&&this.unexpected(),this.eat(L.colon))e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init";else if(this.options.ecmaVersion>=6&&this.type===L.parenL)t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,r);else if(t||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type==L.comma||this.type==L.braceR)this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?(this.checkUnreserved(e.key),e.kind="init",t?e.value=this.parseMaybeDefault(i,s,e.key):this.type===L.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,s,e.key)):e.value=e.key,e.shorthand=!0):this.unexpected();else{(n||r)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var a="get"===e.kind?0:1;if(e.value.params.length!==a){var u=e.value.start;"get"===e.kind?this.raiseRecoverable(u,"getter should have no params"):this.raiseRecoverable(u,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")}},Y.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(L.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(L.bracketR),e.key;e.computed=!1}return e.key=this.type===L.num||this.type===L.string?this.parseExprAtom():this.parseIdent(!0)},Y.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=!1,e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},Y.parseMethod=function(e,t){var n=this.startNode(),r=this.inGenerator,i=this.inAsync,s=this.yieldPos,o=this.awaitPos,a=this.inFunction;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.inGenerator=n.generator,this.inAsync=n.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),this.expect(L.parenL),n.params=this.parseBindingList(L.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=o,this.inFunction=a,this.finishNode(n,"FunctionExpression")},Y.parseArrowExpression=function(e,t,n){var r=this.inGenerator,i=this.inAsync,s=this.yieldPos,o=this.awaitPos,a=this.inFunction;return this.enterFunctionScope(),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.inGenerator=!1,this.inAsync=e.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=o,this.inFunction=a,this.finishNode(e,"ArrowFunctionExpression")},Y.parseFunctionBody=function(e,t){var n=t&&this.type!==L.braceL,r=this.strict,i=!1;if(n)e.body=this.parseMaybeAssign(),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);r&&!s||(i=this.strictDirective(this.end))&&s&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var o=this.labels;this.labels=[],i&&(this.strict=!0),this.checkParams(e,!r&&!i&&!t&&this.isSimpleParamList(e.params)),e.body=this.parseBlock(!1),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=o}this.exitFunctionScope(),this.strict&&e.id&&this.checkLVal(e.id,"none"),this.strict=r},Y.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1){if("Identifier"!==n[t].type)return!1}return!0},Y.checkParams=function(e,t){for(var n={},r=0,i=e.params;r<i.length;r+=1){var s=i[r];this.checkLVal(s,"var",t?null:n)}},Y.parseExprList=function(e,t,n,r){for(var i=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(L.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===L.comma?o=null:this.type===L.ellipsis?(o=this.parseSpread(r),r&&this.type===L.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},Y.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;if(this.inGenerator&&"yield"===r&&this.raiseRecoverable(t,"Can not use 'yield' as identifier inside a generator"),this.inAsync&&"await"===r&&this.raiseRecoverable(t,"Can not use 'await' as identifier inside an async function"),this.isKeyword(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&-1!=this.input.slice(t,n).indexOf("\\"))){(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&this.raiseRecoverable(t,"The keyword '"+r+"' is reserved")}},Y.parseIdent=function(e,t){var n=this.startNode();return e&&"never"==this.options.allowReserved&&(e=!1),this.type===L.name?n.name=this.value:this.type.keyword?(n.name=this.type.keyword,"class"!==n.name&&"function"!==n.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop()):this.unexpected(),this.next(),this.finishNode(n,"Identifier"),e||this.checkUnreserved(n),n},Y.parseYield=function(){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type==L.semi||this.canInsertSemicolon()||this.type!=L.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(L.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")},Y.parseAwait=function(){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0),this.finishNode(e,"AwaitExpression")};var X=V.prototype;X.raise=function(e,t){var n=u(this.input,e);t+=" ("+n.line+":"+n.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},X.raiseRecoverable=X.raise,X.curPosition=function(){if(this.options.locations)return new I(this.curLine,this.pos-this.lineStart)};var Z=V.prototype,K=Object.assign||function(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];for(var r=0,i=t;r<i.length;r+=1){var s=i[r];for(var o in s)a(s,o)&&(e[o]=s[o])}return e};Z.enterFunctionScope=function(){this.scopeStack.push({var:{},lexical:{},childVar:{},parentLexical:{}})},Z.exitFunctionScope=function(){this.scopeStack.pop()},Z.enterLexicalScope=function(){var e=this.scopeStack[this.scopeStack.length-1],t={var:{},lexical:{},childVar:{},parentLexical:{}};this.scopeStack.push(t),K(t.parentLexical,e.lexical,e.parentLexical)},Z.exitLexicalScope=function(){var e=this.scopeStack.pop(),t=this.scopeStack[this.scopeStack.length-1];K(t.childVar,e.var,e.childVar)},Z.canDeclareVarName=function(e){var t=this.scopeStack[this.scopeStack.length-1];return!a(t.lexical,e)&&!a(t.parentLexical,e)},Z.canDeclareLexicalName=function(e){var t=this.scopeStack[this.scopeStack.length-1];return!a(t.lexical,e)&&!a(t.var,e)&&!a(t.childVar,e)},Z.declareVarName=function(e){this.scopeStack[this.scopeStack.length-1].var[e]=!0},Z.declareLexicalName=function(e){this.scopeStack[this.scopeStack.length-1].lexical[e]=!0};var ee=function(e,t,n){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new j(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},te=V.prototype;te.startNode=function(){return new ee(this,this.start,this.startLoc)},te.startNodeAt=function(e,t){return new ee(this,e,t)},te.finishNode=function(e,t){return h.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},te.finishNodeAt=function(e,t,n,r){return h.call(this,e,t,n,r)};var ne=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},re={b_stat:new ne("{",!1),b_expr:new ne("{",!0),b_tmpl:new ne("${",!1),p_stat:new ne("(",!1),p_expr:new ne("(",!0),q_tmpl:new ne("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new ne("function",!1),f_expr:new ne("function",!0),f_expr_gen:new ne("function",!0,!1,null,!0),f_gen:new ne("function",!1,!1,null,!0)},ie=V.prototype;ie.initialContext=function(){return[re.b_stat]},ie.braceIsBlock=function(e){var t=this.curContext();return t===re.f_expr||t===re.f_stat||(e!==L.colon||t!==re.b_stat&&t!==re.b_expr?e===L._return||e==L.name&&this.exprAllowed?O.test(this.input.slice(this.lastTokEnd,this.start)):e===L._else||e===L.semi||e===L.eof||e===L.parenR||e==L.arrow||(e==L.braceL?t===re.b_stat:e!=L._var&&e!=L.name&&!this.exprAllowed):!t.isExpr)},ie.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},ie.updateContext=function(e){var t,n=this.type;n.keyword&&e==L.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},L.parenR.updateContext=L.braceR.updateContext=function(){if(1!=this.context.length){var e=this.context.pop();e===re.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},L.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?re.b_stat:re.b_expr),this.exprAllowed=!0},L.dollarBraceL.updateContext=function(){this.context.push(re.b_tmpl),this.exprAllowed=!0},L.parenL.updateContext=function(e){var t=e===L._if||e===L._for||e===L._with||e===L._while;this.context.push(t?re.p_stat:re.p_expr),this.exprAllowed=!0},L.incDec.updateContext=function(){},L._function.updateContext=L._class.updateContext=function(e){e.beforeExpr&&e!==L.semi&&e!==L._else&&(e!==L.colon&&e!==L.braceL||this.curContext()!==re.b_stat)?this.context.push(re.f_expr):this.context.push(re.f_stat),this.exprAllowed=!1},L.backQuote.updateContext=function(){this.curContext()===re.q_tmpl?this.context.pop():this.context.push(re.q_tmpl),this.exprAllowed=!1},L.star.updateContext=function(e){if(e==L._function){var t=this.context.length-1;this.context[t]===re.f_expr?this.context[t]=re.f_expr_gen:this.context[t]=re.f_gen}this.exprAllowed=!0},L.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&("of"==this.value&&!this.exprAllowed||"yield"==this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var se=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new j(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},oe=V.prototype,ae="object"==typeof Packages&&"[object JavaPackage]"==Object.prototype.toString.call(Packages);oe.next=function(){this.options.onToken&&this.options.onToken(new se(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},oe.getToken=function(){return this.next(),new se(this)},"undefined"!=typeof Symbol&&(oe[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===L.eof,value:t}}}}),oe.curContext=function(){return this.context[this.context.length-1]},oe.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(L.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},oe.readToken=function(e){return n(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},oe.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=57344)return e;return(e<<10)+this.input.charCodeAt(this.pos+1)-56613888},oe.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(-1===n&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations){T.lastIndex=t;for(var r;(r=T.exec(this.input))&&r.index<this.pos;)++this.curLine,this.lineStart=r.index+r[0].length}this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},oe.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!o(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},oe.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&N.test(String.fromCharCode(e))))break e;++this.pos}}},oe.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},oe.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(L.ellipsis)):(++this.pos,this.finishToken(L.dot))},oe.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(L.assign,2):this.finishOp(L.slash,1)},oe.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=42===e?L.star:L.modulo;return this.options.ecmaVersion>=7&&42==e&&42===t&&(++n,r=L.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(L.assign,n+1):this.finishOp(r,n)},oe.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.finishOp(124===e?L.logicalOR:L.logicalAND,2):61===t?this.finishOp(L.assign,2):this.finishOp(124===e?L.bitwiseOR:L.bitwiseAND,1)},oe.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(L.assign,2):this.finishOp(L.bitwiseXOR,1)},oe.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!=t||this.inModule||62!=this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!O.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(L.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(L.assign,2):this.finishOp(L.plusMin,1)},oe.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(L.assign,n+1):this.finishOp(L.bitShift,n)):33!=t||60!=e||this.inModule||45!=this.input.charCodeAt(this.pos+2)||45!=this.input.charCodeAt(this.pos+3)?(61===t&&(n=2),this.finishOp(L.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},oe.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(L.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(L.arrow)):this.finishOp(61===e?L.eq:L.prefix,1)},oe.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(L.parenL);case 41:return++this.pos,this.finishToken(L.parenR);case 59:return++this.pos,this.finishToken(L.semi);case 44:return++this.pos,this.finishToken(L.comma);case 91:return++this.pos,this.finishToken(L.bracketL);case 93:return++this.pos,this.finishToken(L.bracketR);case 123:return++this.pos,this.finishToken(L.braceL);case 125:return++this.pos,this.finishToken(L.braceR);case 58:return++this.pos,this.finishToken(L.colon);case 63:return++this.pos,this.finishToken(L.question);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(L.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(L.prefix,1)}this.raise(this.pos,"Unexpected character '"+d(e)+"'")},oe.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)};var ue=!!f("￿","u");oe.readRegexp=function(){for(var e,t,n=this,r=this.pos;;){n.pos>=n.input.length&&n.raise(r,"Unterminated regular expression");var i=n.input.charAt(n.pos);if(O.test(i)&&n.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++n.pos}var s=this.input.slice(r,this.pos);++this.pos;var o=this.readWord1(),a=s,u="";if(o){var c=/^[gim]*$/;this.options.ecmaVersion>=6&&(c=/^[gimuy]*$/),c.test(o)||this.raise(r,"Invalid regular expression flag"),o.indexOf("u")>=0&&(ue?u="u":(a=(a=a.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(e,t,i){return(t=Number("0x"+t))>1114111&&n.raise(r+i+3,"Code point out of bounds"),"x"})).replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"),u=u.replace("u","")))}var l=null;return ae||(f(a,u,r,this),l=f(s,o)),this.finishToken(L.regexp,{pattern:s,flags:o,value:l})},oe.readInt=function(e,t){for(var n=this.pos,r=0,i=0,s=null==t?1/0:t;i<s;++i){var o=this.input.charCodeAt(this.pos),a=void 0;if((a=o>=97?o-97+10:o>=65?o-65+10:o>=48&&o<=57?o-48:1/0)>=e)break;++this.pos,r=r*e+a}return this.pos===n||null!=t&&this.pos-n!==t?null:r},oe.readRadixNumber=function(e){this.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.start+2,"Expected number in radix "+e),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(L.num,t)},oe.readNumber=function(e){var t=this.pos,r=!1,i=48===this.input.charCodeAt(this.pos);e||null!==this.readInt(10)||this.raise(t,"Invalid number"),i&&this.pos==t+1&&(i=!1);var s=this.input.charCodeAt(this.pos);46!==s||i||(++this.pos,this.readInt(10),r=!0,s=this.input.charCodeAt(this.pos)),69!==s&&101!==s||i||(43!==(s=this.input.charCodeAt(++this.pos))&&45!==s||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),r=!0),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var o,a=this.input.slice(t,this.pos);return r?o=parseFloat(a):i&&1!==a.length?this.strict?this.raise(t,"Invalid number"):o=/[89]/.test(a)?parseInt(a,10):parseInt(a,8):o=parseInt(a,10),this.finishToken(L.num,o)},oe.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},oe.readString=function(e){for(var t="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;92===r?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):(o(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(L.string,t)};var ce={};oe.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==ce)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},oe.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ce;this.raise(e,t)},oe.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==L.template&&this.type!==L.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(L.template,e)):36===n?(this.pos+=2,this.finishToken(L.dollarBraceL)):(++this.pos,this.finishToken(L.backQuote));if(92===n)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(o(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},oe.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(L.invalidTemplate,this.input.slice(this.start,this.pos))}this.raise(this.start,"Unterminated template")},oe.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return d(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(n,8);return r>255&&(n=n.slice(0,-1),r=parseInt(n,8)),"0"!==n&&(this.strict||e)&&this.invalidStringToken(this.pos-2,"Octal literal in strict mode"),this.pos+=n.length-1,String.fromCharCode(r)}return String.fromCharCode(t)}},oe.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return null===n&&this.invalidStringToken(t,"Bad character escape sequence"),n},oe.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,s=this.options.ecmaVersion>=6;this.pos<this.input.length;){var o=this.fullCharCodeAtPos();if(r(o,s))this.pos+=o<=65535?1:2;else{if(92!==o)break;this.containsEsc=!0,e+=this.input.slice(i,this.pos);var a=this.pos;117!=this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var u=this.readCodePoint();(t?n:r)(u,s)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=d(u),i=this.pos}t=!1}return e+this.input.slice(i,this.pos)},oe.readWord=function(){var e=this.readWord1(),t=L.name;return this.keywords.test(e)&&(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+e),t=_[e]),this.finishToken(t,e)};e.version="5.2.1",e.parse=function(e,t){return new V(t,e).parse()},e.parseExpressionAt=function(e,t,n){var r=new V(n,e,t);return r.nextToken(),r.parseExpression()},e.tokenizer=function(e,t){return new V(t,e)},e.addLooseExports=function(t,n,r){e.parse_dammit=t,e.LooseParser=n,e.pluginsLoose=r},e.Parser=V,e.plugins=M,e.defaultOptions=D,e.Position=I,e.SourceLocation=j,e.getLineInfo=u,e.Node=ee,e.TokenType=k,e.tokTypes=L,e.keywordTypes=_,e.TokContext=ne,e.tokContexts=re,e.isIdentifierChar=r,e.isIdentifierStart=n,e.Token=se,e.isNewLine=o,e.lineBreak=O,e.lineBreakG=T,e.nonASCIIwhitespace=N,Object.defineProperty(e,"__esModule",{value:!0})})},{}],5:[function(e,t,n){!function(e,r){"object"==typeof n&&void 0!==t?r(n):"function"==typeof define&&define.amd?define(["exports"],r):r((e.acorn=e.acorn||{},e.acorn.walk=e.acorn.walk||{}))}(this,function(e){"use strict";function t(e){return"string"==typeof e?function(t){return t==e}:e||function(){return!0}}function n(e,t,n){n(e,t)}function r(e,t,n){}var i=function(e,t){this.node=e,this.state=t},s=Object.create||function(e){function t(){}return t.prototype=e,new t},o={};o.Program=o.BlockStatement=function(e,t,n){for(var r=0,i=e.body;r<i.length;r+=1){n(i[r],t,"Statement")}},o.Statement=n,o.EmptyStatement=r,o.ExpressionStatement=o.ParenthesizedExpression=function(e,t,n){return n(e.expression,t,"Expression")},o.IfStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Statement"),e.alternate&&n(e.alternate,t,"Statement")},o.LabeledStatement=function(e,t,n){return n(e.body,t,"Statement")},o.BreakStatement=o.ContinueStatement=r,o.WithStatement=function(e,t,n){n(e.object,t,"Expression"),n(e.body,t,"Statement")},o.SwitchStatement=function(e,t,n){n(e.discriminant,t,"Expression");for(var r=0,i=e.cases;r<i.length;r+=1){var s=i[r];s.test&&n(s.test,t,"Expression");for(var o=0,a=s.consequent;o<a.length;o+=1){n(a[o],t,"Statement")}}},o.ReturnStatement=o.YieldExpression=o.AwaitExpression=function(e,t,n){e.argument&&n(e.argument,t,"Expression")},o.ThrowStatement=o.SpreadElement=function(e,t,n){return n(e.argument,t,"Expression")},o.TryStatement=function(e,t,n){n(e.block,t,"Statement"),e.handler&&n(e.handler,t),e.finalizer&&n(e.finalizer,t,"Statement")},o.CatchClause=function(e,t,n){n(e.param,t,"Pattern"),n(e.body,t,"ScopeBody")},o.WhileStatement=o.DoWhileStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.body,t,"Statement")},o.ForStatement=function(e,t,n){e.init&&n(e.init,t,"ForInit"),e.test&&n(e.test,t,"Expression"),e.update&&n(e.update,t,"Expression"),n(e.body,t,"Statement")},o.ForInStatement=o.ForOfStatement=function(e,t,n){n(e.left,t,"ForInit"),n(e.right,t,"Expression"),n(e.body,t,"Statement")},o.ForInit=function(e,t,n){"VariableDeclaration"==e.type?n(e,t):n(e,t,"Expression")},o.DebuggerStatement=r,o.FunctionDeclaration=function(e,t,n){return n(e,t,"Function")},o.VariableDeclaration=function(e,t,n){for(var r=0,i=e.declarations;r<i.length;r+=1){n(i[r],t)}},o.VariableDeclarator=function(e,t,n){n(e.id,t,"Pattern"),e.init&&n(e.init,t,"Expression")},o.Function=function(e,t,n){e.id&&n(e.id,t,"Pattern");for(var r=0,i=e.params;r<i.length;r+=1){n(i[r],t,"Pattern")}n(e.body,t,e.expression?"ScopeExpression":"ScopeBody")},o.ScopeBody=function(e,t,n){return n(e,t,"Statement")},o.ScopeExpression=function(e,t,n){return n(e,t,"Expression")},o.Pattern=function(e,t,n){"Identifier"==e.type?n(e,t,"VariablePattern"):"MemberExpression"==e.type?n(e,t,"MemberPattern"):n(e,t)},o.VariablePattern=r,o.MemberPattern=n,o.RestElement=function(e,t,n){return n(e.argument,t,"Pattern")},o.ArrayPattern=function(e,t,n){for(var r=0,i=e.elements;r<i.length;r+=1){var s=i[r];s&&n(s,t,"Pattern")}},o.ObjectPattern=function(e,t,n){for(var r=0,i=e.properties;r<i.length;r+=1){n(i[r].value,t,"Pattern")}},o.Expression=n,o.ThisExpression=o.Super=o.MetaProperty=r,o.ArrayExpression=function(e,t,n){for(var r=0,i=e.elements;r<i.length;r+=1){var s=i[r];s&&n(s,t,"Expression")}},o.ObjectExpression=function(e,t,n){for(var r=0,i=e.properties;r<i.length;r+=1){n(i[r],t)}},o.FunctionExpression=o.ArrowFunctionExpression=o.FunctionDeclaration,o.SequenceExpression=o.TemplateLiteral=function(e,t,n){for(var r=0,i=e.expressions;r<i.length;r+=1){n(i[r],t,"Expression")}},o.UnaryExpression=o.UpdateExpression=function(e,t,n){n(e.argument,t,"Expression")},o.BinaryExpression=o.LogicalExpression=function(e,t,n){n(e.left,t,"Expression"),n(e.right,t,"Expression")},o.AssignmentExpression=o.AssignmentPattern=function(e,t,n){n(e.left,t,"Pattern"),n(e.right,t,"Expression")},o.ConditionalExpression=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Expression"),n(e.alternate,t,"Expression")},o.NewExpression=o.CallExpression=function(e,t,n){if(n(e.callee,t,"Expression"),e.arguments)for(var r=0,i=e.arguments;r<i.length;r+=1){n(i[r],t,"Expression")}},o.MemberExpression=function(e,t,n){n(e.object,t,"Expression"),e.computed&&n(e.property,t,"Expression")},o.ExportNamedDeclaration=o.ExportDefaultDeclaration=function(e,t,n){e.declaration&&n(e.declaration,t,"ExportNamedDeclaration"==e.type||e.declaration.id?"Statement":"Expression"),e.source&&n(e.source,t,"Expression")},o.ExportAllDeclaration=function(e,t,n){n(e.source,t,"Expression")},o.ImportDeclaration=function(e,t,n){for(var r=0,i=e.specifiers;r<i.length;r+=1){n(i[r],t)}n(e.source,t,"Expression")},o.ImportSpecifier=o.ImportDefaultSpecifier=o.ImportNamespaceSpecifier=o.Identifier=o.Literal=r,o.TaggedTemplateExpression=function(e,t,n){n(e.tag,t,"Expression"),n(e.quasi,t)},o.ClassDeclaration=o.ClassExpression=function(e,t,n){return n(e,t,"Class")},o.Class=function(e,t,n){e.id&&n(e.id,t,"Pattern"),e.superClass&&n(e.superClass,t,"Expression");for(var r=0,i=e.body.body;r<i.length;r+=1){n(i[r],t)}},o.MethodDefinition=o.Property=function(e,t,n){e.computed&&n(e.key,t,"Expression"),n(e.value,t,"Expression")},e.simple=function(t,n,r,i,s){r||(r=e.base),function e(t,i,s){var o=s||t.type,a=n[o];r[o](t,i,e),a&&a(t,i)}(t,i,s)},e.ancestor=function(t,n,r,i){r||(r=e.base);var s=[];!function e(t,i,o){var a=o||t.type,u=n[a],c=t!=s[s.length-1];c&&s.push(t),r[a](t,i,e),u&&u(t,i||s,s),c&&s.pop()}(t,i)},e.recursive=function(t,n,r,i,s){var o=r?e.make(r,i):i;!function e(t,n,r){o[r||t.type](t,n,e)}(t,n,s)},e.full=function(t,n,r,i,s){r||(r=e.base),function e(t,i,s){var o=s||t.type;r[o](t,i,e),s||n(t,i,o)}(t,i,s)},e.fullAncestor=function(t,n,r,i){r||(r=e.base);var s=[];!function e(t,i,o){var a=o||t.type,u=t!=s[s.length-1];u&&s.push(t),r[a](t,i,e),o||n(t,i||s,s,a),u&&s.pop()}(t,i)},e.findNodeAt=function(n,r,s,o,a,u){o=t(o),a||(a=e.base);try{!function e(t,n,u){var c=u||t.type;if((null==r||t.start<=r)&&(null==s||t.end>=s)&&a[c](t,n,e),(null==r||t.start==r)&&(null==s||t.end==s)&&o(c,t))throw new i(t,n)}(n,u)}catch(e){if(e instanceof i)return e;throw e}},e.findNodeAround=function(n,r,s,o,a){s=t(s),o||(o=e.base);try{!function e(t,n,a){var u=a||t.type;if(!(t.start>r||t.end<r)&&(o[u](t,n,e),s(u,t)))throw new i(t,n)}(n,a)}catch(e){if(e instanceof i)return e;throw e}},e.findNodeAfter=function(n,r,s,o,a){s=t(s),o||(o=e.base);try{!function e(t,n,a){if(!(t.end<r)){var u=a||t.type;if(t.start>=r&&s(u,t))throw new i(t,n);o[u](t,n,e)}}(n,a)}catch(e){if(e instanceof i)return e;throw e}},e.findNodeBefore=function(n,r,s,o,a){s=t(s),o||(o=e.base);var u;return function e(t,n,a){if(!(t.start>r)){var c=a||t.type;t.end<=r&&(!u||u.node.end<t.end)&&s(c,t)&&(u=new i(t,n)),o[c](t,n,e)}}(n,a),u},e.make=function(t,n){n||(n=e.base);var r=s(n);for(var i in t)r[i]=t[i];return r},e.base=o,Object.defineProperty(e,"__esModule",{value:!0})})},{}],6:[function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function s(e,t,n){for(var r,s=[],o=t;o<n;o+=3)r=(e[o]<<16)+(e[o+1]<<8)+e[o+2],s.push(i(r));return s.join("")}n.byteLength=function(e){return 3*e.length/4-r(e)},n.toByteArray=function(e){var t,n,i,s,o,c=e.length;s=r(e),o=new u(3*c/4-s),n=s>0?c-4:c;var l=0;for(t=0;t<n;t+=4)i=a[e.charCodeAt(t)]<<18|a[e.charCodeAt(t+1)]<<12|a[e.charCodeAt(t+2)]<<6|a[e.charCodeAt(t+3)],o[l++]=i>>16&255,o[l++]=i>>8&255,o[l++]=255&i;return 2===s?(i=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[l++]=255&i):1===s&&(i=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[l++]=i>>8&255,o[l++]=255&i),o},n.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i="",a=[],u=0,c=n-r;u<c;u+=16383)a.push(s(e,u,u+16383>c?c:u+16383));return 1===r?(t=e[n-1],i+=o[t>>2],i+=o[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=o[t>>10],i+=o[t>>4&63],i+=o[t<<2&63],i+="="),a.push(i),a.join("")};for(var o=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=c.length;l<p;++l)o[l]=c[l],a[c.charCodeAt(l)]=l;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],7:[function(e,t,n){},{}],8:[function(e,t,n){"use strict";function r(e){if(e>B)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return a(e)}return s(e,t,n)}function s(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return T(e)?function(e,t,n){if(t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");var r;r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n);return r.__proto__=i.prototype,r}(e,t,n):"string"==typeof e?function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!i.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=0|l(e,t),s=r(n),o=s.write(e,t);o!==n&&(s=s.slice(0,o));return s}(e,t):function(e){if(i.isBuffer(e)){var t=0|c(e.length),n=r(t);return 0===n.length?n:(e.copy(n,0,0,t),n)}if(e){if(N(e)||"length"in e)return"number"!=typeof e.length||P(e.length)?r(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function a(e){return o(e),r(e<0?0:0|c(e))}function u(e){for(var t=e.length<0?0:0|c(e.length),n=r(t),i=0;i<t;i+=1)n[i]=255&e[i];return n}function c(e){if(e>=B)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+B.toString(16)+" bytes");return 0|e}function l(e,t){if(i.isBuffer(e))return e.length;if(N(e)||T(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return _(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return L(e).length;default:if(r)return _(e).length;t=(""+t).toLowerCase(),r=!0}}function p(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0);(!n||n<0||n>r)&&(n=r);for(var i="",s=t;s<n;++s)i+=function(e){return e<16?"0"+e.toString(16):e.toString(16)}(e[s]);return i}(this,t,n);case"utf8":case"utf-8":return w(this,t,n);case"ascii":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":return function(e,t,n){return 0===t&&n===e.length?F.fromByteArray(e):F.fromByteArray(e.slice(t,n))}(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var r=e.slice(t,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function h(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function f(e,t,n,r,s){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,P(n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:d(e,t,n,r,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):d(e,[t],n,r,s);throw new TypeError("val must be string, number or Buffer")}function d(e,t,n,r,i){function s(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,n/=2}var c;if(i){var l=-1;for(c=n;c<a;c++)if(s(e,c)===s(t,-1===l?0:c-l)){if(-1===l&&(l=c),c-l+1===u)return l*o}else-1!==l&&(c-=c-l),l=-1}else for(n+u>a&&(n=a-u),c=n;c>=0;c--){for(var p=!0,h=0;h<u;h++)if(s(e,c+h)!==s(t,h)){p=!1;break}if(p)return c}return-1}function y(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a=parseInt(t.substr(2*o,2),16);if(P(a))return o;e[n+o]=a}return o}function m(e,t,n,r){return O(_(t,e.length-n),e,n,r)}function g(e,t,n,r){return O(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function v(e,t,n,r){return g(e,t,n,r)}function b(e,t,n,r){return O(L(t),e,n,r)}function x(e,t,n,r){return O(function(e,t){for(var n,r,i,s=[],o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function w(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var s=e[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=n){var u,c,l,p;switch(a){case 1:s<128&&(o=s);break;case 2:128==(192&(u=e[i+1]))&&(p=(31&s)<<6|63&u)>127&&(o=p);break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(p=(15&s)<<12|(63&u)<<6|63&c)>2047&&(p<55296||p>57343)&&(o=p);break;case 4:u=e[i+1],c=e[i+2],l=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(p=(15&s)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&p<1114112&&(o=p)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=R));return n}(r)}function E(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function S(e,t,n,r,s,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function k(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function A(e,t,n,r,i){return t=+t,n>>>=0,i||k(e,0,n,4),$.write(e,t,n,r,23,4),n+4}function C(e,t,n,r,i){return t=+t,n>>>=0,i||k(e,0,n,8),$.write(e,t,n,r,52,8),n+8}function _(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function L(e){return F.toByteArray(function(e){if((e=e.trim().replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function T(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function N(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function P(e){return e!=e}var F=e("base64-js"),$=e("ieee754");n.Buffer=i,n.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},n.INSPECT_MAX_BYTES=50;var B=2147483647;n.kMaxLength=B,(i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,n){return s(e,t,n)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,n){return function(e,t,n){return o(e),e<=0?r(e):void 0!==t?"string"==typeof n?r(e).fill(t,n):r(e).fill(t):r(e)}(e,t,n)},i.allocUnsafe=function(e){return a(e)},i.allocUnsafeSlow=function(e){return a(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,s=0,o=Math.min(n,r);s<o;++s)if(e[s]!==t[s]){n=e[s],r=t[s];break}return n<r?-1:r<n?1:0},i.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return i.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=i.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){var o=e[n];if(!i.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,s),s+=o.length}return r},i.byteLength=l,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},i.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},i.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},i.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?w(this,0,e):p.apply(this,arguments)},i.prototype.equals=function(e){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===i.compare(this,e)},i.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},i.prototype.compare=function(e,t,n,r,s){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||n>e.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&t>=n)return 0;if(r>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,s>>>=0,this===e)return 0;for(var o=s-r,a=n-t,u=Math.min(o,a),c=this.slice(r,s),l=e.slice(t,n),p=0;p<u;++p)if(c[p]!==l[p]){o=c[p],a=l[p];break}return o<a?-1:a<o?1:0},i.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},i.prototype.indexOf=function(e,t,n){return f(this,e,t,n,!0)},i.prototype.lastIndexOf=function(e,t,n){return f(this,e,t,n,!1)},i.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return m(this,e,t,n);case"ascii":return g(this,e,t,n);case"latin1":case"binary":return v(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return r.__proto__=i.prototype,r},i.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r},i.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},i.prototype.readUInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},i.prototype.readInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||E(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){e>>>=0,t||E(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||E(e,4,this.length),$.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||E(e,4,this.length),$.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||E(e,8,this.length),$.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||E(e,8,this.length),$.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,s=0;for(this[t]=255&e;++s<n&&(i*=256);)this[t+s]=e/i&255;return t+n},i.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=n-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);S(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<n&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);S(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,n){return A(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return A(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return C(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return C(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,s=r-n;if(this===e&&n<t&&t<r)for(i=s-1;i>=0;--i)e[i+t]=this[i+n];else if(s<1e3)for(i=0;i<s;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s},i.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var s=e.charCodeAt(0);s<256&&(e=s)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!i.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=i.isBuffer(e)?e:new i(e,r),u=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%u]}return this};var I=/[^+/0-9A-Za-z-_]/g},{"base64-js":6,ieee754:9}],9:[function(e,t,n){n.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,u=(1<<a)-1,c=u>>1,l=-7,p=n?i-1:0,h=n?-1:1,f=e[t+p];for(p+=h,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+p],p+=h,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+p],p+=h,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=c}return(f?-1:1)*o*Math.pow(2,s-r)},n.write=function(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<<c)-1,p=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,d=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+p>=1?h/u:h*Math.pow(2,1-p))*u>=2&&(o++,u/=2),o+p>=l?(a=0,o=l):o+p>=1?(a=(t*u-1)*Math.pow(2,i),o+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&a,f+=d,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;e[n+f]=255&o,f+=d,o/=256,c-=8);e[n+f-d]|=128*y}},{}],10:[function(e,t,n){(function(n){function r(){}function i(e){this.covers={},this._ident=i.prototype.version+"_"+Math.random(),this.setOptions(e||{})}var s=e("./lib/parser"),o=e("./lib/arboriculture"),a=e("./lib/output");i.prototype.smCache={},i.prototype.setOptions=function(e){return this.log=!1===e.log?r:e.log||this.log,this.options=function(e){var t={};return e.forEach(function(e){if(e&&"object"==typeof e)for(var n in e)t[n]=e[n]}),t}([this.options,e]),delete this.options.log,this},i.prototype.version=e("./package.json").version,i.prototype.isThenable=function(e){return e&&e instanceof Object&&"function"==typeof e.then},i.prototype.compile=function(e,t,n,s){"object"==typeof n&&void 0===s&&(s=n),s=s||{};for(var o in i.initialCodeGenOpts)o in s||(s[o]=i.initialCodeGenOpts[o]);var a=this.parse(e,t,null,s);return this.asynchronize(a,null,s,this.log||r),this.prettyPrint(a,s),a},i.prototype.parse=function(e,t,n,r){"object"==typeof n&&void 0===r&&(r=n);var i={origCode:e.toString(),filename:t};try{return i.ast=s.parse(i.origCode,r&&r.parser),r.babelTree&&s.treeWalker(i.ast,function(e,t,n){"Literal"===e.type?n[0].replace(o.babelLiteralNode(e.value)):"Property"===e.type&&("ClassBody"===n[0].parent.type?e.type="ClassProperty":e.type="ObjectProperty"),t()}),i}catch(e){if(e instanceof SyntaxError){var a=i.origCode.substr(e.pos-e.loc.column);a=a.split("\n")[0],e.message+=" "+t+" (nodent)\n"+a+"\n"+a.replace(/[\S ]/g,"-").substring(0,e.loc.column)+"^",e.stack=""}throw e}},i.prototype.asynchronize=o.asynchronize,i.prototype.printNode=o.printNode,i.prototype.prettyPrint=function(t,r){var i=t.filename?t.filename.split("/"):["anonymous"],s=i.pop(),o=a(t.ast,r&&r.sourcemap?{map:{startLine:r.mapStartLine||0,file:s+"(original)",sourceMapRoot:i.join("/"),sourceContent:t.origCode}}:null,t.origCode);if(r&&r.sourcemap)try{var u="",c=o.map.toJSON();if(c){var l=e("source-map").SourceMapConsumer;t.sourcemap=c,this.smCache[t.filename]={map:c,smc:new l(c)},u="\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,"+function(e){return(e instanceof n?e:new n(e.toString(),"binary")).toString("base64")}(JSON.stringify(c))+"\n"}t.code=o.code+u}catch(e){t.code=o}else t.code=o;return t},i.prototype.getDefaultCompileOptions=void 0,Object.defineProperty(i.prototype,"Promise",{get:function(){return initOpts.log("Warning: nodent.Promise is deprecated. Use nodent.Thenable instead"),Thenable},enumerable:!1,configurable:!1}),i.initialCodeGenOpts={noRuntime:!1,lazyThenables:!1,es6target:!1,noUseDirective:!1,wrapAwait:null,mapStartLine:0,sourcemap:!0,engine:!1,parser:{sourceType:"script"},$return:"$return",$error:"$error",$arguments:"$args",$asyncspawn:"$asyncspawn",$asyncbind:"$asyncbind",generatedSymbolPrefix:"$",$makeThenable:"$makeThenable"},t.exports=i}).call(this,e("buffer").Buffer)},{"./lib/arboriculture":11,"./lib/output":12,"./lib/parser":13,"./package.json":25,buffer:8,"source-map":24}],11:[function(e,t,n){"use strict";function r(e){if(!e)return"";if(Array.isArray(e))return e.map(r).join("|\n");try{return m(e)}catch(t){return t.message+": "+(e&&e.type)}}function i(e){if(Array.isArray(e))return e.map(function(e){return i(e)});var t={};return Object.keys(e).forEach(function(n){t[n]=e[n]}),t}function s(e,t){e!==t&&(e.__proto__=Object.getPrototypeOf(t),Object.keys(e).forEach(function(t){t in g||delete e[t]}),Object.keys(t).forEach(function(n){n in e||(e[n]=t[n])}))}function o(){}function a(e){return e?(b.node=e,b):{}}function u(e,t,n){if(!e)return null;if(t&&"object"==typeof t){var r=Object.keys(t);return u(e,function(e){return r.every(function(n){return e[n]==t[n]})})}var i,s={};if(Array.isArray(e)){for(var o=0;o<e.length;o++)if(i=u(e[o],t))return i;return null}var c=n;"function"!=typeof n&&(c=n?function(e){return!0}:function(e){return!a(e).isScope});try{y.treeWalker(e,function(n,r,i){if(t(n))throw s.path=i,s;(n===e||c(n))&&r()})}catch(e){if(e===s)return s.path;throw e}return null}function c(e){return u(e,function(e){return"AwaitExpression"===e.type&&!e.$hidden})}function l(e){return u(e,function(e){return"AwaitExpression"===e.type&&!e.$hidden},function(e){var t=a(e);return!t.isBlockStatement&&!t.isScope})}function p(e){if(null===e)return{type:"NullLiteral",value:null,raw:"null"};if(!0===e||!1===e)return{type:"BooleanLiteral",value:e,raw:JSON.stringify(e)};if(e instanceof RegExp){var t=e.toString(),n=t.split("/");return{type:"RegExpLiteral",value:e,raw:t,pattern:n[1],flags:n[2]}}return"number"==typeof e?{type:"NumericLiteral",value:e,raw:JSON.stringify(e)}:{type:"StringLiteral",value:e,raw:JSON.stringify(e)}}function h(e,t){return{type:"Identifier",name:e,loc:t}}function f(e){var t={};for(var n in e)t[n]="string"==typeof e[n]?h(e[n]):e[n];return t}function d(e,t,n,d){function m(e,t){if(n.es6target&&!e.id&&!t&&0===e.type.indexOf("Function"))return e.type="ArrowFunctionExpression",e;if(n.noRuntime){if(t){if(a(t).isLiteral)throw new Error("Nodent: 'noRuntime' option only compatible with -promise and -engine modes");e.body.body=y.part("try {$:0} catch($2) {return $1($2)}",[i(e.body),t,h("$boundEx")]).body}else if(n.es6target&&!e.id&&0===e.type.indexOf("Function"))return e.type="ArrowFunctionExpression",e;return n.es6target&&!e.id?(e.type="ArrowFunctionExpression",e):y.part("$0.bind(this)",[e]).expr}return t?y.part("$0.$1(this,$2)",[e,pe.asyncbind,t]).expr:y.part("$0.$1(this)",[e,pe.asyncbind]).expr}function g(e,t,n,r){return y.part("var $0 = $1",[h(e),m({type:"FunctionExpression",id:null,generator:!1,expression:!1,params:n||[],body:Array.isArray(t)?{type:"BlockStatement",body:t}:t},r)]).body[0]}function v(t){return e.filename+(t&&t.loc&&t.loc.start?"("+t.loc.start.line+":"+t.loc.start.column+")\t":"\t")}function b(e){return n.babelTree?p(e):{type:"Literal",value:e,raw:JSON.stringify(e)}}function x(e){return e?!n.babelTree||"ClassMethod"!==e.type&&"ObjectMethod"!==e.type?(!n.babelTree&&"MethodDefinition"===e.type||"Property"===e.type&&(e.method||"get"==e.kind||"set"==e.kind))&&a(e.value).isFunction?e.value:null:e:null}function w(e,t){if(!a(e).isFunction)throw new Error("Can only replace 'arguments' in functions");return"$usesArguments"in e||(y.treeWalker(e,function(t,r,i){"Identifier"===t.type&&"arguments"===t.name?(i[0].parent.shorthand&&(i[0].parent.shorthand=!1,i[0].parent.key=h("arguments"),e.$usesArguments=!0),"key"!==i[0].field&&(t.name=n.$arguments,e.$usesArguments=!0)):t!==e&&a(t).isFunction?"ArrowFunctionExpression"===t.type&&(w(t),e.$usesArguments=e.$usesArguments||t.$usesArguments):r()}),e.$usesArguments=e.$usesArguments||!1),e.$usesArguments&&"ArrowFunctionExpression"!==e.type}function E(e){return"string"!=typeof e&&(e=e.type.replace(/Statement|Expression/g,"")),n.generatedSymbolPrefix+e+"_"+le++}function S(e,t){return e&&(e.$exit=f({$error:t.$error,$return:t.$return})),e}function k(e,t){var n=function(e){for(var t=0;t<e.length;t++){if(e[t].self.$exit)return e[t].self;if(e[t].parent&&e[t].parent.$exit)return e[t].parent}return null}(e);if(n)return n.$exit;if(t)for(var r=0;r<t.length;r++)if(t[r])return f(t[r]);return null}function A(e,t){var r=!(n.promises||n.generators||n.engine)&&n.lazyThenables;ie(e),ne(e),j(e),H(e),J(e),(r?function(e,t){return y.treeWalker(e,function(e,t,r){function o(e){return{type:"ReturnStatement",argument:{type:"UnaryExpression",operator:"void",prefix:!0,argument:L(e||S)}}}function l(e,t){if("BreakStatement"===e.type)s(e,i(A(e.label&&n.generatedSymbolPrefix+"Loop_"+e.label.name+"_exit")));else if("ContinueStatement"===e.type)s(e,i(o(e.label&&n.generatedSymbolPrefix+"Loop_"+e.label.name+"_next")));else if(a(e).isFunction)return!0;t()}"ForInStatement"===e.type&&c(e)?U(e,r):"ForOfStatement"===e.type&&c(e)&&z(e,r),t();var p;if(a(e).isLoop&&c(e)){var f=e.init,d=e.test||b(!0),g=e.update,v=e.body,x=function(e){return u(e,{type:"ThisExpression"})}(v);f&&(a(f).isStatement||(f={type:"ExpressionStatement",expression:f})),g=g&&{type:"ExpressionStatement",expression:g},v=a(v).isBlockStatement?i(v).body:[i(v)];var w=e.$label&&e.$label.name;w="Loop_"+(w||le++);var E=n.generatedSymbolPrefix+(w+"_exit"),S=n.generatedSymbolPrefix+(w+"_next"),k=h(n.generatedSymbolPrefix+w),A=function(e){return{type:"ReturnStatement",argument:{type:"UnaryExpression",operator:"void",prefix:!0,argument:{type:"CallExpression",callee:h(e||E),arguments:[]}}}},_=C(S,[{type:"ReturnStatement",argument:{type:"CallExpression",callee:x?m(k):k,arguments:[h(E),pe.error]}}]);g&&_.body.body.unshift(g);for(var O=0;O<v.length;O++)y.treeWalker(v[O],l);v.push(i(o()));var T={type:"FunctionExpression",id:k,params:[h(E),pe.error],body:{type:"BlockStatement",body:[_]}};if("DoWhileStatement"===e.type)_.body.body=[{type:"IfStatement",test:i(d),consequent:{type:"BlockStatement",body:i(_.body.body)},alternate:{type:"ReturnStatement",argument:{type:"CallExpression",callee:h(E),arguments:[]}}}],T.body.body=[_].concat(v);else{var N={type:"IfStatement",test:i(d),consequent:{type:"BlockStatement",body:v},alternate:i(A())};T.body.body.push(N)}var P={type:"ExpressionStatement",expression:{type:"AwaitExpression",argument:m(T,b(0))}};for(!f||"VariableDeclaration"!==f.type||"let"!==f.kind&&"const"!==f.kind||("const"===f.kind&&(f.kind="let"),P={type:"BlockStatement",body:[i(f),P]},f=null),p=0;p<r.length;p++){var F=r[p];if("index"in F)return f?F.parent[F.field].splice(F.index,1,i(f),P):F.parent[F.field][F.index]=P,!0}}return!0},t),e}:o)(e),F(e),P(e),V(e,[M,r?o:W,B,R,$]),q(e,t),se(e),ue(e)}function C(e,t){var n={$continuation:!0,type:e?"FunctionDeclaration":"FunctionExpression",id:e?"string"==typeof e?h(e):e:void 0,params:[],body:{type:"BlockStatement",body:i(t)}};return e&&(ce[e]={def:n}),n}function _(e){return{type:"AwaitExpression",argument:H({type:"FunctionExpression",generator:!1,expression:!1,async:!0,params:[],body:{type:"BlockStatement",body:e}}).body.body[0].argument}}function L(e,t){"string"==typeof e&&(e=h(e));var n=y.part("$0.call($1)",[e,[{type:"ThisExpression"}].concat(t||[])]).expr;return e.$thisCall=n,n.$thisCallName=e.name,n}function O(e,t){return{type:"ReturnStatement",argument:L(e,t)}}function T(e,t){return{type:"CallExpression",callee:h(e.$seh+"Finally"),arguments:t?[t]:[]}}function N(e,t){if(Array.isArray(e))return e.map(function(e){return N(e,t)});var r=0,i=0;return y.treeWalker(e,function(e,t,s){if("ReturnStatement"!==e.type||e.$mapped){if("ThrowStatement"===e.type){var o=a(e).isAsync;if(r>0){if(!o)return t(e);delete e.async}return void(!o&&i?t():(e.type="ReturnStatement",e.$mapped=!0,e.argument={type:"CallExpression",callee:k(s,[n]).$error,arguments:[e.argument]}))}return"TryStatement"===e.type?(i++,t(e),void i--):a(e).isFunction?(r++,t(e),void r--):void t(e)}if(r>0){if(!a(e).isAsync)return t(e);delete e.async}return e.$mapped=!0,void(a(e.argument).isUnaryExpression&&"void"===e.argument.operator?e.argument=e.argument.argument:e.argument={type:"CallExpression",callee:k(s,[n]).$return,arguments:e.argument?[e.argument]:[]})},t)}function P(e,t){return Array.isArray(e)?e.map(function(e){return P(e,t)}):(y.treeWalker(e,function(e,t,n){if(t(),"ConditionalExpression"===e.type&&(c(e.alternate)||c(e.consequent))){h(E("condOp"));s(e,_(y.part("if ($0) return $1 ; return $2",[e.test,e.consequent,e.alternate]).body))}},t),e)}function F(e,t){return Array.isArray(e)?e.map(function(e){return F(e,t)}):(y.treeWalker(e,function(e,t,n){if(t(),"LogicalExpression"===e.type&&c(e.right)){var r,i=h(E("logical"+("&&"===e.operator?"And":"Or")));if("||"===e.operator)r="var $0; if (!($0 = $1)) {$0 = $2} return $0";else{if("&&"!==e.operator)throw new Error(v(e)+"Illegal logical operator: "+e.operator);r="var $0; if ($0 = $1) {$0 = $2} return $0"}s(e,_(y.part(r,[i,e.left,e.right]).body))}},t),e)}function $(e,t,n){if("SwitchCase"!==e.type&&a(e).isBlockStatement)for(var r=0;r<e.body.length;){var i=e.body[r];if("SwitchCase"!==i.type&&a(i).isBlockStatement){if(ae(i.body))if(l(i)){var s=E(i),o=e.body.splice(r+1,e.body.length-(r+1));if(o.length){var u=C(s,o);delete ce[s],i.body.push(O(s)),e.body.push(u),r++}else r++}else r++;else e.body.splice.apply(e.body,[r,1].concat(i.body))}else r++}}function B(e,t,n){if("IfStatement"===e.type&&c([e.consequent,e.alternate])){var r=E(e),o=t[0],u={type:"BlockStatement",body:[e]};if("index"in o){var l=o.index,p=o.parent[o.field].splice(l+1,o.parent[o.field].length-(l+1));if(o.replace(u),p.length){var h=O(r);u.body.push(n(C(r,p))),[e.consequent,e.alternate].forEach(function(e){if(e){var t;(t=a(e).isBlockStatement?e.body[e.body.length-1]:e)&&"ReturnStatement"===t.type||("BlockStatement"!==e.type&&s(e,{type:"BlockStatement",body:[i(e)]}),e.$deferred=!0,e.body.push(i(h))),n(e)}}),e.consequent&&e.alternate&&e.consequent.$deferred&&e.alternate.$deferred||u.body.push(i(h))}}else o.parent[o.field]=u}}function R(e,t,n){if(!e.$switched&&"SwitchStatement"===e.type&&c(e.cases)){e.$switched=!0;var r,s,o,a=t[0];if("index"in a){var u=a.index+1;(o=a.parent[a.field].splice(u,a.parent[a.field].length-u)).length&&"BreakStatement"===o[o.length-1].type&&a.parent[a.field].push(o.pop()),r=E(e),s=O(r),a.parent[a.field].unshift(C(r,o)),a.parent[a.field].push(i(s))}return e.cases.forEach(function(e,t){if("SwitchCase"!==e.type)throw new Error("switch contains non-case/default statement: "+e.type);if(c(e.consequent)){var n=e.consequent[e.consequent.length-1];"BreakStatement"===n.type?e.consequent[e.consequent.length-1]=i(s):"ReturnStatement"===n.type||"ThrowStatement"===n.type||(d(v(e)+"switch-case fall-through not supported - added break. See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification"),e.consequent.push(i(s)))}}),!0}}function I(e){return"ReturnStatement"===e.type||"ThrowStatement"===e.type}function j(t,r){return y.treeWalker(t,function(t,i,s){if("TryStatement"===t.type&&!t.$seh&&(a(s[0].parent).isBlockStatement||(s[0].parent[s[0].field]={type:"BlockStatement",body:[t]}),t.$seh=E("Try")+"_",t.$containedAwait=!!c(t),t.$finallyExit=t.finalizer&&function(e){for(var t=0;t<e.length;t++)if(a(e[t].self).isFunction)return e[t].self.async||e[t].self.$wasAsync;return!1}(s)&&!!u(t.finalizer.body,I),t.$containedAwait||t.$finallyExit)){t.$needsMapping=!r||!t.$finallyExit;var o=k(s,[n]);if(t.finalizer&&!t.handler){var l=h(E("exception"));t.handler={type:"CatchClause",param:l,body:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:l}]}}}if(!t.handler&&!t.finalizer){var p=new SyntaxError(v(t.value)+"try requires catch and/or finally clause",e.filename,t.start);throw p.pos=t.start,p.loc=t.loc.start,p}t.finalizer?(S(t.block,{$error:t.$seh+"Catch",$return:T(t,o.$return)}),S(t.handler,{$error:T(t,o.$error),$return:T(t,o.$return)})):S(t.block,{$error:t.$seh+"Catch",$return:o.$return})}i()}),t}function D(e,t){for(var n=0;n<e.length;n++)if(!a(e[n]).isDirective)return void e.splice.apply(e,[n,0].concat(t));e.splice.apply(e,[e.length,0].concat(t))}function M(t,r,s){if(t.$needsMapping){var o,a,u,c=r[0];if(!("index"in c))throw new Error(e.filename+" - malformed try/catch blocks");var l=c.index+1,p=c.parent[c.field].splice(l,c.parent[c.field].length-l);if(p.length){var f=s(g(a=t.$seh+"Post",p,[],k(r,[n]).$error));c.parent[c.field].splice(c.index,0,f),o=y.part("return $0()",[t.finalizer?T(t,h(a)):h(a)]).body[0]}else t.finalizer&&(o=O(T(t)));t.$mapped=!0,o&&(t.block.body.push(i(o)),t.handler.body.body.push(i(o)));var d=k(r,[n]);if(t.handler){var v=h(t.$seh+"Catch");u=i(t.handler.body);var b=g(v.name,u,[i(t.handler.param)],t.finalizer?T(t,d.$error):d.$error);t.handler.body.body=[{type:"CallExpression",callee:v,arguments:[i(t.handler.param)]}],c.parent[c.field].splice(c.index,0,b)}if(t.finalizer){s(t.finalizer);var x={exit:h(t.$seh+"Exit"),value:h(t.$seh+"Value"),body:i(t.finalizer.body)},w=y.part("(function ($value) { $:body; return $exit && ($exit.call(this, $value)); })",x).expr,E={type:"VariableDeclaration",kind:"var",declarations:[{type:"VariableDeclarator",id:h(t.$seh+"Finally"),init:m({type:"FunctionExpression",params:[x.exit],id:null,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:m(w,d.$error)}]}})}]};D(c.parent[c.field],[E]);var S=y.part("return $0()",[t.finalizer?T(t,h(a)):h(a)]).body[0];u.body[u.length-1]=S,t.block.body[t.block.body.length-1]=S,delete t.finalizer}}}function V(e,t,n){function r(e,n){return y.treeWalker(e,function(e,n,s){function o(e){return r(e,s)}i.indexOf(e)<0&&(i.push(e),t.forEach(function(t){t(e,s,o)})),n()},n)}var i=[];return r(e,n),e}function q(e,t,o){return y.treeWalker(e,function(e,u,l){if("IfStatement"==e.type&&("BlockStatement"!=e.consequent.type&&c(e.consequent)&&(e.consequent={type:"BlockStatement",body:[e.consequent]}),e.alternate&&"BlockStatement"!=e.alternate.type&&c(e.alternate)&&(e.alternate={type:"BlockStatement",body:[e.alternate]})),u(),a(e).isAwait){var p=e.loc;if(!(t=t||l.some(function(e){return e.self&&e.self.$wasAsync}))||"warn"===t){var f=v(e)+"'await' used inside non-async function. ";n.promises?f+="'return' value Promise runtime-specific":f+="'return' value from await is synchronous",d(f+". See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification")}var y=l[0].parent;"LogicalExpression"===y.type&&y.right===e&&d(v(e.argument)+"'"+r(y)+"' on right of "+y.operator+" will always evaluate '"+r(e.argument)+"'"),"ConditionalExpression"===y.type&&y.test!==e&&d(v(e.argument)+"'"+r(y)+"' will always evaluate '"+r(e.argument)+"'");var g=h(E("await")),b=i(e.argument);s(e,g);for(var x,w,S=1;S<l.length;S++)if(w=a(l[S].self).isBlockStatement){x=l[S-1];break}if(!x)throw new Error(v(e)+"Illegal await not contained in a statement");var A,C,_=k(l,[o,n]),L=x.index,O=w.splice(L,w.length-L).slice(1);"ReturnStatement"===x.self.type&&"CallExpression"===x.self.argument.type&&1===x.self.argument.arguments.length&&x.self.argument.arguments[0].name===g.name?C=A=x.self.argument.callee:"Identifier"===x.self.type||x.self.name===g.name||"ExpressionStatement"===x.self.type&&"Identifier"===x.self.expression.type&&x.self.expression.name===g.name?A=O.length?{type:"FunctionExpression",params:[i(g)],body:q({type:"BlockStatement",body:i(O)},t,_)}:{type:"FunctionExpression",params:[],body:{type:"BlockStatement",body:[]}}:(O.unshift(x.self),A={type:"FunctionExpression",params:[i(g)],body:q({type:"BlockStatement",body:i(O)},t,_)}),C||(C=A?m(A,_.$error):{type:"FunctionExpression",params:[],body:{type:"BlockStatement",body:[]}}),n.wrapAwait&&(b={type:"CallExpression",arguments:[b],callee:n.promises||n.generators?{type:"MemberExpression",object:h("Promise"),property:h("resolve")}:{type:"MemberExpression",object:h("Object"),property:h("$makeThenable")}});var T={type:"CallExpression",callee:{type:"MemberExpression",object:b,property:h("then",p),computed:!1},arguments:[C,_.$error]};w.push({loc:p,type:"ReturnStatement",argument:T})}return!0}),e}function U(e,t){var n=e.$label;delete e.$label;var r=h(E("idx")),i=h(E("in")),o=y.part("var $0,$1 = [];for ($0 in $2) $1.push($0)",[r,i,e.right]).body,u=y.part("for ($0; $1.length;){ $2 = $1.shift(); $:3 ; }",[e.left,i,"VariableDeclaration"===e.left.type?e.left.declarations[0].id:e.left,e.body]).body[0];u.$label=n;for(var c=0;c<t.length;c++)if(a(t[c].parent).isBlockStatement){t[c].parent[t[c].field].splice(t[c].index,0,o[0],o[1]);break}s(e,u)}function z(e,t){"BlockStatement"!==e.body.type&&(e.body={type:"BlockStatement",body:[e.body]});var n,r,i=y.part("[$0[Symbol.iterator]()]",[e.right]).expr;if("VariableDeclaration"===e.left.type){"const"===e.left.kind&&(e.left.kind="let"),n=e.left.declarations[0].id;var s=te(e.left.declarations[0].id);r=h(E("iterator_"+s.join("_"))),e.left.declarations=s.map(function(e){return{type:"VariableDeclarator",id:h(e)}}),e.left.declarations.push({type:"VariableDeclarator",id:r,init:i}),e.init=e.left}else{var o={type:"VariableDeclaration",kind:"var",declarations:[{type:"VariableDeclarator",id:r=h(E("iterator_"+(n=e.left).name)),init:i}]};e.init=o}e.type="ForStatement",e.test=y.part("!($0[1] = $0[0].next()).done && (($1 = $0[1].value) || true)",[r,n]).expr,delete e.left,delete e.right}function W(e,t,r){var i=e.$depth;"ForInStatement"===e.type&&c(e)?U(e,t):"ForOfStatement"===e.type&&c(e)&&z(e);var s=t.some(function(e){return"$label"in e.self&&"ForStatement"===e.self.type&&e.self.$mapped});if(!e.$mapped&&a(e).isLoop&&u(e,function(e){return"AwaitExpression"===e.type&&!e.$hidden||s&&("BreakStatement"===e.type||"ContinueStatement"===e.type)&&e.label})){t[0].self.$mapped=!0;var o=[],l=e.init,p=e.test||b(!0),f=e.update,d=e.body;f&&(f={type:"ExpressionStatement",expression:f}),l&&(a(l).isStatement||(l={type:"ExpressionStatement",expression:l}),o.push(l));var m,g;e.$label?(g=e.$label.name,m=t[1]):(g=le++,m=t[0]);var v,x,w=h((g=n.generatedSymbolPrefix+"Loop_"+g)+"_trampoline"),E=h(g),S=f?h(g+"_step"):E,A=h(g+"_exit");h("q"),h("$exception");if("index"in m){var _=m.index;x=m.parent[m.field].splice(_+1,m.parent[m.field].length-(_+1))}else x=[];v=C(A,x);var L={type:"ReturnStatement",argument:E},O={type:"ReturnStatement",argument:S},T={type:"ReturnStatement",argument:{type:"ArrayExpression",elements:[b(1)]}};y.treeWalker(d,function(e,t,n){if(a(e).isFunction||a(e).isLoop)return!0;if("BreakStatement"===e.type||"ContinueStatement"===e.type)if(e.label)for(var r=n.filter(function(e){return"$label"in e.self}).map(function(e,t){return e.self.$label&&e.self.$label.name}),i=[],s=0;s<r.length;s++){if(r[s]===e.label.name){"BreakStatement"===e.type&&i.push(b(1)),n[0].replace({type:"ReturnStatement",argument:{type:"ArrayExpression",elements:i.reverse()}});break}i.push(b(0))}else"BreakStatement"===e.type?n[0].replace(T):n[0].replace(O);else t()},t),d="BlockStatement"===d.type?d.body.slice(0):[d],d="DoWhileStatement"===e.type?d.concat({type:"IfStatement",test:{type:"UnaryExpression",argument:p,prefix:!0,operator:"!"},consequent:T,alternate:O}):[{type:"IfStatement",test:p,consequent:{type:"BlockStatement",body:d.concat(O)},alternate:T}],n.noRuntime&&o.push({type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:w}],kind:"var"});var N,P=k(t,[n]).$error;N=n.noRuntime?y.part(n.es6target?"($idTrampoline = ((q) => { $$setMapped: while (q) { if (q.then) "+(1===i?" return void q.then($idTrampoline, $exit); ":" return q.then($idTrampoline, $exit); ")+" try { if (q.pop) if (q.length) return q.pop() ? $idContinuation.call(this) : q; else q = $idStep; else q = q.call(this) } catch (_exception) { return $exit(_exception); } } }))($idIter)":"($idTrampoline = (function (q) { $$setMapped: while (q) { if (q.then) "+(1===i?" return void q.then($idTrampoline, $exit); ":" return q.then($idTrampoline, $exit); ")+" try { if (q.pop) if (q.length) return q.pop() ? $idContinuation.call(this) : q; else q = $idStep; else q = q.call(this) } catch (_exception) { return $exit(_exception); } } }).bind(this))($idIter)",{setMapped:function(e){return e.$mapped=!0,e},idTrampoline:w,exit:P,idIter:E,idContinuation:A,idStep:S}).expr:y.part("(Function.$0.trampoline(this,$1,$2,$3,$5)($4))",[pe.asyncbind,A,S,P,E,b(1===i)]).expr,o.push({type:"ReturnStatement",argument:N}),o.push({$label:e.$label,type:"FunctionDeclaration",id:E,params:[],body:{type:"BlockStatement",body:d}}),f&&o.push({type:"FunctionDeclaration",id:S,params:[],body:{type:"BlockStatement",body:[f,L]}}),!l||"VariableDeclaration"!==l.type||"let"!==l.kind&&"const"!==l.kind?(o.push(v),t[0].replace(o.map(r))):("const"===l.kind&&(l.kind="let"),t[0].replace([{type:"BlockStatement",body:o.map(r)},r(v)]))}}function G(e){if(!a(e).isFunction)throw new Error("Cannot examine non-Function node types for async exits");return u(e.body,function(e){return"Identifier"===e.type&&(e.name===n.$return||e.name===n.$error)||I(e)&&a(e).isAsync},function(e){return!(a(e).isFunction&&(e.$wasAsync||a(e).isAsync))})}function J(t){return y.treeWalker(t,function(t,r,i){var s=x(t);if(r(),s&&a(s).isAsync){if("set"==t.kind){var o=new SyntaxError(v(s)+"method 'async set' cannot be invoked",e.filename,t.start);throw o.pos=t.start,o.loc=t.loc.start,o}s.async=!1;var u=w(s);G(s)||0!==s.body.body.length&&"ReturnStatement"===s.body.body[s.body.body.length-1].type||s.body.body.push({type:"ReturnStatement"});var c=m(S({type:"FunctionExpression",params:[pe.return,pe.error],body:J(N(s.body,i)),$wasAsync:!0},n),n.promises||n.generators||n.engine?null:b(!n.lazyThenables||0));n.promises?s.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"NewExpression",callee:h("Promise"),arguments:[c]}}]}:s.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:c}]},u&&D(s.body.body,[he])}})}function H(e){return y.treeWalker(e,function(e,t,r){if(t(),a(e).isAsync&&a(e).isFunction){var i;(i=x(r[0].parent))&&a(i).isAsync&&"get"===r[0].parent.kind&&X(r[0].parent.key),delete e.async;var s=w(e),o=S({type:"FunctionExpression",params:[pe.return,pe.error],$wasAsync:!0},n),u=[{self:o}].concat(r);return a(e.body).isBlockStatement?(G(e)||0!==e.body.body.length&&"ReturnStatement"===e.body.body[e.body.body.length-1].type||e.body.body.push({type:"ReturnStatement"}),o.body={type:"BlockStatement",body:e.body.body.map(function(e){return N(e,u)})}):(o.body={type:"BlockStatement",body:[N({type:"ReturnStatement",argument:e.body},u)]},e.expression=!1),o=m(o,n.promises||n.generators||n.engine?null:b(!n.lazyThenables||0)),n.promises&&(o={type:"NewExpression",callee:h("Promise"),arguments:[o]}),o={type:"BlockStatement",body:[{type:"ReturnStatement",loc:e.loc,argument:o}]},s&&D(o.body,[he]),void(e.body=o)}}),e}function Y(e){if(Array.isArray(e))return e.map(Y);var t=0;return y.treeWalker(e,function(e,n,r){if("ThrowStatement"!==e.type&&"ReturnStatement"!==e.type||e.$mapped){if(a(e).isFunction)return t++,n(e),void t--}else if(t>0&&a(e).isAsync)return delete e.async,e.argument={type:"CallExpression",callee:"ThrowStatement"===e.type?pe.error:pe.return,arguments:e.argument?[e.argument]:[]},void(e.type="ReturnStatement");n(e)})}function Q(e,t){if(n.noRuntime)throw new Error("Nodent: 'noRuntime' option only compatible with -promise and -engine modes");return y.part("{ return (function*($return,$error){ $:body }).$asyncspawn(Promise,this) }",{return:pe.return,error:pe.error,asyncspawn:pe.asyncspawn,body:Y(e).concat(t?[{type:"ReturnStatement",argument:pe.return}]:[])}).body[0]}function X(e){e.$asyncgetwarninig||(e.$asyncgetwarninig=!0,d(v(e)+"'async get "+r(e)+"(){...}' is non-standard. See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification"))}function Z(e,t){function r(e,t){y.treeWalker(e,function(n,r,i){n!==e&&a(n).isFunction||(a(n).isAwait?t?(n.$hidden=!0,r()):(delete n.operator,n.delegate=!1,n.type="YieldExpression",r()):r())})}function o(e){var t=n.promises;n.promises=!0,A(e,!0),n.promises=t}function u(e){return"BlockStatement"!==e.body.type&&(e.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:e.body}]}),e}function c(e,n){n.$asyncexitwarninig||(n.$asyncexitwarninig=!0,d(v(e)+"'async "+{ReturnStatement:"return",ThrowStatement:"throw"}[e.type]+"' not possible in "+(t?"engine":"generator")+" mode. Using Promises for function at "+v(n)))}y.treeWalker(e,function(e,n,i){n();var l,p,h;if(a(e).isAsync&&a(e).isFunction){var f;(f=x(i[0].parent))&&a(f).isAsync&&"get"===i[0].parent.kind&&X(i[0].parent.key),(p=G(e))?(c(p,e.body),o(e)):t?"get"!==i[0].parent.kind&&r(e,!0):(delete(l=e).async,h=w(l),r(l,!1),(l=u(l)).body=Q(l.body.body,p),h&&D(l.body.body,[he]),l.id&&"ExpressionStatement"===i[0].parent.type?(l.type="FunctionDeclaration",i[1].replace(l)):i[0].replace(l))}else(l=x(e))&&a(l).isAsync&&((p=G(l))?(c(p,l),o(e)):t&&"get"!==e.kind||(t?o(e):(e.async=!1,h=w(l),r(l,!1),s(l,u(l)),l.body=Q(l.body.body,p)),h&&D(l.body.body,[he])))});var l=i(n);return n.engine=!1,n.generators=!1,ie(e),ne(e),j(e,l.engine),F(e),P(e),V(e,[M,W,B,R,$]),q(e,"warn"),n.engine=l.engine,n.generators=l.generators,e}function K(e,t,n){var r=[];return y.treeWalker(e,function(i,s,o){if(i===e)return s();t(i,o)?r.push([].concat(o)):n||a(i).isScope||s()}),r}function ee(e,t){var n=[],r={};if((e=e.filter(function(e){return"ExportNamedDeclaration"!==e[0].parent.type})).length){var s={};e.forEach(function(e){function t(e){e in s?r[e]=o.declarations[u]:s[e]=o.declarations[u]}for(var n=e[0],o=n.self,a=(o.kind,[]),u=0;u<o.declarations.length;u++){var c=o.declarations[u];if(te(c.id).forEach(t),c.init){var l={type:"AssignmentExpression",left:i(c.id),operator:"=",right:i(c.init)};a.push(l)}}if(0==a.length)n.remove();else{var p=a.length>1?{type:"SequenceExpression",expressions:a}:a[0];"For"!==n.parent.type.slice(0,3)&&(p={type:"ExpressionStatement",expression:p}),n.replace(p)}});var o=Object.keys(s);o.length&&(o=o.map(function(e){return{type:"VariableDeclarator",id:h(e),loc:s[e].loc,start:s[e].start,end:s[e].end}}),n[0]&&"VariableDeclaration"===n[0].type?n[0].declarations=n[0].declarations.concat(o):n.unshift({type:"VariableDeclaration",kind:t,declarations:o}))}return{decls:n,duplicates:r}}function te(e){if(!e)return[];if(Array.isArray(e))return e.reduce(function(e,t){return e.concat(te(t.id))},[]);switch(e.type){case"Identifier":return[e.name];case"AssignmentPattern":return te(e.left);case"ArrayPattern":return e.elements.reduce(function(e,t){return e.concat(te(t))},[]);case"ObjectPattern":return e.properties.reduce(function(e,t){return e.concat(te(t))},[]);case"ObjectProperty":case"Property":return te(e.value);case"RestElement":case"RestProperty":return te(e.argument)}}function ne(e){function t(e){return u(e,function(e){return"AssignmentExpression"===e.type})}function n(e){return function(t,n){if("VariableDeclaration"===t.type&&(t.kind=t.kind||"var")&&e.indexOf(t.kind)>=0){var r=n[0];return("left"!=r.field||"ForInStatement"!==r.parent.type&&"ForOfStatement"!==r.parent.type)&&("init"!=r.field||"ForStatement"!==r.parent.type||"const"!==t.kind&&"let"!==t.kind)}}}function o(e,t){return!("FunctionDeclaration"!==e.type||!e.id)&&(a(e).isAsync||!e.$continuation)}var l={TemplateLiteral:function(e){return e.expressions},NewExpression:function(e){return e.arguments},CallExpression:function(e){return e.arguments},SequenceExpression:function(e){return e.expressions},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties.map(function(e){return e.value})}};y.treeWalker(e,function(e,n,r){function o(e){h.length&&(e.argument={type:"SequenceExpression",expressions:h.map(function(e){var t=i(e);return s(e,e.left),t}).concat(e.argument)},h=[])}var u;if(n(),e.type in l&&!e.$hoisted){var p=l[e.type](e),h=[];for(u=0;u<p.length;u++)if(!a(p[u]).isScope){if((r=c(p[u]))&&o(r[0].self),!c(p.slice(u+1)))break;(r=t(p[u]))&&h.push(r[0].self)}}else if("VariableDeclaration"===e.type)for(u=e.declarations.length-1;u>0;u--)if(e.declarations[u]&&e.declarations[u].init&&c(e.declarations[u].init)){var f={type:"VariableDeclaration",kind:e.kind,declarations:e.declarations.splice(u)},d=r[0];if(!("index"in d))throw new Error("VariableDeclaration not in a block");d.parent[d.field].splice(d.index+1,0,f)}}),function(e){function t(e){d(v(e)+"Possible assignment to 'const "+r(e)+"'")}function n(e){switch(e.type){case"Identifier":"const"===i[e.name]&&t(e);break;case"ArrayPattern":e.elements.forEach(function(e){"const"===i[e.name]&&t(e)});break;case"ObjectPattern":e.properties.forEach(function(e){"const"===i[e.key.name]&&t(e)})}}var i={};y.treeWalker(e,function(e,t,r){var s=a(e).isBlockStatement;if(s){i=Object.create(i);for(var o=0;o<s.length;o++)if("VariableDeclaration"===s[o].type)for(var u=0;u<s[o].declarations.length;u++)te(s[o].declarations[u].id).forEach(function(e){i[e]=s[o].kind})}t(),"AssignmentExpression"===e.type?n(e.left):"UpdateExpression"===e.type&&n(e.argument),s&&(i=Object.getPrototypeOf(i))})}(e);var p=!1;return y.treeWalker(e,function(e,t,i){var s=p;if(p=p||oe(e),a(e).isBlockStatement){if(c(e)){var l,f,y,m,g;if(!i[0].parent||a(i[0].parent).isScope){var x={},w={};(f=K(e,n(["const"]),!1)).forEach(function(e){e[0].self.declarations.forEach(function(e){te(e.id).forEach(function(t){x[t]||w[t]?(delete x[t],w[t]=e):x[t]=e})})}),f.forEach(function(e){for(var t=0;t<e.length&&!a(e[t].parent).isBlockStatement;t++);var n=e[t];n.append({type:"ExpressionStatement",expression:{type:"SequenceExpression",expressions:e[0].self.declarations.map(function(e){var t={type:"AssignmentExpression",operator:"=",left:e.id,right:e.init};return e.init=null,t})}});var r=te(e[0].self.declarations),i=r.filter(function(e){return e in w});i.length&&e[0].append({type:"VariableDeclaration",kind:"let",declarations:i.map(function(e){return{type:"VariableDeclarator",id:h(e)}})}),e[0].self.kind="var",(i=r.filter(function(e){return e in x})).length?e[0].self.declarations=i.map(function(e){return{type:"VariableDeclarator",id:h(e)}}):n.remove()}),y=K(e,n(["var"]),!1),m=[]}else m=K(e,n(["const"]),!0);m=m.concat(K(e,n(["let"]),!0)),l=K(e,function(e){return a(e).isDirective},!0),g=K(e,o,p),y=y?ee(y,"var"):{duplicates:{},decls:[]},m=m?ee(m,"let"):{duplicates:{},decls:[]},Object.keys(y.duplicates).forEach(function(e){d(v(y.duplicates[e])+"Duplicate declaration '"+r(y.duplicates[e])+"'")}),Object.keys(m.duplicates).forEach(function(e){d(v(m.duplicates[e])+"Duplicate declaration '"+r(m.duplicates[e])+"'")}),g=g.map(function(e){var t,n=e[0];if(a(n.self).isAsync)return t=n.self.id.name,a(n.parent).isBlockStatement?(n.self.type="FunctionDeclaration",n.remove(),n.self):n.replace(h(t));t=n.self.id.name;return"FunctionDeclaration"===n.self.type?n.remove():n.replace(h(t))}),((l=l.map(function(e){return e[0].remove()})).length||y.decls.length||m.decls.length||g.length)&&(e.body=l.concat(y.decls).concat(m.decls).concat(g).concat(e.body))}p=s}if("LabeledStatement"===e.type&&"BlockStatement"===e.body.type&&c(e.body)&&u(e.body,function(e){return"BreakStatement"===e.type&&e.label})&&(e.body.body.push({type:"BreakStatement"}),e.body={type:"DoWhileStatement",test:b(0),body:e.body}),t(),"ForOfStatement"===e.type||"ForInStatement"===e.type||a(e).isLoop){for(var E=0,S=0;S<i.length;S++)if("ForOfStatement"===i[S].self.type||"ForInStatement"===i[S].self.type||a(i[S].self).isLoop)E+=1;else if(a(i[S].self).isFunction)break;e.$depth=E,"LabeledStatement"===i[0].parent.type?e.$label=i[0].parent.label:e.$label=null}return!0}),e}function re(e,t){return y.treeWalker(e,function(e,r,i){if(r(),("ClassDeclaration"===e.type||"ClassExpression"===e.type)&&(e.body.body.forEach(function(e,t){function n(){return e.$superID=e.$superID||h("$super$"+le++)}return function(e){(e=x(e))&&a(e).isAsync&&(!t||"get"===e.kind||u(e,function(e){return a(e).isFunction&&u(e,function(e){return"Super"===e.type})&&u(e,function(e){return e.async&&("ReturnStatement"===e.type||"ThrowStatement"===e.type)})},!0))&&y.treeWalker(e.body,function(e,t,r){var i;a(e).isClass||(t(),"Super"===e.type&&("MemberExpression"===r[0].parent.type?"CallExpression"===r[1].parent.type&&"callee"===r[1].field?(i=y.part("this.$super($field).call(this,$args)",{super:n(),field:r[0].parent.computed?r[0].parent.property:b(r[0].parent.property.name),args:r[1].parent.arguments}).expr,r[2].replace(i)):(i=y.part("this.$super($field)",{super:n(),field:r[0].parent.computed?r[0].parent.property:b(r[0].parent.property.name)}).expr,r[1].replace(i)):d(v(e)+"'super' in async methods must be deferenced. 'async constructor()'/'await super()' not valid.")))})}}(e,t)),e.$superID)){var s=y.part("(function($field) { return super[$field] })",{field:h("$field")}).expr;n.babelTree?(s.type="ClassMethod",s.key=e.$superID,s.kind="method",e.body.body.push(s)):e.body.body.push({type:"MethodDefinition",key:e.$superID,kind:"method",value:s})}})}function ie(e){return y.treeWalker(e,function(e,t,n){return c(e)&&"ArrowFunctionExpression"===e.type&&"BlockStatement"!==e.body.type&&(e.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:e.body}]}),t(),!0}),e}function se(e){return y.treeWalker(e,function(e,t,r){t(),"Identifier"===e.type&&"__nodent"===e.name&&s(e,b(n))}),e}function oe(e){if("Program"===e.type&&"module"===e.sourceType)return!0;var t;if("Program"===e.type)t=e.body;else{if(!a(e).isFunction)return!1;t=e.body.body}if(t)for(var n=0;n<t.length;n++)if(a(t[n]).isDirective&&t[n].expression.value.match(/^\s*use\s+strict\s*$/))return!0;return!1}function ae(e){for(var t=0;t<e.length;t++){var n=e[t];if("ClassDeclaration"===n.type||"VariableDeclaration"===n.type&&("let"===n.kind||"const"===n.kind)||"FunctionDeclaration"===n.type&&n.id&&n.id.name&&!n.$continuation)return!0}return!1}function ue(e){y.treeWalker(e,function(e,t,n){if(t(),"ArrowFunctionExpression"===e.type&&"BlockStatement"===e.body.type&&1===e.body.body.length&&"ReturnStatement"===e.body.body[0].type)e.body=e.body.body[0].argument;else{var r,i;if(r=a(e).isBlockStatement)for(var s=0;s<r.length;s++)(i=a(r[s]).isBlockStatement)&&!ae(i)&&(ae(r[s])||[].splice.apply(r,[s,1].concat(i)))}}),y.treeWalker(e,function(e,t,n){if(t(),a(e).isJump){var r=n[0];if("index"in r)for(var i=r.index+1,s=r.parent[r.field];i<s.length;)"VariableDeclaration"===s[i].type||a(s[i]).isFunction&&s[i].id?i+=1:s.splice(i,1)}}),y.treeWalker(e,function(e,t,n){t(),e.$thisCall&&ce[e.name]&&(ce[e.name].ref?delete ce[e.name]:ce[e.name].ref=e.$thisCall)});var t=Object.keys(ce).map(function(e){return ce[e].ref});if(t.length){y.treeWalker(e,function(e,n,r){if(n(),t.indexOf(e)>=0&&"ReturnStatement"===r[1].self.type){var s=e.$thisCallName,o=i(ce[s].def.body.body);ce[s].$inlined=!0,a(r[1].self).isJump||o.push({type:"ReturnStatement"}),r[1].replace(o)}});var n=Object.keys(ce).map(function(e){return ce[e].$inlined&&ce[e].def});y.treeWalker(e,function(e,t,r){t(),n.indexOf(e)>=0&&r[0].remove()})}if(!("Program"===e.type&&"module"===e.sourceType||u(e,function(e){return a(e).isES6},!0))){var r=oe(e);!function(e){y.treeWalker(e,function(e,t,n){if("Program"===e.type||"FunctionDeclaration"===e.type||"FunctionExpression"===e.type){var i=r;if(r=r||oe(e)){t();var s="Program"===e.type?e:e.body,o=K(s,function(e,t){if("FunctionDeclaration"===e.type)return t[0].parent!==s});o=o.map(function(e){return e[0].remove()}),[].push.apply(s.body,o)}else t();r=i}else t()})}(e)}return y.treeWalker(e,function(e,t,n){t(),Object.keys(e).filter(function(e){return"$"===e[0]}).forEach(function(t){delete e[t]})}),e}var ce={},le=1,pe={};Object.keys(n).filter(function(e){return"$"===e[0]}).forEach(function(e){pe[e.slice(1)]=h(n[e])});var he=y.part("var $0 = arguments",[pe.arguments]).body[0];return n.engine?(e.ast=re(e.ast,!0),e.ast=Z(e.ast,n.engine),e.ast=se(e.ast),ue(e.ast)):n.generators?(e.ast=re(e.ast),e.ast=Z(e.ast),e.ast=se(e.ast),ue(e.ast)):(e.ast=re(e.ast),A(e.ast)),n.babelTree&&y.treeWalker(e.ast,function(e,t,n){t(),"Literal"===e.type&&s(e,b(e.value))}),e}var y=e("./parser"),m=e("./output"),g={start:!0,end:!0,loc:!0,range:!0},v={getScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type?this.node.body.body:"Program"===this.node.type?this.node.body:null},isScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"Program"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type},isFunction:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type},isClass:function(){return"ClassDeclaration"===this.node.type||"ClassExpression"===this.node.type},isBlockStatement:function(){return"ClassBody"===this.node.type||"Program"===this.node.type||"BlockStatement"===this.node.type?this.node.body:"SwitchCase"===this.node.type&&this.node.consequent},isExpressionStatement:function(){return"ExpressionStatement"===this.node.type},isLiteral:function(){return"Literal"===this.node.type||"BooleanLiteral"===this.node.type||"RegExpLiteral"===this.node.type||"NumericLiteral"===this.node.type||"StringLiteral"===this.node.type||"NullLiteral"===this.node.type},isDirective:function(){return"ExpressionStatement"===this.node.type&&("StringLiteral"===this.node.expression.type||"Literal"===this.node.expression.type&&"string"==typeof this.node.expression.value)},isUnaryExpression:function(){return"UnaryExpression"===this.node.type},isAwait:function(){return"AwaitExpression"===this.node.type&&!this.node.$hidden},isAsync:function(){return this.node.async},isStatement:function(){return null!==this.node.type.match(/[a-zA-Z]+Declaration/)||null!==this.node.type.match(/[a-zA-Z]+Statement/)},isExpression:function(){return null!==this.node.type.match(/[a-zA-Z]+Expression/)},isLoop:function(){return"ForStatement"===this.node.type||"WhileStatement"===this.node.type||"DoWhileStatement"===this.node.type},isJump:function(){return"ReturnStatement"===this.node.type||"ThrowStatement"===this.node.type||"BreakStatement"===this.node.type||"ContinueStatement"===this.node.type},isES6:function(){switch(this.node.type){case"ExportNamedDeclaration":case"ExportSpecifier":case"ExportDefaultDeclaration":case"ExportAllDeclaration":case"ImportDeclaration":case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ArrowFunctionExpression":case"ForOfStatement":case"YieldExpression":case"Super":case"RestElement":case"RestProperty":case"SpreadElement":case"TemplateLiteral":case"ClassDeclaration":case"ClassExpression":return!0;case"VariableDeclaration":return this.node.kind&&"var"!==this.node.kind;case"FunctionDeclaration":case"FunctionExpression":return!!this.node.generator}}},b={};Object.keys(v).forEach(function(e){Object.defineProperty(b,e,{get:v[e]})}),t.exports={printNode:r,babelLiteralNode:p,asynchronize:function(e,t,n,r){try{return d(e,0,n,r)}catch(t){if(t instanceof SyntaxError){var i=e.origCode.substr(t.pos-t.loc.column);i=i.split("\n")[0],t.message+=" (nodent)\n"+i+"\n"+i.replace(/[\S ]/g,"-").substring(0,t.loc.column)+"^",t.stack=""}throw t}}}},{"./output":12,"./parser":13}],12:[function(e,t,n){"use strict";function r(e){if("NewExpression"===e.type&&e.arguments&&e.arguments.length)return 19;var t=h[e.type]||h[e.type+e.operator]||h[e.type+e.operator+(e.prefix?"prefix":"")];return void 0!==t?t:20}var i,s,o,a,u,c,l=e("source-map").SourceMapGenerator;if("".repeat)c=function(e,t){return t&&e?e.repeat(t):""};else{var p={};c=function(e,t){if(!t||!e)return"";var n=""+e+t;if(!p[n]){for(var r=[];t--;)r.push(e);p[n]=r.join("")}return p[n]}}var h={ExpressionStatement:-1,Identifier:21,Literal:21,BooleanLiteral:21,RegExpLiteral:21,NumericLiteral:21,StringLiteral:21,NullLiteral:21,ThisExpression:21,SuperExpression:21,ObjectExpression:21,ClassExpression:21,MemberExpression:19,CallExpression:18,NewExpression:18,ArrayExpression:17.5,FunctionExpression:17.5,FunctionDeclaration:17.5,ArrowFunctionExpression:17.5,"UpdateExpression++":17,"UpdateExpression--":17,"UpdateExpression++prefix":16,"UpdateExpression--prefix":16,UnaryExpression:16,AwaitExpression:16,"BinaryExpression**":15,"BinaryExpression*":15,"BinaryExpression/":15,"BinaryExpression%":15,"BinaryExpression+":14,"BinaryExpression-":14,"BinaryExpression<<":13,"BinaryExpression>>":13,"BinaryExpression>>>":13,"BinaryExpression<":12,"BinaryExpression<=":12,"BinaryExpression>":12,"BinaryExpression>=":12,BinaryExpressionin:12,BinaryExpressioninstanceof:12,"BinaryExpression==":11,"BinaryExpression===":11,"BinaryExpression!=":11,"BinaryExpression!==":11,"BinaryExpression&":10,"BinaryExpression^":9,"BinaryExpression|":8,"LogicalExpression&&":7,"LogicalExpression||":6,ConditionalExpression:5,AssignmentPattern:4,AssignmentExpression:4,yield:3,YieldExpression:3,SpreadElement:2,"comma-separated-list":1.5,SequenceExpression:1},f={type:"comma-separated-list"},d={out:function(e,t,n){var r=this[n||e.type];r?r.call(this,e,t):t.write(e,"/*"+e.type+"?*/ "+t.sourceAt(e.start,e.end))},expr:function(e,t,n,i){2===i||r(n)<r(t)||r(n)==r(t)&&(i||t.right===n)?(e.write(null,"("),this.out(n,e,n.type),e.write(null,")")):this.out(n,e,n.type)},argumentList:function(e,t){t.write(e,"(");var n=e.arguments;if(n.length>0)for(var r=n.length,i=0;i<r;i++)0!=i&&t.write(null,", "),this.expr(t,f,n[i]);t.write(null,")")},formatParameters:function(e,t){var n;if(t.write(null,"("),null!=e&&e.length>0){this.out(e[0],t,e[0].type);for(var r=1,i=e.length;r<i;r++)n=e[r],t.write(n,", "),this.out(n,t,n.type)}t.write(null,") ")},Program:function(e,t){for(var n,r,i=c(t.indent,t.indentLevel),s=t.lineEnd,o=0,a=(n=e.body).length;o<a;o++)r=n[o],t.write(null,i),this.out(r,t,r.type),t.write(null,s)},BlockStatement:u=function(e,t){var n,r,i=c(t.indent,t.indentLevel++),s=t.lineEnd,o=i+t.indent;if(t.write(e,"{"),null!=(n=e.body)&&n.length>0){t.write(null,s);for(var a=0,u=n.length;a<u;a++)r=n[a],t.write(null,o),this.out(r,t,r.type),t.write(null,s);t.write(null,i)}t.write(e.loc?{loc:{start:{line:e.loc.end.line,column:0}}}:null,"}"),t.indentLevel--},ClassBody:u,EmptyStatement:function(e,t){t.write(e,";")},ParenthesizedExpression:function(e,t){this.expr(t,e,e.expression,2)},ExpressionStatement:function(e,t){"FunctionExpression"===e.expression.type||"ObjectExpression"===e.expression.type?(t.write(null,"("),this.expr(t,e,e.expression),t.write(null,")")):this.expr(t,e,e.expression),t.write(null,";")},IfStatement:function(e,t){t.write(e,"if ("),this.out(e.test,t,e.test.type),t.write(null,") "),"BlockStatement"!==e.consequent.type&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1)),this.out(e.consequent,t,e.consequent.type),null!=e.alternate&&("BlockStatement"!==e.consequent.type&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel)),t.write(null," else "),"BlockStatement"!==e.alternate.type&&"IfStatement"!==e.alternate.type&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1)),this.out(e.alternate,t,e.alternate.type))},LabeledStatement:function(e,t){this.out(e.label,t,e.label.type),t.write(null,":"),this.out(e.body,t,e.body.type)},BreakStatement:function(e,t){t.write(e,"break"),e.label&&(t.write(null," "),this.out(e.label,t,e.label.type)),t.write(null,";")},ContinueStatement:function(e,t){t.write(e,"continue"),e.label&&(t.write(null," "),this.out(e.label,t,e.label.type)),t.write(null,";")},WithStatement:function(e,t){t.write(e,"with ("),this.out(e.object,t,e.object.type),t.write(null,") "),this.out(e.body,t,e.body.type)},SwitchStatement:function(e,t){var n,r,i,s=c(t.indent,t.indentLevel++),o=t.lineEnd;t.indentLevel++;var a=s+t.indent,u=a+t.indent;t.write(e,"switch ("),this.out(e.discriminant,t,e.discriminant.type),t.write(null,") {",o);for(var l=e.cases,p=0;p<l.length;p++){(n=l[p]).test?(t.write(n,a,"case "),this.out(n.test,t,n.test.type),t.write(null,":",o)):t.write(n,a,"default:",o),r=n.consequent;for(var h=0;h<r.length;h++)i=r[h],t.write(null,u),this.out(i,t,i.type),t.write(null,o)}t.indentLevel-=2,t.write(null,s,"}")},ReturnStatement:function(e,t){e.async&&t.write(e," async "),t.write(e,"return"),e.argument&&(t.write(null," "),this.out(e.argument,t,e.argument.type)),t.write(null,";")},ThrowStatement:function(e,t){e.async&&t.write(e," async "),t.write(e,"throw "),this.out(e.argument,t,e.argument.type),t.write(null,";")},TryStatement:function(e,t){t.write(e,"try "),this.out(e.block,t,e.block.type),e.handler&&this.out(e.handler,t,e.handler.type),e.finalizer&&(t.write(e.finalizer," finally "),this.out(e.finalizer,t,e.finalizer.type))},CatchClause:function(e,t){t.write(e," catch ("),this.out(e.param,t,e.param.type),t.write(null,") "),this.out(e.body,t,e.body.type)},WhileStatement:function(e,t){t.write(e,"while ("),this.out(e.test,t,e.test.type),t.write(null,") "),"BlockStatement"!==e.body.type&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1)),this.out(e.body,t,e.body.type)},DoWhileStatement:function(e,t){t.write(e,"do "),"BlockStatement"!==e.body.type&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1)),this.out(e.body,t,e.body.type),t.write(null," while ("),this.out(e.test,t,e.test.type),t.write(null,");")},ForStatement:function(e,t){if(t.write(e,"for ("),null!=e.init){var n=e.init,r=n.type;t.inForInit++,this.out(n,t,r),t.inForInit--,"VariableDeclaration"!==r&&t.write(null,"; ")}else t.write(null,"; ");e.test&&this.out(e.test,t,e.test.type),t.write(null,"; "),e.update&&this.out(e.update,t,e.update.type),t.write(null,") "),"BlockStatement"!==e.body.type&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1)),this.out(e.body,t,e.body.type)},ForInStatement:i=function(e,t){t.write(e,"for (");var n=e.left,r=n.type;t.inForInit++,this.out(n,t,r),"V"===r[0]&&19===r.length&&t.back(),t.inForInit--,t.write(null,"I"===e.type[3]?" in ":" of "),this.out(e.right,t,e.right.type),t.write(null,") "),"BlockStatement"!==e.body.type&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1)),this.out(e.body,t,e.body.type)},ForOfStatement:i,DebuggerStatement:function(e,t){t.write(e,"debugger;")},Function:function(e,t){e.async&&t.write(e,"async "),t.write(e,e.generator?"function* ":"function "),e.id&&t.write(e.id,e.id.name),this.formatParameters(e.params,t),this.out(e.body,t,e.body.type)},FunctionDeclaration:function(e,t){this.Function(e,t),t.write(null,t.lineEnd,c(t.indent,t.indentLevel))},FunctionExpression:function(e,t){this.Function(e,t)},VariableDeclaration:function(e,t){var n=e.declarations;t.write(e,e.kind," ");var r=n.length;if(r>0){this.out(n[0],t,"VariableDeclarator");for(var i=1;i<r;i++)t.write(null,", "),this.out(n[i],t,"VariableDeclarator")}t.write(null,";")},VariableDeclarator:function(e,t){this.out(e.id,t,e.id.type),null!=e.init&&(t.write(null," = "),this.expr(t,f,e.init))},ClassDeclaration:function(e,t){t.write(e,"class "),e.id&&t.write(e.id,e.id.name+" "),e.superClass&&(t.write(null,"extends "),this.out(e.superClass,t,e.superClass.type),t.write(null," ")),this.out(e.body,t,"BlockStatement")},ImportSpecifier:function(e,t){e.local.name==e.imported.name?this.out(e.local,t,e.local.type):(this.out(e.imported,t,e.imported.type),t.write(null," as "),this.out(e.local,t,e.local.type))},ImportDefaultSpecifier:function(e,t){this.out(e.local,t,e.local.type)},ImportNamespaceSpecifier:function(e,t){t.write(null,"* as "),this.out(e.local,t,e.local.type)},ImportDeclaration:function(e,t){t.write(e,"import ");var n=e.specifiers,r=n.length,i=!0;if(r>0){for(var s=0;s<r;s++)"ImportSpecifier"===n[s].type&&i&&(i=!1,t.write(null,"{")),this.out(n[s],t,n[s].type),s<r-1&&t.write(null,", ");"ImportSpecifier"===n[r-1].type&&t.write(null,"}"),t.write(null," from ")}t.write(e.source,e.source.raw),t.write(null,";")},ExportDefaultDeclaration:function(e,t){t.write(e,"export default "),this.out(e.declaration,t,e.declaration.type)},ExportSpecifier:function(e,t){e.local.name==e.exported.name?this.out(e.local,t,e.local.type):(this.out(e.local,t,e.local.type),t.write(null," as "),this.out(e.exported,t,e.exported.type))},ExportNamedDeclaration:function(e,t){if(t.write(e,"export "),e.declaration)this.out(e.declaration,t,e.declaration.type);else{var n=e.specifiers;if(t.write(e,"{"),n&&n.length>0)for(var r=0;r<n.length;r++)this.out(n[r],t,n[r].type),r<n.length-1&&t.write(null,", ");t.write(null,"}"),e.source&&t.write(e.source," from ",e.source.raw),t.write(null,";")}},ExportAllDeclaration:function(e,t){t.write(e,"export * from "),t.write(e.source,e.source.raw,";")},MethodDefinition:function(e,t){switch(e.value.async&&t.write(e,"async "),e.static&&t.write(e,"static "),e.kind){case"get":case"set":t.write(e,e.kind," ")}e.value.generator&&t.write(null,"*"),e.computed?(t.write(null,"["),this.out(e.key,t,e.key.type),t.write(null,"]")):this.out(e.key,t,e.key.type),this.formatParameters(e.value.params,t),this.out(e.value.body,t,e.value.body.type)},ClassMethod:function(e,t){switch(e.async&&t.write(e,"async "),e.static&&t.write(e,"static "),e.kind){case"get":case"set":t.write(e,e.kind," ")}e.generator&&t.write(null,"*"),e.computed?(t.write(null,"["),this.out(e.key,t,e.key.type),t.write(null,"]")):this.out(e.key,t,e.key.type),this.formatParameters(e.params,t),this.out(e.body,t,e.body.type)},ClassExpression:function(e,t){this.out(e,t,"ClassDeclaration")},ArrowFunctionExpression:function(e,t){e.async&&t.write(e,"async "),1===e.params.length&&"Identifier"===e.params[0].type?(this.out(e.params[0],t,e.params[0].type),t.write(e," => ")):(this.formatParameters(e.params,t),t.write(e,"=> ")),"ObjectExpression"===e.body.type||"SequenceExpression"===e.body.type?(t.write(null,"("),this.out(e.body,t,e.body.type),t.write(null,")")):this.out(e.body,t,e.body.type)},ThisExpression:function(e,t){t.write(e,"this")},Super:function(e,t){t.write(e,"super")},RestElement:s=function(e,t){t.write(e,"..."),this.out(e.argument,t,e.argument.type)},SpreadElement:s,YieldExpression:function(e,t){t.write(e,e.delegate?"yield*":"yield"),e.argument&&(t.write(null," "),this.expr(t,e,e.argument))},AwaitExpression:function(e,t){t.write(e,"await "),this.expr(t,e,e.argument)},TemplateLiteral:function(e,t){var n,r=e.quasis,i=e.expressions;t.write(e,"`");for(var s=0,o=i.length;s<o;s++)n=i[s],t.write(r[s].value,r[s].value.raw),t.write(null,"${"),this.out(n,t,n.type),t.write(null,"}");t.write(r[r.length-1].value,r[r.length-1].value.raw),t.write(e,"`")},TaggedTemplateExpression:function(e,t){this.out(e.tag,t,e.tag.type),this.out(e.quasi,t,e.quasi.type)},ArrayExpression:a=function(e,t){if(t.write(e,"["),e.elements.length>0)for(var n=e.elements,r=n.length,i=0;;){var s=n[i];if(s&&this.expr(t,f,s),((i+=1)<r||null===s)&&t.write(null,","),i>=r)break;t.lineLength()>t.wrapColumn&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1))}t.write(null,"]")},ArrayPattern:a,ObjectExpression:function(e,t){var n,r=c(t.indent,t.indentLevel++),i=t.lineEnd,s=r+t.indent;if(t.write(e,"{"),e.properties.length>0){t.write(null,i);for(var o=e.properties,a=o.length,u=0;n=o[u],t.write(null,s),this.out(n,t,"Property"),++u<a;)t.write(e,",",i),t.lineLength()>t.wrapColumn&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1));t.write(null,i,r,"}")}else t.write(null,"}");t.indentLevel--},Property:function(e,t){e.method||"get"===e.kind||"set"===e.kind?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write(null,"["),this.out(e.key,t,e.key.type),t.write(null,"]")):this.out(e.key,t,e.key.type),t.write(null,": ")),this.expr(t,f,e.value))},ObjectPattern:function(e,t){if(t.write(e,"{"),e.properties.length>0)for(var n=e.properties,r=n.length,i=0;this.out(n[i],t,"Property"),++i<r;)t.write(null,", ");t.write(null,"}")},SequenceExpression:function(e,t){var n,r=e.expressions;if(r.length>0)for(var i=r.length,s=0;s<i;s++)n=r[s],s&&t.write(null,", "),this.expr(t,f,n)},UnaryExpression:function(e,t){e.prefix?(t.write(e,e.operator),e.operator.length>1&&t.write(e," "),this.expr(t,e,e.argument,!0)):(this.expr(t,e,e.argument),t.write(e,e.operator))},UpdateExpression:function(e,t){e.prefix?(t.write(e,e.operator),this.out(e.argument,t,e.argument.type)):(this.out(e.argument,t,e.argument.type),t.write(e,e.operator))},BinaryExpression:o=function(e,t){var n=e.operator;"in"===n&&t.inForInit&&t.write(null,"("),this.expr(t,e,e.left),t.write(e," ",n," "),this.expr(t,e,e.right,"ArrowFunctionExpression"===e.right.type?2:0),"in"===n&&t.inForInit&&t.write(null,")")},LogicalExpression:o,AssignmentExpression:function(e,t){"ObjectPattern"===e.left.type&&t.write(null,"("),this.BinaryExpression(e,t),"ObjectPattern"===e.left.type&&t.write(null,")")},AssignmentPattern:function(e,t){this.expr(t,e,e.left),t.write(e," = "),this.expr(t,e,e.right)},ConditionalExpression:function(e,t){this.expr(t,e,e.test,!0),t.write(e," ? "),this.expr(t,e,e.consequent),t.write(null," : "),this.expr(t,e,e.alternate)},NewExpression:function(e,t){t.write(e,"new "),this.expr(t,e,e.callee,"CallExpression"===e.callee.type||"ObjectExpression"===e.callee.type?2:0),this.argumentList(e,t)},CallExpression:function(e,t){this.expr(t,e,e.callee,"ObjectExpression"===e.callee.type?2:0),this.argumentList(e,t)},MemberExpression:function(e,t){!("ObjectExpression"===e.object.type||e.object.type.match(/Literal$/)&&e.object.raw&&e.object.raw.match(/^[0-9]/))&&("ArrayExpression"===e.object.type||"CallExpression"===e.object.type||"NewExpression"===e.object.type||r(e)<=r(e.object))?this.out(e.object,t,e.object.type):(t.write(null,"("),this.out(e.object,t,e.object.type),t.write(null,")")),e.computed?(t.write(e,"["),this.out(e.property,t,e.property.type),t.write(null,"]")):(t.write(e,"."),this.out(e.property,t,e.property.type))},Identifier:function(e,t){t.write(e,e.name)},Literal:function(e,t){t.write(e,e.raw)},NullLiteral:function(e,t){t.write(e,"null")},BooleanLiteral:function(e,t){t.write(e,JSON.stringify(e.value))},StringLiteral:function(e,t){t.write(e,JSON.stringify(e.value))},RegExpLiteral:function(e,t){t.write(e,e.extra.raw||"/"+e.pattern+"/"+e.flags)},NumericLiteral:function(e,t){t.write(e,JSON.stringify(e.value))}};t.exports=function(e,t,n){var r="",i=[],s=(t=t||{}).map&&new l(t.map);s&&t.map.sourceContent&&s.setSourceContent(t.map.file,t.map.sourceContent);var o="",a=[],u=[],p={inForInit:0,lineLength:function(){return r.length},sourceAt:function(e,t){return n?n.substring(e,t):"/* Omitted Non-standard node */"},write:function(e){o=arguments[arguments.length-1];for(var n=1;n<arguments.length;n++)if(s&&e&&e.loc&&e.loc.start&&s.addMapping({source:t.map.file,original:{line:e.loc.start.line,column:e.loc.start.column},generated:{line:t.map.startLine+i.length+1,column:r.length}}),arguments[n]===p.lineEnd){if(u.length&&(u.forEach(function(e){"Line"===e.type?r+=" // "+e.value:((" /*"+e.value+"*/").split("\n").forEach(function(e){r+=e,i.push(r),r=""}),r=i.pop())}),u=[]),i.push(r),r="",a.length){var l=i.pop();a.forEach(function(e){var t=c(p.indent,e.indent);"Line"===e.type?i.push(t+"//"+e.value):(t+"/*"+e.value+"*/").split("\n").forEach(function(e){i.push(e)})}),i.push(l),a=[]}}else r+=arguments[n],e&&e.$comments&&(e.$comments.forEach(function(t){var n=e.loc.start.column<t.loc.start.column;t.indent=p.indentLevel,n?u.push(t):a.push(t)}),e.$comments=null)},back:function(){r=r.substring(0,r.length-o.length)},indent:" ",lineEnd:"\n",indentLevel:0,wrapColumn:80};d.out(e,p),u=e.$comments||[],p.write(e,p.lineEnd);var h=i.join(p.lineEnd);return t&&t.map?{code:h,map:s}:h}},{"source-map":24}],13:[function(e,t,n){"use strict";function r(e,t){["start","end","loc","range"].forEach(function(n){n in e&&!(n in t)&&(t[n]=e[n])})}function i(e,t,n){function r(e){e.replace=u.replace,e.append=u.append,e.index?(Object.defineProperties(e,{index:{enumerable:!0,get:u.index}}),e.remove=u.removeElement):e.remove=u.removeNode,n.unshift(e),i(e.self,t,n),n.shift()}return n||((n=[{self:e}]).replace=function(e,t){n[e].replace(t)}),t(e,function(){e.type in a&&a[e.type](e,n,function t(i,s,o){if(i===e)return a[o||e.type](e,n,t);for(var u=Object.keys(e),c=0;c<u.length;c++){var l=e[u[c]];Array.isArray(l)?l.indexOf(i)>=0&&r({self:i,parent:e,field:u[c],index:!0}):l instanceof Object&&i===l&&r({self:i,parent:e,field:u[c]})}})},n),e}function s(t,n){var r=[],s={ecmaVersion:8,allowHashBang:!0,allowReturnOutsideFunction:!0,allowImportExportEverywhere:!0,locations:!0,onComment:r};if((!n||!n.noNodentExtensions||parseInt(o.version)<4)&&(c||(parseInt(o.version)<4&&console.warn("Nodent: Warning - noNodentExtensions option requires acorn >=v4.x. Extensions installed."),e("acorn-es7-plugin")(o),c=!0),s.plugins=s.plugins||{},s.plugins.asyncawait={asyncExits:!0,awaitAnywhere:!0}),n)for(var a in n)"noNodentExtensions"!==a&&(s[a]=n[a]);var u=o.parse(t,s);return i(u,function(e,t,n){for(t();r.length&&e.loc&&e.loc.start.line>=r[0].loc.start.line&&e.loc.end.line>=r[0].loc.end.line;)e.$comments=e.$comments||[],e.$comments.push(r.shift())}),u}var o=e("acorn"),a=e("acorn/dist/walk").make({AwaitExpression:function(e,t,n){n(e.argument,t,"Expression")},SwitchStatement:function(e,t,n){n(e.discriminant,t,"Expression");for(var r=0;r<e.cases.length;++r)n(e.cases[r],t)},SwitchCase:function(e,t,n){e.test&&n(e.test,t,"Expression");for(var r=0;r<e.consequent.length;++r)n(e.consequent[r],t,"Statement")},TryStatement:function(e,t,n){n(e.block,t,"Statement"),e.handler&&n(e.handler,t,"Statement"),e.finalizer&&n(e.finalizer,t,"Statement")},CatchClause:function(e,t,n){n(e.param,t,"Pattern"),n(e.body,t,"ScopeBody")},Class:function(e,t,n){e.id&&n(e.id,t,"Pattern"),e.superClass&&n(e.superClass,t,"Expression"),n(e.body,t)},ClassBody:function(e,t,n){for(var r=0;r<e.body.length;r++)n(e.body[r],t)},ObjectPattern:function(e,t,n){for(var r=0,i=e.properties;r<i.length;r+=1)n(i[r],t,"Property")},ClassProperty:function(e,t,n){e.key&&n(e.key,t,"Expression"),e.value&&n(e.value,t,"Expression")},ClassMethod:function(e,t,n){e.key&&n(e.key,t,"Expression"),n(e,t,"Function")},ObjectProperty:function(e,t,n){e.key&&n(e.key,t,"Expression"),e.value&&n(e.value,t,"Expression")},ObjectMethod:function(e,t,n){e.key&&n(e.key,t,"Expression"),n(e,t,"Function")}}),u={replace:function(e){return Array.isArray(e)&&1===e.length&&(e=e[0]),"index"in this?(r(this.parent[this.field][this.index],e),Array.isArray(e)?[].splice.apply(this.parent[this.field],[this.index,1].concat(e)):this.parent[this.field][this.index]=e):(r(this.parent[this.field],e),Array.isArray(e)?this.parent[this.field]={type:"BlockStatement",body:e}:this.parent[this.field]=e),this.self},append:function(e){if(Array.isArray(e)&&1===e.length&&(e=e[0]),!("index"in this))throw new Error("Cannot append Element node to non-array");return Array.isArray(e)?[].splice.apply(this.parent[this.field],[this.index+1,0].concat(e)):this.parent[this.field].splice(this.index+1,0,e),this.self},index:function(){return this.parent[this.field].indexOf(this.self)},removeElement:function(){return this.parent[this.field].splice(this.index,1)[0]},removeNode:function(){var e=this.parent[this.field];return delete this.parent[this.field],e}},c=!1,l={};t.exports={part:function(e,t){function n(e,r){if(Array.isArray(r)&&!Array.isArray(e))throw new Error("Can't substitute an array for a node");return r=r||{},Object.keys(e).forEach(function(i){if(!(e[i]instanceof Object))return r[i]=e[i];if(Array.isArray(e[i]))return r[i]=n(e[i],[]);var s;if(s=Array.isArray(r)?function(e){return"function"==typeof e&&(e=e()),r=r.concat(e)}:function(e){return"function"==typeof e&&(e=e()),r[i]=e,r},"Identifier"===e[i].type&&"$"===e[i].name[0])return s(t[e[i].name.slice(1)]);if("LabeledStatement"===e[i].type&&"$"===e[i].label.name){var o=e[i].body.expression;return s(t[o.name||o.value])}return"LabeledStatement"===e[i].type&&"$$"===e[i].label.name.slice(0,2)?s(t[e[i].label.name.slice(2)](n(e[i]).body)):s(n(e[i]))}),r}l[e]||(l[e]=s(e,{noNodentExtensions:!0,locations:!1,ranges:!1,onComment:null}));var r=n(l[e]);return{body:r.body,expr:"ExpressionStatement"===r.body[0].type?r.body[0].expression:null}},parse:s,treeWalker:i}},{acorn:4,"acorn-es7-plugin":1,"acorn/dist/walk":5}],14:[function(e,t,n){function r(){this._array=[],this._set=o?new Map:Object.create(null)}var i=e("./util"),s=Object.prototype.hasOwnProperty,o="undefined"!=typeof Map;r.fromArray=function(e,t){for(var n=new r,i=0,s=e.length;i<s;i++)n.add(e[i],t);return n},r.prototype.size=function(){return o?this._set.size:Object.getOwnPropertyNames(this._set).length},r.prototype.add=function(e,t){var n=o?e:i.toSetString(e),r=o?this.has(e):s.call(this._set,n),a=this._array.length;r&&!t||this._array.push(e),r||(o?this._set.set(e,a):this._set[n]=a)},r.prototype.has=function(e){if(o)return this._set.has(e);var t=i.toSetString(e);return s.call(this._set,t)},r.prototype.indexOf=function(e){if(o){var t=this._set.get(e);if(t>=0)return t}else{var n=i.toSetString(e);if(s.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')},r.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},r.prototype.toArray=function(){return this._array.slice()},n.ArraySet=r},{"./util":23}],15:[function(e,t,n){var r=e("./base64");n.encode=function(e){var t,n="",i=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{t=31&i,(i>>>=5)>0&&(t|=32),n+=r.encode(t)}while(i>0);return n},n.decode=function(e,t,n){var i,s,o=e.length,a=0,u=0;do{if(t>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(s=r.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));i=!!(32&s),a+=(s&=31)<<u,u+=5}while(i);n.value=function(e){var t=e>>1;return 1==(1&e)?-t:t}(a),n.rest=t}},{"./base64":16}],16:[function(e,t,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");n.encode=function(e){if(0<=e&&e<r.length)return r[e];throw new TypeError("Must be between 0 and 63: "+e)},n.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1}},{}],17:[function(e,t,n){function r(e,t,i,s,o,a){var u=Math.floor((t-e)/2)+e,c=o(i,s[u],!0);return 0===c?u:c>0?t-u>1?r(u,t,i,s,o,a):a==n.LEAST_UPPER_BOUND?t<s.length?t:-1:u:u-e>1?r(e,u,i,s,o,a):a==n.LEAST_UPPER_BOUND?u:e<0?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,i,s){if(0===t.length)return-1;var o=r(-1,t.length,e,t,i,s||n.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&0===i(t[o],t[o-1],!0);)--o;return o}},{}],18:[function(e,t,n){function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=e("./util");r.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},r.prototype.add=function(e){!function(e,t){var n=e.generatedLine,r=t.generatedLine,s=e.generatedColumn,o=t.generatedColumn;return r>n||r==n&&o>=s||i.compareByGeneratedPositionsInflated(e,t)<=0}(this._last,e)?(this._sorted=!1,this._array.push(e)):(this._last=e,this._array.push(e))},r.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=r},{"./util":23}],19:[function(e,t,n){function r(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function i(e,t,n,s){if(n<s){var o=n-1;r(e,function(e,t){return Math.round(e+Math.random()*(t-e))}(n,s),s);for(var a=e[s],u=n;u<s;u++)t(e[u],a)<=0&&r(e,o+=1,u);r(e,o+1,u);var c=o+1;i(e,t,n,c-1),i(e,t,c+1,s)}}n.quickSort=function(e,t){i(e,t,0,e.length-1)}},{}],20:[function(e,t,n){function r(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new o(t):new i(t)}function i(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var n=a.getArg(t,"version"),r=a.getArg(t,"sources"),i=a.getArg(t,"names",[]),s=a.getArg(t,"sourceRoot",null),o=a.getArg(t,"sourcesContent",null),u=a.getArg(t,"mappings"),l=a.getArg(t,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);r=r.map(String).map(a.normalize).map(function(e){return s&&a.isAbsolute(s)&&a.isAbsolute(e)?a.relative(s,e):e}),this._names=c.fromArray(i.map(String),!0),this._sources=c.fromArray(r,!0),this.sourceRoot=s,this.sourcesContent=o,this._mappings=u,this.file=l}function s(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function o(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var n=a.getArg(t,"version"),i=a.getArg(t,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new c,this._names=new c;var s={line:-1,column:0};this._sections=i.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=a.getArg(e,"offset"),n=a.getArg(t,"line"),i=a.getArg(t,"column");if(n<s.line||n===s.line&&i<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=t,{generatedOffset:{generatedLine:n+1,generatedColumn:i+1},consumer:new r(a.getArg(e,"map"))}})}var a=e("./util"),u=e("./binary-search"),c=e("./array-set").ArraySet,l=e("./base64-vlq"),p=e("./quick-sort").quickSort;r.fromSourceMap=function(e){return i.fromSourceMap(e)},r.prototype._version=3,r.prototype.__generatedMappings=null,Object.defineProperty(r.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),r.prototype.__originalMappings=null,Object.defineProperty(r.prototype,"_originalMappings",{get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),r.prototype._charIsMappingSeparator=function(e,t){var n=e.charAt(t);return";"===n||","===n},r.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},r.GENERATED_ORDER=1,r.ORIGINAL_ORDER=2,r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.prototype.eachMapping=function(e,t,n){var i,s=t||null;switch(n||r.GENERATED_ORDER){case r.GENERATED_ORDER:i=this._generatedMappings;break;case r.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;i.map(function(e){var t=null===e.source?null:this._sources.at(e.source);return null!=t&&null!=o&&(t=a.join(o,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}},this).forEach(e,s)},r.prototype.allGeneratedPositionsFor=function(e){var t=a.getArg(e,"line"),n={source:a.getArg(e,"source"),originalLine:t,originalColumn:a.getArg(e,"column",0)};if(null!=this.sourceRoot&&(n.source=a.relative(this.sourceRoot,n.source)),!this._sources.has(n.source))return[];n.source=this._sources.indexOf(n.source);var r=[],i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,u.LEAST_UPPER_BOUND);if(i>=0){var s=this._originalMappings[i];if(void 0===e.column)for(var o=s.originalLine;s&&s.originalLine===o;)r.push({line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var c=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==c;)r.push({line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return r},n.SourceMapConsumer=r,(i.prototype=Object.create(r.prototype)).consumer=r,i.fromSourceMap=function(e){var t=Object.create(i.prototype),n=t._names=c.fromArray(e._names.toArray(),!0),r=t._sources=c.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var o=e._mappings.toArray().slice(),u=t.__generatedMappings=[],l=t.__originalMappings=[],h=0,f=o.length;h<f;h++){var d=o[h],y=new s;y.generatedLine=d.generatedLine,y.generatedColumn=d.generatedColumn,d.source&&(y.source=r.indexOf(d.source),y.originalLine=d.originalLine,y.originalColumn=d.originalColumn,d.name&&(y.name=n.indexOf(d.name)),l.push(y)),u.push(y)}return p(t.__originalMappings,a.compareByOriginalPositions),t},i.prototype._version=3,Object.defineProperty(i.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?a.join(this.sourceRoot,e):e},this)}}),i.prototype._parseMappings=function(e,t){for(var n,r,i,o,u,c=1,h=0,f=0,d=0,y=0,m=0,g=e.length,v=0,b={},x={},w=[],E=[];v<g;)if(";"===e.charAt(v))c++,v++,h=0;else if(","===e.charAt(v))v++;else{for((n=new s).generatedLine=c,o=v;o<g&&!this._charIsMappingSeparator(e,o);o++);if(r=e.slice(v,o),i=b[r])v+=r.length;else{for(i=[];v<o;)l.decode(e,v,x),u=x.value,v=x.rest,i.push(u);if(2===i.length)throw new Error("Found a source, but no line and column");if(3===i.length)throw new Error("Found a source and line, but no column");b[r]=i}n.generatedColumn=h+i[0],h=n.generatedColumn,i.length>1&&(n.source=y+i[1],y+=i[1],n.originalLine=f+i[2],f=n.originalLine,n.originalLine+=1,n.originalColumn=d+i[3],d=n.originalColumn,i.length>4&&(n.name=m+i[4],m+=i[4])),E.push(n),"number"==typeof n.originalLine&&w.push(n)}p(E,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=E,p(w,a.compareByOriginalPositions),this.__originalMappings=w},i.prototype._findMapping=function(e,t,n,r,i,s){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return u.search(e,t,i,s)},i.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(t.generatedLine===n.generatedLine){t.lastGeneratedColumn=n.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},i.prototype.originalPositionFor=function(e){var t={generatedLine:a.getArg(e,"line"),generatedColumn:a.getArg(e,"column")},n=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",a.compareByGeneratedPositionsDeflated,a.getArg(e,"bias",r.GREATEST_LOWER_BOUND));if(n>=0){var i=this._generatedMappings[n];if(i.generatedLine===t.generatedLine){var s=a.getArg(i,"source",null);null!==s&&(s=this._sources.at(s),null!=this.sourceRoot&&(s=a.join(this.sourceRoot,s)));var o=a.getArg(i,"name",null);return null!==o&&(o=this._names.at(o)),{source:s,line:a.getArg(i,"originalLine",null),column:a.getArg(i,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=a.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var n;if(null!=this.sourceRoot&&(n=a.urlParse(this.sourceRoot))){var r=e.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!n.path||"/"==n.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=a.getArg(e,"source");if(null!=this.sourceRoot&&(t=a.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};var n={source:t=this._sources.indexOf(t),originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",r.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===n.source)return{line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=i,(o.prototype=Object.create(r.prototype)).constructor=r,o.prototype._version=3,Object.defineProperty(o.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var n=0;n<this._sections[t].consumer.sources.length;n++)e.push(this._sections[t].consumer.sources[n]);return e}}),o.prototype.originalPositionFor=function(e){var t={generatedLine:a.getArg(e,"line"),generatedColumn:a.getArg(e,"column")},n=u.search(t,this._sections,function(e,t){var n=e.generatedLine-t.generatedOffset.generatedLine;return n||e.generatedColumn-t.generatedOffset.generatedColumn}),r=this._sections[n];return r?r.consumer.originalPositionFor({line:t.generatedLine-(r.generatedOffset.generatedLine-1),column:t.generatedColumn-(r.generatedOffset.generatedLine===t.generatedLine?r.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},o.prototype.sourceContentFor=function(e,t){for(var n=0;n<this._sections.length;n++){var r=this._sections[n].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var n=this._sections[t];if(-1!==n.consumer.sources.indexOf(a.getArg(e,"source"))){var r=n.consumer.generatedPositionFor(e);if(r){return{line:r.line+(n.generatedOffset.generatedLine-1),column:r.column+(n.generatedOffset.generatedLine===r.line?n.generatedOffset.generatedColumn-1:0)}}}}return{line:null,column:null}},o.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var r=this._sections[n],i=r.consumer._generatedMappings,s=0;s<i.length;s++){var o=i[s],u=r.consumer._sources.at(o.source);null!==r.consumer.sourceRoot&&(u=a.join(r.consumer.sourceRoot,u)),this._sources.add(u),u=this._sources.indexOf(u);var c=r.consumer._names.at(o.name);this._names.add(c),c=this._names.indexOf(c);var l={source:u,generatedLine:o.generatedLine+(r.generatedOffset.generatedLine-1),generatedColumn:o.generatedColumn+(r.generatedOffset.generatedLine===o.generatedLine?r.generatedOffset.generatedColumn-1:0),originalLine:o.originalLine,originalColumn:o.originalColumn,name:c};this.__generatedMappings.push(l),"number"==typeof l.originalLine&&this.__originalMappings.push(l)}p(this.__generatedMappings,a.compareByGeneratedPositionsDeflated),p(this.__originalMappings,a.compareByOriginalPositions)},n.IndexedSourceMapConsumer=o},{"./array-set":14,"./base64-vlq":15,"./binary-search":17,"./quick-sort":19,"./util":23}],21:[function(e,t,n){function r(e){e||(e={}),this._file=s.getArg(e,"file",null),this._sourceRoot=s.getArg(e,"sourceRoot",null),this._skipValidation=s.getArg(e,"skipValidation",!1),this._sources=new o,this._names=new o,this._mappings=new a,this._sourcesContents=null}var i=e("./base64-vlq"),s=e("./util"),o=e("./array-set").ArraySet,a=e("./mapping-list").MappingList;r.prototype._version=3,r.fromSourceMap=function(e){var t=e.sourceRoot,n=new r({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var r={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(r.source=e.source,null!=t&&(r.source=s.relative(t,r.source)),r.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(r.name=e.name)),n.addMapping(r)}),e.sources.forEach(function(t){var r=e.sourceContentFor(t);null!=r&&n.setSourceContent(t,r)}),n},r.prototype.addMapping=function(e){var t=s.getArg(e,"generated"),n=s.getArg(e,"original",null),r=s.getArg(e,"source",null),i=s.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,r,i),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=i&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=n&&n.line,originalColumn:null!=n&&n.column,source:r,name:i})},r.prototype.setSourceContent=function(e,t){var n=e;null!=this._sourceRoot&&(n=s.relative(this._sourceRoot,n)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[s.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[s.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},r.prototype.applySourceMap=function(e,t,n){var r=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=e.file}var i=this._sourceRoot;null!=i&&(r=s.relative(i,r));var a=new o,u=new o;this._mappings.unsortedForEach(function(t){if(t.source===r&&null!=t.originalLine){var o=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=o.source&&(t.source=o.source,null!=n&&(t.source=s.join(n,t.source)),null!=i&&(t.source=s.relative(i,t.source)),t.originalLine=o.line,t.originalColumn=o.column,null!=o.name&&(t.name=o.name))}var c=t.source;null==c||a.has(c)||a.add(c);var l=t.name;null==l||u.has(l)||u.add(l)},this),this._sources=a,this._names=u,e.sources.forEach(function(t){var r=e.sourceContentFor(t);null!=r&&(null!=n&&(t=s.join(n,t)),null!=i&&(t=s.relative(i,t)),this.setSourceContent(t,r))},this)},r.prototype._validateMapping=function(e,t,n,r){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||n||r)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))},r.prototype._serializeMappings=function(){for(var e,t,n,r,o=0,a=1,u=0,c=0,l=0,p=0,h="",f=this._mappings.toArray(),d=0,y=f.length;d<y;d++){if(t=f[d],e="",t.generatedLine!==a)for(o=0;t.generatedLine!==a;)e+=";",a++;else if(d>0){if(!s.compareByGeneratedPositionsInflated(t,f[d-1]))continue;e+=","}e+=i.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(r=this._sources.indexOf(t.source),e+=i.encode(r-p),p=r,e+=i.encode(t.originalLine-1-c),c=t.originalLine-1,e+=i.encode(t.originalColumn-u),u=t.originalColumn,null!=t.name&&(n=this._names.indexOf(t.name),e+=i.encode(n-l),l=n)),h+=e}return h},r.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=s.relative(t,e));var n=s.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null},this)},r.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=r},{"./array-set":14,"./base64-vlq":15,"./mapping-list":18,"./util":23}],22:[function(e,t,n){function r(e,t,n,r,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==i?null:i,this[a]=!0,null!=r&&this.add(r)}var i=e("./source-map-generator").SourceMapGenerator,s=e("./util"),o=/(\r?\n)/,a="$$$isSourceNode$$$";r.fromStringWithSourceMap=function(e,t,n){function i(e,t){if(null===e||void 0===e.source)a.add(t);else{var i=n?s.join(n,e.source):e.source;a.add(new r(e.originalLine,e.originalColumn,i,t,e.name))}}var a=new r,u=e.split(o),c=0,l=function(){function e(){return c<u.length?u[c++]:void 0}return e()+(e()||"")},p=1,h=0,f=null;return t.eachMapping(function(e){if(null!==f){if(!(p<e.generatedLine)){var t=(n=u[c]).substr(0,e.generatedColumn-h);return u[c]=n.substr(e.generatedColumn-h),h=e.generatedColumn,i(f,t),void(f=e)}i(f,l()),p++,h=0}for(;p<e.generatedLine;)a.add(l()),p++;if(h<e.generatedColumn){var n=u[c];a.add(n.substr(0,e.generatedColumn)),u[c]=n.substr(e.generatedColumn),h=e.generatedColumn}f=e},this),c<u.length&&(f&&i(f,l()),a.add(u.splice(c).join(""))),t.sources.forEach(function(e){var r=t.sourceContentFor(e);null!=r&&(null!=n&&(e=s.join(n,e)),a.setSourceContent(e,r))}),a},r.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},r.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},r.prototype.walk=function(e){for(var t,n=0,r=this.children.length;n<r;n++)(t=this.children[n])[a]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},r.prototype.join=function(e){var t,n,r=this.children.length;if(r>0){for(t=[],n=0;n<r-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this},r.prototype.replaceRight=function(e,t){var n=this.children[this.children.length-1];return n[a]?n.replaceRight(e,t):"string"==typeof n?this.children[this.children.length-1]=n.replace(e,t):this.children.push("".replace(e,t)),this},r.prototype.setSourceContent=function(e,t){this.sourceContents[s.toSetString(e)]=t},r.prototype.walkSourceContents=function(e){for(var t=0,n=this.children.length;t<n;t++)this.children[t][a]&&this.children[t].walkSourceContents(e);var r=Object.keys(this.sourceContents);for(t=0,n=r.length;t<n;t++)e(s.fromSetString(r[t]),this.sourceContents[r[t]])},r.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e},r.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},n=new i(e),r=!1,s=null,o=null,a=null,u=null;return this.walk(function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?(s===i.source&&o===i.line&&a===i.column&&u===i.name||n.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),s=i.source,o=i.line,a=i.column,u=i.name,r=!0):r&&(n.addMapping({generated:{line:t.line,column:t.column}}),s=null,r=!1);for(var c=0,l=e.length;c<l;c++)10===e.charCodeAt(c)?(t.line++,t.column=0,c+1===l?(s=null,r=!1):r&&n.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++}),this.walkSourceContents(function(e,t){n.setSourceContent(e,t)}),{code:t.code,map:n}},n.SourceNode=r},{"./source-map-generator":21,"./util":23}],23:[function(e,t,n){function r(e){var t=e.match(c);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function i(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function s(e){var t=e,s=r(e);if(s){if(!s.path)return e;t=s.path}for(var o,a=n.isAbsolute(t),u=t.split(/\/+/),c=0,l=u.length-1;l>=0;l--)"."===(o=u[l])?u.splice(l,1):".."===o?c++:c>0&&(""===o?(u.splice(l+1,c),c=0):(u.splice(l,2),c--));return""===(t=u.join("/"))&&(t=a?"/":"."),s?(s.path=t,i(s)):t}function o(e){return e}function a(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function u(e,t){return e===t?0:e>t?1:-1}n.getArg=function(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')};var c=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,l=/^data:.+\,.+$/;n.urlParse=r,n.urlGenerate=i,n.normalize=s,n.join=function(e,t){""===e&&(e="."),""===t&&(t=".");var n=r(t),o=r(e);if(o&&(e=o.path||"/"),n&&!n.scheme)return o&&(n.scheme=o.scheme),i(n);if(n||t.match(l))return t;if(o&&!o.host&&!o.path)return o.host=t,i(o);var a="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return o?(o.path=a,i(o)):a},n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(c)},n.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)};var p=!("__proto__"in Object.create(null));n.toSetString=p?o:function(e){return a(e)?"$"+e:e},n.fromSetString=p?o:function(e){return a(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,t,n){var r=e.source-t.source;return 0!==r?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)||n?r:0!=(r=e.generatedColumn-t.generatedColumn)?r:0!=(r=e.generatedLine-t.generatedLine)?r:e.name-t.name},n.compareByGeneratedPositionsDeflated=function(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-t.generatedColumn)||n?r:0!=(r=e.source-t.source)?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)?r:e.name-t.name},n.compareByGeneratedPositionsInflated=function(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!=(n=e.generatedColumn-t.generatedColumn)?n:0!==(n=u(e.source,t.source))?n:0!=(n=e.originalLine-t.originalLine)?n:0!=(n=e.originalColumn-t.originalColumn)?n:u(e.name,t.name)}},{}],24:[function(e,t,n){n.SourceMapGenerator=e("./lib/source-map-generator").SourceMapGenerator,n.SourceMapConsumer=e("./lib/source-map-consumer").SourceMapConsumer,n.SourceNode=e("./lib/source-node").SourceNode},{"./lib/source-map-consumer":20,"./lib/source-map-generator":21,"./lib/source-node":22}],25:[function(e,t,n){t.exports={_args:[[{raw:"nodent-compiler@>=3.1.5",scope:null,escapedName:"nodent-compiler",name:"nodent-compiler",rawSpec:">=3.1.5",spec:">=3.1.5",type:"range"},"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/nodent"]],_from:"nodent-compiler@>=3.1.5",_id:"nodent-compiler@3.1.5",_inCache:!0,_location:"/nodent-compiler",_nodeVersion:"8.9.1",_npmOperationalInternal:{host:"s3://npm-registry-packages",tmp:"tmp/nodent-compiler-3.1.5.tgz_1511792299537_0.15715787676163018"},_npmUser:{name:"matatbread",email:"npm@mailed.me.uk"},_npmVersion:"5.5.1",_phantomChildren:{},_requested:{raw:"nodent-compiler@>=3.1.5",scope:null,escapedName:"nodent-compiler",name:"nodent-compiler",rawSpec:">=3.1.5",spec:">=3.1.5",type:"range"},_requiredBy:["/nodent"],_resolved:"https://registry.npmjs.org/nodent-compiler/-/nodent-compiler-3.1.5.tgz",_shasum:"8c09289eacf7256bda89c2b88941681d5cccf80c",_shrinkwrap:null,_spec:"nodent-compiler@>=3.1.5",_where:"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/nodent",author:{name:"Mat At Bread",email:"nodent@mailed.me.uk"},bugs:{url:"https://github.com/MatAtBread/nodent/issues"},dependencies:{acorn:">=2.5.2","acorn-es7-plugin":">=1.1.6","source-map":"^0.5.6"},description:"NoDent - Asynchronous Javascript language extensions",devDependencies:{},directories:{},dist:{integrity:"sha512-Istg796un2lALiy/eFNnLbAEMovQqrtpVqXVY8PKs6ycsyBbK480D55misJBQ1QxvstcJ7Hk9xbSVkV8lIi+tg==",shasum:"8c09289eacf7256bda89c2b88941681d5cccf80c",tarball:"https://registry.npmjs.org/nodent-compiler/-/nodent-compiler-3.1.5.tgz"},engines:"node >= 0.10.0",gitHead:"93054f019902e2b107e7be681836273f35a02614",homepage:"https://github.com/MatAtBread/nodent-compiler#readme",keywords:["Javascript","ES7","async","await","language","extensions","Node","callback","generator","Promise","asynchronous"],license:"BSD-2-Clause",main:"compiler.js",maintainers:[{name:"matatbread",email:"npm@mailed.me.uk"}],name:"nodent-compiler",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/MatAtBread/nodent-compiler.git"},scripts:{test:"node tests/basic.js # Please install 'nodent' and test the compiler fully from there."},version:"3.1.5"}},{}],26:[function(e,t,n){"use strict";function r(e,t){if(Function.prototype.$asyncspawn||Object.defineProperty(Function.prototype,"$asyncspawn",{value:r,enumerable:!1,configurable:!0,writable:!0}),this instanceof Function){var n=this;return new e(function(e,r){function i(t,n){var o;try{if((o=t.call(s,n)).done){if(o.value!==e){if(o.value&&o.value===o.value.then)return o.value(e,r);e&&e(o.value),e=null}return}o.value.then?o.value.then(function(e){i(s.next,e)},function(e){i(s.throw,e)}):i(s.next,o.value)}catch(e){return r&&r(e),void(r=null)}}var s=n.call(t,e,r);i(s.next)})}}var i=function(e,t){for(var n=t.toString(),r="return "+n,i=n.match(/.*\(([^)]*)\)/)[1],s=/['"]!!!([^'"]*)['"]/g,o=[];;){var a=s.exec(r);if(!a)break;o.push(a)}return o.reverse().forEach(function(t){r=r.slice(0,t.index)+e[t[1]]+r.substr(t.index+t[0].length)}),r=r.replace(/\/\*[^*]*\*\//g," ").replace(/\s+/g," "),new Function(i,r)()}({zousan:e("./zousan").toString(),thenable:e("./thenableFactory").toString()},function e(t,n){function r(){return i.apply(t,arguments)}Function.prototype.$asyncbind||Object.defineProperty(Function.prototype,"$asyncbind",{value:e,enumerable:!1,configurable:!0,writable:!0}),e.trampoline||(e.trampoline=function(e,t,n,r,i){return function s(o){for(;o;){if(o.then)return o=o.then(s,r),i?void 0:o;try{if(o.pop){if(o.length)return o.pop()?t.call(e):o;o=n}else o=o.call(e)}catch(e){return r(e)}}}}),e.LazyThenable||(e.LazyThenable="!!!thenable"(),e.EagerThenable=e.Thenable=(e.EagerThenableFactory="!!!zousan")());var i=this;switch(n){case!0:return new e.Thenable(r);case 0:return new e.LazyThenable(r);case void 0:return r.then=r,r;default:return function(){try{return i.apply(t,arguments)}catch(e){return n(e)}}}});i(),r(),t.exports={$asyncbind:i,$asyncspawn:r}},{"./thenableFactory":27,"./zousan":28}],27:[function(e,t,n){t.exports=function(){function e(e){return e&&e instanceof Object&&"function"==typeof e.then}function t(n,r,i){try{var s=i?i(r):r;if(n===s)return n.reject(new TypeError("Promise resolution loop"));e(s)?s.then(function(e){t(n,e)},function(e){n.reject(e)}):n.resolve(s)}catch(e){n.reject(e)}}function n(){}function r(e){}function i(r,i){var s=new n;try{this._resolver(function(n){return e(n)?n.then(r,i):t(s,n,r)},function(e){t(s,e,i)})}catch(e){t(s,e,i)}return s}function s(e){this._resolver=e,this.then=i}return n.prototype={resolve:r,reject:r,then:function(e,t){this.resolve=e,this.reject=t}},s.resolve=function(e){return s.isThenable(e)?e:{then:function(t){return t(e)}}},s.isThenable=e,s}},{}],28:[function(e,t,n){(function(e){"use strict";t.exports=function(t){function n(e){if(e){var t=this;e(function(e){t.resolve(e)},function(e){t.reject(e)})}}function r(e,t){if("function"==typeof e.y)try{var n=e.y.call(void 0,t);e.p.resolve(n)}catch(t){e.p.reject(t)}else e.p.resolve(t)}function i(e,t){if("function"==typeof e.n)try{var n=e.n.call(void 0,t);e.p.resolve(n)}catch(t){e.p.reject(t)}else e.p.reject(t)}t=t||"object"==typeof e&&e.nextTick||"function"==typeof setImmediate&&setImmediate||function(e){setTimeout(e,0)};var s=function(){function e(){for(;n.length-r;){try{n[r]()}catch(e){}n[r++]=void 0,r===i&&(n.splice(0,i),r=0)}}var n=[],r=0,i=1024;return function(i){n.push(i),n.length-r==1&&t(e)}}();return n.prototype={resolve:function(e){if(void 0===this.state){if(e===this)return this.reject(new TypeError("Attempt to resolve promise with self"));var t=this;if(e&&("function"==typeof e||"object"==typeof e))try{var n=0,i=e.then;if("function"==typeof i)return void i.call(e,function(e){n++||t.resolve(e)},function(e){n++||t.reject(e)})}catch(e){return void(n||this.reject(e))}this.state=r,this.v=e,t.c&&s(function(){for(var n=0,i=t.c.length;n<i;n++)r(t.c[n],e)})}},reject:function(e){if(void 0===this.state){this.state=i,this.v=e;var t=this.c;t&&s(function(){for(var n=0,r=t.length;n<r;n++)i(t[n],e)})}},then:function(e,t){var r=new n,i={y:e,n:t,p:r};if(void 0===this.state)this.c?this.c.push(i):this.c=[i];else{var o=this.state,a=this.v;s(function(){o(i,a)})}return r}},n.resolve=function(e){if(e&&e instanceof n)return e;var t=new n;return t.resolve(e),t},n.reject=function(e){if(e&&e instanceof n)return e;var t=new n;return t.reject(e),t},n.version="2.3.3-nodent",n}}).call(this,e("_process"))},{_process:32}],29:[function(e,t,n){t.exports=function(e,t,n,r){var i=[[],[]],s=[/(.*)(<script[^>]*>)(.*)/i,/(.*)(<\/script>)(.*)/i],o=0,a=!0;t=t.split("\n");for(var u=0;u<t.length;){var c=s[o].exec(t[u]);c&&0==o&&c[2].match("src=")&&(c=null),c?(1==o?(i[o].push(c[1]),pr=e.compile(i[1].join("\n"),n,3,r.compiler).code,a&&r.runtime&&(a=!1,r.runtime&&i[0].push("Function.prototype.$asyncbind = "+e.$asyncbind.toString()+";\n")),i[0].push(pr),i[1]=[],i[o=0].push(c[2])):(i[o].push(c[1]),i[o].push(c[2]),o=1),t[u]=c[3]):i[o].push(t[u++])}return i[0].join("\n")}},{}],30:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return i.exec(e).slice(1)};n.resolve=function(){for(var n="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,i="/"===o.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),s="/"===o(e,-1);return(e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&s&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),o=Math.min(i.length,s.length),a=o,u=0;u<o;u++)if(i[u]!==s[u]){a=u;break}var c=[];for(u=a;u<i.length;u++)c.push("..");return(c=c.concat(s.slice(a))).join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=s(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},n.basename=function(e,t){var n=s(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return s(e)[3]};var o="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:32}],31:[function(e,t,n){(function(e){"use strict";var n="win32"===e.platform,r=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,i=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/,s={};s.parse=function(e){if("string"!=typeof e)throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e);var t=function(e){var t=r.exec(e),n=(t[1]||"")+(t[2]||""),s=t[3]||"",o=i.exec(s);return[n,o[1],o[2],o[3]]}(e);if(!t||4!==t.length)throw new TypeError("Invalid path '"+e+"'");return{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}};var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a={};a.parse=function(e){if("string"!=typeof e)throw new TypeError("Parameter 'pathString' must be a string, not "+typeof e);var t=function(e){return o.exec(e).slice(1)}(e);if(!t||4!==t.length)throw new TypeError("Invalid path '"+e+"'");return t[1]=t[1]||"",t[2]=t[2]||"",t[3]=t[3]||"",{root:t[0],dir:t[0]+t[1].slice(0,-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}},t.exports=n?s.parse:a.parse,t.exports.posix=a.parse,t.exports.win32=s.parse}).call(this,e("_process"))},{_process:32}],32:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(l===setTimeout)return setTimeout(e,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function o(){y&&f&&(y=!1,f.length?d=f.concat(d):m=-1,d.length&&a())}function a(){if(!y){var e=s(o);y=!0;for(var t=d.length;t;){for(f=d,d=[];++m<t;)f&&f[m].run();m=-1,t=d.length}f=null,y=!1,function(e){if(p===clearTimeout)return clearTimeout(e);if((p===i||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var l,p,h=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(e){l=r}try{p="function"==typeof clearTimeout?clearTimeout:i}catch(e){p=i}}();var f,d=[],y=!1,m=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];d.push(new u(e,t)),1!==d.length||y||s(a)},u.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=c,h.addListener=c,h.once=c,h.off=c,h.removeListener=c,h.removeAllListeners=c,h.emit=c,h.prependListener=c,h.prependOnceListener=c,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],33:[function(e,t,n){var r=e("./lib/core"),i=e("./lib/async");i.core=r,i.isCore=function(e){return r[e]},i.sync=e("./lib/sync"),t.exports=i},{"./lib/async":34,"./lib/core":37,"./lib/sync":39}],34:[function(e,t,n){(function(n){var r=e("./core"),i=e("fs"),s=e("path"),o=e("./caller.js"),a=e("./node-modules-paths.js");t.exports=function(e,t,u){function c(t,n,r){t?d(t):n?d(null,n,r):h(w,function(t,n,r){if(t)d(t);else if(n)d(null,n,r);else{var i=new Error("Cannot find module '"+e+"' from '"+x+"'");i.code="MODULE_NOT_FOUND",d(i)}})}function l(e,t,n){function r(e,t,n){function i(n,i,l){if(c=i,n)return o(n);if(l&&c&&y.pathFilter){var p=s.relative(l,u),h=p.slice(0,p.length-e[0].length),f=y.pathFilter(c,t,h);if(f)return r([""].concat(b.slice()),s.resolve(l,f),c)}g(u,a)}function a(n,i){return n?o(n):i?o(null,u,c):void r(e.slice(1),t,c)}if(0===e.length)return o(null,void 0,n);var u=t+e[0],c=n;c?i(null,c):p(s.dirname(u),i)}var i=t,o=n;"function"==typeof i&&(o=i,i=void 0);r([""].concat(b),e,i)}function p(e,t){if(""===e||"/"===e)return t(null);if("win32"===n.platform&&/^\w:[/\\]*$/.test(e))return t(null);if(/[/\\]node_modules[/\\]*$/.test(e))return t(null);var r=s.join(e,"package.json");g(r,function(n,i){if(!i)return p(s.dirname(e),t);v(r,function(n,i){n&&t(n);try{var s=JSON.parse(i)}catch(e){}s&&y.packageFilter&&(s=y.packageFilter(s,r)),t(null,s,e)})})}function h(e,t,n){var r=n,i=t;"function"==typeof i&&(r=i,i=y.package);var o=s.join(e,"package.json");g(o,function(t,n){return t?r(t):n?void v(o,function(t,n){if(t)return r(t);try{var i=JSON.parse(n)}catch(e){}if(y.packageFilter&&(i=y.packageFilter(i,o)),i.main)return"."!==i.main&&"./"!==i.main||(i.main="index"),void l(s.resolve(e,i.main),i,function(t,n,i){if(t)return r(t);if(n)return r(null,n,i);if(!i)return l(s.join(e,"index"),i,r);h(s.resolve(e,i.main),i,function(t,n,i){return t?r(t):n?r(null,n,i):void l(s.join(e,"index"),i,r)})});l(s.join(e,"/index"),i,r)}):l(s.join(e,"index"),i,r)})}function f(t,n){function r(e,r,i){return e?t(e):r?t(null,r,i):void f(t,n.slice(1))}if(0===n.length)return t(null,void 0);var i=n[0];l(s.join(i,e),void 0,function(n,o,a){return n?t(n):o?t(null,o,a):void h(s.join(i,e),void 0,r)})}var d=u,y=t||{};if("function"==typeof y&&(d=y,y={}),"string"!=typeof e){var m=new TypeError("Path must be a string.");return n.nextTick(function(){d(m)})}var g=y.isFile||function(e,t){i.stat(e,function(e,n){return e?"ENOENT"===e.code||"ENOTDIR"===e.code?t(null,!1):t(e):t(null,n.isFile()||n.isFIFO())})},v=y.readFile||i.readFile,b=y.extensions||[".js"],x=y.basedir||s.dirname(o());if(y.paths=y.paths||[],/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(e)){var w=s.resolve(x,e);".."!==e&&"/"!==e.slice(-1)||(w+="/"),/\/$/.test(e)&&w===x?h(w,y.package,c):l(w,y.package,c)}else!function(e,t,n){f(n,a(t,y))}(0,x,function(t,n,i){if(t)d(t);else if(n)d(null,n,i);else{if(r[e])return d(null,e);var s=new Error("Cannot find module '"+e+"' from '"+x+"'");s.code="MODULE_NOT_FOUND",d(s)}})}}).call(this,e("_process"))},{"./caller.js":35,"./core":37,"./node-modules-paths.js":38,_process:32,fs:7,path:30}],35:[function(e,t,n){t.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=(new Error).stack;return Error.prepareStackTrace=e,t[2].getFileName()}},{}],36:[function(e,t,n){t.exports={assert:!0,buffer_ieee754:"< 0.9.7",buffer:!0,child_process:!0,cluster:!0,console:!0,constants:!0,crypto:!0,_debugger:"< 8",dgram:!0,dns:!0,domain:!0,events:!0,freelist:"< 6",fs:!0,http:!0,http2:">= 8.8",https:!0,_http_server:">= 0.11",_linklist:"< 8",module:!0,net:!0,os:!0,path:!0,perf_hooks:">= 8.5",process:">= 1",punycode:!0,querystring:!0,readline:!0,repl:!0,stream:!0,string_decoder:!0,sys:!0,timers:!0,tls:!0,tty:!0,url:!0,util:!0,v8:">= 1",vm:!0,zlib:!0}},{}],37:[function(e,t,n){(function(n){function r(e){if(!0===e)return!0;for(var t=e.split(" "),n=t[0],r=t[1].split("."),s=0;s<3;++s){var o=Number(i[s]||0),a=Number(r[s]||0);if(o!==a)return"<"===n?o<a:">="===n&&o>=a}return!1}var i=n.versions&&n.versions.node&&n.versions.node.split(".")||[],s=e("./core.json"),o={};for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(o[a]=r(s[a]));t.exports=o}).call(this,e("_process"))},{"./core.json":36,_process:32}],38:[function(e,t,n){var r=e("path"),i=e("fs"),s=r.parse||e("path-parse");t.exports=function(e,t){var n=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"],o=r.resolve(e);if(t&&!1===t.preserveSymlinks)try{o=i.realpathSync(o)}catch(e){if("ENOENT"!==e.code)throw e}var a="/";/^([A-Za-z]:)/.test(o)?a="":/^\\\\/.test(o)&&(a="\\\\");for(var u=[o],c=s(o);c.dir!==u[u.length-1];)u.push(c.dir),c=s(c.dir);var l=u.reduce(function(e,t){return e.concat(n.map(function(e){return r.join(a,t,e)}))},[]);return t&&t.paths?l.concat(t.paths):l}},{fs:7,path:30,"path-parse":31}],39:[function(e,t,n){var r=e("./core"),i=e("fs"),s=e("path"),o=e("./caller.js"),a=e("./node-modules-paths.js");t.exports=function(e,t){function n(e){if(l(e))return e;for(var t=0;t<h.length;t++){var n=e+h[t];if(l(n))return n}}function u(e){var t=s.join(e,"/package.json");if(l(t))try{var r=p(t,"UTF8"),i=JSON.parse(r);if(c.packageFilter&&(i=c.packageFilter(i,e)),i.main){"."!==i.main&&"./"!==i.main||(i.main="index");var o=n(s.resolve(e,i.main));if(o)return o;var a=u(s.resolve(e,i.main));if(a)return a}}catch(e){}return n(s.join(e,"/index"))}if("string"!=typeof e)throw new TypeError("Path must be a string.");var c=t||{},l=c.isFile||function(e){try{var t=i.statSync(e)}catch(e){if(e&&("ENOENT"===e.code||"ENOTDIR"===e.code))return!1;throw e}return t.isFile()||t.isFIFO()},p=c.readFileSync||i.readFileSync,h=c.extensions||[".js"],f=c.basedir||s.dirname(o());if(c.paths=c.paths||[],/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(e)){var d=s.resolve(f,e);".."!==e&&"/"!==e.slice(-1)||(d+="/");var y=n(d)||u(d);if(y)return y}else{var m=function(e,t){for(var r=a(t,c),i=0;i<r.length;i++){var o=r[i],l=n(s.join(o,"/",e));if(l)return l;var p=u(s.join(o,"/",e));if(p)return p}}(e,f);if(m)return m}if(r[e])return e;var g=new Error("Cannot find module '"+e+"' from '"+f+"'");throw g.code="MODULE_NOT_FOUND",g}},{"./caller.js":35,"./core":37,"./node-modules-paths.js":38,fs:7,path:30}],nodent:[function(require,module,exports){(function(process,global,__dirname){"use strict";function copyObj(e){var t={};return e.forEach(function(e){if(e&&"object"==typeof e)for(var n in e)t[n]=e[n]}),t}function globalErrorHandler(e){throw e}function isDirective(e){return"ExpressionStatement"===e.type&&("StringLiteral"===e.expression.type||"Literal"===e.expression.type&&"string"==typeof e.expression.value)}function parseCompilerOptions(code,log,filename){log||(log=console.warn.bind(console));var regex,set,parseOpts={};if("string"==typeof code)(regex=code.match(useDirective))&&(set=regex[1]||"default");else for(var i=0;i<code.body.length&&isDirective(code.body[i].type);i++){var test="'"+code.body[i].value+"'";if(regex=test.match(useDirective)){set=regex[1]||"default";break}}if(!regex){if(!defaultCodeGenOpts.noUseDirective)return null;set="default",regex=[null,null,"{}"]}if(set)try{filename?require("fs").lstatSync(filename).isDirectory()||(filename=require("path").dirname(filename)):filename=require("path").resolve(".");var packagePath=require("resolve").sync("package.json",{moduleDirectory:[""],extensions:[""],basedir:filename}),packageOptions=JSON.parse(fs.readFileSync(packagePath)).nodent.directive[set]}catch(e){}try{parseOpts=copyObj([optionSets[set],packageOptions,regex[2]&&JSON.parse(regex[2])])}catch(e){log("Invalid literal compiler option: "+(regex&®ex[0]||"<no options found>"))}return Object.keys(hostOptions).forEach(function(k){"host"===parseOpts[k]&&(parseOpts[k]=function(){try{return eval(hostOptions[k]),!0}catch(e){return!1}}())}),parseOpts.promises||parseOpts.es7||parseOpts.generators||parseOpts.engine?((parseOpts.promises||parseOpts.es7)&&parseOpts.generators&&(log("No valid 'use nodent' directive, assumed -es7 mode"),parseOpts=optionSets.es7),(parseOpts.generators||parseOpts.engine)&&(parseOpts.promises=!0),parseOpts.promises&&(parseOpts.es7=!0),parseOpts):null}function stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),"#!"===e.substring(0,2)&&(e="//"+e),e}function compileNodentedFile(e,t){return t=t||e.log,function(n,r,i){var s=stripBOM(fs.readFileSync(r,"utf8")),o=e.parse(s,r,i);i=i||parseCompilerOptions(o.ast,t,r),e.asynchronize(o,void 0,i,t),e.prettyPrint(o,i),n._compile(o.code,o.filename)}}function asyncify(e){return e=e||Thenable,function(t,n,r){if(Array.isArray(n)){var i=n;n=function(e,t){return i.indexOf(e)>=0}}else n=n||function(e,t){return!(e.match(/Sync$/)&&e.replace(/Sync$/,"")in t)};r||(r="");var s=Object.create(t);for(var o in s)!function(){var i=o;try{"function"!=typeof t[i]||s[i+r]&&s[i+r].isAsync||!n(i,s)||(s[i+r]=function(){var n=Array.prototype.slice.call(arguments);return new e(function(e,r){var s=function(t,n){if(t)return r(t);switch(arguments.length){case 0:return e();case 2:return e(n);default:return e(Array.prototype.slice.call(arguments,1))}};n.length>t[i].length?n.push(s):n[t[i].length-1]=s;t[i].apply(t,n)})},s[i+r].isAsync=!0)}catch(e){}}();return s.super=t,s}}function generateRequestHandler(e,t,n){var r={},i=this;t||(t=/\.njs$/),n?n.compiler||(n.compiler={}):n={compiler:{}};var s=copyObj([NodentCompiler.initialCodeGenOpts,n.compiler]);return function(o,a,u){function c(e){a.statusCode=500,a.write(e.toString()),a.end()}if(r[o.url])return a.setHeader("Content-Type",r[o.url].contentType),n.setHeaders&&n.setHeaders(a),a.write(r[o.url].output),void a.end();if(!(o.url.match(t)||n.htmlScriptRegex&&o.url.match(n.htmlScriptRegex)))return u&&u();var l=e+o.url;if(n.extensions&&!fs.existsSync(l))for(var p=0;p<n.extensions.length;p++)if(fs.existsSync(l+"."+n.extensions[p])){l=l+"."+n.extensions[p];break}fs.readFile(l,function(e,t){if(e)return c(e);try{var u,l;n.htmlScriptRegex&&o.url.match(n.htmlScriptRegex)?(u=require("./htmlScriptParser")(i,t.toString(),o.url,n),l="text/html"):(n.runtime?(u="Function.prototype."+s.$asyncbind+" = "+$asyncbind.toString()+";",s.generators&&(u+="Function.prototype."+s.$asyncspawn+" = "+$asyncspawn.toString()+";"),s.wrapAwait&&!s.promises&&(u+="Object."+s.$makeThenable+" = "+Thenable.resolve.toString()+";"),s.mapStartLine=u.split("\n").length,u+="\n"):u="",u+=i.compile(t.toString(),o.url,null,s).code,l="application/javascript"),a.setHeader("Content-Type",l),n.enableCache&&(r[o.url]={output:u,contentType:l}),n.setHeaders&&n.setHeaders(a),a.write(u),a.end()}catch(e){return c(e)}})}}function requireCover(e,t){t=t||{};var n=e+"|"+Object.keys(t).sort().reduce(function(e,n){return e+n+JSON.stringify(t[n])},"");return this.covers[n]||(e.indexOf("/")>=0?this.covers[n]=require(e):this.covers[n]=require(__dirname+"/covers/"+e)),this.covers[n](this,t)}function prepareMappedStackTrace(e,t){return e+t.map(function(e){var t=e.getFileName();if(t&&NodentCompiler.prototype.smCache[t]){var n=NodentCompiler.prototype.smCache[t].smc.originalPositionFor({line:e.getLineNumber(),column:e.getColumnNumber()});if(n&&n.line){var r=e.toString();return"\n at "+r.substring(0,r.length-1)+" => …"+n.source+":"+n.line+":"+n.column+(e.getFunctionName()?")":"")}}return"\n at "+e}).join("")}function setGlobalEnvironment(e){var t={};t[defaultCodeGenOpts.$asyncbind]={value:$asyncbind,writable:!0,enumerable:!1,configurable:!0},t[defaultCodeGenOpts.$asyncspawn]={value:$asyncspawn,writable:!0,enumerable:!1,configurable:!0};try{Object.defineProperties(Function.prototype,t)}catch(t){e.log("Function prototypes already assigned: ",t.messsage)}defaultCodeGenOpts[defaultCodeGenOpts.$error]in global||(global[defaultCodeGenOpts[defaultCodeGenOpts.$error]]=globalErrorHandler),e.augmentObject&&Object.defineProperties(Object.prototype,{asyncify:{value:function(e,t,n){return asyncify(e)(this,t,n)},writable:!0,configurable:!0},isThenable:{value:function(){return Thenable.isThenable(this)},writable:!0,configurable:!0}}),Object[defaultCodeGenOpts.$makeThenable]=Thenable.resolve}function initialize(e){function t(n,r){if(!r.match(/nodent\/nodent\.js$/)){if(r.match(/node_modules\/nodent\/.*\.js$/))return stdJSLoader(n,r);for(var o=0;o<i.length;o++)if(r.slice(0,i[o].path.length)==i[o].path){if(i[o].jsCompiler){if(i[o].jsCompiler===t)break;return i[o].jsCompiler.apply(this,arguments)}return stdJSLoader(n,r)}var a=parseCompilerOptions(stripBOM(fs.readFileSync(r,"utf8")),e.log,r);return a?s(n,r,a):stdJSLoader(n,r)}var u={path:r.replace(/\/node_modules\/nodent\/nodent\.js$/,"")};u.path&&(u.version=JSON.parse(fs.readFileSync(r.replace(/nodent\.js$/,"package.json"))).version,stdJSLoader(n,r),function(e,t){e=e.split("."),t=t.split(".");for(var n=0;n<3;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return 0}(u.version,NodentCompiler.prototype.version)<0&&(u.originalNodentLoader=n.exports,n.exports=function(){var t=require.extensions[".js"],n=u.originalNodentLoader.apply(this,arguments);return u.jsCompiler=require.extensions[".js"],require.extensions[".js"]=t,setGlobalEnvironment(e),n},Object.keys(u.originalNodentLoader).forEach(function(e){n.exports[e]=u.originalNodentLoader[e]}),i.push(u),i=i.sort(function(e,t){return t.path.length-e.path.length})))}function n(t){if(Array.isArray(t))return t.forEach(n);if(require.extensions[t]){Object.keys(e).filter(function(t){return compiler[t]!=e[t]}).length&&e.log("File extension "+t+" already configured for async/await compilation.")}require.extensions[t]=compileNodentedFile(compiler,e.log)}if(e){for(var r in e)if("use"!==r&&!config.hasOwnProperty(r))throw new Error("NoDent: unknown option: "+r+"="+JSON.stringify(e[r]))}else e={};compiler?compiler.setOptions(e):(Object.keys(config).forEach(function(t){t in e||(e[t]=config[t])}),compiler=new NodentCompiler(e)),e.dontMapStackTraces||(Error.prepareStackTrace=prepareMappedStackTrace),setGlobalEnvironment(e);var i=[];if(!e.dontInstallRequireHook){if(!stdJSLoader){stdJSLoader=require.extensions[".js"];var s=compileNodentedFile(compiler,e.log);require.extensions[".js"]=t}e.extension&&n(e.extension)}return e.use&&(Array.isArray(e.use)?(e.log("Warning: nodent({use:[...]}) is deprecated. Use nodent.require(module,options)\n"+(new Error).stack.split("\n")[2]),e.use.length&&e.use.forEach(function(e){compiler[e]=compiler.require(e)})):(e.log("Warning: nodent({use:{...}}) is deprecated. Use nodent.require(module,options)\n"+(new Error).stack.split("\n")[2]),Object.keys(e.use).forEach(function(t){compiler[t]=compiler.require(t,e.use[t])}))),compiler}function runFromCLI(){function e(e,n){try{var s,o;if(r.fromast){if(e=JSON.parse(e),s={origCode:"",filename:t,ast:e},!(o=parseCompilerOptions(e,i.log))){var a=r.use?'"use nodent-'+r.use+'";':'"use nodent";';o=parseCompilerOptions(a,i.log),console.warn("/* "+t+": No 'use nodent*' directive, assumed "+a+" */")}}else(o=parseCompilerOptions(r.use?'"use nodent-'+r.use+'";':e,i.log))||(o=parseCompilerOptions('"use nodent";',i.log),r.dest||console.warn("/* "+t+": 'use nodent*' directive missing/ignored, assumed 'use nodent;' */")),s=i.parse(e,t,o);if(r.parseast||r.pretty||i.asynchronize(s,void 0,o,i.log),i.prettyPrint(s,o),r.out||r.pretty||r.dest){if(r.dest&&!n)throw new Error("Can't write unknown file to "+r.dest);var u="";r.runtime&&(u+="Function.prototype.$asyncbind = "+Function.prototype.$asyncbind.toString()+";\n",u+="global.$error = global.$error || "+global.$error.toString()+";\n"),u+=s.code,n&&r.dest?(fs.writeFileSync(r.dest+n,u),console.log("Compiled",r.dest+n)):console.log(u)}(r.minast||r.parseast)&&console.log(JSON.stringify(s.ast,function(e,t){return"$"===e[0]||e.match(/^(start|end|loc)$/)?void 0:t},2,null)),r.ast&&console.log(JSON.stringify(s.ast,function(e,t){return"$"===e[0]?void 0:t},0)),r.exec&&new Function(s.code)()}catch(e){console.error(e)}}var t,n=require("path"),r=(process.env.NODENT_OPTS&&JSON.parse(process.env.NODENT_OPTS),function(e){for(var t=[],n=e||2;n<process.argv.length;n++)if("--"===process.argv[n].slice(0,2)){var r=process.argv[n].slice(2).split("=");t[r[0]]=r[1]||!0}else t.push(process.argv[n]);return t}());initialize.setDefaultCompileOptions({sourcemap:r.sourcemap,wrapAwait:r.wrapAwait,lazyThenables:r.lazyThenables,noRuntime:r.noruntime,es6target:r.es6target,parser:r.noextensions?{noNodentExtensions:!0}:void 0});var i=initialize({augmentObject:!0});if(!(r.fromast||r.parseast||r.pretty||r.out||r.dest||r.ast||r.minast||r.exec))try{var s=n.resolve(r[0]);return require(s)}catch(e){throw e&&(e.message=r[0]+": "+e.message),e}if(0==r.length||"-"===r[0])return t="(stdin)",function(e){return new Thenable(function(t,n){var r=[];e.on("data",function(e){r.push(e)}),e.on("end",function(){var e=r.map(function(e){return e.toString()}).join("");return t(e)}),e.on("error",n)}.$asyncbind(this))}(process.stdin).then(e,globalErrorHandler);for(var o=0;o<r.length;o++)t=n.resolve(r[o]),e(stripBOM(fs.readFileSync(t,"utf8")),r[o])}var stdJSLoader,fs=require("fs"),NodentCompiler=require("nodent-compiler"),config={log:function(e){console.warn("Nodent: "+e)},augmentObject:!1,extension:".njs",dontMapStackTraces:!1,asyncStackTrace:!1,babelTree:!1,dontInstallRequireHook:!1},defaultCodeGenOpts=Object.create(NodentCompiler.initialCodeGenOpts,{es7:{value:!0,writable:!0,enumerable:!0}}),optionSets={default:defaultCodeGenOpts,es7:Object.create(defaultCodeGenOpts),promise:Object.create(defaultCodeGenOpts,{promises:{value:!0,writable:!0,enumerable:!0}}),generator:Object.create(defaultCodeGenOpts,{generators:{value:!0,writable:!0,enumerable:!0},es7:{value:!1,writable:!0,enumerable:!0}}),engine:Object.create(defaultCodeGenOpts,{engine:{value:!0,writable:!0,enumerable:!0},promises:{value:!0,writable:!0,enumerable:!0}}),host:Object.create(defaultCodeGenOpts,{promises:{value:"host",writable:!0,enumerable:!0},es6target:{value:"host",writable:!0,enumerable:!0},engine:{value:"host",writable:!0,enumerable:!0}})};optionSets.promises=optionSets.promise,optionSets.generators=optionSets.generator;var useDirective=/^\s*['"]use\s+nodent-?([a-zA-Z0-9]*)?(\s*.*)?['"]\s*;/,runtimes=require("nodent-runtime"),$asyncbind=runtimes.$asyncbind,$asyncspawn=runtimes.$asyncspawn,Thenable=$asyncbind.Thenable,hostOptions={promises:"Promise",es6target:"()=>0",engine:"(async ()=>0)",noRuntime:"Promise"};NodentCompiler.prototype.Thenable=Thenable,NodentCompiler.prototype.EagerThenable=$asyncbind.EagerThenableFactory,NodentCompiler.prototype.asyncify=asyncify,NodentCompiler.prototype.require=requireCover,NodentCompiler.prototype.generateRequestHandler=generateRequestHandler,NodentCompiler.prototype.$asyncspawn=$asyncspawn,NodentCompiler.prototype.$asyncbind=$asyncbind,NodentCompiler.prototype.parseCompilerOptions=parseCompilerOptions,$asyncbind.call($asyncbind);var compiler;initialize.setDefaultCompileOptions=function(e,t){return e&&Object.keys(e).forEach(function(t){if(!(t in defaultCodeGenOpts))throw new Error("NoDent: unknown compiler option: "+t);defaultCodeGenOpts[t]=e[t]}),t&&Object.keys(t).forEach(function(e){if(!(e in t))throw new Error("NoDent: unknown configuration option: "+e);config[e]=t[e]}),initialize},initialize.setCompileOptions=function(e,t){return optionSet[e]=optionSet[e]||copyObj([defaultCodeGenOpts]),t&&Object.keys(t).forEach(function(n){if(!(n in defaultCodeGenOpts))throw new Error("NoDent: unknown compiler option: "+n);optionSet[e][n]=t[n]}),initialize},initialize.asyncify=asyncify,initialize.Thenable=$asyncbind.Thenable,initialize.EagerThenable=$asyncbind.EagerThenableFactory,module.exports=initialize,require.main===module&&process.argv.length>=3&&runFromCLI()}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},"/node_modules/nodent")},{"./htmlScriptParser":29,_process:32,fs:7,"nodent-compiler":10,"nodent-runtime":26,path:30,resolve:33}]},{},[]); \ No newline at end of file diff --git a/appasar/canary/node_modules/ajv/dist/regenerator.min.js b/appasar/canary/node_modules/ajv/dist/regenerator.min.js new file mode 100644 index 0000000..ef3b8be --- /dev/null +++ b/appasar/canary/node_modules/ajv/dist/regenerator.min.js @@ -0,0 +1,2 @@ +/* regenerator 0.12.2: Source transformer enabling ECMAScript 6 generator functions (yield) in JavaScript-of-today (ES5) */ +require=function e(t,r,n){function i(a,o){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!o&&u)return u(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return i(r||e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,t,r){(function(r){"use strict";function n(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function i(e){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}function s(e){return Object.prototype.toString.call(e)}function a(e){return!i(e)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function o(e){if(g.isFunction(e)){if(x)return e.name;var t=e.toString().match(A);return t&&t[1]}}function u(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function l(e){if(x||!g.isFunction(e))return g.inspect(e);var t=o(e);return"[Function"+(t?": "+t:"")+"]"}function c(e,t,r,n,i){throw new E.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function p(e,t){e||c(e,!0,t,"==",E.ok)}function h(e,t,r,o){if(e===t)return!0;if(i(e)&&i(t))return 0===n(e,t);if(g.isDate(e)&&g.isDate(t))return e.getTime()===t.getTime();if(g.isRegExp(e)&&g.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(a(e)&&a(t)&&s(e)===s(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===n(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(i(e)!==i(t))return!1;var u=(o=o||{actual:[],expected:[]}).actual.indexOf(e);return-1!==u&&u===o.expected.indexOf(t)||(o.actual.push(e),o.expected.push(t),function(e,t,r,n){if(null===e||void 0===e||null===t||void 0===t)return!1;if(g.isPrimitive(e)||g.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=f(e),s=f(t);if(i&&!s||!i&&s)return!1;if(i)return e=v.call(e),t=v.call(t),h(e,t,r);var a,o,u=D(e),l=D(t);if(u.length!==l.length)return!1;for(u.sort(),l.sort(),o=u.length-1;o>=0;o--)if(u[o]!==l[o])return!1;for(o=u.length-1;o>=0;o--)if(a=u[o],!h(e[a],t[a],r,n))return!1;return!0}(e,t,r,o))}return r?e===t:e==t}function f(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function d(e,t,r){h(e,t,!0)&&c(e,t,r,"notDeepStrictEqual",d)}function m(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function y(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&c(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&g.isError(i),o=!e&&i&&!r;if((a&&s&&m(i,r)||o)&&c(i,r,"Got unwanted exception"+n),e&&i&&r&&!m(i,r)||!e&&i)throw i}var g=e("util/"),b=Object.prototype.hasOwnProperty,v=Array.prototype.slice,x="foo"===function(){}.name,E=t.exports=p,A=/\s*function\s+([^\(\s]*)\s*/;E.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return u(l(e.actual),128)+" "+e.operator+" "+u(l(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||c;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=o(t),s=n.indexOf("\n"+i);if(s>=0){var a=n.indexOf("\n",s+1);n=n.substring(a+1)}this.stack=n}}},g.inherits(E.AssertionError,Error),E.fail=c,E.ok=p,E.equal=function(e,t,r){e!=t&&c(e,t,r,"==",E.equal)},E.notEqual=function(e,t,r){e==t&&c(e,t,r,"!=",E.notEqual)},E.deepEqual=function(e,t,r){h(e,t,!1)||c(e,t,r,"deepEqual",E.deepEqual)},E.deepStrictEqual=function(e,t,r){h(e,t,!0)||c(e,t,r,"deepStrictEqual",E.deepStrictEqual)},E.notDeepEqual=function(e,t,r){h(e,t,!1)&&c(e,t,r,"notDeepEqual",E.notDeepEqual)},E.notDeepStrictEqual=d,E.strictEqual=function(e,t,r){e!==t&&c(e,t,r,"===",E.strictEqual)},E.notStrictEqual=function(e,t,r){e===t&&c(e,t,r,"!==",E.notStrictEqual)},E.throws=function(e,t,r){y(!0,e,t,r)},E.doesNotThrow=function(e,t,r){y(!1,e,t,r)},E.ifError=function(e){if(e)throw e};var D=Object.keys||function(e){var t=[];for(var r in e)b.call(e,r)&&t.push(r);return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":613}],2:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("Noop").bases("Node").build(),i("DoExpression").bases("Expression").build("body").field("body",[i("Statement")]),i("Super").bases("Expression").build(),i("BindExpression").bases("Expression").build("object","callee").field("object",s(i("Expression"),null)).field("callee",i("Expression")),i("Decorator").bases("Node").build("expression").field("expression",i("Expression")),i("Property").field("decorators",s([i("Decorator")],null),n.null),i("MethodDefinition").field("decorators",s([i("Decorator")],null),n.null),i("MetaProperty").bases("Expression").build("meta","property").field("meta",i("Identifier")).field("property",i("Identifier")),i("ParenthesizedExpression").bases("Expression").build("expression").field("expression",i("Expression")),i("ImportSpecifier").bases("ModuleSpecifier").build("imported","local").field("imported",i("Identifier")),i("ImportDefaultSpecifier").bases("ModuleSpecifier").build("local"),i("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("local"),i("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",s(i("Declaration"),i("Expression"))),i("ExportNamedDeclaration").bases("Declaration").build("declaration","specifiers","source").field("declaration",s(i("Declaration"),null)).field("specifiers",[i("ExportSpecifier")],n.emptyArray).field("source",s(i("Literal"),null),n.null),i("ExportSpecifier").bases("ModuleSpecifier").build("local","exported").field("exported",i("Identifier")),i("ExportNamespaceSpecifier").bases("Specifier").build("exported").field("exported",i("Identifier")),i("ExportDefaultSpecifier").bases("Specifier").build("exported").field("exported",i("Identifier")),i("ExportAllDeclaration").bases("Declaration").build("exported","source").field("exported",s(i("Identifier"),null)).field("source",i("Literal")),i("CommentBlock").bases("Comment").build("value","leading","trailing"),i("CommentLine").bases("Comment").build("value","leading","trailing")}},{"../lib/shared":18,"../lib/types":19,"./es7":7}],3:[function(e,t,r){t.exports=function(t){t.use(e("./babel")),t.use(e("./flow"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("Directive").bases("Node").build("value").field("value",i("DirectiveLiteral")),i("DirectiveLiteral").bases("Node","Expression").build("value").field("value",String,n["use strict"]),i("BlockStatement").bases("Statement").build("body").field("body",[i("Statement")]).field("directives",[i("Directive")],n.emptyArray),i("Program").bases("Node").build("body").field("body",[i("Statement")]).field("directives",[i("Directive")],n.emptyArray),i("StringLiteral").bases("Literal").build("value").field("value",String),i("NumericLiteral").bases("Literal").build("value").field("value",Number),i("NullLiteral").bases("Literal").build(),i("BooleanLiteral").bases("Literal").build("value").field("value",Boolean),i("RegExpLiteral").bases("Literal").build("pattern","flags").field("pattern",String).field("flags",String);var a=s(i("Property"),i("ObjectMethod"),i("ObjectProperty"),i("SpreadProperty"));i("ObjectExpression").bases("Expression").build("properties").field("properties",[a]),i("ObjectMethod").bases("Node","Function").build("kind","key","params","body","computed").field("kind",s("method","get","set")).field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("params",[i("Pattern")]).field("body",i("BlockStatement")).field("computed",Boolean,n.false).field("generator",Boolean,n.false).field("async",Boolean,n.false).field("decorators",s([i("Decorator")],null),n.null),i("ObjectProperty").bases("Node").build("key","value").field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("value",s(i("Expression"),i("Pattern"))).field("computed",Boolean,n.false);var o=s(i("MethodDefinition"),i("VariableDeclarator"),i("ClassPropertyDefinition"),i("ClassProperty"),i("ClassMethod"));i("ClassBody").bases("Declaration").build("body").field("body",[o]),i("ClassMethod").bases("Declaration","Function").build("kind","key","params","body","computed","static").field("kind",s("get","set","method","constructor")).field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("params",[i("Pattern")]).field("body",i("BlockStatement")).field("computed",Boolean,n.false).field("static",Boolean,n.false).field("generator",Boolean,n.false).field("async",Boolean,n.false).field("decorators",s([i("Decorator")],null),n.null);var u=s(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"),i("SpreadProperty"),i("ObjectProperty"),i("RestProperty"));i("ObjectPattern").bases("Pattern").build("properties").field("properties",[u]).field("decorators",s([i("Decorator")],null),n.null),i("SpreadProperty").bases("Node").build("argument").field("argument",i("Expression")),i("RestProperty").bases("Node").build("argument").field("argument",i("Expression")),i("ForAwaitStatement").bases("Statement").build("left","right","body").field("left",s(i("VariableDeclaration"),i("Expression"))).field("right",i("Expression")).field("body",i("Statement")),i("Import").bases("Expression").build()}},{"../lib/shared":18,"../lib/types":19,"./babel":2,"./flow":9}],4:[function(e,t,r){t.exports=function(t){var r=t.use(e("../lib/types")).Type,n=r.def,i=r.or,s=t.use(e("../lib/shared")),a=s.defaults,o=s.geq;n("Printable").field("loc",i(n("SourceLocation"),null),a.null,!0),n("Node").bases("Printable").field("type",String).field("comments",i([n("Comment")],null),a.null,!0),n("SourceLocation").build("start","end","source").field("start",n("Position")).field("end",n("Position")).field("source",i(String,null),a.null),n("Position").build("line","column").field("line",o(1)).field("column",o(0)),n("File").bases("Node").build("program","name").field("program",n("Program")).field("name",i(String,null),a.null),n("Program").bases("Node").build("body").field("body",[n("Statement")]),n("Function").bases("Node").field("id",i(n("Identifier"),null),a.null).field("params",[n("Pattern")]).field("body",n("BlockStatement")),n("Statement").bases("Node"),n("EmptyStatement").bases("Statement").build(),n("BlockStatement").bases("Statement").build("body").field("body",[n("Statement")]),n("ExpressionStatement").bases("Statement").build("expression").field("expression",n("Expression")),n("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",n("Expression")).field("consequent",n("Statement")).field("alternate",i(n("Statement"),null),a.null),n("LabeledStatement").bases("Statement").build("label","body").field("label",n("Identifier")).field("body",n("Statement")),n("BreakStatement").bases("Statement").build("label").field("label",i(n("Identifier"),null),a.null),n("ContinueStatement").bases("Statement").build("label").field("label",i(n("Identifier"),null),a.null),n("WithStatement").bases("Statement").build("object","body").field("object",n("Expression")).field("body",n("Statement")),n("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",n("Expression")).field("cases",[n("SwitchCase")]).field("lexical",Boolean,a.false),n("ReturnStatement").bases("Statement").build("argument").field("argument",i(n("Expression"),null)),n("ThrowStatement").bases("Statement").build("argument").field("argument",n("Expression")),n("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",n("BlockStatement")).field("handler",i(n("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[n("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[n("CatchClause")],a.emptyArray).field("finalizer",i(n("BlockStatement"),null),a.null),n("CatchClause").bases("Node").build("param","guard","body").field("param",n("Pattern")).field("guard",i(n("Expression"),null),a.null).field("body",n("BlockStatement")),n("WhileStatement").bases("Statement").build("test","body").field("test",n("Expression")).field("body",n("Statement")),n("DoWhileStatement").bases("Statement").build("body","test").field("body",n("Statement")).field("test",n("Expression")),n("ForStatement").bases("Statement").build("init","test","update","body").field("init",i(n("VariableDeclaration"),n("Expression"),null)).field("test",i(n("Expression"),null)).field("update",i(n("Expression"),null)).field("body",n("Statement")),n("ForInStatement").bases("Statement").build("left","right","body").field("left",i(n("VariableDeclaration"),n("Expression"))).field("right",n("Expression")).field("body",n("Statement")),n("DebuggerStatement").bases("Statement").build(),n("Declaration").bases("Statement"),n("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",n("Identifier")),n("FunctionExpression").bases("Function","Expression").build("id","params","body"),n("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",i("var","let","const")).field("declarations",[n("VariableDeclarator")]),n("VariableDeclarator").bases("Node").build("id","init").field("id",n("Pattern")).field("init",i(n("Expression"),null)),n("Expression").bases("Node","Pattern"),n("ThisExpression").bases("Expression").build(),n("ArrayExpression").bases("Expression").build("elements").field("elements",[i(n("Expression"),null)]),n("ObjectExpression").bases("Expression").build("properties").field("properties",[n("Property")]),n("Property").bases("Node").build("kind","key","value").field("kind",i("init","get","set")).field("key",i(n("Literal"),n("Identifier"))).field("value",n("Expression")),n("SequenceExpression").bases("Expression").build("expressions").field("expressions",[n("Expression")]);var u=i("-","+","!","~","typeof","void","delete");n("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",u).field("argument",n("Expression")).field("prefix",Boolean,a.true);var l=i("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");n("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",l).field("left",n("Expression")).field("right",n("Expression"));var c=i("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");n("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",c).field("left",n("Pattern")).field("right",n("Expression"));var p=i("++","--");n("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",p).field("argument",n("Expression")).field("prefix",Boolean);var h=i("||","&&");n("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",n("Expression")).field("right",n("Expression")),n("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",n("Expression")).field("consequent",n("Expression")).field("alternate",n("Expression")),n("NewExpression").bases("Expression").build("callee","arguments").field("callee",n("Expression")).field("arguments",[n("Expression")]),n("CallExpression").bases("Expression").build("callee","arguments").field("callee",n("Expression")).field("arguments",[n("Expression")]),n("MemberExpression").bases("Expression").build("object","property","computed").field("object",n("Expression")).field("property",i(n("Identifier"),n("Expression"))).field("computed",Boolean,function(){var e=this.property.type;return"Literal"===e||"MemberExpression"===e||"BinaryExpression"===e}),n("Pattern").bases("Node"),n("SwitchCase").bases("Node").build("test","consequent").field("test",i(n("Expression"),null)).field("consequent",[n("Statement")]),n("Identifier").bases("Node","Expression","Pattern").build("name").field("name",String),n("Literal").bases("Node","Expression").build("value").field("value",i(String,Boolean,null,Number,RegExp)).field("regex",i({pattern:String,flags:String},null),function(){if(this.value instanceof RegExp){var e="";return this.value.ignoreCase&&(e+="i"),this.value.multiline&&(e+="m"),this.value.global&&(e+="g"),{pattern:this.value.source,flags:e}}return null}),n("Comment").bases("Printable").field("value",String).field("leading",Boolean,a.true).field("trailing",Boolean,a.false)}},{"../lib/shared":18,"../lib/types":19}],5:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or;n("XMLDefaultDeclaration").bases("Declaration").field("namespace",n("Expression")),n("XMLAnyName").bases("Expression"),n("XMLQualifiedIdentifier").bases("Expression").field("left",i(n("Identifier"),n("XMLAnyName"))).field("right",i(n("Identifier"),n("Expression"))).field("computed",Boolean),n("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",i(n("Identifier"),n("Expression"))).field("computed",Boolean),n("XMLAttributeSelector").bases("Expression").field("attribute",n("Expression")),n("XMLFilterExpression").bases("Expression").field("left",n("Expression")).field("right",n("Expression")),n("XMLElement").bases("XML","Expression").field("contents",[n("XML")]),n("XMLList").bases("XML","Expression").field("contents",[n("XML")]),n("XML").bases("Node"),n("XMLEscape").bases("XML").field("expression",n("Expression")),n("XMLText").bases("XML").field("text",String),n("XMLStartTag").bases("XML").field("contents",[n("XML")]),n("XMLEndTag").bases("XML").field("contents",[n("XML")]),n("XMLPointTag").bases("XML").field("contents",[n("XML")]),n("XMLName").bases("XML").field("contents",i(String,[n("XML")])),n("XMLAttribute").bases("XML").field("value",String),n("XMLCdata").bases("XML").field("contents",String),n("XMLComment").bases("XML").field("contents",String),n("XMLProcessingInstruction").bases("XML").field("target",String).field("contents",i(String,null))}},{"../lib/types":19,"./core":4}],6:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("Function").field("generator",Boolean,s.false).field("expression",Boolean,s.false).field("defaults",[i(n("Expression"),null)],s.emptyArray).field("rest",i(n("Identifier"),null),s.null),n("RestElement").bases("Pattern").build("argument").field("argument",n("Pattern")),n("SpreadElementPattern").bases("Pattern").build("argument").field("argument",n("Pattern")),n("FunctionDeclaration").build("id","params","body","generator","expression"),n("FunctionExpression").build("id","params","body","generator","expression"),n("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,s.null).field("body",i(n("BlockStatement"),n("Expression"))).field("generator",!1,s.false),n("YieldExpression").bases("Expression").build("argument","delegate").field("argument",i(n("Expression"),null)).field("delegate",Boolean,s.false),n("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",n("Expression")).field("blocks",[n("ComprehensionBlock")]).field("filter",i(n("Expression"),null)),n("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",n("Expression")).field("blocks",[n("ComprehensionBlock")]).field("filter",i(n("Expression"),null)),n("ComprehensionBlock").bases("Node").build("left","right","each").field("left",n("Pattern")).field("right",n("Expression")).field("each",Boolean),n("Property").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("value",i(n("Expression"),n("Pattern"))).field("method",Boolean,s.false).field("shorthand",Boolean,s.false).field("computed",Boolean,s.false),n("PropertyPattern").bases("Pattern").build("key","pattern").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("pattern",n("Pattern")).field("computed",Boolean,s.false),n("ObjectPattern").bases("Pattern").build("properties").field("properties",[i(n("PropertyPattern"),n("Property"))]),n("ArrayPattern").bases("Pattern").build("elements").field("elements",[i(n("Pattern"),null)]),n("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",i("constructor","method","get","set")).field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("value",n("Function")).field("computed",Boolean,s.false).field("static",Boolean,s.false),n("SpreadElement").bases("Node").build("argument").field("argument",n("Expression")),n("ArrayExpression").field("elements",[i(n("Expression"),n("SpreadElement"),n("RestElement"),null)]),n("NewExpression").field("arguments",[i(n("Expression"),n("SpreadElement"))]),n("CallExpression").field("arguments",[i(n("Expression"),n("SpreadElement"))]),n("AssignmentPattern").bases("Pattern").build("left","right").field("left",n("Pattern")).field("right",n("Expression"));var a=i(n("MethodDefinition"),n("VariableDeclarator"),n("ClassPropertyDefinition"),n("ClassProperty"));n("ClassProperty").bases("Declaration").build("key").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("computed",Boolean,s.false),n("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",a),n("ClassBody").bases("Declaration").build("body").field("body",[a]),n("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",i(n("Identifier"),null)).field("body",n("ClassBody")).field("superClass",i(n("Expression"),null),s.null),n("ClassExpression").bases("Expression").build("id","body","superClass").field("id",i(n("Identifier"),null),s.null).field("body",n("ClassBody")).field("superClass",i(n("Expression"),null),s.null).field("implements",[n("ClassImplements")],s.emptyArray),n("ClassImplements").bases("Node").build("id").field("id",n("Identifier")).field("superClass",i(n("Expression"),null),s.null),n("Specifier").bases("Node"),n("ModuleSpecifier").bases("Specifier").field("local",i(n("Identifier"),null),s.null).field("id",i(n("Identifier"),null),s.null).field("name",i(n("Identifier"),null),s.null),n("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",n("Expression")).field("quasi",n("TemplateLiteral")),n("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[n("TemplateElement")]).field("expressions",[n("Expression")]),n("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean)}},{"../lib/shared":18,"../lib/types":19,"./core":4}],7:[function(e,t,r){t.exports=function(t){t.use(e("./es6"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=(r.builtInTypes,t.use(e("../lib/shared")).defaults);n("Function").field("async",Boolean,s.false),n("SpreadProperty").bases("Node").build("argument").field("argument",n("Expression")),n("ObjectExpression").field("properties",[i(n("Property"),n("SpreadProperty"))]),n("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",n("Pattern")),n("ObjectPattern").field("properties",[i(n("Property"),n("PropertyPattern"),n("SpreadPropertyPattern"))]),n("AwaitExpression").bases("Expression").build("argument","all").field("argument",i(n("Expression"),null)).field("all",Boolean,s.false)}},{"../lib/shared":18,"../lib/types":19,"./es6":6}],8:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("VariableDeclaration").field("declarations",[s(i("VariableDeclarator"),i("Identifier"))]),i("Property").field("value",s(i("Expression"),i("Pattern"))),i("ArrayPattern").field("elements",[s(i("Pattern"),i("SpreadElement"),null)]),i("ObjectPattern").field("properties",[s(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"),i("SpreadProperty"))]),i("ExportSpecifier").bases("ModuleSpecifier").build("id","name"),i("ExportBatchSpecifier").bases("Specifier").build(),i("ImportSpecifier").bases("ModuleSpecifier").build("id","name"),i("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("id"),i("ImportDefaultSpecifier").bases("ModuleSpecifier").build("id"),i("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",s(i("Declaration"),i("Expression"),null)).field("specifiers",[s(i("ExportSpecifier"),i("ExportBatchSpecifier"))],n.emptyArray).field("source",s(i("Literal"),null),n.null),i("ImportDeclaration").bases("Declaration").build("specifiers","source","importKind").field("specifiers",[s(i("ImportSpecifier"),i("ImportNamespaceSpecifier"),i("ImportDefaultSpecifier"))],n.emptyArray).field("source",i("Literal")).field("importKind",s("value","type"),function(){return"value"}),i("Block").bases("Comment").build("value","leading","trailing"),i("Line").bases("Comment").build("value","leading","trailing")}},{"../lib/shared":18,"../lib/types":19,"./es7":7}],9:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("Type").bases("Node"),n("AnyTypeAnnotation").bases("Type").build(),n("EmptyTypeAnnotation").bases("Type").build(),n("MixedTypeAnnotation").bases("Type").build(),n("VoidTypeAnnotation").bases("Type").build(),n("NumberTypeAnnotation").bases("Type").build(),n("NumberLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),n("NumericLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),n("StringTypeAnnotation").bases("Type").build(),n("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",String).field("raw",String),n("BooleanTypeAnnotation").bases("Type").build(),n("BooleanLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Boolean).field("raw",String),n("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",n("Type")),n("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",n("Type")),n("NullLiteralTypeAnnotation").bases("Type").build(),n("NullTypeAnnotation").bases("Type").build(),n("ThisTypeAnnotation").bases("Type").build(),n("ExistsTypeAnnotation").bases("Type").build(),n("ExistentialTypeParam").bases("Type").build(),n("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[n("FunctionTypeParam")]).field("returnType",n("Type")).field("rest",i(n("FunctionTypeParam"),null)).field("typeParameters",i(n("TypeParameterDeclaration"),null)),n("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",n("Identifier")).field("typeAnnotation",n("Type")).field("optional",Boolean),n("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",n("Type")),n("ObjectTypeAnnotation").bases("Type").build("properties","indexers","callProperties").field("properties",[n("ObjectTypeProperty")]).field("indexers",[n("ObjectTypeIndexer")],s.emptyArray).field("callProperties",[n("ObjectTypeCallProperty")],s.emptyArray).field("exact",Boolean,s.false),n("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",i(n("Literal"),n("Identifier"))).field("value",n("Type")).field("optional",Boolean).field("variance",i("plus","minus",null),s.null),n("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",n("Identifier")).field("key",n("Type")).field("value",n("Type")).field("variance",i("plus","minus",null),s.null),n("ObjectTypeCallProperty").bases("Node").build("value").field("value",n("FunctionTypeAnnotation")).field("static",Boolean,s.false),n("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",i(n("Identifier"),n("QualifiedTypeIdentifier"))).field("id",n("Identifier")),n("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",i(n("Identifier"),n("QualifiedTypeIdentifier"))).field("typeParameters",i(n("TypeParameterInstantiation"),null)),n("MemberTypeAnnotation").bases("Type").build("object","property").field("object",n("Identifier")).field("property",i(n("MemberTypeAnnotation"),n("GenericTypeAnnotation"))),n("UnionTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",n("Type")),n("Identifier").field("typeAnnotation",i(n("TypeAnnotation"),null),s.null),n("TypeParameterDeclaration").bases("Node").build("params").field("params",[n("TypeParameter")]),n("TypeParameterInstantiation").bases("Node").build("params").field("params",[n("Type")]),n("TypeParameter").bases("Type").build("name","variance","bound").field("name",String).field("variance",i("plus","minus",null),s.null).field("bound",i(n("TypeAnnotation"),null),s.null),n("Function").field("returnType",i(n("TypeAnnotation"),null),s.null).field("typeParameters",i(n("TypeParameterDeclaration"),null),s.null),n("ClassProperty").build("key","value","typeAnnotation","static").field("value",i(n("Expression"),null)).field("typeAnnotation",i(n("TypeAnnotation"),null)).field("static",Boolean,s.false).field("variance",i("plus","minus",null),s.null),n("ClassImplements").field("typeParameters",i(n("TypeParameterInstantiation"),null),s.null),n("InterfaceDeclaration").bases("Declaration").build("id","body","extends").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterDeclaration"),null),s.null).field("body",n("ObjectTypeAnnotation")).field("extends",[n("InterfaceExtends")]),n("DeclareInterface").bases("InterfaceDeclaration").build("id","body","extends"),n("InterfaceExtends").bases("Node").build("id").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterInstantiation"),null)),n("TypeAlias").bases("Declaration").build("id","typeParameters","right").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterDeclaration"),null)).field("right",n("Type")),n("DeclareTypeAlias").bases("TypeAlias").build("id","typeParameters","right"),n("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",n("Expression")).field("typeAnnotation",n("TypeAnnotation")),n("TupleTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("DeclareVariable").bases("Statement").build("id").field("id",n("Identifier")),n("DeclareFunction").bases("Statement").build("id").field("id",n("Identifier")),n("DeclareClass").bases("InterfaceDeclaration").build("id"),n("DeclareModule").bases("Statement").build("id","body").field("id",i(n("Identifier"),n("Literal"))).field("body",n("BlockStatement")),n("DeclareModuleExports").bases("Statement").build("typeAnnotation").field("typeAnnotation",n("Type")),n("DeclareExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",i(n("DeclareVariable"),n("DeclareFunction"),n("DeclareClass"),n("Type"),null)).field("specifiers",[i(n("ExportSpecifier"),n("ExportBatchSpecifier"))],s.emptyArray).field("source",i(n("Literal"),null),s.null),n("DeclareExportAllDeclaration").bases("Declaration").build("source").field("source",i(n("Literal"),null),s.null)}},{"../lib/shared":18,"../lib/types":19,"./es7":7}],10:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("JSXAttribute").bases("Node").build("name","value").field("name",i(n("JSXIdentifier"),n("JSXNamespacedName"))).field("value",i(n("Literal"),n("JSXExpressionContainer"),null),s.null),n("JSXIdentifier").bases("Identifier").build("name").field("name",String),n("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",n("JSXIdentifier")).field("name",n("JSXIdentifier")),n("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",i(n("JSXIdentifier"),n("JSXMemberExpression"))).field("property",n("JSXIdentifier")).field("computed",Boolean,s.false);var a=i(n("JSXIdentifier"),n("JSXNamespacedName"),n("JSXMemberExpression"));n("JSXSpreadAttribute").bases("Node").build("argument").field("argument",n("Expression"));var o=[i(n("JSXAttribute"),n("JSXSpreadAttribute"))];n("JSXExpressionContainer").bases("Expression").build("expression").field("expression",n("Expression")),n("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",n("JSXOpeningElement")).field("closingElement",i(n("JSXClosingElement"),null),s.null).field("children",[i(n("JSXElement"),n("JSXExpressionContainer"),n("JSXText"),n("Literal"))],s.emptyArray).field("name",a,function(){return this.openingElement.name},!0).field("selfClosing",Boolean,function(){return this.openingElement.selfClosing},!0).field("attributes",o,function(){return this.openingElement.attributes},!0),n("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",a).field("attributes",o,s.emptyArray).field("selfClosing",Boolean,s.false),n("JSXClosingElement").bases("Node").build("name").field("name",a),n("JSXText").bases("Literal").build("value").field("value",String),n("JSXEmptyExpression").bases("Expression").build()}},{"../lib/shared":18,"../lib/types":19,"./es7":7}],11:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")),a=s.geq,o=s.defaults;n("Function").field("body",i(n("BlockStatement"),n("Expression"))),n("ForInStatement").build("left","right","body","each").field("each",Boolean,o.false),n("ForOfStatement").bases("Statement").build("left","right","body").field("left",i(n("VariableDeclaration"),n("Expression"))).field("right",n("Expression")).field("body",n("Statement")),n("LetStatement").bases("Statement").build("head","body").field("head",[n("VariableDeclarator")]).field("body",n("Statement")),n("LetExpression").bases("Expression").build("head","body").field("head",[n("VariableDeclarator")]).field("body",n("Expression")),n("GraphExpression").bases("Expression").build("index","expression").field("index",a(0)).field("expression",n("Literal")),n("GraphIndexExpression").bases("Expression").build("index").field("index",a(0))}},{"../lib/shared":18,"../lib/types":19,"./core":4}],12:[function(e,t,r){t.exports=function(t){function r(e){var t=n.indexOf(e);return-1===t&&(t=n.length,n.push(e),i[t]=e(s)),i[t]}var n=[],i=[],s={};s.use=r;var a=r(e("./lib/types"));t.forEach(r),a.finalize();var o={Type:a.Type,builtInTypes:a.builtInTypes,namedTypes:a.namedTypes,builders:a.builders,defineMethod:a.defineMethod,getFieldNames:a.getFieldNames,getFieldValue:a.getFieldValue,eachField:a.eachField,someField:a.someField,getSupertypeNames:a.getSupertypeNames,astNodesAreEquivalent:r(e("./lib/equiv")),finalize:a.finalize,Path:r(e("./lib/path")),NodePath:r(e("./lib/node-path")),PathVisitor:r(e("./lib/path-visitor")),use:r};return o.visit=o.PathVisitor.visit,o}},{"./lib/equiv":13,"./lib/node-path":14,"./lib/path":16,"./lib/path-visitor":15,"./lib/types":19}],13:[function(e,t,r){t.exports=function(t){function r(e,t,r){return u.check(r)?r.length=0:r=null,i(e,t,r)}function n(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function i(e,t,r){return e===t||(u.check(e)?function(e,t,r){u.assert(e);var n=e.length;if(!u.check(t)||t.length!==n)return r&&r.push("length"),!1;for(var s=0;s<n;++s){if(r&&r.push(s),s in e!=s in t)return!1;if(!i(e[s],t[s],r))return!1;if(r){var a=r.pop();if(a!==s)throw new Error(""+a)}}return!0}(e,t,r):l.check(e)?function(e,t,r){if(l.assert(e),!l.check(t))return!1;if(e.type!==t.type)return r&&r.push("type"),!1;var n=a(e),s=n.length,u=a(t),c=u.length;if(s===c){for(var p=0;p<s;++p){var f=n[p],d=o(e,f),m=o(t,f);if(r&&r.push(f),!i(d,m,r))return!1;if(r){var y=r.pop();if(y!==f)throw new Error(""+y)}}return!0}if(!r)return!1;var g=Object.create(null);for(p=0;p<s;++p)g[n[p]]=!0;for(p=0;p<c;++p){if(f=u[p],!h.call(g,f))return r.push(f),!1;delete g[f]}for(f in g){r.push(f);break}return!1}(e,t,r):c.check(e)?c.check(t)&&+e==+t:p.check(e)?p.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t)}var s=t.use(e("../lib/types")),a=s.getFieldNames,o=s.getFieldValue,u=s.builtInTypes.array,l=s.builtInTypes.object,c=s.builtInTypes.Date,p=s.builtInTypes.RegExp,h=Object.prototype.hasOwnProperty;return r.assert=function(e,t){var i=[];if(!r(e,t,i)){if(0!==i.length)throw new Error("Nodes differ in the following path: "+i.map(n).join(""));if(e!==t)throw new Error("Nodes must be equal")}},r}},{"../lib/types":19}],14:[function(e,t,r){t.exports=function(t){function r(e,t,n){if(!(this instanceof r))throw new Error("NodePath constructor cannot be invoked without 'new'");p.call(this,e,t,n)}function n(e){return o.BinaryExpression.check(e)||o.LogicalExpression.check(e)}function i(e){return!!o.CallExpression.check(e)||(c.check(e)?e.some(i):!!o.Node.check(e)&&a.someField(e,function(e,t){return i(t)}))}function s(e){if(o.VariableDeclaration.check(e.node)){var t=e.get("declarations").value;if(!t||0===t.length)return e.prune()}else if(o.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else o.IfStatement.check(e.node)&&function(e){var t=e.get("test").value,r=e.get("alternate").value,n=e.get("consequent").value;if(n||r){if(!n&&r){var i=u.unaryExpression("!",t,!0);o.UnaryExpression.check(t)&&"!"===t.operator&&(i=t.argument),e.get("test").replace(i),e.get("consequent").replace(r),e.get("alternate").replace()}}else{var s=u.expressionStatement(t);e.replace(s)}}(e);return e}var a=t.use(e("./types")),o=a.namedTypes,u=a.builders,l=a.builtInTypes.number,c=a.builtInTypes.array,p=t.use(e("./path")),h=t.use(e("./scope")),f=r.prototype=Object.create(p.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}});Object.defineProperties(f,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),f.replace=function(){return delete this.node,delete this.parent,delete this.scope,p.prototype.replace.apply(this,arguments)},f.prune=function(){var e=this.parent;return this.replace(),s(e)},f._computeNode=function(){var e=this.value;if(o.Node.check(e))return e;var t=this.parentPath;return t&&t.node||null},f._computeParent=function(){var e=this.value,t=this.parentPath;if(!o.Node.check(e)){for(;t&&!o.Node.check(t.value);)t=t.parentPath;t&&(t=t.parentPath)}for(;t&&!o.Node.check(t.value);)t=t.parentPath;return t||null},f._computeScope=function(){var e=this.value,t=this.parentPath,r=t&&t.scope;return o.Node.check(e)&&h.isEstablishedBy(e)&&(r=new h(this,r)),r||null},f.getValueProperty=function(e){return a.getFieldValue(this.value,e)},f.needsParens=function(e){if(!(s=this.parentPath))return!1;var t=this.value;if(!o.Expression.check(t))return!1;if("Identifier"===t.type)return!1;for(;!o.Node.check(s.value);)if(!(s=s.parentPath))return!1;var r=s.value;switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===r.type&&"object"===this.name&&r.object===t;case"BinaryExpression":case"LogicalExpression":switch(r.type){case"CallExpression":return"callee"===this.name&&r.callee===t;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&r.object===t;case"BinaryExpression":case"LogicalExpression":var n=r.operator,s=d[n],a=t.operator,u=d[a];if(s>u)return!0;if(s===u&&"right"===this.name){if(r.right!==t)throw new Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(r.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(r.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===r.type&&l.check(t.value)&&"object"===this.name&&r.object===t;case"AssignmentExpression":case"ConditionalExpression":switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&r.callee===t;case"ConditionalExpression":return"test"===this.name&&r.test===t;case"MemberExpression":return"object"===this.name&&r.object===t;default:return!1}default:if("NewExpression"===r.type&&"callee"===this.name&&r.callee===t)return i(t)}return!(!0===e||this.canBeFirstInStatement()||!this.firstInStatement())};var d={};return[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){d[e]=t})}),f.canBeFirstInStatement=function(){var e=this.node;return!o.FunctionExpression.check(e)&&!o.ObjectExpression.check(e)},f.firstInStatement=function(){return function(e){for(var t,r;e.parent;e=e.parent){if(t=e.node,r=e.parent.node,o.BlockStatement.check(r)&&"body"===e.parent.name&&0===e.name){if(r.body[0]!==t)throw new Error("Nodes must be equal");return!0}if(o.ExpressionStatement.check(r)&&"expression"===e.name){if(r.expression!==t)throw new Error("Nodes must be equal");return!0}if(o.SequenceExpression.check(r)&&"expressions"===e.parent.name&&0===e.name){if(r.expressions[0]!==t)throw new Error("Nodes must be equal")}else if(o.CallExpression.check(r)&&"callee"===e.name){if(r.callee!==t)throw new Error("Nodes must be equal")}else if(o.MemberExpression.check(r)&&"object"===e.name){if(r.object!==t)throw new Error("Nodes must be equal")}else if(o.ConditionalExpression.check(r)&&"test"===e.name){if(r.test!==t)throw new Error("Nodes must be equal")}else if(n(r)&&"left"===e.name){if(r.left!==t)throw new Error("Nodes must be equal")}else{if(!o.UnaryExpression.check(r)||r.prefix||"argument"!==e.name)return!1;if(r.argument!==t)throw new Error("Nodes must be equal")}}return!0}(this)},r}},{"./path":16,"./scope":17,"./types":19}],15:[function(e,t,r){var n=Object.prototype.hasOwnProperty;t.exports=function(t){function r(){if(!(this instanceof r))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=function(e){var t=Object.create(null);for(var r in e)/^visit[A-Z]/.test(r)&&(t[r.slice("visit".length)]=!0);for(var n=a.computeSupertypeLookupTable(t),i=Object.create(null),s=(t=Object.keys(n)).length,o=0;o<s;++o){var u=t[o];r="visit"+n[u],c.check(e[r])&&(i[u]=r)}return i}(this),this._shouldVisitComments=n.call(this._methodNameTable,"Block")||n.call(this._methodNameTable,"Line"),this.Context=function(e){function t(n){if(!(this instanceof t))throw new Error("");if(!(this instanceof r))throw new Error("");if(!(n instanceof o))throw new Error("");Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=n,this.needToCallTraverse=!0,Object.seal(this)}if(!(e instanceof r))throw new Error("");var n=t.prototype=Object.create(e);return n.constructor=t,i(n,h),t}(this),this._visiting=!1,this._changeReported=!1}function i(e,t){for(var r in t)n.call(t,r)&&(e[r]=t[r]);return e}function s(e,t){if(!(e instanceof o))throw new Error("");if(!(t instanceof r))throw new Error("");var i=e.value;if(u.check(i))e.each(t.visitWithoutReset,t);else if(l.check(i)){var s=a.getFieldNames(i);t._shouldVisitComments&&i.comments&&s.indexOf("comments")<0&&s.push("comments");for(var c=s.length,p=[],h=0;h<c;++h){var f=s[h];n.call(i,f)||(i[f]=a.getFieldValue(i,f)),p.push(e.get(f))}for(h=0;h<c;++h)t.visitWithoutReset(p[h])}else;return e.value}var a=t.use(e("./types")),o=t.use(e("./node-path")),u=(a.namedTypes.Printable,a.builtInTypes.array),l=a.builtInTypes.object,c=a.builtInTypes.function;r.fromMethodsObject=function(e){function t(){if(!(this instanceof t))throw new Error("Visitor constructor cannot be invoked without 'new'");r.call(this)}if(e instanceof r)return e;if(!l.check(e))return new r;var n=t.prototype=Object.create(p);return n.constructor=t,i(n,e),i(t,r),c.assert(t.fromMethodsObject),c.assert(t.visit),new t},r.visit=function(e,t){return r.fromMethodsObject(t).visit(e)};var p=r.prototype;p.visit=function(){if(this._visiting)throw new Error("Recursively calling visitor.visit(path) resets visitor state. Try this.visit(path) or this.traverse(path) instead.");this._visiting=!0,this._changeReported=!1,this._abortRequested=!1;for(var e=arguments.length,t=new Array(e),r=0;r<e;++r)t[r]=arguments[r];t[0]instanceof o||(t[0]=new o({root:t[0]}).get("root")),this.reset.apply(this,t);try{var n=this.visitWithoutReset(t[0]),i=!0}finally{if(this._visiting=!1,!i&&this._abortRequested)return t[0].value}return n},p.AbortRequest=function(){},p.abort=function(){var e=this;e._abortRequested=!0;var t=new e.AbortRequest;throw t.cancel=function(){e._abortRequested=!1},t},p.reset=function(e){},p.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);if(!(e instanceof o))throw new Error("");var t=e.value,r=t&&"object"==typeof t&&"string"==typeof t.type&&this._methodNameTable[t.type];if(!r)return s(e,this);var n=this.acquireContext(e);try{return n.invokeVisitorMethod(r)}finally{this.releaseContext(n)}},p.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},p.releaseContext=function(e){if(!(e instanceof this.Context))throw new Error("");this._reusableContextStack.push(e),e.currentPath=null},p.reportChanged=function(){this._changeReported=!0},p.wasChangeReported=function(){return this._changeReported};var h=Object.create(null);return h.reset=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof o))throw new Error("");return this.currentPath=e,this.needToCallTraverse=!0,this},h.invokeVisitorMethod=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(this.currentPath instanceof o))throw new Error("");var t=this.visitor[e].call(this,this.currentPath);if(!1===t?this.needToCallTraverse=!1:void 0!==t&&(this.currentPath=this.currentPath.replace(t)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),!1!==this.needToCallTraverse)throw new Error("Must either call this.traverse or return false in "+e);var r=this.currentPath;return r&&r.value},h.traverse=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof o))throw new Error("");if(!(this.currentPath instanceof o))throw new Error("");return this.needToCallTraverse=!1,s(e,r.fromMethodsObject(t||this.visitor))},h.visit=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof o))throw new Error("");if(!(this.currentPath instanceof o))throw new Error("");return this.needToCallTraverse=!1,r.fromMethodsObject(t||this.visitor).visitWithoutReset(e)},h.reportChanged=function(){this.visitor.reportChanged()},h.abort=function(){this.needToCallTraverse=!1,this.visitor.abort()},r}},{"./node-path":14,"./types":19}],16:[function(e,t,r){var n=Array.prototype,i=(n.slice,n.map,Object.prototype.hasOwnProperty);t.exports=function(t){function r(e,t,n){if(!(this instanceof r))throw new Error("Path constructor cannot be invoked without 'new'");if(t){if(!(t instanceof r))throw new Error("")}else t=null,n=null;this.value=e,this.parentPath=t,this.name=n,this.__childCache=null}function n(e){return e.__childCache||(e.__childCache=Object.create(null))}function s(e,t){var r=n(e),s=e.getValueProperty(t),a=r[t];return i.call(r,t)&&a.value===s||(a=r[t]=new e.constructor(s,e,t)),a}function a(){}function o(e,t,r,s){if(l.assert(e.value),0===t)return a;var o=e.value.length;if(o<1)return a;var u=arguments.length;2===u?(r=0,s=o):3===u?(r=Math.max(r,0),s=o):(r=Math.max(r,0),s=Math.min(s,o)),c.assert(r),c.assert(s);for(var p=Object.create(null),h=n(e),f=r;f<s;++f)if(i.call(e.value,f)){var d=e.get(f);if(d.name!==f)throw new Error("");var m=f+t;d.name=m,p[m]=d,delete h[f]}return delete h.length,function(){for(var t in p){var r=p[t];if(r.name!==+t)throw new Error("");h[t]=r,e.value[t]=r.value}}}var u=t.use(e("./types")),l=u.builtInTypes.array,c=u.builtInTypes.number,p=r.prototype;return p.getValueProperty=function(e){return this.value[e]},p.get=function(e){for(var t=this,r=arguments,n=r.length,i=0;i<n;++i)t=s(t,r[i]);return t},p.each=function(e,t){var r=[],n=this.value.length,s=0;for(s=0;s<n;++s)i.call(this.value,s)&&(r[s]=this.get(s));for(t=t||this,s=0;s<n;++s)i.call(r,s)&&e.call(t,r[s])},p.map=function(e,t){var r=[];return this.each(function(t){r.push(e.call(this,t))},t),r},p.filter=function(e,t){var r=[];return this.each(function(t){e.call(this,t)&&r.push(t)},t),r},p.shift=function(){var e=o(this,-1),t=this.value.shift();return e(),t},p.unshift=function(e){var t=o(this,arguments.length),r=this.value.unshift.apply(this.value,arguments);return t(),r},p.push=function(e){return l.assert(this.value),delete n(this).length,this.value.push.apply(this.value,arguments)},p.pop=function(){l.assert(this.value);var e=n(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},p.insertAt=function(e,t){var r=arguments.length,n=o(this,r-1,e);if(n===a)return this;e=Math.max(e,0);for(var i=1;i<r;++i)this.value[e+i-1]=arguments[i];return n(),this},p.insertBefore=function(e){for(var t=this.parentPath,r=arguments.length,n=[this.name],i=0;i<r;++i)n.push(arguments[i]);return t.insertAt.apply(t,n)},p.insertAfter=function(e){for(var t=this.parentPath,r=arguments.length,n=[this.name+1],i=0;i<r;++i)n.push(arguments[i]);return t.insertAt.apply(t,n)},p.replace=function(e){var t=[],i=this.parentPath.value,s=n(this.parentPath),a=arguments.length;if(function(e){if(!(e instanceof r))throw new Error("");var t=e.parentPath;if(!t)return e;var i=t.value,s=n(t);if(i[e.name]===e.value)s[e.name]=e;else if(l.check(i)){var a=i.indexOf(e.value);a>=0&&(s[e.name=a]=e)}else i[e.name]=e.value,s[e.name]=e;if(i[e.name]!==e.value)throw new Error("");if(e.parentPath.get(e.name)!==e)throw new Error("")}(this),l.check(i)){for(var u=i.length,c=o(this.parentPath,a-1,this.name+1),p=[this.name,1],h=0;h<a;++h)p.push(arguments[h]);if(i.splice.apply(i,p)[0]!==this.value)throw new Error("");if(i.length!==u-1+a)throw new Error("");if(c(),0===a)delete this.value,delete s[this.name],this.__childCache=null;else{if(i[this.name]!==e)throw new Error("");for(this.value!==e&&(this.value=e,this.__childCache=null),h=0;h<a;++h)t.push(this.parentPath.get(this.name+h));if(t[0]!==this)throw new Error("")}}else if(1===a)this.value!==e&&(this.__childCache=null),this.value=i[this.name]=e,t.push(this);else{if(0!==a)throw new Error("Could not replace path");delete i[this.name],delete this.value,this.__childCache=null}return t},r}},{"./types":19}],17:[function(e,t,r){var n=Object.prototype.hasOwnProperty;t.exports=function(t){function r(n,i){if(!(this instanceof r))throw new Error("Scope constructor cannot be invoked without 'new'");if(!(n instanceof t.use(e("./node-path"))))throw new Error("");m.assert(n.value);var s;if(i){if(!(i instanceof r))throw new Error("");s=i.depth+1}else i=null,s=0;Object.defineProperties(this,{path:{value:n},node:{value:n.value},isGlobal:{value:!i,enumerable:!0},depth:{value:s},parent:{value:i},bindings:{value:{}},types:{value:{}}})}function i(e,t,r){var i=e.value;e.parent&&l.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&a(e.parent.get("id"),t),i&&(h.check(i)?e.each(function(e){s(e,t,r)}):l.Function.check(i)?(e.get("params").each(function(e){a(e,t)}),s(e.get("body"),t,r)):l.TypeAlias&&l.TypeAlias.check(i)?function(e,t){var r=e.value;l.Pattern.assert(r),l.Identifier.check(r)&&(n.call(t,r.name)?t[r.name].push(e):t[r.name]=[e])}(e.get("id"),r):l.VariableDeclarator.check(i)?(a(e.get("id"),t),s(e.get("init"),t,r)):"ImportSpecifier"===i.type||"ImportNamespaceSpecifier"===i.type||"ImportDefaultSpecifier"===i.type?a(e.get(i.local?"local":i.name?"name":"id"),t):c.check(i)&&!p.check(i)&&o.eachField(i,function(n,i){var a=e.get(n);if(!function(e,t){if(e.value===t)return!0;if(Array.isArray(e.value)&&0===e.value.length&&Array.isArray(t)&&0===t.length)return!0;return!1}(a,i))throw new Error("");s(a,t,r)}))}function s(e,t,r){var s=e.value;if(!s||p.check(s));else if(l.FunctionDeclaration.check(s)&&null!==s.id)a(e.get("id"),t);else if(l.ClassDeclaration&&l.ClassDeclaration.check(s))a(e.get("id"),t);else if(m.check(s)){if(l.CatchClause.check(s)){var o=s.param.name,u=n.call(t,o);i(e.get("body"),t,r),u||delete t[o]}}else i(e,t,r)}function a(e,t){var r=e.value;l.Pattern.assert(r),l.Identifier.check(r)?n.call(t,r.name)?t[r.name].push(e):t[r.name]=[e]:l.ObjectPattern&&l.ObjectPattern.check(r)?e.get("properties").each(function(e){var r=e.value;l.Pattern.check(r)?a(e,t):l.Property.check(r)?a(e.get("value"),t):l.SpreadProperty&&l.SpreadProperty.check(r)&&a(e.get("argument"),t)}):l.ArrayPattern&&l.ArrayPattern.check(r)?e.get("elements").each(function(e){var r=e.value;l.Pattern.check(r)?a(e,t):l.SpreadElement&&l.SpreadElement.check(r)&&a(e.get("argument"),t)}):l.PropertyPattern&&l.PropertyPattern.check(r)?a(e.get("pattern"),t):(l.SpreadElementPattern&&l.SpreadElementPattern.check(r)||l.SpreadPropertyPattern&&l.SpreadPropertyPattern.check(r))&&a(e.get("argument"),t)}var o=t.use(e("./types")),u=o.Type,l=o.namedTypes,c=l.Node,p=l.Expression,h=o.builtInTypes.array,f=o.builders,d=[l.Program,l.Function,l.CatchClause],m=u.or.apply(u,d);r.isEstablishedBy=function(e){return m.check(e)};var y=r.prototype;return y.didScan=!1,y.declares=function(e){return this.scan(),n.call(this.bindings,e)},y.declaresType=function(e){return this.scan(),n.call(this.types,e)},y.declareTemporary=function(e){if(e){if(!/^[a-z$_]/i.test(e))throw new Error("")}else e="t$";e+=this.depth.toString(36)+"$",this.scan();for(var t=0;this.declares(e+t);)++t;var r=e+t;return this.bindings[r]=o.builders.identifier(r)},y.injectTemporary=function(e,t){e||(e=this.declareTemporary());var r=this.path.get("body");return l.BlockStatement.check(r.value)&&(r=r.get("body")),r.unshift(f.variableDeclaration("var",[f.variableDeclarator(e,t||null)])),e},y.scan=function(e){if(e||!this.didScan){for(var t in this.bindings)delete this.bindings[t];!function(e,t,r){var n=e.value;m.assert(n),l.CatchClause.check(n)?a(e.get("param"),t):i(e,t,r)}(this.path,this.bindings,this.types),this.didScan=!0}},y.getBindings=function(){return this.scan(),this.bindings},y.getTypes=function(){return this.scan(),this.types},y.lookup=function(e){for(var t=this;t&&!t.declares(e);t=t.parent);return t},y.lookupType=function(e){for(var t=this;t&&!t.declaresType(e);t=t.parent);return t},y.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},r}},{"./node-path":14,"./types":19}],18:[function(e,t,r){t.exports=function(t){var r={},n=t.use(e("../lib/types")),i=n.Type,s=n.builtInTypes,a=s.number;r.geq=function(e){return new i(function(t){return a.check(t)&&t>=e},a+" >= "+e)},r.defaults={null:function(){return null},emptyArray:function(){return[]},false:function(){return!1},true:function(){return!0},undefined:function(){}};var o=i.or(s.string,s.number,s.boolean,s.null,s.undefined);return r.isPrimitive=new i(function(e){if(null===e)return!0;var t=typeof e;return!("object"===t||"function"===t)},o.toString()),r}},{"../lib/types":19}],19:[function(e,t,r){var n=Array.prototype,i=n.slice,s=(n.map,n.forEach,Object.prototype),a=s.toString,o=a.call(function(){}),u=a.call(""),l=s.hasOwnProperty;t.exports=function(){function e(t,r){var n=this;if(!(n instanceof e))throw new Error("Type constructor cannot be invoked without 'new'");if(a.call(t)!==o)throw new Error(t+" is not a function");var i=a.call(r);if(i!==o&&i!==u)throw new Error(r+" is neither a function nor a string");Object.defineProperties(n,{name:{value:r},check:{value:function(e,r){var i=t.call(n,e,r);return!i&&r&&a.call(r)===o&&r(n,e),i}}})}function t(e){return S.check(e)?"{"+Object.keys(e).map(function(t){return t+": "+e[t]}).join(", ")+"}":D.check(e)?"["+e.map(t).join(", ")+"]":JSON.stringify(e)}function r(t,r){var n=a.call(t),i=new e(function(e){return a.call(e)===n},r);return x[r]=i,t&&"function"==typeof t.constructor&&(b.push(t.constructor),v.push(i)),i}function n(t,r){if(t instanceof e)return t;if(t instanceof c)return t.type;if(D.check(t))return e.fromArray(t);if(S.check(t))return e.fromObject(t);if(A.check(t)){var n=b.indexOf(t);return n>=0?v[n]:new e(t,r)}return new e(function(e){return e===t},_.check(r)?function(){return t+""}:r)}function s(e,t,r,i){if(!(this instanceof s))throw new Error("Field constructor cannot be invoked without 'new'");E.assert(e);var a={name:{value:e},type:{value:t=n(t)},hidden:{value:!!i}};A.check(r)&&(a.defaultFn={value:r}),Object.defineProperties(this,a)}function c(t){var r=this;if(!(r instanceof c))throw new Error("Def constructor cannot be invoked without 'new'");Object.defineProperties(r,{typeName:{value:t},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new e(function(e,t){return r.check(e,t)},t)}})}function p(e){return e.replace(/^[A-Z]+/,function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}})}function h(e){return(e=p(e)).replace(/(Expression)?$/,"Statement")}function f(e){var t=c.fromValue(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw new Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function d(e,t){var r=c.fromValue(e);if(r){var n=r.allFields[t];if(n)return n.getValue(e)}return e&&e[t]}function m(e,t){return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}var y={},g=e.prototype;y.Type=e,g.assert=function(e,r){if(!this.check(e,r)){var n=t(e);throw new Error(n+" does not match type "+this)}return!0},g.toString=function(){var e=this.name;return E.check(e)?e:A.check(e)?e.call(this)+"":e+" type"};var b=[],v=[],x={};y.builtInTypes=x;var E=r("truthy","string"),A=r(function(){},"function"),D=r([],"array"),S=r({},"object"),C=(r(/./,"RegExp"),r(new Date,"Date"),r(3,"number")),_=(r(!0,"boolean"),r(null,"null"),r(void 0,"undefined"));e.or=function(){for(var t=[],r=arguments.length,i=0;i<r;++i)t.push(n(arguments[i]));return new e(function(e,n){for(var i=0;i<r;++i)if(t[i].check(e,n))return!0;return!1},function(){return t.join(" | ")})},e.fromArray=function(e){if(!D.check(e))throw new Error("");if(1!==e.length)throw new Error("only one element type is permitted for typed arrays");return n(e[0]).arrayOf()},g.arrayOf=function(){var t=this;return new e(function(e,r){return D.check(e)&&e.every(function(e){return t.check(e,r)})},function(){return"["+t+"]"})},e.fromObject=function(t){var r=Object.keys(t).map(function(e){return new s(e,t[e])});return new e(function(e,t){return S.check(e)&&r.every(function(r){return r.type.check(e[r.name],t)})},function(){return"{ "+r.join(", ")+" }"})};var w=s.prototype;w.toString=function(){return JSON.stringify(this.name)+": "+this.type},w.getValue=function(e){var t=e[this.name];return _.check(t)?(this.defaultFn&&(t=this.defaultFn.call(e)),t):t},e.def=function(e){return E.assert(e),l.call(k,e)?k[e]:k[e]=new c(e)};var k=Object.create(null);c.fromValue=function(e){if(e&&"object"==typeof e){var t=e.type;if("string"==typeof t&&l.call(k,t)){var r=k[t];if(r.finalized)return r}}return null};var F=c.prototype;F.isSupertypeOf=function(e){if(e instanceof c){if(!0!==this.finalized||!0!==e.finalized)throw new Error("");return l.call(e.allSupertypes,this.typeName)}throw new Error(e+" is not a Def")},y.getSupertypeNames=function(e){if(!l.call(k,e))throw new Error("");var t=k[e];if(!0!==t.finalized)throw new Error("");return t.supertypeList.slice(1)},y.computeSupertypeLookupTable=function(e){for(var t={},r=Object.keys(k),n=r.length,i=0;i<n;++i){var s=r[i],a=k[s];if(!0!==a.finalized)throw new Error(""+s);for(var o=0;o<a.supertypeList.length;++o){var u=a.supertypeList[o];if(l.call(e,u)){t[s]=u;break}}}return t},F.checkAllFields=function(e,t){var r=this.allFields;if(!0!==this.finalized)throw new Error(""+this.typeName);return S.check(e)&&Object.keys(r).every(function(n){var i=r[n],s=i.type,a=i.getValue(e);return s.check(a,t)})},F.check=function(e,t){if(!0!==this.finalized)throw new Error("prematurely checking unfinalized type "+this.typeName);if(!S.check(e))return!1;var r=c.fromValue(e);return r?t&&r===this?this.checkAllFields(e,t):!!this.isSupertypeOf(r)&&(!t||r.checkAllFields(e,t)&&this.checkAllFields(e,!1)):("SourceLocation"===this.typeName||"Position"===this.typeName)&&this.checkAllFields(e,t)},F.bases=function(){var e=i.call(arguments),t=this.baseNames;if(this.finalized){if(e.length!==t.length)throw new Error("");for(var r=0;r<e.length;r++)if(e[r]!==t[r])throw new Error("");return this}return e.forEach(function(e){E.assert(e),t.indexOf(e)<0&&t.push(e)}),this},Object.defineProperty(F,"buildable",{value:!1});var T={};y.builders=T;var P={};y.defineMethod=function(e,t){var r=P[e];return _.check(t)?delete P[e]:(A.assert(t),Object.defineProperty(P,e,{enumerable:!0,configurable:!0,value:t})),r};var B=E.arrayOf();F.build=function(){var e=this,r=i.call(arguments);return B.assert(r),Object.defineProperty(e,"buildParams",{value:r,writable:!1,enumerable:!1,configurable:!0}),e.buildable?e:(e.field("type",String,function(){return e.typeName}),Object.defineProperty(e,"buildable",{value:!0}),Object.defineProperty(T,p(e.typeName),{enumerable:!0,value:function(){function r(r,a){if(!l.call(s,r)){var o=e.allFields;if(!l.call(o,r))throw new Error(""+r);var u,c=o[r],p=c.type;if(C.check(a)&&a<i)u=n[a];else{if(!c.defaultFn){var h="no value or default function given for field "+JSON.stringify(r)+" of "+e.typeName+"("+e.buildParams.map(function(e){return o[e]}).join(", ")+")";throw new Error(h)}u=c.defaultFn.call(s)}if(!p.check(u))throw new Error(t(u)+" does not match field "+c+" of type "+e.typeName);s[r]=u}}var n=arguments,i=n.length,s=Object.create(P);if(!e.finalized)throw new Error("attempting to instantiate unfinalized type "+e.typeName);if(e.buildParams.forEach(function(e,t){r(e,t)}),Object.keys(e.allFields).forEach(function(e){r(e)}),s.type!==e.typeName)throw new Error("");return s}}),e)},y.getBuilderName=p,y.getStatementBuilderName=h,F.field=function(e,t,r,n){return this.finalized?(console.error("Ignoring attempt to redefine field "+JSON.stringify(e)+" of finalized type "+JSON.stringify(this.typeName)),this):(this.ownFields[e]=new s(e,t,r,n),this)};var O={};return y.namedTypes=O,y.getFieldNames=f,y.getFieldValue=d,y.eachField=function(e,t,r){f(e).forEach(function(r){t.call(this,r,d(e,r))},r)},y.someField=function(e,t,r){return f(e).some(function(r){return t.call(this,r,d(e,r))},r)},Object.defineProperty(F,"finalized",{value:!1}),F.finalize=function(){var e=this;if(!e.finalized){var t=e.allFields,r=e.allSupertypes;e.baseNames.forEach(function(n){var i=k[n];if(!(i instanceof c)){var s="unknown supertype name "+JSON.stringify(n)+" for subtype "+JSON.stringify(e.typeName);throw new Error(s)}i.finalize(),m(t,i.allFields),m(r,i.allSupertypes)}),m(t,e.ownFields),r[e.typeName]=e,e.fieldNames.length=0;for(var n in t)l.call(t,n)&&!t[n].hidden&&e.fieldNames.push(n);Object.defineProperty(O,e.typeName,{enumerable:!0,value:e.type}),Object.defineProperty(e,"finalized",{value:!0}),function(e,t){t.length=0,t.push(e);for(var r=Object.create(null),n=0;n<t.length;++n){e=t[n];var i=k[e];if(!0!==i.finalized)throw new Error("");l.call(r,e)&&delete t[r[e]],r[e]=n,t.push.apply(t,i.baseNames)}for(var s=0,a=s,o=t.length;a<o;++a)l.call(t,a)&&(t[s++]=t[a]);t.length=s}(e.typeName,e.supertypeList),e.buildable&&e.supertypeList.lastIndexOf("Expression")>=0&&function(e){var t=h(e);if(!T[t]){var r=T[p(e)];r&&(T[t]=function(){return T.expressionStatement(r.apply(T,arguments))})}}(e.typeName)}},y.finalize=function(){Object.keys(k).forEach(function(e){k[e].finalize()})},y}},{}],20:[function(e,t,r){t.exports=e("./fork")([e("./def/core"),e("./def/es6"),e("./def/es7"),e("./def/mozilla"),e("./def/e4x"),e("./def/jsx"),e("./def/flow"),e("./def/esprima"),e("./def/babel"),e("./def/babel6")])},{"./def/babel":2,"./def/babel6":3,"./def/core":4,"./def/e4x":5,"./def/es6":6,"./def/es7":7,"./def/esprima":8,"./def/flow":9,"./def/jsx":10,"./def/mozilla":11,"./fork":12}],21:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){return t.replace(a.default,function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=function(e){var t=e.slice(-2),r=t[0],n=t[1],i=(0,s.matchToToken)(e);if("name"===i.type){if(o.default.keyword.isReservedWordES6(i.value))return"keyword";if(c.test(i.value)&&("<"===n[r-1]||"</"==n.substr(r-2,2)))return"jsx_tag";if(i.value[0]!==i.value[0].toLowerCase())return"capitalized"}return"punctuator"===i.type&&p.test(i.value)?"bracket":i.type}(r),a=e[i];return a?r[0].split(l).map(function(e){return a(e)}).join("\n"):r[0]})}r.__esModule=!0,r.default=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=Math.max(r,0);var s=n.highlightCode&&u.default.supportsColor||n.forceColor,a=u.default;n.forceColor&&(a=new u.default.constructor({enabled:!0}));var o=function(e,t){return s?e(t):t},c=function(e){return{keyword:e.cyan,capitalized:e.yellow,jsx_tag:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold,gutter:e.grey,marker:e.red.bold}}(a);s&&(e=i(c,e));var p=n.linesAbove||2,h=n.linesBelow||3,f=e.split(l),d=Math.max(t-(p+1),0),m=Math.min(f.length,t+h);t||r||(d=0,m=f.length);var y=String(m).length,g=f.slice(d,m).map(function(e,n){var i=d+1+n,s=" "+(" "+i).slice(-y)+" | ";if(i===t){var a="";if(r){var u=e.slice(0,r-1).replace(/[^\t]/g," ");a=["\n ",o(c.gutter,s.replace(/\d/g," ")),u,o(c.marker,"^")].join("")}return[o(c.marker,">"),o(c.gutter,s),e,a].join("")}return" "+o(c.gutter,s)+e}).join("\n");return s?a.reset(g):g};var s=e("js-tokens"),a=n(s),o=n(e("esutils")),u=n(e("chalk")),l=/\r\n|[\n\r\u2028\u2029]/,c=/^[a-z][\w-]*$/i,p=/^[()\[\]{}]$/;t.exports=r.default},{chalk:24,esutils:28,"js-tokens":322}],22:[function(e,t,r){"use strict";t.exports=function(){return/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g}},{}],23:[function(e,t,r){"use strict";Object.defineProperty(t,"exports",{enumerable:!0,get:function(){var e={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};return e.colors.grey=e.colors.gray,Object.keys(e).forEach(function(t){var r=e[t];Object.keys(r).forEach(function(t){var n=r[t];e[t]=r[t]={open:"["+n[0]+"m",close:"["+n[1]+"m"}}),Object.defineProperty(e,t,{value:r,enumerable:!1})}),e}})},{}],24:[function(e,t,r){(function(r){"use strict";function n(e){this.enabled=e&&void 0!==e.enabled?e.enabled:l}function i(e){var t=function(){return function(){var e=arguments,t=e.length,r=0!==t&&String(arguments[0]);if(t>1)for(var n=1;n<t;n++)r+=" "+e[n];if(!this.enabled||!r)return r;var i=this._styles,s=i.length,o=a.dim.open;!p||-1===i.indexOf("gray")&&-1===i.indexOf("grey")||(a.dim.open="");for(;s--;){var u=a[i[s]];r=u.open+r.replace(u.closeRe,u.open)+u.close}return a.dim.open=o,r}.apply(t,arguments)};return t._styles=e,t.enabled=this.enabled,t.__proto__=f,t}var s=e("escape-string-regexp"),a=e("ansi-styles"),o=e("strip-ansi"),u=e("has-ansi"),l=e("supports-color"),c=Object.defineProperties,p="win32"===r.platform&&!/^xterm/i.test(r.env.TERM);p&&(a.blue.open="");var h=function(){var e={};return Object.keys(a).forEach(function(t){a[t].closeRe=new RegExp(s(a[t].close),"g"),e[t]={get:function(){return i.call(this,this._styles.concat(t))}}}),e}(),f=c(function(){},h);c(n.prototype,function(){var e={};return Object.keys(h).forEach(function(t){e[t]={get:function(){return i.call(this,[t])}}}),e}()),t.exports=new n,t.exports.styles=a,t.exports.hasColor=u,t.exports.stripColor=o,t.exports.supportsColor=l}).call(this,e("_process"))},{_process:550,"ansi-styles":23,"escape-string-regexp":312,"has-ansi":314,"strip-ansi":29,"supports-color":30}],25:[function(e,t,r){!function(){"use strict";function e(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function r(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}t.exports={isExpression:function(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1},isStatement:e,isIterationStatement:function(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1},isSourceElement:function(t){return e(t)||null!=t&&"FunctionDeclaration"===t.type},isProblematicIfStatement:function(e){var t;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;t=e.consequent;do{if("IfStatement"===t.type&&null==t.alternate)return!0;t=r(t)}while(t);return!1},trailingStatement:r}}()},{}],26:[function(e,t,r){!function(){"use strict";function e(e){if(e<=65535)return String.fromCharCode(e);return String.fromCharCode(Math.floor((e-65536)/1024)+55296)+String.fromCharCode((e-65536)%1024+56320)}var r,n,i,s,a,o;for(n={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},r={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},i=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],s=new Array(128),o=0;o<128;++o)s[o]=o>=97&&o<=122||o>=65&&o<=90||36===o||95===o;for(a=new Array(128),o=0;o<128;++o)a[o]=o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||36===o||95===o;t.exports={isDecimalDigit:function(e){return 48<=e&&e<=57},isHexDigit:function(e){return 48<=e&&e<=57||97<=e&&e<=102||65<=e&&e<=70},isOctalDigit:function(e){return e>=48&&e<=55},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&i.indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStartES5:function(t){return t<128?s[t]:n.NonAsciiIdentifierStart.test(e(t))},isIdentifierPartES5:function(t){return t<128?a[t]:n.NonAsciiIdentifierPart.test(e(t))},isIdentifierStartES6:function(t){return t<128?s[t]:r.NonAsciiIdentifierStart.test(e(t))},isIdentifierPartES6:function(t){return t<128?a[t]:r.NonAsciiIdentifierPart.test(e(t))}}}()},{}],27:[function(e,t,r){!function(){"use strict";function r(e,t){return!(!t&&"yield"===e)&&n(e,t)}function n(e,t){if(t&&function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function i(e,t){return"null"===e||"true"===e||"false"===e||r(e,t)}function s(e,t){return"null"===e||"true"===e||"false"===e||n(e,t)}function a(e){var t,r,n;if(0===e.length)return!1;if(n=e.charCodeAt(0),!l.isIdentifierStartES5(n))return!1;for(t=1,r=e.length;t<r;++t)if(n=e.charCodeAt(t),!l.isIdentifierPartES5(n))return!1;return!0}function o(e,t){return 1024*(e-55296)+(t-56320)+65536}function u(e){var t,r,n,i,s;if(0===e.length)return!1;for(s=l.isIdentifierStartES6,t=0,r=e.length;t<r;++t){if(55296<=(n=e.charCodeAt(t))&&n<=56319){if(++t>=r)return!1;if(!(56320<=(i=e.charCodeAt(t))&&i<=57343))return!1;n=o(n,i)}if(!s(n))return!1;s=l.isIdentifierPartES6}return!0}var l=e("./code");t.exports={isKeywordES5:r,isKeywordES6:n,isReservedWordES5:i,isReservedWordES6:s,isRestrictedWord:function(e){return"eval"===e||"arguments"===e},isIdentifierNameES5:a,isIdentifierNameES6:u,isIdentifierES5:function(e,t){return a(e)&&!i(e,t)},isIdentifierES6:function(e,t){return u(e)&&!s(e,t)}}}()},{"./code":26}],28:[function(e,t,r){!function(){"use strict";r.ast=e("./ast"),r.code=e("./code"),r.keyword=e("./keyword")}()},{"./ast":25,"./code":26,"./keyword":27}],29:[function(e,t,r){"use strict";var n=e("ansi-regex")();t.exports=function(e){return"string"==typeof e?e.replace(n,""):e}},{"ansi-regex":22}],30:[function(e,t,r){(function(e){"use strict";var r=e.argv,n=r.indexOf("--"),i=function(e){e="--"+e;var t=r.indexOf(e);return-1!==t&&(-1===n||t<n)};t.exports="FORCE_COLOR"in e.env||!(i("no-color")||i("no-colors")||i("color=false"))&&(!!(i("color")||i("colors")||i("color=true")||i("color=always"))||!(e.stdout&&!e.stdout.isTTY)&&("win32"===e.platform||("COLORTERM"in e.env||"dumb"!==e.env.TERM&&!!/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(e.env.TERM))))}).call(this,e("_process"))},{_process:550}],31:[function(e,t,r){t.exports=e("./lib/api/node.js")},{"./lib/api/node.js":32}],32:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.transformFromAst=r.transform=r.analyse=r.Pipeline=r.OptionManager=r.traverse=r.types=r.messages=r.util=r.version=r.resolvePreset=r.resolvePlugin=r.template=r.buildExternalHelpers=r.options=r.File=void 0;var s=e("../transformation/file");Object.defineProperty(r,"File",{enumerable:!0,get:function(){return i(s).default}});var a=e("../transformation/file/options/config");Object.defineProperty(r,"options",{enumerable:!0,get:function(){return i(a).default}});var o=e("../tools/build-external-helpers");Object.defineProperty(r,"buildExternalHelpers",{enumerable:!0,get:function(){return i(o).default}});var u=e("babel-template");Object.defineProperty(r,"template",{enumerable:!0,get:function(){return i(u).default}});var l=e("../helpers/resolve-plugin");Object.defineProperty(r,"resolvePlugin",{enumerable:!0,get:function(){return i(l).default}});var c=e("../helpers/resolve-preset");Object.defineProperty(r,"resolvePreset",{enumerable:!0,get:function(){return i(c).default}});var p=e("../../package");Object.defineProperty(r,"version",{enumerable:!0,get:function(){return p.version}}),r.Plugin=function(e){throw new Error("The ("+e+") Babel 5 plugin is being run with Babel 6.")},r.transformFile=function(e,t,r){"function"==typeof t&&(r=t,t={}),t.filename=e,h.default.readFile(e,function(e,n){var i=void 0;if(!e)try{i=x(n,t)}catch(t){e=t}e?r(e):r(null,i)})},r.transformFileSync=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.filename=e,x(h.default.readFileSync(e,"utf8"),t)};var h=i(e("fs")),f=n(e("../util")),d=n(e("babel-messages")),m=n(e("babel-types")),y=i(e("babel-traverse")),g=i(e("../transformation/file/options/option-manager")),b=i(e("../transformation/pipeline"));r.util=f,r.messages=d,r.types=m,r.traverse=y.default,r.OptionManager=g.default,r.Pipeline=b.default;var v=new b.default,x=(r.analyse=v.analyse.bind(v),r.transform=v.transform.bind(v));r.transformFromAst=v.transformFromAst.bind(v)},{"../../package":73,"../helpers/resolve-plugin":38,"../helpers/resolve-preset":39,"../tools/build-external-helpers":42,"../transformation/file":43,"../transformation/file/options/config":47,"../transformation/file/options/option-manager":49,"../transformation/pipeline":54,"../util":57,"babel-messages":110,"babel-template":139,"babel-traverse":143,"babel-types":180,fs:193}],33:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){return["babel-plugin-"+e,e]},t.exports=r.default},{}],34:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){var t=["babel-preset-"+e,e],r=e.match(/^(@[^/]+)\/(.+)$/);if(r){var n=r[1],i=r[2];t.push(n+"/babel-preset-"+i)}return t},t.exports=r.default},{}],35:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator"));r.default=function(e,t){if(e&&t)return(0,s.default)(e,t,function(e,t){if(t&&Array.isArray(e)){var r=t.slice(0),n=e,s=Array.isArray(n),a=0;for(n=s?n:(0,i.default)(n);;){var o;if(s){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var u=o;r.indexOf(u)<0&&r.push(u)}return r}})};var s=n(e("lodash/mergeWith"));t.exports=r.default},{"babel-runtime/core-js/get-iterator":120,"lodash/mergeWith":527}],36:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t,r){if(e){if("Program"===e.type)return n.file(e,t||[],r||[]);if("File"===e.type)return e}throw new Error("Not a valid ast?")};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));t.exports=r.default},{"babel-types":180}],37:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){return e.reduce(function(e,r){return e||(0,n.default)(r,t)},null)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./resolve"));t.exports=r.default},{"./resolve":40}],38:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();return(0,s.default)((0,a.default)(e),t)};var s=i(e("./resolve-from-possible-names")),a=i(e("./get-possible-plugin-names"));t.exports=r.default}).call(this,e("_process"))},{"./get-possible-plugin-names":33,"./resolve-from-possible-names":37,_process:550}],39:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();return(0,s.default)((0,a.default)(e),t)};var s=i(e("./resolve-from-possible-names")),a=i(e("./get-possible-preset-names"));t.exports=r.default}).call(this,e("_process"))},{"./get-possible-preset-names":34,"./resolve-from-possible-names":37,_process:550}],40:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var s=i(e("babel-runtime/helpers/typeof"));r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();if("object"===(void 0===a.default?"undefined":(0,s.default)(a.default)))return null;var r=u[t];if(!r){r=new a.default;var i=o.default.join(t,".babelrc");r.id=i,r.filename=i,r.paths=a.default._nodeModulePaths(t),u[t]=r}try{return a.default._resolveFilename(e,r)}catch(e){return null}};var a=i(e("module")),o=i(e("path")),u={};t.exports=r.default}).call(this,e("_process"))},{_process:550,"babel-runtime/helpers/typeof":138,module:193,path:546}],41:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/map")),s=n(e("babel-runtime/helpers/classCallCheck")),a=n(e("babel-runtime/helpers/possibleConstructorReturn")),o=n(e("babel-runtime/helpers/inherits")),u=function(e){function t(){(0,s.default)(this,t);var r=(0,a.default)(this,e.call(this));return r.dynamicData={},r}return(0,o.default)(t,e),t.prototype.setDynamic=function(e,t){this.dynamicData[e]=t},t.prototype.get=function(t){if(this.has(t))return e.prototype.get.call(this,t);if(Object.prototype.hasOwnProperty.call(this.dynamicData,t)){var r=this.dynamicData[t]();return this.set(t,r),r}},t}(i.default);r.default=u,t.exports=r.default},{"babel-runtime/core-js/map":122,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137}],42:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function s(e,t){var r=[],n=h.functionExpression(null,[h.identifier("global")],h.blockStatement(r)),i=h.program([h.expressionStatement(h.callExpression(n,[u.get("selfGlobal")]))]);return r.push(h.variableDeclaration("var",[h.variableDeclarator(e,h.assignmentExpression("=",h.memberExpression(h.identifier("global"),e),h.objectExpression([])))])),t(r),i}function a(e,t){var r=[];return r.push(h.variableDeclaration("var",[h.variableDeclarator(e,h.identifier("global"))])),t(r),h.program([f({FACTORY_PARAMETERS:h.identifier("global"),BROWSER_ARGUMENTS:h.assignmentExpression("=",h.memberExpression(h.identifier("root"),e),h.objectExpression([])),COMMON_ARGUMENTS:h.identifier("exports"),AMD_ARGUMENTS:h.arrayExpression([h.stringLiteral("exports")]),FACTORY_BODY:r,UMD_ROOT:h.identifier("this")})])}function o(e,t){var r=[];return r.push(h.variableDeclaration("var",[h.variableDeclarator(e,h.objectExpression([]))])),t(r),r.push(h.expressionStatement(e)),h.program(r)}r.__esModule=!0,r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"global",r=h.identifier("babelHelpers"),n=void 0,i={global:s,umd:a,var:o}[t];if(!i)throw new Error(c.get("unsupportedOutputType",t));return n=i(r,function(t){return function(e,t,r){u.list.forEach(function(n){if(!(r&&r.indexOf(n)<0)){var i=h.identifier(n);e.push(h.expressionStatement(h.assignmentExpression("=",h.memberExpression(t,i),u.get(n))))}})}(t,r,e)}),(0,l.default)(n).code};var u=i(e("babel-helpers")),l=n(e("babel-generator")),c=i(e("babel-messages")),p=n(e("babel-template")),h=i(e("babel-types")),f=(0,p.default)('\n (function (root, factory) {\n if (typeof define === "function" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === "object") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n');t.exports=r.default},{"babel-generator":85,"babel-helpers":109,"babel-messages":110,"babel-template":139,"babel-types":180}],43:[function(e,t,r){(function(t){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.File=void 0;var s=i(e("babel-runtime/core-js/get-iterator")),a=i(e("babel-runtime/core-js/object/create")),o=i(e("babel-runtime/core-js/object/assign")),u=i(e("babel-runtime/helpers/classCallCheck")),l=i(e("babel-runtime/helpers/possibleConstructorReturn")),c=i(e("babel-runtime/helpers/inherits")),p=i(e("babel-helpers")),h=n(e("./metadata")),f=i(e("convert-source-map")),d=i(e("./options/option-manager")),m=i(e("../plugin-pass")),y=e("babel-traverse"),g=i(y),b=i(e("source-map")),v=i(e("babel-generator")),x=i(e("babel-code-frame")),E=i(e("lodash/defaults")),A=i(e("./logger")),D=i(e("../../store")),S=e("babylon"),C=n(e("../../util")),_=i(e("path")),w=n(e("babel-types")),k=i(e("../../helpers/resolve")),F=i(e("../internal-plugins/block-hoist")),T=i(e("../internal-plugins/shadow-functions")),P=/^#!.*/,B=[[F.default],[T.default]],O={enter:function(e,t){var r=e.node.loc;r&&(t.loc=r,e.stop())}},N=function(r){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];(0,u.default)(this,n);var i=(0,l.default)(this,r.call(this));return i.pipeline=t,i.log=new A.default(i,e.filename||"unknown"),i.opts=i.initOptions(e),i.parserOpts={sourceType:i.opts.sourceType,sourceFileName:i.opts.filename,plugins:[]},i.pluginVisitors=[],i.pluginPasses=[],i.buildPluginsForOptions(i.opts),i.opts.passPerPreset&&(i.perPresetOpts=[],i.opts.presets.forEach(function(e){var t=(0,o.default)((0,a.default)(i.opts),e);i.perPresetOpts.push(t),i.buildPluginsForOptions(t)})),i.metadata={usedHelpers:[],marked:[],modules:{imports:[],exports:{exported:[],specifiers:[]}}},i.dynamicImportTypes={},i.dynamicImportIds={},i.dynamicImports=[],i.declarations={},i.usedHelpers={},i.path=null,i.ast={},i.code="",i.shebang="",i.hub=new y.Hub(i),i}return(0,c.default)(n,r),n.prototype.getMetadata=function(){var e=!1,t=this.ast.program.body,r=Array.isArray(t),n=0;for(t=r?t:(0,s.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var a=i;if(w.isModuleDeclaration(a)){e=!0;break}}e&&this.path.traverse(h,this)},n.prototype.initOptions=function(e){(e=new d.default(this.log,this.pipeline).init(e)).inputSourceMap&&(e.sourceMaps=!0),e.moduleId&&(e.moduleIds=!0),e.basename=_.default.basename(e.filename,_.default.extname(e.filename)),e.ignore=C.arrayify(e.ignore,C.regexify),e.only&&(e.only=C.arrayify(e.only,C.regexify)),(0,E.default)(e,{moduleRoot:e.sourceRoot}),(0,E.default)(e,{sourceRoot:e.moduleRoot}),(0,E.default)(e,{filenameRelative:e.filename});var t=_.default.basename(e.filenameRelative);return(0,E.default)(e,{sourceFileName:t,sourceMapTarget:t}),e},n.prototype.buildPluginsForOptions=function(e){if(Array.isArray(e.plugins)){var t=[],r=[],n=e.plugins.concat(B),i=Array.isArray(n),a=0;for(n=i?n:(0,s.default)(n);;){var o;if(i){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var u=o,l=u[0],c=u[1];t.push(l.visitor),r.push(new m.default(this,l,c)),l.manipulateOptions&&l.manipulateOptions(e,this.parserOpts,this)}this.pluginVisitors.push(t),this.pluginPasses.push(r)}},n.prototype.getModuleName=function(){var e=this.opts;if(!e.moduleIds)return null;if(null!=e.moduleId&&!e.getModuleId)return e.moduleId;var t=e.filenameRelative,r="";if(null!=e.moduleRoot&&(r=e.moduleRoot+"/"),!e.filenameRelative)return r+e.filename.replace(/^\//,"");if(null!=e.sourceRoot){var n=new RegExp("^"+e.sourceRoot+"/?");t=t.replace(n,"")}return t=t.replace(/\.(\w*?)$/,""),r+=t,r=r.replace(/\\/g,"/"),e.getModuleId?e.getModuleId(r)||r:r},n.prototype.resolveModuleSource=function(e){var t=this.opts.resolveModuleSource;return t&&(e=t(e,this.opts.filename)),e},n.prototype.addImport=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=e+":"+t,i=this.dynamicImportIds[n];if(!i){e=this.resolveModuleSource(e),i=this.dynamicImportIds[n]=this.scope.generateUidIdentifier(r);var s=[];"*"===t?s.push(w.importNamespaceSpecifier(i)):"default"===t?s.push(w.importDefaultSpecifier(i)):s.push(w.importSpecifier(i,w.identifier(t)));var a=w.importDeclaration(s,w.stringLiteral(e));a._blockHoist=3,this.path.unshiftContainer("body",a)}return i},n.prototype.addHelper=function(e){var t=this.declarations[e];if(t)return t;this.usedHelpers[e]||(this.metadata.usedHelpers.push(e),this.usedHelpers[e]=!0);var r=this.get("helperGenerator"),n=this.get("helpersNamespace");if(r){var i=r(e);if(i)return i}else if(n)return w.memberExpression(n,w.identifier(e));var s=(0,p.default)(e),a=this.declarations[e]=this.scope.generateUidIdentifier(e);return w.isFunctionExpression(s)&&!s.id?(s.body._compact=!0,s._generated=!0,s.id=a,s.type="FunctionDeclaration",this.path.unshiftContainer("body",s)):(s._compact=!0,this.scope.push({id:a,init:s,unique:!0})),a},n.prototype.addTemplateObject=function(e,t,r){var n=r.elements.map(function(e){return e.value}),i=e+"_"+r.elements.length+"_"+n.join(","),s=this.declarations[i];if(s)return s;var a=this.declarations[i]=this.scope.generateUidIdentifier("templateObject"),o=this.addHelper(e),u=w.callExpression(o,[t,r]);return u._compact=!0,this.scope.push({id:a,init:u,_blockHoist:1.9}),a},n.prototype.buildCodeFrameError=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:SyntaxError,n=e&&(e.loc||e._loc),i=new r(t);return n?i.loc=n.start:((0,g.default)(e,O,this.scope,i),i.message+=" (This is an error on an internal node. Probably an internal error",i.loc&&(i.message+=". Location has been estimated."),i.message+=")"),i},n.prototype.mergeSourceMap=function(e){var t=this.opts.inputSourceMap;if(t){var r=new b.default.SourceMapConsumer(t),n=new b.default.SourceMapConsumer(e),i=new b.default.SourceMapGenerator({file:r.file,sourceRoot:r.sourceRoot}),s=n.sources[0];r.eachMapping(function(e){var t=n.generatedPositionFor({line:e.generatedLine,column:e.generatedColumn,source:s});null!=t.column&&i.addMapping({source:e.source,original:null==e.source?null:{line:e.originalLine,column:e.originalColumn},generated:t})});var a=i.toJSON();return t.mappings=a.mappings,t}return e},n.prototype.parse=function(r){var n=S.parse,i=this.opts.parserOpts;if(i&&(i=(0,o.default)({},this.parserOpts,i)).parser){if("string"==typeof i.parser){var s=_.default.dirname(this.opts.filename)||t.cwd(),a=(0,k.default)(i.parser,s);if(!a)throw new Error("Couldn't find parser "+i.parser+' with "parse" method relative to directory '+s);n=e(a).parse}else n=i.parser;i.parser={parse:function(e){return(0,S.parse)(e,i)}}}this.log.debug("Parse start");var u=n(r,i||this.parserOpts);return this.log.debug("Parse stop"),u},n.prototype._addAst=function(e){this.path=y.NodePath.get({hub:this.hub,parentPath:null,parent:e,container:e,key:"program"}).setContext(),this.scope=this.path.scope,this.ast=e,this.getMetadata()},n.prototype.addAst=function(e){this.log.debug("Start set AST"),this._addAst(e),this.log.debug("End set AST")},n.prototype.transform=function(){for(var e=0;e<this.pluginPasses.length;e++){var t=this.pluginPasses[e];this.call("pre",t),this.log.debug("Start transform traverse");var r=g.default.visitors.merge(this.pluginVisitors[e],t,this.opts.wrapPluginVisitorMethod);(0,g.default)(this.ast,r,this.scope),this.log.debug("End transform traverse"),this.call("post",t)}return this.generate()},n.prototype.wrap=function(e,r){e+="";try{return this.shouldIgnore()?this.makeResult({code:e,ignored:!0}):r()}catch(r){if(r._babel)throw r;r._babel=!0;var n=r.message=this.opts.filename+": "+r.message,i=r.loc;if(i&&(r.codeFrame=(0,x.default)(e,i.line,i.column+1,this.opts),n+="\n"+r.codeFrame),t.browser&&(r.message=n),r.stack){var s=r.stack.replace(r.message,n);r.stack=s}throw r}},n.prototype.addCode=function(e){e=(e||"")+"",e=this.parseInputSourceMap(e),this.code=e},n.prototype.parseCode=function(){this.parseShebang();var e=this.parse(this.code);this.addAst(e)},n.prototype.shouldIgnore=function(){var e=this.opts;return C.shouldIgnore(e.filename,e.ignore,e.only)},n.prototype.call=function(e,t){var r=t,n=Array.isArray(r),i=0;for(r=n?r:(0,s.default)(r);;){var a;if(n){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}var o=a,u=o.plugin[e];u&&u.call(o,this)}},n.prototype.parseInputSourceMap=function(e){var t=this.opts;if(!1!==t.inputSourceMap){var r=f.default.fromSource(e);r&&(t.inputSourceMap=r.toObject(),e=f.default.removeComments(e))}return e},n.prototype.parseShebang=function(){var e=P.exec(this.code);e&&(this.shebang=e[0],this.code=this.code.replace(P,""))},n.prototype.makeResult=function(e){var t=e.code,r=e.map,n=e.ast,i=e.ignored,s={metadata:null,options:this.opts,ignored:!!i,code:null,ast:null,map:r||null};return this.opts.code&&(s.code=t),this.opts.ast&&(s.ast=n),this.opts.metadata&&(s.metadata=this.metadata),s},n.prototype.generate=function(){var r=this.opts,n=this.ast,i={ast:n};if(!r.code)return this.makeResult(i);var s=v.default;if(r.generatorOpts.generator&&"string"==typeof(s=r.generatorOpts.generator)){var a=_.default.dirname(this.opts.filename)||t.cwd(),u=(0,k.default)(s,a);if(!u)throw new Error("Couldn't find generator "+s+' with "print" method relative to directory '+a);s=e(u).print}this.log.debug("Generation start");var l=s(n,r.generatorOpts?(0,o.default)(r,r.generatorOpts):r,this.code);return i.code=l.code,i.map=l.map,this.log.debug("Generation end"),this.shebang&&(i.code=this.shebang+"\n"+i.code),i.map&&(i.map=this.mergeSourceMap(i.map)),"inline"!==r.sourceMaps&&"both"!==r.sourceMaps||(i.code+="\n"+f.default.fromObject(i.map).toComment()),"inline"===r.sourceMaps&&(i.map=null),this.makeResult(i)},n}(D.default);r.default=N,r.File=N}).call(this,e("_process"))},{"../../helpers/resolve":40,"../../store":41,"../../util":57,"../internal-plugins/block-hoist":52,"../internal-plugins/shadow-functions":53,"../plugin-pass":55,"./logger":44,"./metadata":45,"./options/option-manager":49,_process:550,"babel-code-frame":21,"babel-generator":85,"babel-helpers":109,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/object/assign":124,"babel-runtime/core-js/object/create":125,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137,"babel-traverse":143,"babel-types":180,babylon:188,"convert-source-map":58,"lodash/defaults":495,path:546,"source-map":72}],44:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("debug/node")),a=(0,s.default)("babel:verbose"),o=(0,s.default)("babel"),u=[],l=function(){function e(t,r){(0,i.default)(this,e),this.filename=r,this.file=t}return e.prototype._buildMessage=function(e){var t="[BABEL] "+this.filename;return e&&(t+=": "+e),t},e.prototype.warn=function(e){console.warn(this._buildMessage(e))},e.prototype.error=function(e){throw new(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Error)(this._buildMessage(e))},e.prototype.deprecate=function(e){this.file.opts&&this.file.opts.suppressDeprecationMessages||(e=this._buildMessage(e),u.indexOf(e)>=0||(u.push(e),console.error(e)))},e.prototype.verbose=function(e){a.enabled&&a(this._buildMessage(e))},e.prototype.debug=function(e){o.enabled&&o(this._buildMessage(e))},e.prototype.deopt=function(e,t){this.debug(t)},e}();r.default=l,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134,"debug/node":59}],45:[function(e,t,r){"use strict";r.__esModule=!0,r.ImportDeclaration=r.ModuleDeclaration=void 0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.ExportDeclaration=function(e,t){var r=e.node,s=r.source?r.source.value:null,a=t.metadata.modules.exports,o=e.get("declaration");if(o.isStatement()){var u=o.getBindingIdentifiers();for(var l in u)a.exported.push(l),a.specifiers.push({kind:"local",local:l,exported:e.isExportDefaultDeclaration()?"default":l})}if(e.isExportNamedDeclaration()&&r.specifiers){var c=r.specifiers,p=Array.isArray(c),h=0;for(c=p?c:(0,n.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if((h=c.next()).done)break;f=h.value}var d=f,m=d.exported.name;a.exported.push(m),i.isExportDefaultSpecifier(d)&&a.specifiers.push({kind:"external",local:m,exported:m,source:s}),i.isExportNamespaceSpecifier(d)&&a.specifiers.push({kind:"external-namespace",exported:m,source:s});var y=d.local;y&&(s&&a.specifiers.push({kind:"external",local:y.name,exported:m,source:s}),s||a.specifiers.push({kind:"local",local:y.name,exported:m}))}}e.isExportAllDeclaration()&&a.specifiers.push({kind:"external-all",source:s})},r.Scope=function(e){e.skip()};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.ModuleDeclaration={enter:function(e,t){var r=e.node;r.source&&(r.source.value=t.resolveModuleSource(r.source.value))}},r.ImportDeclaration={exit:function(e,t){var r=e.node,i=[],s=[];t.metadata.modules.imports.push({source:r.source.value,imported:s,specifiers:i});var a=e.get("specifiers"),o=Array.isArray(a),u=0;for(a=o?a:(0,n.default)(a);;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l,p=c.node.local.name;if(c.isImportDefaultSpecifier()&&(s.push("default"),i.push({kind:"named",imported:"default",local:p})),c.isImportSpecifier()){var h=c.node.imported.name;s.push(h),i.push({kind:"named",imported:h,local:p})}c.isImportNamespaceSpecifier()&&(s.push("*"),i.push({kind:"namespace",local:p}))}}}},{"babel-runtime/core-js/get-iterator":120,"babel-types":180}],46:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=f[e];return null==t?f[e]=h.default.existsSync(e):t}r.__esModule=!0;var a=i(e("babel-runtime/core-js/object/assign")),o=i(e("babel-runtime/helpers/classCallCheck"));r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],r=e.filename,n=new m(t);return!1!==e.babelrc&&n.findConfigs(r),n.mergeConfig({options:e,alias:"base",dirname:r&&p.default.dirname(r)}),n.configs};var u=i(e("../../../helpers/resolve")),l=i(e("json5")),c=i(e("path-is-absolute")),p=i(e("path")),h=i(e("fs")),f={},d={},m=function(){function e(t){(0,o.default)(this,e),this.resolvedConfigs=[],this.configs=[],this.log=t}return e.prototype.findConfigs=function(e){if(e){(0,c.default)(e)||(e=p.default.join(n.cwd(),e));for(var t=!1,r=!1;e!==(e=p.default.dirname(e));){if(!t){var i=p.default.join(e,".babelrc");s(i)&&(this.addConfig(i),t=!0);var a=p.default.join(e,"package.json");!t&&s(a)&&(t=this.addConfig(a,"babel",JSON))}if(!r){var o=p.default.join(e,".babelignore");s(o)&&(this.addIgnoreConfig(o),r=!0)}if(r&&t)return}}},e.prototype.addIgnoreConfig=function(e){var t=h.default.readFileSync(e,"utf8").split("\n");(t=t.map(function(e){return e.replace(/#(.*?)$/,"").trim()}).filter(function(e){return!!e})).length&&this.mergeConfig({options:{ignore:t},alias:e,dirname:p.default.dirname(e)})},e.prototype.addConfig=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default;if(this.resolvedConfigs.indexOf(e)>=0)return!1;this.resolvedConfigs.push(e);var n=h.default.readFileSync(e,"utf8"),i=void 0;try{i=d[n]=d[n]||r.parse(n),t&&(i=i[t])}catch(t){throw t.message=e+": Error while parsing JSON - "+t.message,t}return this.mergeConfig({options:i,alias:e,dirname:p.default.dirname(e)}),!!i},e.prototype.mergeConfig=function(e){var t=e.options,r=e.alias,i=e.loc,s=e.dirname;if(!t)return!1;if(t=(0,a.default)({},t),s=s||n.cwd(),i=i||r,t.extends){var o=(0,u.default)(t.extends,s);o?this.addConfig(o):this.log&&this.log.error("Couldn't resolve extends clause of "+t.extends+" in "+r),delete t.extends}this.configs.push({options:t,alias:r,loc:i,dirname:s});var l=void 0,c=n.env.BABEL_ENV||n.env.NODE_ENV||"development";t.env&&(l=t.env[c],delete t.env),this.mergeConfig({options:l,alias:r+".env."+c,dirname:s})},e}();t.exports=r.default}).call(this,e("_process"))},{"../../../helpers/resolve":40,_process:550,"babel-runtime/core-js/object/assign":124,"babel-runtime/helpers/classCallCheck":134,fs:193,json5:324,path:546,"path-is-absolute":547}],47:[function(e,t,r){"use strict";t.exports={filename:{type:"filename",description:"filename to use when reading from stdin - this will be used in source-maps, errors etc",default:"unknown",shorthand:"f"},filenameRelative:{hidden:!0,type:"string"},inputSourceMap:{hidden:!0},env:{hidden:!0,default:{}},mode:{description:"",hidden:!0},retainLines:{type:"boolean",default:!1,description:"retain line numbers - will result in really ugly code"},highlightCode:{description:"enable/disable ANSI syntax highlighting of code frames (on by default)",type:"boolean",default:!0},suppressDeprecationMessages:{type:"boolean",default:!1,hidden:!0},presets:{type:"list",description:"",default:[]},plugins:{type:"list",default:[],description:""},ignore:{type:"list",description:"list of glob paths to **not** compile",default:[]},only:{type:"list",description:"list of glob paths to **only** compile"},code:{hidden:!0,default:!0,type:"boolean"},metadata:{hidden:!0,default:!0,type:"boolean"},ast:{hidden:!0,default:!0,type:"boolean"},extends:{type:"string",hidden:!0},comments:{type:"boolean",default:!0,description:"write comments to generated output (true by default)"},shouldPrintComment:{hidden:!0,description:"optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"},wrapPluginVisitorMethod:{hidden:!0,description:"optional callback to wrap all visitor methods"},compact:{type:"booleanString",default:"auto",description:"do not include superfluous whitespace characters and line terminators [true|false|auto]"},minified:{type:"boolean",default:!1,description:"save as much bytes when printing [true|false]"},sourceMap:{alias:"sourceMaps",hidden:!0},sourceMaps:{type:"booleanString",description:"[true|false|inline]",default:!1,shorthand:"s"},sourceMapTarget:{type:"string",description:"set `file` on returned source map"},sourceFileName:{type:"string",description:"set `sources[0]` on returned source map"},sourceRoot:{type:"filename",description:"the root from which all sources are relative"},babelrc:{description:"Whether or not to look up .babelrc and .babelignore files",type:"boolean",default:!0},sourceType:{description:"",default:"module"},auxiliaryCommentBefore:{type:"string",description:"print a comment before any injected non-user code"},auxiliaryCommentAfter:{type:"string",description:"print a comment after any injected non-user code"},resolveModuleSource:{hidden:!0},getModuleId:{hidden:!0},moduleRoot:{type:"filename",description:"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"},moduleIds:{type:"boolean",default:!1,shorthand:"M",description:"insert an explicit id for modules"},moduleId:{description:"specify a custom name for module ids",type:"string"},passPerPreset:{description:"Whether to spawn a traversal pass per a preset. By default all presets are merged.",type:"boolean",default:!1,hidden:!0},parserOpts:{description:"Options to pass into the parser, or to change parsers (parserOpts.parser)",default:!1},generatorOpts:{description:"Options to pass into the generator, or to change generators (generatorOpts.generator)",default:!1}}},{}],48:[function(e,t,r){"use strict";r.__esModule=!0,r.config=void 0,r.normaliseOptions=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in e){var r=e[t];if(null!=r){var s=i.default[t];if(s&&s.alias&&(s=i.default[s.alias]),s){var a=n[s.type];a&&(r=a(r)),e[t]=r}}}return e};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./parsers")),i=function(e){return e&&e.__esModule?e:{default:e}}(e("./config"));r.config=i.default},{"./config":47,"./parsers":50}],49:[function(e,t,r){(function(n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function s(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var a=s(e("babel-runtime/helpers/objectWithoutProperties")),o=s(e("babel-runtime/core-js/json/stringify")),u=s(e("babel-runtime/core-js/object/assign")),l=s(e("babel-runtime/core-js/get-iterator")),c=s(e("babel-runtime/helpers/typeof")),p=s(e("babel-runtime/helpers/classCallCheck")),h=i(e("../../../api/node")),f=s(e("../../plugin")),d=i(e("babel-messages")),m=e("./index"),y=s(e("../../../helpers/resolve-plugin")),g=s(e("../../../helpers/resolve-preset")),b=s(e("lodash/cloneDeepWith")),v=s(e("lodash/clone")),x=s(e("../../../helpers/merge")),E=s(e("./config")),A=s(e("./removed")),D=s(e("./build-config-chain")),S=s(e("path")),C=function(){function t(e){(0,p.default)(this,t),this.resolvedConfigs=[],this.options=t.createBareOptions(),this.log=e}return t.memoisePluginContainer=function(e,r,n,i){var s=t.memoisedPlugins,a=Array.isArray(s),o=0;for(s=a?s:(0,l.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var p=u;if(p.container===e)return p.plugin}var m=void 0;if("object"===(void 0===(m="function"==typeof e?e(h):e)?"undefined":(0,c.default)(m))){var y=new f.default(m,i);return t.memoisedPlugins.push({container:e,plugin:y}),y}throw new TypeError(d.get("pluginNotObject",r,n,void 0===m?"undefined":(0,c.default)(m))+r+n)},t.createBareOptions=function(){var e={};for(var t in E.default){var r=E.default[t];e[t]=(0,v.default)(r.default)}return e},t.normalisePlugin=function(e,r,n,i){if(!((e=e.__esModule?e.default:e)instanceof f.default)){if("function"!=typeof e&&"object"!==(void 0===e?"undefined":(0,c.default)(e)))throw new TypeError(d.get("pluginNotFunction",r,n,void 0===e?"undefined":(0,c.default)(e)));e=t.memoisePluginContainer(e,r,n,i)}return e.init(r,n),e},t.normalisePlugins=function(r,n,i){return i.map(function(i,s){var a=void 0,o=void 0;if(!i)throw new TypeError("Falsy value found in plugins");Array.isArray(i)?(a=i[0],o=i[1]):a=i;var u="string"==typeof a?a:r+"$"+s;if("string"==typeof a){var l=(0,y.default)(a,n);if(!l)throw new ReferenceError(d.get("pluginUnknown",a,r,s,n));a=e(l)}return a=t.normalisePlugin(a,r,s,u),[a,o]})},t.prototype.mergeOptions=function(e){var r=this,i=e.options,s=e.extending,a=e.alias,o=e.loc,l=e.dirname;if(a=a||"foreign",i){("object"!==(void 0===i?"undefined":(0,c.default)(i))||Array.isArray(i))&&this.log.error("Invalid options type for "+a,TypeError);var p=(0,b.default)(i,function(e){if(e instanceof f.default)return e});l=l||n.cwd(),o=o||a;for(var h in p){if(!E.default[h]&&this.log)if(A.default[h])this.log.error("Using removed Babel 5 option: "+a+"."+h+" - "+A.default[h].message,ReferenceError);else{var d="Unknown option: "+a+"."+h+". Check out http://babeljs.io/docs/usage/options/ for more information about options.";this.log.error(d+"\n\nA common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.",ReferenceError)}}(0,m.normaliseOptions)(p),p.plugins&&(p.plugins=t.normalisePlugins(o,l,p.plugins)),p.presets&&(p.passPerPreset?p.presets=this.resolvePresets(p.presets,l,function(e,t){r.mergeOptions({options:e,extending:e,alias:t,loc:t,dirname:l})}):(this.mergePresets(p.presets,l),delete p.presets)),i===s?(0,u.default)(s,p):(0,x.default)(s||this.options,p)}},t.prototype.mergePresets=function(e,t){var r=this;this.resolvePresets(e,t,function(e,t){r.mergeOptions({options:e,alias:t,loc:t,dirname:S.default.dirname(t||"")})})},t.prototype.resolvePresets=function(t,r,n){return t.map(function(t){var i=void 0;if(Array.isArray(t)){if(t.length>2)throw new Error("Unexpected extra options "+(0,o.default)(t.slice(2))+" passed to preset.");var s=t;t=s[0],i=s[1]}var u=void 0;try{if("string"==typeof t){if(!(u=(0,g.default)(t,r)))throw new Error("Couldn't find preset "+(0,o.default)(t)+" relative to directory "+(0,o.default)(r));t=e(u)}if("object"===(void 0===t?"undefined":(0,c.default)(t))&&t.__esModule)if(t.default)t=t.default;else{var l=t;l.__esModule;t=(0,a.default)(l,["__esModule"])}if("object"===(void 0===t?"undefined":(0,c.default)(t))&&t.buildPreset&&(t=t.buildPreset),"function"!=typeof t&&void 0!==i)throw new Error("Options "+(0,o.default)(i)+" passed to "+(u||"a preset")+" which does not accept options.");if("function"==typeof t&&(t=t(h,i,{dirname:r})),"object"!==(void 0===t?"undefined":(0,c.default)(t)))throw new Error("Unsupported preset format: "+t+".");n&&n(t,u)}catch(e){throw u&&(e.message+=" (While processing preset: "+(0,o.default)(u)+")"),e}return t})},t.prototype.normaliseOptions=function(){var e=this.options;for(var t in E.default){var r=E.default[t],n=e[t];!n&&r.optional||(r.alias?e[r.alias]=e[r.alias]||n:e[t]=n)}},t.prototype.init=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,D.default)(e,this.log),r=Array.isArray(t),n=0;for(t=r?t:(0,l.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;this.mergeOptions(s)}return this.normaliseOptions(e),this.options},t}();r.default=C,C.memoisedPlugins=[],t.exports=r.default}).call(this,e("_process"))},{"../../../api/node":32,"../../../helpers/merge":35,"../../../helpers/resolve-plugin":38,"../../../helpers/resolve-preset":39,"../../plugin":56,"./build-config-chain":46,"./config":47,"./index":48,"./removed":51,_process:550,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/core-js/object/assign":124,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/objectWithoutProperties":136,"babel-runtime/helpers/typeof":138,"lodash/clone":491,"lodash/cloneDeepWith":493,path:546}],50:[function(e,t,r){"use strict";r.__esModule=!0,r.filename=void 0,r.boolean=function(e){return!!e},r.booleanString=function(e){return i.booleanify(e)},r.list=function(e){return i.list(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("slash")),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("../../../util"));r.filename=n.default},{"../../../util":57,slash:603}],51:[function(e,t,r){"use strict";t.exports={auxiliaryComment:{message:"Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"},blacklist:{message:"Put the specific transforms you want in the `plugins` option"},breakConfig:{message:"This is not a necessary option in Babel 6"},experimental:{message:"Put the specific transforms you want in the `plugins` option"},externalHelpers:{message:"Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"},extra:{message:""},jsxPragma:{message:"use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"},loose:{message:"Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."},metadataUsedHelpers:{message:"Not required anymore as this is enabled by default"},modules:{message:"Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"},nonStandard:{message:"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"},optional:{message:"Put the specific transforms you want in the `plugins` option"},sourceMapName:{message:"Use the `sourceMapTarget` option"},stage:{message:"Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"},whitelist:{message:"Put the specific transforms you want in the `plugins` option"}}},{}],52:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("../plugin")),s=n(e("lodash/sortBy"));r.default=new i.default({name:"internal.blockHoist",visitor:{Block:{exit:function(e){for(var t=e.node,r=!1,n=0;n<t.body.length;n++){var i=t.body[n];if(i&&null!=i._blockHoist){r=!0;break}}r&&(t.body=(0,s.default)(t.body,function(e){var t=e&&e._blockHoist;return null==t&&(t=1),!0===t&&(t=2),-1*t}))}}}}),t.exports=r.default},{"../plugin":56,"lodash/sortBy":531}],53:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var r=e.inShadow(t);if(function(e,t){return!!e.is("_forceShadow")||t}(e,r)){var n=e.node._shadowedFunctionLiteral,i=void 0,s=!1,a=e.find(function(t){if(t.parentPath&&t.parentPath.isClassProperty()&&"value"===t.key)return!0;if(e===t)return!1;if((t.isProgram()||t.isFunction())&&(i=i||t),t.isProgram())return s=!0,!0;if(t.isFunction()&&!t.isArrowFunctionExpression()){if(n){if(t===n||t.node===n.node)return!0}else if(!t.is("shadow"))return!0;return s=!0,!1}return!1});if(n&&a.isProgram()&&!n.isProgram()&&(a=e.findParent(function(e){return e.isProgram()||e.isFunction()})),a!==i&&s){var u=a.getData(t);if(u)return e.replaceWith(u);var c=e.scope.generateUidIdentifier(t);a.setData(t,c);var p=a.findParent(function(e){return e.isClass()}),h=!!(p&&p.node&&p.node.superClass);if("this"===t&&a.isMethod({kind:"constructor"})&&h)a.scope.push({id:c}),a.traverse(l,{id:c});else{var f="this"===t?o.thisExpression():o.identifier(t);n&&(f._shadowedFunctionLiteral=n),a.scope.push({id:c,init:f})}return e.replaceWith(c)}}}r.__esModule=!0;var s=n(e("babel-runtime/core-js/symbol")),a=n(e("../plugin")),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),u=(0,s.default)("super this bound"),l={CallExpression:function(e){if(e.get("callee").isSuper()){var t=e.node;t[u]||(t[u]=!0,e.replaceWith(o.assignmentExpression("=",this.id,t)))}}};r.default=new a.default({name:"internal.shadowFunctions",visitor:{ThisExpression:function(e){i(e,"this")},ReferencedIdentifier:function(e){"arguments"===e.node.name&&i(e,"arguments")}}}),t.exports=r.default},{"../plugin":56,"babel-runtime/core-js/symbol":129,"babel-types":180}],54:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("../helpers/normalize-ast")),a=n(e("./plugin")),o=n(e("./file")),u=function(){function e(){(0,i.default)(this,e)}return e.prototype.lint=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.code=!1,t.mode="lint",this.transform(e,t)},e.prototype.pretransform=function(e,t){var r=new o.default(t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r})},e.prototype.transform=function(e,t){var r=new o.default(t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r.transform()})},e.prototype.analyse=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];return t.code=!1,r&&(t.plugins=t.plugins||[],t.plugins.push(new a.default({visitor:r}))),this.transform(e,t).metadata},e.prototype.transformFromAst=function(e,t,r){e=(0,s.default)(e);var n=new o.default(r,this);return n.wrap(t,function(){return n.addCode(t),n.addAst(e),n.transform()})},e}();r.default=u,t.exports=r.default},{"../helpers/normalize-ast":36,"./file":43,"./plugin":56,"babel-runtime/helpers/classCallCheck":134}],55:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("babel-runtime/helpers/possibleConstructorReturn")),a=n(e("babel-runtime/helpers/inherits")),o=n(e("../store")),u=(n(e("./file")),function(e){function t(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,i.default)(this,t);var o=(0,s.default)(this,e.call(this));return o.plugin=n,o.key=n.key,o.file=r,o.opts=a,o}return(0,a.default)(t,e),t.prototype.addHelper=function(){var e;return(e=this.file).addHelper.apply(e,arguments)},t.prototype.addImport=function(){var e;return(e=this.file).addImport.apply(e,arguments)},t.prototype.getModuleName=function(){var e;return(e=this.file).getModuleName.apply(e,arguments)},t.prototype.buildCodeFrameError=function(){var e;return(e=this.file).buildCodeFrameError.apply(e,arguments)},t}(o.default));r.default=u,t.exports=r.default},{"../store":41,"./file":43,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137}],56:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator")),s=n(e("babel-runtime/helpers/classCallCheck")),a=n(e("babel-runtime/helpers/possibleConstructorReturn")),o=n(e("babel-runtime/helpers/inherits")),u=n(e("./file/options/option-manager")),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-messages")),c=n(e("../store")),p=n(e("babel-traverse")),h=n(e("lodash/assign")),f=n(e("lodash/clone")),d=["enter","exit"],m=function(e){function t(r,n){(0,s.default)(this,t);var i=(0,a.default)(this,e.call(this));return i.initialized=!1,i.raw=(0,h.default)({},r),i.key=i.take("name")||n,i.manipulateOptions=i.take("manipulateOptions"),i.post=i.take("post"),i.pre=i.take("pre"),i.visitor=i.normaliseVisitor((0,f.default)(i.take("visitor"))||{}),i}return(0,o.default)(t,e),t.prototype.take=function(e){var t=this.raw[e];return delete this.raw[e],t},t.prototype.chain=function(e,t){if(!e[t])return this[t];if(!this[t])return e[t];var r=[e[t],this[t]];return function(){for(var e=void 0,t=arguments.length,n=Array(t),s=0;s<t;s++)n[s]=arguments[s];var a=r,o=Array.isArray(a),u=0;for(a=o?a:(0,i.default)(a);;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}if(l){var c=l.apply(this,n);null!=c&&(e=c)}}return e}},t.prototype.maybeInherit=function(e){var t=this.take("inherits");t&&(t=u.default.normalisePlugin(t,e,"inherits"),this.manipulateOptions=this.chain(t,"manipulateOptions"),this.post=this.chain(t,"post"),this.pre=this.chain(t,"pre"),this.visitor=p.default.visitors.merge([t.visitor,this.visitor]))},t.prototype.init=function(e,t){if(!this.initialized){this.initialized=!0,this.maybeInherit(e);for(var r in this.raw)throw new Error(l.get("pluginInvalidProperty",e,t,r))}},t.prototype.normaliseVisitor=function(e){var t=d,r=Array.isArray(t),n=0;for(t=r?t:(0,i.default)(t);;){var s;if(r){if(n>=t.length)break;s=t[n++]}else{if((n=t.next()).done)break;s=n.value}if(e[s])throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. Please target individual nodes.")}return p.default.explode(e),e},t}(c.default);r.default=m,t.exports=r.default},{"../store":41,"./file/options/option-manager":49,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137,"babel-traverse":143,"lodash/assign":488,"lodash/clone":491}],57:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var r=t||i.EXTENSIONS,n=m.default.extname(e);return(0,f.default)(r,n)}function s(e){return e?Array.isArray(e)?e:"string"==typeof e?e.split(","):[e]:[]}function a(e,t){return e?"boolean"==typeof e?a([e],t):"string"==typeof e?a(s(e),t):Array.isArray(e)?(t&&(e=e.map(t)),e):[e]:[]}function o(e,t){return"function"==typeof e?e(t):e.test(t)}r.__esModule=!0,r.inspect=r.inherits=void 0;var u=n(e("babel-runtime/core-js/get-iterator")),l=e("util");Object.defineProperty(r,"inherits",{enumerable:!0,get:function(){return l.inherits}}),Object.defineProperty(r,"inspect",{enumerable:!0,get:function(){return l.inspect}}),r.canCompile=i,r.list=s,r.regexify=function(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=new RegExp(e.map(c.default).join("|"),"i")),"string"==typeof e){e=(0,y.default)(e),((0,p.default)(e,"./")||(0,p.default)(e,"*/"))&&(e=e.slice(2)),(0,p.default)(e,"**/")&&(e=e.slice(3));var t=h.default.makeRe(e,{nocase:!0});return new RegExp(t.source.slice(1,-1),"i")}if((0,d.default)(e))return e;throw new TypeError("illegal type for regexify")},r.arrayify=a,r.booleanify=function(e){return"true"===e||1==e||!("false"===e||0==e||!e)&&e},r.shouldIgnore=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2];if(e=e.replace(/\\/g,"/"),r){var n=r,i=Array.isArray(n),s=0;for(n=i?n:(0,u.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}if(o(a,e))return!1}return!0}if(t.length){var l=t,c=Array.isArray(l),p=0;for(l=c?l:(0,u.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if((p=l.next()).done)break;h=p.value}if(o(h,e))return!0}}return!1};var c=n(e("lodash/escapeRegExp")),p=n(e("lodash/startsWith")),h=n(e("minimatch")),f=n(e("lodash/includes")),d=n(e("lodash/isRegExp")),m=n(e("path")),y=n(e("slash"));i.EXTENSIONS=[".js",".jsx",".es6",".es"]},{"babel-runtime/core-js/get-iterator":120,"lodash/escapeRegExp":497,"lodash/includes":507,"lodash/isRegExp":519,"lodash/startsWith":532,minimatch:542,path:546,slash:603,util:613}],58:[function(e,t,r){(function(t){"use strict";function n(e,n){(n=n||{}).isFileComment&&(e=function(e,t){var n=r.mapFileCommentRegex.exec(e),a=n[1]||n[2],o=s.resolve(t,a);try{return i.readFileSync(o,"utf8")}catch(e){throw new Error("An error occurred while trying to read the map file at "+o+"\n"+e)}}(e,n.commentFileDir)),n.hasComment&&(e=function(e){return e.split(",").pop()}(e)),n.isEncoded&&(e=function(e){return new t(e,"base64").toString()}(e)),(n.isJSON||n.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}var i=e("fs"),s=e("path");Object.defineProperty(r,"commentRegex",{get:function(){return/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/gm}}),Object.defineProperty(r,"mapFileCommentRegex",{get:function(){return/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm}}),n.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},n.prototype.toBase64=function(){var e=this.toJSON();return new t(e).toString("base64")},n.prototype.toComment=function(e){var t="sourceMappingURL=data:application/json;charset=utf-8;base64,"+this.toBase64();return e&&e.multiline?"/*# "+t+" */":"//# "+t},n.prototype.toObject=function(){return JSON.parse(this.toJSON())},n.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error('property "'+e+'" already exists on the sourcemap, use set property instead');return this.setProperty(e,t)},n.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},n.prototype.getProperty=function(e){return this.sourcemap[e]},r.fromObject=function(e){return new n(e)},r.fromJSON=function(e){return new n(e,{isJSON:!0})},r.fromBase64=function(e){return new n(e,{isEncoded:!0})},r.fromComment=function(e){return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new n(e,{isEncoded:!0,hasComment:!0})},r.fromMapFileComment=function(e,t){return new n(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},r.fromSource=function(e){var t=e.match(r.commentRegex);return t?r.fromComment(t.pop()):null},r.fromMapFileSource=function(e,t){var n=e.match(r.mapFileCommentRegex);return n?r.fromMapFileComment(n.pop(),t):null},r.removeComments=function(e){return e.replace(r.commentRegex,"")},r.removeMapFileComments=function(e){return e.replace(r.mapFileCommentRegex,"")},r.generateMapFileComment=function(e,t){var r="sourceMappingURL="+e;return t&&t.multiline?"/*# "+r+" */":"//# "+r}}).call(this,e("buffer").Buffer)},{buffer:194,fs:193,path:546}],59:[function(e,t,r){t.exports=e("./src/node")},{"./src/node":61}],60:[function(e,t,r){function n(e){function t(){if(t.enabled){var e=t,n=+new Date,s=n-(i||n);e.diff=s,e.prev=i,e.curr=n,i=n;for(var a=new Array(arguments.length),o=0;o<a.length;o++)a[o]=arguments[o];a[0]=r.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var u=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,function(t,n){if("%%"===t)return t;u++;var i=r.formatters[n];if("function"==typeof i){var s=a[u];t=i.call(e,s),a.splice(u,1),u--}return t}),r.formatArgs.call(e,a);(t.log||r.log||console.log.bind(console)).apply(e,a)}}return t.namespace=e,t.enabled=r.enabled(e),t.useColors=r.useColors(),t.color=function(e){var t,n=0;for(t in e)n=(n<<5)-n+e.charCodeAt(t),n|=0;return r.colors[Math.abs(n)%r.colors.length]}(e),"function"==typeof r.init&&r.init(t),t}(r=t.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){r.enable("")},r.enable=function(e){r.save(e),r.names=[],r.skips=[];for(var t=("string"==typeof e?e:"").split(/[\s,]+/),n=t.length,i=0;i<n;i++)t[i]&&("-"===(e=t[i].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){var t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.names=[],r.skips=[],r.formatters={};var i},{ms:543}],61:[function(e,t,r){(function(n){function i(){return n.env.DEBUG}var s=e("tty"),a=e("util");(r=t.exports=e("./debug")).init=function(e){e.inspectOpts={};for(var t=Object.keys(r.inspectOpts),n=0;n<t.length;n++)e.inspectOpts[t[n]]=r.inspectOpts[t[n]]},r.log=function(){return u.write(a.format.apply(a,arguments)+"\n")},r.formatArgs=function(e){var t=this.namespace;if(this.useColors){var n=this.color,i=" [3"+n+";1m"+t+" ";e[0]=i+e[0].split("\n").join("\n"+i),e.push("[3"+n+"m+"+r.humanize(this.diff)+"")}else e[0]=(new Date).toUTCString()+" "+t+" "+e[0]},r.save=function(e){null==e?delete n.env.DEBUG:n.env.DEBUG=e},r.load=i,r.useColors=function(){return"colors"in r.inspectOpts?Boolean(r.inspectOpts.colors):s.isatty(o)},r.colors=[6,2,3,4,5,1],r.inspectOpts=Object.keys(n.env).filter(function(e){return/^debug_/i.test(e)}).reduce(function(e,t){var r=t.substring(6).toLowerCase().replace(/_([a-z])/g,function(e,t){return t.toUpperCase()}),i=n.env[t];return i=!!/^(yes|on|true|enabled)$/i.test(i)||!/^(no|off|false|disabled)$/i.test(i)&&("null"===i?null:Number(i)),e[r]=i,e},{});var o=parseInt(n.env.DEBUG_FD,10)||2;1!==o&&2!==o&&a.deprecate(function(){},"except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();var u=1===o?n.stdout:2===o?n.stderr:function(t){var r;switch(n.binding("tty_wrap").guessHandleType(t)){case"TTY":(r=new s.WriteStream(t))._type="tty",r._handle&&r._handle.unref&&r._handle.unref();break;case"FILE":(r=new(e("fs").SyncWriteStream)(t,{autoClose:!1}))._type="fs";break;case"PIPE":case"TCP":(r=new(e("net").Socket)({fd:t,readable:!1,writable:!0})).readable=!1,r.read=null,r._type="pipe",r._handle&&r._handle.unref&&r._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return r.fd=t,r._isStdio=!0,r}(o);r.formatters.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map(function(e){return e.trim()}).join(" ")},r.formatters.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)},r.enable(i())}).call(this,e("_process"))},{"./debug":60,_process:550,fs:193,net:193,tty:609,util:613}],62:[function(e,t,r){function n(){this._array=[],this._set=a?new Map:Object.create(null)}var i=e("./util"),s=Object.prototype.hasOwnProperty,a="undefined"!=typeof Map;n.fromArray=function(e,t){for(var r=new n,i=0,s=e.length;i<s;i++)r.add(e[i],t);return r},n.prototype.size=function(){return a?this._set.size:Object.getOwnPropertyNames(this._set).length},n.prototype.add=function(e,t){var r=a?e:i.toSetString(e),n=a?this.has(e):s.call(this._set,r),o=this._array.length;n&&!t||this._array.push(e),n||(a?this._set.set(e,o):this._set[r]=o)},n.prototype.has=function(e){if(a)return this._set.has(e);var t=i.toSetString(e);return s.call(this._set,t)},n.prototype.indexOf=function(e){if(a){var t=this._set.get(e);if(t>=0)return t}else{var r=i.toSetString(e);if(s.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},n.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},n.prototype.toArray=function(){return this._array.slice()},r.ArraySet=n},{"./util":71}],63:[function(e,t,r){var n=e("./base64");r.encode=function(e){var t,r="",i=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{t=31&i,(i>>>=5)>0&&(t|=32),r+=n.encode(t)}while(i>0);return r},r.decode=function(e,t,r){var i,s,a=e.length,o=0,u=0;do{if(t>=a)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(s=n.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));i=!!(32&s),o+=(s&=31)<<u,u+=5}while(i);r.value=function(e){var t=e>>1;return 1==(1&e)?-t:t}(o),r.rest=t}},{"./base64":64}],64:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(0<=e&&e<n.length)return n[e];throw new TypeError("Must be between 0 and 63: "+e)},r.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1}},{}],65:[function(e,t,r){function n(e,t,i,s,a,o){var u=Math.floor((t-e)/2)+e,l=a(i,s[u],!0);return 0===l?u:l>0?t-u>1?n(u,t,i,s,a,o):o==r.LEAST_UPPER_BOUND?t<s.length?t:-1:u:u-e>1?n(e,u,i,s,a,o):o==r.LEAST_UPPER_BOUND?u:e<0?-1:e}r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.search=function(e,t,i,s){if(0===t.length)return-1;var a=n(-1,t.length,e,t,i,s||r.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===i(t[a],t[a-1],!0);)--a;return a}},{}],66:[function(e,t,r){function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=e("./util");n.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},n.prototype.add=function(e){!function(e,t){var r=e.generatedLine,n=t.generatedLine,s=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=s||i.compareByGeneratedPositionsInflated(e,t)<=0}(this._last,e)?(this._sorted=!1,this._array.push(e)):(this._last=e,this._array.push(e))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},r.MappingList=n},{"./util":71}],67:[function(e,t,r){function n(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function i(e,t,r,s){if(r<s){var a=r-1;n(e,function(e,t){return Math.round(e+Math.random()*(t-e))}(r,s),s);for(var o=e[s],u=r;u<s;u++)t(e[u],o)<=0&&n(e,a+=1,u);n(e,a+1,u);var l=a+1;i(e,t,r,l-1),i(e,t,l+1,s)}}r.quickSort=function(e,t){i(e,t,0,e.length-1)}},{}],68:[function(e,t,r){function n(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new a(t):new i(t)}function i(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=o.getArg(t,"version"),n=o.getArg(t,"sources"),i=o.getArg(t,"names",[]),s=o.getArg(t,"sourceRoot",null),a=o.getArg(t,"sourcesContent",null),u=o.getArg(t,"mappings"),c=o.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);n=n.map(String).map(o.normalize).map(function(e){return s&&o.isAbsolute(s)&&o.isAbsolute(e)?o.relative(s,e):e}),this._names=l.fromArray(i.map(String),!0),this._sources=l.fromArray(n,!0),this.sourceRoot=s,this.sourcesContent=a,this._mappings=u,this.file=c}function s(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function a(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=o.getArg(t,"version"),i=o.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new l,this._names=new l;var s={line:-1,column:0};this._sections=i.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=o.getArg(e,"offset"),r=o.getArg(t,"line"),i=o.getArg(t,"column");if(r<s.line||r===s.line&&i<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=t,{generatedOffset:{generatedLine:r+1,generatedColumn:i+1},consumer:new n(o.getArg(e,"map"))}})}var o=e("./util"),u=e("./binary-search"),l=e("./array-set").ArraySet,c=e("./base64-vlq"),p=e("./quick-sort").quickSort;n.fromSourceMap=function(e){return i.fromSourceMap(e)},n.prototype._version=3,n.prototype.__generatedMappings=null,Object.defineProperty(n.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),n.prototype.__originalMappings=null,Object.defineProperty(n.prototype,"_originalMappings",{get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),n.prototype._charIsMappingSeparator=function(e,t){var r=e.charAt(t);return";"===r||","===r},n.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},n.GENERATED_ORDER=1,n.ORIGINAL_ORDER=2,n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.prototype.eachMapping=function(e,t,r){var i,s=t||null;switch(r||n.GENERATED_ORDER){case n.GENERATED_ORDER:i=this._generatedMappings;break;case n.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;i.map(function(e){var t=null===e.source?null:this._sources.at(e.source);return null!=t&&null!=a&&(t=o.join(a,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}},this).forEach(e,s)},n.prototype.allGeneratedPositionsFor=function(e){var t=o.getArg(e,"line"),r={source:o.getArg(e,"source"),originalLine:t,originalColumn:o.getArg(e,"column",0)};if(null!=this.sourceRoot&&(r.source=o.relative(this.sourceRoot,r.source)),!this._sources.has(r.source))return[];r.source=this._sources.indexOf(r.source);var n=[],i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,u.LEAST_UPPER_BOUND);if(i>=0){var s=this._originalMappings[i];if(void 0===e.column)for(var a=s.originalLine;s&&s.originalLine===a;)n.push({line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var l=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==l;)n.push({line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return n},r.SourceMapConsumer=n,(i.prototype=Object.create(n.prototype)).consumer=n,i.fromSourceMap=function(e){var t=Object.create(i.prototype),r=t._names=l.fromArray(e._names.toArray(),!0),n=t._sources=l.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var a=e._mappings.toArray().slice(),u=t.__generatedMappings=[],c=t.__originalMappings=[],h=0,f=a.length;h<f;h++){var d=a[h],m=new s;m.generatedLine=d.generatedLine,m.generatedColumn=d.generatedColumn,d.source&&(m.source=n.indexOf(d.source),m.originalLine=d.originalLine,m.originalColumn=d.originalColumn,d.name&&(m.name=r.indexOf(d.name)),c.push(m)),u.push(m)}return p(t.__originalMappings,o.compareByOriginalPositions),t},i.prototype._version=3,Object.defineProperty(i.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?o.join(this.sourceRoot,e):e},this)}}),i.prototype._parseMappings=function(e,t){for(var r,n,i,a,u,l=1,h=0,f=0,d=0,m=0,y=0,g=e.length,b=0,v={},x={},E=[],A=[];b<g;)if(";"===e.charAt(b))l++,b++,h=0;else if(","===e.charAt(b))b++;else{for((r=new s).generatedLine=l,a=b;a<g&&!this._charIsMappingSeparator(e,a);a++);if(n=e.slice(b,a),i=v[n])b+=n.length;else{for(i=[];b<a;)c.decode(e,b,x),u=x.value,b=x.rest,i.push(u);if(2===i.length)throw new Error("Found a source, but no line and column");if(3===i.length)throw new Error("Found a source and line, but no column");v[n]=i}r.generatedColumn=h+i[0],h=r.generatedColumn,i.length>1&&(r.source=m+i[1],m+=i[1],r.originalLine=f+i[2],f=r.originalLine,r.originalLine+=1,r.originalColumn=d+i[3],d=r.originalColumn,i.length>4&&(r.name=y+i[4],y+=i[4])),A.push(r),"number"==typeof r.originalLine&&E.push(r)}p(A,o.compareByGeneratedPositionsDeflated),this.__generatedMappings=A,p(E,o.compareByOriginalPositions),this.__originalMappings=E},i.prototype._findMapping=function(e,t,r,n,i,s){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return u.search(e,t,i,s)},i.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},i.prototype.originalPositionFor=function(e){var t={generatedLine:o.getArg(e,"line"),generatedColumn:o.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",o.compareByGeneratedPositionsDeflated,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var s=o.getArg(i,"source",null);null!==s&&(s=this._sources.at(s),null!=this.sourceRoot&&(s=o.join(this.sourceRoot,s)));var a=o.getArg(i,"name",null);return null!==a&&(a=this._names.at(a)),{source:s,line:o.getArg(i,"originalLine",null),column:o.getArg(i,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=o.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=o.urlParse(this.sourceRoot))){var n=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(n))return this.sourcesContent[this._sources.indexOf(n)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=o.getArg(e,"source");if(null!=this.sourceRoot&&(t=o.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};var r={source:t=this._sources.indexOf(t),originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===r.source)return{line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},r.BasicSourceMapConsumer=i,(a.prototype=Object.create(n.prototype)).constructor=n,a.prototype._version=3,Object.defineProperty(a.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}}),a.prototype.originalPositionFor=function(e){var t={generatedLine:o.getArg(e,"line"),generatedColumn:o.getArg(e,"column")},r=u.search(t,this._sections,function(e,t){var r=e.generatedLine-t.generatedOffset.generatedLine;return r||e.generatedColumn-t.generatedOffset.generatedColumn}),n=this._sections[r];return n?n.consumer.originalPositionFor({line:t.generatedLine-(n.generatedOffset.generatedLine-1),column:t.generatedColumn-(n.generatedOffset.generatedLine===t.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},a.prototype.sourceContentFor=function(e,t){for(var r=0;r<this._sections.length;r++){var n=this._sections[r].consumer.sourceContentFor(e,!0);if(n)return n}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(-1!==r.consumer.sources.indexOf(o.getArg(e,"source"))){var n=r.consumer.generatedPositionFor(e);if(n){return{line:n.line+(r.generatedOffset.generatedLine-1),column:n.column+(r.generatedOffset.generatedLine===n.line?r.generatedOffset.generatedColumn-1:0)}}}}return{line:null,column:null}},a.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var n=this._sections[r],i=n.consumer._generatedMappings,s=0;s<i.length;s++){var a=i[s],u=n.consumer._sources.at(a.source);null!==n.consumer.sourceRoot&&(u=o.join(n.consumer.sourceRoot,u)),this._sources.add(u),u=this._sources.indexOf(u);var l=n.consumer._names.at(a.name);this._names.add(l),l=this._names.indexOf(l);var c={source:u,generatedLine:a.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:a.generatedColumn+(n.generatedOffset.generatedLine===a.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:a.originalLine,originalColumn:a.originalColumn,name:l};this.__generatedMappings.push(c),"number"==typeof c.originalLine&&this.__originalMappings.push(c)}p(this.__generatedMappings,o.compareByGeneratedPositionsDeflated),p(this.__originalMappings,o.compareByOriginalPositions)},r.IndexedSourceMapConsumer=a},{"./array-set":62,"./base64-vlq":63,"./binary-search":65,"./quick-sort":67,"./util":71}],69:[function(e,t,r){function n(e){e||(e={}),this._file=s.getArg(e,"file",null),this._sourceRoot=s.getArg(e,"sourceRoot",null),this._skipValidation=s.getArg(e,"skipValidation",!1),this._sources=new a,this._names=new a,this._mappings=new o,this._sourcesContents=null}var i=e("./base64-vlq"),s=e("./util"),a=e("./array-set").ArraySet,o=e("./mapping-list").MappingList;n.prototype._version=3,n.fromSourceMap=function(e){var t=e.sourceRoot,r=new n({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var n={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(n.source=e.source,null!=t&&(n.source=s.relative(t,n.source)),n.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(n.name=e.name)),r.addMapping(n)}),e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&r.setSourceContent(t,n)}),r},n.prototype.addMapping=function(e){var t=s.getArg(e,"generated"),r=s.getArg(e,"original",null),n=s.getArg(e,"source",null),i=s.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,n,i),null!=n&&(n=String(n),this._sources.has(n)||this._sources.add(n)),null!=i&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:n,name:i})},n.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=s.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[s.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[s.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},n.prototype.applySourceMap=function(e,t,r){var n=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=e.file}var i=this._sourceRoot;null!=i&&(n=s.relative(i,n));var o=new a,u=new a;this._mappings.unsortedForEach(function(t){if(t.source===n&&null!=t.originalLine){var a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=s.join(r,t.source)),null!=i&&(t.source=s.relative(i,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}var l=t.source;null==l||o.has(l)||o.add(l);var c=t.name;null==c||u.has(c)||u.add(c)},this),this._sources=o,this._names=u,e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&(null!=r&&(t=s.join(r,t)),null!=i&&(t=s.relative(i,t)),this.setSourceContent(t,n))},this)},n.prototype._validateMapping=function(e,t,r,n){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},n.prototype._serializeMappings=function(){for(var e,t,r,n,a=0,o=1,u=0,l=0,c=0,p=0,h="",f=this._mappings.toArray(),d=0,m=f.length;d<m;d++){if(t=f[d],e="",t.generatedLine!==o)for(a=0;t.generatedLine!==o;)e+=";",o++;else if(d>0){if(!s.compareByGeneratedPositionsInflated(t,f[d-1]))continue;e+=","}e+=i.encode(t.generatedColumn-a),a=t.generatedColumn,null!=t.source&&(n=this._sources.indexOf(t.source),e+=i.encode(n-p),p=n,e+=i.encode(t.originalLine-1-l),l=t.originalLine-1,e+=i.encode(t.originalColumn-u),u=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=i.encode(r-c),c=r)),h+=e}return h},n.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=s.relative(t,e));var r=s.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},n.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},r.SourceMapGenerator=n},{"./array-set":62,"./base64-vlq":63,"./mapping-list":66,"./util":71}],70:[function(e,t,r){function n(e,t,r,n,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==i?null:i,this[o]=!0,null!=n&&this.add(n)}var i=e("./source-map-generator").SourceMapGenerator,s=e("./util"),a=/(\r?\n)/,o="$$$isSourceNode$$$";n.fromStringWithSourceMap=function(e,t,r){function i(e,t){if(null===e||void 0===e.source)o.add(t);else{var i=r?s.join(r,e.source):e.source;o.add(new n(e.originalLine,e.originalColumn,i,t,e.name))}}var o=new n,u=e.split(a),l=0,c=function(){function e(){return l<u.length?u[l++]:void 0}return e()+(e()||"")},p=1,h=0,f=null;return t.eachMapping(function(e){if(null!==f){if(!(p<e.generatedLine)){var t=(r=u[l]).substr(0,e.generatedColumn-h);return u[l]=r.substr(e.generatedColumn-h),h=e.generatedColumn,i(f,t),void(f=e)}i(f,c()),p++,h=0}for(;p<e.generatedLine;)o.add(c()),p++;if(h<e.generatedColumn){var r=u[l];o.add(r.substr(0,e.generatedColumn)),u[l]=r.substr(e.generatedColumn),h=e.generatedColumn}f=e},this),l<u.length&&(f&&i(f,c()),o.add(u.splice(l).join(""))),t.sources.forEach(function(e){var n=t.sourceContentFor(e);null!=n&&(null!=r&&(e=s.join(r,e)),o.setSourceContent(e,n))}),o},n.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[o]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},n.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[o]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},n.prototype.walk=function(e){for(var t,r=0,n=this.children.length;r<n;r++)(t=this.children[r])[o]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(e){var t,r,n=this.children.length;if(n>0){for(t=[],r=0;r<n-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},n.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[o]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},n.prototype.setSourceContent=function(e,t){this.sourceContents[s.toSetString(e)]=t},n.prototype.walkSourceContents=function(e){for(var t=0,r=this.children.length;t<r;t++)this.children[t][o]&&this.children[t].walkSourceContents(e);var n=Object.keys(this.sourceContents);for(t=0,r=n.length;t<r;t++)e(s.fromSetString(n[t]),this.sourceContents[n[t]])},n.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e},n.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},r=new i(e),n=!1,s=null,a=null,o=null,u=null;return this.walk(function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?(s===i.source&&a===i.line&&o===i.column&&u===i.name||r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),s=i.source,a=i.line,o=i.column,u=i.name,n=!0):n&&(r.addMapping({generated:{line:t.line,column:t.column}}),s=null,n=!1);for(var l=0,c=e.length;l<c;l++)10===e.charCodeAt(l)?(t.line++,t.column=0,l+1===c?(s=null,n=!1):n&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++}),this.walkSourceContents(function(e,t){r.setSourceContent(e,t)}),{code:t.code,map:r}},r.SourceNode=n},{"./source-map-generator":69,"./util":71}],71:[function(e,t,r){function n(e){var t=e.match(l);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function i(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function s(e){var t=e,s=n(e);if(s){if(!s.path)return e;t=s.path}for(var a,o=r.isAbsolute(t),u=t.split(/\/+/),l=0,c=u.length-1;c>=0;c--)"."===(a=u[c])?u.splice(c,1):".."===a?l++:l>0&&(""===a?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return""===(t=u.join("/"))&&(t=o?"/":"."),s?(s.path=t,i(s)):t}function a(e){return e}function o(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function u(e,t){return e===t?0:e>t?1:-1}r.getArg=function(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')};var l=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,c=/^data:.+\,.+$/;r.urlParse=n,r.urlGenerate=i,r.normalize=s,r.join=function(e,t){""===e&&(e="."),""===t&&(t=".");var r=n(t),a=n(e);if(a&&(e=a.path||"/"),r&&!r.scheme)return a&&(r.scheme=a.scheme),i(r);if(r||t.match(c))return t;if(a&&!a.host&&!a.path)return a.host=t,i(a);var o="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return a?(a.path=o,i(a)):o},r.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(l)},r.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(n<0)return t;if((e=e.slice(0,n)).match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)};var p=!("__proto__"in Object.create(null));r.toSetString=p?a:function(e){return o(e)?"$"+e:e},r.fromSetString=p?a:function(e){return o(e)?e.slice(1):e},r.compareByOriginalPositions=function(e,t,r){var n=e.source-t.source;return 0!==n?n:0!=(n=e.originalLine-t.originalLine)?n:0!=(n=e.originalColumn-t.originalColumn)||r?n:0!=(n=e.generatedColumn-t.generatedColumn)?n:0!=(n=e.generatedLine-t.generatedLine)?n:e.name-t.name},r.compareByGeneratedPositionsDeflated=function(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!=(n=e.generatedColumn-t.generatedColumn)||r?n:0!=(n=e.source-t.source)?n:0!=(n=e.originalLine-t.originalLine)?n:0!=(n=e.originalColumn-t.originalColumn)?n:e.name-t.name},r.compareByGeneratedPositionsInflated=function(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-t.generatedColumn)?r:0!==(r=u(e.source,t.source))?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)?r:u(e.name,t.name)}},{}],72:[function(e,t,r){r.SourceMapGenerator=e("./lib/source-map-generator").SourceMapGenerator,r.SourceMapConsumer=e("./lib/source-map-consumer").SourceMapConsumer,r.SourceNode=e("./lib/source-node").SourceNode},{"./lib/source-map-consumer":68,"./lib/source-map-generator":69,"./lib/source-node":70}],73:[function(e,t,r){t.exports={_args:[[{raw:"babel-core@^6.18.2",scope:null,escapedName:"babel-core",name:"babel-core",rawSpec:"^6.18.2",spec:">=6.18.2 <7.0.0",type:"range"},"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/regenerator"]],_from:"babel-core@>=6.18.2 <7.0.0",_id:"babel-core@6.26.0",_inCache:!0,_location:"/babel-core",_nodeVersion:"6.9.0",_npmOperationalInternal:{host:"s3://npm-registry-packages",tmp:"tmp/babel-core-6.26.0.tgz_1502898861183_0.43529116874560714"},_npmUser:{name:"hzoo",email:"hi@henryzoo.com"},_npmVersion:"4.6.1",_phantomChildren:{ms:"2.0.0"},_requested:{raw:"babel-core@^6.18.2",scope:null,escapedName:"babel-core",name:"babel-core",rawSpec:"^6.18.2",spec:">=6.18.2 <7.0.0",type:"range"},_requiredBy:["/babel-register","/regenerator"],_resolved:"https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",_shasum:"af32f78b31a6fcef119c87b0fd8d9753f03a0bb8",_shrinkwrap:null,_spec:"babel-core@^6.18.2",_where:"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/regenerator",author:{name:"Sebastian McKenzie",email:"sebmck@gmail.com"},dependencies:{"babel-code-frame":"^6.26.0","babel-generator":"^6.26.0","babel-helpers":"^6.24.1","babel-messages":"^6.23.0","babel-register":"^6.26.0","babel-runtime":"^6.26.0","babel-template":"^6.26.0","babel-traverse":"^6.26.0","babel-types":"^6.26.0",babylon:"^6.18.0","convert-source-map":"^1.5.0",debug:"^2.6.8",json5:"^0.5.1",lodash:"^4.17.4",minimatch:"^3.0.4","path-is-absolute":"^1.0.1",private:"^0.1.7",slash:"^1.0.0","source-map":"^0.5.6"},description:"Babel compiler core.",devDependencies:{"babel-helper-fixtures":"^6.26.0","babel-helper-transform-fixture-test-runner":"^6.26.0","babel-polyfill":"^6.26.0"},directories:{},dist:{shasum:"af32f78b31a6fcef119c87b0fd8d9753f03a0bb8",tarball:"https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz"},homepage:"https://babeljs.io/",keywords:["6to5","babel","classes","const","es6","harmony","let","modules","transpile","transpiler","var","babel-core","compiler"],license:"MIT",maintainers:[{name:"thejameskyle",email:"me@thejameskyle.com"},{name:"sebmck",email:"sebmck@gmail.com"},{name:"danez",email:"daniel@tschinder.de"},{name:"hzoo",email:"hi@henryzoo.com"},{name:"loganfsmyth",email:"loganfsmyth@gmail.com"}],name:"babel-core",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"https://github.com/babel/babel/tree/master/packages/babel-core"},scripts:{bench:"make bench",test:"make test"},version:"6.26.0"}},{}],74:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("trim-right")),a=/^[ \t]+$/,o=function(){function e(t){(0,i.default)(this,e),this._map=null,this._buf=[],this._last="",this._queue=[],this._position={line:1,column:0},this._sourcePosition={identifierName:null,line:null,column:null,filename:null},this._map=t}return e.prototype.get=function(){this._flush();var e=this._map,t={code:(0,s.default)(this._buf.join("")),map:null,rawMappings:e&&e.getRawMappings()};return e&&Object.defineProperty(t,"map",{configurable:!0,enumerable:!0,get:function(){return this.map=e.get()},set:function(e){Object.defineProperty(this,"map",{value:e,writable:!0})}}),t},e.prototype.append=function(e){this._flush();var t=this._sourcePosition,r=t.line,n=t.column,i=t.filename,s=t.identifierName;this._append(e,r,n,s,i)},e.prototype.queue=function(e){if("\n"===e)for(;this._queue.length>0&&a.test(this._queue[0][0]);)this._queue.shift();var t=this._sourcePosition,r=t.line,n=t.column,i=t.filename,s=t.identifierName;this._queue.unshift([e,r,n,s,i])},e.prototype._flush=function(){for(var e=void 0;e=this._queue.pop();)this._append.apply(this,e)},e.prototype._append=function(e,t,r,n,i){this._map&&"\n"!==e[0]&&this._map.mark(this._position.line,this._position.column,t,r,n,i),this._buf.push(e),this._last=e[e.length-1];for(var s=0;s<e.length;s++)"\n"===e[s]?(this._position.line++,this._position.column=0):this._position.column++},e.prototype.removeTrailingNewline=function(){this._queue.length>0&&"\n"===this._queue[0][0]&&this._queue.shift()},e.prototype.removeLastSemicolon=function(){this._queue.length>0&&";"===this._queue[0][0]&&this._queue.shift()},e.prototype.endsWith=function(e){if(1===e.length){var t=void 0;if(this._queue.length>0){var r=this._queue[0][0];t=r[r.length-1]}else t=this._last;return t===e}var n=this._last+this._queue.reduce(function(e,t){return t[0]+e},"");return e.length<=n.length&&n.slice(-e.length)===e},e.prototype.hasContent=function(){return this._queue.length>0||!!this._last},e.prototype.source=function(e,t){if(!e||t){var r=t?t[e]:null;this._sourcePosition.identifierName=t&&t.identifierName||null,this._sourcePosition.line=r?r.line:null,this._sourcePosition.column=r?r.column:null,this._sourcePosition.filename=t&&t.filename||null}},e.prototype.withSource=function(e,t,r){if(!this._map)return r();var n=this._sourcePosition.line,i=this._sourcePosition.column,s=this._sourcePosition.filename,a=this._sourcePosition.identifierName;this.source(e,t),r(),this._sourcePosition.line=n,this._sourcePosition.column=i,this._sourcePosition.filename=s,this._sourcePosition.identifierName=a},e.prototype.getCurrentColumn=function(){var e=this._queue.reduce(function(e,t){return t[0]+e},""),t=e.lastIndexOf("\n");return-1===t?this._position.column+e.length:e.length-1-t},e.prototype.getCurrentLine=function(){for(var e=this._queue.reduce(function(e,t){return t[0]+e},""),t=0,r=0;r<e.length;r++)"\n"===e[r]&&t++;return this._position.line+t},e}();r.default=o,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134,"trim-right":608}],75:[function(e,t,r){"use strict";r.__esModule=!0,r.File=function(e){this.print(e.program,e)},r.Program=function(e){this.printInnerComments(e,!1),this.printSequence(e.directives,e),e.directives&&e.directives.length&&this.newline(),this.printSequence(e.body,e)},r.BlockStatement=function(e){this.token("{"),this.printInnerComments(e);var t=e.directives&&e.directives.length;e.body.length||t?(this.newline(),this.printSequence(e.directives,e,{indent:!0}),t&&this.newline(),this.printSequence(e.body,e,{indent:!0}),this.removeTrailingNewline(),this.source("end",e.loc),this.endsWith("\n")||this.newline(),this.rightBrace()):(this.source("end",e.loc),this.token("}"))},r.Noop=function(){},r.Directive=function(e){this.print(e.value,e),this.semicolon()};var n=e("./types");Object.defineProperty(r,"DirectiveLiteral",{enumerable:!0,get:function(){return n.StringLiteral}})},{"./types":84}],76:[function(e,t,r){"use strict";function n(e){this.printJoin(e.decorators,e),this.word("class"),e.id&&(this.space(),this.print(e.id,e)),this.print(e.typeParameters,e),e.superClass&&(this.space(),this.word("extends"),this.space(),this.print(e.superClass,e),this.print(e.superTypeParameters,e)),e.implements&&(this.space(),this.word("implements"),this.space(),this.printList(e.implements,e)),this.space(),this.print(e.body,e)}r.__esModule=!0,r.ClassDeclaration=n,r.ClassBody=function(e){this.token("{"),this.printInnerComments(e),0===e.body.length?this.token("}"):(this.newline(),this.indent(),this.printSequence(e.body,e),this.dedent(),this.endsWith("\n")||this.newline(),this.rightBrace())},r.ClassProperty=function(e){this.printJoin(e.decorators,e),e.static&&(this.word("static"),this.space()),e.computed?(this.token("["),this.print(e.key,e),this.token("]")):(this._variance(e),this.print(e.key,e)),this.print(e.typeAnnotation,e),e.value&&(this.space(),this.token("="),this.space(),this.print(e.value,e)),this.semicolon()},r.ClassMethod=function(e){this.printJoin(e.decorators,e),e.static&&(this.word("static"),this.space()),"constructorCall"===e.kind&&(this.word("call"),this.space()),this._method(e)},r.ClassExpression=n},{}],77:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(){this.token(","),this.newline(),this.endsWith("\n")||this.space()}function s(e){return function(t){if(this.word(e),t.delegate&&this.token("*"),t.argument){this.space();var r=this.startTerminatorless();this.print(t.argument,t),this.endTerminatorless(r)}}}function a(e,t){var r=this.inForStatementInitCounter&&"in"===e.operator&&!u.needsParens(e,t);r&&this.token("("),this.print(e.left,e),this.space(),"in"===e.operator||"instanceof"===e.operator?this.word(e.operator):this.token(e.operator),this.space(),this.print(e.right,e),r&&this.token(")")}r.__esModule=!0,r.LogicalExpression=r.BinaryExpression=r.AwaitExpression=r.YieldExpression=void 0,r.UnaryExpression=function(e){"void"===e.operator||"delete"===e.operator||"typeof"===e.operator?(this.word(e.operator),this.space()):this.token(e.operator),this.print(e.argument,e)},r.DoExpression=function(e){this.word("do"),this.space(),this.print(e.body,e)},r.ParenthesizedExpression=function(e){this.token("("),this.print(e.expression,e),this.token(")")},r.UpdateExpression=function(e){e.prefix?(this.token(e.operator),this.print(e.argument,e)):(this.print(e.argument,e),this.token(e.operator))},r.ConditionalExpression=function(e){this.print(e.test,e),this.space(),this.token("?"),this.space(),this.print(e.consequent,e),this.space(),this.token(":"),this.space(),this.print(e.alternate,e)},r.NewExpression=function(e,t){this.word("new"),this.space(),this.print(e.callee,e),(0!==e.arguments.length||!this.format.minified||o.isCallExpression(t,{callee:e})||o.isMemberExpression(t)||o.isNewExpression(t))&&(this.token("("),this.printList(e.arguments,e),this.token(")"))},r.SequenceExpression=function(e){this.printList(e.expressions,e)},r.ThisExpression=function(){this.word("this")},r.Super=function(){this.word("super")},r.Decorator=function(e){this.token("@"),this.print(e.expression,e),this.newline()},r.CallExpression=function(e){this.print(e.callee,e),this.token("(");var t=e._prettyCall,r=void 0;t&&(r=i,this.newline(),this.indent()),this.printList(e.arguments,e,{separator:r}),t&&(this.newline(),this.dedent()),this.token(")")},r.Import=function(){this.word("import")},r.EmptyStatement=function(){this.semicolon(!0)},r.ExpressionStatement=function(e){this.print(e.expression,e),this.semicolon()},r.AssignmentPattern=function(e){this.print(e.left,e),e.left.optional&&this.token("?"),this.print(e.left.typeAnnotation,e),this.space(),this.token("="),this.space(),this.print(e.right,e)},r.AssignmentExpression=a,r.BindExpression=function(e){this.print(e.object,e),this.token("::"),this.print(e.callee,e)},r.MemberExpression=function(e){if(this.print(e.object,e),!e.computed&&o.isMemberExpression(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");var t=e.computed;o.isLiteral(e.property)&&"number"==typeof e.property.value&&(t=!0),t?(this.token("["),this.print(e.property,e),this.token("]")):(this.token("."),this.print(e.property,e))},r.MetaProperty=function(e){this.print(e.meta,e),this.token("."),this.print(e.property,e)};var o=n(e("babel-types")),u=n(e("../node"));r.YieldExpression=s("yield"),r.AwaitExpression=s("await");r.BinaryExpression=a,r.LogicalExpression=a},{"../node":86,"babel-types":180}],78:[function(e,t,r){"use strict";function n(e){this.print(e.id,e),this.print(e.typeParameters,e)}function i(){this.space(),this.token("&"),this.space()}function s(e){this.token("<"),this.printList(e.params,e,{}),this.token(">")}function a(){this.space(),this.token("|"),this.space()}r.__esModule=!0,r.TypeParameterDeclaration=r.StringLiteralTypeAnnotation=r.NumericLiteralTypeAnnotation=r.GenericTypeAnnotation=r.ClassImplements=void 0,r.AnyTypeAnnotation=function(){this.word("any")},r.ArrayTypeAnnotation=function(e){this.print(e.elementType,e),this.token("["),this.token("]")},r.BooleanTypeAnnotation=function(){this.word("boolean")},r.BooleanLiteralTypeAnnotation=function(e){this.word(e.value?"true":"false")},r.NullLiteralTypeAnnotation=function(){this.word("null")},r.DeclareClass=function(e,t){u.isDeclareExportDeclaration(t)||(this.word("declare"),this.space()),this.word("class"),this.space(),this._interfaceish(e)},r.DeclareFunction=function(e,t){u.isDeclareExportDeclaration(t)||(this.word("declare"),this.space()),this.word("function"),this.space(),this.print(e.id,e),this.print(e.id.typeAnnotation.typeAnnotation,e),this.semicolon()},r.DeclareInterface=function(e){this.word("declare"),this.space(),this.InterfaceDeclaration(e)},r.DeclareModule=function(e){this.word("declare"),this.space(),this.word("module"),this.space(),this.print(e.id,e),this.space(),this.print(e.body,e)},r.DeclareModuleExports=function(e){this.word("declare"),this.space(),this.word("module"),this.token("."),this.word("exports"),this.print(e.typeAnnotation,e)},r.DeclareTypeAlias=function(e){this.word("declare"),this.space(),this.TypeAlias(e)},r.DeclareOpaqueType=function(e,t){u.isDeclareExportDeclaration(t)||(this.word("declare"),this.space()),this.OpaqueType(e)},r.DeclareVariable=function(e,t){u.isDeclareExportDeclaration(t)||(this.word("declare"),this.space()),this.word("var"),this.space(),this.print(e.id,e),this.print(e.id.typeAnnotation,e),this.semicolon()},r.DeclareExportDeclaration=function(e){this.word("declare"),this.space(),this.word("export"),this.space(),e.default&&(this.word("default"),this.space()),function(e){if(e.declaration){var t=e.declaration;this.print(t,e),u.isStatement(t)||this.semicolon()}else this.token("{"),e.specifiers.length&&(this.space(),this.printList(e.specifiers,e),this.space()),this.token("}"),e.source&&(this.space(),this.word("from"),this.space(),this.print(e.source,e)),this.semicolon()}.apply(this,arguments)},r.ExistentialTypeParam=function(){this.token("*")},r.FunctionTypeAnnotation=function(e,t){this.print(e.typeParameters,e),this.token("("),this.printList(e.params,e),e.rest&&(e.params.length&&(this.token(","),this.space()),this.token("..."),this.print(e.rest,e)),this.token(")"),"ObjectTypeCallProperty"===t.type||"DeclareFunction"===t.type?this.token(":"):(this.space(),this.token("=>")),this.space(),this.print(e.returnType,e)},r.FunctionTypeParam=function(e){this.print(e.name,e),e.optional&&this.token("?"),this.token(":"),this.space(),this.print(e.typeAnnotation,e)},r.InterfaceExtends=n,r._interfaceish=function(e){this.print(e.id,e),this.print(e.typeParameters,e),e.extends.length&&(this.space(),this.word("extends"),this.space(),this.printList(e.extends,e)),e.mixins&&e.mixins.length&&(this.space(),this.word("mixins"),this.space(),this.printList(e.mixins,e)),this.space(),this.print(e.body,e)},r._variance=function(e){"plus"===e.variance?this.token("+"):"minus"===e.variance&&this.token("-")},r.InterfaceDeclaration=function(e){this.word("interface"),this.space(),this._interfaceish(e)},r.IntersectionTypeAnnotation=function(e){this.printJoin(e.types,e,{separator:i})},r.MixedTypeAnnotation=function(){this.word("mixed")},r.EmptyTypeAnnotation=function(){this.word("empty")},r.NullableTypeAnnotation=function(e){this.token("?"),this.print(e.typeAnnotation,e)};var o=e("./types");Object.defineProperty(r,"NumericLiteralTypeAnnotation",{enumerable:!0,get:function(){return o.NumericLiteral}}),Object.defineProperty(r,"StringLiteralTypeAnnotation",{enumerable:!0,get:function(){return o.StringLiteral}}),r.NumberTypeAnnotation=function(){this.word("number")},r.StringTypeAnnotation=function(){this.word("string")},r.ThisTypeAnnotation=function(){this.word("this")},r.TupleTypeAnnotation=function(e){this.token("["),this.printList(e.types,e),this.token("]")},r.TypeofTypeAnnotation=function(e){this.word("typeof"),this.space(),this.print(e.argument,e)},r.TypeAlias=function(e){this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),this.space(),this.token("="),this.space(),this.print(e.right,e),this.semicolon()},r.OpaqueType=function(e){this.word("opaque"),this.space(),this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),e.supertype&&(this.token(":"),this.space(),this.print(e.supertype,e)),e.impltype&&(this.space(),this.token("="),this.space(),this.print(e.impltype,e)),this.semicolon()},r.TypeAnnotation=function(e){this.token(":"),this.space(),e.optional&&this.token("?"),this.print(e.typeAnnotation,e)},r.TypeParameter=function(e){this._variance(e),this.word(e.name),e.bound&&this.print(e.bound,e),e.default&&(this.space(),this.token("="),this.space(),this.print(e.default,e))},r.TypeParameterInstantiation=s,r.ObjectTypeAnnotation=function(e){var t=this;e.exact?this.token("{|"):this.token("{");var r=e.properties.concat(e.callProperties,e.indexers);r.length&&(this.space(),this.printJoin(r,e,{addNewlines:function(e){if(e&&!r[0])return 1},indent:!0,statement:!0,iterator:function(){1!==r.length&&(t.format.flowCommaSeparator?t.token(","):t.semicolon(),t.space())}}),this.space()),e.exact?this.token("|}"):this.token("}")},r.ObjectTypeCallProperty=function(e){e.static&&(this.word("static"),this.space()),this.print(e.value,e)},r.ObjectTypeIndexer=function(e){e.static&&(this.word("static"),this.space()),this._variance(e),this.token("["),this.print(e.id,e),this.token(":"),this.space(),this.print(e.key,e),this.token("]"),this.token(":"),this.space(),this.print(e.value,e)},r.ObjectTypeProperty=function(e){e.static&&(this.word("static"),this.space()),this._variance(e),this.print(e.key,e),e.optional&&this.token("?"),this.token(":"),this.space(),this.print(e.value,e)},r.ObjectTypeSpreadProperty=function(e){this.token("..."),this.print(e.argument,e)},r.QualifiedTypeIdentifier=function(e){this.print(e.qualification,e),this.token("."),this.print(e.id,e)},r.UnionTypeAnnotation=function(e){this.printJoin(e.types,e,{separator:a})},r.TypeCastExpression=function(e){this.token("("),this.print(e.expression,e),this.print(e.typeAnnotation,e),this.token(")")},r.VoidTypeAnnotation=function(){this.word("void")};var u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.ClassImplements=n,r.GenericTypeAnnotation=n,r.TypeParameterDeclaration=s},{"./types":84,"babel-types":180}],79:[function(e,t,r){"use strict";function n(){this.space()}r.__esModule=!0;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.JSXAttribute=function(e){this.print(e.name,e),e.value&&(this.token("="),this.print(e.value,e))},r.JSXIdentifier=function(e){this.word(e.name)},r.JSXNamespacedName=function(e){this.print(e.namespace,e),this.token(":"),this.print(e.name,e)},r.JSXMemberExpression=function(e){this.print(e.object,e),this.token("."),this.print(e.property,e)},r.JSXSpreadAttribute=function(e){this.token("{"),this.token("..."),this.print(e.argument,e),this.token("}")},r.JSXExpressionContainer=function(e){this.token("{"),this.print(e.expression,e),this.token("}")},r.JSXSpreadChild=function(e){this.token("{"),this.token("..."),this.print(e.expression,e),this.token("}")},r.JSXText=function(e){this.token(e.value)},r.JSXElement=function(e){var t=e.openingElement;if(this.print(t,e),!t.selfClosing){this.indent();var r=e.children,n=Array.isArray(r),s=0;for(r=n?r:(0,i.default)(r);;){var a;if(n){if(s>=r.length)break;a=r[s++]}else{if((s=r.next()).done)break;a=s.value}var o=a;this.print(o,e)}this.dedent(),this.print(e.closingElement,e)}},r.JSXOpeningElement=function(e){this.token("<"),this.print(e.name,e),e.attributes.length>0&&(this.space(),this.printJoin(e.attributes,e,{separator:n})),e.selfClosing?(this.space(),this.token("/>")):this.token(">")},r.JSXClosingElement=function(e){this.token("</"),this.print(e.name,e),this.token(">")},r.JSXEmptyExpression=function(){}},{"babel-runtime/core-js/get-iterator":120}],80:[function(e,t,r){"use strict";function n(e){e.async&&(this.word("async"),this.space()),this.word("function"),e.generator&&this.token("*"),e.id?(this.space(),this.print(e.id,e)):this.space(),this._params(e),this.space(),this.print(e.body,e)}r.__esModule=!0,r.FunctionDeclaration=void 0,r._params=function(e){var t=this;this.print(e.typeParameters,e),this.token("("),this.printList(e.params,e,{iterator:function(e){e.optional&&t.token("?"),t.print(e.typeAnnotation,e)}}),this.token(")"),e.returnType&&this.print(e.returnType,e)},r._method=function(e){var t=e.kind,r=e.key;"method"!==t&&"init"!==t||e.generator&&this.token("*"),"get"!==t&&"set"!==t||(this.word(t),this.space()),e.async&&(this.word("async"),this.space()),e.computed?(this.token("["),this.print(r,e),this.token("]")):this.print(r,e),this._params(e),this.space(),this.print(e.body,e)},r.FunctionExpression=n,r.ArrowFunctionExpression=function(e){e.async&&(this.word("async"),this.space());var t=e.params[0];1===e.params.length&&i.isIdentifier(t)&&!function(e,t){return e.typeParameters||e.returnType||t.typeAnnotation||t.optional||t.trailingComments}(e,t)?this.print(t,e):this._params(e),this.space(),this.token("=>"),this.space(),this.print(e.body,e)};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.FunctionDeclaration=n},{"babel-types":180}],81:[function(e,t,r){"use strict";function n(e){if(e.declaration){var t=e.declaration;this.print(t,e),i.isStatement(t)||this.semicolon()}else{"type"===e.exportKind&&(this.word("type"),this.space());for(var r=e.specifiers.slice(0),n=!1;;){var s=r[0];if(!i.isExportDefaultSpecifier(s)&&!i.isExportNamespaceSpecifier(s))break;n=!0,this.print(r.shift(),e),r.length&&(this.token(","),this.space())}(r.length||!r.length&&!n)&&(this.token("{"),r.length&&(this.space(),this.printList(r,e),this.space()),this.token("}")),e.source&&(this.space(),this.word("from"),this.space(),this.print(e.source,e)),this.semicolon()}}r.__esModule=!0,r.ImportSpecifier=function(e){"type"!==e.importKind&&"typeof"!==e.importKind||(this.word(e.importKind),this.space()),this.print(e.imported,e),e.local&&e.local.name!==e.imported.name&&(this.space(),this.word("as"),this.space(),this.print(e.local,e))},r.ImportDefaultSpecifier=function(e){this.print(e.local,e)},r.ExportDefaultSpecifier=function(e){this.print(e.exported,e)},r.ExportSpecifier=function(e){this.print(e.local,e),e.exported&&e.local.name!==e.exported.name&&(this.space(),this.word("as"),this.space(),this.print(e.exported,e))},r.ExportNamespaceSpecifier=function(e){this.token("*"),this.space(),this.word("as"),this.space(),this.print(e.exported,e)},r.ExportAllDeclaration=function(e){this.word("export"),this.space(),this.token("*"),this.space(),this.word("from"),this.space(),this.print(e.source,e),this.semicolon()},r.ExportNamedDeclaration=function(){this.word("export"),this.space(),n.apply(this,arguments)},r.ExportDefaultDeclaration=function(){this.word("export"),this.space(),this.word("default"),this.space(),n.apply(this,arguments)},r.ImportDeclaration=function(e){this.word("import"),this.space(),"type"!==e.importKind&&"typeof"!==e.importKind||(this.word(e.importKind),this.space());var t=e.specifiers.slice(0);if(t&&t.length){for(;;){var r=t[0];if(!i.isImportDefaultSpecifier(r)&&!i.isImportNamespaceSpecifier(r))break;this.print(t.shift(),e),t.length&&(this.token(","),this.space())}t.length&&(this.token("{"),this.space(),this.printList(t,e),this.space(),this.token("}")),this.space(),this.word("from"),this.space()}this.print(e.source,e),this.semicolon()},r.ImportNamespaceSpecifier=function(e){this.token("*"),this.space(),this.word("as"),this.space(),this.print(e.local,e)};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))},{"babel-types":180}],82:[function(e,t,r){"use strict";function n(e){return u.isStatement(e.body)?n(e.body):e}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"label";return function(r){this.word(e);var n=r[t];if(n){this.space();var i=this.startTerminatorless();this.print(n,r),this.endTerminatorless(i)}this.semicolon()}}function s(){if(this.token(","),this.newline(),this.endsWith("\n"))for(var e=0;e<4;e++)this.space(!0)}function a(){if(this.token(","),this.newline(),this.endsWith("\n"))for(var e=0;e<6;e++)this.space(!0)}r.__esModule=!0,r.ThrowStatement=r.BreakStatement=r.ReturnStatement=r.ContinueStatement=r.ForAwaitStatement=r.ForOfStatement=r.ForInStatement=void 0;var o=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.WithStatement=function(e){this.word("with"),this.space(),this.token("("),this.print(e.object,e),this.token(")"),this.printBlock(e)},r.IfStatement=function(e){this.word("if"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.space();var t=e.alternate&&u.isIfStatement(n(e.consequent));t&&(this.token("{"),this.newline(),this.indent()),this.printAndIndentOnComments(e.consequent,e),t&&(this.dedent(),this.newline(),this.token("}")),e.alternate&&(this.endsWith("}")&&this.space(),this.word("else"),this.space(),this.printAndIndentOnComments(e.alternate,e))},r.ForStatement=function(e){this.word("for"),this.space(),this.token("("),this.inForStatementInitCounter++,this.print(e.init,e),this.inForStatementInitCounter--,this.token(";"),e.test&&(this.space(),this.print(e.test,e)),this.token(";"),e.update&&(this.space(),this.print(e.update,e)),this.token(")"),this.printBlock(e)},r.WhileStatement=function(e){this.word("while"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.printBlock(e)},r.DoWhileStatement=function(e){this.word("do"),this.space(),this.print(e.body,e),this.space(),this.word("while"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.semicolon()},r.LabeledStatement=function(e){this.print(e.label,e),this.token(":"),this.space(),this.print(e.body,e)},r.TryStatement=function(e){this.word("try"),this.space(),this.print(e.block,e),this.space(),e.handlers?this.print(e.handlers[0],e):this.print(e.handler,e),e.finalizer&&(this.space(),this.word("finally"),this.space(),this.print(e.finalizer,e))},r.CatchClause=function(e){this.word("catch"),this.space(),this.token("("),this.print(e.param,e),this.token(")"),this.space(),this.print(e.body,e)},r.SwitchStatement=function(e){this.word("switch"),this.space(),this.token("("),this.print(e.discriminant,e),this.token(")"),this.space(),this.token("{"),this.printSequence(e.cases,e,{indent:!0,addNewlines:function(t,r){if(!t&&e.cases[e.cases.length-1]===r)return-1}}),this.token("}")},r.SwitchCase=function(e){e.test?(this.word("case"),this.space(),this.print(e.test,e),this.token(":")):(this.word("default"),this.token(":")),e.consequent.length&&(this.newline(),this.printSequence(e.consequent,e,{indent:!0}))},r.DebuggerStatement=function(){this.word("debugger"),this.semicolon()},r.VariableDeclaration=function(e,t){this.word(e.kind),this.space();var r=!1;if(!u.isFor(t)){var n=e.declarations,i=Array.isArray(n),l=0;for(n=i?n:(0,o.default)(n);;){var c;if(i){if(l>=n.length)break;c=n[l++]}else{if((l=n.next()).done)break;c=l.value}c.init&&(r=!0)}}var p=void 0;r&&(p="const"===e.kind?a:s),this.printList(e.declarations,e,{separator:p}),(!u.isFor(t)||t.left!==e&&t.init!==e)&&this.semicolon()},r.VariableDeclarator=function(e){this.print(e.id,e),this.print(e.id.typeAnnotation,e),e.init&&(this.space(),this.token("="),this.space(),this.print(e.init,e))};var u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),l=function(e){return function(t){this.word("for"),this.space(),"await"===e&&(this.word("await"),this.space()),this.token("("),this.print(t.left,t),this.space(),this.word("await"===e?"of":e),this.space(),this.print(t.right,t),this.token(")"),this.printBlock(t)}};r.ForInStatement=l("in"),r.ForOfStatement=l("of"),r.ForAwaitStatement=l("await"),r.ContinueStatement=i("continue"),r.ReturnStatement=i("return","argument"),r.BreakStatement=i("break"),r.ThrowStatement=i("throw","argument")},{"babel-runtime/core-js/get-iterator":120,"babel-types":180}],83:[function(e,t,r){"use strict";r.__esModule=!0,r.TaggedTemplateExpression=function(e){this.print(e.tag,e),this.print(e.quasi,e)},r.TemplateElement=function(e,t){var r=t.quasis[0]===e,n=t.quasis[t.quasis.length-1]===e,i=(r?"`":"}")+e.value.raw+(n?"`":"${");this.token(i)},r.TemplateLiteral=function(e){for(var t=e.quasis,r=0;r<t.length;r++)this.print(t[r],e),r+1<t.length&&this.print(e.expressions[r],e)}},{}],84:[function(e,t,r){"use strict";function n(e){this.token("..."),this.print(e.argument,e)}function i(e){var t=e.properties;this.token("{"),this.printInnerComments(e),t.length&&(this.space(),this.printList(t,e,{indent:!0,statement:!0}),this.space()),this.token("}")}function s(e){var t=e.elements,r=t.length;this.token("["),this.printInnerComments(e);for(var n=0;n<t.length;n++){var i=t[n];i?(n>0&&this.space(),this.print(i,e),n<r-1&&this.token(",")):this.token(",")}this.token("]")}r.__esModule=!0,r.ArrayPattern=r.ObjectPattern=r.RestProperty=r.SpreadProperty=r.SpreadElement=void 0,r.Identifier=function(e){e.variance&&("plus"===e.variance?this.token("+"):"minus"===e.variance&&this.token("-")),this.word(e.name)},r.RestElement=n,r.ObjectExpression=i,r.ObjectMethod=function(e){this.printJoin(e.decorators,e),this._method(e)},r.ObjectProperty=function(e){if(this.printJoin(e.decorators,e),e.computed)this.token("["),this.print(e.key,e),this.token("]");else{if(a.isAssignmentPattern(e.value)&&a.isIdentifier(e.key)&&e.key.name===e.value.left.name)return void this.print(e.value,e);if(this.print(e.key,e),e.shorthand&&a.isIdentifier(e.key)&&a.isIdentifier(e.value)&&e.key.name===e.value.name)return}this.token(":"),this.space(),this.print(e.value,e)},r.ArrayExpression=s,r.RegExpLiteral=function(e){this.word("/"+e.pattern+"/"+e.flags)},r.BooleanLiteral=function(e){this.word(e.value?"true":"false")},r.NullLiteral=function(){this.word("null")},r.NumericLiteral=function(e){var t=this.getPossibleRaw(e),r=e.value+"";null==t?this.number(r):this.format.minified?this.number(t.length<r.length?t:r):this.number(t)},r.StringLiteral=function(e,t){var r=this.getPossibleRaw(e);if(this.format.minified||null==r){var n={quotes:a.isJSX(t)?"double":this.format.quotes,wrap:!0};this.format.jsonCompatibleStrings&&(n.json=!0);var i=(0,o.default)(e.value,n);return this.token(i)}this.token(r)};var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),o=function(e){return e&&e.__esModule?e:{default:e}}(e("jsesc"));r.SpreadElement=n,r.SpreadProperty=n,r.RestProperty=n,r.ObjectPattern=i,r.ArrayPattern=s},{"babel-types":180,jsesc:323}],85:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.CodeGenerator=void 0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("babel-runtime/helpers/possibleConstructorReturn")),a=n(e("babel-runtime/helpers/inherits"));r.default=function(e,t,r){return new c(e,t,r).generate()};var o=n(e("detect-indent")),u=n(e("./source-map")),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-messages")),c=function(e){function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments[2];(0,i.default)(this,t);var c=r.tokens||[],p=function(e,t,r){var n=" ";if(e&&"string"==typeof e){var i=(0,o.default)(e).indent;i&&" "!==i&&(n=i)}var s={auxiliaryCommentBefore:t.auxiliaryCommentBefore,auxiliaryCommentAfter:t.auxiliaryCommentAfter,shouldPrintComment:t.shouldPrintComment,retainLines:t.retainLines,retainFunctionParens:t.retainFunctionParens,comments:null==t.comments||t.comments,compact:t.compact,minified:t.minified,concise:t.concise,quotes:t.quotes||function(e,t){if(!e)return"double";for(var r={single:0,double:0},n=0,i=0;i<t.length;i++){var s=t[i];if("string"===s.type.label){var a=e.slice(s.start,s.end);if("'"===a[0]?r.single++:r.double++,++n>=3)break}}return r.single>r.double?"single":"double"}(e,r),jsonCompatibleStrings:t.jsonCompatibleStrings,indent:{adjustMultilineComment:!0,style:n,base:0},flowCommaSeparator:t.flowCommaSeparator};return s.minified?(s.compact=!0,s.shouldPrintComment=s.shouldPrintComment||function(){return s.comments}):s.shouldPrintComment=s.shouldPrintComment||function(e){return s.comments||e.indexOf("@license")>=0||e.indexOf("@preserve")>=0},"auto"===s.compact&&(s.compact=e.length>5e5,s.compact&&console.error("[BABEL] "+l.get("codeGeneratorDeopt",t.filename,"500KB"))),s.compact&&(s.indent.adjustMultilineComment=!1),s}(a,n,c),h=n.sourceMaps?new u.default(n,a):null,f=(0,s.default)(this,e.call(this,p,h,c));return f.ast=r,f}return(0,a.default)(t,e),t.prototype.generate=function(){return e.prototype.generate.call(this,this.ast)},t}(n(e("./printer")).default);r.CodeGenerator=function(){function e(t,r,n){(0,i.default)(this,e),this._generator=new c(t,r,n)}return e.prototype.generate=function(){return this._generator.generate()},e}()},{"./printer":89,"./source-map":90,"babel-messages":110,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137,"detect-indent":311}],86:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){function t(e,t){var n=r[e];r[e]=n?function(e,r,i){var s=n(e,r,i);return null==s?t(e,r,i):s}:t}var r={},n=(0,c.default)(e),i=Array.isArray(n),s=0;for(n=i?n:(0,l.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a,u=f.FLIPPED_ALIAS_KEYS[o];if(u){var p=u,h=Array.isArray(p),d=0;for(p=h?p:(0,l.default)(p);;){var m;if(h){if(d>=p.length)break;m=p[d++]}else{if((d=p.next()).done)break;m=d.value}t(m,e[o])}}else t(o,e[o])}return r}function a(e,t,r,n){var i=e[t.type];return i?i(t,r,n):null}function o(e){return!!f.isCallExpression(e)||!!f.isMemberExpression(e)&&(o(e.object)||!e.computed&&o(e.property))}function u(e,t,r){if(!e)return 0;f.isExpressionStatement(e)&&(e=e.expression);var n=a(m,e,t);if(!n){var i=a(y,e,t);if(i)for(var s=0;s<i.length&&!(n=u(i[s],e,r));s++);}return n&&n[r]||0}r.__esModule=!0;var l=i(e("babel-runtime/core-js/get-iterator")),c=i(e("babel-runtime/core-js/object/keys"));r.needsWhitespace=u,r.needsWhitespaceBefore=function(e,t){return u(e,t,"before")},r.needsWhitespaceAfter=function(e,t){return u(e,t,"after")},r.needsParens=function(e,t,r){return!!t&&(!(!f.isNewExpression(t)||t.callee!==e||!o(e))||a(d,e,t,r))};var p=i(e("./whitespace")),h=n(e("./parentheses")),f=n(e("babel-types")),d=s(h),m=s(p.default.nodes),y=s(p.default.list)},{"./parentheses":87,"./whitespace":88,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/object/keys":127,"babel-types":180}],87:[function(e,t,r){"use strict";function n(e,t){return u.isArrayTypeAnnotation(t)}function i(e,t){return u.isBinary(t)||u.isUnaryLike(t)||u.isCallExpression(t)||u.isMemberExpression(t)||u.isNewExpression(t)||u.isConditionalExpression(t)&&e===t.test}function s(e,t){return u.isMemberExpression(t,{object:e})||u.isCallExpression(t,{callee:e})||u.isNewExpression(t,{callee:e})}function a(e,t){return!!(u.isUnaryLike(t)||u.isBinary(t)||u.isConditionalExpression(t,{test:e})||u.isAwaitExpression(t))||s(e,t)}function o(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.considerArrow,n=void 0!==r&&r,i=t.considerDefaultExports,s=void 0!==i&&i,a=e.length-1,o=e[a],l=e[--a];a>0;){if(u.isExpressionStatement(l,{expression:o})||u.isTaggedTemplateExpression(l)||s&&u.isExportDefaultDeclaration(l,{declaration:o})||n&&u.isArrowFunctionExpression(l,{body:o}))return!0;if(!(u.isCallExpression(l,{callee:o})||u.isSequenceExpression(l)&&l.expressions[0]===o||u.isMemberExpression(l,{object:o})||u.isConditional(l,{test:o})||u.isBinary(l,{left:o})||u.isAssignmentExpression(l,{left:o})))return!1;o=l,l=e[--a]}return!1}r.__esModule=!0,r.AwaitExpression=r.FunctionTypeAnnotation=void 0,r.NullableTypeAnnotation=n,r.UpdateExpression=function(e,t){return u.isMemberExpression(t)&&t.object===e},r.ObjectExpression=function(e,t,r){return o(r,{considerArrow:!0})},r.DoExpression=function(e,t,r){return o(r)},r.Binary=function(e,t){if((u.isCallExpression(t)||u.isNewExpression(t))&&t.callee===e||u.isUnaryLike(t)||u.isMemberExpression(t)&&t.object===e||u.isAwaitExpression(t))return!0;if(u.isBinary(t)){var r=t.operator,n=l[r],i=e.operator,s=l[i];if(n===s&&t.right===e&&!u.isLogicalExpression(t)||n>s)return!0}return!1},r.BinaryExpression=function(e,t){return"in"===e.operator&&(u.isVariableDeclarator(t)||u.isFor(t))},r.SequenceExpression=function(e,t){return!(u.isForStatement(t)||u.isThrowStatement(t)||u.isReturnStatement(t)||u.isIfStatement(t)&&t.test===e||u.isWhileStatement(t)&&t.test===e||u.isForInStatement(t)&&t.right===e||u.isSwitchStatement(t)&&t.discriminant===e||u.isExpressionStatement(t)&&t.expression===e)},r.YieldExpression=i,r.ClassExpression=function(e,t,r){return o(r,{considerDefaultExports:!0})},r.UnaryLike=s,r.FunctionExpression=function(e,t,r){return o(r,{considerDefaultExports:!0})},r.ArrowFunctionExpression=function(e,t){return!!(u.isExportDeclaration(t)||u.isBinaryExpression(t)||u.isLogicalExpression(t)||u.isUnaryExpression(t)||u.isTaggedTemplateExpression(t))||s(e,t)},r.ConditionalExpression=a,r.AssignmentExpression=function(e){return!!u.isObjectPattern(e.left)||a.apply(void 0,arguments)};var u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),l={"||":0,"&&":1,"|":2,"^":3,"&":4,"==":5,"===":5,"!=":5,"!==":5,"<":6,">":6,"<=":6,">=":6,in:6,instanceof:6,">>":7,"<<":7,">>>":7,"+":8,"-":8,"*":9,"/":9,"%":9,"**":10};r.FunctionTypeAnnotation=n,r.AwaitExpression=i},{"babel-types":180}],88:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o.isMemberExpression(e)?(n(e.object,t),e.computed&&n(e.property,t)):o.isBinary(e)||o.isAssignmentExpression(e)?(n(e.left,t),n(e.right,t)):o.isCallExpression(e)?(t.hasCall=!0,n(e.callee,t)):o.isFunction(e)?t.hasFunction=!0:o.isIdentifier(e)&&(t.hasHelper=t.hasHelper||i(e.callee)),t}function i(e){return o.isMemberExpression(e)?i(e.object)||i(e.property):o.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:o.isCallExpression(e)?i(e.callee):!(!o.isBinary(e)&&!o.isAssignmentExpression(e))&&(o.isIdentifier(e.left)&&i(e.left)||i(e.right))}function s(e){return o.isLiteral(e)||o.isObjectExpression(e)||o.isArrayExpression(e)||o.isIdentifier(e)||o.isMemberExpression(e)}var a=function(e){return e&&e.__esModule?e:{default:e}}(e("lodash/map")),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.nodes={AssignmentExpression:function(e){var t=n(e.right);if(t.hasCall&&t.hasHelper||t.hasFunction)return{before:t.hasFunction,after:!0}},SwitchCase:function(e,t){return{before:e.consequent.length||t.cases[0]===e}},LogicalExpression:function(e){if(o.isFunction(e.left)||o.isFunction(e.right))return{after:!0}},Literal:function(e){if("use strict"===e.value)return{after:!0}},CallExpression:function(e){if(o.isFunction(e.callee)||i(e))return{before:!0,after:!0}},VariableDeclaration:function(e){for(var t=0;t<e.declarations.length;t++){var r=e.declarations[t],a=i(r.id)&&!s(r.init);if(!a){var o=n(r.init);a=i(r.init)&&o.hasCall||o.hasFunction}if(a)return{before:!0,after:!0}}},IfStatement:function(e){if(o.isBlockStatement(e.consequent))return{before:!0,after:!0}}},r.nodes.ObjectProperty=r.nodes.ObjectTypeProperty=r.nodes.ObjectMethod=r.nodes.SpreadProperty=function(e,t){if(t.properties[0]===e)return{before:!0}},r.list={VariableDeclaration:function(e){return(0,a.default)(e.declarations,"init")},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties}},[["Function",!0],["Class",!0],["Loop",!0],["LabeledStatement",!0],["SwitchStatement",!0],["TryStatement",!0]].forEach(function(e){var t=e[0],n=e[1];"boolean"==typeof n&&(n={after:n,before:n}),[t].concat(o.FLIPPED_ALIAS_KEYS[t]||[]).forEach(function(e){r.nodes[e]=function(){return n}})})},{"babel-types":180,"lodash/map":525}],89:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(){this.token(","),this.space()}r.__esModule=!0;var a=i(e("babel-runtime/core-js/object/assign")),o=i(e("babel-runtime/core-js/get-iterator")),u=i(e("babel-runtime/core-js/json/stringify")),l=i(e("babel-runtime/core-js/weak-set")),c=i(e("babel-runtime/helpers/classCallCheck")),p=i(e("lodash/find")),h=i(e("lodash/findLast")),f=i(e("lodash/isInteger")),d=i(e("lodash/repeat")),m=i(e("./buffer")),y=n(e("./node")),g=i(e("./whitespace")),b=n(e("babel-types")),v=/e/i,x=/\.0+$/,E=/^0[box]/,A=function(){function e(t,r,n){(0,c.default)(this,e),this.inForStatementInitCounter=0,this._printStack=[],this._indent=0,this._insideAux=!1,this._printedCommentStarts={},this._parenPushNewlineState=null,this._printAuxAfterOnNextUserNode=!1,this._printedComments=new l.default,this._endsWithInteger=!1,this._endsWithWord=!1,this.format=t||{},this._buf=new m.default(r),this._whitespace=n.length>0?new g.default(n):null}return e.prototype.generate=function(e){return this.print(e),this._maybeAddAuxComment(),this._buf.get()},e.prototype.indent=function(){this.format.compact||this.format.concise||this._indent++},e.prototype.dedent=function(){this.format.compact||this.format.concise||this._indent--},e.prototype.semicolon=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._maybeAddAuxComment(),this._append(";",!e)},e.prototype.rightBrace=function(){this.format.minified&&this._buf.removeLastSemicolon(),this.token("}")},e.prototype.space=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.format.compact||(this._buf.hasContent()&&!this.endsWith(" ")&&!this.endsWith("\n")||e)&&this._space()},e.prototype.word=function(e){this._endsWithWord&&this._space(),this._maybeAddAuxComment(),this._append(e),this._endsWithWord=!0},e.prototype.number=function(e){this.word(e),this._endsWithInteger=(0,f.default)(+e)&&!E.test(e)&&!v.test(e)&&!x.test(e)&&"."!==e[e.length-1]},e.prototype.token=function(e){("--"===e&&this.endsWith("!")||"+"===e[0]&&this.endsWith("+")||"-"===e[0]&&this.endsWith("-")||"."===e[0]&&this._endsWithInteger)&&this._space(),this._maybeAddAuxComment(),this._append(e)},e.prototype.newline=function(e){if(!this.format.retainLines&&!this.format.compact)if(this.format.concise)this.space();else if(!(this.endsWith("\n\n")||("number"!=typeof e&&(e=1),e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,e<=0)))for(var t=0;t<e;t++)this._newline()},e.prototype.endsWith=function(e){return this._buf.endsWith(e)},e.prototype.removeTrailingNewline=function(){this._buf.removeTrailingNewline()},e.prototype.source=function(e,t){this._catchUp(e,t),this._buf.source(e,t)},e.prototype.withSource=function(e,t,r){this._catchUp(e,t),this._buf.withSource(e,t,r)},e.prototype._space=function(){this._append(" ",!0)},e.prototype._newline=function(){this._append("\n",!0)},e.prototype._append=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._maybeAddParen(e),this._maybeIndent(e),t?this._buf.queue(e):this._buf.append(e),this._endsWithWord=!1,this._endsWithInteger=!1},e.prototype._maybeIndent=function(e){this._indent&&this.endsWith("\n")&&"\n"!==e[0]&&this._buf.queue(this._getIndent())},e.prototype._maybeAddParen=function(e){var t=this._parenPushNewlineState;if(t){this._parenPushNewlineState=null;var r=void 0;for(r=0;r<e.length&&" "===e[r];r++);if(r!==e.length){var n=e[r];"\n"!==n&&"/"!==n||(this.token("("),this.indent(),t.printed=!0)}}},e.prototype._catchUp=function(e,t){if(this.format.retainLines){var r=t?t[e]:null;if(r&&null!==r.line)for(var n=r.line-this._buf.getCurrentLine(),i=0;i<n;i++)this._newline()}},e.prototype._getIndent=function(){return(0,d.default)(this.format.indent.style,this._indent)},e.prototype.startTerminatorless=function(){return this._parenPushNewlineState={printed:!1}},e.prototype.endTerminatorless=function(e){e.printed&&(this.dedent(),this.newline(),this.token(")"))},e.prototype.print=function(e,t){var r=this;if(e){var n=this.format.concise;e._compact&&(this.format.concise=!0);if(!this[e.type])throw new ReferenceError("unknown node of type "+(0,u.default)(e.type)+" with constructor "+(0,u.default)(e&&e.constructor.name));this._printStack.push(e);var i=this._insideAux;this._insideAux=!e.loc,this._maybeAddAuxComment(this._insideAux&&!i);var s=y.needsParens(e,t,this._printStack);this.format.retainFunctionParens&&"FunctionExpression"===e.type&&e.extra&&e.extra.parenthesized&&(s=!0),s&&this.token("("),this._printLeadingComments(e,t);var a=b.isProgram(e)||b.isFile(e)?null:e.loc;this.withSource("start",a,function(){r[e.type](e,t)}),this._printTrailingComments(e,t),s&&this.token(")"),this._printStack.pop(),this.format.concise=n,this._insideAux=i}},e.prototype._maybeAddAuxComment=function(e){e&&this._printAuxBeforeComment(),this._insideAux||this._printAuxAfterComment()},e.prototype._printAuxBeforeComment=function(){if(!this._printAuxAfterOnNextUserNode){this._printAuxAfterOnNextUserNode=!0;var e=this.format.auxiliaryCommentBefore;e&&this._printComment({type:"CommentBlock",value:e})}},e.prototype._printAuxAfterComment=function(){if(this._printAuxAfterOnNextUserNode){this._printAuxAfterOnNextUserNode=!1;var e=this.format.auxiliaryCommentAfter;e&&this._printComment({type:"CommentBlock",value:e})}},e.prototype.getPossibleRaw=function(e){var t=e.extra;if(t&&null!=t.raw&&null!=t.rawValue&&e.value===t.rawValue)return t.raw},e.prototype.printJoin=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&e.length){r.indent&&this.indent();for(var n={addNewlines:r.addNewlines},i=0;i<e.length;i++){var s=e[i];s&&(r.statement&&this._printNewline(!0,s,t,n),this.print(s,t),r.iterator&&r.iterator(s,i),r.separator&&i<e.length-1&&r.separator.call(this),r.statement&&this._printNewline(!1,s,t,n))}r.indent&&this.dedent()}},e.prototype.printAndIndentOnComments=function(e,t){var r=!!e.leadingComments;r&&this.indent(),this.print(e,t),r&&this.dedent()},e.prototype.printBlock=function(e){var t=e.body;b.isEmptyStatement(t)||this.space(),this.print(t,e)},e.prototype._printTrailingComments=function(e,t){this._printComments(this._getComments(!1,e,t))},e.prototype._printLeadingComments=function(e,t){this._printComments(this._getComments(!0,e,t))},e.prototype.printInnerComments=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.innerComments&&(t&&this.indent(),this._printComments(e.innerComments),t&&this.dedent())},e.prototype.printSequence=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.statement=!0,this.printJoin(e,t,r)},e.prototype.printList=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return null==r.separator&&(r.separator=s),this.printJoin(e,t,r)},e.prototype._printNewline=function(e,t,r,n){var i=this;if(!this.format.retainLines&&!this.format.compact)if(this.format.concise)this.space();else{var s=0;if(null!=t.start&&!t._ignoreUserWhitespace&&this._whitespace)if(e){var a=t.leadingComments,o=a&&(0,p.default)(a,function(e){return!!e.loc&&i.format.shouldPrintComment(e.value)});s=this._whitespace.getNewlinesBefore(o||t)}else{var u=t.trailingComments,l=u&&(0,h.default)(u,function(e){return!!e.loc&&i.format.shouldPrintComment(e.value)});s=this._whitespace.getNewlinesAfter(l||t)}else{e||s++,n.addNewlines&&(s+=n.addNewlines(e,t)||0);var c=y.needsWhitespaceAfter;e&&(c=y.needsWhitespaceBefore),c(t,r)&&s++,this._buf.hasContent()||(s=0)}this.newline(s)}},e.prototype._getComments=function(e,t){return t&&(e?t.leadingComments:t.trailingComments)||[]},e.prototype._printComment=function(e){var t=this;if(this.format.shouldPrintComment(e.value)&&!e.ignore&&!this._printedComments.has(e)){if(this._printedComments.add(e),null!=e.start){if(this._printedCommentStarts[e.start])return;this._printedCommentStarts[e.start]=!0}this.newline(this._whitespace?this._whitespace.getNewlinesBefore(e):0),this.endsWith("[")||this.endsWith("{")||this.space();var r="CommentLine"===e.type?"//"+e.value+"\n":"/*"+e.value+"*/";if("CommentBlock"===e.type&&this.format.indent.adjustMultilineComment){var n=e.loc&&e.loc.start.column;if(n){var i=new RegExp("\\n\\s{1,"+n+"}","g");r=r.replace(i,"\n")}var s=Math.max(this._getIndent().length,this._buf.getCurrentColumn());r=r.replace(/\n(?!$)/g,"\n"+(0,d.default)(" ",s))}this.withSource("start",e.loc,function(){t._append(r)}),this.newline((this._whitespace?this._whitespace.getNewlinesAfter(e):0)+("CommentLine"===e.type?-1:0))}},e.prototype._printComments=function(e){if(e&&e.length){var t=e,r=Array.isArray(t),n=0;for(t=r?t:(0,o.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;this._printComment(s)}}},e}();r.default=A;for(var D=[e("./generators/template-literals"),e("./generators/expressions"),e("./generators/statements"),e("./generators/classes"),e("./generators/methods"),e("./generators/modules"),e("./generators/types"),e("./generators/flow"),e("./generators/base"),e("./generators/jsx")],S=0;S<D.length;S++){var C=D[S];(0,a.default)(A.prototype,C)}t.exports=r.default},{"./buffer":74,"./generators/base":75,"./generators/classes":76,"./generators/expressions":77,"./generators/flow":78,"./generators/jsx":79,"./generators/methods":80,"./generators/modules":81,"./generators/statements":82,"./generators/template-literals":83,"./generators/types":84,"./node":86,"./whitespace":91,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/core-js/object/assign":124,"babel-runtime/core-js/weak-set":133,"babel-runtime/helpers/classCallCheck":134,"babel-types":180,"lodash/find":499,"lodash/findLast":501,"lodash/isInteger":514,"lodash/repeat":530}],90:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/object/keys")),s=n(e("babel-runtime/helpers/typeof")),a=n(e("babel-runtime/helpers/classCallCheck")),o=n(e("source-map")),u=function(){function e(t,r){(0,a.default)(this,e),this._cachedMap=null,this._code=r,this._opts=t,this._rawMappings=[]}return e.prototype.get=function(){if(!this._cachedMap){var e=this._cachedMap=new o.default.SourceMapGenerator({file:this._opts.sourceMapTarget,sourceRoot:this._opts.sourceRoot}),t=this._code;"string"==typeof t?e.setSourceContent(this._opts.sourceFileName,t):"object"===(void 0===t?"undefined":(0,s.default)(t))&&(0,i.default)(t).forEach(function(r){e.setSourceContent(r,t[r])}),this._rawMappings.forEach(e.addMapping,e)}return this._cachedMap.toJSON()},e.prototype.getRawMappings=function(){return this._rawMappings.slice()},e.prototype.mark=function(e,t,r,n,i,s){this._lastGenLine!==e&&null===r||this._lastGenLine===e&&this._lastSourceLine===r&&this._lastSourceColumn===n||(this._cachedMap=null,this._lastGenLine=e,this._lastSourceLine=r,this._lastSourceColumn=n,this._rawMappings.push({name:i||void 0,generated:{line:e,column:t},source:null==r?void 0:s||this._opts.sourceFileName,original:null==r?void 0:{line:r,column:n}}))},e}();r.default=u,t.exports=r.default},{"babel-runtime/core-js/object/keys":127,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/typeof":138,"source-map":102}],91:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/helpers/classCallCheck")),i=function(){function e(t){(0,n.default)(this,e),this.tokens=t,this.used={}}return e.prototype.getNewlinesBefore=function(e){var t=void 0,r=void 0,n=this.tokens,i=this._findToken(function(t){return t.start-e.start},0,n.length);if(i>=0){for(;i&&e.start===n[i-1].start;)--i;t=n[i-1],r=n[i]}return this._getNewlinesBetween(t,r)},e.prototype.getNewlinesAfter=function(e){var t=void 0,r=void 0,n=this.tokens,i=this._findToken(function(t){return t.end-e.end},0,n.length);if(i>=0){for(;i&&e.end===n[i-1].end;)--i;t=n[i],","===(r=n[i+1]).type.label&&(r=n[i+2])}return r&&"eof"===r.type.label?1:this._getNewlinesBetween(t,r)},e.prototype._getNewlinesBetween=function(e,t){if(!t||!t.loc)return 0;for(var r=e?e.loc.end.line:1,n=t.loc.start.line,i=0,s=r;s<n;s++)void 0===this.used[s]&&(this.used[s]=!0,i++);return i},e.prototype._findToken=function(e,t,r){if(t>=r)return-1;var n=t+r>>>1,i=e(this.tokens[n]);return i<0?this._findToken(e,n+1,r):i>0?this._findToken(e,t,n):0===i?n:-1},e}();r.default=i,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134}],92:[function(e,t,r){arguments[4][62][0].apply(r,arguments)},{"./util":101,dup:62}],93:[function(e,t,r){arguments[4][63][0].apply(r,arguments)},{"./base64":94,dup:63}],94:[function(e,t,r){arguments[4][64][0].apply(r,arguments)},{dup:64}],95:[function(e,t,r){arguments[4][65][0].apply(r,arguments)},{dup:65}],96:[function(e,t,r){arguments[4][66][0].apply(r,arguments)},{"./util":101,dup:66}],97:[function(e,t,r){arguments[4][67][0].apply(r,arguments)},{dup:67}],98:[function(e,t,r){arguments[4][68][0].apply(r,arguments)},{"./array-set":92,"./base64-vlq":93,"./binary-search":95,"./quick-sort":97,"./util":101,dup:68}],99:[function(e,t,r){arguments[4][69][0].apply(r,arguments)},{"./array-set":92,"./base64-vlq":93,"./mapping-list":96,"./util":101,dup:69}],100:[function(e,t,r){arguments[4][70][0].apply(r,arguments)},{"./source-map-generator":99,"./util":101,dup:70}],101:[function(e,t,r){arguments[4][71][0].apply(r,arguments)},{dup:71}],102:[function(e,t,r){arguments[4][72][0].apply(r,arguments)},{"./lib/source-map-consumer":98,"./lib/source-map-generator":99,"./lib/source-node":100,dup:72}],103:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=u.objectExpression([]);return(0,s.default)(e).forEach(function(r){var n=e[r],i=u.objectExpression([]),a=u.objectProperty(n._key,i,n._computed);(0,s.default)(n).forEach(function(e){var t=n[e];if("_"!==e[0]){var r=t;(u.isClassMethod(t)||u.isClassProperty(t))&&(t=t.value);var s=u.objectProperty(u.identifier(e),t);u.inheritsComments(s,r),u.removeComments(r),i.properties.push(s)}}),t.properties.push(a)}),t}r.__esModule=!0;var s=n(e("babel-runtime/core-js/object/keys"));r.push=function(e,t,r,n,i){var s=u.toKeyAlias(t),l={};if((0,o.default)(e,s)&&(l=e[s]),e[s]=l,l._inherits=l._inherits||[],l._inherits.push(t),l._key=t.key,t.computed&&(l._computed=!0),t.decorators){var c=l.decorators=l.decorators||u.arrayExpression([]);c.elements=c.elements.concat(t.decorators.map(function(e){return e.expression}).reverse())}if(l.value||l.initializer)throw n.buildCodeFrameError(t,"Key conflict with sibling node");var p=void 0,h=void 0;(u.isObjectProperty(t)||u.isObjectMethod(t)||u.isClassMethod(t))&&(p=u.toComputedKey(t,t.key)),u.isObjectProperty(t)||u.isClassProperty(t)?h=t.value:(u.isObjectMethod(t)||u.isClassMethod(t))&&((h=u.functionExpression(null,t.params,t.body,t.generator,t.async)).returnType=t.returnType);var f=function(e){return!u.isClassMethod(e)&&!u.isObjectMethod(e)||"get"!==e.kind&&"set"!==e.kind?"value":e.kind}(t);return r&&"value"===f||(r=f),i&&u.isStringLiteral(p)&&("value"===r||"initializer"===r)&&u.isFunctionExpression(h)&&(h=(0,a.default)({id:p,node:h,scope:i})),h&&(u.inheritsComments(h,t),l[r]=h),l},r.hasComputed=function(e){for(var t in e)if(e[t]._computed)return!0;return!1},r.toComputedObjectFromClass=function(e){for(var t=u.arrayExpression([]),r=0;r<e.properties.length;r++){var n=e.properties[r],i=n.value;i.properties.unshift(u.objectProperty(u.identifier("key"),u.toComputedKey(n))),t.elements.push(i)}return t},r.toClassObject=i,r.toDefineObject=function(e){return(0,s.default)(e).forEach(function(t){var r=e[t];r.value&&(r.writable=u.booleanLiteral(!0)),r.configurable=u.booleanLiteral(!0),r.enumerable=u.booleanLiteral(!0)}),i(e)};var a=n(e("babel-helper-function-name")),o=n(e("lodash/has")),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))},{"babel-helper-function-name":104,"babel-runtime/core-js/object/keys":127,"babel-types":180,"lodash/has":504}],104:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.default=function(e){var t=e.node,r=e.parent,n=e.scope,s=e.id;if(!t.id){if(!a.isObjectProperty(r)&&!a.isObjectMethod(r,{kind:"method"})||r.computed&&!a.isLiteral(r.key)){if(a.isVariableDeclarator(r)){if(s=r.id,a.isIdentifier(s)){var c=n.parent.getBinding(s.name);if(c&&c.constant&&n.getBinding(s.name)===c)return t.id=s,void(t.id[a.NOT_LOCAL_BINDING]=!0)}}else if(a.isAssignmentExpression(r))s=r.left;else if(!s)return}else s=r.key;var p=void 0;if(s&&a.isLiteral(s))p=s.value;else{if(!s||!a.isIdentifier(s))return;p=s.name}p=a.toBindingIdentifierName(p),(s=a.identifier(p))[a.NOT_LOCAL_BINDING]=!0;return function(e,t,r,n){if(e.selfReference){if(!n.hasBinding(r.name)||n.hasGlobal(r.name)){if(!a.isFunction(t))return;var s=o;t.generator&&(s=u);var l=s({FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:n.generateUidIdentifier(r.name)}).expression;l.callee._skipModulesRemap=!0;for(var c=l.callee.body.body[0].params,p=0,h=(0,i.default)(t);p<h;p++)c.push(n.generateUidIdentifier("x"));return l}n.rename(r.name)}t.id=r,n.getProgramParent().references[r.name]=!0}(function(e,t,r){var n={selfAssignment:!1,selfReference:!1,outerDeclar:r.getBindingIdentifier(t),references:[],name:t},i=r.getOwnBinding(t);return i?"param"===i.kind&&(n.selfReference=!0):(n.outerDeclar||r.hasGlobal(t))&&r.traverse(e,l,n),n}(t,p,n),t,s,n)||t}};var i=n(e("babel-helper-get-function-arity")),s=n(e("babel-template")),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),o=(0,s.default)("\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n"),u=(0,s.default)("\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n"),l={"ReferencedIdentifier|BindingIdentifier":function(e,t){if(e.node.name===t.name){e.scope.getBindingIdentifier(t.name)===t.outerDeclar&&(t.selfReference=!0,e.stop())}}};t.exports=r.default},{"babel-helper-get-function-arity":105,"babel-template":139,"babel-types":180}],105:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){for(var t=e.params,r=0;r<t.length;r++){var i=t[r];if(n.isAssignmentPattern(i)||n.isRestElement(i))return r}return t.length};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));t.exports=r.default},{"babel-types":180}],106:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t,r){return 1===r.length&&n.isSpreadElement(r[0])&&n.isIdentifier(r[0].argument,{name:"arguments"})?n.callExpression(n.memberExpression(e,n.identifier("apply")),[t,r[0].argument]):n.callExpression(n.memberExpression(e,n.identifier("call")),[t].concat(r))};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));t.exports=r.default},{"babel-types":180}],107:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){return p.isMemberExpression(e)&&p.isSuper(e.object)}function a(e,t){var r=t?e:p.memberExpression(e,p.identifier("prototype"));return p.logicalExpression("||",p.memberExpression(r,p.identifier("__proto__")),p.callExpression(p.memberExpression(p.identifier("Object"),p.identifier("getPrototypeOf")),[r]))}r.__esModule=!0;var o=i(e("babel-runtime/helpers/classCallCheck")),u=i(e("babel-runtime/core-js/symbol")),l=i(e("babel-helper-optimise-call-expression")),c=n(e("babel-messages")),p=n(e("babel-types")),h=(0,u.default)(),f={Function:function(e){e.inShadow("this")||e.skip()},ReturnStatement:function(e,t){e.inShadow("this")||t.returns.push(e)},ThisExpression:function(e,t){e.node[h]||t.thises.push(e)},enter:function(e,t){var r=t.specHandle;t.isLoose&&(r=t.looseHandle);var n=e.isCallExpression()&&e.get("callee").isSuper(),i=r.call(t,e);i&&(t.hasSuper=!0),n&&t.bareSupers.push(e),!0===i&&e.requeue(),!0!==i&&i&&(Array.isArray(i)?e.replaceWithMultiple(i):e.replaceWith(i))}},d=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(0,o.default)(this,e),this.forceSuperMemoisation=t.forceSuperMemoisation,this.methodPath=t.methodPath,this.methodNode=t.methodNode,this.superRef=t.superRef,this.isStatic=t.isStatic,this.hasSuper=!1,this.inClass=r,this.isLoose=t.isLoose,this.scope=this.methodPath.scope,this.file=t.file,this.opts=t,this.bareSupers=[],this.returns=[],this.thises=[]}return e.prototype.getObjectRef=function(){return this.opts.objectRef||this.opts.getObjectRef()},e.prototype.setSuperProperty=function(e,t,r){return p.callExpression(this.file.addHelper("set"),[a(this.getObjectRef(),this.isStatic),r?e:p.stringLiteral(e.name),t,p.thisExpression()])},e.prototype.getSuperProperty=function(e,t){return p.callExpression(this.file.addHelper("get"),[a(this.getObjectRef(),this.isStatic),t?e:p.stringLiteral(e.name),p.thisExpression()])},e.prototype.replace=function(){this.methodPath.traverse(f,this)},e.prototype.getLooseSuperProperty=function(e,t){var r=this.methodNode,n=this.superRef||p.identifier("Function");return t.property===e?void 0:p.isCallExpression(t,{callee:e})?void 0:p.isMemberExpression(t)&&!r.static?p.memberExpression(n,p.identifier("prototype")):n},e.prototype.looseHandle=function(e){var t=e.node;if(e.isSuper())return this.getLooseSuperProperty(t,e.parent);if(e.isCallExpression()){var r=t.callee;if(!p.isMemberExpression(r))return;if(!p.isSuper(r.object))return;return p.appendToMemberExpression(r,p.identifier("call")),t.arguments.unshift(p.thisExpression()),!0}},e.prototype.specHandleAssignmentExpression=function(e,t,r){return"="===r.operator?this.setSuperProperty(r.left.property,r.right,r.left.computed):(e=e||t.scope.generateUidIdentifier("ref"),[p.variableDeclaration("var",[p.variableDeclarator(e,r.left)]),p.expressionStatement(p.assignmentExpression("=",r.left,p.binaryExpression(r.operator[0],e,r.right)))])},e.prototype.specHandle=function(e){var t=void 0,r=void 0,n=void 0,i=e.parent,a=e.node;if(function(e,t){return!!p.isSuper(e)&&!p.isMemberExpression(t,{computed:!1})&&!p.isCallExpression(t,{callee:e})}(a,i))throw e.buildCodeFrameError(c.get("classesIllegalBareSuper"));if(p.isCallExpression(a)){var o=a.callee;if(p.isSuper(o))return;s(o)&&(t=o.property,r=o.computed,n=a.arguments)}else if(p.isMemberExpression(a)&&p.isSuper(a.object))t=a.property,r=a.computed;else{if(p.isUpdateExpression(a)&&s(a.argument)){var u=p.binaryExpression(a.operator[0],a.argument,p.numericLiteral(1));if(a.prefix)return this.specHandleAssignmentExpression(null,e,u);var l=e.scope.generateUidIdentifier("ref");return this.specHandleAssignmentExpression(l,e,u).concat(p.expressionStatement(l))}if(p.isAssignmentExpression(a)&&s(a.left))return this.specHandleAssignmentExpression(null,e,a)}if(t){var h=this.getSuperProperty(t,r);return n?this.optimiseCall(h,n):h}},e.prototype.optimiseCall=function(e,t){var r=p.thisExpression();return r[h]=!0,(0,l.default)(e,r,t)},e}();r.default=d,t.exports=r.default},{"babel-helper-optimise-call-expression":106,"babel-messages":110,"babel-runtime/core-js/symbol":129,"babel-runtime/helpers/classCallCheck":134,"babel-types":180}],108:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-template")),i={};r.default=i,i.typeof=(0,n.default)('\n (typeof Symbol === "function" && typeof Symbol.iterator === "symbol")\n ? function (obj) { return typeof obj; }\n : function (obj) {\n return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype\n ? "symbol"\n : typeof obj;\n };\n'),i.jsx=(0,n.default)('\n (function () {\n var REACT_ELEMENT_TYPE = (typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")) || 0xeac7;\n\n return function createRawReactElement (type, props, key, children) {\n var defaultProps = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n // If we\'re going to assign props.children, we create a new object now\n // to avoid mutating defaultProps.\n props = {};\n }\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n props.children = childArray;\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : \'\' + key,\n ref: null,\n props: props,\n _owner: null,\n };\n };\n\n })()\n'),i.asyncIterator=(0,n.default)('\n (function (iterable) {\n if (typeof Symbol === "function") {\n if (Symbol.asyncIterator) {\n var method = iterable[Symbol.asyncIterator];\n if (method != null) return method.call(iterable);\n }\n if (Symbol.iterator) {\n return iterable[Symbol.iterator]();\n }\n }\n throw new TypeError("Object is not async iterable");\n })\n'),i.asyncGenerator=(0,n.default)('\n (function () {\n function AwaitValue(value) {\n this.value = value;\n }\n\n function AsyncGenerator(gen) {\n var front, back;\n\n function send(key, arg) {\n return new Promise(function (resolve, reject) {\n var request = {\n key: key,\n arg: arg,\n resolve: resolve,\n reject: reject,\n next: null\n };\n\n if (back) {\n back = back.next = request;\n } else {\n front = back = request;\n resume(key, arg);\n }\n });\n }\n\n function resume(key, arg) {\n try {\n var result = gen[key](arg)\n var value = result.value;\n if (value instanceof AwaitValue) {\n Promise.resolve(value.value).then(\n function (arg) { resume("next", arg); },\n function (arg) { resume("throw", arg); });\n } else {\n settle(result.done ? "return" : "normal", result.value);\n }\n } catch (err) {\n settle("throw", err);\n }\n }\n\n function settle(type, value) {\n switch (type) {\n case "return":\n front.resolve({ value: value, done: true });\n break;\n case "throw":\n front.reject(value);\n break;\n default:\n front.resolve({ value: value, done: false });\n break;\n }\n\n front = front.next;\n if (front) {\n resume(front.key, front.arg);\n } else {\n back = null;\n }\n }\n\n this._invoke = send;\n\n // Hide "return" method if generator return is not supported\n if (typeof gen.return !== "function") {\n this.return = undefined;\n }\n }\n\n if (typeof Symbol === "function" && Symbol.asyncIterator) {\n AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; };\n }\n\n AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); };\n AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); };\n AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); };\n\n return {\n wrap: function (fn) {\n return function () {\n return new AsyncGenerator(fn.apply(this, arguments));\n };\n },\n await: function (value) {\n return new AwaitValue(value);\n }\n };\n\n })()\n'),i.asyncGeneratorDelegate=(0,n.default)('\n (function (inner, awaitWrap) {\n var iter = {}, waiting = false;\n\n function pump(key, value) {\n waiting = true;\n value = new Promise(function (resolve) { resolve(inner[key](value)); });\n return { done: false, value: awaitWrap(value) };\n };\n\n if (typeof Symbol === "function" && Symbol.iterator) {\n iter[Symbol.iterator] = function () { return this; };\n }\n\n iter.next = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n return pump("next", value);\n };\n\n if (typeof inner.throw === "function") {\n iter.throw = function (value) {\n if (waiting) {\n waiting = false;\n throw value;\n }\n return pump("throw", value);\n };\n }\n\n if (typeof inner.return === "function") {\n iter.return = function (value) {\n return pump("return", value);\n };\n }\n\n return iter;\n })\n'),i.asyncToGenerator=(0,n.default)('\n (function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n return new Promise(function (resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function (value) {\n step("next", value);\n }, function (err) {\n step("throw", err);\n });\n }\n }\n\n return step("next");\n });\n };\n })\n'),i.classCallCheck=(0,n.default)('\n (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n });\n'),i.createClass=(0,n.default)('\n (function() {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i ++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n })()\n'),i.defineEnumerableProperties=(0,n.default)('\n (function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if ("value" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n return obj;\n })\n'),i.defaults=(0,n.default)("\n (function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n return obj;\n })\n"),i.defineProperty=(0,n.default)("\n (function (obj, key, value) {\n // Shortcircuit the slow defineProperty path when possible.\n // We are trying to avoid issues where setters defined on the\n // prototype cause side effects under the fast path of simple\n // assignment. By checking for existence of the property with\n // the in operator, we can optimize most of this overhead away.\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n });\n"),i.extends=(0,n.default)("\n Object.assign || (function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n })\n"),i.get=(0,n.default)('\n (function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if ("value" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n });\n'),i.inherits=(0,n.default)('\n (function (subClass, superClass) {\n if (typeof superClass !== "function" && superClass !== null) {\n throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n })\n'),i.instanceof=(0,n.default)('\n (function (left, right) {\n if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n });\n'),i.interopRequireDefault=(0,n.default)("\n (function (obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n })\n"),i.interopRequireWildcard=(0,n.default)("\n (function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n newObj.default = obj;\n return newObj;\n }\n })\n"),i.newArrowCheck=(0,n.default)('\n (function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError("Cannot instantiate an arrow function");\n }\n });\n'),i.objectDestructuringEmpty=(0,n.default)('\n (function (obj) {\n if (obj == null) throw new TypeError("Cannot destructure undefined");\n });\n'),i.objectWithoutProperties=(0,n.default)("\n (function (obj, keys) {\n var target = {};\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n return target;\n })\n"),i.possibleConstructorReturn=(0,n.default)('\n (function (self, call) {\n if (!self) {\n throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");\n }\n return call && (typeof call === "object" || typeof call === "function") ? call : self;\n });\n'),i.selfGlobal=(0,n.default)('\n typeof global === "undefined" ? self : global\n'),i.set=(0,n.default)('\n (function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if ("value" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n });\n'),i.slicedToArray=(0,n.default)('\n (function () {\n // Broken out into a separate function to avoid deoptimizations due to the try/catch for the\n // array iterator case.\n function sliceIterator(arr, i) {\n // this is an expanded form of `for...of` that properly supports abrupt completions of\n // iterators etc. variable names have been minimised to reduce the size of this massive\n // helper. sometimes spec compliancy is annoying :(\n //\n // _n = _iteratorNormalCompletion\n // _d = _didIteratorError\n // _e = _iteratorError\n // _i = _iterator\n // _s = _step\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i["return"]) _i["return"]();\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError("Invalid attempt to destructure non-iterable instance");\n }\n };\n })();\n'),i.slicedToArrayLoose=(0,n.default)('\n (function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n if (i && _arr.length === i) break;\n }\n return _arr;\n } else {\n throw new TypeError("Invalid attempt to destructure non-iterable instance");\n }\n });\n'),i.taggedTemplateLiteral=(0,n.default)("\n (function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: { value: Object.freeze(raw) }\n }));\n });\n"),i.taggedTemplateLiteralLoose=(0,n.default)("\n (function (strings, raw) {\n strings.raw = raw;\n return strings;\n });\n"),i.temporalRef=(0,n.default)('\n (function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + " is not defined - temporal dead zone");\n } else {\n return val;\n }\n })\n'),i.temporalUndefined=(0,n.default)("\n ({})\n"),i.toArray=(0,n.default)("\n (function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n });\n"),i.toConsumableArray=(0,n.default)("\n (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n return arr2;\n } else {\n return Array.from(arr);\n }\n });\n"),t.exports=r.default},{"babel-template":139}],109:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=a.default[e];if(!t)throw new ReferenceError("Unknown helper "+e);return t().expression}r.__esModule=!0,r.list=void 0;var s=n(e("babel-runtime/core-js/object/keys"));r.get=i;var a=n(e("./helpers"));r.list=(0,s.default)(a.default).map(function(e){return e.replace(/^_/,"")}).filter(function(e){return"__esModule"!==e});r.default=i},{"./helpers":108,"babel-runtime/core-js/object/keys":127}],110:[function(e,t,r){"use strict";function n(e){return e.map(function(e){if(null!=e&&e.inspect)return e.inspect();try{return(0,i.default)(e)||e+""}catch(t){return s.inspect(e)}})}r.__esModule=!0,r.MESSAGES=void 0;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/json/stringify"));r.get=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];var o=a[e];if(!o)throw new ReferenceError("Unknown message "+(0,i.default)(e));return r=n(r),o.replace(/\$(\d+)/g,function(e,t){return r[t-1]})},r.parseArgs=n;var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("util")),a=r.MESSAGES={tailCallReassignmentDeopt:"Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence",classesIllegalBareSuper:"Illegal use of bare super",classesIllegalSuperCall:"Direct super call is illegal in non-constructor, use super.$1() instead",scopeDuplicateDeclaration:"Duplicate declaration $1",settersNoRest:"Setters aren't allowed to have a rest",noAssignmentsInForHead:"No assignments allowed in for-in/of head",expectedMemberExpressionOrIdentifier:"Expected type MemberExpression or Identifier",invalidParentForThisNode:"We don't know how to handle this node within the current parent - please open an issue",readOnly:"$1 is read-only",unknownForHead:"Unknown node type $1 in ForStatement",didYouMean:"Did you mean $1?",codeGeneratorDeopt:"Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",missingTemplatesDirectory:"no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",unsupportedOutputType:"Unsupported output type $1",illegalMethodName:"Illegal method name $1",lostTrackNodePath:"We lost track of this node's position, likely because the AST was directly manipulated",modulesIllegalExportName:"Illegal export $1",modulesDuplicateDeclarations:"Duplicate module declarations with the same source but in different scopes",undeclaredVariable:"Reference to undeclared variable $1",undeclaredVariableType:"Referencing a type alias outside of a type annotation",undeclaredVariableSuggestion:"Reference to undeclared variable $1 - did you mean $2?",traverseNeedsParent:"You must pass a scope and parentPath unless traversing a Program/File. Instead of that you tried to traverse a $1 node without passing scope and parentPath.",traverseVerifyRootFunction:"You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",traverseVerifyVisitorProperty:"You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",traverseVerifyNodeType:"You gave us a visitor for the node type $1 but it's not a valid type",pluginNotObject:"Plugin $2 specified in $1 was expected to return an object when invoked but returned $3",pluginNotFunction:"Plugin $2 specified in $1 was expected to return a function but returned $3",pluginUnknown:"Unknown plugin $1 specified in $2 at $3, attempted to resolve relative to $4",pluginInvalidProperty:"Plugin $2 specified in $1 provided an invalid property of $3"}},{"babel-runtime/core-js/json/stringify":121,util:613}],111:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(){return{manipulateOptions:function(e,t){t.plugins.push("asyncFunctions")}}},t.exports=r.default},{}],112:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(){return{manipulateOptions:function(e,t){t.plugins.push("asyncGenerators")}}},t.exports=r.default},{}],113:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){var t=e.types;return{visitor:{ArrowFunctionExpression:function(e,r){if(r.opts.spec){var n=e.node;if(n.shadow)return;n.shadow={this:!1},n.type="FunctionExpression";var i=t.thisExpression();i._forceShadow=e,e.ensureBlock(),e.get("body").unshiftContainer("body",t.expressionStatement(t.callExpression(r.addHelper("newArrowCheck"),[t.thisExpression(),i]))),e.replaceWith(t.callExpression(t.memberExpression(n,t.identifier("bind")),[t.thisExpression()]))}else e.arrowFunctionToShadowed()}}}},t.exports=r.default},{}],114:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return!!h.isVariableDeclaration(e)&&(!!e[h.BLOCK_SCOPED_SYMBOL]||("let"===e.kind||"const"===e.kind))}function s(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(t||(t=e.node),!h.isFor(r))for(var s=0;s<t.declarations.length;s++){var a=t.declarations[s];a.init=a.init||n.buildUndefinedNode()}if(t[h.BLOCK_SCOPED_SYMBOL]=!0,t.kind="var",i){var o=n.getFunctionParent(),u=e.getBindingIdentifiers();for(var l in u){var c=n.getOwnBinding(l);c&&(c.kind="var"),n.moveBindingTo(l,o)}}}function a(e){return h.isVariableDeclaration(e,{kind:"var"})&&!i(e)}r.__esModule=!0;var o=n(e("babel-runtime/core-js/symbol")),u=n(e("babel-runtime/core-js/object/create")),l=n(e("babel-runtime/helpers/classCallCheck"));r.default=function(){return{visitor:{VariableDeclaration:function(e,t){var r=e.node,n=e.parent,a=e.scope;if(i(r)&&(s(e,null,n,a,!0),r._tdzThis)){for(var o=[r],u=0;u<r.declarations.length;u++){var l=r.declarations[u];if(l.init){var c=h.assignmentExpression("=",l.id,l.init);c._ignoreBlockScopingTDZ=!0,o.push(h.expressionStatement(c))}l.init=t.addHelper("temporalUndefined")}r._blockHoist=2,e.isCompletionRecord()&&o.push(h.expressionStatement(a.buildUndefinedNode())),e.replaceWithMultiple(o)}},Loop:function(e,t){var r=e.node,n=e.parent,i=e.scope;h.ensureBlock(r);var s=new A(e,e.get("body"),n,i,t).run();s&&e.replaceWith(s)},CatchClause:function(e,t){var r=e.parent,n=e.scope;new A(null,e.get("body"),r,n,t).run()},"BlockStatement|SwitchStatement|Program":function(e,t){if(!function(e){return h.isLoop(e.parent)||h.isCatchClause(e.parent)}(e)){new A(null,e,e.parent,e.scope,t).run()}}}}};var c=n(e("babel-traverse")),p=e("./tdz"),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),f=n(e("lodash/values")),d=n(e("lodash/extend")),m=(0,n(e("babel-template")).default)('\n if (typeof RETURN === "object") return RETURN.v;\n'),y=c.default.visitors.merge([{Loop:{enter:function(e,t){t.loopDepth++},exit:function(e,t){t.loopDepth--}},Function:function(e,t){return t.loopDepth>0&&e.traverse(g,t),e.skip()}},p.visitor]),g=c.default.visitors.merge([{ReferencedIdentifier:function(e,t){var r=t.letReferences[e.node.name];if(r){var n=e.scope.getBindingIdentifier(e.node.name);n&&n!==r||(t.closurify=!0)}}},p.visitor]),b={enter:function(e,t){var r=e.node;e.parent;if(e.isForStatement()){if(a(r.init)){var n=t.pushDeclar(r.init);1===n.length?r.init=n[0]:r.init=h.sequenceExpression(n)}}else if(e.isFor())a(r.left)&&(t.pushDeclar(r.left),r.left=r.left.declarations[0].id);else if(a(r))e.replaceWithMultiple(t.pushDeclar(r).map(function(e){return h.expressionStatement(e)}));else if(e.isFunction())return e.skip()}},v={LabeledStatement:function(e,t){var r=e.node;t.innerLabels.push(r.label.name)}},x={enter:function(e,t){if(e.isAssignmentExpression()||e.isUpdateExpression()){var r=e.getBindingIdentifiers();for(var n in r)t.outsideReferences[n]===e.scope.getBindingIdentifier(n)&&(t.reassignments[n]=!0)}}},E={Loop:function(e,t){var r=t.ignoreLabeless;t.ignoreLabeless=!0,e.traverse(E,t),t.ignoreLabeless=r,e.skip()},Function:function(e){e.skip()},SwitchCase:function(e,t){var r=t.inSwitchCase;t.inSwitchCase=!0,e.traverse(E,t),t.inSwitchCase=r,e.skip()},"BreakStatement|ContinueStatement|ReturnStatement":function(e,t){var r=e.node,n=e.parent,i=e.scope;if(!r[this.LOOP_IGNORE]){var s=void 0,a=function(e){return h.isBreakStatement(e)?"break":h.isContinueStatement(e)?"continue":void 0}(r);if(a){if(r.label){if(t.innerLabels.indexOf(r.label.name)>=0)return;a=a+"|"+r.label.name}else{if(t.ignoreLabeless)return;if(t.inSwitchCase)return;if(h.isBreakStatement(r)&&h.isSwitchCase(n))return}t.hasBreakContinue=!0,t.map[a]=r,s=h.stringLiteral(a)}e.isReturnStatement()&&(t.hasReturn=!0,s=h.objectExpression([h.objectProperty(h.identifier("v"),r.argument||i.buildUndefinedNode())])),s&&((s=h.returnStatement(s))[this.LOOP_IGNORE]=!0,e.skip(),e.replaceWith(h.inherits(s,r)))}}},A=function(){function e(t,r,n,i,s){(0,l.default)(this,e),this.parent=n,this.scope=i,this.file=s,this.blockPath=r,this.block=r.node,this.outsideLetReferences=(0,u.default)(null),this.hasLetReferences=!1,this.letReferences=(0,u.default)(null),this.body=[],t&&(this.loopParent=t.parent,this.loopLabel=h.isLabeledStatement(this.loopParent)&&this.loopParent.label,this.loopPath=t,this.loop=t.node)}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var t=this.getLetReferences();if(h.isFunction(this.parent)||h.isProgram(this.block))this.updateScopeInfo();else if(this.hasLetReferences)return t?this.wrapClosure():this.remap(),this.updateScopeInfo(t),this.loopLabel&&!h.isLabeledStatement(this.loopParent)?h.labeledStatement(this.loopLabel,this.loop):void 0}},e.prototype.updateScopeInfo=function(e){var t=this.scope,r=t.getFunctionParent(),n=this.letReferences;for(var i in n){var s=n[i],a=t.getBinding(s.name);a&&("let"!==a.kind&&"const"!==a.kind||(a.kind="var",e?t.removeBinding(s.name):t.moveBindingTo(s.name,r)))}},e.prototype.remap=function(){var e=this.letReferences,t=this.scope;for(var r in e){var n=e[r];(t.parentHasBinding(r)||t.hasGlobal(r))&&(t.hasOwnBinding(r)&&t.rename(n.name),this.blockPath.scope.hasOwnBinding(r)&&this.blockPath.scope.rename(n.name))}},e.prototype.wrapClosure=function(){if(this.file.opts.throwIfClosureRequired)throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure (throwIfClosureRequired).");var e=this.block,t=this.outsideLetReferences;if(this.loop)for(var r in t){var n=t[r];(this.scope.hasGlobal(n.name)||this.scope.parentHasBinding(n.name))&&(delete t[n.name],delete this.letReferences[n.name],this.scope.rename(n.name),this.letReferences[n.name]=n,t[n.name]=n)}this.has=this.checkLoop(),this.hoistVarDeclarations();var i=(0,f.default)(t),s=(0,f.default)(t),a=this.blockPath.isSwitchStatement(),o=h.functionExpression(null,i,h.blockStatement(a?[e]:e.body));o.shadow=!0,this.addContinuations(o);var u=o;this.loop&&(u=this.scope.generateUidIdentifier("loop"),this.loopPath.insertBefore(h.variableDeclaration("var",[h.variableDeclarator(u,o)])));var l=h.callExpression(u,s),p=this.scope.generateUidIdentifier("ret");c.default.hasType(o.body,this.scope,"YieldExpression",h.FUNCTION_TYPES)&&(o.generator=!0,l=h.yieldExpression(l,!0));c.default.hasType(o.body,this.scope,"AwaitExpression",h.FUNCTION_TYPES)&&(o.async=!0,l=h.awaitExpression(l)),this.buildClosure(p,l),a?this.blockPath.replaceWithMultiple(this.body):e.body=this.body},e.prototype.buildClosure=function(e,t){var r=this.has;r.hasReturn||r.hasBreakContinue?this.buildHas(e,t):this.body.push(h.expressionStatement(t))},e.prototype.addContinuations=function(e){var t={reassignments:{},outsideReferences:this.outsideLetReferences};this.scope.traverse(e,x,t);for(var r=0;r<e.params.length;r++){var n=e.params[r];if(t.reassignments[n.name]){var i=this.scope.generateUidIdentifier(n.name);e.params[r]=i,this.scope.rename(n.name,i.name,e),e.body.body.push(h.expressionStatement(h.assignmentExpression("=",n,i)))}}},e.prototype.getLetReferences=function(){var e=this,t=this.block,r=[];if(this.loop){var n=this.loop.left||this.loop.init;i(n)&&(r.push(n),(0,d.default)(this.outsideLetReferences,h.getBindingIdentifiers(n)))}var a=function n(a,o){o=o||a.node,(h.isClassDeclaration(o)||h.isFunctionDeclaration(o)||i(o))&&(i(o)&&s(a,o,t,e.scope),r=r.concat(o.declarations||o)),h.isLabeledStatement(o)&&n(a.get("body"),o.body)};if(t.body)for(var o=0;o<t.body.length;o++){a(this.blockPath.get("body")[o])}if(t.cases)for(var u=0;u<t.cases.length;u++)for(var l=t.cases[u].consequent,c=0;c<l.length;c++){a(this.blockPath.get("cases")[u],l[c])}for(var p=0;p<r.length;p++){var f=r[p],m=h.getBindingIdentifiers(f,!1,!0);(0,d.default)(this.letReferences,m),this.hasLetReferences=!0}if(this.hasLetReferences){var g={letReferences:this.letReferences,closurify:!1,file:this.file,loopDepth:0},b=this.blockPath.find(function(e){return e.isLoop()||e.isFunction()});return b&&b.isLoop()&&g.loopDepth++,this.blockPath.traverse(y,g),g.closurify}},e.prototype.checkLoop=function(){var e={hasBreakContinue:!1,ignoreLabeless:!1,inSwitchCase:!1,innerLabels:[],hasReturn:!1,isLoop:!!this.loop,map:{},LOOP_IGNORE:(0,o.default)()};return this.blockPath.traverse(v,e),this.blockPath.traverse(E,e),e},e.prototype.hoistVarDeclarations=function(){this.blockPath.traverse(b,this)},e.prototype.pushDeclar=function(e){var t=[],r=h.getBindingIdentifiers(e);for(var n in r)t.push(h.variableDeclarator(r[n]));this.body.push(h.variableDeclaration(e.kind,t));for(var i=[],s=0;s<e.declarations.length;s++){var a=e.declarations[s];if(a.init){var o=h.assignmentExpression("=",a.id,a.init);i.push(h.inherits(o,a))}}return i},e.prototype.buildHas=function(e,t){var r=this.body;r.push(h.variableDeclaration("var",[h.variableDeclarator(e,t)]));var n=void 0,i=this.has,s=[];if(i.hasReturn&&(n=m({RETURN:e})),i.hasBreakContinue){for(var a in i.map)s.push(h.switchCase(h.stringLiteral(a),[i.map[a]]));if(i.hasReturn&&s.push(h.switchCase(null,[n])),1===s.length){var o=s[0];r.push(h.ifStatement(h.binaryExpression("===",e,o.test),o.consequent[0]))}else{if(this.loop)for(var u=0;u<s.length;u++){var l=s[u].consequent[0];h.isBreakStatement(l)&&!l.label&&(l.label=this.loopLabel=this.loopLabel||this.scope.generateUidIdentifier("loop"))}r.push(h.switchStatement(e,s))}}else i.hasReturn&&r.push(n)},e}();t.exports=r.default},{"./tdz":115,"babel-runtime/core-js/object/create":125,"babel-runtime/core-js/symbol":129,"babel-runtime/helpers/classCallCheck":134,"babel-template":139,"babel-traverse":143,"babel-types":180,"lodash/extend":498,"lodash/values":541}],115:[function(e,t,r){"use strict";function n(e,t){return s.callExpression(t.addHelper("temporalRef"),[e,s.stringLiteral(e.name),t.addHelper("temporalUndefined")])}function i(e,t,r){var n=r.letReferences[e.name];return!!n&&t.getBindingIdentifier(e.name)===n}r.__esModule=!0,r.visitor=void 0;var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.visitor={ReferencedIdentifier:function(e,t){if(this.file.opts.tdz){var r=e.node,a=e.parent,o=e.scope;if(!e.parentPath.isFor({left:r})&&i(r,o,t)){var u=o.getBinding(r.name).path,l=function(e,t){var r=t._guessExecutionStatusRelativeTo(e);return"before"===r?"inside":"after"===r?"outside":"maybe"}(e,u);if("inside"!==l)if("maybe"===l){var c=n(r,t.file);if(u.parent._tdzThis=!0,e.skip(),e.parentPath.isUpdateExpression()){if(a._ignoreBlockScopingTDZ)return;e.parentPath.replaceWith(s.sequenceExpression([c,a]))}else e.replaceWith(c)}else"outside"===l&&e.replaceWith(s.throwStatement(s.inherits(s.newExpression(s.identifier("ReferenceError"),[s.stringLiteral(r.name+" is not defined - temporal dead zone")]),r)))}}},AssignmentExpression:{exit:function(e,t){if(this.file.opts.tdz){var r=e.node;if(!r._ignoreBlockScopingTDZ){var a=[],o=e.getBindingIdentifiers();for(var u in o){var l=o[u];i(l,e.scope,t)&&a.push(n(l,t.file))}a.length&&(r._ignoreBlockScopingTDZ=!0,a.push(r),e.replaceWithMultiple(a.map(s.expressionStatement)))}}}}}},{"babel-types":180}],116:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/symbol"));r.default=function(e){var t=e.types,r=(0,i.default)();return{visitor:{ExportDefaultDeclaration:function(e){if(e.get("declaration").isClassDeclaration()){var r=e.node,n=r.declaration.id||e.scope.generateUidIdentifier("class");r.declaration.id=n,e.replaceWith(r.declaration),e.insertAfter(t.exportDefaultDeclaration(n))}},ClassDeclaration:function(e){var r=e.node,n=r.id||e.scope.generateUidIdentifier("class");e.replaceWith(t.variableDeclaration("let",[t.variableDeclarator(n,t.toExpression(r))]))},ClassExpression:function(e,t){var n=e.node;if(!n[r]){var i=(0,o.default)(e);if(i&&i!==n)return e.replaceWith(i);n[r]=!0;var u=a.default;t.opts.loose&&(u=s.default),e.replaceWith(new u(e,t.file).run())}}}}};var s=n(e("./loose")),a=n(e("./vanilla")),o=n(e("babel-helper-function-name"));t.exports=r.default},{"./loose":117,"./vanilla":118,"babel-helper-function-name":104,"babel-runtime/core-js/symbol":129}],117:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("babel-runtime/helpers/possibleConstructorReturn")),a=n(e("babel-runtime/helpers/inherits")),o=n(e("babel-helper-function-name")),u=n(e("./vanilla")),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),c=function(e){function t(){(0,i.default)(this,t);var r=(0,s.default)(this,e.apply(this,arguments));return r.isLoose=!0,r}return(0,a.default)(t,e),t.prototype._processMethod=function(e,t){if(!e.decorators){var r=this.classRef;e.static||(r=l.memberExpression(r,l.identifier("prototype")));var n=l.memberExpression(r,e.key,e.computed||l.isLiteral(e.key)),i=l.functionExpression(null,e.params,e.body,e.generator,e.async);i.returnType=e.returnType;var s=l.toComputedKey(e,e.key);l.isStringLiteral(s)&&(i=(0,o.default)({node:i,id:s,scope:t}));var a=l.expressionStatement(l.assignmentExpression("=",n,i));return l.inheritsComments(a,e),this.body.push(a),!0}},t}(u.default);r.default=c,t.exports=r.default},{"./vanilla":118,"babel-helper-function-name":104,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137,"babel-types":180}],118:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var s=i(e("babel-runtime/core-js/get-iterator")),a=i(e("babel-runtime/helpers/classCallCheck")),o=e("babel-traverse"),u=i(e("babel-helper-replace-supers")),l=i(e("babel-helper-optimise-call-expression")),c=n(e("babel-helper-define-map")),p=i(e("babel-template")),h=n(e("babel-types")),f=(0,p.default)("\n (function () {\n super(...arguments);\n })\n"),d={"FunctionExpression|FunctionDeclaration":function(e){e.is("shadow")||e.skip()},Method:function(e){e.skip()}},m=o.visitors.merge([d,{Super:function(e){if(this.isDerived&&!this.hasBareSuper&&!e.parentPath.isCallExpression({callee:e.node}))throw e.buildCodeFrameError("'super.*' is not allowed before super()")},CallExpression:{exit:function(e){if(e.get("callee").isSuper()&&(this.hasBareSuper=!0,!this.isDerived))throw e.buildCodeFrameError("super() is only allowed in a derived constructor")}},ThisExpression:function(e){if(this.isDerived&&!this.hasBareSuper&&!e.inShadow("this"))throw e.buildCodeFrameError("'this' is not allowed before super()")}}]),y=o.visitors.merge([d,{ThisExpression:function(e){this.superThises.push(e)}}]),g=function(){function e(t,r){(0,a.default)(this,e),this.parent=t.parent,this.scope=t.scope,this.node=t.node,this.path=t,this.file=r,this.clearDescriptors(),this.instancePropBody=[],this.instancePropRefs={},this.staticPropBody=[],this.body=[],this.bareSuperAfter=[],this.bareSupers=[],this.pushedConstructor=!1,this.pushedInherits=!1,this.isLoose=!1,this.superThises=[],this.classId=this.node.id,this.classRef=this.node.id?h.identifier(this.node.id.name):this.scope.generateUidIdentifier("class"),this.superName=this.node.superClass||h.identifier("Function"),this.isDerived=!!this.node.superClass}return e.prototype.run=function(){var e=this,t=this.superName,r=this.file,n=this.body,i=this.constructorBody=h.blockStatement([]);this.constructor=this.buildConstructor();var s=[],a=[];if(this.isDerived&&(a.push(t),t=this.scope.generateUidIdentifierBasedOnNode(t),s.push(t),this.superName=t),this.buildBody(),i.body.unshift(h.expressionStatement(h.callExpression(r.addHelper("classCallCheck"),[h.thisExpression(),this.classRef]))),n=n.concat(this.staticPropBody.map(function(t){return t(e.classRef)})),this.classId&&1===n.length)return h.toExpression(n[0]);n.push(h.returnStatement(this.classRef));var o=h.functionExpression(null,s,h.blockStatement(n));return o.shadow=!0,h.callExpression(o,a)},e.prototype.buildConstructor=function(){var e=h.functionDeclaration(this.classRef,[],this.constructorBody);return h.inherits(e,this.node),e},e.prototype.pushToMap=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value",n=arguments[3],i=void 0;e.static?(this.hasStaticDescriptors=!0,i=this.staticMutatorMap):(this.hasInstanceDescriptors=!0,i=this.instanceMutatorMap);var s=c.push(i,e,r,this.file,n);return t&&(s.enumerable=h.booleanLiteral(!0)),s},e.prototype.constructorMeMaybe=function(){var e=!1,t=this.path.get("body.body"),r=Array.isArray(t),n=0;for(t=r?t:(0,s.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}if(e=i.equals("kind","constructor"))break}if(!e){var a=void 0,o=void 0;if(this.isDerived){var u=f().expression;a=u.params,o=u.body}else a=[],o=h.blockStatement([]);this.path.get("body").unshiftContainer("body",h.classMethod("constructor",h.identifier("constructor"),a,o))}},e.prototype.buildBody=function(){if(this.constructorMeMaybe(),this.pushBody(),this.verifyConstructor(),this.userConstructor){var e=this.constructorBody;e.body=e.body.concat(this.userConstructor.body.body),h.inherits(this.constructor,this.userConstructor),h.inherits(e,this.userConstructor.body)}this.pushDescriptors()},e.prototype.pushBody=function(){var e=this.path.get("body.body"),t=Array.isArray(e),r=0;for(e=t?e:(0,s.default)(e);;){var n;if(t){if(r>=e.length)break;n=e[r++]}else{if((r=e.next()).done)break;n=r.value}var i=n,a=i.node;if(i.isClassProperty())throw i.buildCodeFrameError("Missing class properties transform.");if(a.decorators)throw i.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.");if(h.isClassMethod(a)){var o="constructor"===a.kind;if(o&&(i.traverse(m,this),!this.hasBareSuper&&this.isDerived))throw i.buildCodeFrameError("missing super() call in constructor");var l=new u.default({forceSuperMemoisation:o,methodPath:i,methodNode:a,objectRef:this.classRef,superRef:this.superName,isStatic:a.static,isLoose:this.isLoose,scope:this.scope,file:this.file},!0);l.replace(),o?this.pushConstructor(l,a,i):this.pushMethod(a,i)}}},e.prototype.clearDescriptors=function(){this.hasInstanceDescriptors=!1,this.hasStaticDescriptors=!1,this.instanceMutatorMap={},this.staticMutatorMap={}},e.prototype.pushDescriptors=function(){this.pushInherits();var e=this.body,t=void 0,r=void 0;if(this.hasInstanceDescriptors&&(t=c.toClassObject(this.instanceMutatorMap)),this.hasStaticDescriptors&&(r=c.toClassObject(this.staticMutatorMap)),t||r){t&&(t=c.toComputedObjectFromClass(t)),r&&(r=c.toComputedObjectFromClass(r));var n=h.nullLiteral(),i=[this.classRef,n,n,n,n];t&&(i[1]=t),r&&(i[2]=r),this.instanceInitializersId&&(i[3]=this.instanceInitializersId,e.unshift(this.buildObjectAssignment(this.instanceInitializersId))),this.staticInitializersId&&(i[4]=this.staticInitializersId,e.unshift(this.buildObjectAssignment(this.staticInitializersId)));for(var s=0,a=0;a<i.length;a++)i[a]!==n&&(s=a);i=i.slice(0,s+1),e.push(h.expressionStatement(h.callExpression(this.file.addHelper("createClass"),i)))}this.clearDescriptors()},e.prototype.buildObjectAssignment=function(e){return h.variableDeclaration("var",[h.variableDeclarator(e,h.objectExpression([]))])},e.prototype.wrapSuperCall=function(e,t,r,n){var i=e.node;this.isLoose?(i.arguments.unshift(h.thisExpression()),2===i.arguments.length&&h.isSpreadElement(i.arguments[1])&&h.isIdentifier(i.arguments[1].argument,{name:"arguments"})?(i.arguments[1]=i.arguments[1].argument,i.callee=h.memberExpression(t,h.identifier("apply"))):i.callee=h.memberExpression(t,h.identifier("call"))):i=(0,l.default)(h.logicalExpression("||",h.memberExpression(this.classRef,h.identifier("__proto__")),h.callExpression(h.memberExpression(h.identifier("Object"),h.identifier("getPrototypeOf")),[this.classRef])),h.thisExpression(),i.arguments);var s=h.callExpression(this.file.addHelper("possibleConstructorReturn"),[h.thisExpression(),i]),a=this.bareSuperAfter.map(function(e){return e(r)});e.parentPath.isExpressionStatement()&&e.parentPath.container===n.node.body&&n.node.body.length-1===e.parentPath.key?((this.superThises.length||a.length)&&(e.scope.push({id:r}),s=h.assignmentExpression("=",r,s)),a.length&&(s=h.toSequenceExpression([s].concat(a,[r]))),e.parentPath.replaceWith(h.returnStatement(s))):e.replaceWithMultiple([h.variableDeclaration("var",[h.variableDeclarator(r,s)])].concat(a,[h.expressionStatement(r)]))},e.prototype.verifyConstructor=function(){var e=this;if(this.isDerived){var t=this.userConstructorPath,r=t.get("body");t.traverse(y,this);var n=!!this.bareSupers.length,i=this.superName||h.identifier("Function"),a=t.scope.generateUidIdentifier("this"),o=this.bareSupers,u=Array.isArray(o),l=0;for(o=u?o:(0,s.default)(o);;){var c;if(u){if(l>=o.length)break;c=o[l++]}else{if((l=o.next()).done)break;c=l.value}var p=c;this.wrapSuperCall(p,i,a,r),n&&p.find(function(e){return e===t||(e.isLoop()||e.isConditional()?(n=!1,!0):void 0)})}var f=this.superThises,d=Array.isArray(f),m=0;for(f=d?f:(0,s.default)(f);;){var g;if(d){if(m>=f.length)break;g=f[m++]}else{if((m=f.next()).done)break;g=m.value}g.replaceWith(a)}var b=function(t){return h.callExpression(e.file.addHelper("possibleConstructorReturn"),[a].concat(t||[]))},v=r.get("body");v.length&&!v.pop().isReturnStatement()&&r.pushContainer("body",h.returnStatement(n?a:b()));var x=this.superReturns,E=Array.isArray(x),A=0;for(x=E?x:(0,s.default)(x);;){var D;if(E){if(A>=x.length)break;D=x[A++]}else{if((A=x.next()).done)break;D=A.value}var S=D;if(S.node.argument){var C=S.scope.generateDeclaredUidIdentifier("ret");S.get("argument").replaceWithMultiple([h.assignmentExpression("=",C,S.node.argument),b(C)])}else S.get("argument").replaceWith(b())}}},e.prototype.pushMethod=function(e,t){var r=t?t.scope:this.scope;"method"===e.kind&&this._processMethod(e,r)||this.pushToMap(e,!1,null,r)},e.prototype._processMethod=function(){return!1},e.prototype.pushConstructor=function(e,t,r){this.bareSupers=e.bareSupers,this.superReturns=e.returns,r.scope.hasOwnBinding(this.classRef.name)&&r.scope.rename(this.classRef.name);var n=this.constructor;this.userConstructorPath=r,this.userConstructor=t,this.hasConstructor=!0,h.inheritsComments(n,t),n._ignoreUserWhitespace=!0,n.params=t.params,h.inherits(n.body,t.body),n.body.directives=t.body.directives,this._pushConstructor()},e.prototype._pushConstructor=function(){this.pushedConstructor||(this.pushedConstructor=!0,(this.hasInstanceDescriptors||this.hasStaticDescriptors)&&this.pushDescriptors(),this.body.push(this.constructor),this.pushInherits())},e.prototype.pushInherits=function(){this.isDerived&&!this.pushedInherits&&(this.pushedInherits=!0,this.body.unshift(h.expressionStatement(h.callExpression(this.file.addHelper("inherits"),[this.classRef,this.superName]))))},e}();r.default=g,t.exports=r.default},{"babel-helper-define-map":103,"babel-helper-optimise-call-expression":106,"babel-helper-replace-supers":107,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-template":139,"babel-traverse":143,"babel-types":180}],119:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){function t(e){var t=e.node,r=e.scope,n=[],i=t.right;if(!a.isIdentifier(i)||!r.hasBinding(i.name)){var s=r.generateUidIdentifier("arr");n.push(a.variableDeclaration("var",[a.variableDeclarator(s,i)])),i=s}var u=r.generateUidIdentifier("i"),l=o({BODY:t.body,KEY:u,ARR:i});a.inherits(l,t),a.ensureBlock(l);var c=a.memberExpression(i,u,!0),p=t.left;return a.isVariableDeclaration(p)?(p.declarations[0].init=c,l.body.body.unshift(p)):l.body.body.unshift(a.expressionStatement(a.assignmentExpression("=",p,c))),e.parentPath.isLabeledStatement()&&(l=a.labeledStatement(e.parentPath.node.label,l)),n.push(l),n}function r(e,t){var r=e.node,n=e.scope,s=e.parent,o=r.left,l=void 0,c=void 0;if(a.isIdentifier(o)||a.isPattern(o)||a.isMemberExpression(o))c=o;else{if(!a.isVariableDeclaration(o))throw t.buildCodeFrameError(o,i.get("unknownForHead",o.type));c=n.generateUidIdentifier("ref"),l=a.variableDeclaration(o.kind,[a.variableDeclarator(o.declarations[0].id,c)])}var p=n.generateUidIdentifier("iterator"),h=n.generateUidIdentifier("isArray"),f=u({LOOP_OBJECT:p,IS_ARRAY:h,OBJECT:r.right,INDEX:n.generateUidIdentifier("i"),ID:c});l||f.body.body.shift();var d=a.isLabeledStatement(s),m=void 0;return d&&(m=a.labeledStatement(s.label,f)),{replaceParent:d,declar:l,node:m||f,loop:f}}function n(e,t){var r=e.node,n=e.scope,s=e.parent,o=r.left,u=void 0,c=n.generateUidIdentifier("step"),p=a.memberExpression(c,a.identifier("value"));if(a.isIdentifier(o)||a.isPattern(o)||a.isMemberExpression(o))u=a.expressionStatement(a.assignmentExpression("=",o,p));else{if(!a.isVariableDeclaration(o))throw t.buildCodeFrameError(o,i.get("unknownForHead",o.type));u=a.variableDeclaration(o.kind,[a.variableDeclarator(o.declarations[0].id,p)])}var h=n.generateUidIdentifier("iterator"),f=l({ITERATOR_HAD_ERROR_KEY:n.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:n.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:n.generateUidIdentifier("iteratorError"),ITERATOR_KEY:h,STEP_KEY:c,OBJECT:r.right,BODY:null}),d=a.isLabeledStatement(s),m=f[3].block.body,y=m[0];return d&&(m[0]=a.labeledStatement(s.label,y)),{replaceParent:d,declar:u,loop:y,node:f}}var i=e.messages,s=e.template,a=e.types,o=s("\n for (var KEY = 0; KEY < ARR.length; KEY++) BODY;\n "),u=s("\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n var ID;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n "),l=s("\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n ");return{visitor:{ForOfStatement:function(e,i){if(e.get("right").isArrayExpression())return e.parentPath.isLabeledStatement()?e.parentPath.replaceWithMultiple(t(e)):e.replaceWithMultiple(t(e));var s=n;i.opts.loose&&(s=r);var o=e.node,u=s(e,i),l=u.declar,c=u.loop,p=c.body;e.ensureBlock(),l&&p.body.push(l),p.body=p.body.concat(o.body.body),a.inherits(c,o),a.inherits(c.body,o.body),u.replaceParent?(e.parentPath.replaceWithMultiple(u.node),e.remove()):e.replaceWithMultiple(u.node)}}}},t.exports=r.default},{}],120:[function(e,t,r){t.exports={default:e("core-js/library/fn/get-iterator"),__esModule:!0}},{"core-js/library/fn/get-iterator":196}],121:[function(e,t,r){t.exports={default:e("core-js/library/fn/json/stringify"),__esModule:!0}},{"core-js/library/fn/json/stringify":197}],122:[function(e,t,r){t.exports={default:e("core-js/library/fn/map"),__esModule:!0}},{"core-js/library/fn/map":198}],123:[function(e,t,r){t.exports={default:e("core-js/library/fn/number/max-safe-integer"),__esModule:!0}},{"core-js/library/fn/number/max-safe-integer":199}],124:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":200}],125:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":201}],126:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/get-own-property-symbols"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-symbols":202}],127:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":203}],128:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/set-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/set-prototype-of":204}],129:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":206}],130:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol/for"),__esModule:!0}},{"core-js/library/fn/symbol/for":205}],131:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":207}],132:[function(e,t,r){t.exports={default:e("core-js/library/fn/weak-map"),__esModule:!0}},{"core-js/library/fn/weak-map":208}],133:[function(e,t,r){t.exports={default:e("core-js/library/fn/weak-set"),__esModule:!0}},{"core-js/library/fn/weak-set":209}],134:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},{}],135:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("../core-js/object/set-prototype-of")),s=n(e("../core-js/object/create")),a=n(e("../helpers/typeof"));r.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,a.default)(t)));e.prototype=(0,s.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(i.default?(0,i.default)(e,t):e.__proto__=t)}},{"../core-js/object/create":125,"../core-js/object/set-prototype-of":128,"../helpers/typeof":138}],136:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}},{}],137:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("../helpers/typeof"));r.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,n.default)(t))&&"function"!=typeof t?e:t}},{"../helpers/typeof":138}],138:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("../core-js/symbol/iterator")),s=n(e("../core-js/symbol")),a="function"==typeof s.default&&"symbol"==typeof i.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":typeof e};r.default="function"==typeof s.default&&"symbol"===a(i.default)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":void 0===e?"undefined":a(e)}},{"../core-js/symbol":129,"../core-js/symbol/iterator":131}],139:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var s=i(e("babel-runtime/core-js/symbol"));r.default=function(e,t){var r=void 0;try{throw new Error}catch(e){e.stack&&(r=e.stack.split("\n").slice(1).join("\n"))}t=(0,o.default)({allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,preserveComments:!1},t);var n=function(){var i=void 0;try{i=c.parse(e,t),i=l.default.removeProperties(i,{preserveComments:t.preserveComments}),l.default.cheap(i,function(e){e[h]=!0})}catch(e){throw e.stack=e.stack+"from\n"+r,e}return n=function(){return i},i};return function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e,t){var r=(e=(0,a.default)(e)).program;return t.length&&(0,l.default)(e,d,null,t),r.body.length>1?r.body:r.body[0]}(n(),t)}};var a=i(e("lodash/cloneDeep")),o=i(e("lodash/assign")),u=i(e("lodash/has")),l=i(e("babel-traverse")),c=n(e("babylon")),p=n(e("babel-types")),h="_fromTemplate",f=(0,s.default)(),d={noScope:!0,enter:function(e,t){var r=e.node;if(r[f])return e.skip();p.isExpressionStatement(r)&&(r=r.expression);var n=void 0;if(p.isIdentifier(r)&&r[h])if((0,u.default)(t[0],r.name))n=t[0][r.name];else if("$"===r.name[0]){var i=+r.name.slice(1);t[i]&&(n=t[i])}null===n&&e.remove(),n&&(n[f]=!0,e.replaceInline(n))},exit:function(e){var t=e.node;t.loc||l.default.clearNode(t)}};t.exports=r.default},{"babel-runtime/core-js/symbol":129,"babel-traverse":143,"babel-types":180,babylon:188,"lodash/assign":488,"lodash/cloneDeep":492,"lodash/has":504}],140:[function(e,t,r){"use strict";function n(){r.path=new s.default}function i(){r.scope=new s.default}r.__esModule=!0,r.scope=r.path=void 0;var s=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/weak-map"));r.clear=function(){n(),i()},r.clearPath=n,r.clearScope=i;r.path=new s.default,r.scope=new s.default},{"babel-runtime/core-js/weak-map":132}],141:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var s=i(e("babel-runtime/core-js/get-iterator")),a=i(e("babel-runtime/helpers/classCallCheck")),o=i(e("./path")),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),l="test"===n.env.NODE_ENV,c=function(){function e(t,r,n,i){(0,a.default)(this,e),this.queue=null,this.parentPath=i,this.scope=t,this.state=n,this.opts=r}return e.prototype.shouldVisit=function(e){var t=this.opts;if(t.enter||t.exit)return!0;if(t[e.type])return!0;var r=u.VISITOR_KEYS[e.type];if(!r||!r.length)return!1;var n=r,i=Array.isArray(n),a=0;for(n=i?n:(0,s.default)(n);;){var o;if(i){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}if(e[o])return!0}return!1},e.prototype.create=function(e,t,r,n){return o.default.get({parentPath:this.parentPath,parent:e,container:t,key:r,listKey:n})},e.prototype.maybeQueue=function(e,t){if(this.trap)throw new Error("Infinite cycle detected");this.queue&&(t?this.queue.push(e):this.priorityQueue.push(e))},e.prototype.visitMultiple=function(e,t,r){if(0===e.length)return!1;for(var n=[],i=0;i<e.length;i++){var s=e[i];s&&this.shouldVisit(s)&&n.push(this.create(t,e,i,r))}return this.visitQueue(n)},e.prototype.visitSingle=function(e,t){return!!this.shouldVisit(e[t])&&this.visitQueue([this.create(e,e,t)])},e.prototype.visitQueue=function(e){this.queue=e,this.priorityQueue=[];var t=[],r=!1,n=e,i=Array.isArray(n),a=0;for(n=i?n:(0,s.default)(n);;){var o;if(i){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var u=o;if(u.resync(),0!==u.contexts.length&&u.contexts[u.contexts.length-1]===this||u.pushContext(this),null!==u.key&&(l&&e.length>=1e4&&(this.trap=!0),!(t.indexOf(u.node)>=0))){if(t.push(u.node),u.visit()){r=!0;break}if(this.priorityQueue.length&&(r=this.visitQueue(this.priorityQueue),this.priorityQueue=[],this.queue=e,r))break}}var c=e,p=Array.isArray(c),h=0;for(c=p?c:(0,s.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if((h=c.next()).done)break;f=h.value}f.popContext()}return this.queue=null,r},e.prototype.visit=function(e,t){var r=e[t];return!!r&&(Array.isArray(r)?this.visitMultiple(r,e,t):this.visitSingle(e,t))},e}();r.default=c,t.exports=r.default}).call(this,e("_process"))},{"./path":150,_process:550,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-types":180}],142:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/helpers/classCallCheck"));r.default=function e(t,r){(0,n.default)(this,e),this.file=t,this.options=r},t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134}],143:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r,n,i){if(e){if(t||(t={}),!t.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error(f.get("traverseNeedsParent",e.type));h.explode(t),s.node(e,t,r,n,i)}}function a(e,t){e.node.type===t.type&&(t.has=!0,e.stop())}r.__esModule=!0,r.visitors=r.Hub=r.Scope=r.NodePath=void 0;var o=i(e("babel-runtime/core-js/get-iterator")),u=e("./path");Object.defineProperty(r,"NodePath",{enumerable:!0,get:function(){return i(u).default}});var l=e("./scope");Object.defineProperty(r,"Scope",{enumerable:!0,get:function(){return i(l).default}});var c=e("./hub");Object.defineProperty(r,"Hub",{enumerable:!0,get:function(){return i(c).default}}),r.default=s;var p=i(e("./context")),h=n(e("./visitors")),f=n(e("babel-messages")),d=i(e("lodash/includes")),m=n(e("babel-types")),y=n(e("./cache"));r.visitors=h,s.visitors=h,s.verify=h.verify,s.explode=h.explode,s.NodePath=e("./path"),s.Scope=e("./scope"),s.Hub=e("./hub"),s.cheap=function(e,t){return m.traverseFast(e,t)},s.node=function(e,t,r,n,i,s){var a=m.VISITOR_KEYS[e.type];if(a){var u=new p.default(r,t,n,i),l=a,c=Array.isArray(l),h=0;for(l=c?l:(0,o.default)(l);;){var f;if(c){if(h>=l.length)break;f=l[h++]}else{if((h=l.next()).done)break;f=h.value}var d=f;if((!s||!s[d])&&u.visit(e,d))return}}},s.clearNode=function(e,t){m.removeProperties(e,t),y.path.delete(e)},s.removeProperties=function(e,t){return m.traverseFast(e,s.clearNode,t),e},s.hasType=function(e,t,r,n){if((0,d.default)(n,e.type))return!1;if(e.type===r)return!0;var i={has:!1,type:r};return s(e,{blacklist:n,enter:a},t,i),i.has},(s.clearCache=function(){y.clear()}).clearPath=y.clearPath,s.clearCache.clearScope=y.clearScope,s.copyCache=function(e,t){y.path.has(e)&&y.path.set(t,y.path.get(e))}},{"./cache":140,"./context":141,"./hub":142,"./path":150,"./scope":162,"./visitors":164,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-types":180,"lodash/includes":507}],144:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator"));r.findParent=function(e){for(var t=this;t=t.parentPath;)if(e(t))return t;return null},r.find=function(e){var t=this;do{if(e(t))return t}while(t=t.parentPath);return null},r.getFunctionParent=function(){return this.findParent(function(e){return e.isFunction()||e.isProgram()})},r.getStatementParent=function(){var e=this;do{if(Array.isArray(e.container))return e}while(e=e.parentPath)},r.getEarliestCommonAncestorFrom=function(e){return this.getDeepestCommonAncestorFrom(e,function(e,t,r){var n=void 0,a=s.VISITOR_KEYS[e.type],o=r,u=Array.isArray(o),l=0;for(o=u?o:(0,i.default)(o);;){var c;if(u){if(l>=o.length)break;c=o[l++]}else{if((l=o.next()).done)break;c=l.value}var p=c[t+1];n?p.listKey&&n.listKey===p.listKey&&p.key<n.key?n=p:a.indexOf(n.parentKey)>a.indexOf(p.parentKey)&&(n=p):n=p}return n})},r.getDeepestCommonAncestorFrom=function(e,t){var r=this;if(!e.length)return this;if(1===e.length)return e[0];var n=1/0,s=void 0,a=void 0,o=e.map(function(e){var t=[];do{t.unshift(e)}while((e=e.parentPath)&&e!==r);return t.length<n&&(n=t.length),t}),u=o[0];e:for(var l=0;l<n;l++){var c=u[l],p=o,h=Array.isArray(p),f=0;for(p=h?p:(0,i.default)(p);;){var d;if(h){if(f>=p.length)break;d=p[f++]}else{if((f=p.next()).done)break;d=f.value}if(d[l]!==c)break e}s=l,a=c}if(a)return t?t(a,s,o):a;throw new Error("Couldn't find intersection")},r.getAncestry=function(){var e=this,t=[];do{t.push(e)}while(e=e.parentPath);return t},r.isAncestor=function(e){return e.isDescendant(this)},r.isDescendant=function(e){return!!this.findParent(function(t){return t===e})},r.inType=function(){for(var e=this;e;){var t=arguments,r=Array.isArray(t),n=0;for(t=r?t:(0,i.default)(t);;){var s;if(r){if(n>=t.length)break;s=t[n++]}else{if((n=t.next()).done)break;s=n.value}var a=s;if(e.node.type===a)return!0}e=e.parentPath}return!1},r.inShadow=function(e){var t=this.isFunction()?this:this.findParent(function(e){return e.isFunction()});if(t){if(t.isFunctionExpression()||t.isFunctionDeclaration()){var r=t.node.shadow;if(r&&(!e||!1!==r[e]))return t}else if(t.isArrowFunctionExpression())return t;return null}};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));n(e("./index"))},{"./index":150,"babel-runtime/core-js/get-iterator":120,"babel-types":180}],145:[function(e,t,r){"use strict";r.__esModule=!0,r.shareCommentsWithSiblings=function(){if("string"!=typeof this.key){var e=this.node;if(e){var t=e.trailingComments,r=e.leadingComments;if(t||r){var n=this.getSibling(this.key-1),i=this.getSibling(this.key+1);n.node||(n=i),i.node||(i=n),n.addComments("trailing",r),i.addComments("leading",t)}}}},r.addComment=function(e,t,r){this.addComments(e,[{type:r?"CommentLine":"CommentBlock",value:t}])},r.addComments=function(e,t){if(t){var r=this.node;if(r){var n=e+"Comments";r[n]?r[n]=r[n].concat(t):r[n]=t}}}},{}],146:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator"));r.call=function(e){var t=this.opts;return this.debug(function(){return e}),!(!this.node||!this._call(t[e]))||!!this.node&&this._call(t[this.node.type]&&t[this.node.type][e])},r._call=function(e){if(!e)return!1;var t=e,r=Array.isArray(t),n=0;for(t=r?t:(0,i.default)(t);;){var s;if(r){if(n>=t.length)break;s=t[n++]}else{if((n=t.next()).done)break;s=n.value}var a=s;if(a){var o=this.node;if(!o)return!0;if(a.call(this.state,this,this.state))throw new Error("Unexpected return value from visitor method "+a);if(this.node!==o)return!0;if(this.shouldStop||this.shouldSkip||this.removed)return!0}}return!1},r.isBlacklisted=function(){var e=this.opts.blacklist;return e&&e.indexOf(this.node.type)>-1},r.visit=function(){return!!this.node&&!this.isBlacklisted()&&(!this.opts.shouldSkip||!this.opts.shouldSkip(this))&&(this.call("enter")||this.shouldSkip?(this.debug(function(){return"Skip..."}),this.shouldStop):(this.debug(function(){return"Recursing into..."}),s.default.node(this.node,this.opts,this.scope,this.state,this,this.skipKeys),this.call("exit"),this.shouldStop))},r.skip=function(){this.shouldSkip=!0},r.skipKey=function(e){this.skipKeys[e]=!0},r.stop=function(){this.shouldStop=!0,this.shouldSkip=!0},r.setScope=function(){if(!this.opts||!this.opts.noScope){var e=this.context&&this.context.scope;if(!e)for(var t=this.parentPath;t&&!e;){if(t.opts&&t.opts.noScope)return;e=t.scope,t=t.parentPath}this.scope=this.getScope(e),this.scope&&this.scope.init()}},r.setContext=function(e){return this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.skipKeys={},e&&(this.context=e,this.state=e.state,this.opts=e.opts),this.setScope(),this},r.resync=function(){this.removed||(this._resyncParent(),this._resyncList(),this._resyncKey())},r._resyncParent=function(){this.parentPath&&(this.parent=this.parentPath.node)},r._resyncKey=function(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(var e=0;e<this.container.length;e++)if(this.container[e]===this.node)return this.setKey(e)}else for(var t in this.container)if(this.container[t]===this.node)return this.setKey(t);this.key=null}},r._resyncList=function(){if(this.parent&&this.inList){var e=this.parent[this.listKey];this.container!==e&&(this.container=e||null)}},r._resyncRemoved=function(){null!=this.key&&this.container&&this.container[this.key]===this.node||this._markRemoved()},r.popContext=function(){this.contexts.pop(),this.setContext(this.contexts[this.contexts.length-1])},r.pushContext=function(e){this.contexts.push(e),this.setContext(e)},r.setup=function(e,t,r,n){this.inList=!!r,this.listKey=r,this.parentKey=r||n,this.container=t,this.parentPath=e||this.parentPath,this.setKey(n)},r.setKey=function(e){this.key=e,this.node=this.container[this.key],this.type=this.node&&this.node.type},r.requeue=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;if(!e.removed){var t=this.contexts,r=Array.isArray(t),n=0;for(t=r?t:(0,i.default)(t);;){var s;if(r){if(n>=t.length)break;s=t[n++]}else{if((n=t.next()).done)break;s=n.value}s.maybeQueue(e)}}},r._getQueueContexts=function(){for(var e=this,t=this.contexts;!t.length;)t=(e=e.parentPath).contexts;return t};var s=n(e("../index"))},{"../index":143,"babel-runtime/core-js/get-iterator":120}],147:[function(e,t,r){"use strict";r.__esModule=!0,r.toComputedKey=function(){var e=this.node,t=void 0;if(this.isMemberExpression())t=e.property;else{if(!this.isProperty()&&!this.isMethod())throw new ReferenceError("todo");t=e.key}return e.computed||n.isIdentifier(t)&&(t=n.stringLiteral(t.name)),t},r.ensureBlock=function(){return n.ensureBlock(this.node)},r.arrowFunctionToShadowed=function(){if(this.isArrowFunctionExpression()){this.ensureBlock();var e=this.node;e.expression=!1,e.type="FunctionExpression",e.shadow=e.shadow||!0}};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))},{"babel-types":180}],148:[function(e,t,r){(function(t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/typeof")),s=n(e("babel-runtime/core-js/get-iterator")),a=n(e("babel-runtime/core-js/map"));r.evaluateTruthy=function(){var e=this.evaluate();if(e.confident)return!!e.value},r.evaluate=function(){function e(e){n&&(l=e,n=!1)}function r(a){var l=a.node;if(c.has(l)){var p=c.get(l);return p.resolved?p.value:void e(a)}var h={resolved:!1};c.set(l,h);var f=function(a){if(n){var l=a.node;if(a.isSequenceExpression()){var c=a.get("expressions");return r(c[c.length-1])}if(a.isStringLiteral()||a.isNumericLiteral()||a.isBooleanLiteral())return l.value;if(a.isNullLiteral())return null;if(a.isTemplateLiteral()){for(var p="",h=0,f=a.get("expressions"),d=l.quasis,m=Array.isArray(d),y=0,d=m?d:(0,s.default)(d);;){var g;if(m){if(y>=d.length)break;g=d[y++]}else{if((y=d.next()).done)break;g=y.value}var b=g;if(!n)break;p+=b.value.cooked;var v=f[h++];v&&(p+=String(r(v)))}if(!n)return;return p}if(a.isConditionalExpression()){var x=r(a.get("test"));if(!n)return;return r(x?a.get("consequent"):a.get("alternate"))}if(a.isExpressionWrapper())return r(a.get("expression"));if(a.isMemberExpression()&&!a.parentPath.isCallExpression({callee:l})){var E=a.get("property"),A=a.get("object");if(A.isLiteral()&&E.isIdentifier()){var D=A.node.value,S=void 0===D?"undefined":(0,i.default)(D);if("number"===S||"string"===S)return D[E.node.name]}}if(a.isReferencedIdentifier()){var C=a.scope.getBinding(l.name);if(C&&C.constantViolations.length>0)return e(C.path);if(C&&a.node.start<C.path.node.end)return e(C.path);if(C&&C.hasValue)return C.value;if("undefined"===l.name)return C?e(C.path):void 0;if("Infinity"===l.name)return C?e(C.path):1/0;if("NaN"===l.name)return C?e(C.path):NaN;var _=a.resolve();return _===a?e(a):r(_)}if(a.isUnaryExpression({prefix:!0})){if("void"===l.operator)return;var w=a.get("argument");if("typeof"===l.operator&&(w.isFunction()||w.isClass()))return"function";var k=r(w);if(!n)return;switch(l.operator){case"!":return!k;case"+":return+k;case"-":return-k;case"~":return~k;case"typeof":return void 0===k?"undefined":(0,i.default)(k)}}if(a.isArrayExpression()){for(var F=[],T=a.get("elements"),P=T,B=Array.isArray(P),O=0,P=B?P:(0,s.default)(P);;){var N;if(B){if(O>=P.length)break;N=P[O++]}else{if((O=P.next()).done)break;N=O.value}var j=N;if(!(j=j.evaluate()).confident)return e(j);F.push(j.value)}return F}if(a.isObjectExpression()){for(var I={},L=a.get("properties"),M=L,R=Array.isArray(M),V=0,M=R?M:(0,s.default)(M);;){var U;if(R){if(V>=M.length)break;U=M[V++]}else{if((V=M.next()).done)break;U=V.value}var q=U;if(q.isObjectMethod()||q.isSpreadProperty())return e(q);var G=q.get("key"),X=G;if(q.node.computed){if(!(X=X.evaluate()).confident)return e(G);X=X.value}else X=X.isIdentifier()?X.node.name:X.node.value;var J=q.get("value"),W=J.evaluate();if(!W.confident)return e(J);W=W.value,I[X]=W}return I}if(a.isLogicalExpression()){var K=n,z=r(a.get("left")),Y=n;n=K;var H=r(a.get("right")),$=n;switch(n=Y&&$,l.operator){case"||":if(z&&Y)return n=!0,z;if(!n)return;return z||H;case"&&":if((!z&&Y||!H&&$)&&(n=!0),!n)return;return z&&H}}if(a.isBinaryExpression()){var Q=r(a.get("left"));if(!n)return;var Z=r(a.get("right"));if(!n)return;switch(l.operator){case"-":return Q-Z;case"+":return Q+Z;case"/":return Q/Z;case"*":return Q*Z;case"%":return Q%Z;case"**":return Math.pow(Q,Z);case"<":return Q<Z;case">":return Q>Z;case"<=":return Q<=Z;case">=":return Q>=Z;case"==":return Q==Z;case"!=":return Q!=Z;case"===":return Q===Z;case"!==":return Q!==Z;case"|":return Q|Z;case"&":return Q&Z;case"^":return Q^Z;case"<<":return Q<<Z;case">>":return Q>>Z;case">>>":return Q>>>Z}}if(a.isCallExpression()){var ee=a.get("callee"),te=void 0,re=void 0;if(ee.isIdentifier()&&!a.scope.getBinding(ee.node.name,!0)&&o.indexOf(ee.node.name)>=0&&(re=t[l.callee.name]),ee.isMemberExpression()){var ne=ee.get("object"),ie=ee.get("property");if(ne.isIdentifier()&&ie.isIdentifier()&&o.indexOf(ne.node.name)>=0&&u.indexOf(ie.node.name)<0&&(te=t[ne.node.name],re=te[ie.node.name]),ne.isLiteral()&&ie.isIdentifier()){var se=(0,i.default)(ne.node.value);"string"!==se&&"number"!==se||(te=ne.node.value,re=te[ie.node.name])}}if(re){var ae=a.get("arguments").map(r);if(!n)return;return re.apply(te,ae)}}e(a)}}(a);return n&&(h.resolved=!0,h.value=f),f}var n=!0,l=void 0,c=new a.default,p=r(this);return n||(p=void 0),{confident:n,deopt:l,value:p}};var o=["String","Number","Math"],u=["random"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/map":122,"babel-runtime/helpers/typeof":138}],149:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/object/create")),s=n(e("babel-runtime/core-js/get-iterator"));r.getStatementParent=function(){var e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e},r.getOpposite=function(){return"left"===this.key?this.getSibling("right"):"right"===this.key?this.getSibling("left"):void 0},r.getCompletionRecords=function(){var e=[],t=function(t){t&&(e=e.concat(t.getCompletionRecords()))};if(this.isIfStatement())t(this.get("consequent")),t(this.get("alternate"));else if(this.isDoExpression()||this.isFor()||this.isWhile())t(this.get("body"));else if(this.isProgram()||this.isBlockStatement())t(this.get("body").pop());else{if(this.isFunction())return this.get("body").getCompletionRecords();this.isTryStatement()?(t(this.get("block")),t(this.get("handler")),t(this.get("finalizer"))):e.push(this)}return e},r.getSibling=function(e){return a.default.get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:e})},r.getPrevSibling=function(){return this.getSibling(this.key-1)},r.getNextSibling=function(){return this.getSibling(this.key+1)},r.getAllNextSiblings=function(){for(var e=this.key,t=this.getSibling(++e),r=[];t.node;)r.push(t),t=this.getSibling(++e);return r},r.getAllPrevSiblings=function(){for(var e=this.key,t=this.getSibling(--e),r=[];t.node;)r.push(t),t=this.getSibling(--e);return r},r.get=function(e,t){!0===t&&(t=this.context);var r=e.split(".");return 1===r.length?this._getKey(e,t):this._getPattern(r,t)},r._getKey=function(e,t){var r=this,n=this.node,i=n[e];return Array.isArray(i)?i.map(function(s,o){return a.default.get({listKey:e,parentPath:r,parent:n,container:i,key:o}).setContext(t)}):a.default.get({parentPath:this,parent:n,container:n,key:e}).setContext(t)},r._getPattern=function(e,t){var r=this,n=e,i=Array.isArray(n),a=0;for(n=i?n:(0,s.default)(n);;){var o;if(i){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var u=o;r="."===u?r.parentPath:Array.isArray(r)?r[u]:r.get(u,t)}return r},r.getBindingIdentifiers=function(e){return o.getBindingIdentifiers(this.node,e)},r.getOuterBindingIdentifiers=function(e){return o.getOuterBindingIdentifiers(this.node,e)},r.getBindingIdentifierPaths=function(){for(var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=[].concat(this),n=(0,i.default)(null);r.length;){var s=r.shift();if(s&&s.node){var a=o.getBindingIdentifiers.keys[s.node.type];if(s.isIdentifier())e?(n[s.node.name]=n[s.node.name]||[]).push(s):n[s.node.name]=s;else if(s.isExportDeclaration()){var u=s.get("declaration");u.isDeclaration()&&r.push(u)}else{if(t){if(s.isFunctionDeclaration()){r.push(s.get("id"));continue}if(s.isFunctionExpression())continue}if(a)for(var l=0;l<a.length;l++){var c=a[l],p=s.get(c);(Array.isArray(p)||p.node)&&(r=r.concat(p))}}}}return n},r.getOuterBindingIdentifierPaths=function(e){return this.getBindingIdentifierPaths(e,!0)};var a=n(e("./index")),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))},{"./index":150,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/object/create":125,"babel-types":180}],150:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var s=i(e("babel-runtime/core-js/get-iterator")),a=i(e("babel-runtime/helpers/classCallCheck")),o=n(e("./lib/virtual-types")),u=i(e("debug")),l=i(e("invariant")),c=i(e("../index")),p=i(e("lodash/assign")),h=i(e("../scope")),f=n(e("babel-types")),d=e("../cache"),m=(0,u.default)("babel"),y=function(){function e(t,r){(0,a.default)(this,e),this.parent=r,this.hub=t,this.contexts=[],this.data={},this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.state=null,this.opts=null,this.skipKeys=null,this.parentPath=null,this.context=null,this.container=null,this.listKey=null,this.inList=!1,this.parentKey=null,this.key=null,this.node=null,this.scope=null,this.type=null,this.typeAnnotation=null}return e.get=function(t){var r=t.hub,n=t.parentPath,i=t.parent,s=t.container,a=t.listKey,o=t.key;!r&&n&&(r=n.hub),(0,l.default)(i,"To get a node path the parent needs to exist");var u=s[o],c=d.path.get(i)||[];d.path.has(i)||d.path.set(i,c);for(var p=void 0,h=0;h<c.length;h++){var f=c[h];if(f.node===u){p=f;break}}return p||(p=new e(r,i),c.push(p)),p.setup(n,s,a,o),p},e.prototype.getScope=function(e){var t=e;return this.isScope()&&(t=new h.default(this,e)),t},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e,t){var r=this.data[e];return!r&&t&&(r=this.data[e]=t),r},e.prototype.buildCodeFrameError=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:SyntaxError;return this.hub.file.buildCodeFrameError(this.node,e,t)},e.prototype.traverse=function(e,t){(0,c.default)(this.node,e,this.scope,t,this)},e.prototype.mark=function(e,t){this.hub.file.metadata.marked.push({type:e,message:t,loc:this.node.loc})},e.prototype.set=function(e,t){f.validate(this.node,e,t),this.node[e]=t},e.prototype.getPathLocation=function(){var e=[],t=this;do{var r=t.key;t.inList&&(r=t.listKey+"["+r+"]"),e.unshift(r)}while(t=t.parentPath);return e.join(".")},e.prototype.debug=function(e){m.enabled&&m(this.getPathLocation()+" "+this.type+": "+e())},e}();r.default=y,(0,p.default)(y.prototype,e("./ancestry")),(0,p.default)(y.prototype,e("./inference")),(0,p.default)(y.prototype,e("./replacement")),(0,p.default)(y.prototype,e("./evaluation")),(0,p.default)(y.prototype,e("./conversion")),(0,p.default)(y.prototype,e("./introspection")),(0,p.default)(y.prototype,e("./context")),(0,p.default)(y.prototype,e("./removal")),(0,p.default)(y.prototype,e("./modification")),(0,p.default)(y.prototype,e("./family")),(0,p.default)(y.prototype,e("./comments"));var g=function(){if(v){if(x>=b.length)return"break";E=b[x++]}else{if((x=b.next()).done)return"break";E=x.value}var e=E,t="is"+e;y.prototype[t]=function(e){return f[t](this.node,e)},y.prototype["assert"+e]=function(r){if(!this[t](r))throw new TypeError("Expected node path of type "+e)}},b=f.TYPES,v=Array.isArray(b),x=0;for(b=v?b:(0,s.default)(b);;){var E;if("break"===g())break}var A=function(e){if("_"===e[0])return"continue";f.TYPES.indexOf(e)<0&&f.TYPES.push(e);var t=o[e];y.prototype["is"+e]=function(e){return t.checkPath(this,e)}};for(var D in o){A(D)}t.exports=r.default},{"../cache":140,"../index":143,"../scope":162,"./ancestry":144,"./comments":145,"./context":146,"./conversion":147,"./evaluation":148,"./family":149,"./inference":151,"./introspection":154,"./lib/virtual-types":157,"./modification":158,"./removal":159,"./replacement":160,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-types":180,debug:165,invariant:318,"lodash/assign":488}],151:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e,t,r){if("string"===e)return o.isStringTypeAnnotation(t);if("number"===e)return o.isNumberTypeAnnotation(t);if("boolean"===e)return o.isBooleanTypeAnnotation(t);if("any"===e)return o.isAnyTypeAnnotation(t);if("mixed"===e)return o.isMixedTypeAnnotation(t);if("empty"===e)return o.isEmptyTypeAnnotation(t);if("void"===e)return o.isVoidTypeAnnotation(t);if(r)return!1;throw new Error("Unknown base type "+e)}r.__esModule=!0;var s=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.getTypeAnnotation=function(){if(this.typeAnnotation)return this.typeAnnotation;var e=this._getTypeAnnotation()||o.anyTypeAnnotation();return o.isTypeAnnotation(e)&&(e=e.typeAnnotation),this.typeAnnotation=e},r._getTypeAnnotation=function(){var e=this.node;if(e){if(e.typeAnnotation)return e.typeAnnotation;var t=a[e.type];return t?t.call(this,e):(t=a[this.parentPath.type])&&t.validParent?this.parentPath.getTypeAnnotation():void 0}if("init"===this.key&&this.parentPath.isVariableDeclarator()){var r=this.parentPath.parentPath,n=r.parentPath;return"left"===r.key&&n.isForInStatement()?o.stringTypeAnnotation():"left"===r.key&&n.isForOfStatement()?o.anyTypeAnnotation():o.voidTypeAnnotation()}},r.isBaseType=function(e,t){return i(e,this.getTypeAnnotation(),t)},r.couldBeBaseType=function(e){var t=this.getTypeAnnotation();if(o.isAnyTypeAnnotation(t))return!0;if(o.isUnionTypeAnnotation(t)){var r=t.types,n=Array.isArray(r),a=0;for(r=n?r:(0,s.default)(r);;){var u;if(n){if(a>=r.length)break;u=r[a++]}else{if((a=r.next()).done)break;u=a.value}var l=u;if(o.isAnyTypeAnnotation(l)||i(e,l,!0))return!0}return!1}return i(e,t,!0)},r.baseTypeStrictlyMatches=function(e){var t=this.getTypeAnnotation();if(e=e.getTypeAnnotation(),!o.isAnyTypeAnnotation(t)&&o.isFlowBaseAnnotation(t))return e.type===t.type},r.isGenericType=function(e){var t=this.getTypeAnnotation();return o.isGenericTypeAnnotation(t)&&o.isIdentifier(t.id,{name:e})};var a=n(e("./inferers")),o=n(e("babel-types"))},{"./inferers":153,"babel-runtime/core-js/get-iterator":120,"babel-types":180}],152:[function(e,t,r){"use strict";function n(e,t,r){var n=e.constantViolations.slice();return n.unshift(e.path),n.filter(function(e){var n=(e=e.resolve())._guessExecutionStatusRelativeTo(t);return r&&"function"===n&&r.push(e),"before"===n})}function i(e,t){var r=t.node.operator,n=t.get("right").resolve(),i=t.get("left").resolve(),s=void 0;if(i.isIdentifier({name:e})?s=n:n.isIdentifier({name:e})&&(s=i),s)return"==="===r?s.getTypeAnnotation():o.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(r)>=0?o.numberTypeAnnotation():void 0;if("==="===r){var a=void 0,u=void 0;if(i.isUnaryExpression({operator:"typeof"})?(a=i,u=n):n.isUnaryExpression({operator:"typeof"})&&(a=n,u=i),(u||a)&&(u=u.resolve()).isLiteral()){if("string"==typeof u.node.value&&a.get("argument").isIdentifier({name:e}))return o.createTypeAnnotationBasedOnTypeof(u.node.value)}}}function s(e,t){var r=function(e){for(var t=void 0;t=e.parentPath;){if(t.isIfStatement()||t.isConditionalExpression())return"test"===e.key?void 0:t;e=t}}(e);if(r){var n=[r.get("test")],a=[];do{var u=n.shift().resolve();if(u.isLogicalExpression()&&(n.push(u.get("left")),n.push(u.get("right"))),u.isBinaryExpression()){var l=i(t,u);l&&a.push(l)}}while(n.length);return a.length?{typeAnnotation:o.createUnionTypeAnnotation(a),ifStatement:r}:s(r,t)}}r.__esModule=!0;var a=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.default=function(e){if(this.isReferenced()){var t=this.scope.getBinding(e.name);return t?t.identifier.typeAnnotation?t.identifier.typeAnnotation:function(e,t){var r=e.scope.getBinding(t),i=[];e.typeAnnotation=o.unionTypeAnnotation(i);var u=[],l=n(r,e,u),c=s(e,t);if(c){var p=n(r,c.ifStatement);l=l.filter(function(e){return p.indexOf(e)<0}),i.push(c.typeAnnotation)}if(l.length){var h=l=l.concat(u),f=Array.isArray(h),d=0;for(h=f?h:(0,a.default)(h);;){var m;if(f){if(d>=h.length)break;m=h[d++]}else{if((d=h.next()).done)break;m=d.value}var y=m;i.push(y.getTypeAnnotation())}}if(i.length)return o.createUnionTypeAnnotation(i)}(this,e.name):"undefined"===e.name?o.voidTypeAnnotation():"NaN"===e.name||"Infinity"===e.name?o.numberTypeAnnotation():void e.name}};var o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));t.exports=r.default},{"babel-runtime/core-js/get-iterator":120,"babel-types":180}],153:[function(e,t,r){"use strict";function n(e){return e.typeAnnotation}function i(){return l.genericTypeAnnotation(l.identifier("Array"))}function s(){return i()}function a(){return l.genericTypeAnnotation(l.identifier("Function"))}function o(e){if((e=e.resolve()).isFunction()){if(e.is("async"))return e.is("generator")?l.genericTypeAnnotation(l.identifier("AsyncIterator")):l.genericTypeAnnotation(l.identifier("Promise"));if(e.node.returnType)return e.node.returnType}}r.__esModule=!0,r.ClassDeclaration=r.ClassExpression=r.FunctionDeclaration=r.ArrowFunctionExpression=r.FunctionExpression=r.Identifier=void 0;var u=e("./inferer-reference");Object.defineProperty(r,"Identifier",{enumerable:!0,get:function(){return function(e){return e&&e.__esModule?e:{default:e}}(u).default}}),r.VariableDeclarator=function(){return this.get("id").isIdentifier()?this.get("init").getTypeAnnotation():void 0},r.TypeCastExpression=n,r.NewExpression=function(e){if(this.get("callee").isIdentifier())return l.genericTypeAnnotation(e.callee)},r.TemplateLiteral=function(){return l.stringTypeAnnotation()},r.UnaryExpression=function(e){var t=e.operator;return"void"===t?l.voidTypeAnnotation():l.NUMBER_UNARY_OPERATORS.indexOf(t)>=0?l.numberTypeAnnotation():l.STRING_UNARY_OPERATORS.indexOf(t)>=0?l.stringTypeAnnotation():l.BOOLEAN_UNARY_OPERATORS.indexOf(t)>=0?l.booleanTypeAnnotation():void 0},r.BinaryExpression=function(e){var t=e.operator;if(l.NUMBER_BINARY_OPERATORS.indexOf(t)>=0)return l.numberTypeAnnotation();if(l.BOOLEAN_BINARY_OPERATORS.indexOf(t)>=0)return l.booleanTypeAnnotation();if("+"===t){var r=this.get("right"),n=this.get("left");return n.isBaseType("number")&&r.isBaseType("number")?l.numberTypeAnnotation():n.isBaseType("string")||r.isBaseType("string")?l.stringTypeAnnotation():l.unionTypeAnnotation([l.stringTypeAnnotation(),l.numberTypeAnnotation()])}},r.LogicalExpression=function(){return l.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(),this.get("right").getTypeAnnotation()])},r.ConditionalExpression=function(){return l.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(),this.get("alternate").getTypeAnnotation()])},r.SequenceExpression=function(){return this.get("expressions").pop().getTypeAnnotation()},r.AssignmentExpression=function(){return this.get("right").getTypeAnnotation()},r.UpdateExpression=function(e){var t=e.operator;if("++"===t||"--"===t)return l.numberTypeAnnotation()},r.StringLiteral=function(){return l.stringTypeAnnotation()},r.NumericLiteral=function(){return l.numberTypeAnnotation()},r.BooleanLiteral=function(){return l.booleanTypeAnnotation()},r.NullLiteral=function(){return l.nullLiteralTypeAnnotation()},r.RegExpLiteral=function(){return l.genericTypeAnnotation(l.identifier("RegExp"))},r.ObjectExpression=function(){return l.genericTypeAnnotation(l.identifier("Object"))},r.ArrayExpression=i,r.RestElement=s,r.CallExpression=function(){return o(this.get("callee"))},r.TaggedTemplateExpression=function(){return o(this.get("tag"))};var l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));n.validParent=!0,s.validParent=!0,r.FunctionExpression=a,r.ArrowFunctionExpression=a,r.FunctionDeclaration=a,r.ClassExpression=a,r.ClassDeclaration=a},{"./inferer-reference":152,"babel-types":180}],154:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=this.node&&this.node[e];return t&&Array.isArray(t)?!!t.length:!!t}r.__esModule=!0,r.is=void 0;var s=n(e("babel-runtime/core-js/get-iterator"));r.matchesPattern=function(e,t){function r(e){var t=n[s];return"*"===t||e===t}if(!this.isMemberExpression())return!1;for(var n=e.split("."),i=[this.node],s=0;i.length;){var a=i.shift();if(t&&s===n.length)return!0;if(o.isIdentifier(a)){if(!r(a.name))return!1}else if(o.isLiteral(a)){if(!r(a.value))return!1}else{if(o.isMemberExpression(a)){if(a.computed&&!o.isLiteral(a.property))return!1;i.unshift(a.property),i.unshift(a.object);continue}if(!o.isThisExpression(a))return!1;if(!r("this"))return!1}if(++s>n.length)return!1}return s===n.length},r.has=i,r.isStatic=function(){return this.scope.isStatic(this.node)},r.isnt=function(e){return!this.has(e)},r.equals=function(e,t){return this.node[e]===t},r.isNodeType=function(e){return o.isType(this.type,e)},r.canHaveVariableDeclarationOrExpression=function(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()},r.canSwapBetweenExpressionAndStatement=function(e){return!("body"!==this.key||!this.parentPath.isArrowFunctionExpression())&&(this.isExpression()?o.isBlockStatement(e):!!this.isBlockStatement()&&o.isExpression(e))},r.isCompletionRecord=function(e){var t=this,r=!0;do{var n=t.container;if(t.isFunction()&&!r)return!!e;if(r=!1,Array.isArray(n)&&t.key!==n.length-1)return!1}while((t=t.parentPath)&&!t.isProgram());return!0},r.isStatementOrBlock=function(){return!this.parentPath.isLabeledStatement()&&!o.isBlockStatement(this.container)&&(0,a.default)(o.STATEMENT_OR_BLOCK_KEYS,this.key)},r.referencesImport=function(e,t){if(!this.isReferencedIdentifier())return!1;var r=this.scope.getBinding(this.node.name);if(!r||"module"!==r.kind)return!1;var n=r.path,i=n.parentPath;return!(!i.isImportDeclaration()||i.node.source.value!==e||t&&(!n.isImportDefaultSpecifier()||"default"!==t)&&(!n.isImportNamespaceSpecifier()||"*"!==t)&&(!n.isImportSpecifier()||n.node.imported.name!==t))},r.getSource=function(){var e=this.node;return e.end?this.hub.file.code.slice(e.start,e.end):""},r.willIMaybeExecuteBefore=function(e){return"after"!==this._guessExecutionStatusRelativeTo(e)},r._guessExecutionStatusRelativeTo=function(e){var t=e.scope.getFunctionParent(),r=this.scope.getFunctionParent();if(t.node!==r.node){var n=this._guessExecutionStatusRelativeToDifferentFunctions(t);if(n)return n;e=t.path}var i=e.getAncestry();if(i.indexOf(this)>=0)return"after";var s=this.getAncestry(),a=void 0,u=void 0,l=void 0;for(l=0;l<s.length;l++){var c=s[l];if((u=i.indexOf(c))>=0){a=c;break}}if(!a)return"before";var p=i[u-1],h=s[l-1];return p&&h?p.listKey&&p.container===h.container?p.key>h.key?"before":"after":o.VISITOR_KEYS[p.type].indexOf(p.key)>o.VISITOR_KEYS[h.type].indexOf(h.key)?"before":"after":"before"},r._guessExecutionStatusRelativeToDifferentFunctions=function(e){var t=e.path;if(t.isFunctionDeclaration()){var r=t.scope.getBinding(t.node.id.name);if(!r.references)return"before";var n=r.referencePaths,i=n,a=Array.isArray(i),o=0;for(i=a?i:(0,s.default)(i);;){var u;if(a){if(o>=i.length)break;u=i[o++]}else{if((o=i.next()).done)break;u=o.value}var l=u;if("callee"!==l.key||!l.parentPath.isCallExpression())return}var c=void 0,p=n,h=Array.isArray(p),f=0;for(p=h?p:(0,s.default)(p);;){var d;if(h){if(f>=p.length)break;d=p[f++]}else{if((f=p.next()).done)break;d=f.value}var m=d;if(!m.find(function(e){return e.node===t.node})){var y=this._guessExecutionStatusRelativeTo(m);if(c){if(c!==y)return}else c=y}}return c}},r.resolve=function(e,t){return this._resolve(e,t)||this},r._resolve=function(e,t){if(!(t&&t.indexOf(this)>=0))if((t=t||[]).push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(e,t)}else if(this.isReferencedIdentifier()){var r=this.scope.getBinding(this.node.name);if(!r)return;if(!r.constant)return;if("module"===r.kind)return;if(r.path!==this){var n=r.path.resolve(e,t);if(this.find(function(e){return e.node===n.node}))return;return n}}else{if(this.isTypeCastExpression())return this.get("expression").resolve(e,t);if(e&&this.isMemberExpression()){var i=this.toComputedKey();if(!o.isLiteral(i))return;var a=i.value,u=this.get("object").resolve(e,t);if(u.isObjectExpression()){var l=u.get("properties"),c=Array.isArray(l),p=0;for(l=c?l:(0,s.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if((p=l.next()).done)break;h=p.value}var f=h;if(f.isProperty()){var d=f.get("key"),m=f.isnt("computed")&&d.isIdentifier({name:a});if(m=m||d.isLiteral({value:a}))return f.get("value").resolve(e,t)}}}else if(u.isArrayExpression()&&!isNaN(+a)){var y=u.get("elements")[a];if(y)return y.resolve(e,t)}}}};var a=n(e("lodash/includes")),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.is=i},{"babel-runtime/core-js/get-iterator":120,"babel-types":180,"lodash/includes":507}],155:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator")),s=n(e("babel-runtime/helpers/classCallCheck")),a=e("babel-types"),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(a),u={ReferencedIdentifier:function(e,t){if(!e.isJSXIdentifier()||!a.react.isCompatTag(e.node.name)||e.parentPath.isJSXMemberExpression()){if("this"===e.node.name){var r=e.scope;do{if(r.path.isFunction()&&!r.path.isArrowFunctionExpression())break}while(r=r.parent);r&&t.breakOnScopePaths.push(r.path)}var n=e.scope.getBinding(e.node.name);n&&n===t.scope.getBinding(e.node.name)&&(t.bindings[e.node.name]=n)}}},l=function(){function e(t,r){(0,s.default)(this,e),this.breakOnScopePaths=[],this.bindings={},this.scopes=[],this.scope=r,this.path=t,this.attachAfter=!1}return e.prototype.isCompatibleScope=function(e){for(var t in this.bindings){var r=this.bindings[t];if(!e.bindingIdentifierEquals(t,r.identifier))return!1}return!0},e.prototype.getCompatibleScopes=function(){var e=this.path.scope;do{if(!this.isCompatibleScope(e))break;if(this.scopes.push(e),this.breakOnScopePaths.indexOf(e.path)>=0)break}while(e=e.parent)},e.prototype.getAttachmentPath=function(){var e=this._getAttachmentPath();if(e){var t=e.scope;if(t.path===e&&(t=e.scope.parent),t.path.isProgram()||t.path.isFunction())for(var r in this.bindings)if(t.hasOwnBinding(r)){var n=this.bindings[r];if("param"!==n.kind&&this.getAttachmentParentForPath(n.path).key>e.key){this.attachAfter=!0,e=n.path;var s=n.constantViolations,a=Array.isArray(s),o=0;for(s=a?s:(0,i.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var l=u;this.getAttachmentParentForPath(l).key>e.key&&(e=l)}}}return e.parentPath.isExportDeclaration()&&(e=e.parentPath),e}},e.prototype._getAttachmentPath=function(){var e=this.scopes.pop();if(e){if(e.path.isFunction()){if(this.hasOwnParamBindings(e)){if(this.scope===e)return;return e.path.get("body").get("body")[0]}return this.getNextScopeAttachmentParent()}return e.path.isProgram()?this.getNextScopeAttachmentParent():void 0}},e.prototype.getNextScopeAttachmentParent=function(){var e=this.scopes.pop();if(e)return this.getAttachmentParentForPath(e.path)},e.prototype.getAttachmentParentForPath=function(e){do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement()||e.isVariableDeclarator()&&null!==e.parentPath.node&&e.parentPath.node.declarations.length>1)return e}while(e=e.parentPath)},e.prototype.hasOwnParamBindings=function(e){for(var t in this.bindings)if(e.hasOwnBinding(t)){var r=this.bindings[t];if("param"===r.kind&&r.constant)return!0}return!1},e.prototype.run=function(){var e=this.path.node;if(!e._hoisted){e._hoisted=!0,this.path.traverse(u,this),this.getCompatibleScopes();var t=this.getAttachmentPath();if(t&&t.getFunctionParent()!==this.path.getFunctionParent()){var r=t.scope.generateUidIdentifier("ref"),n=o.variableDeclarator(r,this.path.node);t[this.attachAfter?"insertAfter":"insertBefore"]([t.isVariableDeclarator()?n:o.variableDeclaration("var",[n])]);var i=this.path.parentPath;i.isJSXElement()&&this.path.container===i.node.children&&(r=o.JSXExpressionContainer(r)),this.path.replaceWith(r)}}},e}();r.default=l,t.exports=r.default},{"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-types":180}],156:[function(e,t,r){"use strict";r.__esModule=!0;r.hooks=[function(e,t){if("test"===e.key&&(t.isWhile()||t.isSwitchCase())||"declaration"===e.key&&t.isExportDeclaration()||"body"===e.key&&t.isLabeledStatement()||"declarations"===e.listKey&&t.isVariableDeclaration()&&1===t.node.declarations.length||"expression"===e.key&&t.isExpressionStatement())return t.remove(),!0},function(e,t){if(t.isSequenceExpression()&&1===t.node.expressions.length)return t.replaceWith(t.node.expressions[0]),!0},function(e,t){if(t.isBinary())return"left"===e.key?t.replaceWith(t.node.right):t.replaceWith(t.node.left),!0},function(e,t){if(t.isIfStatement()&&("consequent"===e.key||"alternate"===e.key)||"body"===e.key&&(t.isLoop()||t.isArrowFunctionExpression()))return e.replaceWith({type:"BlockStatement",body:[]}),!0}]},{}],157:[function(e,t,r){"use strict";r.__esModule=!0,r.Flow=r.Pure=r.Generated=r.User=r.Var=r.BlockScoped=r.Referenced=r.Scope=r.Expression=r.Statement=r.BindingIdentifier=r.ReferencedMemberExpression=r.ReferencedIdentifier=void 0;var n=e("babel-types"),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n);r.ReferencedIdentifier={types:["Identifier","JSXIdentifier"],checkPath:function(e,t){var r=e.node,s=e.parent;if(!i.isIdentifier(r,t)&&!i.isJSXMemberExpression(s,t)){if(!i.isJSXIdentifier(r,t))return!1;if(n.react.isCompatTag(r.name))return!1}return i.isReferenced(r,s)}},r.ReferencedMemberExpression={types:["MemberExpression"],checkPath:function(e){var t=e.node,r=e.parent;return i.isMemberExpression(t)&&i.isReferenced(t,r)}},r.BindingIdentifier={types:["Identifier"],checkPath:function(e){var t=e.node,r=e.parent;return i.isIdentifier(t)&&i.isBinding(t,r)}},r.Statement={types:["Statement"],checkPath:function(e){var t=e.node,r=e.parent;if(i.isStatement(t)){if(i.isVariableDeclaration(t)){if(i.isForXStatement(r,{left:t}))return!1;if(i.isForStatement(r,{init:t}))return!1}return!0}return!1}},r.Expression={types:["Expression"],checkPath:function(e){return e.isIdentifier()?e.isReferencedIdentifier():i.isExpression(e.node)}},r.Scope={types:["Scopable"],checkPath:function(e){return i.isScope(e.node,e.parent)}},r.Referenced={checkPath:function(e){return i.isReferenced(e.node,e.parent)}},r.BlockScoped={checkPath:function(e){return i.isBlockScoped(e.node)}},r.Var={types:["VariableDeclaration"],checkPath:function(e){return i.isVar(e.node)}},r.User={checkPath:function(e){return e.node&&!!e.node.loc}},r.Generated={checkPath:function(e){return!e.isUser()}},r.Pure={checkPath:function(e,t){return e.scope.isPure(e.node,t)}},r.Flow={types:["Flow","ImportDeclaration","ExportDeclaration","ImportSpecifier"],checkPath:function(e){var t=e.node;return!!i.isFlow(t)||(i.isImportDeclaration(t)?"type"===t.importKind||"typeof"===t.importKind:i.isExportDeclaration(t)?"type"===t.exportKind:!!i.isImportSpecifier(t)&&("type"===t.importKind||"typeof"===t.importKind))}}},{"babel-types":180}],158:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/typeof")),s=n(e("babel-runtime/core-js/get-iterator"));r.insertBefore=function(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertBefore(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key)this.node&&e.push(this.node),this.replaceExpressionWithStatements(e);else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertBefore(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.push(this.node),this._replaceWith(l.blockStatement(e))}return[this]},r._containerInsert=function(e,t){this.updateSiblingKeys(e,t.length);for(var r=[],n=0;n<t.length;n++){var i=e+n,a=t[n];if(this.container.splice(i,0,a),this.context){var o=this.context.create(this.parent,this.container,i,this.listKey);this.context.queue&&o.pushContext(this.context),r.push(o)}else r.push(u.default.get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:i}))}var l=this._getQueueContexts(),c=r,p=Array.isArray(c),h=0;for(c=p?c:(0,s.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if((h=c.next()).done)break;f=h.value}var d=f;d.setScope(),d.debug(function(){return"Inserted."});var m=l,y=Array.isArray(m),g=0;for(m=y?m:(0,s.default)(m);;){var b;if(y){if(g>=m.length)break;b=m[g++]}else{if((g=m.next()).done)break;b=g.value}b.maybeQueue(d,!0)}}return r},r._containerInsertBefore=function(e){return this._containerInsert(this.key,e)},r._containerInsertAfter=function(e){return this._containerInsert(this.key+1,e)},r._maybePopFromStatements=function(e){var t=e[e.length-1];(l.isIdentifier(t)||l.isExpressionStatement(t)&&l.isIdentifier(t.expression))&&!this.isCompletionRecord()&&e.pop()},r.insertAfter=function(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertAfter(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key){if(this.node){var t=this.scope.generateDeclaredUidIdentifier();e.unshift(l.expressionStatement(l.assignmentExpression("=",t,this.node))),e.push(l.expressionStatement(t))}this.replaceExpressionWithStatements(e)}else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertAfter(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.unshift(this.node),this._replaceWith(l.blockStatement(e))}return[this]},r.updateSiblingKeys=function(e,t){if(this.parent)for(var r=a.path.get(this.parent),n=0;n<r.length;n++){var i=r[n];i.key>=e&&(i.key+=t)}},r._verifyNodeList=function(e){if(!e)return[];e.constructor!==Array&&(e=[e]);for(var t=0;t<e.length;t++){var r=e[t],n=void 0;if(r?"object"!==(void 0===r?"undefined":(0,i.default)(r))?n="contains a non-object node":r.type?r instanceof u.default&&(n="has a NodePath when it expected a raw object"):n="without a type":n="has falsy node",n){var s=Array.isArray(r)?"array":void 0===r?"undefined":(0,i.default)(r);throw new Error("Node list "+n+" with the index of "+t+" and type of "+s)}}return e},r.unshiftContainer=function(e,t){return this._assertUnremoved(),t=this._verifyNodeList(t),u.default.get({parentPath:this,parent:this.node,container:this.node[e],listKey:e,key:0}).insertBefore(t)},r.pushContainer=function(e,t){this._assertUnremoved(),t=this._verifyNodeList(t);var r=this.node[e];return u.default.get({parentPath:this,parent:this.node,container:r,listKey:e,key:r.length}).replaceWithMultiple(t)},r.hoist=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.scope;return new o.default(this,e).run()};var a=e("../cache"),o=n(e("./lib/hoister")),u=n(e("./index")),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))},{"../cache":140,"./index":150,"./lib/hoister":155,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/typeof":138,"babel-types":180}],159:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.remove=function(){this._assertUnremoved(),this.resync(),this._callRemovalHooks()?this._markRemoved():(this.shareCommentsWithSiblings(),this._remove(),this._markRemoved())},r._callRemovalHooks=function(){var e=i.hooks,t=Array.isArray(e),r=0;for(e=t?e:(0,n.default)(e);;){var s;if(t){if(r>=e.length)break;s=e[r++]}else{if((r=e.next()).done)break;s=r.value}if(s(this,this.parentPath))return!0}},r._remove=function(){Array.isArray(this.container)?(this.container.splice(this.key,1),this.updateSiblingKeys(this.key,-1)):this._replaceWith(null)},r._markRemoved=function(){this.shouldSkip=!0,this.removed=!0,this.node=null},r._assertUnremoved=function(){if(this.removed)throw this.buildCodeFrameError("NodePath has been removed so is read-only.")};var i=e("./lib/removal-hooks")},{"./lib/removal-hooks":156,"babel-runtime/core-js/get-iterator":120}],160:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator"));r.replaceWithMultiple=function(e){this.resync(),e=this._verifyNodeList(e),l.inheritLeadingComments(e[0],this.node),l.inheritTrailingComments(e[e.length-1],this.node),this.node=this.container[this.key]=null,this.insertAfter(e),this.node?this.requeue():this.remove()},r.replaceWithSourceString=function(e){this.resync();try{e="("+e+")",e=(0,u.parse)(e)}catch(r){var t=r.loc;throw t&&(r.message+=" - make sure this is an expression.",r.message+="\n"+(0,s.default)(e,t.line,t.column+1)),r}return e=e.program.body[0].expression,a.default.removeProperties(e),this.replaceWith(e)},r.replaceWith=function(e){if(this.resync(),this.removed)throw new Error("You can't replace this node, we've already removed it");if(e instanceof o.default&&(e=e.node),!e)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");if(this.node!==e){if(this.isProgram()&&!l.isProgram(e))throw new Error("You can only replace a Program root node with another Program node");if(Array.isArray(e))throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");if("string"==typeof e)throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");if(this.isNodeType("Statement")&&l.isExpression(e)&&(this.canHaveVariableDeclarationOrExpression()||this.canSwapBetweenExpressionAndStatement(e)||this.parentPath.isExportDefaultDeclaration()||(e=l.expressionStatement(e))),this.isNodeType("Expression")&&l.isStatement(e)&&!this.canHaveVariableDeclarationOrExpression()&&!this.canSwapBetweenExpressionAndStatement(e))return this.replaceExpressionWithStatements([e]);var t=this.node;t&&(l.inheritsComments(e,t),l.removeComments(t)),this._replaceWith(e),this.type=e.type,this.setScope(),this.requeue()}},r._replaceWith=function(e){if(!this.container)throw new ReferenceError("Container is falsy");this.inList?l.validate(this.parent,this.key,[e]):l.validate(this.parent,this.key,e),this.debug(function(){return"Replace with "+(e&&e.type)}),this.node=this.container[this.key]=e},r.replaceExpressionWithStatements=function(e){this.resync();var t=l.toSequenceExpression(e,this.scope);if(l.isSequenceExpression(t)){var r=t.expressions;r.length>=2&&this.parentPath.isExpressionStatement()&&this._maybePopFromStatements(r),1===r.length?this.replaceWith(r[0]):this.replaceWith(t)}else{if(!t){var n=l.functionExpression(null,[],l.blockStatement(e));n.shadow=!0,this.replaceWith(l.callExpression(n,[])),this.traverse(c);var s=this.get("callee").getCompletionRecords(),a=Array.isArray(s),o=0;for(s=a?s:(0,i.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var p=u;if(p.isExpressionStatement()){var h=p.findParent(function(e){return e.isLoop()});if(h){var f=h.getData("expressionReplacementReturnUid");if(f)f=l.identifier(f.name);else{var d=this.get("callee");f=d.scope.generateDeclaredUidIdentifier("ret"),d.get("body").pushContainer("body",l.returnStatement(f)),h.setData("expressionReplacementReturnUid",f)}p.get("expression").replaceWith(l.assignmentExpression("=",f,p.node.expression))}else p.replaceWith(l.returnStatement(p.node.expression))}}return this.node}this.replaceWith(t)}},r.replaceInline=function(e){return this.resync(),Array.isArray(e)?Array.isArray(this.container)?(e=this._verifyNodeList(e),this._containerInsertAfter(e),this.remove()):this.replaceWithMultiple(e):this.replaceWith(e)};var s=n(e("babel-code-frame")),a=n(e("../index")),o=n(e("./index")),u=e("babylon"),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),c={Function:function(e){e.skip()},VariableDeclaration:function(e){if("var"===e.node.kind){var t=e.getBindingIdentifiers();for(var r in t)e.scope.push({id:t[r]});var n=[],s=e.node.declarations,a=Array.isArray(s),o=0;for(s=a?s:(0,i.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var c=u;c.init&&n.push(l.expressionStatement(l.assignmentExpression("=",c.id,c.init)))}e.replaceWithMultiple(n)}}}},{"../index":143,"./index":150,"babel-code-frame":21,"babel-runtime/core-js/get-iterator":120,"babel-types":180,babylon:188}],161:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/helpers/classCallCheck")),i=function(){function e(t){var r=t.existing,i=t.identifier,s=t.scope,a=t.path,o=t.kind;(0,n.default)(this,e),this.identifier=i,this.scope=s,this.path=a,this.kind=o,this.constantViolations=[],this.constant=!0,this.referencePaths=[],this.referenced=!1,this.references=0,this.clearValue(),r&&(this.constantViolations=[].concat(r.path,r.constantViolations,this.constantViolations))}return e.prototype.deoptValue=function(){this.clearValue(),this.hasDeoptedValue=!0},e.prototype.setValue=function(e){this.hasDeoptedValue||(this.hasValue=!0,this.value=e)},e.prototype.clearValue=function(){this.hasDeoptedValue=!1,this.hasValue=!1,this.value=null},e.prototype.reassign=function(e){this.constant=!1,-1===this.constantViolations.indexOf(e)&&this.constantViolations.push(e)},e.prototype.reference=function(e){-1===this.referencePaths.indexOf(e)&&(this.referenced=!0,this.references++,this.referencePaths.push(e))},e.prototype.dereference=function(){this.references--,this.referenced=!!this.references},e}();r.default=i,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134}],162:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(v.isModuleDeclaration(e))if(e.source)s(e.source,t);else if(e.specifiers&&e.specifiers.length){var r=e.specifiers,n=Array.isArray(r),i=0;for(r=n?r:(0,c.default)(r);;){var a;if(n){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}s(a,t)}}else e.declaration&&s(e.declaration,t);else if(v.isModuleSpecifier(e))s(e.local,t);else if(v.isMemberExpression(e))s(e.object,t),s(e.property,t);else if(v.isIdentifier(e))t.push(e.name);else if(v.isLiteral(e))t.push(e.value);else if(v.isCallExpression(e))s(e.callee,t);else if(v.isObjectExpression(e)||v.isObjectPattern(e)){var o=e.properties,u=Array.isArray(o),l=0;for(o=u?o:(0,c.default)(o);;){var p;if(u){if(l>=o.length)break;p=o[l++]}else{if((l=o.next()).done)break;p=l.value}var h=p;s(h.key||h.argument,t)}}}r.__esModule=!0;var a=i(e("babel-runtime/core-js/object/keys")),o=i(e("babel-runtime/core-js/object/create")),u=i(e("babel-runtime/core-js/map")),l=i(e("babel-runtime/helpers/classCallCheck")),c=i(e("babel-runtime/core-js/get-iterator")),p=i(e("lodash/includes")),h=i(e("lodash/repeat")),f=i(e("./lib/renamer")),d=i(e("../index")),m=i(e("lodash/defaults")),y=n(e("babel-messages")),g=i(e("./binding")),b=i(e("globals")),v=n(e("babel-types")),x=e("../cache"),E=0,A={For:function(e){var t=v.FOR_INIT_KEYS,r=Array.isArray(t),n=0;for(t=r?t:(0,c.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i,a=e.get(s);a.isVar()&&e.scope.getFunctionParent().registerBinding("var",a)}},Declaration:function(e){e.isBlockScoped()||e.isExportDeclaration()&&e.get("declaration").isDeclaration()||e.scope.getFunctionParent().registerDeclaration(e)},ReferencedIdentifier:function(e,t){t.references.push(e)},ForXStatement:function(e,t){var r=e.get("left");(r.isPattern()||r.isIdentifier())&&t.constantViolations.push(r)},ExportDeclaration:{exit:function(e){var t=e.node,r=e.scope,n=t.declaration;if(v.isClassDeclaration(n)||v.isFunctionDeclaration(n)){var i=n.id;if(!i)return;var s=r.getBinding(i.name);s&&s.reference(e)}else if(v.isVariableDeclaration(n)){var a=n.declarations,o=Array.isArray(a),u=0;for(a=o?a:(0,c.default)(a);;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var p=l,h=v.getBindingIdentifiers(p);for(var f in h){var d=r.getBinding(f);d&&d.reference(e)}}}}},LabeledStatement:function(e){e.scope.getProgramParent().addGlobal(e.node),e.scope.getBlockParent().registerDeclaration(e)},AssignmentExpression:function(e,t){t.assignments.push(e)},UpdateExpression:function(e,t){t.constantViolations.push(e.get("argument"))},UnaryExpression:function(e,t){"delete"===e.node.operator&&t.constantViolations.push(e.get("argument"))},BlockScoped:function(e){var t=e.scope;t.path===e&&(t=t.parent),t.getBlockParent().registerDeclaration(e)},ClassDeclaration:function(e){var t=e.node.id;if(t){var r=t.name;e.scope.bindings[r]=e.scope.getBinding(r)}},Block:function(e){var t=e.get("body"),r=Array.isArray(t),n=0;for(t=r?t:(0,c.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;s.isFunctionDeclaration()&&e.scope.getBlockParent().registerDeclaration(s)}}},D=0,S=function(){function e(t,r){if((0,l.default)(this,e),r&&r.block===t.node)return r;var n=function(e,t,r){var n=x.scope.get(e.node)||[],i=n,s=Array.isArray(i),a=0;for(i=s?i:(0,c.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if((a=i.next()).done)break;o=a.value}var u=o;if(u.parent===t&&u.path===e)return u}n.push(r),x.scope.has(e.node)||x.scope.set(e.node,n)}(t,r,this);if(n)return n;this.uid=D++,this.parent=r,this.hub=t.hub,this.parentBlock=t.parent,this.block=t.node,this.path=t,this.labels=new u.default}return e.prototype.traverse=function(e,t,r){(0,d.default)(e,t,this,r,this.path)},e.prototype.generateDeclaredUidIdentifier=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp",t=this.generateUidIdentifier(e);return this.push({id:t}),t},e.prototype.generateUidIdentifier=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp";return v.identifier(this.generateUid(e))},e.prototype.generateUid=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp";e=v.toIdentifier(e).replace(/^_+/,"").replace(/[0-9]+$/g,"");var t=void 0,r=0;do{t=this._generateUid(e,r),r++}while(this.hasLabel(t)||this.hasBinding(t)||this.hasGlobal(t)||this.hasReference(t));var n=this.getProgramParent();return n.references[t]=!0,n.uids[t]=!0,t},e.prototype._generateUid=function(e,t){var r=e;return t>1&&(r+=t),"_"+r},e.prototype.generateUidIdentifierBasedOnNode=function(e,t){var r=e;v.isAssignmentExpression(e)?r=e.left:v.isVariableDeclarator(e)?r=e.id:(v.isObjectProperty(r)||v.isObjectMethod(r))&&(r=r.key);var n=[];s(r,n);var i=n.join("$");return i=i.replace(/^_/,"")||t||"ref",this.generateUidIdentifier(i.slice(0,20))},e.prototype.isStatic=function(e){if(v.isThisExpression(e)||v.isSuper(e))return!0;if(v.isIdentifier(e)){var t=this.getBinding(e.name);return t?t.constant:this.hasBinding(e.name)}return!1},e.prototype.maybeGenerateMemoised=function(e,t){if(this.isStatic(e))return null;var r=this.generateUidIdentifierBasedOnNode(e);return t||this.push({id:r}),r},e.prototype.checkBlockScopedCollisions=function(e,t,r,n){if("param"!==t&&("hoisted"!==t||"let"!==e.kind)){if("let"===t||"let"===e.kind||"const"===e.kind||"module"===e.kind||"param"===e.kind&&("let"===t||"const"===t))throw this.hub.file.buildCodeFrameError(n,y.get("scopeDuplicateDeclaration",r),TypeError)}},e.prototype.rename=function(e,t,r){var n=this.getBinding(e);if(n)return t=t||this.generateUidIdentifier(e).name,new f.default(n,e,t).rename(r)},e.prototype._renameFromMap=function(e,t,r,n){e[t]&&(e[r]=n,e[t]=null)},e.prototype.dump=function(){var e=(0,h.default)("-",60);console.log(e);var t=this;do{console.log("#",t.block.type);for(var r in t.bindings){var n=t.bindings[r];console.log(" -",r,{constant:n.constant,references:n.references,violations:n.constantViolations.length,kind:n.kind})}}while(t=t.parent);console.log(e)},e.prototype.toArray=function(e,t){var r=this.hub.file;if(v.isIdentifier(e)){var n=this.getBinding(e.name);if(n&&n.constant&&n.path.isGenericType("Array"))return e}if(v.isArrayExpression(e))return e;if(v.isIdentifier(e,{name:"arguments"}))return v.callExpression(v.memberExpression(v.memberExpression(v.memberExpression(v.identifier("Array"),v.identifier("prototype")),v.identifier("slice")),v.identifier("call")),[e]);var i="toArray",s=[e];return!0===t?i="toConsumableArray":t&&(s.push(v.numericLiteral(t)),i="slicedToArray"),v.callExpression(r.addHelper(i),s)},e.prototype.hasLabel=function(e){return!!this.getLabel(e)},e.prototype.getLabel=function(e){return this.labels.get(e)},e.prototype.registerLabel=function(e){this.labels.set(e.node.label.name,e)},e.prototype.registerDeclaration=function(e){if(e.isLabeledStatement())this.registerLabel(e);else if(e.isFunctionDeclaration())this.registerBinding("hoisted",e.get("id"),e);else if(e.isVariableDeclaration()){var t=e.get("declarations"),r=Array.isArray(t),n=0;for(t=r?t:(0,c.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;this.registerBinding(e.node.kind,s)}}else if(e.isClassDeclaration())this.registerBinding("let",e);else if(e.isImportDeclaration()){var a=e.get("specifiers"),o=Array.isArray(a),u=0;for(a=o?a:(0,c.default)(a);;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var p=l;this.registerBinding("module",p)}}else if(e.isExportDeclaration()){var h=e.get("declaration");(h.isClassDeclaration()||h.isFunctionDeclaration()||h.isVariableDeclaration())&&this.registerDeclaration(h)}else this.registerBinding("unknown",e)},e.prototype.buildUndefinedNode=function(){return this.hasBinding("undefined")?v.unaryExpression("void",v.numericLiteral(0),!0):v.identifier("undefined")},e.prototype.registerConstantViolation=function(e){var t=e.getBindingIdentifiers();for(var r in t){var n=this.getBinding(r);n&&n.reassign(e)}},e.prototype.registerBinding=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;if(!e)throw new ReferenceError("no `kind`");if(t.isVariableDeclaration()){var n=t.get("declarations"),i=Array.isArray(n),s=0;for(n=i?n:(0,c.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a;this.registerBinding(e,o)}}else{var u=this.getProgramParent(),l=t.getBindingIdentifiers(!0);for(var p in l){var h=l[p],f=Array.isArray(h),d=0;for(h=f?h:(0,c.default)(h);;){var m;if(f){if(d>=h.length)break;m=h[d++]}else{if((d=h.next()).done)break;m=d.value}var y=m,b=this.getOwnBinding(p);if(b){if(b.identifier===y)continue;this.checkBlockScopedCollisions(b,e,p,y)}b&&b.path.isFlow()&&(b=null),u.references[p]=!0,this.bindings[p]=new g.default({identifier:y,existing:b,scope:this,path:r,kind:e})}}}},e.prototype.addGlobal=function(e){this.globals[e.name]=e},e.prototype.hasUid=function(e){var t=this;do{if(t.uids[e])return!0}while(t=t.parent);return!1},e.prototype.hasGlobal=function(e){var t=this;do{if(t.globals[e])return!0}while(t=t.parent);return!1},e.prototype.hasReference=function(e){var t=this;do{if(t.references[e])return!0}while(t=t.parent);return!1},e.prototype.isPure=function(e,t){if(v.isIdentifier(e)){var r=this.getBinding(e.name);return!!r&&(!t||r.constant)}if(v.isClass(e))return!(e.superClass&&!this.isPure(e.superClass,t))&&this.isPure(e.body,t);if(v.isClassBody(e)){var n=e.body,i=Array.isArray(n),s=0;for(n=i?n:(0,c.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a;if(!this.isPure(o,t))return!1}return!0}if(v.isBinary(e))return this.isPure(e.left,t)&&this.isPure(e.right,t);if(v.isArrayExpression(e)){var u=e.elements,l=Array.isArray(u),p=0;for(u=l?u:(0,c.default)(u);;){var h;if(l){if(p>=u.length)break;h=u[p++]}else{if((p=u.next()).done)break;h=p.value}var f=h;if(!this.isPure(f,t))return!1}return!0}if(v.isObjectExpression(e)){var d=e.properties,m=Array.isArray(d),y=0;for(d=m?d:(0,c.default)(d);;){var g;if(m){if(y>=d.length)break;g=d[y++]}else{if((y=d.next()).done)break;g=y.value}var b=g;if(!this.isPure(b,t))return!1}return!0}return v.isClassMethod(e)?!(e.computed&&!this.isPure(e.key,t))&&("get"!==e.kind&&"set"!==e.kind):v.isClassProperty(e)||v.isObjectProperty(e)?!(e.computed&&!this.isPure(e.key,t))&&this.isPure(e.value,t):v.isUnaryExpression(e)?this.isPure(e.argument,t):v.isPureish(e)},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e){var t=this;do{var r=t.data[e];if(null!=r)return r}while(t=t.parent)},e.prototype.removeData=function(e){var t=this;do{null!=t.data[e]&&(t.data[e]=null)}while(t=t.parent)},e.prototype.init=function(){this.references||this.crawl()},e.prototype.crawl=function(){E++,this._crawl(),E--},e.prototype._crawl=function(){var e=this.path;if(this.references=(0,o.default)(null),this.bindings=(0,o.default)(null),this.globals=(0,o.default)(null),this.uids=(0,o.default)(null),this.data=(0,o.default)(null),e.isLoop()){var t=v.FOR_INIT_KEYS,r=Array.isArray(t),n=0;for(t=r?t:(0,c.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i,a=e.get(s);a.isBlockScoped()&&this.registerBinding(a.node.kind,a)}}if(e.isFunctionExpression()&&e.has("id")&&(e.get("id").node[v.NOT_LOCAL_BINDING]||this.registerBinding("local",e.get("id"),e)),e.isClassExpression()&&e.has("id")&&(e.get("id").node[v.NOT_LOCAL_BINDING]||this.registerBinding("local",e)),e.isFunction()){var u=e.get("params"),l=Array.isArray(u),p=0;for(u=l?u:(0,c.default)(u);;){var h;if(l){if(p>=u.length)break;h=u[p++]}else{if((p=u.next()).done)break;h=p.value}var f=h;this.registerBinding("param",f)}}e.isCatchClause()&&this.registerBinding("let",e);if(!this.getProgramParent().crawling){var d={references:[],constantViolations:[],assignments:[]};this.crawling=!0,e.traverse(A,d),this.crawling=!1;var m=d.assignments,y=Array.isArray(m),g=0;for(m=y?m:(0,c.default)(m);;){var b;if(y){if(g>=m.length)break;b=m[g++]}else{if((g=m.next()).done)break;b=g.value}var x=b,E=x.getBindingIdentifiers(),D=void 0;for(var S in E)x.scope.getBinding(S)||(D=D||x.scope.getProgramParent()).addGlobal(E[S]);x.scope.registerConstantViolation(x)}var C=d.references,_=Array.isArray(C),w=0;for(C=_?C:(0,c.default)(C);;){var k;if(_){if(w>=C.length)break;k=C[w++]}else{if((w=C.next()).done)break;k=w.value}var F=k,T=F.scope.getBinding(F.node.name);T?T.reference(F):F.scope.getProgramParent().addGlobal(F.node)}var P=d.constantViolations,B=Array.isArray(P),O=0;for(P=B?P:(0,c.default)(P);;){var N;if(B){if(O>=P.length)break;N=P[O++]}else{if((O=P.next()).done)break;N=O.value}var j=N;j.scope.registerConstantViolation(j)}}},e.prototype.push=function(e){var t=this.path;t.isBlockStatement()||t.isProgram()||(t=this.getBlockParent().path),t.isSwitchStatement()&&(t=this.getFunctionParent().path),(t.isLoop()||t.isCatchClause()||t.isFunction())&&(v.ensureBlock(t.node),t=t.get("body"));var r=e.unique,n=e.kind||"var",i=null==e._blockHoist?2:e._blockHoist,s="declaration:"+n+":"+i,a=!r&&t.getData(s);if(!a){var o=v.variableDeclaration(n,[]);o._generated=!0,o._blockHoist=i;a=t.unshiftContainer("body",[o])[0],r||t.setData(s,a)}var u=v.variableDeclarator(e.id,e.init);a.node.declarations.push(u),this.registerBinding(n,a.get("declarations").pop())},e.prototype.getProgramParent=function(){var e=this;do{if(e.path.isProgram())return e}while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getFunctionParent=function(){var e=this;do{if(e.path.isFunctionParent())return e}while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getBlockParent=function(){var e=this;do{if(e.path.isBlockParent())return e}while(e=e.parent);throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...")},e.prototype.getAllBindings=function(){var e=(0,o.default)(null),t=this;do{(0,m.default)(e,t.bindings),t=t.parent}while(t);return e},e.prototype.getAllBindingsOfKind=function(){var e=(0,o.default)(null),t=arguments,r=Array.isArray(t),n=0;for(t=r?t:(0,c.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i,a=this;do{for(var u in a.bindings){var l=a.bindings[u];l.kind===s&&(e[u]=l)}a=a.parent}while(a)}return e},e.prototype.bindingIdentifierEquals=function(e,t){return this.getBindingIdentifier(e)===t},e.prototype.warnOnFlowBinding=function(e){return 0===E&&e&&e.path.isFlow()&&console.warn("\n You or one of the Babel plugins you are using are using Flow declarations as bindings.\n Support for this will be removed in version 7. To find out the caller, grep for this\n message and change it to a `console.trace()`.\n "),e},e.prototype.getBinding=function(e){var t=this;do{var r=t.getOwnBinding(e);if(r)return this.warnOnFlowBinding(r)}while(t=t.parent)},e.prototype.getOwnBinding=function(e){return this.warnOnFlowBinding(this.bindings[e])},e.prototype.getBindingIdentifier=function(e){var t=this.getBinding(e);return t&&t.identifier},e.prototype.getOwnBindingIdentifier=function(e){var t=this.bindings[e];return t&&t.identifier},e.prototype.hasOwnBinding=function(e){return!!this.getOwnBinding(e)},e.prototype.hasBinding=function(t,r){return!!t&&(!!this.hasOwnBinding(t)||(!!this.parentHasBinding(t,r)||(!!this.hasUid(t)||(!(r||!(0,p.default)(e.globals,t))||!(r||!(0,p.default)(e.contextVariables,t))))))},e.prototype.parentHasBinding=function(e,t){return this.parent&&this.parent.hasBinding(e,t)},e.prototype.moveBindingTo=function(e,t){var r=this.getBinding(e);r&&(r.scope.removeOwnBinding(e),r.scope=t,t.bindings[e]=r)},e.prototype.removeOwnBinding=function(e){delete this.bindings[e]},e.prototype.removeBinding=function(e){var t=this.getBinding(e);t&&t.scope.removeOwnBinding(e);var r=this;do{r.uids[e]&&(r.uids[e]=!1)}while(r=r.parent)},e}();S.globals=(0,a.default)(b.default.builtin),S.contextVariables=["arguments","undefined","Infinity","NaN"],r.default=S,t.exports=r.default},{"../cache":140,"../index":143,"./binding":161,"./lib/renamer":163,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/map":122,"babel-runtime/core-js/object/create":125,"babel-runtime/core-js/object/keys":127,"babel-runtime/helpers/classCallCheck":134,"babel-types":180,globals:168,"lodash/defaults":495,"lodash/includes":507,"lodash/repeat":530}],163:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=(n(e("../binding")),function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))),a={ReferencedIdentifier:function(e,t){var r=e.node;r.name===t.oldName&&(r.name=t.newName)},Scope:function(e,t){e.scope.bindingIdentifierEquals(t.oldName,t.binding.identifier)||e.skip()},"AssignmentExpression|Declaration":function(e,t){var r=e.getOuterBindingIdentifiers();for(var n in r)n===t.oldName&&(r[n].name=t.newName)}},o=function(){function e(t,r,n){(0,i.default)(this,e),this.newName=n,this.oldName=r,this.binding=t}return e.prototype.maybeConvertFromExportDeclaration=function(e){var t=e.parentPath.isExportDeclaration()&&e.parentPath;if(t){var r=t.isExportDefaultDeclaration();r&&(e.isFunctionDeclaration()||e.isClassDeclaration())&&!e.node.id&&(e.node.id=e.scope.generateUidIdentifier("default"));var n=e.getOuterBindingIdentifiers(),i=[];for(var a in n){var o=a===this.oldName?this.newName:a,u=r?"default":a;i.push(s.exportSpecifier(s.identifier(o),s.identifier(u)))}if(i.length){var l=s.exportNamedDeclaration(null,i);e.isFunctionDeclaration()&&(l._blockHoist=3),t.insertAfter(l),t.replaceWith(e.node)}}},e.prototype.rename=function(e){var t=this.binding,r=this.oldName,n=this.newName,i=t.scope,s=t.path.find(function(e){return e.isDeclaration()||e.isFunctionExpression()});s&&this.maybeConvertFromExportDeclaration(s),i.traverse(e||i.block,a,this),e||(i.removeOwnBinding(r),i.bindings[n]=t,this.binding.identifier.name=n),t.type},e}();r.default=o,t.exports=r.default},{"../binding":161,"babel-runtime/helpers/classCallCheck":134,"babel-types":180}],164:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){if(e._exploded)return e;e._exploded=!0;for(var t in e)if(!l(t)){var r=t.split("|");if(1!==r.length){var n=e[t];delete e[t];var i=r,s=Array.isArray(i),o=0;for(i=s?i:(0,f.default)(i);;){var p;if(s){if(o>=i.length)break;p=i[o++]}else{if((o=i.next()).done)break;p=o.value}e[p]=n}}}a(e),delete e.__esModule,function(e){for(var t in e)if(!l(t)){var r=e[t];"function"==typeof r&&(e[t]={enter:r})}}(e),u(e);var m=(0,h.default)(e),b=Array.isArray(m),v=0;for(m=b?m:(0,f.default)(m);;){var x;if(b){if(v>=m.length)break;x=m[v++]}else{if((v=m.next()).done)break;x=v.value}var E=x;if(!l(E)){var A=d[E];if(A){var D=e[E];for(var S in D)D[S]=function(e,t){var r=function(r){if(e.checkPath(r))return t.apply(this,arguments)};return r.toString=function(){return t.toString()},r}(A,D[S]);if(delete e[E],A.types){var C=A.types,_=Array.isArray(C),w=0;for(C=_?C:(0,f.default)(C);;){var k;if(_){if(w>=C.length)break;k=C[w++]}else{if((w=C.next()).done)break;k=w.value}var F=k;e[F]?c(e[F],D):e[F]=D}}else c(e,D)}}}for(var T in e)if(!l(T)){var P=e[T],B=y.FLIPPED_ALIAS_KEYS[T],O=y.DEPRECATED_KEYS[T];if(O&&(console.trace("Visitor defined for "+T+" but it has been renamed to "+O),B=[O]),B){delete e[T];var N=B,j=Array.isArray(N),I=0;for(N=j?N:(0,f.default)(N);;){var L;if(j){if(I>=N.length)break;L=N[I++]}else{if((I=N.next()).done)break;L=I.value}var M=L,R=e[M];R?c(R,P):e[M]=(0,g.default)(P)}}}for(var V in e)l(V)||u(e[V]);return e}function a(e){if(!e._verified){if("function"==typeof e)throw new Error(m.get("traverseVerifyRootFunction"));for(var t in e)if("enter"!==t&&"exit"!==t||o(t,e[t]),!l(t)){if(y.TYPES.indexOf(t)<0)throw new Error(m.get("traverseVerifyNodeType",t));var r=e[t];if("object"===(void 0===r?"undefined":(0,p.default)(r)))for(var n in r){if("enter"!==n&&"exit"!==n)throw new Error(m.get("traverseVerifyVisitorProperty",t,n));o(t+"."+n,r[n])}}e._verified=!0}}function o(e,t){var r=[].concat(t),n=Array.isArray(r),i=0;for(r=n?r:(0,f.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;if("function"!=typeof a)throw new TypeError("Non-function found defined in "+e+" with type "+(void 0===a?"undefined":(0,p.default)(a)))}}function u(e){e.enter&&!Array.isArray(e.enter)&&(e.enter=[e.enter]),e.exit&&!Array.isArray(e.exit)&&(e.exit=[e.exit])}function l(e){return"_"===e[0]||("enter"===e||"exit"===e||"shouldSkip"===e||("blacklist"===e||"noScope"===e||"skipKeys"===e))}function c(e,t){for(var r in t)e[r]=[].concat(e[r]||[],t[r])}r.__esModule=!0;var p=i(e("babel-runtime/helpers/typeof")),h=i(e("babel-runtime/core-js/object/keys")),f=i(e("babel-runtime/core-js/get-iterator"));r.explode=s,r.verify=a,r.merge=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2],n={},i=0;i<e.length;i++){var a=e[i],o=t[i];s(a);for(var u in a){var l=a[u];(o||r)&&(l=function(e,t,r){var n={},i=function(i){var s=e[i];if(!Array.isArray(s))return"continue";s=s.map(function(e){var n=e;return t&&(n=function(r){return e.call(t,r,t)}),r&&(n=r(t.key,i,n)),n}),n[i]=s};for(var s in e)i(s);return n}(l,o,r)),c(n[u]=n[u]||{},l)}}return n};var d=n(e("./path/lib/virtual-types")),m=n(e("babel-messages")),y=n(e("babel-types")),g=i(e("lodash/clone"))},{"./path/lib/virtual-types":157,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/object/keys":127,"babel-runtime/helpers/typeof":138,"babel-types":180,"lodash/clone":491}],165:[function(e,t,r){(function(n){function i(){var e;try{e=r.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}(r=t.exports=e("./debug")).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},r.formatArgs=function(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff),t){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,s=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(s=i))}),e.splice(s,0,n)}},r.save=function(e){try{null==e?r.storage.removeItem("debug"):r.storage.debug=e}catch(e){}},r.load=i,r.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},r.enable(i())}).call(this,e("_process"))},{"./debug":166,_process:550}],166:[function(e,t,r){arguments[4][60][0].apply(r,arguments)},{dup:60,ms:543}],167:[function(e,t,r){t.exports={builtin:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,DataView:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,escape:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,unescape:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},es5:{Array:!1,Boolean:!1,constructor:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,escape:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,propertyIsEnumerable:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,toLocaleString:!1,toString:!1,TypeError:!1,undefined:!1,unescape:!1,URIError:!1,valueOf:!1},es6:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,DataView:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,escape:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,unescape:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},browser:{addEventListener:!1,alert:!1,AnalyserNode:!1,Animation:!1,AnimationEffectReadOnly:!1,AnimationEffectTiming:!1,AnimationEffectTimingReadOnly:!1,AnimationEvent:!1,AnimationPlaybackEvent:!1,AnimationTimeline:!1,applicationCache:!1,ApplicationCache:!1,ApplicationCacheErrorEvent:!1,atob:!1,Attr:!1,Audio:!1,AudioBuffer:!1,AudioBufferSourceNode:!1,AudioContext:!1,AudioDestinationNode:!1,AudioListener:!1,AudioNode:!1,AudioParam:!1,AudioProcessingEvent:!1,AutocompleteErrorEvent:!1,BarProp:!1,BatteryManager:!1,BeforeUnloadEvent:!1,BiquadFilterNode:!1,Blob:!1,blur:!1,btoa:!1,Cache:!1,caches:!1,CacheStorage:!1,cancelAnimationFrame:!1,cancelIdleCallback:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CDATASection:!1,ChannelMergerNode:!1,ChannelSplitterNode:!1,CharacterData:!1,clearInterval:!1,clearTimeout:!1,clientInformation:!1,ClientRect:!1,ClientRectList:!1,ClipboardEvent:!1,close:!1,closed:!1,CloseEvent:!1,Comment:!1,CompositionEvent:!1,confirm:!1,console:!1,ConvolverNode:!1,createImageBitmap:!1,Credential:!1,CredentialsContainer:!1,crypto:!1,Crypto:!1,CryptoKey:!1,CSS:!1,CSSAnimation:!1,CSSFontFaceRule:!1,CSSImportRule:!1,CSSKeyframeRule:!1,CSSKeyframesRule:!1,CSSMediaRule:!1,CSSPageRule:!1,CSSRule:!1,CSSRuleList:!1,CSSStyleDeclaration:!1,CSSStyleRule:!1,CSSStyleSheet:!1,CSSSupportsRule:!1,CSSTransition:!1,CSSUnknownRule:!1,CSSViewportRule:!1,customElements:!1,CustomEvent:!1,DataTransfer:!1,DataTransferItem:!1,DataTransferItemList:!1,Debug:!1,defaultStatus:!1,defaultstatus:!1,DelayNode:!1,DeviceMotionEvent:!1,DeviceOrientationEvent:!1,devicePixelRatio:!1,dispatchEvent:!1,document:!1,Document:!1,DocumentFragment:!1,DocumentTimeline:!1,DocumentType:!1,DOMError:!1,DOMException:!1,DOMImplementation:!1,DOMParser:!1,DOMSettableTokenList:!1,DOMStringList:!1,DOMStringMap:!1,DOMTokenList:!1,DragEvent:!1,DynamicsCompressorNode:!1,Element:!1,ElementTimeControl:!1,ErrorEvent:!1,event:!1,Event:!1,EventSource:!1,EventTarget:!1,external:!1,FederatedCredential:!1,fetch:!1,File:!1,FileError:!1,FileList:!1,FileReader:!1,find:!1,focus:!1,FocusEvent:!1,FontFace:!1,FormData:!1,frameElement:!1,frames:!1,GainNode:!1,Gamepad:!1,GamepadButton:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,Headers:!1,history:!1,History:!1,HTMLAllCollection:!1,HTMLAnchorElement:!1,HTMLAppletElement:!1,HTMLAreaElement:!1,HTMLAudioElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLContentElement:!1,HTMLDataListElement:!1,HTMLDetailsElement:!1,HTMLDialogElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLDocument:!1,HTMLElement:!1,HTMLEmbedElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormControlsCollection:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLKeygenElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMarqueeElement:!1,HTMLMediaElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLMeterElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLOptionsCollection:!1,HTMLOutputElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPictureElement:!1,HTMLPreElement:!1,HTMLProgressElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLShadowElement:!1,HTMLSourceElement:!1,HTMLSpanElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLTrackElement:!1,HTMLUListElement:!1,HTMLUnknownElement:!1,HTMLVideoElement:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBEnvironment:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,Image:!1,ImageBitmap:!1,ImageData:!1,indexedDB:!1,innerHeight:!1,innerWidth:!1,InputEvent:!1,InputMethodContext:!1,IntersectionObserver:!1,IntersectionObserverEntry:!1,Intl:!1,KeyboardEvent:!1,KeyframeEffect:!1,KeyframeEffectReadOnly:!1,length:!1,localStorage:!1,location:!1,Location:!1,locationbar:!1,matchMedia:!1,MediaElementAudioSourceNode:!1,MediaEncryptedEvent:!1,MediaError:!1,MediaKeyError:!1,MediaKeyEvent:!1,MediaKeyMessageEvent:!1,MediaKeys:!1,MediaKeySession:!1,MediaKeyStatusMap:!1,MediaKeySystemAccess:!1,MediaList:!1,MediaQueryList:!1,MediaQueryListEvent:!1,MediaSource:!1,MediaRecorder:!1,MediaStream:!1,MediaStreamAudioDestinationNode:!1,MediaStreamAudioSourceNode:!1,MediaStreamEvent:!1,MediaStreamTrack:!1,menubar:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MIDIAccess:!1,MIDIConnectionEvent:!1,MIDIInput:!1,MIDIInputMap:!1,MIDIMessageEvent:!1,MIDIOutput:!1,MIDIOutputMap:!1,MIDIPort:!1,MimeType:!1,MimeTypeArray:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationEvent:!1,MutationObserver:!1,MutationRecord:!1,name:!1,NamedNodeMap:!1,navigator:!1,Navigator:!1,Node:!1,NodeFilter:!1,NodeIterator:!1,NodeList:!1,Notification:!1,OfflineAudioCompletionEvent:!1,OfflineAudioContext:!1,offscreenBuffering:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,opera:!1,Option:!1,OscillatorNode:!1,outerHeight:!1,outerWidth:!1,PageTransitionEvent:!1,pageXOffset:!1,pageYOffset:!1,parent:!1,PasswordCredential:!1,Path2D:!1,performance:!1,Performance:!1,PerformanceEntry:!1,PerformanceMark:!1,PerformanceMeasure:!1,PerformanceNavigation:!1,PerformanceResourceTiming:!1,PerformanceTiming:!1,PeriodicWave:!1,Permissions:!1,PermissionStatus:!1,personalbar:!1,Plugin:!1,PluginArray:!1,PopStateEvent:!1,postMessage:!1,print:!1,ProcessingInstruction:!1,ProgressEvent:!1,PromiseRejectionEvent:!1,prompt:!1,PushManager:!1,PushSubscription:!1,RadioNodeList:!1,Range:!1,ReadableByteStream:!1,ReadableStream:!1,removeEventListener:!1,Request:!1,requestAnimationFrame:!1,requestIdleCallback:!1,resizeBy:!1,resizeTo:!1,Response:!1,RTCIceCandidate:!1,RTCSessionDescription:!1,RTCPeerConnection:!1,screen:!1,Screen:!1,screenLeft:!1,ScreenOrientation:!1,screenTop:!1,screenX:!1,screenY:!1,ScriptProcessorNode:!1,scroll:!1,scrollbars:!1,scrollBy:!1,scrollTo:!1,scrollX:!1,scrollY:!1,SecurityPolicyViolationEvent:!1,Selection:!1,self:!1,ServiceWorker:!1,ServiceWorkerContainer:!1,ServiceWorkerRegistration:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,ShadowRoot:!1,SharedKeyframeList:!1,SharedWorker:!1,showModalDialog:!1,SiteBoundCredential:!1,speechSynthesis:!1,SpeechSynthesisEvent:!1,SpeechSynthesisUtterance:!1,status:!1,statusbar:!1,stop:!1,Storage:!1,StorageEvent:!1,styleMedia:!1,StyleSheet:!1,StyleSheetList:!1,SubtleCrypto:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimationElement:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCSSRule:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDiscardElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGEvent:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEDropShadowElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGeometryElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGGraphicsElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLinearGradientElement:!1,SVGLineElement:!1,SVGLocatable:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGMPathElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSVGElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformable:!1,SVGTransformList:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGUnitTypes:!1,SVGURIReference:!1,SVGUseElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGVKernElement:!1,SVGZoomAndPan:!1,SVGZoomEvent:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TextEvent:!1,TextMetrics:!1,TextTrack:!1,TextTrackCue:!1,TextTrackCueList:!1,TextTrackList:!1,TimeEvent:!1,TimeRanges:!1,toolbar:!1,top:!1,Touch:!1,TouchEvent:!1,TouchList:!1,TrackEvent:!1,TransitionEvent:!1,TreeWalker:!1,UIEvent:!1,URL:!1,URLSearchParams:!1,ValidityState:!1,VTTCue:!1,WaveShaperNode:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,WheelEvent:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLDocument:!1,XMLHttpRequest:!1,XMLHttpRequestEventTarget:!1,XMLHttpRequestProgressEvent:!1,XMLHttpRequestUpload:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1,XSLTProcessor:!1},worker:{applicationCache:!1,atob:!1,Blob:!1,BroadcastChannel:!1,btoa:!1,Cache:!1,caches:!1,clearInterval:!1,clearTimeout:!1,close:!0,console:!1,fetch:!1,FileReaderSync:!1,FormData:!1,Headers:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,ImageData:!1,importScripts:!0,indexedDB:!1,location:!1,MessageChannel:!1,MessagePort:!1,name:!1,navigator:!1,Notification:!1,onclose:!0,onconnect:!0,onerror:!0,onlanguagechange:!0,onmessage:!0,onoffline:!0,ononline:!0,onrejectionhandled:!0,onunhandledrejection:!0,performance:!1,Performance:!1,PerformanceEntry:!1,PerformanceMark:!1,PerformanceMeasure:!1,PerformanceNavigation:!1,PerformanceResourceTiming:!1,PerformanceTiming:!1,postMessage:!0,Promise:!1,Request:!1,Response:!1,self:!0,ServiceWorkerRegistration:!1,setInterval:!1,setTimeout:!1,TextDecoder:!1,TextEncoder:!1,URL:!1,URLSearchParams:!1,WebSocket:!1,Worker:!1,XMLHttpRequest:!1},node:{__dirname:!1,__filename:!1,arguments:!1,Buffer:!1,clearImmediate:!1,clearInterval:!1,clearTimeout:!1,console:!1,exports:!0,GLOBAL:!1,global:!1,Intl:!1,module:!1,process:!1,require:!1,root:!1,setImmediate:!1,setInterval:!1,setTimeout:!1},commonjs:{exports:!0,module:!1,require:!1,global:!1},amd:{define:!1,require:!1},mocha:{after:!1,afterEach:!1,before:!1,beforeEach:!1,context:!1,describe:!1,it:!1,mocha:!1,run:!1,setup:!1,specify:!1,suite:!1,suiteSetup:!1,suiteTeardown:!1,teardown:!1,test:!1,xcontext:!1,xdescribe:!1,xit:!1,xspecify:!1},jasmine:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,describe:!1,expect:!1,fail:!1,fdescribe:!1,fit:!1,it:!1,jasmine:!1,pending:!1,runs:!1,spyOn:!1,spyOnProperty:!1,waits:!1,waitsFor:!1,xdescribe:!1,xit:!1},jest:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,check:!1,describe:!1,expect:!1,gen:!1,it:!1,fdescribe:!1,fit:!1,jest:!1,pit:!1,require:!1,test:!1,xdescribe:!1,xit:!1,xtest:!1},qunit:{asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notOk:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,throws:!1},phantomjs:{console:!0,exports:!0,phantom:!0,require:!0,WebPage:!0},couch:{emit:!1,exports:!1,getRow:!1,log:!1,module:!1,provides:!1,require:!1,respond:!1,send:!1,start:!1,sum:!1},rhino:{defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},nashorn:{__DIR__:!1,__FILE__:!1,__LINE__:!1,com:!1,edu:!1,exit:!1,Java:!1,java:!1,javafx:!1,JavaImporter:!1,javax:!1,JSAdapter:!1,load:!1,loadWithNewGlobal:!1,org:!1,Packages:!1,print:!1,quit:!1},wsh:{ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WScript:!0,WSH:!0,XDomainRequest:!0},jquery:{$:!1,jQuery:!1},yui:{Y:!1,YUI:!1,YUI_config:!1},shelljs:{cat:!1,cd:!1,chmod:!1,config:!1,cp:!1,dirs:!1,echo:!1,env:!1,error:!1,exec:!1,exit:!1,find:!1,grep:!1,ls:!1,ln:!1,mkdir:!1,mv:!1,popd:!1,pushd:!1,pwd:!1,rm:!1,sed:!1,set:!1,target:!1,tempdir:!1,test:!1,touch:!1,which:!1},prototypejs:{$:!1,$$:!1,$A:!1,$break:!1,$continue:!1,$F:!1,$H:!1,$R:!1,$w:!1,Abstract:!1,Ajax:!1,Autocompleter:!1,Builder:!1,Class:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Element:!1,Enumerable:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Scriptaculous:!1,Selector:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Template:!1,Toggle:!1,Try:!1},meteor:{$:!1,_:!1,Accounts:!1,AccountsClient:!1,AccountsServer:!1,AccountsCommon:!1,App:!1,Assets:!1,Blaze:!1,check:!1,Cordova:!1,DDP:!1,DDPServer:!1,DDPRateLimiter:!1,Deps:!1,EJSON:!1,Email:!1,HTTP:!1,Log:!1,Match:!1,Meteor:!1,Mongo:!1,MongoInternals:!1,Npm:!1,Package:!1,Plugin:!1,process:!1,Random:!1,ReactiveDict:!1,ReactiveVar:!1,Router:!1,ServiceConfiguration:!1,Session:!1,share:!1,Spacebars:!1,Template:!1,Tinytest:!1,Tracker:!1,UI:!1,Utils:!1,WebApp:!1,WebAppInternals:!1},mongo:{_isWindows:!1,_rand:!1,BulkWriteResult:!1,cat:!1,cd:!1,connect:!1,db:!1,getHostName:!1,getMemInfo:!1,hostname:!1,ISODate:!1,listFiles:!1,load:!1,ls:!1,md5sumFile:!1,mkdir:!1,Mongo:!1,NumberInt:!1,NumberLong:!1,ObjectId:!1,PlanCache:!1,print:!1,printjson:!1,pwd:!1,quit:!1,removeFile:!1,rs:!1,sh:!1,UUID:!1,version:!1,WriteResult:!1},applescript:{$:!1,Application:!1,Automation:!1,console:!1,delay:!1,Library:!1,ObjC:!1,ObjectSpecifier:!1,Path:!1,Progress:!1,Ref:!1},serviceworker:{caches:!1,Cache:!1,CacheStorage:!1,Client:!1,clients:!1,Clients:!1,ExtendableEvent:!1,ExtendableMessageEvent:!1,FetchEvent:!1,importScripts:!1,registration:!1,self:!1,ServiceWorker:!1,ServiceWorkerContainer:!1,ServiceWorkerGlobalScope:!1,ServiceWorkerMessageEvent:!1,ServiceWorkerRegistration:!1,skipWaiting:!1,WindowClient:!1},atomtest:{advanceClock:!1,fakeClearInterval:!1,fakeClearTimeout:!1,fakeSetInterval:!1,fakeSetTimeout:!1,resetTimeouts:!1,waitsForPromise:!1},embertest:{andThen:!1,click:!1,currentPath:!1,currentRouteName:!1,currentURL:!1,fillIn:!1,find:!1,findWithAssert:!1,keyEvent:!1,pauseTest:!1,resumeTest:!1,triggerEvent:!1,visit:!1},protractor:{$:!1,$$:!1,browser:!1,By:!1,by:!1,DartObject:!1,element:!1,protractor:!1},"shared-node-browser":{clearInterval:!1,clearTimeout:!1,console:!1,setInterval:!1,setTimeout:!1},webextensions:{browser:!1,chrome:!1,opr:!1},greasemonkey:{GM_addStyle:!1,GM_deleteValue:!1,GM_getResourceText:!1,GM_getResourceURL:!1,GM_getValue:!1,GM_info:!1,GM_listValues:!1,GM_log:!1,GM_openInTab:!1,GM_registerMenuCommand:!1,GM_setClipboard:!1,GM_setValue:!1,GM_xmlhttpRequest:!1,unsafeWindow:!1}}},{}],168:[function(e,t,r){t.exports=e("./globals.json")},{"./globals.json":167}],169:[function(e,t,r){"use strict";r.__esModule=!0,r.NOT_LOCAL_BINDING=r.BLOCK_SCOPED_SYMBOL=r.INHERIT_KEYS=r.UNARY_OPERATORS=r.STRING_UNARY_OPERATORS=r.NUMBER_UNARY_OPERATORS=r.BOOLEAN_UNARY_OPERATORS=r.BINARY_OPERATORS=r.NUMBER_BINARY_OPERATORS=r.BOOLEAN_BINARY_OPERATORS=r.COMPARISON_BINARY_OPERATORS=r.EQUALITY_BINARY_OPERATORS=r.BOOLEAN_NUMBER_BINARY_OPERATORS=r.UPDATE_OPERATORS=r.LOGICAL_OPERATORS=r.COMMENT_KEYS=r.FOR_INIT_KEYS=r.FLATTENABLE_KEYS=r.STATEMENT_OR_BLOCK_KEYS=void 0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/symbol/for")),i=(r.STATEMENT_OR_BLOCK_KEYS=["consequent","body","alternate"],r.FLATTENABLE_KEYS=["body","expressions"],r.FOR_INIT_KEYS=["left","init"],r.COMMENT_KEYS=["leadingComments","trailingComments","innerComments"],r.LOGICAL_OPERATORS=["||","&&"],r.UPDATE_OPERATORS=["++","--"],r.BOOLEAN_NUMBER_BINARY_OPERATORS=[">","<",">=","<="]),s=r.EQUALITY_BINARY_OPERATORS=["==","===","!=","!=="],a=r.COMPARISON_BINARY_OPERATORS=[].concat(s,["in","instanceof"]),o=r.BOOLEAN_BINARY_OPERATORS=[].concat(a,i),u=r.NUMBER_BINARY_OPERATORS=["-","/","%","*","**","&","|",">>",">>>","<<","^"],l=(r.BINARY_OPERATORS=["+"].concat(u,o),r.BOOLEAN_UNARY_OPERATORS=["delete","!"]),c=r.NUMBER_UNARY_OPERATORS=["+","-","++","--","~"],p=r.STRING_UNARY_OPERATORS=["typeof"];r.UNARY_OPERATORS=["void"].concat(l,c,p),r.INHERIT_KEYS={optional:["typeAnnotation","typeParameters","returnType"],force:["start","loc","end"]},r.BLOCK_SCOPED_SYMBOL=(0,n.default)("var used to be block scoped"),r.NOT_LOCAL_BINDING=(0,n.default)("should not be considered a local binding")},{"babel-runtime/core-js/symbol/for":130}],170:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,r){var n=[],s=!0,a=e,o=Array.isArray(a),u=0;for(a=o?a:(0,l.default)(a);;){var c;if(o){if(u>=a.length)break;c=a[u++]}else{if((u=a.next()).done)break;c=u.value}var p=c;if(s=!1,h.isExpression(p))n.push(p);else if(h.isExpressionStatement(p))n.push(p.expression);else if(h.isVariableDeclaration(p)){if("var"!==p.kind)return;var f=p.declarations,d=Array.isArray(f),m=0;for(f=d?f:(0,l.default)(f);;){var y;if(d){if(m>=f.length)break;y=f[m++]}else{if((m=f.next()).done)break;y=m.value}var g=y,b=h.getBindingIdentifiers(g);for(var v in b)r.push({kind:p.kind,id:b[v]});g.init&&n.push(h.assignmentExpression("=",g.id,g.init))}s=!0}else if(h.isIfStatement(p)){var x=p.consequent?i([p.consequent],t,r):t.buildUndefinedNode(),E=p.alternate?i([p.alternate],t,r):t.buildUndefinedNode();if(!x||!E)return;n.push(h.conditionalExpression(p.test,x,E))}else if(h.isBlockStatement(p)){var A=i(p.body,t,r);if(!A)return;n.push(A)}else{if(!h.isEmptyStatement(p))return;s=!0}}return s&&n.push(t.buildUndefinedNode()),1===n.length?n[0]:h.sequenceExpression(n)}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.key,r=void 0;return"method"===e.kind?s.increment()+"":(r=h.isIdentifier(t)?t.name:h.isStringLiteral(t)?(0,u.default)(t.value):(0,u.default)(h.removePropertiesDeep(h.cloneDeep(t))),e.computed&&(r="["+r+"]"),e.static&&(r="static:"+r),r)}function a(e){return e+="",e=e.replace(/[^a-zA-Z0-9$_]/g,"-"),e=e.replace(/^[-0-9]+/,""),e=e.replace(/[-\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""}),h.isValidIdentifier(e)||(e="_"+e),e||"_"}r.__esModule=!0;var o=n(e("babel-runtime/core-js/number/max-safe-integer")),u=n(e("babel-runtime/core-js/json/stringify")),l=n(e("babel-runtime/core-js/get-iterator"));r.toComputedKey=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.key||e.property;return e.computed||h.isIdentifier(t)&&(t=h.stringLiteral(t.name)),t},r.toSequenceExpression=function(e,t){if(e&&e.length){var r=[],n=i(e,t,r);if(n){var s=r,a=Array.isArray(s),o=0;for(s=a?s:(0,l.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var c=u;t.push(c)}return n}}},r.toKeyAlias=s,r.toIdentifier=a,r.toBindingIdentifierName=function(e){return"eval"!==(e=a(e))&&"arguments"!==e||(e="_"+e),e},r.toStatement=function(e,t){if(h.isStatement(e))return e;var r=!1,n=void 0;if(h.isClass(e))r=!0,n="ClassDeclaration";else if(h.isFunction(e))r=!0,n="FunctionDeclaration";else if(h.isAssignmentExpression(e))return h.expressionStatement(e);if(r&&!e.id&&(n=!1),!n){if(t)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=n,e},r.toExpression=function(e){if(h.isExpressionStatement(e)&&(e=e.expression),h.isExpression(e))return e;if(h.isClass(e)?e.type="ClassExpression":h.isFunction(e)&&(e.type="FunctionExpression"),!h.isExpression(e))throw new Error("cannot turn "+e.type+" to an expression");return e},r.toBlock=function(e,t){return h.isBlockStatement(e)?e:(h.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(h.isStatement(e)||(e=h.isFunction(t)?h.returnStatement(e):h.expressionStatement(e)),e=[e]),h.blockStatement(e))},r.valueToNode=function(e){if(void 0===e)return h.identifier("undefined");if(!0===e||!1===e)return h.booleanLiteral(e);if(null===e)return h.nullLiteral();if("string"==typeof e)return h.stringLiteral(e);if("number"==typeof e)return h.numericLiteral(e);if((0,p.default)(e)){var t=e.source,r=e.toString().match(/\/([a-z]+|)$/)[1];return h.regExpLiteral(t,r)}if(Array.isArray(e))return h.arrayExpression(e.map(h.valueToNode));if((0,c.default)(e)){var n=[];for(var i in e){var s=void 0;s=h.isValidIdentifier(i)?h.identifier(i):h.stringLiteral(i),n.push(h.objectProperty(s,h.valueToNode(e[i])))}return h.objectExpression(n)}throw new Error("don't know how to turn this value into a node")};var c=n(e("lodash/isPlainObject")),p=n(e("lodash/isRegExp")),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./index"));s.uid=0,s.increment=function(){return s.uid>=o.default?s.uid=0:s.uid++}},{"./index":180,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/core-js/number/max-safe-integer":123,"lodash/isPlainObject":518,"lodash/isRegExp":519}],171:[function(e,t,r){"use strict";var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("../index")),i=e("../constants"),s=e("./index"),a=function(e){return e&&e.__esModule?e:{default:e}}(s);(0,a.default)("ArrayExpression",{fields:{elements:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeOrValueType)("null","Expression","SpreadElement"))),default:[]}},visitor:["elements"],aliases:["Expression"]}),(0,a.default)("AssignmentExpression",{fields:{operator:{validate:(0,s.assertValueType)("string")},left:{validate:(0,s.assertNodeType)("LVal")},right:{validate:(0,s.assertNodeType)("Expression")}},builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]}),(0,a.default)("BinaryExpression",{builder:["operator","left","right"],fields:{operator:{validate:s.assertOneOf.apply(void 0,i.BINARY_OPERATORS)},left:{validate:(0,s.assertNodeType)("Expression")},right:{validate:(0,s.assertNodeType)("Expression")}},visitor:["left","right"],aliases:["Binary","Expression"]}),(0,a.default)("Directive",{visitor:["value"],fields:{value:{validate:(0,s.assertNodeType)("DirectiveLiteral")}}}),(0,a.default)("DirectiveLiteral",{builder:["value"],fields:{value:{validate:(0,s.assertValueType)("string")}}}),(0,a.default)("BlockStatement",{builder:["body","directives"],visitor:["directives","body"],fields:{directives:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Directive"))),default:[]},body:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Statement")))}},aliases:["Scopable","BlockParent","Block","Statement"]}),(0,a.default)("BreakStatement",{visitor:["label"],fields:{label:{validate:(0,s.assertNodeType)("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]}),(0,a.default)("CallExpression",{visitor:["callee","arguments"],fields:{callee:{validate:(0,s.assertNodeType)("Expression")},arguments:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Expression","SpreadElement")))}},aliases:["Expression"]}),(0,a.default)("CatchClause",{visitor:["param","body"],fields:{param:{validate:(0,s.assertNodeType)("Identifier")},body:{validate:(0,s.assertNodeType)("BlockStatement")}},aliases:["Scopable"]}),(0,a.default)("ConditionalExpression",{visitor:["test","consequent","alternate"],fields:{test:{validate:(0,s.assertNodeType)("Expression")},consequent:{validate:(0,s.assertNodeType)("Expression")},alternate:{validate:(0,s.assertNodeType)("Expression")}},aliases:["Expression","Conditional"]}),(0,a.default)("ContinueStatement",{visitor:["label"],fields:{label:{validate:(0,s.assertNodeType)("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]}),(0,a.default)("DebuggerStatement",{aliases:["Statement"]}),(0,a.default)("DoWhileStatement",{visitor:["test","body"],fields:{test:{validate:(0,s.assertNodeType)("Expression")},body:{validate:(0,s.assertNodeType)("Statement")}},aliases:["Statement","BlockParent","Loop","While","Scopable"]}),(0,a.default)("EmptyStatement",{aliases:["Statement"]}),(0,a.default)("ExpressionStatement",{visitor:["expression"],fields:{expression:{validate:(0,s.assertNodeType)("Expression")}},aliases:["Statement","ExpressionWrapper"]}),(0,a.default)("File",{builder:["program","comments","tokens"],visitor:["program"],fields:{program:{validate:(0,s.assertNodeType)("Program")}}}),(0,a.default)("ForInStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,s.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,s.assertNodeType)("Expression")},body:{validate:(0,s.assertNodeType)("Statement")}}}),(0,a.default)("ForStatement",{visitor:["init","test","update","body"],aliases:["Scopable","Statement","For","BlockParent","Loop"],fields:{init:{validate:(0,s.assertNodeType)("VariableDeclaration","Expression"),optional:!0},test:{validate:(0,s.assertNodeType)("Expression"),optional:!0},update:{validate:(0,s.assertNodeType)("Expression"),optional:!0},body:{validate:(0,s.assertNodeType)("Statement")}}}),(0,a.default)("FunctionDeclaration",{builder:["id","params","body","generator","async"],visitor:["id","params","body","returnType","typeParameters"],fields:{id:{validate:(0,s.assertNodeType)("Identifier")},params:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("LVal")))},body:{validate:(0,s.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,s.assertValueType)("boolean")},async:{default:!1,validate:(0,s.assertValueType)("boolean")}},aliases:["Scopable","Function","BlockParent","FunctionParent","Statement","Pureish","Declaration"]}),(0,a.default)("FunctionExpression",{inherits:"FunctionDeclaration",aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{id:{validate:(0,s.assertNodeType)("Identifier"),optional:!0},params:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("LVal")))},body:{validate:(0,s.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,s.assertValueType)("boolean")},async:{default:!1,validate:(0,s.assertValueType)("boolean")}}}),(0,a.default)("Identifier",{builder:["name"],visitor:["typeAnnotation"],aliases:["Expression","LVal"],fields:{name:{validate:function(e,t,r){n.isValidIdentifier(r)}},decorators:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Decorator")))}}}),(0,a.default)("IfStatement",{visitor:["test","consequent","alternate"],aliases:["Statement","Conditional"],fields:{test:{validate:(0,s.assertNodeType)("Expression")},consequent:{validate:(0,s.assertNodeType)("Statement")},alternate:{optional:!0,validate:(0,s.assertNodeType)("Statement")}}}),(0,a.default)("LabeledStatement",{visitor:["label","body"],aliases:["Statement"],fields:{label:{validate:(0,s.assertNodeType)("Identifier")},body:{validate:(0,s.assertNodeType)("Statement")}}}),(0,a.default)("StringLiteral",{builder:["value"],fields:{value:{validate:(0,s.assertValueType)("string")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,a.default)("NumericLiteral",{builder:["value"],deprecatedAlias:"NumberLiteral",fields:{value:{validate:(0,s.assertValueType)("number")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,a.default)("NullLiteral",{aliases:["Expression","Pureish","Literal","Immutable"]}),(0,a.default)("BooleanLiteral",{builder:["value"],fields:{value:{validate:(0,s.assertValueType)("boolean")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,a.default)("RegExpLiteral",{builder:["pattern","flags"],deprecatedAlias:"RegexLiteral",aliases:["Expression","Literal"],fields:{pattern:{validate:(0,s.assertValueType)("string")},flags:{validate:(0,s.assertValueType)("string"),default:""}}}),(0,a.default)("LogicalExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"],fields:{operator:{validate:s.assertOneOf.apply(void 0,i.LOGICAL_OPERATORS)},left:{validate:(0,s.assertNodeType)("Expression")},right:{validate:(0,s.assertNodeType)("Expression")}}}),(0,a.default)("MemberExpression",{builder:["object","property","computed"],visitor:["object","property"],aliases:["Expression","LVal"],fields:{object:{validate:(0,s.assertNodeType)("Expression")},property:{validate:function(e,t,r){var n=e.computed?"Expression":"Identifier";(0,s.assertNodeType)(n)(e,t,r)}},computed:{default:!1}}}),(0,a.default)("NewExpression",{visitor:["callee","arguments"],aliases:["Expression"],fields:{callee:{validate:(0,s.assertNodeType)("Expression")},arguments:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Expression","SpreadElement")))}}}),(0,a.default)("Program",{visitor:["directives","body"],builder:["body","directives"],fields:{directives:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Directive"))),default:[]},body:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Statement")))}},aliases:["Scopable","BlockParent","Block","FunctionParent"]}),(0,a.default)("ObjectExpression",{visitor:["properties"],aliases:["Expression"],fields:{properties:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("ObjectMethod","ObjectProperty","SpreadProperty")))}}}),(0,a.default)("ObjectMethod",{builder:["kind","key","params","body","computed"],fields:{kind:{validate:(0,s.chain)((0,s.assertValueType)("string"),(0,s.assertOneOf)("method","get","set")),default:"method"},computed:{validate:(0,s.assertValueType)("boolean"),default:!1},key:{validate:function(e,t,r){var n=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];s.assertNodeType.apply(void 0,n)(e,t,r)}},decorators:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Decorator")))},body:{validate:(0,s.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,s.assertValueType)("boolean")},async:{default:!1,validate:(0,s.assertValueType)("boolean")}},visitor:["key","params","body","decorators","returnType","typeParameters"],aliases:["UserWhitespacable","Function","Scopable","BlockParent","FunctionParent","Method","ObjectMember"]}),(0,a.default)("ObjectProperty",{builder:["key","value","computed","shorthand","decorators"],fields:{computed:{validate:(0,s.assertValueType)("boolean"),default:!1},key:{validate:function(e,t,r){var n=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];s.assertNodeType.apply(void 0,n)(e,t,r)}},value:{validate:(0,s.assertNodeType)("Expression","Pattern","RestElement")},shorthand:{validate:(0,s.assertValueType)("boolean"),default:!1},decorators:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Decorator"))),optional:!0}},visitor:["key","value","decorators"],aliases:["UserWhitespacable","Property","ObjectMember"]}),(0,a.default)("RestElement",{visitor:["argument","typeAnnotation"],aliases:["LVal"],fields:{argument:{validate:(0,s.assertNodeType)("LVal")},decorators:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Decorator")))}}}),(0,a.default)("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:(0,s.assertNodeType)("Expression"),optional:!0}}}),(0,a.default)("SequenceExpression",{visitor:["expressions"],fields:{expressions:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Expression")))}},aliases:["Expression"]}),(0,a.default)("SwitchCase",{visitor:["test","consequent"],fields:{test:{validate:(0,s.assertNodeType)("Expression"),optional:!0},consequent:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Statement")))}}}),(0,a.default)("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"],fields:{discriminant:{validate:(0,s.assertNodeType)("Expression")},cases:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("SwitchCase")))}}}),(0,a.default)("ThisExpression",{aliases:["Expression"]}),(0,a.default)("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:(0,s.assertNodeType)("Expression")}}}),(0,a.default)("TryStatement",{visitor:["block","handler","finalizer"],aliases:["Statement"],fields:{body:{validate:(0,s.assertNodeType)("BlockStatement")},handler:{optional:!0,handler:(0,s.assertNodeType)("BlockStatement")},finalizer:{optional:!0,validate:(0,s.assertNodeType)("BlockStatement")}}}),(0,a.default)("UnaryExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!0},argument:{validate:(0,s.assertNodeType)("Expression")},operator:{validate:s.assertOneOf.apply(void 0,i.UNARY_OPERATORS)}},visitor:["argument"],aliases:["UnaryLike","Expression"]}),(0,a.default)("UpdateExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!1},argument:{validate:(0,s.assertNodeType)("Expression")},operator:{validate:s.assertOneOf.apply(void 0,i.UPDATE_OPERATORS)}},visitor:["argument"],aliases:["Expression"]}),(0,a.default)("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"],fields:{kind:{validate:(0,s.chain)((0,s.assertValueType)("string"),(0,s.assertOneOf)("var","let","const"))},declarations:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("VariableDeclarator")))}}}),(0,a.default)("VariableDeclarator",{visitor:["id","init"],fields:{id:{validate:(0,s.assertNodeType)("LVal")},init:{optional:!0,validate:(0,s.assertNodeType)("Expression")}}}),(0,a.default)("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"],fields:{test:{validate:(0,s.assertNodeType)("Expression")},body:{validate:(0,s.assertNodeType)("BlockStatement","Statement")}}}),(0,a.default)("WithStatement",{visitor:["object","body"],aliases:["Statement"],fields:{object:{object:(0,s.assertNodeType)("Expression")},body:{validate:(0,s.assertNodeType)("BlockStatement","Statement")}}})},{"../constants":169,"../index":180,"./index":175}],172:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AssignmentPattern",{visitor:["left","right"],aliases:["Pattern","LVal"],fields:{left:{validate:(0,n.assertNodeType)("Identifier")},right:{validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ArrayPattern",{visitor:["elements","typeAnnotation"],aliases:["Pattern","LVal"],fields:{elements:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Identifier","Pattern","RestElement")))},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["params","body","returnType","typeParameters"],aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{params:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("LVal")))},body:{validate:(0,n.assertNodeType)("BlockStatement","Expression")},async:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("ClassBody",{visitor:["body"],fields:{body:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ClassMethod","ClassProperty")))}}}),(0,i.default)("ClassDeclaration",{builder:["id","superClass","body","decorators"],visitor:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Statement","Declaration","Pureish"],fields:{id:{validate:(0,n.assertNodeType)("Identifier")},body:{validate:(0,n.assertNodeType)("ClassBody")},superClass:{optional:!0,validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ClassExpression",{inherits:"ClassDeclaration",aliases:["Scopable","Class","Expression","Pureish"],fields:{id:{optional:!0,validate:(0,n.assertNodeType)("Identifier")},body:{validate:(0,n.assertNodeType)("ClassBody")},superClass:{optional:!0,validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ExportAllDeclaration",{visitor:["source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{source:{validate:(0,n.assertNodeType)("StringLiteral")}}}),(0,i.default)("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{declaration:{validate:(0,n.assertNodeType)("FunctionDeclaration","ClassDeclaration","Expression")}}}),(0,i.default)("ExportNamedDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{declaration:{validate:(0,n.assertNodeType)("Declaration"),optional:!0},specifiers:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ExportSpecifier")))},source:{validate:(0,n.assertNodeType)("StringLiteral"),optional:!0}}}),(0,i.default)("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")},exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ForOfStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,n.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,n.assertNodeType)("Expression")},body:{validate:(0,n.assertNodeType)("Statement")}}}),(0,i.default)("ImportDeclaration",{visitor:["specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration"],fields:{specifiers:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ImportSpecifier","ImportDefaultSpecifier","ImportNamespaceSpecifier")))},source:{validate:(0,n.assertNodeType)("StringLiteral")}}}),(0,i.default)("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ImportSpecifier",{visitor:["local","imported"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")},imported:{validate:(0,n.assertNodeType)("Identifier")},importKind:{validate:(0,n.assertOneOf)(null,"type","typeof")}}}),(0,i.default)("MetaProperty",{visitor:["meta","property"],aliases:["Expression"],fields:{meta:{validate:(0,n.assertValueType)("string")},property:{validate:(0,n.assertValueType)("string")}}}),(0,i.default)("ClassMethod",{aliases:["Function","Scopable","BlockParent","FunctionParent","Method"],builder:["kind","key","params","body","computed","static"],visitor:["key","params","body","decorators","returnType","typeParameters"],fields:{kind:{validate:(0,n.chain)((0,n.assertValueType)("string"),(0,n.assertOneOf)("get","set","method","constructor")),default:"method"},computed:{default:!1,validate:(0,n.assertValueType)("boolean")},static:{default:!1,validate:(0,n.assertValueType)("boolean")},key:{validate:function(e,t,r){var i=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];n.assertNodeType.apply(void 0,i)(e,t,r)}},params:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("LVal")))},body:{validate:(0,n.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,n.assertValueType)("boolean")},async:{default:!1,validate:(0,n.assertValueType)("boolean")}}}),(0,i.default)("ObjectPattern",{visitor:["properties","typeAnnotation"],aliases:["Pattern","LVal"],fields:{properties:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("RestProperty","Property")))},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("Super",{aliases:["Expression"]}),(0,i.default)("TaggedTemplateExpression",{visitor:["tag","quasi"],aliases:["Expression"],fields:{tag:{validate:(0,n.assertNodeType)("Expression")},quasi:{validate:(0,n.assertNodeType)("TemplateLiteral")}}}),(0,i.default)("TemplateElement",{builder:["value","tail"],fields:{value:{},tail:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression","Literal"],fields:{quasis:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("TemplateElement")))},expressions:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Expression")))}}}),(0,i.default)("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{delegate:{validate:(0,n.assertValueType)("boolean"),default:!1},argument:{optional:!0,validate:(0,n.assertNodeType)("Expression")}}})},{"./index":175}],173:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AwaitExpression",{builder:["argument"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("ForAwaitStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,n.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,n.assertNodeType)("Expression")},body:{validate:(0,n.assertNodeType)("Statement")}}}),(0,i.default)("BindExpression",{visitor:["object","callee"],aliases:["Expression"],fields:{}}),(0,i.default)("Import",{aliases:["Expression"]}),(0,i.default)("Decorator",{visitor:["expression"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("DoExpression",{visitor:["body"],aliases:["Expression"],fields:{body:{validate:(0,n.assertNodeType)("BlockStatement")}}}),(0,i.default)("ExportDefaultSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("RestProperty",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("LVal")}}}),(0,i.default)("SpreadProperty",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}})},{"./index":175}],174:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AnyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["Flow"],fields:{}}),(0,i.default)("BooleanTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("BooleanLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("NullLiteralTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ClassImplements",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("ClassProperty",{visitor:["key","value","typeAnnotation","decorators"],builder:["key","value","typeAnnotation","decorators","computed"],aliases:["Property"],fields:{computed:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("DeclareClass",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareFunction",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareInterface",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareModule",{visitor:["id","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareModuleExports",{visitor:["typeAnnotation"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareTypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareOpaqueType",{visitor:["id","typeParameters","supertype"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareVariable",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareExportDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("ExistentialTypeParam",{aliases:["Flow"]}),(0,i.default)("FunctionTypeAnnotation",{visitor:["typeParameters","params","rest","returnType"],aliases:["Flow"],fields:{}}),(0,i.default)("FunctionTypeParam",{visitor:["name","typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("InterfaceExtends",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("InterfaceDeclaration",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("IntersectionTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("MixedTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),(0,i.default)("EmptyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),(0,i.default)("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("NumericLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("NumberTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("StringLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("StringTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ThisTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("TupleTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeofTypeAnnotation",{visitor:["argument"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("OpaqueType",{visitor:["id","typeParameters","impltype","supertype"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("TypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["Flow","ExpressionWrapper","Expression"],fields:{}}),(0,i.default)("TypeParameter",{visitor:["bound"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeParameterDeclaration",{visitor:["params"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeParameterInstantiation",{visitor:["params"],aliases:["Flow"],fields:{}}),(0,i.default)("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties"],aliases:["Flow"],fields:{}}),(0,i.default)("ObjectTypeCallProperty",{visitor:["value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("ObjectTypeIndexer",{visitor:["id","key","value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("ObjectTypeProperty",{visitor:["key","value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("ObjectTypeSpreadProperty",{visitor:["argument"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("QualifiedTypeIdentifier",{visitor:["id","qualification"],aliases:["Flow"],fields:{}}),(0,i.default)("UnionTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("VoidTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}})},{"./index":175}],175:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return Array.isArray(e)?"array":null===e?"null":void 0===e?"undefined":void 0===e?"undefined":(0,u.default)(e)}function s(e){function t(t,r,n){if(!(i(n)===e))throw new TypeError("Property "+r+" expected type of "+e+" but got "+i(n))}return t.type=e,t}r.__esModule=!0,r.DEPRECATED_KEYS=r.BUILDER_KEYS=r.NODE_FIELDS=r.ALIAS_KEYS=r.VISITOR_KEYS=void 0;var a=n(e("babel-runtime/core-js/get-iterator")),o=n(e("babel-runtime/core-js/json/stringify")),u=n(e("babel-runtime/helpers/typeof"));r.assertEach=function(e){function t(t,r,n){if(Array.isArray(n))for(var i=0;i<n.length;i++)e(t,r+"["+i+"]",n[i])}return t.each=e,t},r.assertOneOf=function(){function e(e,t,n){if(r.indexOf(n)<0)throw new TypeError("Property "+t+" expected value to be one of "+(0,o.default)(r)+" but got "+(0,o.default)(n))}for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.oneOf=r,e},r.assertNodeType=function(){function e(e,t,n){var i=!1,s=r,u=Array.isArray(s),c=0;for(s=u?s:(0,a.default)(s);;){var p;if(u){if(c>=s.length)break;p=s[c++]}else{if((c=s.next()).done)break;p=c.value}var h=p;if(l.is(h,n)){i=!0;break}}if(!i)throw new TypeError("Property "+t+" of "+e.type+" expected node to be of a type "+(0,o.default)(r)+" but instead got "+(0,o.default)(n&&n.type))}for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.oneOfNodeTypes=r,e},r.assertNodeOrValueType=function(){function e(e,t,n){var s=!1,u=r,c=Array.isArray(u),p=0;for(u=c?u:(0,a.default)(u);;){var h;if(c){if(p>=u.length)break;h=u[p++]}else{if((p=u.next()).done)break;h=p.value}var f=h;if(i(n)===f||l.is(f,n)){s=!0;break}}if(!s)throw new TypeError("Property "+t+" of "+e.type+" expected node to be of a type "+(0,o.default)(r)+" but instead got "+(0,o.default)(n&&n.type))}for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.oneOfNodeOrValueTypes=r,e},r.assertValueType=s,r.chain=function(){function e(){var e=r,t=Array.isArray(e),n=0;for(e=t?e:(0,a.default)(e);;){var i;if(t){if(n>=e.length)break;i=e[n++]}else{if((n=e.next()).done)break;i=n.value}i.apply(void 0,arguments)}}for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.chainOf=r,e},r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.inherits&&m[t.inherits]||{};t.fields=t.fields||r.fields||{},t.visitor=t.visitor||r.visitor||[],t.aliases=t.aliases||r.aliases||[],t.builder=t.builder||r.builder||t.visitor||[],t.deprecatedAlias&&(d[t.deprecatedAlias]=e);var n=t.visitor.concat(t.builder),o=Array.isArray(n),u=0;for(n=o?n:(0,a.default)(n);;){var l;if(o){if(u>=n.length)break;l=n[u++]}else{if((u=n.next()).done)break;l=u.value}var y=l;t.fields[y]=t.fields[y]||{}}for(var g in t.fields){var b=t.fields[g];-1===t.builder.indexOf(g)&&(b.optional=!0),void 0===b.default?b.default=null:b.validate||(b.validate=s(i(b.default)))}c[e]=t.visitor,f[e]=t.builder,h[e]=t.fields,p[e]=t.aliases,m[e]=t};var l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("../index")),c=r.VISITOR_KEYS={},p=r.ALIAS_KEYS={},h=r.NODE_FIELDS={},f=r.BUILDER_KEYS={},d=r.DEPRECATED_KEYS={},m={}},{"../index":180,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/helpers/typeof":138}],176:[function(e,t,r){"use strict";e("./index"),e("./core"),e("./es2015"),e("./flow"),e("./jsx"),e("./misc"),e("./experimental")},{"./core":171,"./es2015":172,"./experimental":173,"./flow":174,"./index":175,"./jsx":177,"./misc":178}],177:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("JSXAttribute",{visitor:["name","value"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXNamespacedName")},value:{optional:!0,validate:(0,n.assertNodeType)("JSXElement","StringLiteral","JSXExpressionContainer")}}}),(0,i.default)("JSXClosingElement",{visitor:["name"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXMemberExpression")}}}),(0,i.default)("JSXElement",{builder:["openingElement","closingElement","children","selfClosing"],visitor:["openingElement","children","closingElement"],aliases:["JSX","Immutable","Expression"],fields:{openingElement:{validate:(0,n.assertNodeType)("JSXOpeningElement")},closingElement:{optional:!0,validate:(0,n.assertNodeType)("JSXClosingElement")},children:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement")))}}}),(0,i.default)("JSXEmptyExpression",{aliases:["JSX","Expression"]}),(0,i.default)("JSXExpressionContainer",{visitor:["expression"],aliases:["JSX","Immutable"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXSpreadChild",{visitor:["expression"],aliases:["JSX","Immutable"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXIdentifier",{builder:["name"],aliases:["JSX","Expression"],fields:{name:{validate:(0,n.assertValueType)("string")}}}),(0,i.default)("JSXMemberExpression",{visitor:["object","property"],aliases:["JSX","Expression"],fields:{object:{validate:(0,n.assertNodeType)("JSXMemberExpression","JSXIdentifier")},property:{validate:(0,n.assertNodeType)("JSXIdentifier")}}}),(0,i.default)("JSXNamespacedName",{visitor:["namespace","name"],aliases:["JSX"],fields:{namespace:{validate:(0,n.assertNodeType)("JSXIdentifier")},name:{validate:(0,n.assertNodeType)("JSXIdentifier")}}}),(0,i.default)("JSXOpeningElement",{builder:["name","attributes","selfClosing"],visitor:["name","attributes"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXMemberExpression")},selfClosing:{default:!1,validate:(0,n.assertValueType)("boolean")},attributes:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("JSXAttribute","JSXSpreadAttribute")))}}}),(0,i.default)("JSXSpreadAttribute",{visitor:["argument"],aliases:["JSX"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXText",{aliases:["JSX","Immutable"],builder:["value"],fields:{value:{validate:(0,n.assertValueType)("string")}}})},{"./index":175}],178:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("Noop",{visitor:[]}),(0,i.default)("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression","ExpressionWrapper"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}})},{"./index":175}],179:[function(e,t,r){"use strict";function n(e){for(var t={},r={},s=[],a=[],o=0;o<e.length;o++){var u=e[o];if(u&&!(a.indexOf(u)>=0)){if(i.isAnyTypeAnnotation(u))return[u];if(i.isFlowBaseAnnotation(u))r[u.type]=u;else if(i.isUnionTypeAnnotation(u))s.indexOf(u.types)<0&&(e=e.concat(u.types),s.push(u.types));else if(i.isGenericTypeAnnotation(u)){var l=u.id.name;if(t[l]){var c=t[l];c.typeParameters?u.typeParameters&&(c.typeParameters.params=n(c.typeParameters.params.concat(u.typeParameters.params))):c=u.typeParameters}else t[l]=u}else a.push(u)}}for(var p in r)a.push(r[p]);for(var h in t)a.push(t[h]);return a}r.__esModule=!0,r.createUnionTypeAnnotation=function(e){var t=n(e);return 1===t.length?t[0]:i.unionTypeAnnotation(t)},r.removeTypeDuplicates=n,r.createTypeAnnotationBasedOnTypeof=function(e){if("string"===e)return i.stringTypeAnnotation();if("number"===e)return i.numberTypeAnnotation();if("undefined"===e)return i.voidTypeAnnotation();if("boolean"===e)return i.booleanTypeAnnotation();if("function"===e)return i.genericTypeAnnotation(i.identifier("Function"));if("object"===e)return i.genericTypeAnnotation(i.identifier("Object"));if("symbol"===e)return i.genericTypeAnnotation(i.identifier("Symbol"));throw new Error("Invalid typeof value")};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./index"))},{"./index":180}],180:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=F["is"+e];t||(t=F["is"+e]=function(t,r){return F.is(e,t,r)}),F["assert"+e]=function(r,n){if(n=n||{},!t(r,n))throw new Error("Expected type "+(0,b.default)(e)+" with option "+(0,b.default)(n))}}function s(e,t){if(e===t)return!0;if(F.ALIAS_KEYS[t])return!1;var r=F.FLIPPED_ALIAS_KEYS[t];if(r){if(r[0]===e)return!0;var n=r,i=Array.isArray(n),s=0;for(n=i?n:(0,y.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}if(e===a)return!0}}return!1}function a(e,t,r){if(e){var n=F.NODE_FIELDS[e.type];if(n){var i=n[t];i&&i.validate&&(i.optional&&null==r||i.validate(e,t,r))}}}function o(e){if(!e)return e;var t={};for(var r in e)"_"!==r[0]&&(t[r]=e[r]);return t}function u(e,t){p("trailingComments",e,t)}function l(e,t){p("leadingComments",e,t)}function c(e,t){p("innerComments",e,t)}function p(e,t,r){t&&r&&(t[e]=(0,_.default)([].concat(t[e],r[e]).filter(Boolean)))}function h(e){return!(!e||!w.VISITOR_KEYS[e.type])}function f(e,t,r){if(e){var n=F.VISITOR_KEYS[e.type];if(n){t(e,r=r||{});var i=n,s=Array.isArray(i),a=0;for(i=s?i:(0,y.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if((a=i.next()).done)break;o=a.value}var u=e[o];if(Array.isArray(u)){var l=u,c=Array.isArray(l),p=0;for(l=c?l:(0,y.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if((p=l.next()).done)break;h=p.value}f(h,t,r)}}else f(u,t,r)}}}}function d(e,t){var r=(t=t||{}).preserveComments?O:N,n=Array.isArray(r),i=0;for(r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;null!=e[a]&&(e[a]=void 0)}for(var o in e)"_"===o[0]&&null!=e[o]&&(e[o]=void 0);var u=(0,m.default)(e),l=Array.isArray(u),c=0;for(u=l?u:(0,y.default)(u);;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if((c=u.next()).done)break;p=c.value}e[p]=null}}r.__esModule=!0,r.createTypeAnnotationBasedOnTypeof=r.removeTypeDuplicates=r.createUnionTypeAnnotation=r.valueToNode=r.toBlock=r.toExpression=r.toStatement=r.toBindingIdentifierName=r.toIdentifier=r.toKeyAlias=r.toSequenceExpression=r.toComputedKey=r.isNodesEquivalent=r.isImmutable=r.isScope=r.isSpecifierDefault=r.isVar=r.isBlockScoped=r.isLet=r.isValidIdentifier=r.isReferenced=r.isBinding=r.getOuterBindingIdentifiers=r.getBindingIdentifiers=r.TYPES=r.react=r.DEPRECATED_KEYS=r.BUILDER_KEYS=r.NODE_FIELDS=r.ALIAS_KEYS=r.VISITOR_KEYS=r.NOT_LOCAL_BINDING=r.BLOCK_SCOPED_SYMBOL=r.INHERIT_KEYS=r.UNARY_OPERATORS=r.STRING_UNARY_OPERATORS=r.NUMBER_UNARY_OPERATORS=r.BOOLEAN_UNARY_OPERATORS=r.BINARY_OPERATORS=r.NUMBER_BINARY_OPERATORS=r.BOOLEAN_BINARY_OPERATORS=r.COMPARISON_BINARY_OPERATORS=r.EQUALITY_BINARY_OPERATORS=r.BOOLEAN_NUMBER_BINARY_OPERATORS=r.UPDATE_OPERATORS=r.LOGICAL_OPERATORS=r.COMMENT_KEYS=r.FOR_INIT_KEYS=r.FLATTENABLE_KEYS=r.STATEMENT_OR_BLOCK_KEYS=void 0;var m=n(e("babel-runtime/core-js/object/get-own-property-symbols")),y=n(e("babel-runtime/core-js/get-iterator")),g=n(e("babel-runtime/core-js/object/keys")),b=n(e("babel-runtime/core-js/json/stringify")),v=e("./constants");Object.defineProperty(r,"STATEMENT_OR_BLOCK_KEYS",{enumerable:!0,get:function(){return v.STATEMENT_OR_BLOCK_KEYS}}),Object.defineProperty(r,"FLATTENABLE_KEYS",{enumerable:!0,get:function(){return v.FLATTENABLE_KEYS}}),Object.defineProperty(r,"FOR_INIT_KEYS",{enumerable:!0,get:function(){return v.FOR_INIT_KEYS}}),Object.defineProperty(r,"COMMENT_KEYS",{enumerable:!0,get:function(){return v.COMMENT_KEYS}}),Object.defineProperty(r,"LOGICAL_OPERATORS",{enumerable:!0,get:function(){return v.LOGICAL_OPERATORS}}),Object.defineProperty(r,"UPDATE_OPERATORS",{enumerable:!0,get:function(){return v.UPDATE_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_NUMBER_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.BOOLEAN_NUMBER_BINARY_OPERATORS}}),Object.defineProperty(r,"EQUALITY_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.EQUALITY_BINARY_OPERATORS}}),Object.defineProperty(r,"COMPARISON_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.COMPARISON_BINARY_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.BOOLEAN_BINARY_OPERATORS}}),Object.defineProperty(r,"NUMBER_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.NUMBER_BINARY_OPERATORS}}),Object.defineProperty(r,"BINARY_OPERATORS",{enumerable:!0,get:function(){return v.BINARY_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_UNARY_OPERATORS",{enumerable:!0,get:function(){return v.BOOLEAN_UNARY_OPERATORS}}),Object.defineProperty(r,"NUMBER_UNARY_OPERATORS",{enumerable:!0,get:function(){return v.NUMBER_UNARY_OPERATORS}}),Object.defineProperty(r,"STRING_UNARY_OPERATORS",{enumerable:!0,get:function(){return v.STRING_UNARY_OPERATORS}}),Object.defineProperty(r,"UNARY_OPERATORS",{enumerable:!0,get:function(){return v.UNARY_OPERATORS}}),Object.defineProperty(r,"INHERIT_KEYS",{enumerable:!0,get:function(){return v.INHERIT_KEYS}}),Object.defineProperty(r,"BLOCK_SCOPED_SYMBOL",{enumerable:!0,get:function(){return v.BLOCK_SCOPED_SYMBOL}}),Object.defineProperty(r,"NOT_LOCAL_BINDING",{enumerable:!0,get:function(){return v.NOT_LOCAL_BINDING}}),r.is=function(e,t,r){return!!t&&!!s(t.type,e)&&(void 0===r||F.shallowEqual(t,r))},r.isType=s,r.validate=a,r.shallowEqual=function(e,t){var r=(0,g.default)(t),n=Array.isArray(r),i=0;for(r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;if(e[a]!==t[a])return!1}return!0},r.appendToMemberExpression=function(e,t,r){return e.object=F.memberExpression(e.object,e.property,e.computed),e.property=t,e.computed=!!r,e},r.prependToMemberExpression=function(e,t){return e.object=F.memberExpression(t,e.object),e},r.ensureBlock=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"body";return e[t]=F.toBlock(e[t],e)},r.clone=o,r.cloneWithoutLoc=function(e){var t=o(e);return delete t.loc,t},r.cloneDeep=function(e){if(!e)return e;var t={};for(var r in e)if("_"!==r[0]){var n=e[r];n&&(n.type?n=F.cloneDeep(n):Array.isArray(n)&&(n=n.map(F.cloneDeep))),t[r]=n}return t},r.buildMatchMemberExpression=function(e,t){var r=e.split(".");return function(e){if(!F.isMemberExpression(e))return!1;for(var n=[e],i=0;n.length;){var s=n.shift();if(t&&i===r.length)return!0;if(F.isIdentifier(s)){if(r[i]!==s.name)return!1}else{if(!F.isStringLiteral(s)){if(F.isMemberExpression(s)){if(s.computed&&!F.isStringLiteral(s.property))return!1;n.push(s.object),n.push(s.property);continue}return!1}if(r[i]!==s.value)return!1}if(++i>r.length)return!1}return!0}},r.removeComments=function(e){var t=F.COMMENT_KEYS,r=Array.isArray(t),n=0;for(t=r?t:(0,y.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}delete e[i]}return e},r.inheritsComments=function(e,t){return u(e,t),l(e,t),c(e,t),e},r.inheritTrailingComments=u,r.inheritLeadingComments=l,r.inheritInnerComments=c,r.inherits=function(e,t){if(!e||!t)return e;var r=F.INHERIT_KEYS.optional,n=Array.isArray(r),i=0;for(r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;null==e[a]&&(e[a]=t[a])}for(var o in t)"_"===o[0]&&(e[o]=t[o]);var u=F.INHERIT_KEYS.force,l=Array.isArray(u),c=0;for(u=l?u:(0,y.default)(u);;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if((c=u.next()).done)break;p=c.value}var h=p;e[h]=t[h]}return F.inheritsComments(e,t),e},r.assertNode=function(e){if(!h(e))throw new TypeError("Not a valid node "+(e&&e.type))},r.isNode=h,r.traverseFast=f,r.removeProperties=d,r.removePropertiesDeep=function(e,t){return f(e,d,t),e};var x=e("./retrievers");Object.defineProperty(r,"getBindingIdentifiers",{enumerable:!0,get:function(){return x.getBindingIdentifiers}}),Object.defineProperty(r,"getOuterBindingIdentifiers",{enumerable:!0,get:function(){return x.getOuterBindingIdentifiers}});var E=e("./validators");Object.defineProperty(r,"isBinding",{enumerable:!0,get:function(){return E.isBinding}}),Object.defineProperty(r,"isReferenced",{enumerable:!0,get:function(){return E.isReferenced}}),Object.defineProperty(r,"isValidIdentifier",{enumerable:!0,get:function(){return E.isValidIdentifier}}),Object.defineProperty(r,"isLet",{enumerable:!0,get:function(){return E.isLet}}),Object.defineProperty(r,"isBlockScoped",{enumerable:!0,get:function(){return E.isBlockScoped}}),Object.defineProperty(r,"isVar",{enumerable:!0,get:function(){return E.isVar}}),Object.defineProperty(r,"isSpecifierDefault",{enumerable:!0,get:function(){return E.isSpecifierDefault}}),Object.defineProperty(r,"isScope",{enumerable:!0,get:function(){return E.isScope}}),Object.defineProperty(r,"isImmutable",{enumerable:!0,get:function(){return E.isImmutable}}),Object.defineProperty(r,"isNodesEquivalent",{enumerable:!0,get:function(){return E.isNodesEquivalent}});var A=e("./converters");Object.defineProperty(r,"toComputedKey",{enumerable:!0,get:function(){return A.toComputedKey}}),Object.defineProperty(r,"toSequenceExpression",{enumerable:!0,get:function(){return A.toSequenceExpression}}),Object.defineProperty(r,"toKeyAlias",{enumerable:!0,get:function(){return A.toKeyAlias}}),Object.defineProperty(r,"toIdentifier",{enumerable:!0,get:function(){return A.toIdentifier}}),Object.defineProperty(r,"toBindingIdentifierName",{enumerable:!0,get:function(){return A.toBindingIdentifierName}}),Object.defineProperty(r,"toStatement",{enumerable:!0,get:function(){return A.toStatement}}),Object.defineProperty(r,"toExpression",{enumerable:!0,get:function(){return A.toExpression}}),Object.defineProperty(r,"toBlock",{enumerable:!0,get:function(){return A.toBlock}}),Object.defineProperty(r,"valueToNode",{enumerable:!0,get:function(){return A.valueToNode}});var D=e("./flow");Object.defineProperty(r,"createUnionTypeAnnotation",{enumerable:!0,get:function(){return D.createUnionTypeAnnotation}}),Object.defineProperty(r,"removeTypeDuplicates",{enumerable:!0,get:function(){return D.removeTypeDuplicates}}),Object.defineProperty(r,"createTypeAnnotationBasedOnTypeof",{enumerable:!0,get:function(){return D.createTypeAnnotationBasedOnTypeof}});var S=n(e("to-fast-properties")),C=n(e("lodash/clone")),_=n(e("lodash/uniq"));e("./definitions/init");var w=e("./definitions"),k=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./react")),F=r;r.VISITOR_KEYS=w.VISITOR_KEYS,r.ALIAS_KEYS=w.ALIAS_KEYS,r.NODE_FIELDS=w.NODE_FIELDS,r.BUILDER_KEYS=w.BUILDER_KEYS,r.DEPRECATED_KEYS=w.DEPRECATED_KEYS,r.react=k;for(var T in F.VISITOR_KEYS)i(T);F.FLIPPED_ALIAS_KEYS={},(0,g.default)(F.ALIAS_KEYS).forEach(function(e){F.ALIAS_KEYS[e].forEach(function(t){(F.FLIPPED_ALIAS_KEYS[t]=F.FLIPPED_ALIAS_KEYS[t]||[]).push(e)})}),(0,g.default)(F.FLIPPED_ALIAS_KEYS).forEach(function(e){F[e.toUpperCase()+"_TYPES"]=F.FLIPPED_ALIAS_KEYS[e],i(e)});r.TYPES=(0,g.default)(F.VISITOR_KEYS).concat((0,g.default)(F.FLIPPED_ALIAS_KEYS)).concat((0,g.default)(F.DEPRECATED_KEYS));(0,g.default)(F.BUILDER_KEYS).forEach(function(e){function t(){if(arguments.length>r.length)throw new Error("t."+e+": Too many arguments passed. Received "+arguments.length+" but can receive no more than "+r.length);var t={};t.type=e;var n=0,i=r,s=Array.isArray(i),o=0;for(i=s?i:(0,y.default)(i);;){var u;if(s){if(o>=i.length)break;u=i[o++]}else{if((o=i.next()).done)break;u=o.value}var l=u,c=F.NODE_FIELDS[e][l],p=arguments[n++];void 0===p&&(p=(0,C.default)(c.default)),t[l]=p}for(var h in t)a(t,h,t[h]);return t}var r=F.BUILDER_KEYS[e];F[e]=t,F[e[0].toLowerCase()+e.slice(1)]=t});var P=function(e){function t(t){return function(){return console.trace("The node type "+e+" has been renamed to "+r),t.apply(this,arguments)}}var r=F.DEPRECATED_KEYS[e];F[e]=F[e[0].toLowerCase()+e.slice(1)]=t(F[r]),F["is"+e]=t(F["is"+r]),F["assert"+e]=t(F["assert"+r])};for(var B in F.DEPRECATED_KEYS)P(B);(0,S.default)(F),(0,S.default)(F.VISITOR_KEYS);var O=["tokens","start","end","loc","raw","rawValue"],N=F.COMMENT_KEYS.concat(["comments"]).concat(O)},{"./constants":169,"./converters":170,"./definitions":175,"./definitions/init":176,"./flow":179,"./react":181,"./retrievers":182,"./validators":183,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/core-js/object/get-own-property-symbols":126,"babel-runtime/core-js/object/keys":127,"lodash/clone":491,"lodash/uniq":540,"to-fast-properties":607}],181:[function(e,t,r){"use strict";function n(e,t){for(var r=e.value.split(/\r\n|\n|\r/),n=0,s=0;s<r.length;s++)r[s].match(/[^ \t]/)&&(n=s);for(var a="",o=0;o<r.length;o++){var u=r[o],l=0===o,c=o===r.length-1,p=o===n,h=u.replace(/\t/g," ");l||(h=h.replace(/^[ ]+/,"")),c||(h=h.replace(/[ ]+$/,"")),h&&(p||(h+=" "),a+=h)}a&&t.push(i.stringLiteral(a))}r.__esModule=!0,r.isReactComponent=void 0,r.isCompatTag=function(e){return!!e&&/^[a-z]|\-/.test(e)},r.buildChildren=function(e){for(var t=[],r=0;r<e.children.length;r++){var s=e.children[r];i.isJSXText(s)?n(s,t):(i.isJSXExpressionContainer(s)&&(s=s.expression),i.isJSXEmptyExpression(s)||t.push(s))}return t};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./index"));r.isReactComponent=i.buildMatchMemberExpression("React.Component")},{"./index":180}],182:[function(e,t,r){"use strict";function n(e,t,r){for(var n=[].concat(e),a=(0,i.default)(null);n.length;){var o=n.shift();if(o){var u=s.getBindingIdentifiers.keys[o.type];if(s.isIdentifier(o))if(t){(a[o.name]=a[o.name]||[]).push(o)}else a[o.name]=o;else if(s.isExportDeclaration(o))s.isDeclaration(o.declaration)&&n.push(o.declaration);else{if(r){if(s.isFunctionDeclaration(o)){n.push(o.id);continue}if(s.isFunctionExpression(o))continue}if(u)for(var l=0;l<u.length;l++){var c=u[l];o[c]&&(n=n.concat(o[c]))}}}}return a}r.__esModule=!0;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/object/create"));r.getBindingIdentifiers=n,r.getOuterBindingIdentifiers=function(e,t){return n(e,t,!0)};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./index"));n.keys={DeclareClass:["id"],DeclareFunction:["id"],DeclareModule:["id"],DeclareVariable:["id"],InterfaceDeclaration:["id"],TypeAlias:["id"],OpaqueType:["id"],CatchClause:["param"],LabeledStatement:["label"],UnaryExpression:["argument"],AssignmentExpression:["left"],ImportSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportDefaultSpecifier:["local"],ImportDeclaration:["specifiers"],ExportSpecifier:["exported"],ExportNamespaceSpecifier:["exported"],ExportDefaultSpecifier:["exported"],FunctionDeclaration:["id","params"],FunctionExpression:["id","params"],ClassDeclaration:["id"],ClassExpression:["id"],RestElement:["argument"],UpdateExpression:["argument"],RestProperty:["argument"],ObjectProperty:["value"],AssignmentPattern:["left"],ArrayPattern:["elements"],ObjectPattern:["properties"],VariableDeclaration:["declarations"],VariableDeclarator:["id"]}},{"./index":180,"babel-runtime/core-js/object/create":125}],183:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("object"!==(void 0===e?"undefined":(0,a.default)(e))||"object"!==(void 0===e?"undefined":(0,a.default)(e))||null==e||null==t)return e===t;if(e.type!==t.type)return!1;var r=(0,s.default)(c.NODE_FIELDS[e.type]||e.type),n=Array.isArray(r),u=0;for(r=n?r:(0,o.default)(r);;){var l;if(n){if(u>=r.length)break;l=r[u++]}else{if((u=r.next()).done)break;l=u.value}var p=l;if((0,a.default)(e[p])!==(0,a.default)(t[p]))return!1;if(Array.isArray(e[p])){if(!Array.isArray(t[p]))return!1;if(e[p].length!==t[p].length)return!1;for(var h=0;h<e[p].length;h++)if(!i(e[p][h],t[p][h]))return!1}else if(!i(e[p],t[p]))return!1}return!0}r.__esModule=!0;var s=n(e("babel-runtime/core-js/object/keys")),a=n(e("babel-runtime/helpers/typeof")),o=n(e("babel-runtime/core-js/get-iterator"));r.isBinding=function(e,t){var r=u.getBindingIdentifiers.keys[t.type];if(r)for(var n=0;n<r.length;n++){var i=t[r[n]];if(Array.isArray(i)){if(i.indexOf(e)>=0)return!0}else if(i===e)return!0}return!1},r.isReferenced=function(e,t){switch(t.type){case"BindExpression":return t.object===e||t.callee===e;case"MemberExpression":case"JSXMemberExpression":return!(t.property!==e||!t.computed)||t.object===e;case"MetaProperty":return!1;case"ObjectProperty":if(t.key===e)return t.computed;case"VariableDeclarator":return t.id!==e;case"ArrowFunctionExpression":case"FunctionDeclaration":case"FunctionExpression":var r=t.params,n=Array.isArray(r),i=0;for(r=n?r:(0,o.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}if(s===e)return!1}return t.id!==e;case"ExportSpecifier":return!t.source&&t.local===e;case"ExportNamespaceSpecifier":case"ExportDefaultSpecifier":return!1;case"JSXAttribute":return t.name!==e;case"ClassProperty":return t.key===e?t.computed:t.value===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ImportSpecifier":return!1;case"ClassDeclaration":case"ClassExpression":return t.id!==e;case"ClassMethod":case"ObjectMethod":return t.key===e&&t.computed;case"LabeledStatement":return!1;case"CatchClause":return t.param!==e;case"RestElement":return!1;case"AssignmentExpression":case"AssignmentPattern":return t.right===e;case"ObjectPattern":case"ArrayPattern":return!1}return!0},r.isValidIdentifier=function(e){return"string"==typeof e&&!l.default.keyword.isReservedWordES6(e,!0)&&"await"!==e&&l.default.keyword.isIdentifierNameES6(e)},r.isLet=function(e){return c.isVariableDeclaration(e)&&("var"!==e.kind||e[p.BLOCK_SCOPED_SYMBOL])},r.isBlockScoped=function(e){return c.isFunctionDeclaration(e)||c.isClassDeclaration(e)||c.isLet(e)},r.isVar=function(e){return c.isVariableDeclaration(e,{kind:"var"})&&!e[p.BLOCK_SCOPED_SYMBOL]},r.isSpecifierDefault=function(e){return c.isImportDefaultSpecifier(e)||c.isIdentifier(e.imported||e.exported,{name:"default"})},r.isScope=function(e,t){return(!c.isBlockStatement(e)||!c.isFunction(t,{body:e}))&&c.isScopable(e)},r.isImmutable=function(e){return!!c.isType(e.type,"Immutable")||!!c.isIdentifier(e)&&"undefined"===e.name},r.isNodesEquivalent=i;var u=e("./retrievers"),l=n(e("esutils")),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./index")),p=e("./constants")},{"./constants":169,"./index":180,"./retrievers":182,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/object/keys":127,"babel-runtime/helpers/typeof":138,esutils:187}],184:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],185:[function(e,t,r){arguments[4][26][0].apply(r,arguments)},{dup:26}],186:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{"./code":185,dup:27}],187:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{"./ast":184,"./code":185,"./keyword":186,dup:28}],188:[function(e,t,r){"use strict";function n(e){return e=e.split(" "),function(t){return e.indexOf(t)>=0}}function i(e,t){for(var r=65536,n=0;n<t.length;n+=2){if((r+=t[n])>e)return!1;if((r+=t[n+1])>=e)return!0}}function s(e){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&g.test(String.fromCharCode(e)):i(e,v)))}function a(e){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&b.test(String.fromCharCode(e)):i(e,v)||i(e,x))))}function o(e){return 10===e||13===e||8232===e||8233===e}function u(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}function l(e,t,r,n){return e.type=t,e.end=r,e.loc.end=n,this.processComment(e),e}function c(e){return e[e.length-1]}function p(e){return e&&"Property"===e.type&&"init"===e.kind&&!1===e.method}function h(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?h(e.object)+"."+h(e.property):void 0}Object.defineProperty(r,"__esModule",{value:!0});var f={6:n("enum await"),strict:n("implements interface let package private protected public static yield"),strictBind:n("eval arguments")},d=n("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"),m="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",y="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",g=new RegExp("["+m+"]"),b=new RegExp("["+m+y+"]");m=y=null;var v=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],x=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],E={sourceType:"script",sourceFilename:void 0,startLine:1,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,plugins:[],strictMode:null},A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},S=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},C=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},_=!0,w=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};D(this,e),this.label=t,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.rightAssociative=!!r.rightAssociative,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop||null,this.updateContext=null},k=function(e){function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return D(this,t),n.keyword=r,C(this,e.call(this,r,n))}return S(t,e),t}(w),F=function(e){function t(r,n){return D(this,t),C(this,e.call(this,r,{beforeExpr:_,binop:n}))}return S(t,e),t}(w),T={num:new w("num",{startsExpr:!0}),regexp:new w("regexp",{startsExpr:!0}),string:new w("string",{startsExpr:!0}),name:new w("name",{startsExpr:!0}),eof:new w("eof"),bracketL:new w("[",{beforeExpr:_,startsExpr:!0}),bracketR:new w("]"),braceL:new w("{",{beforeExpr:_,startsExpr:!0}),braceBarL:new w("{|",{beforeExpr:_,startsExpr:!0}),braceR:new w("}"),braceBarR:new w("|}"),parenL:new w("(",{beforeExpr:_,startsExpr:!0}),parenR:new w(")"),comma:new w(",",{beforeExpr:_}),semi:new w(";",{beforeExpr:_}),colon:new w(":",{beforeExpr:_}),doubleColon:new w("::",{beforeExpr:_}),dot:new w("."),question:new w("?",{beforeExpr:_}),arrow:new w("=>",{beforeExpr:_}),template:new w("template"),ellipsis:new w("...",{beforeExpr:_}),backQuote:new w("`",{startsExpr:!0}),dollarBraceL:new w("${",{beforeExpr:_,startsExpr:!0}),at:new w("@"),eq:new w("=",{beforeExpr:_,isAssign:!0}),assign:new w("_=",{beforeExpr:_,isAssign:!0}),incDec:new w("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new w("prefix",{beforeExpr:_,prefix:!0,startsExpr:!0}),logicalOR:new F("||",1),logicalAND:new F("&&",2),bitwiseOR:new F("|",3),bitwiseXOR:new F("^",4),bitwiseAND:new F("&",5),equality:new F("==/!=",6),relational:new F("</>",7),bitShift:new F("<</>>",8),plusMin:new w("+/-",{beforeExpr:_,binop:9,prefix:!0,startsExpr:!0}),modulo:new F("%",10),star:new F("*",10),slash:new F("/",10),exponent:new w("**",{beforeExpr:_,binop:11,rightAssociative:!0})},P={break:new k("break"),case:new k("case",{beforeExpr:_}),catch:new k("catch"),continue:new k("continue"),debugger:new k("debugger"),default:new k("default",{beforeExpr:_}),do:new k("do",{isLoop:!0,beforeExpr:_}),else:new k("else",{beforeExpr:_}),finally:new k("finally"),for:new k("for",{isLoop:!0}),function:new k("function",{startsExpr:!0}),if:new k("if"),return:new k("return",{beforeExpr:_}),switch:new k("switch"),throw:new k("throw",{beforeExpr:_}),try:new k("try"),var:new k("var"),let:new k("let"),const:new k("const"),while:new k("while",{isLoop:!0}),with:new k("with"),new:new k("new",{beforeExpr:_,startsExpr:!0}),this:new k("this",{startsExpr:!0}),super:new k("super",{startsExpr:!0}),class:new k("class"),extends:new k("extends",{beforeExpr:_}),export:new k("export"),import:new k("import",{startsExpr:!0}),yield:new k("yield",{beforeExpr:_,startsExpr:!0}),null:new k("null",{startsExpr:!0}),true:new k("true",{startsExpr:!0}),false:new k("false",{startsExpr:!0}),in:new k("in",{beforeExpr:_,binop:7}),instanceof:new k("instanceof",{beforeExpr:_,binop:7}),typeof:new k("typeof",{beforeExpr:_,prefix:!0,startsExpr:!0}),void:new k("void",{beforeExpr:_,prefix:!0,startsExpr:!0}),delete:new k("delete",{beforeExpr:_,prefix:!0,startsExpr:!0})};Object.keys(P).forEach(function(e){T["_"+e]=P[e]});var B=/\r\n?|\n|\u2028|\u2029/,O=new RegExp(B.source,"g"),N=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,j=function e(t,r,n,i){D(this,e),this.token=t,this.isExpr=!!r,this.preserveSpace=!!n,this.override=i},I={braceStatement:new j("{",!1),braceExpression:new j("{",!0),templateQuasi:new j("${",!0),parenStatement:new j("(",!1),parenExpression:new j("(",!0),template:new j("`",!0,!0,function(e){return e.readTmplToken()}),functionExpression:new j("function",!0)};T.parenR.updateContext=T.braceR.updateContext=function(){if(1!==this.state.context.length){var e=this.state.context.pop();e===I.braceStatement&&this.curContext()===I.functionExpression?(this.state.context.pop(),this.state.exprAllowed=!1):e===I.templateQuasi?this.state.exprAllowed=!0:this.state.exprAllowed=!e.isExpr}else this.state.exprAllowed=!0},T.name.updateContext=function(e){this.state.exprAllowed=!1,e!==T._let&&e!==T._const&&e!==T._var||B.test(this.input.slice(this.state.end))&&(this.state.exprAllowed=!0)},T.braceL.updateContext=function(e){this.state.context.push(this.braceIsBlock(e)?I.braceStatement:I.braceExpression),this.state.exprAllowed=!0},T.dollarBraceL.updateContext=function(){this.state.context.push(I.templateQuasi),this.state.exprAllowed=!0},T.parenL.updateContext=function(e){var t=e===T._if||e===T._for||e===T._with||e===T._while;this.state.context.push(t?I.parenStatement:I.parenExpression),this.state.exprAllowed=!0},T.incDec.updateContext=function(){},T._function.updateContext=function(){this.curContext()!==I.braceStatement&&this.state.context.push(I.functionExpression),this.state.exprAllowed=!1},T.backQuote.updateContext=function(){this.curContext()===I.template?this.state.context.pop():this.state.context.push(I.template),this.state.exprAllowed=!1};var L=function e(t,r){D(this,e),this.line=t,this.column=r},M=function e(t,r){D(this,e),this.start=t,this.end=r},R=function(){function e(){D(this,e)}return e.prototype.init=function(e,t){return this.strict=!1!==e.strictMode&&"module"===e.sourceType,this.input=t,this.potentialArrowAt=-1,this.inMethod=this.inFunction=this.inGenerator=this.inAsync=this.inPropertyName=this.inType=this.inClassProperty=this.noAnonFunctionType=!1,this.labels=[],this.decorators=[],this.tokens=[],this.comments=[],this.trailingComments=[],this.leadingComments=[],this.commentStack=[],this.pos=this.lineStart=0,this.curLine=e.startLine,this.type=T.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=[I.braceStatement],this.exprAllowed=!0,this.containsEsc=this.containsOctal=!1,this.octalPosition=null,this.invalidTemplateEscapePosition=null,this.exportedIdentifiers=[],this},e.prototype.curPosition=function(){return new L(this.curLine,this.pos-this.lineStart)},e.prototype.clone=function(t){var r=new e;for(var n in this){var i=this[n];t&&"context"!==n||!Array.isArray(i)||(i=i.slice()),r[n]=i}return r},e}(),V={},U=["jsx","doExpressions","objectRestSpread","decorators","classProperties","exportExtensions","asyncGenerators","functionBind","functionSent","dynamicImport","flow"],q=function(e){function t(r,n){D(this,t),r=function(e){var t={};for(var r in E)t[r]=e&&r in e?e[r]:E[r];return t}(r);var i=C(this,e.call(this,r,n));return i.options=r,i.inModule="module"===i.options.sourceType,i.input=n,i.plugins=i.loadPlugins(i.options.plugins),i.filename=r.sourceFilename,0===i.state.pos&&"#"===i.input[0]&&"!"===i.input[1]&&i.skipLineComment(2),i}return S(t,e),t.prototype.isReservedWord=function(e){return"await"===e?this.inModule:f[6](e)},t.prototype.hasPlugin=function(e){return!!(this.plugins["*"]&&U.indexOf(e)>-1)||!!this.plugins[e]},t.prototype.extend=function(e,t){this[e]=t(this[e])},t.prototype.loadAllPlugins=function(){var e=this,t=Object.keys(V).filter(function(e){return"flow"!==e&&"estree"!==e});t.push("flow"),t.forEach(function(t){var r=V[t];r&&r(e)})},t.prototype.loadPlugins=function(e){if(e.indexOf("*")>=0)return this.loadAllPlugins(),{"*":!0};var t={};e.indexOf("flow")>=0&&(e=e.filter(function(e){return"flow"!==e})).push("flow"),e.indexOf("estree")>=0&&(e=e.filter(function(e){return"estree"!==e})).unshift("estree");var r=e,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;if(!t[a]){t[a]=!0;var o=V[a];o&&o(this)}}return t},t.prototype.parse=function(){var e=this.startNode(),t=this.startNode();return this.nextToken(),this.parseTopLevel(e,t)},t}(function(){function e(t,r){D(this,e),this.state=new R,this.state.init(t,r)}return e.prototype.next=function(){this.isLookahead||this.state.tokens.push(new function e(t){D(this,e),this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,this.loc=new M(t.startLoc,t.endLoc)}(this.state)),this.state.lastTokEnd=this.state.end,this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},e.prototype.eat=function(e){return!!this.match(e)&&(this.next(),!0)},e.prototype.match=function(e){return this.state.type===e},e.prototype.isKeyword=function(e){return d(e)},e.prototype.lookahead=function(){var e=this.state;this.state=e.clone(!0),this.isLookahead=!0,this.next(),this.isLookahead=!1;var t=this.state.clone(!0);return this.state=e,t},e.prototype.setStrict=function(e){if(this.state.strict=e,this.match(T.num)||this.match(T.string)){for(this.state.pos=this.state.start;this.state.pos<this.state.lineStart;)this.state.lineStart=this.input.lastIndexOf("\n",this.state.lineStart-2)+1,--this.state.curLine;this.nextToken()}},e.prototype.curContext=function(){return this.state.context[this.state.context.length-1]},e.prototype.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.state.containsOctal=!1,this.state.octalPosition=null,this.state.start=this.state.pos,this.state.startLoc=this.state.curPosition(),this.state.pos>=this.input.length?this.finishToken(T.eof):e.override?e.override(this):this.readToken(this.fullCharCodeAtPos())},e.prototype.readToken=function(e){return s(e)||92===e?this.readWord():this.getTokenFromCode(e)},e.prototype.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.state.pos);if(e<=55295||e>=57344)return e;return(e<<10)+this.input.charCodeAt(this.state.pos+1)-56613888},e.prototype.pushComment=function(e,t,r,n,i,s){var a={type:e?"CommentBlock":"CommentLine",value:t,start:r,end:n,loc:new M(i,s)};this.isLookahead||(this.state.tokens.push(a),this.state.comments.push(a),this.addComment(a))},e.prototype.skipBlockComment=function(){var e=this.state.curPosition(),t=this.state.pos,r=this.input.indexOf("*/",this.state.pos+=2);-1===r&&this.raise(this.state.pos-2,"Unterminated comment"),this.state.pos=r+2,O.lastIndex=t;for(var n=void 0;(n=O.exec(this.input))&&n.index<this.state.pos;)++this.state.curLine,this.state.lineStart=n.index+n[0].length;this.pushComment(!0,this.input.slice(t+2,r),t,this.state.pos,e,this.state.curPosition())},e.prototype.skipLineComment=function(e){for(var t=this.state.pos,r=this.state.curPosition(),n=this.input.charCodeAt(this.state.pos+=e);this.state.pos<this.input.length&&10!==n&&13!==n&&8232!==n&&8233!==n;)++this.state.pos,n=this.input.charCodeAt(this.state.pos);this.pushComment(!1,this.input.slice(t+e,this.state.pos),t,this.state.pos,r,this.state.curPosition())},e.prototype.skipSpace=function(){e:for(;this.state.pos<this.input.length;){var e=this.input.charCodeAt(this.state.pos);switch(e){case 32:case 160:++this.state.pos;break;case 13:10===this.input.charCodeAt(this.state.pos+1)&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&N.test(String.fromCharCode(e))))break e;++this.state.pos}}},e.prototype.finishToken=function(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var r=this.state.type;this.state.type=e,this.state.value=t,this.updateContext(r)},e.prototype.readToken_dot=function(){var e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.state.pos+2);return 46===e&&46===t?(this.state.pos+=3,this.finishToken(T.ellipsis)):(++this.state.pos,this.finishToken(T.dot))},e.prototype.readToken_slash=function(){if(this.state.exprAllowed)return++this.state.pos,this.readRegexp();return 61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(T.assign,2):this.finishOp(T.slash,1)},e.prototype.readToken_mult_modulo=function(e){var t=42===e?T.star:T.modulo,r=1,n=this.input.charCodeAt(this.state.pos+1);return 42===n&&(r++,n=this.input.charCodeAt(this.state.pos+2),t=T.exponent),61===n&&(r++,t=T.assign),this.finishOp(t,r)},e.prototype.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?this.finishOp(124===e?T.logicalOR:T.logicalAND,2):61===t?this.finishOp(T.assign,2):124===e&&125===t&&this.hasPlugin("flow")?this.finishOp(T.braceBarR,2):this.finishOp(124===e?T.bitwiseOR:T.bitwiseAND,1)},e.prototype.readToken_caret=function(){return 61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(T.assign,2):this.finishOp(T.bitwiseXOR,1)},e.prototype.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?45===t&&62===this.input.charCodeAt(this.state.pos+2)&&B.test(this.input.slice(this.state.lastTokEnd,this.state.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(T.incDec,2):61===t?this.finishOp(T.assign,2):this.finishOp(T.plusMin,1)},e.prototype.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.state.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.state.pos+2)?3:2,61===this.input.charCodeAt(this.state.pos+r)?this.finishOp(T.assign,r+1):this.finishOp(T.bitShift,r)):33===t&&60===e&&45===this.input.charCodeAt(this.state.pos+2)&&45===this.input.charCodeAt(this.state.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===t&&(r=2),this.finishOp(T.relational,r))},e.prototype.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.state.pos+1);return 61===t?this.finishOp(T.equality,61===this.input.charCodeAt(this.state.pos+2)?3:2):61===e&&62===t?(this.state.pos+=2,this.finishToken(T.arrow)):this.finishOp(61===e?T.eq:T.prefix,1)},e.prototype.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.state.pos,this.finishToken(T.parenL);case 41:return++this.state.pos,this.finishToken(T.parenR);case 59:return++this.state.pos,this.finishToken(T.semi);case 44:return++this.state.pos,this.finishToken(T.comma);case 91:return++this.state.pos,this.finishToken(T.bracketL);case 93:return++this.state.pos,this.finishToken(T.bracketR);case 123:return this.hasPlugin("flow")&&124===this.input.charCodeAt(this.state.pos+1)?this.finishOp(T.braceBarL,2):(++this.state.pos,this.finishToken(T.braceL));case 125:return++this.state.pos,this.finishToken(T.braceR);case 58:return this.hasPlugin("functionBind")&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(T.doubleColon,2):(++this.state.pos,this.finishToken(T.colon));case 63:return++this.state.pos,this.finishToken(T.question);case 64:return++this.state.pos,this.finishToken(T.at);case 96:return++this.state.pos,this.finishToken(T.backQuote);case 48:var t=this.input.charCodeAt(this.state.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(T.prefix,1)}this.raise(this.state.pos,"Unexpected character '"+u(e)+"'")},e.prototype.finishOp=function(e,t){var r=this.input.slice(this.state.pos,this.state.pos+t);return this.state.pos+=t,this.finishToken(e,r)},e.prototype.readRegexp=function(){for(var e=this.state.pos,t=void 0,r=void 0;;){this.state.pos>=this.input.length&&this.raise(e,"Unterminated regular expression");var n=this.input.charAt(this.state.pos);if(B.test(n)&&this.raise(e,"Unterminated regular expression"),t)t=!1;else{if("["===n)r=!0;else if("]"===n&&r)r=!1;else if("/"===n&&!r)break;t="\\"===n}++this.state.pos}var i=this.input.slice(e,this.state.pos);++this.state.pos;var s=this.readWord1();if(s){/^[gmsiyu]*$/.test(s)||this.raise(e,"Invalid regular expression flag")}return this.finishToken(T.regexp,{pattern:i,flags:s})},e.prototype.readInt=function(e,t){for(var r=this.state.pos,n=0,i=0,s=null==t?1/0:t;i<s;++i){var a=this.input.charCodeAt(this.state.pos),o=void 0;if((o=a>=97?a-97+10:a>=65?a-65+10:a>=48&&a<=57?a-48:1/0)>=e)break;++this.state.pos,n=n*e+o}return this.state.pos===r||null!=t&&this.state.pos-r!==t?null:n},e.prototype.readRadixNumber=function(e){this.state.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.state.start+2,"Expected number in radix "+e),s(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number"),this.finishToken(T.num,t)},e.prototype.readNumber=function(e){var t=this.state.pos,r=48===this.input.charCodeAt(t),n=!1;e||null!==this.readInt(10)||this.raise(t,"Invalid number"),r&&this.state.pos==t+1&&(r=!1);var i=this.input.charCodeAt(this.state.pos);46!==i||r||(++this.state.pos,this.readInt(10),n=!0,i=this.input.charCodeAt(this.state.pos)),69!==i&&101!==i||r||(43!==(i=this.input.charCodeAt(++this.state.pos))&&45!==i||++this.state.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),n=!0),s(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number");var a=this.input.slice(t,this.state.pos),o=void 0;return n?o=parseFloat(a):r&&1!==a.length?this.state.strict?this.raise(t,"Invalid number"):o=/[89]/.test(a)?parseInt(a,10):parseInt(a,8):o=parseInt(a,10),this.finishToken(T.num,o)},e.prototype.readCodePoint=function(e){var t=void 0;if(123===this.input.charCodeAt(this.state.pos)){var r=++this.state.pos;if(t=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos,e),++this.state.pos,null===t)--this.state.invalidTemplateEscapePosition;else if(t>1114111){if(!e)return this.state.invalidTemplateEscapePosition=r-2,null;this.raise(r,"Code point out of bounds")}}else t=this.readHexChar(4,e);return t},e.prototype.readString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;92===n?(t+=this.input.slice(r,this.state.pos),t+=this.readEscapedChar(!1),r=this.state.pos):(o(n)&&this.raise(this.state.start,"Unterminated string constant"),++this.state.pos)}return t+=this.input.slice(r,this.state.pos++),this.finishToken(T.string,t)},e.prototype.readTmplToken=function(){for(var e="",t=this.state.pos,r=!1;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated template");var n=this.input.charCodeAt(this.state.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.state.pos+1))return this.state.pos===this.state.start&&this.match(T.template)?36===n?(this.state.pos+=2,this.finishToken(T.dollarBraceL)):(++this.state.pos,this.finishToken(T.backQuote)):(e+=this.input.slice(t,this.state.pos),this.finishToken(T.template,r?null:e));if(92===n){e+=this.input.slice(t,this.state.pos);var i=this.readEscapedChar(!0);null===i?r=!0:e+=i,t=this.state.pos}else if(o(n)){switch(e+=this.input.slice(t,this.state.pos),++this.state.pos,n){case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(n)}++this.state.curLine,this.state.lineStart=this.state.pos,t=this.state.pos}else++this.state.pos}},e.prototype.readEscapedChar=function(e){var t=!e,r=this.input.charCodeAt(++this.state.pos);switch(++this.state.pos,r){case 110:return"\n";case 114:return"\r";case 120:var n=this.readHexChar(2,t);return null===n?null:String.fromCharCode(n);case 117:var i=this.readCodePoint(t);return null===i?null:u(i);case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:return this.state.lineStart=this.state.pos,++this.state.curLine,"";default:if(r>=48&&r<=55){var s=this.state.pos-1,a=this.input.substr(this.state.pos-1,3).match(/^[0-7]+/)[0],o=parseInt(a,8);if(o>255&&(a=a.slice(0,-1),o=parseInt(a,8)),o>0){if(e)return this.state.invalidTemplateEscapePosition=s,null;this.state.strict?this.raise(s,"Octal literal in strict mode"):this.state.containsOctal||(this.state.containsOctal=!0,this.state.octalPosition=s)}return this.state.pos+=a.length-1,String.fromCharCode(o)}return String.fromCharCode(r)}},e.prototype.readHexChar=function(e,t){var r=this.state.pos,n=this.readInt(16,e);return null===n&&(t?this.raise(r,"Bad character escape sequence"):(this.state.pos=r-1,this.state.invalidTemplateEscapePosition=r-1)),n},e.prototype.readWord1=function(){this.state.containsEsc=!1;for(var e="",t=!0,r=this.state.pos;this.state.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(a(n))this.state.pos+=n<=65535?1:2;else{if(92!==n)break;this.state.containsEsc=!0,e+=this.input.slice(r,this.state.pos);var i=this.state.pos;117!==this.input.charCodeAt(++this.state.pos)&&this.raise(this.state.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.state.pos;var o=this.readCodePoint(!0);(t?s:a)(o,!0)||this.raise(i,"Invalid Unicode escape"),e+=u(o),r=this.state.pos}t=!1}return e+this.input.slice(r,this.state.pos)},e.prototype.readWord=function(){var e=this.readWord1(),t=T.name;return!this.state.containsEsc&&this.isKeyword(e)&&(t=P[e]),this.finishToken(t,e)},e.prototype.braceIsBlock=function(e){if(e===T.colon){var t=this.curContext();if(t===I.braceStatement||t===I.braceExpression)return!t.isExpr}return e===T._return?B.test(this.input.slice(this.state.lastTokEnd,this.state.start)):e===T._else||e===T.semi||e===T.eof||e===T.parenR||(e===T.braceL?this.curContext()===I.braceStatement:!this.state.exprAllowed)},e.prototype.updateContext=function(e){var t=this.state.type,r=void 0;t.keyword&&e===T.dot?this.state.exprAllowed=!1:(r=t.updateContext)?r.call(this,e):this.state.exprAllowed=t.beforeExpr},e}()),G=q.prototype;G.addExtra=function(e,t,r){if(e){(e.extra=e.extra||{})[t]=r}},G.isRelational=function(e){return this.match(T.relational)&&this.state.value===e},G.expectRelational=function(e){this.isRelational(e)?this.next():this.unexpected(null,T.relational)},G.isContextual=function(e){return this.match(T.name)&&this.state.value===e},G.eatContextual=function(e){return this.state.value===e&&this.eat(T.name)},G.expectContextual=function(e,t){this.eatContextual(e)||this.unexpected(null,t)},G.canInsertSemicolon=function(){return this.match(T.eof)||this.match(T.braceR)||B.test(this.input.slice(this.state.lastTokEnd,this.state.start))},G.isLineTerminator=function(){return this.eat(T.semi)||this.canInsertSemicolon()},G.semicolon=function(){this.isLineTerminator()||this.unexpected(null,T.semi)},G.expect=function(e,t){return this.eat(e)||this.unexpected(t,e)},G.unexpected=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unexpected token";t&&"object"===(void 0===t?"undefined":A(t))&&t.label&&(t="Unexpected token, expected "+t.label),this.raise(null!=e?e:this.state.start,t)};var X=q.prototype;X.parseTopLevel=function(e,t){return t.sourceType=this.options.sourceType,this.parseBlockBody(t,!0,!0,T.eof),e.program=this.finishNode(t,"Program"),e.comments=this.state.comments,e.tokens=this.state.tokens,this.finishNode(e,"File")};var J={kind:"loop"},W={kind:"switch"};X.stmtToDirective=function(e){var t=e.expression,r=this.startNodeAt(t.start,t.loc.start),n=this.startNodeAt(e.start,e.loc.start),i=this.input.slice(t.start,t.end),s=r.value=i.slice(1,-1);return this.addExtra(r,"raw",i),this.addExtra(r,"rawValue",s),n.value=this.finishNodeAt(r,"DirectiveLiteral",t.end,t.loc.end),this.finishNodeAt(n,"Directive",e.end,e.loc.end)},X.parseStatement=function(e,t){this.match(T.at)&&this.parseDecorators(!0);var r=this.state.type,n=this.startNode();switch(r){case T._break:case T._continue:return this.parseBreakContinueStatement(n,r.keyword);case T._debugger:return this.parseDebuggerStatement(n);case T._do:return this.parseDoStatement(n);case T._for:return this.parseForStatement(n);case T._function:return e||this.unexpected(),this.parseFunctionStatement(n);case T._class:return e||this.unexpected(),this.parseClass(n,!0);case T._if:return this.parseIfStatement(n);case T._return:return this.parseReturnStatement(n);case T._switch:return this.parseSwitchStatement(n);case T._throw:return this.parseThrowStatement(n);case T._try:return this.parseTryStatement(n);case T._let:case T._const:e||this.unexpected();case T._var:return this.parseVarStatement(n,r);case T._while:return this.parseWhileStatement(n);case T._with:return this.parseWithStatement(n);case T.braceL:return this.parseBlock();case T.semi:return this.parseEmptyStatement(n);case T._export:case T._import:if(this.hasPlugin("dynamicImport")&&this.lookahead().type===T.parenL)break;return this.options.allowImportExportEverywhere||(t||this.raise(this.state.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.state.start,"'import' and 'export' may appear only with 'sourceType: \"module\"'")),r===T._import?this.parseImport(n):this.parseExport(n);case T.name:if("async"===this.state.value){var i=this.state.clone();if(this.next(),this.match(T._function)&&!this.canInsertSemicolon())return this.expect(T._function),this.parseFunction(n,!0,!1,!0);this.state=i}}var s=this.state.value,a=this.parseExpression();return r===T.name&&"Identifier"===a.type&&this.eat(T.colon)?this.parseLabeledStatement(n,s,a):this.parseExpressionStatement(n,a)},X.takeDecorators=function(e){this.state.decorators.length&&(e.decorators=this.state.decorators,this.state.decorators=[])},X.parseDecorators=function(e){for(;this.match(T.at);){var t=this.parseDecorator();this.state.decorators.push(t)}e&&this.match(T._export)||this.match(T._class)||this.raise(this.state.start,"Leading decorators must be attached to a class declaration")},X.parseDecorator=function(){this.hasPlugin("decorators")||this.unexpected();var e=this.startNode();return this.next(),e.expression=this.parseMaybeAssign(),this.finishNode(e,"Decorator")},X.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.isLineTerminator()?e.label=null:this.match(T.name)?(e.label=this.parseIdentifier(),this.semicolon()):this.unexpected();var n=void 0;for(n=0;n<this.state.labels.length;++n){var i=this.state.labels[n];if(null==e.label||i.name===e.label.name){if(null!=i.kind&&(r||"loop"===i.kind))break;if(e.label&&r)break}}return n===this.state.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},X.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},X.parseDoStatement=function(e){return this.next(),this.state.labels.push(J),e.body=this.parseStatement(!1),this.state.labels.pop(),this.expect(T._while),e.test=this.parseParenExpression(),this.eat(T.semi),this.finishNode(e,"DoWhileStatement")},X.parseForStatement=function(e){this.next(),this.state.labels.push(J);var t=!1;if(this.hasPlugin("asyncGenerators")&&this.state.inAsync&&this.isContextual("await")&&(t=!0,this.next()),this.expect(T.parenL),this.match(T.semi))return t&&this.unexpected(),this.parseFor(e,null);if(this.match(T._var)||this.match(T._let)||this.match(T._const)){var r=this.startNode(),n=this.state.type;return this.next(),this.parseVar(r,!0,n),this.finishNode(r,"VariableDeclaration"),!this.match(T._in)&&!this.isContextual("of")||1!==r.declarations.length||r.declarations[0].init?(t&&this.unexpected(),this.parseFor(e,r)):this.parseForIn(e,r,t)}var i={start:0},s=this.parseExpression(!0,i);if(this.match(T._in)||this.isContextual("of")){var a=this.isContextual("of")?"for-of statement":"for-in statement";return this.toAssignable(s,void 0,a),this.checkLVal(s,void 0,void 0,a),this.parseForIn(e,s,t)}return i.start&&this.unexpected(i.start),t&&this.unexpected(),this.parseFor(e,s)},X.parseFunctionStatement=function(e){return this.next(),this.parseFunction(e,!0)},X.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!1),e.alternate=this.eat(T._else)?this.parseStatement(!1):null,this.finishNode(e,"IfStatement")},X.parseReturnStatement=function(e){return this.state.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.state.start,"'return' outside of function"),this.next(),this.isLineTerminator()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},X.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(T.braceL),this.state.labels.push(W);for(var t,r=void 0;!this.match(T.braceR);)if(this.match(T._case)||this.match(T._default)){var n=this.match(T._case);r&&this.finishNode(r,"SwitchCase"),e.cases.push(r=this.startNode()),r.consequent=[],this.next(),n?r.test=this.parseExpression():(t&&this.raise(this.state.lastTokStart,"Multiple default clauses"),t=!0,r.test=null),this.expect(T.colon)}else r?r.consequent.push(this.parseStatement(!0)):this.unexpected();return r&&this.finishNode(r,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(e,"SwitchStatement")},X.parseThrowStatement=function(e){return this.next(),B.test(this.input.slice(this.state.lastTokEnd,this.state.start))&&this.raise(this.state.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var K=[];X.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.match(T._catch)){var t=this.startNode();this.next(),this.expect(T.parenL),t.param=this.parseBindingAtom(),this.checkLVal(t.param,!0,Object.create(null),"catch clause"),this.expect(T.parenR),t.body=this.parseBlock(),e.handler=this.finishNode(t,"CatchClause")}return e.guardedHandlers=K,e.finalizer=this.eat(T._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},X.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},X.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.state.labels.push(J),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"WhileStatement")},X.parseWithStatement=function(e){return this.state.strict&&this.raise(this.state.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},X.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},X.parseLabeledStatement=function(e,t,r){var n=this.state.labels,i=Array.isArray(n),s=0;for(n=i?n:n[Symbol.iterator]();;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}a.name===t&&this.raise(r.start,"Label '"+t+"' is already declared")}for(var o=this.state.type.isLoop?"loop":this.match(T._switch)?"switch":null,u=this.state.labels.length-1;u>=0;u--){var l=this.state.labels[u];if(l.statementStart!==e.start)break;l.statementStart=this.state.start,l.kind=o}return this.state.labels.push({name:t,kind:o,statementStart:this.state.start}),e.body=this.parseStatement(!0),this.state.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},X.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},X.parseBlock=function(e){var t=this.startNode();return this.expect(T.braceL),this.parseBlockBody(t,e,!1,T.braceR),this.finishNode(t,"BlockStatement")},X.isValidDirective=function(e){return"ExpressionStatement"===e.type&&"StringLiteral"===e.expression.type&&!e.expression.extra.parenthesized},X.parseBlockBody=function(e,t,r,n){e.body=[],e.directives=[];for(var i=!1,s=void 0,a=void 0;!this.eat(n);){i||!this.state.containsOctal||a||(a=this.state.octalPosition);var o=this.parseStatement(!0,r);if(t&&!i&&this.isValidDirective(o)){var u=this.stmtToDirective(o);e.directives.push(u),void 0===s&&"use strict"===u.value.value&&(s=this.state.strict,this.setStrict(!0),a&&this.raise(a,"Octal literal in strict mode"))}else i=!0,e.body.push(o)}!1===s&&this.setStrict(!1)},X.parseFor=function(e,t){return e.init=t,this.expect(T.semi),e.test=this.match(T.semi)?null:this.parseExpression(),this.expect(T.semi),e.update=this.match(T.parenR)?null:this.parseExpression(),this.expect(T.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"ForStatement")},X.parseForIn=function(e,t,r){var n=void 0;return r?(this.eatContextual("of"),n="ForAwaitStatement"):(n=this.match(T._in)?"ForInStatement":"ForOfStatement",this.next()),e.left=t,e.right=this.parseExpression(),this.expect(T.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,n)},X.parseVar=function(e,t,r){for(e.declarations=[],e.kind=r.keyword;;){var n=this.startNode();if(this.parseVarHead(n),this.eat(T.eq)?n.init=this.parseMaybeAssign(t):r!==T._const||this.match(T._in)||this.isContextual("of")?"Identifier"===n.id.type||t&&(this.match(T._in)||this.isContextual("of"))?n.init=null:this.raise(this.state.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(T.comma))break}return e},X.parseVarHead=function(e){e.id=this.parseBindingAtom(),this.checkLVal(e.id,!0,void 0,"variable declaration")},X.parseFunction=function(e,t,r,n,i){var s=this.state.inMethod;return this.state.inMethod=!1,this.initFunction(e,n),this.match(T.star)&&(e.async&&!this.hasPlugin("asyncGenerators")?this.unexpected():(e.generator=!0,this.next())),!t||i||this.match(T.name)||this.match(T._yield)||this.unexpected(),(this.match(T.name)||this.match(T._yield))&&(e.id=this.parseBindingIdentifier()),this.parseFunctionParams(e),this.parseFunctionBody(e,r),this.state.inMethod=s,this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},X.parseFunctionParams=function(e){this.expect(T.parenL),e.params=this.parseBindingList(T.parenR)},X.parseClass=function(e,t,r){return this.next(),this.takeDecorators(e),this.parseClassId(e,t,r),this.parseClassSuper(e),this.parseClassBody(e),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},X.isClassProperty=function(){return this.match(T.eq)||this.match(T.semi)||this.match(T.braceR)},X.isClassMethod=function(){return this.match(T.parenL)},X.isNonstaticConstructor=function(e){return!(e.computed||e.static||"constructor"!==e.key.name&&"constructor"!==e.key.value)},X.parseClassBody=function(e){var t=this.state.strict;this.state.strict=!0;var r=!1,n=!1,i=[],s=this.startNode();for(s.body=[],this.expect(T.braceL);!this.eat(T.braceR);)if(this.eat(T.semi))i.length>0&&this.raise(this.state.lastTokEnd,"Decorators must not be followed by a semicolon");else if(this.match(T.at))i.push(this.parseDecorator());else{var a=this.startNode();if(i.length&&(a.decorators=i,i=[]),a.static=!1,this.match(T.name)&&"static"===this.state.value){var o=this.parseIdentifier(!0);if(this.isClassMethod()){a.kind="method",a.computed=!1,a.key=o,this.parseClassMethod(s,a,!1,!1);continue}if(this.isClassProperty()){a.computed=!1,a.key=o,s.body.push(this.parseClassProperty(a));continue}a.static=!0}if(this.eat(T.star))a.kind="method",this.parsePropertyName(a),this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Constructor can't be a generator"),a.computed||!a.static||"prototype"!==a.key.name&&"prototype"!==a.key.value||this.raise(a.key.start,"Classes may not have static property named prototype"),this.parseClassMethod(s,a,!0,!1);else{var u=this.match(T.name),l=this.parsePropertyName(a);if(a.computed||!a.static||"prototype"!==a.key.name&&"prototype"!==a.key.value||this.raise(a.key.start,"Classes may not have static property named prototype"),this.isClassMethod())this.isNonstaticConstructor(a)?(n?this.raise(l.start,"Duplicate constructor in the same class"):a.decorators&&this.raise(a.start,"You can't attach decorators to a class constructor"),n=!0,a.kind="constructor"):a.kind="method",this.parseClassMethod(s,a,!1,!1);else if(this.isClassProperty())this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Classes may not have a non-static field named 'constructor'"),s.body.push(this.parseClassProperty(a));else if(u&&"async"===l.name&&!this.isLineTerminator()){var c=this.hasPlugin("asyncGenerators")&&this.eat(T.star);a.kind="method",this.parsePropertyName(a),this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Constructor can't be an async function"),this.parseClassMethod(s,a,c,!0)}else!u||"get"!==l.name&&"set"!==l.name||this.isLineTerminator()&&this.match(T.star)?this.hasPlugin("classConstructorCall")&&u&&"call"===l.name&&this.match(T.name)&&"constructor"===this.state.value?(r?this.raise(a.start,"Duplicate constructor call in the same class"):a.decorators&&this.raise(a.start,"You can't attach decorators to a class constructor"),r=!0,a.kind="constructorCall",this.parsePropertyName(a),this.parseClassMethod(s,a,!1,!1)):this.isLineTerminator()?(this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Classes may not have a non-static field named 'constructor'"),s.body.push(this.parseClassProperty(a))):this.unexpected():(a.kind=l.name,this.parsePropertyName(a),this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Constructor can't have get/set modifier"),this.parseClassMethod(s,a,!1,!1),this.checkGetterSetterParamCount(a))}}i.length&&this.raise(this.state.start,"You have trailing decorators with no method"),e.body=this.finishNode(s,"ClassBody"),this.state.strict=t},X.parseClassProperty=function(e){return this.state.inClassProperty=!0,this.match(T.eq)?(this.hasPlugin("classProperties")||this.unexpected(),this.next(),e.value=this.parseMaybeAssign()):e.value=null,this.semicolon(),this.state.inClassProperty=!1,this.finishNode(e,"ClassProperty")},X.parseClassMethod=function(e,t,r,n){this.parseMethod(t,r,n),e.body.push(this.finishNode(t,"ClassMethod"))},X.parseClassId=function(e,t,r){this.match(T.name)?e.id=this.parseIdentifier():r||!t?e.id=null:this.unexpected()},X.parseClassSuper=function(e){e.superClass=this.eat(T._extends)?this.parseExprSubscripts():null},X.parseExport=function(e){if(this.next(),this.match(T.star)){var t=this.startNode();if(this.next(),!this.hasPlugin("exportExtensions")||!this.eatContextual("as"))return this.parseExportFrom(e,!0),this.finishNode(e,"ExportAllDeclaration");t.exported=this.parseIdentifier(),e.specifiers=[this.finishNode(t,"ExportNamespaceSpecifier")],this.parseExportSpecifiersMaybe(e),this.parseExportFrom(e,!0)}else if(this.hasPlugin("exportExtensions")&&this.isExportDefaultSpecifier()){var r=this.startNode();if(r.exported=this.parseIdentifier(!0),e.specifiers=[this.finishNode(r,"ExportDefaultSpecifier")],this.match(T.comma)&&this.lookahead().type===T.star){this.expect(T.comma);var n=this.startNode();this.expect(T.star),this.expectContextual("as"),n.exported=this.parseIdentifier(),e.specifiers.push(this.finishNode(n,"ExportNamespaceSpecifier"))}else this.parseExportSpecifiersMaybe(e);this.parseExportFrom(e,!0)}else{if(this.eat(T._default)){var i=this.startNode(),s=!1;return this.eat(T._function)?i=this.parseFunction(i,!0,!1,!1,!0):this.match(T._class)?i=this.parseClass(i,!0,!0):(s=!0,i=this.parseMaybeAssign()),e.declaration=i,s&&this.semicolon(),this.checkExport(e,!0,!0),this.finishNode(e,"ExportDefaultDeclaration")}this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,e.declaration=this.parseExportDeclaration(e)):(e.declaration=null,e.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(e))}return this.checkExport(e,!0),this.finishNode(e,"ExportNamedDeclaration")},X.parseExportDeclaration=function(){return this.parseStatement(!0)},X.isExportDefaultSpecifier=function(){if(this.match(T.name))return"async"!==this.state.value;if(!this.match(T._default))return!1;var e=this.lookahead();return e.type===T.comma||e.type===T.name&&"from"===e.value},X.parseExportSpecifiersMaybe=function(e){this.eat(T.comma)&&(e.specifiers=e.specifiers.concat(this.parseExportSpecifiers()))},X.parseExportFrom=function(e,t){this.eatContextual("from")?(e.source=this.match(T.string)?this.parseExprAtom():this.unexpected(),this.checkExport(e)):t?this.unexpected():e.source=null,this.semicolon()},X.shouldParseExportDeclaration=function(){return"var"===this.state.type.keyword||"const"===this.state.type.keyword||"let"===this.state.type.keyword||"function"===this.state.type.keyword||"class"===this.state.type.keyword||this.isContextual("async")},X.checkExport=function(e,t,r){if(t)if(r)this.checkDuplicateExports(e,"default");else if(e.specifiers&&e.specifiers.length){var n=e.specifiers,i=Array.isArray(n),s=0;for(n=i?n:n[Symbol.iterator]();;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a;this.checkDuplicateExports(o,o.exported.name)}}else if(e.declaration)if("FunctionDeclaration"===e.declaration.type||"ClassDeclaration"===e.declaration.type)this.checkDuplicateExports(e,e.declaration.id.name);else if("VariableDeclaration"===e.declaration.type){var u=e.declaration.declarations,l=Array.isArray(u),c=0;for(u=l?u:u[Symbol.iterator]();;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if((c=u.next()).done)break;p=c.value}var h=p;this.checkDeclaration(h.id)}}if(this.state.decorators.length){var f=e.declaration&&("ClassDeclaration"===e.declaration.type||"ClassExpression"===e.declaration.type);e.declaration&&f||this.raise(e.start,"You can only use decorators on an export when exporting a class"),this.takeDecorators(e.declaration)}},X.checkDeclaration=function(e){if("ObjectPattern"===e.type){var t=e.properties,r=Array.isArray(t),n=0;for(t=r?t:t[Symbol.iterator]();;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;this.checkDeclaration(s)}}else if("ArrayPattern"===e.type){var a=e.elements,o=Array.isArray(a),u=0;for(a=o?a:a[Symbol.iterator]();;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l;c&&this.checkDeclaration(c)}}else"ObjectProperty"===e.type?this.checkDeclaration(e.value):"RestElement"===e.type||"RestProperty"===e.type?this.checkDeclaration(e.argument):"Identifier"===e.type&&this.checkDuplicateExports(e,e.name)},X.checkDuplicateExports=function(e,t){this.state.exportedIdentifiers.indexOf(t)>-1&&this.raiseDuplicateExportError(e,t),this.state.exportedIdentifiers.push(t)},X.raiseDuplicateExportError=function(e,t){this.raise(e.start,"default"===t?"Only one default export allowed per module.":"`"+t+"` has already been exported. Exported identifiers must be unique.")},X.parseExportSpecifiers=function(){var e=[],t=!0,r=void 0;for(this.expect(T.braceL);!this.eat(T.braceR);){if(t)t=!1;else if(this.expect(T.comma),this.eat(T.braceR))break;var n=this.match(T._default);n&&!r&&(r=!0);var i=this.startNode();i.local=this.parseIdentifier(n),i.exported=this.eatContextual("as")?this.parseIdentifier(!0):i.local.__clone(),e.push(this.finishNode(i,"ExportSpecifier"))}return r&&!this.isContextual("from")&&this.unexpected(),e},X.parseImport=function(e){return this.eat(T._import),this.match(T.string)?(e.specifiers=[],e.source=this.parseExprAtom()):(e.specifiers=[],this.parseImportSpecifiers(e),this.expectContextual("from"),e.source=this.match(T.string)?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},X.parseImportSpecifiers=function(e){var t=!0;if(this.match(T.name)){var r=this.state.start,n=this.state.startLoc;if(e.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(),r,n)),!this.eat(T.comma))return}if(this.match(T.star)){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdentifier(),this.checkLVal(i.local,!0,void 0,"import namespace specifier"),void e.specifiers.push(this.finishNode(i,"ImportNamespaceSpecifier"))}for(this.expect(T.braceL);!this.eat(T.braceR);){if(t)t=!1;else if(this.eat(T.colon)&&this.unexpected(null,"ES2015 named imports do not destructure. Use another statement for destructuring after the import."),this.expect(T.comma),this.eat(T.braceR))break;this.parseImportSpecifier(e)}},X.parseImportSpecifier=function(e){var t=this.startNode();t.imported=this.parseIdentifier(!0),this.eatContextual("as")?t.local=this.parseIdentifier():(this.checkReservedWord(t.imported.name,t.start,!0,!0),t.local=t.imported.__clone()),this.checkLVal(t.local,!0,void 0,"import specifier"),e.specifiers.push(this.finishNode(t,"ImportSpecifier"))},X.parseImportSpecifierDefault=function(e,t,r){var n=this.startNodeAt(t,r);return n.local=e,this.checkLVal(n.local,!0,void 0,"default import specifier"),this.finishNode(n,"ImportDefaultSpecifier")};var z=q.prototype;z.toAssignable=function(e,t,r){if(e)switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";var n=e.properties,i=Array.isArray(n),s=0;for(n=i?n:n[Symbol.iterator]();;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a;"ObjectMethod"===o.type?"get"===o.kind||"set"===o.kind?this.raise(o.key.start,"Object pattern can't contain getter or setter"):this.raise(o.key.start,"Object pattern can't contain methods"):this.toAssignable(o,t,"object destructuring pattern")}break;case"ObjectProperty":this.toAssignable(e.value,t,r);break;case"SpreadProperty":e.type="RestProperty";var u=e.argument;this.toAssignable(u,t,r);break;case"ArrayExpression":e.type="ArrayPattern",this.toAssignableList(e.elements,t,r);break;case"AssignmentExpression":"="===e.operator?(e.type="AssignmentPattern",delete e.operator):this.raise(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!t)break;default:var l="Invalid left-hand side"+(r?" in "+r:"expression");this.raise(e.start,l)}return e},z.toAssignableList=function(e,t,r){var n=e.length;if(n){var i=e[n-1];if(i&&"RestElement"===i.type)--n;else if(i&&"SpreadElement"===i.type){i.type="RestElement";var s=i.argument;this.toAssignable(s,t,r),"Identifier"!==s.type&&"MemberExpression"!==s.type&&"ArrayPattern"!==s.type&&this.unexpected(s.start),--n}}for(var a=0;a<n;a++){var o=e[a];o&&this.toAssignable(o,t,r)}return e},z.toReferencedList=function(e){return e},z.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},z.parseRest=function(){var e=this.startNode();return this.next(),e.argument=this.parseBindingIdentifier(),this.finishNode(e,"RestElement")},z.shouldAllowYieldIdentifier=function(){return this.match(T._yield)&&!this.state.strict&&!this.state.inGenerator},z.parseBindingIdentifier=function(){return this.parseIdentifier(this.shouldAllowYieldIdentifier())},z.parseBindingAtom=function(){switch(this.state.type){case T._yield:(this.state.strict||this.state.inGenerator)&&this.unexpected();case T.name:return this.parseIdentifier(!0);case T.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(T.bracketR,!0),this.finishNode(e,"ArrayPattern");case T.braceL:return this.parseObj(!0);default:this.unexpected()}},z.parseBindingList=function(e,t){for(var r=[],n=!0;!this.eat(e);)if(n?n=!1:this.expect(T.comma),t&&this.match(T.comma))r.push(null);else{if(this.eat(e))break;if(this.match(T.ellipsis)){r.push(this.parseAssignableListItemTypes(this.parseRest())),this.expect(e);break}for(var i=[];this.match(T.at);)i.push(this.parseDecorator());var s=this.parseMaybeDefault();i.length&&(s.decorators=i),this.parseAssignableListItemTypes(s),r.push(this.parseMaybeDefault(s.start,s.loc.start,s))}return r},z.parseAssignableListItemTypes=function(e){return e},z.parseMaybeDefault=function(e,t,r){if(t=t||this.state.startLoc,e=e||this.state.start,r=r||this.parseBindingAtom(),!this.eat(T.eq))return r;var n=this.startNodeAt(e,t);return n.left=r,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},z.checkLVal=function(e,t,r,n){switch(e.type){case"Identifier":if(this.checkReservedWord(e.name,e.start,!1,!0),r){var i="_"+e.name;r[i]?this.raise(e.start,"Argument name clash in strict mode"):r[i]=!0}break;case"MemberExpression":t&&this.raise(e.start,(t?"Binding":"Assigning to")+" member expression");break;case"ObjectPattern":var s=e.properties,a=Array.isArray(s),o=0;for(s=a?s:s[Symbol.iterator]();;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var l=u;"ObjectProperty"===l.type&&(l=l.value),this.checkLVal(l,t,r,"object destructuring pattern")}break;case"ArrayPattern":var c=e.elements,p=Array.isArray(c),h=0;for(c=p?c:c[Symbol.iterator]();;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if((h=c.next()).done)break;f=h.value}var d=f;d&&this.checkLVal(d,t,r,"array destructuring pattern")}break;case"AssignmentPattern":this.checkLVal(e.left,t,r,"assignment pattern");break;case"RestProperty":this.checkLVal(e.argument,t,r,"rest property");break;case"RestElement":this.checkLVal(e.argument,t,r,"rest element");break;default:var m=(t?"Binding invalid":"Invalid")+" left-hand side"+(n?" in "+n:"expression");this.raise(e.start,m)}};var Y=q.prototype;Y.checkPropClash=function(e,t){if(!e.computed&&!e.kind){var r=e.key;"__proto__"===("Identifier"===r.type?r.name:String(r.value))&&(t.proto&&this.raise(r.start,"Redefinition of __proto__ property"),t.proto=!0)}},Y.getExpression=function(){this.nextToken();var e=this.parseExpression();return this.match(T.eof)||this.unexpected(),e},Y.parseExpression=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeAssign(e,t);if(this.match(T.comma)){var s=this.startNodeAt(r,n);for(s.expressions=[i];this.eat(T.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.toReferencedList(s.expressions),this.finishNode(s,"SequenceExpression")}return i},Y.parseMaybeAssign=function(e,t,r,n){var i=this.state.start,s=this.state.startLoc;if(this.match(T._yield)&&this.state.inGenerator){var a=this.parseYield();return r&&(a=r.call(this,a,i,s)),a}var o=void 0;t?o=!1:(t={start:0},o=!0),(this.match(T.parenL)||this.match(T.name))&&(this.state.potentialArrowAt=this.state.start);var u=this.parseMaybeConditional(e,t,n);if(r&&(u=r.call(this,u,i,s)),this.state.type.isAssign){var l=this.startNodeAt(i,s);if(l.operator=this.state.value,l.left=this.match(T.eq)?this.toAssignable(u,void 0,"assignment expression"):u,t.start=0,this.checkLVal(u,void 0,void 0,"assignment expression"),u.extra&&u.extra.parenthesized){var c=void 0;"ObjectPattern"===u.type?c="`({a}) = 0` use `({a} = 0)`":"ArrayPattern"===u.type&&(c="`([a]) = 0` use `([a] = 0)`"),c&&this.raise(u.start,"You're trying to assign to a parenthesized expression, eg. instead of "+c)}return this.next(),l.right=this.parseMaybeAssign(e),this.finishNode(l,"AssignmentExpression")}return o&&t.start&&this.unexpected(t.start),u},Y.parseMaybeConditional=function(e,t,r){var n=this.state.start,i=this.state.startLoc,s=this.parseExprOps(e,t);return t&&t.start?s:this.parseConditional(s,e,n,i,r)},Y.parseConditional=function(e,t,r,n){if(this.eat(T.question)){var i=this.startNodeAt(r,n);return i.test=e,i.consequent=this.parseMaybeAssign(),this.expect(T.colon),i.alternate=this.parseMaybeAssign(t),this.finishNode(i,"ConditionalExpression")}return e},Y.parseExprOps=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeUnary(t);return t&&t.start?i:this.parseExprOp(i,r,n,-1,e)},Y.parseExprOp=function(e,t,r,n,i){var s=this.state.type.binop;if(!(null==s||i&&this.match(T._in))&&s>n){var a=this.startNodeAt(t,r);a.left=e,a.operator=this.state.value,"**"!==a.operator||"UnaryExpression"!==e.type||!e.extra||e.extra.parenthesizedArgument||e.extra.parenthesized||this.raise(e.argument.start,"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");var o=this.state.type;this.next();var u=this.state.start,l=this.state.startLoc;return a.right=this.parseExprOp(this.parseMaybeUnary(),u,l,o.rightAssociative?s-1:s,i),this.finishNode(a,o===T.logicalOR||o===T.logicalAND?"LogicalExpression":"BinaryExpression"),this.parseExprOp(a,t,r,n,i)}return e},Y.parseMaybeUnary=function(e){if(this.state.type.prefix){var t=this.startNode(),r=this.match(T.incDec);t.operator=this.state.value,t.prefix=!0,this.next();var n=this.state.type;return t.argument=this.parseMaybeUnary(),this.addExtra(t,"parenthesizedArgument",!(n!==T.parenL||t.argument.extra&&t.argument.extra.parenthesized)),e&&e.start&&this.unexpected(e.start),r?this.checkLVal(t.argument,void 0,void 0,"prefix operation"):this.state.strict&&"delete"===t.operator&&"Identifier"===t.argument.type&&this.raise(t.start,"Deleting local variable in strict mode"),this.finishNode(t,r?"UpdateExpression":"UnaryExpression")}var i=this.state.start,s=this.state.startLoc,a=this.parseExprSubscripts(e);if(e&&e.start)return a;for(;this.state.type.postfix&&!this.canInsertSemicolon();){var o=this.startNodeAt(i,s);o.operator=this.state.value,o.prefix=!1,o.argument=a,this.checkLVal(a,void 0,void 0,"postfix operation"),this.next(),a=this.finishNode(o,"UpdateExpression")}return a},Y.parseExprSubscripts=function(e){var t=this.state.start,r=this.state.startLoc,n=this.state.potentialArrowAt,i=this.parseExprAtom(e);return"ArrowFunctionExpression"===i.type&&i.start===n?i:e&&e.start?i:this.parseSubscripts(i,t,r)},Y.parseSubscripts=function(e,t,r,n){for(;;){if(!n&&this.eat(T.doubleColon)){var i=this.startNodeAt(t,r);return i.object=e,i.callee=this.parseNoCallExpr(),this.parseSubscripts(this.finishNode(i,"BindExpression"),t,r,n)}if(this.eat(T.dot)){var s=this.startNodeAt(t,r);s.object=e,s.property=this.parseIdentifier(!0),s.computed=!1,e=this.finishNode(s,"MemberExpression")}else if(this.eat(T.bracketL)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseExpression(),a.computed=!0,this.expect(T.bracketR),e=this.finishNode(a,"MemberExpression")}else if(!n&&this.match(T.parenL)){var o=this.state.potentialArrowAt===e.start&&"Identifier"===e.type&&"async"===e.name&&!this.canInsertSemicolon();this.next();var u=this.startNodeAt(t,r);if(u.callee=e,u.arguments=this.parseCallExpressionArguments(T.parenR,o),"Import"===u.callee.type&&1!==u.arguments.length&&this.raise(u.start,"import() requires exactly one argument"),e=this.finishNode(u,"CallExpression"),o&&this.shouldParseAsyncArrow())return this.parseAsyncArrowFromCallExpression(this.startNodeAt(t,r),u);this.toReferencedList(u.arguments)}else{if(!this.match(T.backQuote))return e;var l=this.startNodeAt(t,r);l.tag=e,l.quasi=this.parseTemplate(!0),e=this.finishNode(l,"TaggedTemplateExpression")}}},Y.parseCallExpressionArguments=function(e,t){for(var r=[],n=void 0,i=!0;!this.eat(e);){if(i)i=!1;else if(this.expect(T.comma),this.eat(e))break;this.match(T.parenL)&&!n&&(n=this.state.start),r.push(this.parseExprListItem(!1,t?{start:0}:void 0,t?{start:0}:void 0))}return t&&n&&this.shouldParseAsyncArrow()&&this.unexpected(),r},Y.shouldParseAsyncArrow=function(){return this.match(T.arrow)},Y.parseAsyncArrowFromCallExpression=function(e,t){return this.expect(T.arrow),this.parseArrowExpression(e,t.arguments,!0)},Y.parseNoCallExpr=function(){var e=this.state.start,t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,t,!0)},Y.parseExprAtom=function(e){var t=this.state.potentialArrowAt===this.state.start,r=void 0;switch(this.state.type){case T._super:return this.state.inMethod||this.state.inClassProperty||this.options.allowSuperOutsideMethod||this.raise(this.state.start,"'super' outside of function or class"),r=this.startNode(),this.next(),this.match(T.parenL)||this.match(T.bracketL)||this.match(T.dot)||this.unexpected(),this.match(T.parenL)&&"constructor"!==this.state.inMethod&&!this.options.allowSuperOutsideMethod&&this.raise(r.start,"super() outside of class constructor"),this.finishNode(r,"Super");case T._import:return this.hasPlugin("dynamicImport")||this.unexpected(),r=this.startNode(),this.next(),this.match(T.parenL)||this.unexpected(null,T.parenL),this.finishNode(r,"Import");case T._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case T._yield:this.state.inGenerator&&this.unexpected();case T.name:r=this.startNode();var n="await"===this.state.value&&this.state.inAsync,i=this.shouldAllowYieldIdentifier(),s=this.parseIdentifier(n||i);if("await"===s.name){if(this.state.inAsync||this.inModule)return this.parseAwait(r)}else{if("async"===s.name&&this.match(T._function)&&!this.canInsertSemicolon())return this.next(),this.parseFunction(r,!1,!1,!0);if(t&&"async"===s.name&&this.match(T.name)){var a=[this.parseIdentifier()];return this.expect(T.arrow),this.parseArrowExpression(r,a,!0)}}return t&&!this.canInsertSemicolon()&&this.eat(T.arrow)?this.parseArrowExpression(r,[s]):s;case T._do:if(this.hasPlugin("doExpressions")){var o=this.startNode();this.next();var u=this.state.inFunction,l=this.state.labels;return this.state.labels=[],this.state.inFunction=!1,o.body=this.parseBlock(!1,!0),this.state.inFunction=u,this.state.labels=l,this.finishNode(o,"DoExpression")}case T.regexp:var c=this.state.value;return r=this.parseLiteral(c.value,"RegExpLiteral"),r.pattern=c.pattern,r.flags=c.flags,r;case T.num:return this.parseLiteral(this.state.value,"NumericLiteral");case T.string:return this.parseLiteral(this.state.value,"StringLiteral");case T._null:return r=this.startNode(),this.next(),this.finishNode(r,"NullLiteral");case T._true:case T._false:return r=this.startNode(),r.value=this.match(T._true),this.next(),this.finishNode(r,"BooleanLiteral");case T.parenL:return this.parseParenAndDistinguishExpression(null,null,t);case T.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(T.bracketR,!0,e),this.toReferencedList(r.elements),this.finishNode(r,"ArrayExpression");case T.braceL:return this.parseObj(!1,e);case T._function:return this.parseFunctionExpression();case T.at:this.parseDecorators();case T._class:return r=this.startNode(),this.takeDecorators(r),this.parseClass(r,!1);case T._new:return this.parseNew();case T.backQuote:return this.parseTemplate(!1);case T.doubleColon:r=this.startNode(),this.next(),r.object=null;var p=r.callee=this.parseNoCallExpr();if("MemberExpression"===p.type)return this.finishNode(r,"BindExpression");this.raise(p.start,"Binding should be performed on object property.");default:this.unexpected()}},Y.parseFunctionExpression=function(){var e=this.startNode(),t=this.parseIdentifier(!0);return this.state.inGenerator&&this.eat(T.dot)&&this.hasPlugin("functionSent")?this.parseMetaProperty(e,t,"sent"):this.parseFunction(e,!1)},Y.parseMetaProperty=function(e,t,r){return e.meta=t,e.property=this.parseIdentifier(!0),e.property.name!==r&&this.raise(e.property.start,"The only valid meta property for new is "+t.name+"."+r),this.finishNode(e,"MetaProperty")},Y.parseLiteral=function(e,t,r,n){r=r||this.state.start,n=n||this.state.startLoc;var i=this.startNodeAt(r,n);return this.addExtra(i,"rawValue",e),this.addExtra(i,"raw",this.input.slice(r,this.state.end)),i.value=e,this.next(),this.finishNode(i,t)},Y.parseParenExpression=function(){this.expect(T.parenL);var e=this.parseExpression();return this.expect(T.parenR),e},Y.parseParenAndDistinguishExpression=function(e,t,r){e=e||this.state.start,t=t||this.state.startLoc;var n=void 0;this.expect(T.parenL);for(var i=this.state.start,s=this.state.startLoc,a=[],o={start:0},u={start:0},l=!0,c=void 0,p=void 0;!this.match(T.parenR);){if(l)l=!1;else if(this.expect(T.comma,u.start||null),this.match(T.parenR)){p=this.state.start;break}if(this.match(T.ellipsis)){var h=this.state.start,f=this.state.startLoc;c=this.state.start,a.push(this.parseParenItem(this.parseRest(),h,f));break}a.push(this.parseMaybeAssign(!1,o,this.parseParenItem,u))}var d=this.state.start,m=this.state.startLoc;this.expect(T.parenR);var y=this.startNodeAt(e,t);if(r&&this.shouldParseArrow()&&(y=this.parseArrow(y))){var g=a,b=Array.isArray(g),v=0;for(g=b?g:g[Symbol.iterator]();;){var x;if(b){if(v>=g.length)break;x=g[v++]}else{if((v=g.next()).done)break;x=v.value}var E=x;E.extra&&E.extra.parenthesized&&this.unexpected(E.extra.parenStart)}return this.parseArrowExpression(y,a)}return a.length||this.unexpected(this.state.lastTokStart),p&&this.unexpected(p),c&&this.unexpected(c),o.start&&this.unexpected(o.start),u.start&&this.unexpected(u.start),a.length>1?((n=this.startNodeAt(i,s)).expressions=a,this.toReferencedList(n.expressions),this.finishNodeAt(n,"SequenceExpression",d,m)):n=a[0],this.addExtra(n,"parenthesized",!0),this.addExtra(n,"parenStart",e),n},Y.shouldParseArrow=function(){return!this.canInsertSemicolon()},Y.parseArrow=function(e){if(this.eat(T.arrow))return e},Y.parseParenItem=function(e){return e},Y.parseNew=function(){var e=this.startNode(),t=this.parseIdentifier(!0);if(this.eat(T.dot)){var r=this.parseMetaProperty(e,t,"target");return this.state.inFunction||this.raise(r.property.start,"new.target can only be used in functions"),r}return e.callee=this.parseNoCallExpr(),this.eat(T.parenL)?(e.arguments=this.parseExprList(T.parenR),this.toReferencedList(e.arguments)):e.arguments=[],this.finishNode(e,"NewExpression")},Y.parseTemplateElement=function(e){var t=this.startNode();return null===this.state.value&&(e&&this.hasPlugin("templateInvalidEscapes")?this.state.invalidTemplateEscapePosition=null:this.raise(this.state.invalidTemplateEscapePosition,"Invalid escape sequence in template")),t.value={raw:this.input.slice(this.state.start,this.state.end).replace(/\r\n?/g,"\n"),cooked:this.state.value},this.next(),t.tail=this.match(T.backQuote),this.finishNode(t,"TemplateElement")},Y.parseTemplate=function(e){var t=this.startNode();this.next(),t.expressions=[];var r=this.parseTemplateElement(e);for(t.quasis=[r];!r.tail;)this.expect(T.dollarBraceL),t.expressions.push(this.parseExpression()),this.expect(T.braceR),t.quasis.push(r=this.parseTemplateElement(e));return this.next(),this.finishNode(t,"TemplateLiteral")},Y.parseObj=function(e,t){var r=[],n=Object.create(null),i=!0,s=this.startNode();s.properties=[],this.next();for(var a=null;!this.eat(T.braceR);){if(i)i=!1;else if(this.expect(T.comma),this.eat(T.braceR))break;for(;this.match(T.at);)r.push(this.parseDecorator());var o=this.startNode(),u=!1,l=!1,c=void 0,p=void 0;if(r.length&&(o.decorators=r,r=[]),this.hasPlugin("objectRestSpread")&&this.match(T.ellipsis)){if(o=this.parseSpread(e?{start:0}:void 0),o.type=e?"RestProperty":"SpreadProperty",e&&this.toAssignable(o.argument,!0,"object pattern"),s.properties.push(o),!e)continue;var h=this.state.start;if(null===a){if(this.eat(T.braceR))break;if(this.match(T.comma)&&this.lookahead().type===T.braceR)continue;a=h;continue}this.unexpected(a,"Cannot have multiple rest elements when destructuring")}if(o.method=!1,o.shorthand=!1,(e||t)&&(c=this.state.start,p=this.state.startLoc),e||(u=this.eat(T.star)),!e&&this.isContextual("async")){u&&this.unexpected();var f=this.parseIdentifier();this.match(T.colon)||this.match(T.parenL)||this.match(T.braceR)||this.match(T.eq)||this.match(T.comma)?(o.key=f,o.computed=!1):(l=!0,this.hasPlugin("asyncGenerators")&&(u=this.eat(T.star)),this.parsePropertyName(o))}else this.parsePropertyName(o);this.parseObjPropValue(o,c,p,u,l,e,t),this.checkPropClash(o,n),o.shorthand&&this.addExtra(o,"shorthand",!0),s.properties.push(o)}return null!==a&&this.unexpected(a,"The rest element has to be the last element when destructuring"),r.length&&this.raise(this.state.start,"You have trailing decorators with no property"),this.finishNode(s,e?"ObjectPattern":"ObjectExpression")},Y.isGetterOrSetterMethod=function(e,t){return!t&&!e.computed&&"Identifier"===e.key.type&&("get"===e.key.name||"set"===e.key.name)&&(this.match(T.string)||this.match(T.num)||this.match(T.bracketL)||this.match(T.name)||this.state.type.keyword)},Y.checkGetterSetterParamCount=function(e){var t="get"===e.kind?0:1;if(e.params.length!==t){var r=e.start;"get"===e.kind?this.raise(r,"getter should have no params"):this.raise(r,"setter should have exactly one param")}},Y.parseObjectMethod=function(e,t,r,n){return r||t||this.match(T.parenL)?(n&&this.unexpected(),e.kind="method",e.method=!0,this.parseMethod(e,t,r),this.finishNode(e,"ObjectMethod")):this.isGetterOrSetterMethod(e,n)?((t||r)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),this.parseMethod(e),this.checkGetterSetterParamCount(e),this.finishNode(e,"ObjectMethod")):void 0},Y.parseObjectProperty=function(e,t,r,n,i){return this.eat(T.colon)?(e.value=n?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssign(!1,i),this.finishNode(e,"ObjectProperty")):e.computed||"Identifier"!==e.key.type?void 0:(this.checkReservedWord(e.key.name,e.key.start,!0,!0),n?e.value=this.parseMaybeDefault(t,r,e.key.__clone()):this.match(T.eq)&&i?(i.start||(i.start=this.state.start),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):e.value=e.key.__clone(),e.shorthand=!0,this.finishNode(e,"ObjectProperty"))},Y.parseObjPropValue=function(e,t,r,n,i,s,a){var o=this.parseObjectMethod(e,n,i,s)||this.parseObjectProperty(e,t,r,s,a);return o||this.unexpected(),o},Y.parsePropertyName=function(e){if(this.eat(T.bracketL))e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(T.bracketR);else{e.computed=!1;var t=this.state.inPropertyName;this.state.inPropertyName=!0,e.key=this.match(T.num)||this.match(T.string)?this.parseExprAtom():this.parseIdentifier(!0),this.state.inPropertyName=t}return e.key},Y.initFunction=function(e,t){e.id=null,e.generator=!1,e.expression=!1,e.async=!!t},Y.parseMethod=function(e,t,r){var n=this.state.inMethod;return this.state.inMethod=e.kind||!0,this.initFunction(e,r),this.expect(T.parenL),e.params=this.parseBindingList(T.parenR),e.generator=!!t,this.parseFunctionBody(e),this.state.inMethod=n,e},Y.parseArrowExpression=function(e,t,r){return this.initFunction(e,r),e.params=this.toAssignableList(t,!0,"arrow function parameters"),this.parseFunctionBody(e,!0),this.finishNode(e,"ArrowFunctionExpression")},Y.isStrictBody=function(e,t){if(!t&&e.body.directives.length){var r=e.body.directives,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}if("use strict"===s.value.value)return!0}}return!1},Y.parseFunctionBody=function(e,t){var r=t&&!this.match(T.braceL),n=this.state.inAsync;if(this.state.inAsync=e.async,r)e.body=this.parseMaybeAssign(),e.expression=!0;else{var i=this.state.inFunction,s=this.state.inGenerator,a=this.state.labels;this.state.inFunction=!0,this.state.inGenerator=e.generator,this.state.labels=[],e.body=this.parseBlock(!0),e.expression=!1,this.state.inFunction=i,this.state.inGenerator=s,this.state.labels=a}this.state.inAsync=n;var o=this.isStrictBody(e,r),u=this.state.strict||t||o;if(o&&e.id&&"Identifier"===e.id.type&&"yield"===e.id.name&&this.raise(e.id.start,"Binding yield in strict mode"),u){var l=Object.create(null),c=this.state.strict;o&&(this.state.strict=!0),e.id&&this.checkLVal(e.id,!0,void 0,"function name");var p=e.params,h=Array.isArray(p),f=0;for(p=h?p:p[Symbol.iterator]();;){var d;if(h){if(f>=p.length)break;d=p[f++]}else{if((f=p.next()).done)break;d=f.value}var m=d;o&&"Identifier"!==m.type&&this.raise(m.start,"Non-simple parameter in strict mode"),this.checkLVal(m,!0,l,"function parameter list")}this.state.strict=c}},Y.parseExprList=function(e,t,r){for(var n=[],i=!0;!this.eat(e);){if(i)i=!1;else if(this.expect(T.comma),this.eat(e))break;n.push(this.parseExprListItem(t,r))}return n},Y.parseExprListItem=function(e,t,r){return e&&this.match(T.comma)?null:this.match(T.ellipsis)?this.parseSpread(t):this.parseMaybeAssign(!1,t,this.parseParenItem,r)},Y.parseIdentifier=function(e){var t=this.startNode();return e||this.checkReservedWord(this.state.value,this.state.start,!!this.state.type.keyword,!1),this.match(T.name)?t.name=this.state.value:this.state.type.keyword?t.name=this.state.type.keyword:this.unexpected(),!e&&"await"===t.name&&this.state.inAsync&&this.raise(t.start,"invalid use of await inside of an async function"),t.loc.identifierName=t.name,this.next(),this.finishNode(t,"Identifier")},Y.checkReservedWord=function(e,t,r,n){(this.isReservedWord(e)||r&&this.isKeyword(e))&&this.raise(t,e+" is a reserved word"),this.state.strict&&(f.strict(e)||n&&f.strictBind(e))&&this.raise(t,e+" is a reserved word in strict mode")},Y.parseAwait=function(e){return this.state.inAsync||this.unexpected(),this.match(T.star)&&this.raise(e.start,"await* has been removed from the async functions proposal. Use Promise.all() instead."),e.argument=this.parseMaybeUnary(),this.finishNode(e,"AwaitExpression")},Y.parseYield=function(){var e=this.startNode();return this.next(),this.match(T.semi)||this.canInsertSemicolon()||!this.match(T.star)&&!this.state.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(T.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")};var H=q.prototype,$=["leadingComments","trailingComments","innerComments"],Q=function(){function e(t,r,n){D(this,e),this.type="",this.start=t,this.end=0,this.loc=new M(r),n&&(this.loc.filename=n)}return e.prototype.__clone=function(){var t=new e;for(var r in this)$.indexOf(r)<0&&(t[r]=this[r]);return t},e}();H.startNode=function(){return new Q(this.state.start,this.state.startLoc,this.filename)},H.startNodeAt=function(e,t){return new Q(e,t,this.filename)},H.finishNode=function(e,t){return l.call(this,e,t,this.state.lastTokEnd,this.state.lastTokEndLoc)},H.finishNodeAt=function(e,t,r,n){return l.call(this,e,t,r,n)};q.prototype.raise=function(e,t){var r=function(e,t){for(var r=1,n=0;;){O.lastIndex=n;var i=O.exec(e);if(!(i&&i.index<t))return new L(r,t-n);++r,n=i.index+i[0].length}}(this.input,e);t+=" ("+r.line+":"+r.column+")";var n=new SyntaxError(t);throw n.pos=e,n.loc=r,n};var Z=q.prototype;Z.addComment=function(e){this.filename&&(e.loc.filename=this.filename),this.state.trailingComments.push(e),this.state.leadingComments.push(e)},Z.processComment=function(e){if(!("Program"===e.type&&e.body.length>0)){var t=this.state.commentStack,r=void 0,n=void 0,i=void 0,s=void 0,a=void 0;if(this.state.trailingComments.length>0)this.state.trailingComments[0].start>=e.end?(i=this.state.trailingComments,this.state.trailingComments=[]):this.state.trailingComments.length=0;else{var o=c(t);t.length>0&&o.trailingComments&&o.trailingComments[0].start>=e.end&&(i=o.trailingComments,o.trailingComments=null)}for(t.length>0&&c(t).start>=e.start&&(r=t.pop());t.length>0&&c(t).start>=e.start;)n=t.pop();if(!n&&r&&(n=r),r&&this.state.leadingComments.length>0){var u=c(this.state.leadingComments);if("ObjectProperty"===r.type){if(u.start>=e.start&&this.state.commentPreviousNode){for(a=0;a<this.state.leadingComments.length;a++)this.state.leadingComments[a].end<this.state.commentPreviousNode.end&&(this.state.leadingComments.splice(a,1),a--);this.state.leadingComments.length>0&&(r.trailingComments=this.state.leadingComments,this.state.leadingComments=[])}}else if("CallExpression"===e.type&&e.arguments&&e.arguments.length){var l=c(e.arguments);l&&u.start>=l.start&&u.end<=e.end&&this.state.commentPreviousNode&&this.state.leadingComments.length>0&&(l.trailingComments=this.state.leadingComments,this.state.leadingComments=[])}}if(n){if(n.leadingComments)if(n!==e&&c(n.leadingComments).end<=e.start)e.leadingComments=n.leadingComments,n.leadingComments=null;else for(s=n.leadingComments.length-2;s>=0;--s)if(n.leadingComments[s].end<=e.start){e.leadingComments=n.leadingComments.splice(0,s+1);break}}else if(this.state.leadingComments.length>0)if(c(this.state.leadingComments).end<=e.start){if(this.state.commentPreviousNode)for(a=0;a<this.state.leadingComments.length;a++)this.state.leadingComments[a].end<this.state.commentPreviousNode.end&&(this.state.leadingComments.splice(a,1),a--);this.state.leadingComments.length>0&&(e.leadingComments=this.state.leadingComments,this.state.leadingComments=[])}else{for(s=0;s<this.state.leadingComments.length&&!(this.state.leadingComments[s].end>e.start);s++);e.leadingComments=this.state.leadingComments.slice(0,s),0===e.leadingComments.length&&(e.leadingComments=null),0===(i=this.state.leadingComments.slice(s)).length&&(i=null)}this.state.commentPreviousNode=e,i&&(i.length&&i[0].start>=e.start&&c(i).end<=e.end?e.innerComments=i:e.trailingComments=i),t.push(e)}};var ee=q.prototype;ee.estreeParseRegExpLiteral=function(e){var t=e.pattern,r=e.flags,n=null;try{n=new RegExp(t,r)}catch(e){}var i=this.estreeParseLiteral(n);return i.regex={pattern:t,flags:r},i},ee.estreeParseLiteral=function(e){return this.parseLiteral(e,"Literal")},ee.directiveToStmt=function(e){var t=e.value,r=this.startNodeAt(e.start,e.loc.start),n=this.startNodeAt(t.start,t.loc.start);return n.value=t.value,n.raw=t.extra.raw,r.expression=this.finishNodeAt(n,"Literal",t.end,t.loc.end),r.directive=t.extra.raw.slice(1,-1),this.finishNodeAt(r,"ExpressionStatement",e.end,e.loc.end)};var te=["any","mixed","empty","bool","boolean","number","string","void","null"],re=q.prototype;re.flowParseTypeInitialiser=function(e){var t=this.state.inType;this.state.inType=!0,this.expect(e||T.colon);var r=this.flowParseType();return this.state.inType=t,r},re.flowParsePredicate=function(){var e=this.startNode(),t=this.state.startLoc,r=this.state.start;this.expect(T.modulo);var n=this.state.startLoc;return this.expectContextual("checks"),t.line===n.line&&t.column===n.column-1||this.raise(r,"Spaces between ´%´ and ´checks´ are not allowed here."),this.eat(T.parenL)?(e.expression=this.parseExpression(),this.expect(T.parenR),this.finishNode(e,"DeclaredPredicate")):this.finishNode(e,"InferredPredicate")},re.flowParseTypeAndPredicateInitialiser=function(){var e=this.state.inType;this.state.inType=!0,this.expect(T.colon);var t=null,r=null;return this.match(T.modulo)?(this.state.inType=e,r=this.flowParsePredicate()):(t=this.flowParseType(),this.state.inType=e,this.match(T.modulo)&&(r=this.flowParsePredicate())),[t,r]},re.flowParseDeclareClass=function(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},re.flowParseDeclareFunction=function(e){this.next();var t=e.id=this.parseIdentifier(),r=this.startNode(),n=this.startNode();this.isRelational("<")?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,this.expect(T.parenL);var i=this.flowParseFunctionTypeParams();r.params=i.params,r.rest=i.rest,this.expect(T.parenR);var s=null,a=this.flowParseTypeAndPredicateInitialiser();return r.returnType=a[0],s=a[1],n.typeAnnotation=this.finishNode(r,"FunctionTypeAnnotation"),n.predicate=s,t.typeAnnotation=this.finishNode(n,"TypeAnnotation"),this.finishNode(t,t.type),this.semicolon(),this.finishNode(e,"DeclareFunction")},re.flowParseDeclare=function(e){return this.match(T._class)?this.flowParseDeclareClass(e):this.match(T._function)?this.flowParseDeclareFunction(e):this.match(T._var)?this.flowParseDeclareVariable(e):this.isContextual("module")?this.lookahead().type===T.dot?this.flowParseDeclareModuleExports(e):this.flowParseDeclareModule(e):this.isContextual("type")?this.flowParseDeclareTypeAlias(e):this.isContextual("opaque")?this.flowParseDeclareOpaqueType(e):this.isContextual("interface")?this.flowParseDeclareInterface(e):this.match(T._export)?this.flowParseDeclareExportDeclaration(e):void this.unexpected()},re.flowParseDeclareExportDeclaration=function(e){if(this.expect(T._export),this.isContextual("opaque"))return e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,"DeclareExportDeclaration");throw this.unexpected()},re.flowParseDeclareVariable=function(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(),this.semicolon(),this.finishNode(e,"DeclareVariable")},re.flowParseDeclareModule=function(e){this.next(),this.match(T.string)?e.id=this.parseExprAtom():e.id=this.parseIdentifier();var t=e.body=this.startNode(),r=t.body=[];for(this.expect(T.braceL);!this.match(T.braceR);){var n=this.startNode();if(this.match(T._import)){var i=this.lookahead();"type"!==i.value&&"typeof"!==i.value&&this.unexpected(null,"Imports within a `declare module` body must always be `import type` or `import typeof`"),this.parseImport(n)}else this.expectContextual("declare","Only declares and type imports are allowed inside declare module"),n=this.flowParseDeclare(n,!0);r.push(n)}return this.expect(T.braceR),this.finishNode(t,"BlockStatement"),this.finishNode(e,"DeclareModule")},re.flowParseDeclareModuleExports=function(e){return this.expectContextual("module"),this.expect(T.dot),this.expectContextual("exports"),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")},re.flowParseDeclareTypeAlias=function(e){return this.next(),this.flowParseTypeAlias(e),this.finishNode(e,"DeclareTypeAlias")},re.flowParseDeclareOpaqueType=function(e){return this.next(),this.flowParseOpaqueType(e,!0),this.finishNode(e,"DeclareOpaqueType")},re.flowParseDeclareInterface=function(e){return this.next(),this.flowParseInterfaceish(e),this.finishNode(e,"DeclareInterface")},re.flowParseInterfaceish=function(e){if(e.id=this.parseIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],e.mixins=[],this.eat(T._extends))do{e.extends.push(this.flowParseInterfaceExtends())}while(this.eat(T.comma));if(this.isContextual("mixins")){this.next();do{e.mixins.push(this.flowParseInterfaceExtends())}while(this.eat(T.comma))}e.body=this.flowParseObjectType(!0,!1,!1)},re.flowParseInterfaceExtends=function(){var e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")},re.flowParseInterface=function(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},re.flowParseRestrictedIdentifier=function(e){return te.indexOf(this.state.value)>-1&&this.raise(this.state.start,"Cannot overwrite primitive type "+this.state.value),this.parseIdentifier(e)},re.flowParseTypeAlias=function(e){return e.id=this.flowParseRestrictedIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(T.eq),this.semicolon(),this.finishNode(e,"TypeAlias")},re.flowParseOpaqueType=function(e,t){return this.expectContextual("type"),e.id=this.flowParseRestrictedIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.supertype=null,this.match(T.colon)&&(e.supertype=this.flowParseTypeInitialiser(T.colon)),e.impltype=null,t||(e.impltype=this.flowParseTypeInitialiser(T.eq)),this.semicolon(),this.finishNode(e,"OpaqueType")},re.flowParseTypeParameter=function(){var e=this.startNode(),t=this.flowParseVariance(),r=this.flowParseTypeAnnotatableIdentifier();return e.name=r.name,e.variance=t,e.bound=r.typeAnnotation,this.match(T.eq)&&(this.eat(T.eq),e.default=this.flowParseType()),this.finishNode(e,"TypeParameter")},re.flowParseTypeParameterDeclaration=function(){var e=this.state.inType,t=this.startNode();t.params=[],this.state.inType=!0,this.isRelational("<")||this.match(T.jsxTagStart)?this.next():this.unexpected();do{t.params.push(this.flowParseTypeParameter()),this.isRelational(">")||this.expect(T.comma)}while(!this.isRelational(">"));return this.expectRelational(">"),this.state.inType=e,this.finishNode(t,"TypeParameterDeclaration")},re.flowParseTypeParameterInstantiation=function(){var e=this.startNode(),t=this.state.inType;for(e.params=[],this.state.inType=!0,this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseType()),this.isRelational(">")||this.expect(T.comma);return this.expectRelational(">"),this.state.inType=t,this.finishNode(e,"TypeParameterInstantiation")},re.flowParseObjectPropertyKey=function(){return this.match(T.num)||this.match(T.string)?this.parseExprAtom():this.parseIdentifier(!0)},re.flowParseObjectTypeIndexer=function(e,t,r){return e.static=t,this.expect(T.bracketL),this.lookahead().type===T.colon?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(T.bracketR),e.value=this.flowParseTypeInitialiser(),e.variance=r,this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeIndexer")},re.flowParseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(T.parenL);!this.match(T.parenR)&&!this.match(T.ellipsis);)e.params.push(this.flowParseFunctionTypeParam()),this.match(T.parenR)||this.expect(T.comma);return this.eat(T.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),this.expect(T.parenR),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")},re.flowParseObjectTypeMethod=function(e,t,r,n){var i=this.startNodeAt(e,t);return i.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e,t)),i.static=r,i.key=n,i.optional=!1,this.flowObjectTypeSemicolon(),this.finishNode(i,"ObjectTypeProperty")},re.flowParseObjectTypeCallProperty=function(e,t){var r=this.startNode();return e.static=t,e.value=this.flowParseObjectTypeMethodish(r),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeCallProperty")},re.flowParseObjectType=function(e,t,r){var n=this.state.inType;this.state.inType=!0;var i=this.startNode(),s=void 0,a=void 0,o=!1;i.callProperties=[],i.properties=[],i.indexers=[];var u=void 0,l=void 0;for(t&&this.match(T.braceBarL)?(this.expect(T.braceBarL),u=T.braceBarR,l=!0):(this.expect(T.braceL),u=T.braceR,l=!1),i.exact=l;!this.match(u);){var c=!1,p=this.state.start,h=this.state.startLoc;s=this.startNode(),e&&this.isContextual("static")&&this.lookahead().type!==T.colon&&(this.next(),o=!0);var f=this.state.start,d=this.flowParseVariance();this.match(T.bracketL)?i.indexers.push(this.flowParseObjectTypeIndexer(s,o,d)):this.match(T.parenL)||this.isRelational("<")?(d&&this.unexpected(f),i.callProperties.push(this.flowParseObjectTypeCallProperty(s,o))):this.match(T.ellipsis)?(r||this.unexpected(null,"Spread operator cannot appear in class or interface definitions"),d&&this.unexpected(d.start,"Spread properties cannot have variance"),this.expect(T.ellipsis),s.argument=this.flowParseType(),this.flowObjectTypeSemicolon(),i.properties.push(this.finishNode(s,"ObjectTypeSpreadProperty"))):(a=this.flowParseObjectPropertyKey(),this.isRelational("<")||this.match(T.parenL)?(d&&this.unexpected(d.start),i.properties.push(this.flowParseObjectTypeMethod(p,h,o,a))):(this.eat(T.question)&&(c=!0),s.key=a,s.value=this.flowParseTypeInitialiser(),s.optional=c,s.static=o,s.variance=d,this.flowObjectTypeSemicolon(),i.properties.push(this.finishNode(s,"ObjectTypeProperty")))),o=!1}this.expect(u);var m=this.finishNode(i,"ObjectTypeAnnotation");return this.state.inType=n,m},re.flowObjectTypeSemicolon=function(){this.eat(T.semi)||this.eat(T.comma)||this.match(T.braceR)||this.match(T.braceBarR)||this.unexpected()},re.flowParseQualifiedTypeIdentifier=function(e,t,r){e=e||this.state.start,t=t||this.state.startLoc;for(var n=r||this.parseIdentifier();this.eat(T.dot);){var i=this.startNodeAt(e,t);i.qualification=n,i.id=this.parseIdentifier(),n=this.finishNode(i,"QualifiedTypeIdentifier")}return n},re.flowParseGenericType=function(e,t,r){var n=this.startNodeAt(e,t);return n.typeParameters=null,n.id=this.flowParseQualifiedTypeIdentifier(e,t,r),this.isRelational("<")&&(n.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(n,"GenericTypeAnnotation")},re.flowParseTypeofType=function(){var e=this.startNode();return this.expect(T._typeof),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},re.flowParseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(T.bracketL);this.state.pos<this.input.length&&!this.match(T.bracketR)&&(e.types.push(this.flowParseType()),!this.match(T.bracketR));)this.expect(T.comma);return this.expect(T.bracketR),this.finishNode(e,"TupleTypeAnnotation")},re.flowParseFunctionTypeParam=function(){var e=null,t=!1,r=null,n=this.startNode(),i=this.lookahead();return i.type===T.colon||i.type===T.question?(e=this.parseIdentifier(),this.eat(T.question)&&(t=!0),r=this.flowParseTypeInitialiser()):r=this.flowParseType(),n.name=e,n.optional=t,n.typeAnnotation=r,this.finishNode(n,"FunctionTypeParam")},re.reinterpretTypeAsFunctionTypeParam=function(e){var t=this.startNodeAt(e.start,e.loc.start);return t.name=null,t.optional=!1,t.typeAnnotation=e,this.finishNode(t,"FunctionTypeParam")},re.flowParseFunctionTypeParams=function(){for(var e={params:arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],rest:null};!this.match(T.parenR)&&!this.match(T.ellipsis);)e.params.push(this.flowParseFunctionTypeParam()),this.match(T.parenR)||this.expect(T.comma);return this.eat(T.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),e},re.flowIdentToTypeAnnotation=function(e,t,r,n){switch(n.name){case"any":return this.finishNode(r,"AnyTypeAnnotation");case"void":return this.finishNode(r,"VoidTypeAnnotation");case"bool":case"boolean":return this.finishNode(r,"BooleanTypeAnnotation");case"mixed":return this.finishNode(r,"MixedTypeAnnotation");case"empty":return this.finishNode(r,"EmptyTypeAnnotation");case"number":return this.finishNode(r,"NumberTypeAnnotation");case"string":return this.finishNode(r,"StringTypeAnnotation");default:return this.flowParseGenericType(e,t,n)}},re.flowParsePrimaryType=function(){var e=this.state.start,t=this.state.startLoc,r=this.startNode(),n=void 0,i=void 0,s=!1,a=this.state.noAnonFunctionType;switch(this.state.type){case T.name:return this.flowIdentToTypeAnnotation(e,t,r,this.parseIdentifier());case T.braceL:return this.flowParseObjectType(!1,!1,!0);case T.braceBarL:return this.flowParseObjectType(!1,!0,!0);case T.bracketL:return this.flowParseTupleType();case T.relational:if("<"===this.state.value)return r.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(T.parenL),n=this.flowParseFunctionTypeParams(),r.params=n.params,r.rest=n.rest,this.expect(T.parenR),this.expect(T.arrow),r.returnType=this.flowParseType(),this.finishNode(r,"FunctionTypeAnnotation");break;case T.parenL:if(this.next(),!this.match(T.parenR)&&!this.match(T.ellipsis))if(this.match(T.name)){var o=this.lookahead().type;s=o!==T.question&&o!==T.colon}else s=!0;if(s){if(this.state.noAnonFunctionType=!1,i=this.flowParseType(),this.state.noAnonFunctionType=a,this.state.noAnonFunctionType||!(this.match(T.comma)||this.match(T.parenR)&&this.lookahead().type===T.arrow))return this.expect(T.parenR),i;this.eat(T.comma)}return n=i?this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(i)]):this.flowParseFunctionTypeParams(),r.params=n.params,r.rest=n.rest,this.expect(T.parenR),this.expect(T.arrow),r.returnType=this.flowParseType(),r.typeParameters=null,this.finishNode(r,"FunctionTypeAnnotation");case T.string:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case T._true:case T._false:return r.value=this.match(T._true),this.next(),this.finishNode(r,"BooleanLiteralTypeAnnotation");case T.plusMin:if("-"===this.state.value)return this.next(),this.match(T.num)||this.unexpected(null,"Unexpected token, expected number"),this.parseLiteral(-this.state.value,"NumericLiteralTypeAnnotation",r.start,r.loc.start);this.unexpected();case T.num:return this.parseLiteral(this.state.value,"NumericLiteralTypeAnnotation");case T._null:return r.value=this.match(T._null),this.next(),this.finishNode(r,"NullLiteralTypeAnnotation");case T._this:return r.value=this.match(T._this),this.next(),this.finishNode(r,"ThisTypeAnnotation");case T.star:return this.next(),this.finishNode(r,"ExistentialTypeParam");default:if("typeof"===this.state.type.keyword)return this.flowParseTypeofType()}this.unexpected()},re.flowParsePostfixType=function(){for(var e=this.state.start,t=this.state.startLoc,r=this.flowParsePrimaryType();!this.canInsertSemicolon()&&this.match(T.bracketL);){var n=this.startNodeAt(e,t);n.elementType=r,this.expect(T.bracketL),this.expect(T.bracketR),r=this.finishNode(n,"ArrayTypeAnnotation")}return r},re.flowParsePrefixType=function(){var e=this.startNode();return this.eat(T.question)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()},re.flowParseAnonFunctionWithoutParens=function(){var e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(T.arrow)){var t=this.startNodeAt(e.start,e.loc.start);return t.params=[this.reinterpretTypeAsFunctionTypeParam(e)],t.rest=null,t.returnType=this.flowParseType(),t.typeParameters=null,this.finishNode(t,"FunctionTypeAnnotation")}return e},re.flowParseIntersectionType=function(){var e=this.startNode();this.eat(T.bitwiseAND);var t=this.flowParseAnonFunctionWithoutParens();for(e.types=[t];this.eat(T.bitwiseAND);)e.types.push(this.flowParseAnonFunctionWithoutParens());return 1===e.types.length?t:this.finishNode(e,"IntersectionTypeAnnotation")},re.flowParseUnionType=function(){var e=this.startNode();this.eat(T.bitwiseOR);var t=this.flowParseIntersectionType();for(e.types=[t];this.eat(T.bitwiseOR);)e.types.push(this.flowParseIntersectionType());return 1===e.types.length?t:this.finishNode(e,"UnionTypeAnnotation")},re.flowParseType=function(){var e=this.state.inType;this.state.inType=!0;var t=this.flowParseUnionType();return this.state.inType=e,t},re.flowParseTypeAnnotation=function(){var e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")},re.flowParseTypeAndPredicateAnnotation=function(){var e=this.startNode(),t=this.flowParseTypeAndPredicateInitialiser();return e.typeAnnotation=t[0],e.predicate=t[1],this.finishNode(e,"TypeAnnotation")},re.flowParseTypeAnnotatableIdentifier=function(){var e=this.flowParseRestrictedIdentifier();return this.match(T.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(e,e.type)),e},re.typeCastToParameter=function(e){return e.expression.typeAnnotation=e.typeAnnotation,this.finishNodeAt(e.expression,e.expression.type,e.typeAnnotation.end,e.typeAnnotation.loc.end)},re.flowParseVariance=function(){var e=null;return this.match(T.plusMin)&&("+"===this.state.value?e="plus":"-"===this.state.value&&(e="minus"),this.next()),e};var ne=String.fromCodePoint;if(!ne){var ie=String.fromCharCode,se=Math.floor;ne=function(){var e=[],t=void 0,r=void 0,n=-1,i=arguments.length;if(!i)return"";for(var s="";++n<i;){var a=Number(arguments[n]);if(!isFinite(a)||a<0||a>1114111||se(a)!=a)throw RangeError("Invalid code point: "+a);a<=65535?e.push(a):(t=55296+((a-=65536)>>10),r=a%1024+56320,e.push(t,r)),(n+1==i||e.length>16384)&&(s+=ie.apply(null,e),e.length=0)}return s}}var ae=ne,oe={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},ue=/^[\da-fA-F]+$/,le=/^\d+$/;I.j_oTag=new j("<tag",!1),I.j_cTag=new j("</tag",!1),I.j_expr=new j("<tag>...</tag>",!0,!0),T.jsxName=new w("jsxName"),T.jsxText=new w("jsxText",{beforeExpr:!0}),T.jsxTagStart=new w("jsxTagStart",{startsExpr:!0}),T.jsxTagEnd=new w("jsxTagEnd"),T.jsxTagStart.updateContext=function(){this.state.context.push(I.j_expr),this.state.context.push(I.j_oTag),this.state.exprAllowed=!1},T.jsxTagEnd.updateContext=function(e){var t=this.state.context.pop();t===I.j_oTag&&e===T.slash||t===I.j_cTag?(this.state.context.pop(),this.state.exprAllowed=this.curContext()===I.j_expr):this.state.exprAllowed=!0};var ce=q.prototype;ce.jsxReadToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated JSX contents");var r=this.input.charCodeAt(this.state.pos);switch(r){case 60:case 123:return this.state.pos===this.state.start?60===r&&this.state.exprAllowed?(++this.state.pos,this.finishToken(T.jsxTagStart)):this.getTokenFromCode(r):(e+=this.input.slice(t,this.state.pos),this.finishToken(T.jsxText,e));case 38:e+=this.input.slice(t,this.state.pos),e+=this.jsxReadEntity(),t=this.state.pos;break;default:o(r)?(e+=this.input.slice(t,this.state.pos),e+=this.jsxReadNewLine(!0),t=this.state.pos):++this.state.pos}}},ce.jsxReadNewLine=function(e){var t=this.input.charCodeAt(this.state.pos),r=void 0;return++this.state.pos,13===t&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,r=e?"\n":"\r\n"):r=String.fromCharCode(t),++this.state.curLine,this.state.lineStart=this.state.pos,r},ce.jsxReadString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;38===n?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos):o(n)?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!1),r=this.state.pos):++this.state.pos}return t+=this.input.slice(r,this.state.pos++),this.finishToken(T.string,t)},ce.jsxReadEntity=function(){for(var e="",t=0,r=void 0,n=this.input[this.state.pos],i=++this.state.pos;this.state.pos<this.input.length&&t++<10;){if(";"===(n=this.input[this.state.pos++])){"#"===e[0]?"x"===e[1]?(e=e.substr(2),ue.test(e)&&(r=ae(parseInt(e,16)))):(e=e.substr(1),le.test(e)&&(r=ae(parseInt(e,10)))):r=oe[e];break}e+=n}return r||(this.state.pos=i,"&")},ce.jsxReadWord=function(){var e=void 0,t=this.state.pos;do{e=this.input.charCodeAt(++this.state.pos)}while(a(e)||45===e);return this.finishToken(T.jsxName,this.input.slice(t,this.state.pos))},ce.jsxParseIdentifier=function(){var e=this.startNode();return this.match(T.jsxName)?e.name=this.state.value:this.state.type.keyword?e.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(e,"JSXIdentifier")},ce.jsxParseNamespacedName=function(){var e=this.state.start,t=this.state.startLoc,r=this.jsxParseIdentifier();if(!this.eat(T.colon))return r;var n=this.startNodeAt(e,t);return n.namespace=r,n.name=this.jsxParseIdentifier(),this.finishNode(n,"JSXNamespacedName")},ce.jsxParseElementName=function(){for(var e=this.state.start,t=this.state.startLoc,r=this.jsxParseNamespacedName();this.eat(T.dot);){var n=this.startNodeAt(e,t);n.object=r,n.property=this.jsxParseIdentifier(),r=this.finishNode(n,"JSXMemberExpression")}return r},ce.jsxParseAttributeValue=function(){var e=void 0;switch(this.state.type){case T.braceL:if("JSXEmptyExpression"!==(e=this.jsxParseExpressionContainer()).expression.type)return e;this.raise(e.start,"JSX attributes must only be assigned a non-empty expression");case T.jsxTagStart:case T.string:return e=this.parseExprAtom(),e.extra=null,e;default:this.raise(this.state.start,"JSX value should be either an expression or a quoted JSX text")}},ce.jsxParseEmptyExpression=function(){var e=this.startNodeAt(this.state.lastTokEnd,this.state.lastTokEndLoc);return this.finishNodeAt(e,"JSXEmptyExpression",this.state.start,this.state.startLoc)},ce.jsxParseSpreadChild=function(){var e=this.startNode();return this.expect(T.braceL),this.expect(T.ellipsis),e.expression=this.parseExpression(),this.expect(T.braceR),this.finishNode(e,"JSXSpreadChild")},ce.jsxParseExpressionContainer=function(){var e=this.startNode();return this.next(),this.match(T.braceR)?e.expression=this.jsxParseEmptyExpression():e.expression=this.parseExpression(),this.expect(T.braceR),this.finishNode(e,"JSXExpressionContainer")},ce.jsxParseAttribute=function(){var e=this.startNode();return this.eat(T.braceL)?(this.expect(T.ellipsis),e.argument=this.parseMaybeAssign(),this.expect(T.braceR),this.finishNode(e,"JSXSpreadAttribute")):(e.name=this.jsxParseNamespacedName(),e.value=this.eat(T.eq)?this.jsxParseAttributeValue():null,this.finishNode(e,"JSXAttribute"))},ce.jsxParseOpeningElementAt=function(e,t){var r=this.startNodeAt(e,t);for(r.attributes=[],r.name=this.jsxParseElementName();!this.match(T.slash)&&!this.match(T.jsxTagEnd);)r.attributes.push(this.jsxParseAttribute());return r.selfClosing=this.eat(T.slash),this.expect(T.jsxTagEnd),this.finishNode(r,"JSXOpeningElement")},ce.jsxParseClosingElementAt=function(e,t){var r=this.startNodeAt(e,t);return r.name=this.jsxParseElementName(),this.expect(T.jsxTagEnd),this.finishNode(r,"JSXClosingElement")},ce.jsxParseElementAt=function(e,t){var r=this.startNodeAt(e,t),n=[],i=this.jsxParseOpeningElementAt(e,t),s=null;if(!i.selfClosing){e:for(;;)switch(this.state.type){case T.jsxTagStart:if(e=this.state.start,t=this.state.startLoc,this.next(),this.eat(T.slash)){s=this.jsxParseClosingElementAt(e,t);break e}n.push(this.jsxParseElementAt(e,t));break;case T.jsxText:n.push(this.parseExprAtom());break;case T.braceL:this.lookahead().type===T.ellipsis?n.push(this.jsxParseSpreadChild()):n.push(this.jsxParseExpressionContainer());break;default:this.unexpected()}h(s.name)!==h(i.name)&&this.raise(s.start,"Expected corresponding JSX closing tag for <"+h(i.name)+">")}return r.openingElement=i,r.closingElement=s,r.children=n,this.match(T.relational)&&"<"===this.state.value&&this.raise(this.state.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(r,"JSXElement")},ce.jsxParseElement=function(){var e=this.state.start,t=this.state.startLoc;return this.next(),this.jsxParseElementAt(e,t)};V.estree=function(e){e.extend("checkDeclaration",function(e){return function(t){p(t)?this.checkDeclaration(t.value):e.call(this,t)}}),e.extend("checkGetterSetterParamCount",function(){return function(e){var t="get"===e.kind?0:1;if(e.value.params.length!==t){var r=e.start;"get"===e.kind?this.raise(r,"getter should have no params"):this.raise(r,"setter should have exactly one param")}}}),e.extend("checkLVal",function(e){return function(t,r,n){var i=this;switch(t.type){case"ObjectPattern":t.properties.forEach(function(e){i.checkLVal("Property"===e.type?e.value:e,r,n,"object destructuring pattern")});break;default:for(var s=arguments.length,a=Array(s>3?s-3:0),o=3;o<s;o++)a[o-3]=arguments[o];e.call.apply(e,[this,t,r,n].concat(a))}}}),e.extend("checkPropClash",function(){return function(e,t){if(!e.computed&&p(e)){var r=e.key;"__proto__"===("Identifier"===r.type?r.name:String(r.value))&&(t.proto&&this.raise(r.start,"Redefinition of __proto__ property"),t.proto=!0)}}}),e.extend("isStrictBody",function(){return function(e,t){if(!t&&e.body.body.length>0){var r=e.body.body,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;if("ExpressionStatement"!==a.type||"Literal"!==a.expression.type)break;if("use strict"===a.expression.value)return!0}}return!1}}),e.extend("isValidDirective",function(){return function(e){return!("ExpressionStatement"!==e.type||"Literal"!==e.expression.type||"string"!=typeof e.expression.value||e.expression.extra&&e.expression.extra.parenthesized)}}),e.extend("stmtToDirective",function(e){return function(t){var r=e.call(this,t),n=t.expression.value;return r.value.value=n,r}}),e.extend("parseBlockBody",function(e){return function(t){for(var r=this,n=arguments.length,i=Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];e.call.apply(e,[this,t].concat(i)),t.directives.reverse().forEach(function(e){t.body.unshift(r.directiveToStmt(e))}),delete t.directives}}),e.extend("parseClassMethod",function(){return function(e,t,r,n){this.parseMethod(t,r,n),t.typeParameters&&(t.value.typeParameters=t.typeParameters,delete t.typeParameters),e.body.push(this.finishNode(t,"MethodDefinition"))}}),e.extend("parseExprAtom",function(e){return function(){switch(this.state.type){case T.regexp:return this.estreeParseRegExpLiteral(this.state.value);case T.num:case T.string:return this.estreeParseLiteral(this.state.value);case T._null:return this.estreeParseLiteral(null);case T._true:return this.estreeParseLiteral(!0);case T._false:return this.estreeParseLiteral(!1);default:for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.call.apply(e,[this].concat(r))}}}),e.extend("parseLiteral",function(e){return function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=e.call.apply(e,[this].concat(r));return i.raw=i.extra.raw,delete i.extra,i}}),e.extend("parseMethod",function(e){return function(t){var r=this.startNode();r.kind=t.kind;for(var n=arguments.length,i=Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return r=e.call.apply(e,[this,r].concat(i)),delete r.kind,t.value=this.finishNode(r,"FunctionExpression"),t}}),e.extend("parseObjectMethod",function(e){return function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=e.call.apply(e,[this].concat(r));return i&&("method"===i.kind&&(i.kind="init"),i.type="Property"),i}}),e.extend("parseObjectProperty",function(e){return function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=e.call.apply(e,[this].concat(r));return i&&(i.kind="init",i.type="Property"),i}}),e.extend("toAssignable",function(e){return function(t,r){for(var n=arguments.length,i=Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];if(p(t))return this.toAssignable.apply(this,[t.value,r].concat(i)),t;if("ObjectExpression"===t.type){t.type="ObjectPattern";var a=t.properties,o=Array.isArray(a),u=0;for(a=o?a:a[Symbol.iterator]();;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l;"get"===c.kind||"set"===c.kind?this.raise(c.key.start,"Object pattern can't contain getter or setter"):c.method?this.raise(c.key.start,"Object pattern can't contain methods"):this.toAssignable(c,r,"object destructuring pattern")}return t}return e.call.apply(e,[this,t,r].concat(i))}})},V.flow=function(e){e.extend("parseFunctionBody",function(e){return function(t,r){return this.match(T.colon)&&!r&&(t.returnType=this.flowParseTypeAndPredicateAnnotation()),e.call(this,t,r)}}),e.extend("parseStatement",function(e){return function(t,r){if(this.state.strict&&this.match(T.name)&&"interface"===this.state.value){var n=this.startNode();return this.next(),this.flowParseInterface(n)}return e.call(this,t,r)}}),e.extend("parseExpressionStatement",function(e){return function(t,r){if("Identifier"===r.type)if("declare"===r.name){if(this.match(T._class)||this.match(T.name)||this.match(T._function)||this.match(T._var)||this.match(T._export))return this.flowParseDeclare(t)}else if(this.match(T.name)){if("interface"===r.name)return this.flowParseInterface(t);if("type"===r.name)return this.flowParseTypeAlias(t);if("opaque"===r.name)return this.flowParseOpaqueType(t,!1)}return e.call(this,t,r)}}),e.extend("shouldParseExportDeclaration",function(e){return function(){return this.isContextual("type")||this.isContextual("interface")||this.isContextual("opaque")||e.call(this)}}),e.extend("isExportDefaultSpecifier",function(e){return function(){return(!this.match(T.name)||"type"!==this.state.value&&"interface"!==this.state.value&&"opaque"!==this.state.value)&&e.call(this)}}),e.extend("parseConditional",function(e){return function(t,r,n,i,s){if(s&&this.match(T.question)){var a=this.state.clone();try{return e.call(this,t,r,n,i)}catch(e){if(e instanceof SyntaxError)return this.state=a,s.start=e.pos||this.state.start,t;throw e}}return e.call(this,t,r,n,i)}}),e.extend("parseParenItem",function(e){return function(t,r,n){if(t=e.call(this,t,r,n),this.eat(T.question)&&(t.optional=!0),this.match(T.colon)){var i=this.startNodeAt(r,n);return i.expression=t,i.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(i,"TypeCastExpression")}return t}}),e.extend("parseExport",function(e){return function(t){return"ExportNamedDeclaration"===(t=e.call(this,t)).type&&(t.exportKind=t.exportKind||"value"),t}}),e.extend("parseExportDeclaration",function(e){return function(t){if(this.isContextual("type")){t.exportKind="type";var r=this.startNode();return this.next(),this.match(T.braceL)?(t.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(t),null):this.flowParseTypeAlias(r)}if(this.isContextual("opaque")){t.exportKind="type";var n=this.startNode();return this.next(),this.flowParseOpaqueType(n,!1)}if(this.isContextual("interface")){t.exportKind="type";var i=this.startNode();return this.next(),this.flowParseInterface(i)}return e.call(this,t)}}),e.extend("parseClassId",function(e){return function(t){e.apply(this,arguments),this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}}),e.extend("isKeyword",function(e){return function(t){return(!this.state.inType||"void"!==t)&&e.call(this,t)}}),e.extend("readToken",function(e){return function(t){return!this.state.inType||62!==t&&60!==t?e.call(this,t):this.finishOp(T.relational,1)}}),e.extend("jsx_readToken",function(e){return function(){if(!this.state.inType)return e.call(this)}}),e.extend("toAssignable",function(e){return function(t,r,n){return"TypeCastExpression"===t.type?e.call(this,this.typeCastToParameter(t),r,n):e.call(this,t,r,n)}}),e.extend("toAssignableList",function(e){return function(t,r,n){for(var i=0;i<t.length;i++){var s=t[i];s&&"TypeCastExpression"===s.type&&(t[i]=this.typeCastToParameter(s))}return e.call(this,t,r,n)}}),e.extend("toReferencedList",function(){return function(e){for(var t=0;t<e.length;t++){var r=e[t];r&&r._exprListItem&&"TypeCastExpression"===r.type&&this.raise(r.start,"Unexpected type cast")}return e}}),e.extend("parseExprListItem",function(e){return function(){for(var t=this.startNode(),r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=e.call.apply(e,[this].concat(n));return this.match(T.colon)?(t._exprListItem=!0,t.expression=s,t.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(t,"TypeCastExpression")):s}}),e.extend("checkLVal",function(e){return function(t){if("TypeCastExpression"!==t.type)return e.apply(this,arguments)}}),e.extend("parseClassProperty",function(e){return function(t){return delete t.variancePos,this.match(T.colon)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),e.call(this,t)}}),e.extend("isClassMethod",function(e){return function(){return this.isRelational("<")||e.call(this)}}),e.extend("isClassProperty",function(e){return function(){return this.match(T.colon)||e.call(this)}}),e.extend("isNonstaticConstructor",function(e){return function(t){return!this.match(T.colon)&&e.call(this,t)}}),e.extend("parseClassMethod",function(e){return function(t,r){r.variance&&this.unexpected(r.variancePos),delete r.variance,delete r.variancePos,this.isRelational("<")&&(r.typeParameters=this.flowParseTypeParameterDeclaration());for(var n=arguments.length,i=Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];e.call.apply(e,[this,t,r].concat(i))}}),e.extend("parseClassSuper",function(e){return function(t,r){if(e.call(this,t,r),t.superClass&&this.isRelational("<")&&(t.superTypeParameters=this.flowParseTypeParameterInstantiation()),this.isContextual("implements")){this.next();var n=t.implements=[];do{var i=this.startNode();i.id=this.parseIdentifier(),this.isRelational("<")?i.typeParameters=this.flowParseTypeParameterInstantiation():i.typeParameters=null,n.push(this.finishNode(i,"ClassImplements"))}while(this.eat(T.comma))}}}),e.extend("parsePropertyName",function(e){return function(t){var r=this.state.start,n=this.flowParseVariance(),i=e.call(this,t);return t.variance=n,t.variancePos=r,i}}),e.extend("parseObjPropValue",function(e){return function(t){t.variance&&this.unexpected(t.variancePos),delete t.variance,delete t.variancePos;var r=void 0;this.isRelational("<")&&(r=this.flowParseTypeParameterDeclaration(),this.match(T.parenL)||this.unexpected()),e.apply(this,arguments),r&&((t.value||t).typeParameters=r)}}),e.extend("parseAssignableListItemTypes",function(){return function(e){return this.eat(T.question)&&(e.optional=!0),this.match(T.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),this.finishNode(e,e.type),e}}),e.extend("parseMaybeDefault",function(e){return function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=e.apply(this,r);return"AssignmentPattern"===i.type&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(i.typeAnnotation.start,"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`"),i}}),e.extend("parseImportSpecifiers",function(e){return function(t){t.importKind="value";var r=null;if(this.match(T._typeof)?r="typeof":this.isContextual("type")&&(r="type"),r){var n=this.lookahead();(n.type===T.name&&"from"!==n.value||n.type===T.braceL||n.type===T.star)&&(this.next(),t.importKind=r)}e.call(this,t)}}),e.extend("parseImportSpecifier",function(){return function(e){var t=this.startNode(),r=this.state.start,n=this.parseIdentifier(!0),i=null;"type"===n.name?i="type":"typeof"===n.name&&(i="typeof");var s=!1;if(this.isContextual("as")){var a=this.parseIdentifier(!0);null===i||this.match(T.name)||this.state.type.keyword?(t.imported=n,t.importKind=null,t.local=this.parseIdentifier()):(t.imported=a,t.importKind=i,t.local=a.__clone())}else null!==i&&(this.match(T.name)||this.state.type.keyword)?(t.imported=this.parseIdentifier(!0),t.importKind=i,this.eatContextual("as")?t.local=this.parseIdentifier():(s=!0,t.local=t.imported.__clone())):(s=!0,t.imported=n,t.importKind=null,t.local=t.imported.__clone());"type"!==e.importKind&&"typeof"!==e.importKind||"type"!==t.importKind&&"typeof"!==t.importKind||this.raise(r,"`The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements`"),s&&this.checkReservedWord(t.local.name,t.start,!0,!0),this.checkLVal(t.local,!0,void 0,"import specifier"),e.specifiers.push(this.finishNode(t,"ImportSpecifier"))}}),e.extend("parseFunctionParams",function(e){return function(t){this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),e.call(this,t)}}),e.extend("parseVarHead",function(e){return function(t){e.call(this,t),this.match(T.colon)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(t.id,t.id.type))}}),e.extend("parseAsyncArrowFromCallExpression",function(e){return function(t,r){if(this.match(T.colon)){var n=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,t.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=n}return e.call(this,t,r)}}),e.extend("shouldParseAsyncArrow",function(e){return function(){return this.match(T.colon)||e.call(this)}}),e.extend("parseMaybeAssign",function(e){return function(){for(var t=null,r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];if(T.jsxTagStart&&this.match(T.jsxTagStart)){var s=this.state.clone();try{return e.apply(this,n)}catch(e){if(!(e instanceof SyntaxError))throw e;this.state=s,this.state.context.length-=2,t=e}}if(null!=t||this.isRelational("<")){var a=void 0,o=void 0;try{o=this.flowParseTypeParameterDeclaration(),(a=e.apply(this,n)).typeParameters=o,a.start=o.start,a.loc.start=o.loc.start}catch(e){throw t||e}if("ArrowFunctionExpression"===a.type)return a;if(null!=t)throw t;this.raise(o.start,"Expected an arrow function after this type parameter declaration")}return e.apply(this,n)}}),e.extend("parseArrow",function(e){return function(t){if(this.match(T.colon)){var r=this.state.clone();try{var n=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;var i=this.flowParseTypeAndPredicateAnnotation();this.state.noAnonFunctionType=n,this.canInsertSemicolon()&&this.unexpected(),this.match(T.arrow)||this.unexpected(),t.returnType=i}catch(e){if(!(e instanceof SyntaxError))throw e;this.state=r}}return e.call(this,t)}}),e.extend("shouldParseArrow",function(e){return function(){return this.match(T.colon)||e.call(this)}})},V.jsx=function(e){e.extend("parseExprAtom",function(e){return function(t){if(this.match(T.jsxText)){var r=this.parseLiteral(this.state.value,"JSXText");return r.extra=null,r}return this.match(T.jsxTagStart)?this.jsxParseElement():e.call(this,t)}}),e.extend("readToken",function(e){return function(t){if(this.state.inPropertyName)return e.call(this,t);var r=this.curContext();if(r===I.j_expr)return this.jsxReadToken();if(r===I.j_oTag||r===I.j_cTag){if(s(t))return this.jsxReadWord();if(62===t)return++this.state.pos,this.finishToken(T.jsxTagEnd);if((34===t||39===t)&&r===I.j_oTag)return this.jsxReadString(t)}return 60===t&&this.state.exprAllowed?(++this.state.pos,this.finishToken(T.jsxTagStart)):e.call(this,t)}}),e.extend("updateContext",function(e){return function(t){if(this.match(T.braceL)){var r=this.curContext();r===I.j_oTag?this.state.context.push(I.braceExpression):r===I.j_expr?this.state.context.push(I.templateQuasi):e.call(this,t),this.state.exprAllowed=!0}else{if(!this.match(T.slash)||t!==T.jsxTagStart)return e.call(this,t);this.state.context.length-=2,this.state.context.push(I.j_cTag),this.state.exprAllowed=!1}}})},r.parse=function(e,t){return new q(t,e).parse()},r.parseExpression=function(e,t){var r=new q(t,e);return r.options.strictMode&&(r.state.strict=!0),r.getExpression()},r.tokTypes=T},{}],189:[function(e,t,r){"use strict";function n(e,t,r){e instanceof RegExp&&(e=i(e,r)),t instanceof RegExp&&(t=i(t,r));var n=s(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function i(e,t){var r=t.match(e);return r?r[0]:null}function s(e,t,r){var n,i,s,a,o,u=r.indexOf(e),l=r.indexOf(t,u+1),c=u;if(u>=0&&l>0){for(n=[],s=r.length;c>=0&&!o;)c==u?(n.push(c),u=r.indexOf(e,c+1)):1==n.length?o=[n.pop(),l]:((i=n.pop())<s&&(s=i,a=l),l=r.indexOf(t,c+1)),c=u<l&&u>=0?u:l;n.length&&(o=[s,a])}return o}t.exports=n,n.range=s},{}],190:[function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function s(e,t,r){for(var n,s=[],a=t;a<r;a+=3)n=(e[a]<<16)+(e[a+1]<<8)+e[a+2],s.push(i(n));return s.join("")}r.byteLength=function(e){return 3*e.length/4-n(e)},r.toByteArray=function(e){var t,r,i,s,a,l=e.length;s=n(e),a=new u(3*l/4-s),r=s>0?l-4:l;var c=0;for(t=0;t<r;t+=4)i=o[e.charCodeAt(t)]<<18|o[e.charCodeAt(t+1)]<<12|o[e.charCodeAt(t+2)]<<6|o[e.charCodeAt(t+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===s?(i=o[e.charCodeAt(t)]<<2|o[e.charCodeAt(t+1)]>>4,a[c++]=255&i):1===s&&(i=o[e.charCodeAt(t)]<<10|o[e.charCodeAt(t+1)]<<4|o[e.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",o=[],u=0,l=r-n;u<l;u+=16383)o.push(s(e,u,u+16383>l?l:u+16383));return 1===n?(t=e[r-1],i+=a[t>>2],i+=a[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=a[t>>10],i+=a[t>>4&63],i+=a[t<<2&63],i+="="),o.push(i),o.join("")};for(var a=[],o=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,p=l.length;c<p;++c)a[c]=l[c],o[l.charCodeAt(c)]=c;o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],191:[function(e,t,r){function n(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function i(e){return e.split(f).join("\\").split(d).join("{").split(m).join("}").split(y).join(",").split(g).join(".")}function s(e){if(!e)return[""];var t=[],r=h("{","}",e);if(!r)return e.split(",");var n=r.pre,i=r.body,a=r.post,o=n.split(",");o[o.length-1]+="{"+i+"}";var u=s(a);return a.length&&(o[o.length-1]+=u.shift(),o.push.apply(o,u)),t.push.apply(t,o),t}function a(e){return"{"+e+"}"}function o(e){return/^-?0\d/.test(e)}function u(e,t){return e<=t}function l(e,t){return e>=t}function c(e,t){var r=[],i=h("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var f=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),y=f||d,g=i.body.indexOf(",")>=0;if(!y&&!g)return i.post.match(/,.*\}/)?(e=i.pre+"{"+i.body+m+i.post,c(e)):[e];var b;if(y)b=i.body.split(/\.\./);else if(1===(b=s(i.body)).length&&1===(b=c(b[0],!1).map(a)).length){return(E=i.post.length?c(i.post,!1):[""]).map(function(e){return i.pre+b[0]+e})}var v,x=i.pre,E=i.post.length?c(i.post,!1):[""];if(y){var A=n(b[0]),D=n(b[1]),S=Math.max(b[0].length,b[1].length),C=3==b.length?Math.abs(n(b[2])):1,_=u;D<A&&(C*=-1,_=l);var w=b.some(o);v=[];for(var k=A;_(k,D);k+=C){var F;if(d)"\\"===(F=String.fromCharCode(k))&&(F="");else if(F=String(k),w){var T=S-F.length;if(T>0){var P=new Array(T+1).join("0");F=k<0?"-"+P+F.slice(1):P+F}}v.push(F)}}else v=p(b,function(e){return c(e,!1)});for(var B=0;B<v.length;B++)for(var O=0;O<E.length;O++){var N=x+v[B]+E[O];(!t||y||N)&&r.push(N)}return r}var p=e("concat-map"),h=e("balanced-match");t.exports=function(e){return e?("{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2)),c(function(e){return e.split("\\\\").join(f).split("\\{").join(d).split("\\}").join(m).split("\\,").join(y).split("\\.").join(g)}(e),!0).map(i)):[]};var f="\0SLASH"+Math.random()+"\0",d="\0OPEN"+Math.random()+"\0",m="\0CLOSE"+Math.random()+"\0",y="\0COMMA"+Math.random()+"\0",g="\0PERIOD"+Math.random()+"\0"},{"balanced-match":189,"concat-map":195}],192:[function(e,t,r){},{}],193:[function(e,t,r){arguments[4][192][0].apply(r,arguments)},{dup:192}],194:[function(e,t,r){"use strict";function n(e){if(e>j)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return o(e)}return s(e,t,r)}function s(e,t,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return T(e)?function(e,t,r){if(t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(r||0))throw new RangeError("'length' is out of bounds");var n;n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r);return n.__proto__=i.prototype,n}(e,t,r):"string"==typeof e?function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!i.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var r=0|c(e,t),s=n(r),a=s.write(e,t);a!==r&&(s=s.slice(0,a));return s}(e,t):function(e){if(i.isBuffer(e)){var t=0|l(e.length),r=n(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}if(e){if(P(e)||"length"in e)return"number"!=typeof e.length||B(e.length)?n(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function o(e){return a(e),n(e<0?0:0|l(e))}function u(e){for(var t=e.length<0?0:0|l(e.length),r=n(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}function l(e){if(e>=j)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+j.toString(16)+" bytes");return 0|e}function c(e,t){if(i.isBuffer(e))return e.length;if(P(e)||T(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return w(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return k(e).length;default:if(n)return w(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0);(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=function(e){return e<16?"0"+e.toString(16):e.toString(16)}(e[s]);return i}(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return function(e,t,r){return 0===t&&r===e.length?O.fromByteArray(e):O.fromByteArray(e.slice(t,r))}(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function h(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function f(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,B(r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):d(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){function s(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,u/=2,r/=2}var l;if(i){var c=-1;for(l=r;l<o;l++)if(s(e,l)===s(t,-1===c?0:l-c)){if(-1===c&&(c=l),l-c+1===u)return c*a}else-1!==c&&(l-=l-c),c=-1}else for(r+u>o&&(r=o-u),l=r;l>=0;l--){for(var p=!0,h=0;h<u;h++)if(s(e,l+h)!==s(t,h)){p=!1;break}if(p)return l}return-1}function m(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var a=0;a<n;++a){var o=parseInt(t.substr(2*a,2),16);if(B(o))return a;e[r+a]=o}return a}function y(e,t,r,n){return F(w(t,e.length-r),e,r,n)}function g(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function b(e,t,r,n){return g(e,t,r,n)}function v(e,t,r,n){return F(k(t),e,r,n)}function x(e,t,r,n){return F(function(e,t){for(var r,n,i,s=[],a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s=e[i],a=null,o=s>239?4:s>223?3:s>191?2:1;if(i+o<=r){var u,l,c,p;switch(o){case 1:s<128&&(a=s);break;case 2:128==(192&(u=e[i+1]))&&(p=(31&s)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&s)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&s)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=o}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=I));return r}(n)}function A(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,n,s,a){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function S(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(e,t,r,n,i){return t=+t,r>>>=0,i||S(e,0,r,4),N.write(e,t,r,n,23,4),r+4}function _(e,t,r,n,i){return t=+t,r>>>=0,i||S(e,0,r,8),N.write(e,t,r,n,52,8),r+8}function w(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function k(e){return O.toByteArray(function(e){if((e=e.trim().replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function T(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function P(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function B(e){return e!=e}var O=e("base64-js"),N=e("ieee754");r.Buffer=i,r.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},r.INSPECT_MAX_BYTES=50;var j=2147483647;r.kMaxLength=j,(i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,r){return s(e,t,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,r){return function(e,t,r){return a(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}(e,t,r)},i.allocUnsafe=function(e){return o(e)},i.allocUnsafeSlow=function(e){return o(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,s=0,a=Math.min(r,n);s<a;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:n<r?1:0},i.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return i.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=i.allocUnsafe(t),s=0;for(r=0;r<e.length;++r){var a=e[r];if(!i.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,s),s+=a.length}return n},i.byteLength=c,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},i.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},i.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},i.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):p.apply(this,arguments)},i.prototype.equals=function(e){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===i.compare(this,e)},i.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},i.prototype.compare=function(e,t,r,n,s){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var a=s-n,o=r-t,u=Math.min(a,o),l=this.slice(n,s),c=e.slice(t,r),p=0;p<u;++p)if(l[p]!==c[p]){a=l[p],o=c[p];break}return a<o?-1:o<a?1:0},i.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},i.prototype.indexOf=function(e,t,r){return f(this,e,t,r,!0)},i.prototype.lastIndexOf=function(e,t,r){return f(this,e,t,r,!1)},i.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":return g(this,e,t,r);case"latin1":case"binary":return b(this,e,t,r);case"base64":return v(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=i.prototype,n},i.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},i.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},i.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},i.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),N.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),N.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),N.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),N.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},i.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s<r&&(a*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,r){return C(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return C(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&r<t&&t<n)for(i=s-1;i>=0;--i)e[i+t]=this[i+r];else if(s<1e3)for(i=0;i<s;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},i.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var s=e.charCodeAt(0);s<256&&(e=s)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=i.isBuffer(e)?e:new i(e,n),u=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%u]}return this};var L=/[^+/0-9A-Za-z-_]/g},{"base64-js":190,ieee754:316}],195:[function(e,t,r){t.exports=function(e,t){for(var r=[],i=0;i<e.length;i++){var s=t(e[i],i);n(s)?r.push.apply(r,s):r.push(s)}return r};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],196:[function(e,t,r){e("../modules/web.dom.iterable"),e("../modules/es6.string.iterator"),t.exports=e("../modules/core.get-iterator")},{"../modules/core.get-iterator":287,"../modules/es6.string.iterator":296,"../modules/web.dom.iterable":309}],197:[function(e,t,r){var n=e("../../modules/_core"),i=n.JSON||(n.JSON={stringify:JSON.stringify});t.exports=function(e){return i.stringify.apply(i,arguments)}},{"../../modules/_core":225}],198:[function(e,t,r){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.map"),e("../modules/es7.map.to-json"),e("../modules/es7.map.of"),e("../modules/es7.map.from"),t.exports=e("../modules/_core").Map},{"../modules/_core":225,"../modules/es6.map":289,"../modules/es6.object.to-string":295,"../modules/es6.string.iterator":296,"../modules/es7.map.from":300,"../modules/es7.map.of":301,"../modules/es7.map.to-json":302,"../modules/web.dom.iterable":309}],199:[function(e,t,r){e("../../modules/es6.number.max-safe-integer"),t.exports=9007199254740991},{"../../modules/es6.number.max-safe-integer":290}],200:[function(e,t,r){e("../../modules/es6.object.assign"),t.exports=e("../../modules/_core").Object.assign},{"../../modules/_core":225,"../../modules/es6.object.assign":291}],201:[function(e,t,r){e("../../modules/es6.object.create");var n=e("../../modules/_core").Object;t.exports=function(e,t){return n.create(e,t)}},{"../../modules/_core":225,"../../modules/es6.object.create":292}],202:[function(e,t,r){e("../../modules/es6.symbol"),t.exports=e("../../modules/_core").Object.getOwnPropertySymbols},{"../../modules/_core":225,"../../modules/es6.symbol":297}],203:[function(e,t,r){e("../../modules/es6.object.keys"),t.exports=e("../../modules/_core").Object.keys},{"../../modules/_core":225,"../../modules/es6.object.keys":293}],204:[function(e,t,r){e("../../modules/es6.object.set-prototype-of"),t.exports=e("../../modules/_core").Object.setPrototypeOf},{"../../modules/_core":225,"../../modules/es6.object.set-prototype-of":294}],205:[function(e,t,r){e("../../modules/es6.symbol"),t.exports=e("../../modules/_core").Symbol.for},{"../../modules/_core":225,"../../modules/es6.symbol":297}],206:[function(e,t,r){e("../../modules/es6.symbol"),e("../../modules/es6.object.to-string"),e("../../modules/es7.symbol.async-iterator"),e("../../modules/es7.symbol.observable"),t.exports=e("../../modules/_core").Symbol},{"../../modules/_core":225,"../../modules/es6.object.to-string":295,"../../modules/es6.symbol":297,"../../modules/es7.symbol.async-iterator":303,"../../modules/es7.symbol.observable":304}],207:[function(e,t,r){e("../../modules/es6.string.iterator"),e("../../modules/web.dom.iterable"),t.exports=e("../../modules/_wks-ext").f("iterator")},{"../../modules/_wks-ext":284,"../../modules/es6.string.iterator":296,"../../modules/web.dom.iterable":309}],208:[function(e,t,r){e("../modules/es6.object.to-string"),e("../modules/web.dom.iterable"),e("../modules/es6.weak-map"),e("../modules/es7.weak-map.of"),e("../modules/es7.weak-map.from"),t.exports=e("../modules/_core").WeakMap},{"../modules/_core":225,"../modules/es6.object.to-string":295,"../modules/es6.weak-map":298,"../modules/es7.weak-map.from":305,"../modules/es7.weak-map.of":306,"../modules/web.dom.iterable":309}],209:[function(e,t,r){e("../modules/es6.object.to-string"),e("../modules/web.dom.iterable"),e("../modules/es6.weak-set"),e("../modules/es7.weak-set.of"),e("../modules/es7.weak-set.from"),t.exports=e("../modules/_core").WeakSet},{"../modules/_core":225,"../modules/es6.object.to-string":295,"../modules/es6.weak-set":299,"../modules/es7.weak-set.from":307,"../modules/es7.weak-set.of":308,"../modules/web.dom.iterable":309}],210:[function(e,t,r){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],211:[function(e,t,r){t.exports=function(){}},{}],212:[function(e,t,r){t.exports=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e}},{}],213:[function(e,t,r){var n=e("./_is-object");t.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},{"./_is-object":243}],214:[function(e,t,r){var n=e("./_for-of");t.exports=function(e,t){var r=[];return n(e,!1,r.push,r,t),r}},{"./_for-of":234}],215:[function(e,t,r){var n=e("./_to-iobject"),i=e("./_to-length"),s=e("./_to-absolute-index");t.exports=function(e){return function(t,r,a){var o,u=n(t),l=i(u.length),c=s(a,l);if(e&&r!=r){for(;l>c;)if((o=u[c++])!=o)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===r)return e||c||0;return!e&&-1}}},{"./_to-absolute-index":275,"./_to-iobject":277,"./_to-length":278}],216:[function(e,t,r){var n=e("./_ctx"),i=e("./_iobject"),s=e("./_to-object"),a=e("./_to-length"),o=e("./_array-species-create");t.exports=function(e,t){var r=1==e,u=2==e,l=3==e,c=4==e,p=6==e,h=5==e||p,f=t||o;return function(t,o,d){for(var m,y,g=s(t),b=i(g),v=n(o,d,3),x=a(b.length),E=0,A=r?f(t,x):u?f(t,0):void 0;x>E;E++)if((h||E in b)&&(m=b[E],y=v(m,E,g),e))if(r)A[E]=y;else if(y)switch(e){case 3:return!0;case 5:return m;case 6:return E;case 2:A.push(m)}else if(c)return!1;return p?-1:l||c?c:A}}},{"./_array-species-create":218,"./_ctx":226,"./_iobject":240,"./_to-length":278,"./_to-object":279}],217:[function(e,t,r){var n=e("./_is-object"),i=e("./_is-array"),s=e("./_wks")("species");t.exports=function(e){var t;return i(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0),n(t)&&null===(t=t[s])&&(t=void 0)),void 0===t?Array:t}},{"./_is-array":242,"./_is-object":243,"./_wks":285}],218:[function(e,t,r){var n=e("./_array-species-constructor");t.exports=function(e,t){return new(n(e))(t)}},{"./_array-species-constructor":217}],219:[function(e,t,r){var n=e("./_cof"),i=e("./_wks")("toStringTag"),s="Arguments"==n(function(){return arguments}());t.exports=function(e){var t,r,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?r:s?n(t):"Object"==(a=n(t))&&"function"==typeof t.callee?"Arguments":a}},{"./_cof":220,"./_wks":285}],220:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],221:[function(e,t,r){"use strict";var n=e("./_object-dp").f,i=e("./_object-create"),s=e("./_redefine-all"),a=e("./_ctx"),o=e("./_an-instance"),u=e("./_for-of"),l=e("./_iter-define"),c=e("./_iter-step"),p=e("./_set-species"),h=e("./_descriptors"),f=e("./_meta").fastKey,d=e("./_validate-collection"),m=h?"_s":"size",y=function(e,t){var r,n=f(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};t.exports={getConstructor:function(e,t,r,l){var c=e(function(e,n){o(e,c,t,"_i"),e._t=t,e._i=i(null),e._f=void 0,e._l=void 0,e[m]=0,void 0!=n&&u(n,r,e[l],e)});return s(c.prototype,{clear:function(){for(var e=d(this,t),r=e._i,n=e._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete r[n.i];e._f=e._l=void 0,e[m]=0},delete:function(e){var r=d(this,t),n=y(r,e);if(n){var i=n.n,s=n.p;delete r._i[n.i],n.r=!0,s&&(s.n=i),i&&(i.p=s),r._f==n&&(r._f=i),r._l==n&&(r._l=s),r[m]--}return!!n},forEach:function(e){d(this,t);for(var r,n=a(e,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(n(r.v,r.k,this);r&&r.r;)r=r.p},has:function(e){return!!y(d(this,t),e)}}),h&&n(c.prototype,"size",{get:function(){return d(this,t)[m]}}),c},def:function(e,t,r){var n,i,s=y(e,t);return s?s.v=r:(e._l=s={i:i=f(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=s),n&&(n.n=s),e[m]++,"F"!==i&&(e._i[i]=s)),e},getEntry:y,setStrong:function(e,t,r){l(e,t,function(e,r){this._t=d(e,t),this._k=r,this._l=void 0},function(){for(var e=this._k,t=this._l;t&&t.r;)t=t.p;return this._t&&(this._l=t=t?t.n:this._t._f)?c(0,"keys"==e?t.k:"values"==e?t.v:[t.k,t.v]):(this._t=void 0,c(1))},r?"entries":"values",!r,!0),p(t)}}},{"./_an-instance":212,"./_ctx":226,"./_descriptors":228,"./_for-of":234,"./_iter-define":246,"./_iter-step":247,"./_meta":250,"./_object-create":252,"./_object-dp":253,"./_redefine-all":265,"./_set-species":270,"./_validate-collection":282}],222:[function(e,t,r){var n=e("./_classof"),i=e("./_array-from-iterable");t.exports=function(e){return function(){if(n(this)!=e)throw TypeError(e+"#toJSON isn't generic");return i(this)}}},{"./_array-from-iterable":214,"./_classof":219}],223:[function(e,t,r){"use strict";var n=e("./_redefine-all"),i=e("./_meta").getWeak,s=e("./_an-object"),a=e("./_is-object"),o=e("./_an-instance"),u=e("./_for-of"),l=e("./_array-methods"),c=e("./_has"),p=e("./_validate-collection"),h=l(5),f=l(6),d=0,m=function(e){return e._l||(e._l=new y)},y=function(){this.a=[]},g=function(e,t){return h(e.a,function(e){return e[0]===t})};y.prototype={get:function(e){var t=g(this,e);if(t)return t[1]},has:function(e){return!!g(this,e)},set:function(e,t){var r=g(this,e);r?r[1]=t:this.a.push([e,t])},delete:function(e){var t=f(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},t.exports={getConstructor:function(e,t,r,s){var l=e(function(e,n){o(e,l,t,"_i"),e._t=t,e._i=d++,e._l=void 0,void 0!=n&&u(n,r,e[s],e)});return n(l.prototype,{delete:function(e){if(!a(e))return!1;var r=i(e);return!0===r?m(p(this,t)).delete(e):r&&c(r,this._i)&&delete r[this._i]},has:function(e){if(!a(e))return!1;var r=i(e);return!0===r?m(p(this,t)).has(e):r&&c(r,this._i)}}),l},def:function(e,t,r){var n=i(s(t),!0);return!0===n?m(e).set(t,r):n[e._i]=r,e},ufstore:m}},{"./_an-instance":212,"./_an-object":213,"./_array-methods":216,"./_for-of":234,"./_has":236,"./_is-object":243,"./_meta":250,"./_redefine-all":265,"./_validate-collection":282}],224:[function(e,t,r){"use strict";var n=e("./_global"),i=e("./_export"),s=e("./_meta"),a=e("./_fails"),o=e("./_hide"),u=e("./_redefine-all"),l=e("./_for-of"),c=e("./_an-instance"),p=e("./_is-object"),h=e("./_set-to-string-tag"),f=e("./_object-dp").f,d=e("./_array-methods")(0),m=e("./_descriptors");t.exports=function(e,t,r,y,g,b){var v=n[e],x=v,E=g?"set":"add",A=x&&x.prototype,D={};return m&&"function"==typeof x&&(b||A.forEach&&!a(function(){(new x).entries().next()}))?(x=t(function(t,r){c(t,x,e,"_c"),t._c=new v,void 0!=r&&l(r,g,t[E],t)}),d("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(e){var t="add"==e||"set"==e;e in A&&(!b||"clear"!=e)&&o(x.prototype,e,function(r,n){if(c(this,x,e),!t&&b&&!p(r))return"get"==e&&void 0;var i=this._c[e](0===r?0:r,n);return t?this:i})}),b||f(x.prototype,"size",{get:function(){return this._c.size}})):(x=y.getConstructor(t,e,g,E),u(x.prototype,r),s.NEED=!0),h(x,e),D[e]=x,i(i.G+i.W+i.F,D),b||y.setStrong(x,e,g),x}},{"./_an-instance":212,"./_array-methods":216,"./_descriptors":228,"./_export":232,"./_fails":233,"./_for-of":234,"./_global":235,"./_hide":237,"./_is-object":243,"./_meta":250,"./_object-dp":253,"./_redefine-all":265,"./_set-to-string-tag":271}],225:[function(e,t,r){var n=t.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},{}],226:[function(e,t,r){var n=e("./_a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":210}],227:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],228:[function(e,t,r){t.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":233}],229:[function(e,t,r){var n=e("./_is-object"),i=e("./_global").document,s=n(i)&&n(i.createElement);t.exports=function(e){return s?i.createElement(e):{}}},{"./_global":235,"./_is-object":243}],230:[function(e,t,r){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],231:[function(e,t,r){var n=e("./_object-keys"),i=e("./_object-gops"),s=e("./_object-pie");t.exports=function(e){var t=n(e),r=i.f;if(r)for(var a,o=r(e),u=s.f,l=0;o.length>l;)u.call(e,a=o[l++])&&t.push(a);return t}},{"./_object-gops":258,"./_object-keys":261,"./_object-pie":262}],232:[function(e,t,r){var n=e("./_global"),i=e("./_core"),s=e("./_ctx"),a=e("./_hide"),o="prototype",u=function(e,t,r){var l,c,p,h=e&u.F,f=e&u.G,d=e&u.S,m=e&u.P,y=e&u.B,g=e&u.W,b=f?i:i[t]||(i[t]={}),v=b[o],x=f?n:d?n[t]:(n[t]||{})[o];f&&(r=t);for(l in r)(c=!h&&x&&void 0!==x[l])&&l in b||(p=c?x[l]:r[l],b[l]=f&&"function"!=typeof x[l]?r[l]:y&&c?s(p,n):g&&x[l]==p?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t[o]=e[o],t}(p):m&&"function"==typeof p?s(Function.call,p):p,m&&((b.virtual||(b.virtual={}))[l]=p,e&u.R&&v&&!v[l]&&a(v,l,p)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},{"./_core":225,"./_ctx":226,"./_global":235,"./_hide":237}],233:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],234:[function(e,t,r){var n=e("./_ctx"),i=e("./_iter-call"),s=e("./_is-array-iter"),a=e("./_an-object"),o=e("./_to-length"),u=e("./core.get-iterator-method"),l={},c={};(r=t.exports=function(e,t,r,p,h){var f,d,m,y,g=h?function(){return e}:u(e),b=n(r,p,t?2:1),v=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(s(g)){for(f=o(e.length);f>v;v++)if((y=t?b(a(d=e[v])[0],d[1]):b(e[v]))===l||y===c)return y}else for(m=g.call(e);!(d=m.next()).done;)if((y=i(m,b,d.value,t))===l||y===c)return y}).BREAK=l,r.RETURN=c},{"./_an-object":213,"./_ctx":226,"./_is-array-iter":241,"./_iter-call":244,"./_to-length":278,"./core.get-iterator-method":286}],235:[function(e,t,r){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],236:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],237:[function(e,t,r){var n=e("./_object-dp"),i=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},{"./_descriptors":228,"./_object-dp":253,"./_property-desc":264}],238:[function(e,t,r){var n=e("./_global").document;t.exports=n&&n.documentElement},{"./_global":235}],239:[function(e,t,r){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return 7!=Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":228,"./_dom-create":229,"./_fails":233}],240:[function(e,t,r){var n=e("./_cof");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},{"./_cof":220}],241:[function(e,t,r){var n=e("./_iterators"),i=e("./_wks")("iterator"),s=Array.prototype;t.exports=function(e){return void 0!==e&&(n.Array===e||s[i]===e)}},{"./_iterators":248,"./_wks":285}],242:[function(e,t,r){var n=e("./_cof");t.exports=Array.isArray||function(e){return"Array"==n(e)}},{"./_cof":220}],243:[function(e,t,r){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],244:[function(e,t,r){var n=e("./_an-object");t.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(t){var s=e.return;throw void 0!==s&&n(s.call(e)),t}}},{"./_an-object":213}],245:[function(e,t,r){"use strict";var n=e("./_object-create"),i=e("./_property-desc"),s=e("./_set-to-string-tag"),a={};e("./_hide")(a,e("./_wks")("iterator"),function(){return this}),t.exports=function(e,t,r){e.prototype=n(a,{next:i(1,r)}),s(e,t+" Iterator")}},{"./_hide":237,"./_object-create":252,"./_property-desc":264,"./_set-to-string-tag":271,"./_wks":285}],246:[function(e,t,r){"use strict";var n=e("./_library"),i=e("./_export"),s=e("./_redefine"),a=e("./_hide"),o=e("./_has"),u=e("./_iterators"),l=e("./_iter-create"),c=e("./_set-to-string-tag"),p=e("./_object-gpo"),h=e("./_wks")("iterator"),f=!([].keys&&"next"in[].keys()),d=function(){return this};t.exports=function(e,t,r,m,y,g,b){l(r,t,m);var v,x,E,A=function(e){if(!f&&e in _)return _[e];switch(e){case"keys":case"values":return function(){return new r(this,e)}}return function(){return new r(this,e)}},D=t+" Iterator",S="values"==y,C=!1,_=e.prototype,w=_[h]||_["@@iterator"]||y&&_[y],k=!f&&w||A(y),F=y?S?A("entries"):k:void 0,T="Array"==t?_.entries||w:w;if(T&&(E=p(T.call(new e)))!==Object.prototype&&E.next&&(c(E,D,!0),n||o(E,h)||a(E,h,d)),S&&w&&"values"!==w.name&&(C=!0,k=function(){return w.call(this)}),n&&!b||!f&&!C&&_[h]||a(_,h,k),u[t]=k,u[D]=d,y)if(v={values:S?k:A("values"),keys:g?k:A("keys"),entries:F},b)for(x in v)x in _||s(_,x,v[x]);else i(i.P+i.F*(f||C),t,v);return v}},{"./_export":232,"./_has":236,"./_hide":237,"./_iter-create":245,"./_iterators":248,"./_library":249,"./_object-gpo":259,"./_redefine":266,"./_set-to-string-tag":271,"./_wks":285}],247:[function(e,t,r){t.exports=function(e,t){return{value:t,done:!!e}}},{}],248:[function(e,t,r){t.exports={}},{}],249:[function(e,t,r){t.exports=!0},{}],250:[function(e,t,r){var n=e("./_uid")("meta"),i=e("./_is-object"),s=e("./_has"),a=e("./_object-dp").f,o=0,u=Object.isExtensible||function(){return!0},l=!e("./_fails")(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,n,{value:{i:"O"+ ++o,w:{}}})},p=t.exports={KEY:n,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,n)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[n].i},getWeak:function(e,t){if(!s(e,n)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[n].w},onFreeze:function(e){return l&&p.NEED&&u(e)&&!s(e,n)&&c(e),e}}},{"./_fails":233,"./_has":236,"./_is-object":243,"./_object-dp":253,"./_uid":281}],251:[function(e,t,r){"use strict";var n=e("./_object-keys"),i=e("./_object-gops"),s=e("./_object-pie"),a=e("./_to-object"),o=e("./_iobject"),u=Object.assign;t.exports=!u||e("./_fails")(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n})?function(e,t){for(var r=a(e),u=arguments.length,l=1,c=i.f,p=s.f;u>l;)for(var h,f=o(arguments[l++]),d=c?n(f).concat(c(f)):n(f),m=d.length,y=0;m>y;)p.call(f,h=d[y++])&&(r[h]=f[h]);return r}:u},{"./_fails":233,"./_iobject":240,"./_object-gops":258,"./_object-keys":261,"./_object-pie":262,"./_to-object":279}],252:[function(e,t,r){var n=e("./_an-object"),i=e("./_object-dps"),s=e("./_enum-bug-keys"),a=e("./_shared-key")("IE_PROTO"),o=function(){},u=function(){var t,r=e("./_dom-create")("iframe"),n=s.length;for(r.style.display="none",e("./_html").appendChild(r),r.src="javascript:",(t=r.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;n--;)delete u.prototype[s[n]];return u()};t.exports=Object.create||function(e,t){var r;return null!==e?(o.prototype=n(e),r=new o,o.prototype=null,r[a]=e):r=u(),void 0===t?r:i(r,t)}},{"./_an-object":213,"./_dom-create":229,"./_enum-bug-keys":230,"./_html":238,"./_object-dps":254,"./_shared-key":272}],253:[function(e,t,r){var n=e("./_an-object"),i=e("./_ie8-dom-define"),s=e("./_to-primitive"),a=Object.defineProperty;r.f=e("./_descriptors")?Object.defineProperty:function(e,t,r){if(n(e),t=s(t,!0),n(r),i)try{return a(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},{"./_an-object":213,"./_descriptors":228,"./_ie8-dom-define":239,"./_to-primitive":280}],254:[function(e,t,r){var n=e("./_object-dp"),i=e("./_an-object"),s=e("./_object-keys");t.exports=e("./_descriptors")?Object.defineProperties:function(e,t){i(e);for(var r,a=s(t),o=a.length,u=0;o>u;)n.f(e,r=a[u++],t[r]);return e}},{"./_an-object":213,"./_descriptors":228,"./_object-dp":253,"./_object-keys":261}],255:[function(e,t,r){var n=e("./_object-pie"),i=e("./_property-desc"),s=e("./_to-iobject"),a=e("./_to-primitive"),o=e("./_has"),u=e("./_ie8-dom-define"),l=Object.getOwnPropertyDescriptor;r.f=e("./_descriptors")?l:function(e,t){if(e=s(e),t=a(t,!0),u)try{return l(e,t)}catch(e){}if(o(e,t))return i(!n.f.call(e,t),e[t])}},{"./_descriptors":228,"./_has":236,"./_ie8-dom-define":239,"./_object-pie":262,"./_property-desc":264,"./_to-iobject":277,"./_to-primitive":280}],256:[function(e,t,r){var n=e("./_to-iobject"),i=e("./_object-gopn").f,s={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(e){return a&&"[object Window]"==s.call(e)?function(e){try{return i(e)}catch(e){return a.slice()}}(e):i(n(e))}},{"./_object-gopn":257,"./_to-iobject":277}],257:[function(e,t,r){var n=e("./_object-keys-internal"),i=e("./_enum-bug-keys").concat("length","prototype");r.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},{"./_enum-bug-keys":230,"./_object-keys-internal":260}],258:[function(e,t,r){r.f=Object.getOwnPropertySymbols},{}],259:[function(e,t,r){var n=e("./_has"),i=e("./_to-object"),s=e("./_shared-key")("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(e){return e=i(e),n(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},{"./_has":236,"./_shared-key":272,"./_to-object":279}],260:[function(e,t,r){var n=e("./_has"),i=e("./_to-iobject"),s=e("./_array-includes")(!1),a=e("./_shared-key")("IE_PROTO");t.exports=function(e,t){var r,o=i(e),u=0,l=[];for(r in o)r!=a&&n(o,r)&&l.push(r);for(;t.length>u;)n(o,r=t[u++])&&(~s(l,r)||l.push(r));return l}},{"./_array-includes":215,"./_has":236,"./_shared-key":272,"./_to-iobject":277}],261:[function(e,t,r){var n=e("./_object-keys-internal"),i=e("./_enum-bug-keys");t.exports=Object.keys||function(e){return n(e,i)}},{"./_enum-bug-keys":230,"./_object-keys-internal":260}],262:[function(e,t,r){r.f={}.propertyIsEnumerable},{}],263:[function(e,t,r){var n=e("./_export"),i=e("./_core"),s=e("./_fails");t.exports=function(e,t){var r=(i.Object||{})[e]||Object[e],a={};a[e]=t(r),n(n.S+n.F*s(function(){r(1)}),"Object",a)}},{"./_core":225,"./_export":232,"./_fails":233}],264:[function(e,t,r){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],265:[function(e,t,r){var n=e("./_hide");t.exports=function(e,t,r){for(var i in t)r&&e[i]?e[i]=t[i]:n(e,i,t[i]);return e}},{"./_hide":237}],266:[function(e,t,r){t.exports=e("./_hide")},{"./_hide":237}],267:[function(e,t,r){"use strict";var n=e("./_export"),i=e("./_a-function"),s=e("./_ctx"),a=e("./_for-of");t.exports=function(e){n(n.S,e,{from:function(e){var t,r,n,o,u=arguments[1];return i(this),(t=void 0!==u)&&i(u),void 0==e?new this:(r=[],t?(n=0,o=s(u,arguments[2],2),a(e,!1,function(e){r.push(o(e,n++))})):a(e,!1,r.push,r),new this(r))}})}},{"./_a-function":210,"./_ctx":226,"./_export":232,"./_for-of":234}],268:[function(e,t,r){"use strict";var n=e("./_export");t.exports=function(e){n(n.S,e,{of:function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];return new this(t)}})}},{"./_export":232}],269:[function(e,t,r){var n=e("./_is-object"),i=e("./_an-object"),s=function(e,t){if(i(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,r,n){try{(n=e("./_ctx")(Function.call,e("./_object-gopd").f(Object.prototype,"__proto__").set,2))(t,[]),r=!(t instanceof Array)}catch(e){r=!0}return function(e,t){return s(e,t),r?e.__proto__=t:n(e,t),e}}({},!1):void 0),check:s}},{"./_an-object":213,"./_ctx":226,"./_is-object":243,"./_object-gopd":255}],270:[function(e,t,r){"use strict";var n=e("./_global"),i=e("./_core"),s=e("./_object-dp"),a=e("./_descriptors"),o=e("./_wks")("species");t.exports=function(e){var t="function"==typeof i[e]?i[e]:n[e];a&&t&&!t[o]&&s.f(t,o,{configurable:!0,get:function(){return this}})}},{"./_core":225,"./_descriptors":228,"./_global":235,"./_object-dp":253,"./_wks":285}],271:[function(e,t,r){var n=e("./_object-dp").f,i=e("./_has"),s=e("./_wks")("toStringTag");t.exports=function(e,t,r){e&&!i(e=r?e:e.prototype,s)&&n(e,s,{configurable:!0,value:t})}},{"./_has":236,"./_object-dp":253,"./_wks":285}],272:[function(e,t,r){var n=e("./_shared")("keys"),i=e("./_uid");t.exports=function(e){return n[e]||(n[e]=i(e))}},{"./_shared":273,"./_uid":281}],273:[function(e,t,r){var n=e("./_global"),i=n["__core-js_shared__"]||(n["__core-js_shared__"]={});t.exports=function(e){return i[e]||(i[e]={})}},{"./_global":235}],274:[function(e,t,r){var n=e("./_to-integer"),i=e("./_defined");t.exports=function(e){return function(t,r){var s,a,o=String(i(t)),u=n(r),l=o.length;return u<0||u>=l?e?"":void 0:(s=o.charCodeAt(u))<55296||s>56319||u+1===l||(a=o.charCodeAt(u+1))<56320||a>57343?e?o.charAt(u):s:e?o.slice(u,u+2):a-56320+(s-55296<<10)+65536}}},{"./_defined":227,"./_to-integer":276}],275:[function(e,t,r){var n=e("./_to-integer"),i=Math.max,s=Math.min;t.exports=function(e,t){return(e=n(e))<0?i(e+t,0):s(e,t)}},{"./_to-integer":276}],276:[function(e,t,r){var n=Math.ceil,i=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},{}],277:[function(e,t,r){var n=e("./_iobject"),i=e("./_defined");t.exports=function(e){return n(i(e))}},{"./_defined":227,"./_iobject":240}],278:[function(e,t,r){var n=e("./_to-integer"),i=Math.min;t.exports=function(e){return e>0?i(n(e),9007199254740991):0}},{"./_to-integer":276}],279:[function(e,t,r){var n=e("./_defined");t.exports=function(e){return Object(n(e))}},{"./_defined":227}],280:[function(e,t,r){var n=e("./_is-object");t.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":243}],281:[function(e,t,r){var n=0,i=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},{}],282:[function(e,t,r){var n=e("./_is-object");t.exports=function(e,t){if(!n(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}},{"./_is-object":243}],283:[function(e,t,r){var n=e("./_global"),i=e("./_core"),s=e("./_library"),a=e("./_wks-ext"),o=e("./_object-dp").f;t.exports=function(e){var t=i.Symbol||(i.Symbol=s?{}:n.Symbol||{});"_"==e.charAt(0)||e in t||o(t,e,{value:a.f(e)})}},{"./_core":225,"./_global":235,"./_library":249,"./_object-dp":253,"./_wks-ext":284}],284:[function(e,t,r){r.f=e("./_wks")},{"./_wks":285}],285:[function(e,t,r){var n=e("./_shared")("wks"),i=e("./_uid"),s=e("./_global").Symbol,a="function"==typeof s;(t.exports=function(e){return n[e]||(n[e]=a&&s[e]||(a?s:i)("Symbol."+e))}).store=n},{"./_global":235,"./_shared":273,"./_uid":281}],286:[function(e,t,r){var n=e("./_classof"),i=e("./_wks")("iterator"),s=e("./_iterators");t.exports=e("./_core").getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||s[n(e)]}},{"./_classof":219,"./_core":225,"./_iterators":248,"./_wks":285}],287:[function(e,t,r){var n=e("./_an-object"),i=e("./core.get-iterator-method");t.exports=e("./_core").getIterator=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return n(t.call(e))}},{"./_an-object":213,"./_core":225,"./core.get-iterator-method":286}],288:[function(e,t,r){"use strict";var n=e("./_add-to-unscopables"),i=e("./_iter-step"),s=e("./_iterators"),a=e("./_to-iobject");t.exports=e("./_iter-define")(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?r:"values"==t?e[r]:[r,e[r]])},"values"),s.Arguments=s.Array,n("keys"),n("values"),n("entries")},{"./_add-to-unscopables":211,"./_iter-define":246,"./_iter-step":247,"./_iterators":248,"./_to-iobject":277}],289:[function(e,t,r){"use strict";var n=e("./_collection-strong"),i=e("./_validate-collection");t.exports=e("./_collection")("Map",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{get:function(e){var t=n.getEntry(i(this,"Map"),e);return t&&t.v},set:function(e,t){return n.def(i(this,"Map"),0===e?0:e,t)}},n,!0)},{"./_collection":224,"./_collection-strong":221,"./_validate-collection":282}],290:[function(e,t,r){var n=e("./_export");n(n.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{"./_export":232}],291:[function(e,t,r){var n=e("./_export");n(n.S+n.F,"Object",{assign:e("./_object-assign")})},{"./_export":232,"./_object-assign":251}],292:[function(e,t,r){var n=e("./_export");n(n.S,"Object",{create:e("./_object-create")})},{"./_export":232,"./_object-create":252}],293:[function(e,t,r){var n=e("./_to-object"),i=e("./_object-keys");e("./_object-sap")("keys",function(){return function(e){return i(n(e))}})},{"./_object-keys":261,"./_object-sap":263,"./_to-object":279}],294:[function(e,t,r){var n=e("./_export");n(n.S,"Object",{setPrototypeOf:e("./_set-proto").set})},{"./_export":232,"./_set-proto":269}],295:[function(e,t,r){arguments[4][192][0].apply(r,arguments)},{dup:192}],296:[function(e,t,r){"use strict";var n=e("./_string-at")(!0);e("./_iter-define")(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})})},{"./_iter-define":246,"./_string-at":274}],297:[function(e,t,r){"use strict";var n=e("./_global"),i=e("./_has"),s=e("./_descriptors"),a=e("./_export"),o=e("./_redefine"),u=e("./_meta").KEY,l=e("./_fails"),c=e("./_shared"),p=e("./_set-to-string-tag"),h=e("./_uid"),f=e("./_wks"),d=e("./_wks-ext"),m=e("./_wks-define"),y=e("./_enum-keys"),g=e("./_is-array"),b=e("./_an-object"),v=e("./_is-object"),x=e("./_to-iobject"),E=e("./_to-primitive"),A=e("./_property-desc"),D=e("./_object-create"),S=e("./_object-gopn-ext"),C=e("./_object-gopd"),_=e("./_object-dp"),w=e("./_object-keys"),k=C.f,F=_.f,T=S.f,P=n.Symbol,B=n.JSON,O=B&&B.stringify,N="prototype",j=f("_hidden"),I=f("toPrimitive"),L={}.propertyIsEnumerable,M=c("symbol-registry"),R=c("symbols"),V=c("op-symbols"),U=Object[N],q="function"==typeof P,G=n.QObject,X=!G||!G[N]||!G[N].findChild,J=s&&l(function(){return 7!=D(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=k(U,t);n&&delete U[t],F(e,t,r),n&&e!==U&&F(U,t,n)}:F,W=function(e){var t=R[e]=D(P[N]);return t._k=e,t},K=q&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},z=function(e,t,r){return e===U&&z(V,t,r),b(e),t=E(t,!0),b(r),i(R,t)?(r.enumerable?(i(e,j)&&e[j][t]&&(e[j][t]=!1),r=D(r,{enumerable:A(0,!1)})):(i(e,j)||F(e,j,A(1,{})),e[j][t]=!0),J(e,t,r)):F(e,t,r)},Y=function(e,t){b(e);for(var r,n=y(t=x(t)),i=0,s=n.length;s>i;)z(e,r=n[i++],t[r]);return e},H=function(e){var t=L.call(this,e=E(e,!0));return!(this===U&&i(R,e)&&!i(V,e))&&(!(t||!i(this,e)||!i(R,e)||i(this,j)&&this[j][e])||t)},$=function(e,t){if(e=x(e),t=E(t,!0),e!==U||!i(R,t)||i(V,t)){var r=k(e,t);return!r||!i(R,t)||i(e,j)&&e[j][t]||(r.enumerable=!0),r}},Q=function(e){for(var t,r=T(x(e)),n=[],s=0;r.length>s;)i(R,t=r[s++])||t==j||t==u||n.push(t);return n},Z=function(e){for(var t,r=e===U,n=T(r?V:x(e)),s=[],a=0;n.length>a;)!i(R,t=n[a++])||r&&!i(U,t)||s.push(R[t]);return s};q||(o((P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=h(arguments.length>0?arguments[0]:void 0),t=function(r){this===U&&t.call(V,r),i(this,j)&&i(this[j],e)&&(this[j][e]=!1),J(this,e,A(1,r))};return s&&X&&J(U,e,{configurable:!0,set:t}),W(e)})[N],"toString",function(){return this._k}),C.f=$,_.f=z,e("./_object-gopn").f=S.f=Q,e("./_object-pie").f=H,e("./_object-gops").f=Z,s&&!e("./_library")&&o(U,"propertyIsEnumerable",H,!0),d.f=function(e){return W(f(e))}),a(a.G+a.W+a.F*!q,{Symbol:P});for(var ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),te=0;ee.length>te;)f(ee[te++]);for(var re=w(f.store),ne=0;re.length>ne;)m(re[ne++]);a(a.S+a.F*!q,"Symbol",{for:function(e){return i(M,e+="")?M[e]:M[e]=P(e)},keyFor:function(e){if(!K(e))throw TypeError(e+" is not a symbol!");for(var t in M)if(M[t]===e)return t},useSetter:function(){X=!0},useSimple:function(){X=!1}}),a(a.S+a.F*!q,"Object",{create:function(e,t){return void 0===t?D(e):Y(D(e),t)},defineProperty:z,defineProperties:Y,getOwnPropertyDescriptor:$,getOwnPropertyNames:Q,getOwnPropertySymbols:Z}),B&&a(a.S+a.F*(!q||l(function(){var e=P();return"[null]"!=O([e])||"{}"!=O({a:e})||"{}"!=O(Object(e))})),"JSON",{stringify:function(e){for(var t,r,n=[e],i=1;arguments.length>i;)n.push(arguments[i++]);if(r=t=n[1],(v(t)||void 0!==e)&&!K(e))return g(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!K(t))return t}),n[1]=t,O.apply(B,n)}}),P[N][I]||e("./_hide")(P[N],I,P[N].valueOf),p(P,"Symbol"),p(Math,"Math",!0),p(n.JSON,"JSON",!0)},{"./_an-object":213,"./_descriptors":228,"./_enum-keys":231,"./_export":232,"./_fails":233,"./_global":235,"./_has":236,"./_hide":237,"./_is-array":242,"./_is-object":243,"./_library":249,"./_meta":250,"./_object-create":252,"./_object-dp":253,"./_object-gopd":255,"./_object-gopn":257,"./_object-gopn-ext":256,"./_object-gops":258,"./_object-keys":261,"./_object-pie":262,"./_property-desc":264,"./_redefine":266,"./_set-to-string-tag":271,"./_shared":273,"./_to-iobject":277,"./_to-primitive":280,"./_uid":281,"./_wks":285,"./_wks-define":283,"./_wks-ext":284}],298:[function(e,t,r){"use strict";var n,i=e("./_array-methods")(0),s=e("./_redefine"),a=e("./_meta"),o=e("./_object-assign"),u=e("./_collection-weak"),l=e("./_is-object"),c=e("./_fails"),p=e("./_validate-collection"),h=a.getWeak,f=Object.isExtensible,d=u.ufstore,m={},y=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},g={get:function(e){if(l(e)){var t=h(e);return!0===t?d(p(this,"WeakMap")).get(e):t?t[this._i]:void 0}},set:function(e,t){return u.def(p(this,"WeakMap"),e,t)}},b=t.exports=e("./_collection")("WeakMap",y,g,u,!0,!0);c(function(){return 7!=(new b).set((Object.freeze||Object)(m),7).get(m)})&&(o((n=u.getConstructor(y,"WeakMap")).prototype,g),a.NEED=!0,i(["delete","has","get","set"],function(e){var t=b.prototype,r=t[e];s(t,e,function(t,i){if(l(t)&&!f(t)){this._f||(this._f=new n);var s=this._f[e](t,i);return"set"==e?this:s}return r.call(this,t,i)})}))},{"./_array-methods":216,"./_collection":224,"./_collection-weak":223,"./_fails":233,"./_is-object":243,"./_meta":250,"./_object-assign":251,"./_redefine":266,"./_validate-collection":282}],299:[function(e,t,r){"use strict";var n=e("./_collection-weak"),i=e("./_validate-collection");e("./_collection")("WeakSet",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return n.def(i(this,"WeakSet"),e,!0)}},n,!1,!0)},{"./_collection":224,"./_collection-weak":223,"./_validate-collection":282}],300:[function(e,t,r){e("./_set-collection-from")("Map")},{"./_set-collection-from":267}],301:[function(e,t,r){e("./_set-collection-of")("Map")},{"./_set-collection-of":268}],302:[function(e,t,r){var n=e("./_export");n(n.P+n.R,"Map",{toJSON:e("./_collection-to-json")("Map")})},{"./_collection-to-json":222,"./_export":232}],303:[function(e,t,r){e("./_wks-define")("asyncIterator")},{"./_wks-define":283}],304:[function(e,t,r){e("./_wks-define")("observable")},{"./_wks-define":283}],305:[function(e,t,r){e("./_set-collection-from")("WeakMap")},{"./_set-collection-from":267}],306:[function(e,t,r){e("./_set-collection-of")("WeakMap")},{"./_set-collection-of":268}],307:[function(e,t,r){e("./_set-collection-from")("WeakSet")},{"./_set-collection-from":267}],308:[function(e,t,r){e("./_set-collection-of")("WeakSet")},{"./_set-collection-of":268}],309:[function(e,t,r){e("./es6.array.iterator");for(var n=e("./_global"),i=e("./_hide"),s=e("./_iterators"),a=e("./_wks")("toStringTag"),o="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<o.length;u++){var l=o[u],c=n[l],p=c&&c.prototype;p&&!p[a]&&i(p,a,l),s[l]=s.Array}},{"./_global":235,"./_hide":237,"./_iterators":248,"./_wks":285,"./es6.array.iterator":288}],310:[function(e,t,r){(function(e){function t(e){return Object.prototype.toString.call(e)}r.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isNull=function(e){return null===e},r.isNullOrUndefined=function(e){return null==e},r.isNumber=function(e){return"number"==typeof e},r.isString=function(e){return"string"==typeof e},r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=function(e){return void 0===e},r.isRegExp=function(e){return"[object RegExp]"===t(e)},r.isObject=function(e){return"object"==typeof e&&null!==e},r.isDate=function(e){return"[object Date]"===t(e)},r.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},r.isFunction=function(e){return"function"==typeof e},r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":319}],311:[function(e,t,r){"use strict";var n=e("repeating"),i=/^(?:( )+|\t+)/;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");var t,r,s=0,a=0,o=0,u={};e.split(/\n/g).forEach(function(e){if(e){var n,l=e.match(i);l?(n=l[0].length,l[1]?a++:s++):n=0;var c=n-o;o=n,c?(t=u[(r=c>0)?c:-c])?t[0]++:t=u[c]=[1,0]:t&&(t[1]+=Number(r))}});var l,c,p=function(e){var t=0,r=0,n=0;for(var i in e){var s=e[i],a=s[0],o=s[1];(a>r||a===r&&o>n)&&(r=a,n=o,t=Number(i))}return t}(u);return p?a>=s?(l="space",c=n(" ",p)):(l="tab",c=n("\t",p)):(l=null,c=""),{amount:p,type:l,indent:c}}},{repeating:601}],312:[function(e,t,r){"use strict";var n=/[|\\{}()[\]^$+*?.]/g;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(n,"\\$&")}},{}],313:[function(e,t,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function s(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,o,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(r=this._events[e],a(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),r.apply(this,o)}else if(s(r))for(o=Array.prototype.slice.call(arguments,1),n=(l=r.slice()).length,u=0;u<n;u++)l[u].apply(this,o);return!0},n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,t){var r,n,a,o;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(o=a;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){n=o;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],i(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],314:[function(e,t,r){"use strict";var n=e("ansi-regex"),i=new RegExp(n().source);t.exports=i.test.bind(i)},{"ansi-regex":315}],315:[function(e,t,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],316:[function(e,t,r){r.read=function(e,t,r,n,i){var s,a,o=8*i-n-1,u=(1<<o)-1,l=u>>1,c=-7,p=r?i-1:0,h=r?-1:1,f=e[t+p];for(p+=h,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+e[t+p],p+=h,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+e[t+p],p+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=l}return(f?-1:1)*a*Math.pow(2,s-n)},r.write=function(e,t,r,n,i,s){var a,o,u,l=8*s-i-1,c=(1<<l)-1,p=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+p>=1?h/u:h*Math.pow(2,1-p))*u>=2&&(a++,u/=2),a+p>=c?(o=0,a=c):a+p>=1?(o=(t*u-1)*Math.pow(2,i),a+=p):(o=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<<i|o,l+=i;l>0;e[r+f]=255&a,f+=d,a/=256,l-=8);e[r+f-d]|=128*m}},{}],317:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],318:[function(e,t,r){"use strict";t.exports=function(e,t,r,n,i,s,a,o){if(void 0===t)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,i,s,a,o],c=0;(u=new Error(t.replace(/%s/g,function(){return l[c++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}}},{}],319:[function(e,t,r){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}t.exports=function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)}},{}],320:[function(e,t,r){"use strict";var n=e("number-is-nan");t.exports=Number.isFinite||function(e){return!("number"!=typeof e||n(e)||e===1/0||e===-1/0)}},{"number-is-nan":544}],321:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],322:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g,r.matchToToken=function(e){var t={type:"invalid",value:e[0]};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}},{}],323:[function(e,t,r){(function(e){!function(n){var i="object"==typeof r&&r,s="object"==typeof t&&t&&t.exports==i&&t,a="object"==typeof e&&e;a.global!==a&&a.window!==a||(n=a);var o={},u=o.hasOwnProperty,l=function(e,t){var r;for(r in e)u.call(e,r)&&t(r,e[r])},c=o.toString,p={'"':'\\"',"'":"\\'","\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},h=/["'\\\b\f\n\r\t]/,f=/[0-9]/,d=/[ !#-&\(-\[\]-~]/,m=function(e,t){var r={escapeEverything:!1,escapeEtago:!1,quotes:"single",wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:"decimal",indent:"\t",__indent__:"",__inline1__:!1,__inline2__:!1},n=t&&t.json;n&&(r.quotes="double",r.wrap=!0),"single"!=(t=function(e,t){return t?(l(t,function(t,r){e[t]=r}),e):e}(r,t)).quotes&&"double"!=t.quotes&&(t.quotes="single");var i,s="double"==t.quotes?'"':"'",a=t.compact,o=t.indent,u=t.lowercaseHex,y="",g=t.__inline1__,b=t.__inline2__,v=a?"":"\n",x=!0,E="binary"==t.numbers,A="octal"==t.numbers,D="decimal"==t.numbers,S="hexadecimal"==t.numbers;if(n&&e&&function(e){return"function"==typeof e||"[object Function]"==c.call(e)}(e.toJSON)&&(e=e.toJSON()),!function(e){return"string"==typeof e||"[object String]"==c.call(e)}(e)){if(function(e){return"[object Map]"==c.call(e)}(e))return 0==e.size?"new Map()":(a||(t.__inline1__=!0),"new Map("+m(Array.from(e),t)+")");if(function(e){return"[object Set]"==c.call(e)}(e))return 0==e.size?"new Set()":"new Set("+m(Array.from(e),t)+")";if(function(e){return"[object Array]"==c.call(e)}(e))return i=[],t.wrap=!0,g?(t.__inline1__=!1,t.__inline2__=!0):(y=t.__indent__,o+=y,t.__indent__=o),function(e,t){for(var r=e.length,n=-1;++n<r;)t(e[n])}(e,function(e){x=!1,b&&(t.__inline2__=!1),i.push((a||b?"":o)+m(e,t))}),x?"[]":b?"["+i.join(", ")+"]":"["+v+i.join(","+v)+v+(a?"":y)+"]";if(!function(e){return"number"==typeof e||"[object Number]"==c.call(e)}(e))return function(e){return"[object Object]"==c.call(e)}(e)?(i=[],t.wrap=!0,y=t.__indent__,o+=y,t.__indent__=o,l(e,function(e,r){x=!1,i.push((a?"":o)+m(e,t)+":"+(a?"":" ")+m(r,t))}),x?"{}":"{"+v+i.join(","+v)+v+(a?"":y)+"}"):n?JSON.stringify(e)||"null":String(e);if(n)return JSON.stringify(e);if(D)return String(e);if(S){var C=e.toString(16);return u||(C=C.toUpperCase()),"0x"+C}if(E)return"0b"+e.toString(2);if(A)return"0o"+e.toString(8)}var _,w,k=e,F=-1,T=k.length;for(i="";++F<T;){var P=k.charAt(F);if(t.es6&&(_=k.charCodeAt(F))>=55296&&_<=56319&&T>F+1&&(w=k.charCodeAt(F+1))>=56320&&w<=57343){var B=(1024*(_-55296)+w-56320+65536).toString(16);u||(B=B.toUpperCase()),i+="\\u{"+B+"}",F++}else{if(!t.escapeEverything){if(d.test(P)){i+=P;continue}if('"'==P){i+=s==P?'\\"':P;continue}if("'"==P){i+=s==P?"\\'":P;continue}}if("\0"!=P||n||f.test(k.charAt(F+1)))if(h.test(P))i+=p[P];else{B=P.charCodeAt(0).toString(16);u||(B=B.toUpperCase());var O=B.length>2||n,N="\\"+(O?"u":"x")+("0000"+B).slice(O?-4:-2);i+=N}else i+="\\0"}}return t.wrap&&(i=s+i+s),t.escapeEtago?i.replace(/<\/(script|style)/gi,"<\\/$1"):i};m.version="1.3.0","function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return m}):i&&!i.nodeType?s?s.exports=m:i.jsesc=m:n.jsesc=m}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],324:[function(e,t,r){var n="object"==typeof r?r:{};n.parse=function(){"use strict";var e,t,r,n,i,s,a={"'":"'",'"':'"',"\\":"\\","/":"/","\n":"",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},o=[" ","\t","\r","\n","\v","\f"," ","\ufeff"],u=function(e){return""===e?"EOF":"'"+e+"'"},l=function(n){var s=new SyntaxError;throw s.message=n+" at line "+t+" column "+r+" of the JSON5 data. Still to read: "+JSON.stringify(i.substring(e-1,e+19)),s.at=e,s.lineNumber=t,s.columnNumber=r,s},c=function(s){return s&&s!==n&&l("Expected "+u(s)+" instead of "+u(n)),n=i.charAt(e),e++,r++,("\n"===n||"\r"===n&&"\n"!==p())&&(t++,r=0),n},p=function(){return i.charAt(e)},h=function(){var e=n;for("_"!==n&&"$"!==n&&(n<"a"||n>"z")&&(n<"A"||n>"Z")&&l("Bad identifier as unquoted key");c()&&("_"===n||"$"===n||n>="a"&&n<="z"||n>="A"&&n<="Z"||n>="0"&&n<="9");)e+=n;return e},f=function(){var e,t="",r="",i=10;if("-"!==n&&"+"!==n||(t=n,c(n)),"I"===n)return("number"!=typeof(e=g())||isNaN(e))&&l("Unexpected word for number"),"-"===t?-e:e;if("N"===n)return e=g(),isNaN(e)||l("expected word to be NaN"),e;switch("0"===n&&(r+=n,c(),"x"===n||"X"===n?(r+=n,c(),i=16):n>="0"&&n<="9"&&l("Octal literal")),i){case 10:for(;n>="0"&&n<="9";)r+=n,c();if("."===n)for(r+=".";c()&&n>="0"&&n<="9";)r+=n;if("e"===n||"E"===n)for(r+=n,c(),"-"!==n&&"+"!==n||(r+=n,c());n>="0"&&n<="9";)r+=n,c();break;case 16:for(;n>="0"&&n<="9"||n>="A"&&n<="F"||n>="a"&&n<="f";)r+=n,c()}if(e="-"===t?-r:+r,isFinite(e))return e;l("Bad number")},d=function(){var e,t,r,i,s="";if('"'===n||"'"===n)for(r=n;c();){if(n===r)return c(),s;if("\\"===n)if(c(),"u"===n){for(i=0,t=0;t<4&&(e=parseInt(c(),16),isFinite(e));t+=1)i=16*i+e;s+=String.fromCharCode(i)}else if("\r"===n)"\n"===p()&&c();else{if("string"!=typeof a[n])break;s+=a[n]}else{if("\n"===n)break;s+=n}}l("Bad string")},m=function(){"/"!==n&&l("Not a comment"),c("/"),"/"===n?function(){"/"!==n&&l("Not an inline comment");do{if(c(),"\n"===n||"\r"===n)return void c()}while(n)}():"*"===n?function(){"*"!==n&&l("Not a block comment");do{for(c();"*"===n;)if(c("*"),"/"===n)return void c("/")}while(n);l("Unterminated block comment")}():l("Unrecognized comment")},y=function(){for(;n;)if("/"===n)m();else{if(!(o.indexOf(n)>=0))return;c()}},g=function(){switch(n){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null;case"I":return c("I"),c("n"),c("f"),c("i"),c("n"),c("i"),c("t"),c("y"),1/0;case"N":return c("N"),c("a"),c("N"),NaN}l("Unexpected "+u(n))};return s=function(){switch(y(),n){case"{":return function(){var e,t={};if("{"===n)for(c("{"),y();n;){if("}"===n)return c("}"),t;if(e='"'===n||"'"===n?d():h(),y(),c(":"),t[e]=s(),y(),","!==n)return c("}"),t;c(","),y()}l("Bad object")}();case"[":return function(){var e=[];if("["===n)for(c("["),y();n;){if("]"===n)return c("]"),e;if(","===n?l("Missing array element"):e.push(s()),y(),","!==n)return c("]"),e;c(","),y()}l("Bad array")}();case'"':case"'":return d();case"-":case"+":case".":return f();default:return n>="0"&&n<="9"?f():g()}},function(a,o){var u;return i=String(a),e=0,t=1,r=1,n=" ",u=s(),y(),n&&l("Syntax error"),"function"==typeof o?function e(t,r){var n,i,s=t[r];if(s&&"object"==typeof s)for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(void 0!==(i=e(s,n))?s[n]=i:delete s[n]);return o.call(t,r,s)}({"":u},""):u}}(),n.stringify=function(e,t,r){function i(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e||"$"===e}function s(e){if("string"!=typeof e)return!1;if(!function(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e||"$"===e}(e[0]))return!1;for(var t=1,r=e.length;t<r;){if(!i(e[t]))return!1;t++}return!0}function a(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function o(e){for(var t=0;t<f.length;t++)if(f[t]===e)throw new TypeError("Converting circular structure to JSON")}function u(e,t,r){if(!e)return"";e.length>10&&(e=e.substring(0,10));for(var n=r?"":"\n",i=0;i<t;i++)n+=e;return n}function l(e){return d.lastIndex=0,d.test(e)?'"'+e.replace(d,function(e){var t=m[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function c(e,t,r){var n,i,d=p(e,t,r);switch(d&&!function(e){return"[object Date]"===Object.prototype.toString.call(e)}(d)&&(d=d.valueOf()),typeof d){case"boolean":return d.toString();case"number":return isNaN(d)||!isFinite(d)?"null":d.toString();case"string":return l(d.toString());case"object":if(null===d)return"null";if(a(d)){o(d),n="[",f.push(d);for(var m=0;m<d.length;m++)i=c(d,m,!1),n+=u(h,f.length),n+=null===i||void 0===i?"null":i,m<d.length-1?n+=",":h&&(n+="\n");f.pop(),d.length&&(n+=u(h,f.length,!0)),n+="]"}else{o(d),n="{";var y=!1;f.push(d);for(var g in d)if(d.hasOwnProperty(g)){var b=c(d,g,!1);r=!1,void 0!==b&&null!==b&&(n+=u(h,f.length),y=!0,n+=(t=s(g)?g:l(g))+":"+(h?" ":"")+b+",")}f.pop(),n=y?n.substring(0,n.length-1)+u(h,f.length)+"}":"{}"}return n;default:return}}if(t&&"function"!=typeof t&&!a(t))throw new Error("Replacer must be a function or an array");var p=function(e,r,n){var i=e[r];return i&&i.toJSON&&"function"==typeof i.toJSON&&(i=i.toJSON()),"function"==typeof t?t.call(e,r,i):t?n||a(e)||t.indexOf(r)>=0?i:void 0:i};n.isWord=s;var h,f=[];r&&("string"==typeof r?h=r:"number"==typeof r&&r>=0&&(h=u(" ",r,!0)));var d=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},y={"":e};return void 0===e?p(y,"",!0):c(y,"",!0)}},{}],325:[function(e,t,r){var n=e("./_getNative")(e("./_root"),"DataView");t.exports=n},{"./_getNative":429,"./_root":473}],326:[function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var i=e("./_hashClear"),s=e("./_hashDelete"),a=e("./_hashGet"),o=e("./_hashHas"),u=e("./_hashSet");n.prototype.clear=i,n.prototype.delete=s,n.prototype.get=a,n.prototype.has=o,n.prototype.set=u,t.exports=n},{"./_hashClear":437,"./_hashDelete":438,"./_hashGet":439,"./_hashHas":440,"./_hashSet":441}],327:[function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var i=e("./_listCacheClear"),s=e("./_listCacheDelete"),a=e("./_listCacheGet"),o=e("./_listCacheHas"),u=e("./_listCacheSet");n.prototype.clear=i,n.prototype.delete=s,n.prototype.get=a,n.prototype.has=o,n.prototype.set=u,t.exports=n},{"./_listCacheClear":453,"./_listCacheDelete":454,"./_listCacheGet":455,"./_listCacheHas":456,"./_listCacheSet":457}],328:[function(e,t,r){var n=e("./_getNative")(e("./_root"),"Map");t.exports=n},{"./_getNative":429,"./_root":473}],329:[function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}var i=e("./_mapCacheClear"),s=e("./_mapCacheDelete"),a=e("./_mapCacheGet"),o=e("./_mapCacheHas"),u=e("./_mapCacheSet");n.prototype.clear=i,n.prototype.delete=s,n.prototype.get=a,n.prototype.has=o,n.prototype.set=u,t.exports=n},{"./_mapCacheClear":458,"./_mapCacheDelete":459,"./_mapCacheGet":460,"./_mapCacheHas":461,"./_mapCacheSet":462}],330:[function(e,t,r){var n=e("./_getNative")(e("./_root"),"Promise");t.exports=n},{"./_getNative":429,"./_root":473}],331:[function(e,t,r){var n=e("./_getNative")(e("./_root"),"Set");t.exports=n},{"./_getNative":429,"./_root":473}],332:[function(e,t,r){function n(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new i;++t<r;)this.add(e[t])}var i=e("./_MapCache"),s=e("./_setCacheAdd"),a=e("./_setCacheHas");n.prototype.add=n.prototype.push=s,n.prototype.has=a,t.exports=n},{"./_MapCache":329,"./_setCacheAdd":474,"./_setCacheHas":475}],333:[function(e,t,r){function n(e){var t=this.__data__=new i(e);this.size=t.size}var i=e("./_ListCache"),s=e("./_stackClear"),a=e("./_stackDelete"),o=e("./_stackGet"),u=e("./_stackHas"),l=e("./_stackSet");n.prototype.clear=s,n.prototype.delete=a,n.prototype.get=o,n.prototype.has=u,n.prototype.set=l,t.exports=n},{"./_ListCache":327,"./_stackClear":479,"./_stackDelete":480,"./_stackGet":481,"./_stackHas":482,"./_stackSet":483}],334:[function(e,t,r){var n=e("./_root").Symbol;t.exports=n},{"./_root":473}],335:[function(e,t,r){var n=e("./_root").Uint8Array;t.exports=n},{"./_root":473}],336:[function(e,t,r){var n=e("./_getNative")(e("./_root"),"WeakMap");t.exports=n},{"./_getNative":429,"./_root":473}],337:[function(e,t,r){t.exports=function(e,t){return e.set(t[0],t[1]),e}},{}],338:[function(e,t,r){t.exports=function(e,t){return e.add(t),e}},{}],339:[function(e,t,r){t.exports=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}},{}],340:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}},{}],341:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,s=[];++r<n;){var a=e[r];t(a,r,e)&&(s[i++]=a)}return s}},{}],342:[function(e,t,r){var n=e("./_baseIndexOf");t.exports=function(e,t){return!(null==e||!e.length)&&n(e,t,0)>-1}},{"./_baseIndexOf":368}],343:[function(e,t,r){t.exports=function(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}},{}],344:[function(e,t,r){var n=e("./_baseTimes"),i=e("./isArguments"),s=e("./isArray"),a=e("./isBuffer"),o=e("./_isIndex"),u=e("./isTypedArray"),l=Object.prototype.hasOwnProperty;t.exports=function(e,t){var r=s(e),c=!r&&i(e),p=!r&&!c&&a(e),h=!r&&!c&&!p&&u(e),f=r||c||p||h,d=f?n(e.length,String):[],m=d.length;for(var y in e)!t&&!l.call(e,y)||f&&("length"==y||p&&("offset"==y||"parent"==y)||h&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||o(y,m))||d.push(y);return d}},{"./_baseTimes":392,"./_isIndex":446,"./isArguments":508,"./isArray":509,"./isBuffer":512,"./isTypedArray":522}],345:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}},{}],346:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}},{}],347:[function(e,t,r){t.exports=function(e,t,r,n){var i=-1,s=null==e?0:e.length;for(n&&s&&(r=e[++i]);++i<s;)r=t(r,e[i],i,e);return r}},{}],348:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}},{}],349:[function(e,t,r){var n=e("./_baseAssignValue"),i=e("./eq");t.exports=function(e,t,r){(void 0===r||i(e[t],r))&&(void 0!==r||t in e)||n(e,t,r)}},{"./_baseAssignValue":354,"./eq":496}],350:[function(e,t,r){var n=e("./_baseAssignValue"),i=e("./eq"),s=Object.prototype.hasOwnProperty;t.exports=function(e,t,r){var a=e[t];s.call(e,t)&&i(a,r)&&(void 0!==r||t in e)||n(e,t,r)}},{"./_baseAssignValue":354,"./eq":496}],351:[function(e,t,r){var n=e("./eq");t.exports=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}},{"./eq":496}],352:[function(e,t,r){var n=e("./_copyObject"),i=e("./keys");t.exports=function(e,t){return e&&n(t,i(t),e)}},{"./_copyObject":410,"./keys":523}],353:[function(e,t,r){var n=e("./_copyObject"),i=e("./keysIn");t.exports=function(e,t){return e&&n(t,i(t),e)}},{"./_copyObject":410,"./keysIn":524}],354:[function(e,t,r){var n=e("./_defineProperty");t.exports=function(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}},{"./_defineProperty":420}],355:[function(e,t,r){t.exports=function(e,t,r){return e==e&&(void 0!==r&&(e=e<=r?e:r),void 0!==t&&(e=e>=t?e:t)),e}},{}],356:[function(e,t,r){function n(e,t,r,P,B,O){var N,j=t&D,I=t&S,L=t&C;if(r&&(N=B?r(e,P,B,O):r(e)),void 0!==N)return N;if(!E(e))return e;var M=v(e);if(M){if(N=y(e),!j)return c(e,N)}else{var R=m(e),V=R==w||R==k;if(x(e))return l(e,j);if(R==F||R==_||V&&!B){if(N=I||V?{}:b(e),!j)return I?h(e,u(N,e)):p(e,o(N,e))}else{if(!T[R])return B?e:{};N=g(e,R,n,j)}}O||(O=new i);var U=O.get(e);if(U)return U;O.set(e,N);var q=L?I?d:f:I?keysIn:A,G=M?void 0:q(e);return s(G||e,function(i,s){G&&(i=e[s=i]),a(N,s,n(i,t,r,s,e,O))}),N}var i=e("./_Stack"),s=e("./_arrayEach"),a=e("./_assignValue"),o=e("./_baseAssign"),u=e("./_baseAssignIn"),l=e("./_cloneBuffer"),c=e("./_copyArray"),p=e("./_copySymbols"),h=e("./_copySymbolsIn"),f=e("./_getAllKeys"),d=e("./_getAllKeysIn"),m=e("./_getTag"),y=e("./_initCloneArray"),g=e("./_initCloneByTag"),b=e("./_initCloneObject"),v=e("./isArray"),x=e("./isBuffer"),E=e("./isObject"),A=e("./keys"),D=1,S=2,C=4,_="[object Arguments]",w="[object Function]",k="[object GeneratorFunction]",F="[object Object]",T={};T[_]=T["[object Array]"]=T["[object ArrayBuffer]"]=T["[object DataView]"]=T["[object Boolean]"]=T["[object Date]"]=T["[object Float32Array]"]=T["[object Float64Array]"]=T["[object Int8Array]"]=T["[object Int16Array]"]=T["[object Int32Array]"]=T["[object Map]"]=T["[object Number]"]=T[F]=T["[object RegExp]"]=T["[object Set]"]=T["[object String]"]=T["[object Symbol]"]=T["[object Uint8Array]"]=T["[object Uint8ClampedArray]"]=T["[object Uint16Array]"]=T["[object Uint32Array]"]=!0,T["[object Error]"]=T[w]=T["[object WeakMap]"]=!1,t.exports=n},{"./_Stack":333,"./_arrayEach":340,"./_assignValue":350,"./_baseAssign":352,"./_baseAssignIn":353,"./_cloneBuffer":400,"./_copyArray":409,"./_copySymbols":411,"./_copySymbolsIn":412,"./_getAllKeys":425,"./_getAllKeysIn":426,"./_getTag":434,"./_initCloneArray":442,"./_initCloneByTag":443,"./_initCloneObject":444,"./isArray":509,"./isBuffer":512,"./isObject":516,"./keys":523}],357:[function(e,t,r){var n=e("./isObject"),i=Object.create,s=function(){function e(){}return function(t){if(!n(t))return{};if(i)return i(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();t.exports=s},{"./isObject":516}],358:[function(e,t,r){var n=e("./_baseForOwn"),i=e("./_createBaseEach")(n);t.exports=i},{"./_baseForOwn":362,"./_createBaseEach":415}],359:[function(e,t,r){t.exports=function(e,t,r,n){for(var i=e.length,s=r+(n?1:-1);n?s--:++s<i;)if(t(e[s],s,e))return s;return-1}},{}],360:[function(e,t,r){function n(e,t,r,a,o){var u=-1,l=e.length;for(r||(r=s),o||(o=[]);++u<l;){var c=e[u];t>0&&r(c)?t>1?n(c,t-1,r,a,o):i(o,c):a||(o[o.length]=c)}return o}var i=e("./_arrayPush"),s=e("./_isFlattenable");t.exports=n},{"./_arrayPush":346,"./_isFlattenable":445}],361:[function(e,t,r){var n=e("./_createBaseFor")();t.exports=n},{"./_createBaseFor":416}],362:[function(e,t,r){var n=e("./_baseFor"),i=e("./keys");t.exports=function(e,t){return e&&n(e,t,i)}},{"./_baseFor":361,"./keys":523}],363:[function(e,t,r){var n=e("./_castPath"),i=e("./_toKey");t.exports=function(e,t){for(var r=0,s=(t=n(t,e)).length;null!=e&&r<s;)e=e[i(t[r++])];return r&&r==s?e:void 0}},{"./_castPath":398,"./_toKey":486}],364:[function(e,t,r){var n=e("./_arrayPush"),i=e("./isArray");t.exports=function(e,t,r){var s=t(e);return i(e)?s:n(s,r(e))}},{"./_arrayPush":346,"./isArray":509}],365:[function(e,t,r){var n=e("./_Symbol"),i=e("./_getRawTag"),s=e("./_objectToString"),a="[object Null]",o="[object Undefined]",u=n?n.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?o:a:u&&u in Object(e)?i(e):s(e)}},{"./_Symbol":334,"./_getRawTag":431,"./_objectToString":470}],366:[function(e,t,r){var n=Object.prototype.hasOwnProperty;t.exports=function(e,t){return null!=e&&n.call(e,t)}},{}],367:[function(e,t,r){t.exports=function(e,t){return null!=e&&t in Object(e)}},{}],368:[function(e,t,r){var n=e("./_baseFindIndex"),i=e("./_baseIsNaN"),s=e("./_strictIndexOf");t.exports=function(e,t,r){return t==t?s(e,t,r):n(e,i,r)}},{"./_baseFindIndex":359,"./_baseIsNaN":373,"./_strictIndexOf":484}],369:[function(e,t,r){var n=e("./_baseGetTag"),i=e("./isObjectLike"),s="[object Arguments]";t.exports=function(e){return i(e)&&n(e)==s}},{"./_baseGetTag":365,"./isObjectLike":517}],370:[function(e,t,r){function n(e,t,r,a,o){return e===t||(null==e||null==t||!s(e)&&!s(t)?e!=e&&t!=t:i(e,t,r,a,n,o))}var i=e("./_baseIsEqualDeep"),s=e("./isObjectLike");t.exports=n},{"./_baseIsEqualDeep":371,"./isObjectLike":517}],371:[function(e,t,r){var n=e("./_Stack"),i=e("./_equalArrays"),s=e("./_equalByTag"),a=e("./_equalObjects"),o=e("./_getTag"),u=e("./isArray"),l=e("./isBuffer"),c=e("./isTypedArray"),p=1,h="[object Arguments]",f="[object Array]",d="[object Object]",m=Object.prototype.hasOwnProperty;t.exports=function(e,t,r,y,g,b){var v=u(e),x=u(t),E=v?f:o(e),A=x?f:o(t),D=(E=E==h?d:E)==d,S=(A=A==h?d:A)==d,C=E==A;if(C&&l(e)){if(!l(t))return!1;v=!0,D=!1}if(C&&!D)return b||(b=new n),v||c(e)?i(e,t,r,y,g,b):s(e,t,E,r,y,g,b);if(!(r&p)){var _=D&&m.call(e,"__wrapped__"),w=S&&m.call(t,"__wrapped__");if(_||w){var k=_?e.value():e,F=w?t.value():t;return b||(b=new n),g(k,F,r,y,b)}}return!!C&&(b||(b=new n),a(e,t,r,y,g,b))}},{"./_Stack":333,"./_equalArrays":421,"./_equalByTag":422,"./_equalObjects":423,"./_getTag":434,"./isArray":509,"./isBuffer":512,"./isTypedArray":522}],372:[function(e,t,r){var n=e("./_Stack"),i=e("./_baseIsEqual"),s=1,a=2;t.exports=function(e,t,r,o){var u=r.length,l=u,c=!o;if(null==e)return!l;for(e=Object(e);u--;){var p=r[u];if(c&&p[2]?p[1]!==e[p[0]]:!(p[0]in e))return!1}for(;++u<l;){var h=(p=r[u])[0],f=e[h],d=p[1];if(c&&p[2]){if(void 0===f&&!(h in e))return!1}else{var m=new n;if(o)var y=o(f,d,h,e,t,m);if(!(void 0===y?i(d,f,s|a,o,m):y))return!1}}return!0}},{"./_Stack":333,"./_baseIsEqual":370}],373:[function(e,t,r){t.exports=function(e){return e!=e}},{}],374:[function(e,t,r){var n=e("./isFunction"),i=e("./_isMasked"),s=e("./isObject"),a=e("./_toSource"),o=/^\[object .+?Constructor\]$/,u=Function.prototype,l=Object.prototype,c=u.toString,p=l.hasOwnProperty,h=RegExp("^"+c.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(e){return!(!s(e)||i(e))&&(n(e)?h:o).test(a(e))}},{"./_isMasked":450,"./_toSource":487,"./isFunction":513,"./isObject":516}],375:[function(e,t,r){var n=e("./_baseGetTag"),i=e("./isObjectLike"),s="[object RegExp]";t.exports=function(e){return i(e)&&n(e)==s}},{"./_baseGetTag":365,"./isObjectLike":517}],376:[function(e,t,r){var n=e("./_baseGetTag"),i=e("./isLength"),s=e("./isObjectLike"),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(e){return s(e)&&i(e.length)&&!!a[n(e)]}},{"./_baseGetTag":365,"./isLength":515,"./isObjectLike":517}],377:[function(e,t,r){var n=e("./_baseMatches"),i=e("./_baseMatchesProperty"),s=e("./identity"),a=e("./isArray"),o=e("./property");t.exports=function(e){return"function"==typeof e?e:null==e?s:"object"==typeof e?a(e)?i(e[0],e[1]):n(e):o(e)}},{"./_baseMatches":381,"./_baseMatchesProperty":382,"./identity":506,"./isArray":509,"./property":529}],378:[function(e,t,r){var n=e("./_isPrototype"),i=e("./_nativeKeys"),s=Object.prototype.hasOwnProperty;t.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))s.call(e,r)&&"constructor"!=r&&t.push(r);return t}},{"./_isPrototype":451,"./_nativeKeys":467}],379:[function(e,t,r){var n=e("./isObject"),i=e("./_isPrototype"),s=e("./_nativeKeysIn"),a=Object.prototype.hasOwnProperty;t.exports=function(e){if(!n(e))return s(e);var t=i(e),r=[];for(var o in e)("constructor"!=o||!t&&a.call(e,o))&&r.push(o);return r}},{"./_isPrototype":451,"./_nativeKeysIn":468,"./isObject":516}],380:[function(e,t,r){var n=e("./_baseEach"),i=e("./isArrayLike");t.exports=function(e,t){var r=-1,s=i(e)?Array(e.length):[];return n(e,function(e,n,i){s[++r]=t(e,n,i)}),s}},{"./_baseEach":358,"./isArrayLike":510}],381:[function(e,t,r){var n=e("./_baseIsMatch"),i=e("./_getMatchData"),s=e("./_matchesStrictComparable");t.exports=function(e){var t=i(e);return 1==t.length&&t[0][2]?s(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}},{"./_baseIsMatch":372,"./_getMatchData":428,"./_matchesStrictComparable":464}],382:[function(e,t,r){var n=e("./_baseIsEqual"),i=e("./get"),s=e("./hasIn"),a=e("./_isKey"),o=e("./_isStrictComparable"),u=e("./_matchesStrictComparable"),l=e("./_toKey"),c=1,p=2;t.exports=function(e,t){return a(e)&&o(t)?u(l(e),t):function(r){var a=i(r,e);return void 0===a&&a===t?s(r,e):n(t,a,c|p)}}},{"./_baseIsEqual":370,"./_isKey":448,"./_isStrictComparable":452,"./_matchesStrictComparable":464,"./_toKey":486,"./get":503,"./hasIn":505}],383:[function(e,t,r){function n(e,t,r,c,p){e!==t&&a(t,function(a,l){if(u(a))p||(p=new i),o(e,t,l,r,n,c,p);else{var h=c?c(e[l],a,l+"",e,t,p):void 0;void 0===h&&(h=a),s(e,l,h)}},l)}var i=e("./_Stack"),s=e("./_assignMergeValue"),a=e("./_baseFor"),o=e("./_baseMergeDeep"),u=e("./isObject"),l=e("./keysIn");t.exports=n},{"./_Stack":333,"./_assignMergeValue":349,"./_baseFor":361,"./_baseMergeDeep":384,"./isObject":516,"./keysIn":524}],384:[function(e,t,r){var n=e("./_assignMergeValue"),i=e("./_cloneBuffer"),s=e("./_cloneTypedArray"),a=e("./_copyArray"),o=e("./_initCloneObject"),u=e("./isArguments"),l=e("./isArray"),c=e("./isArrayLikeObject"),p=e("./isBuffer"),h=e("./isFunction"),f=e("./isObject"),d=e("./isPlainObject"),m=e("./isTypedArray"),y=e("./toPlainObject");t.exports=function(e,t,r,g,b,v,x){var E=e[r],A=t[r],D=x.get(A);if(D)n(e,r,D);else{var S=v?v(E,A,r+"",e,t,x):void 0,C=void 0===S;if(C){var _=l(A),w=!_&&p(A),k=!_&&!w&&m(A);S=A,_||w||k?l(E)?S=E:c(E)?S=a(E):w?(C=!1,S=i(A,!0)):k?(C=!1,S=s(A,!0)):S=[]:d(A)||u(A)?(S=E,u(E)?S=y(E):(!f(E)||g&&h(E))&&(S=o(A))):C=!1}C&&(x.set(A,S),b(S,A,g,v,x),x.delete(A)),n(e,r,S)}}},{"./_assignMergeValue":349,"./_cloneBuffer":400,"./_cloneTypedArray":406,"./_copyArray":409,"./_initCloneObject":444,"./isArguments":508,"./isArray":509,"./isArrayLikeObject":511,"./isBuffer":512,"./isFunction":513,"./isObject":516,"./isPlainObject":518,"./isTypedArray":522,"./toPlainObject":538}],385:[function(e,t,r){var n=e("./_arrayMap"),i=e("./_baseIteratee"),s=e("./_baseMap"),a=e("./_baseSortBy"),o=e("./_baseUnary"),u=e("./_compareMultiple"),l=e("./identity");t.exports=function(e,t,r){var c=-1;t=n(t.length?t:[l],o(i));var p=s(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++c,value:e}});return a(p,function(e,t){return u(e,t,r)})}},{"./_arrayMap":345,"./_baseIteratee":377,"./_baseMap":380,"./_baseSortBy":391,"./_baseUnary":394,"./_compareMultiple":408,"./identity":506}],386:[function(e,t,r){t.exports=function(e){return function(t){return null==t?void 0:t[e]}}},{}],387:[function(e,t,r){var n=e("./_baseGet");t.exports=function(e){return function(t){return n(t,e)}}},{"./_baseGet":363}],388:[function(e,t,r){var n=9007199254740991,i=Math.floor;t.exports=function(e,t){var r="";if(!e||t<1||t>n)return r;do{t%2&&(r+=e),(t=i(t/2))&&(e+=e)}while(t);return r}},{}],389:[function(e,t,r){var n=e("./identity"),i=e("./_overRest"),s=e("./_setToString");t.exports=function(e,t){return s(i(e,t,n),e+"")}},{"./_overRest":472,"./_setToString":477,"./identity":506}],390:[function(e,t,r){var n=e("./constant"),i=e("./_defineProperty"),s=e("./identity"),a=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:s;t.exports=a},{"./_defineProperty":420,"./constant":494,"./identity":506}],391:[function(e,t,r){t.exports=function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}},{}],392:[function(e,t,r){t.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},{}],393:[function(e,t,r){function n(e){if("string"==typeof e)return e;if(a(e))return s(e,n)+"";if(o(e))return c?c.call(e):"";var t=e+"";return"0"==t&&1/e==-u?"-0":t}var i=e("./_Symbol"),s=e("./_arrayMap"),a=e("./isArray"),o=e("./isSymbol"),u=1/0,l=i?i.prototype:void 0,c=l?l.toString:void 0;t.exports=n},{"./_Symbol":334,"./_arrayMap":345,"./isArray":509,"./isSymbol":521}],394:[function(e,t,r){t.exports=function(e){return function(t){return e(t)}}},{}],395:[function(e,t,r){var n=e("./_SetCache"),i=e("./_arrayIncludes"),s=e("./_arrayIncludesWith"),a=e("./_cacheHas"),o=e("./_createSet"),u=e("./_setToArray"),l=200;t.exports=function(e,t,r){var c=-1,p=i,h=e.length,f=!0,d=[],m=d;if(r)f=!1,p=s;else if(h>=l){var y=t?null:o(e);if(y)return u(y);f=!1,p=a,m=new n}else m=t?[]:d;e:for(;++c<h;){var g=e[c],b=t?t(g):g;if(g=r||0!==g?g:0,f&&b==b){for(var v=m.length;v--;)if(m[v]===b)continue e;t&&m.push(b),d.push(g)}else p(m,b,r)||(m!==d&&m.push(b),d.push(g))}return d}},{"./_SetCache":332,"./_arrayIncludes":342,"./_arrayIncludesWith":343,"./_cacheHas":397,"./_createSet":418,"./_setToArray":476}],396:[function(e,t,r){var n=e("./_arrayMap");t.exports=function(e,t){return n(t,function(t){return e[t]})}},{"./_arrayMap":345}],397:[function(e,t,r){t.exports=function(e,t){return e.has(t)}},{}],398:[function(e,t,r){var n=e("./isArray"),i=e("./_isKey"),s=e("./_stringToPath"),a=e("./toString");t.exports=function(e,t){return n(e)?e:i(e,t)?[e]:s(a(e))}},{"./_isKey":448,"./_stringToPath":485,"./isArray":509,"./toString":539}],399:[function(e,t,r){var n=e("./_Uint8Array");t.exports=function(e){var t=new e.constructor(e.byteLength);return new n(t).set(new n(e)),t}},{"./_Uint8Array":335}],400:[function(e,t,r){var n=e("./_root"),i="object"==typeof r&&r&&!r.nodeType&&r,s=i&&"object"==typeof t&&t&&!t.nodeType&&t,a=s&&s.exports===i?n.Buffer:void 0,o=a?a.allocUnsafe:void 0;t.exports=function(e,t){if(t)return e.slice();var r=e.length,n=o?o(r):new e.constructor(r);return e.copy(n),n}},{"./_root":473}],401:[function(e,t,r){var n=e("./_cloneArrayBuffer");t.exports=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}},{"./_cloneArrayBuffer":399}],402:[function(e,t,r){var n=e("./_addMapEntry"),i=e("./_arrayReduce"),s=e("./_mapToArray"),a=1;t.exports=function(e,t,r){var o=t?r(s(e),a):s(e);return i(o,n,new e.constructor)}},{"./_addMapEntry":337,"./_arrayReduce":347,"./_mapToArray":463}],403:[function(e,t,r){var n=/\w*$/;t.exports=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}},{}],404:[function(e,t,r){var n=e("./_addSetEntry"),i=e("./_arrayReduce"),s=e("./_setToArray"),a=1;t.exports=function(e,t,r){var o=t?r(s(e),a):s(e);return i(o,n,new e.constructor)}},{"./_addSetEntry":338,"./_arrayReduce":347,"./_setToArray":476}],405:[function(e,t,r){var n=e("./_Symbol"),i=n?n.prototype:void 0,s=i?i.valueOf:void 0;t.exports=function(e){return s?Object(s.call(e)):{}}},{"./_Symbol":334}],406:[function(e,t,r){var n=e("./_cloneArrayBuffer");t.exports=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}},{"./_cloneArrayBuffer":399}],407:[function(e,t,r){var n=e("./isSymbol");t.exports=function(e,t){if(e!==t){var r=void 0!==e,i=null===e,s=e==e,a=n(e),o=void 0!==t,u=null===t,l=t==t,c=n(t);if(!u&&!c&&!a&&e>t||a&&o&&l&&!u&&!c||i&&o&&l||!r&&l||!s)return 1;if(!i&&!a&&!c&&e<t||c&&r&&s&&!i&&!a||u&&r&&s||!o&&s||!l)return-1}return 0}},{"./isSymbol":521}],408:[function(e,t,r){var n=e("./_compareAscending");t.exports=function(e,t,r){for(var i=-1,s=e.criteria,a=t.criteria,o=s.length,u=r.length;++i<o;){var l=n(s[i],a[i]);if(l)return i>=u?l:l*("desc"==r[i]?-1:1)}return e.index-t.index}},{"./_compareAscending":407}],409:[function(e,t,r){t.exports=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}},{}],410:[function(e,t,r){var n=e("./_assignValue"),i=e("./_baseAssignValue");t.exports=function(e,t,r,s){var a=!r;r||(r={});for(var o=-1,u=t.length;++o<u;){var l=t[o],c=s?s(r[l],e[l],l,r,e):void 0;void 0===c&&(c=e[l]),a?i(r,l,c):n(r,l,c)}return r}},{"./_assignValue":350,"./_baseAssignValue":354}],411:[function(e,t,r){var n=e("./_copyObject"),i=e("./_getSymbols");t.exports=function(e,t){return n(e,i(e),t)}},{"./_copyObject":410,"./_getSymbols":432}],412:[function(e,t,r){var n=e("./_copyObject"),i=e("./_getSymbolsIn");t.exports=function(e,t){return n(e,i(e),t)}},{"./_copyObject":410,"./_getSymbolsIn":433}],413:[function(e,t,r){var n=e("./_root")["__core-js_shared__"];t.exports=n},{"./_root":473}],414:[function(e,t,r){var n=e("./_baseRest"),i=e("./_isIterateeCall");t.exports=function(e){return n(function(t,r){var n=-1,s=r.length,a=s>1?r[s-1]:void 0,o=s>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(s--,a):void 0,o&&i(r[0],r[1],o)&&(a=s<3?void 0:a,s=1),t=Object(t);++n<s;){var u=r[n];u&&e(t,u,n,a)}return t})}},{"./_baseRest":389,"./_isIterateeCall":447}],415:[function(e,t,r){var n=e("./isArrayLike");t.exports=function(e,t){return function(r,i){if(null==r)return r;if(!n(r))return e(r,i);for(var s=r.length,a=t?s:-1,o=Object(r);(t?a--:++a<s)&&!1!==i(o[a],a,o););return r}}},{"./isArrayLike":510}],416:[function(e,t,r){t.exports=function(e){return function(t,r,n){for(var i=-1,s=Object(t),a=n(t),o=a.length;o--;){var u=a[e?o:++i];if(!1===r(s[u],u,s))break}return t}}},{}],417:[function(e,t,r){var n=e("./_baseIteratee"),i=e("./isArrayLike"),s=e("./keys");t.exports=function(e){return function(t,r,a){var o=Object(t);if(!i(t)){var u=n(r,3);t=s(t),r=function(e){return u(o[e],e,o)}}var l=e(t,r,a);return l>-1?o[u?t[l]:l]:void 0}}},{"./_baseIteratee":377,"./isArrayLike":510,"./keys":523}],418:[function(e,t,r){var n=e("./_Set"),i=e("./noop"),s=e("./_setToArray"),a=n&&1/s(new n([,-0]))[1]==1/0?function(e){return new n(e)}:i;t.exports=a},{"./_Set":331,"./_setToArray":476,"./noop":528}],419:[function(e,t,r){var n=e("./eq"),i=Object.prototype,s=i.hasOwnProperty;t.exports=function(e,t,r,a){return void 0===e||n(e,i[r])&&!s.call(a,r)?t:e}},{"./eq":496}],420:[function(e,t,r){var n=e("./_getNative"),i=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();t.exports=i},{"./_getNative":429}],421:[function(e,t,r){var n=e("./_SetCache"),i=e("./_arraySome"),s=e("./_cacheHas"),a=1,o=2;t.exports=function(e,t,r,u,l,c){var p=r&a,h=e.length,f=t.length;if(h!=f&&!(p&&f>h))return!1;var d=c.get(e);if(d&&c.get(t))return d==t;var m=-1,y=!0,g=r&o?new n:void 0;for(c.set(e,t),c.set(t,e);++m<h;){var b=e[m],v=t[m];if(u)var x=p?u(v,b,m,t,e,c):u(b,v,m,e,t,c);if(void 0!==x){if(x)continue;y=!1;break}if(g){if(!i(t,function(e,t){if(!s(g,t)&&(b===e||l(b,e,r,u,c)))return g.push(t)})){y=!1;break}}else if(b!==v&&!l(b,v,r,u,c)){y=!1;break}}return c.delete(e),c.delete(t),y}},{"./_SetCache":332,"./_arraySome":348,"./_cacheHas":397}],422:[function(e,t,r){var n=e("./_Symbol"),i=e("./_Uint8Array"),s=e("./eq"),a=e("./_equalArrays"),o=e("./_mapToArray"),u=e("./_setToArray"),l=1,c=2,p="[object Boolean]",h="[object Date]",f="[object Error]",d="[object Map]",m="[object Number]",y="[object RegExp]",g="[object Set]",b="[object String]",v="[object Symbol]",x="[object ArrayBuffer]",E="[object DataView]",A=n?n.prototype:void 0,D=A?A.valueOf:void 0;t.exports=function(e,t,r,n,A,S,C){switch(r){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!S(new i(e),new i(t)));case p:case h:case m:return s(+e,+t);case f:return e.name==t.name&&e.message==t.message;case y:case b:return e==t+"";case d:var _=o;case g:var w=n&l;if(_||(_=u),e.size!=t.size&&!w)return!1;var k=C.get(e);if(k)return k==t;n|=c,C.set(e,t);var F=a(_(e),_(t),n,A,S,C);return C.delete(e),F;case v:if(D)return D.call(e)==D.call(t)}return!1}},{"./_Symbol":334,"./_Uint8Array":335,"./_equalArrays":421,"./_mapToArray":463,"./_setToArray":476,"./eq":496}],423:[function(e,t,r){var n=e("./_getAllKeys"),i=1,s=Object.prototype.hasOwnProperty;t.exports=function(e,t,r,a,o,u){var l=r&i,c=n(e),p=c.length;if(p!=n(t).length&&!l)return!1;for(var h=p;h--;){var f=c[h];if(!(l?f in t:s.call(t,f)))return!1}var d=u.get(e);if(d&&u.get(t))return d==t;var m=!0;u.set(e,t),u.set(t,e);for(var y=l;++h<p;){var g=e[f=c[h]],b=t[f];if(a)var v=l?a(b,g,f,t,e,u):a(g,b,f,e,t,u);if(!(void 0===v?g===b||o(g,b,r,a,u):v)){m=!1;break}y||(y="constructor"==f)}if(m&&!y){var x=e.constructor,E=t.constructor;x!=E&&"constructor"in e&&"constructor"in t&&!("function"==typeof x&&x instanceof x&&"function"==typeof E&&E instanceof E)&&(m=!1)}return u.delete(e),u.delete(t),m}},{"./_getAllKeys":425}],424:[function(e,t,r){(function(e){var r="object"==typeof e&&e&&e.Object===Object&&e;t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],425:[function(e,t,r){var n=e("./_baseGetAllKeys"),i=e("./_getSymbols"),s=e("./keys");t.exports=function(e){return n(e,s,i)}},{"./_baseGetAllKeys":364,"./_getSymbols":432,"./keys":523}],426:[function(e,t,r){var n=e("./_baseGetAllKeys"),i=e("./_getSymbolsIn"),s=e("./keysIn");t.exports=function(e){return n(e,s,i)}},{"./_baseGetAllKeys":364,"./_getSymbolsIn":433,"./keysIn":524}],427:[function(e,t,r){var n=e("./_isKeyable");t.exports=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}},{"./_isKeyable":449}],428:[function(e,t,r){var n=e("./_isStrictComparable"),i=e("./keys");t.exports=function(e){for(var t=i(e),r=t.length;r--;){var s=t[r],a=e[s];t[r]=[s,a,n(a)]}return t}},{"./_isStrictComparable":452,"./keys":523}],429:[function(e,t,r){var n=e("./_baseIsNative"),i=e("./_getValue");t.exports=function(e,t){var r=i(e,t);return n(r)?r:void 0}},{"./_baseIsNative":374,"./_getValue":435}],430:[function(e,t,r){var n=e("./_overArg")(Object.getPrototypeOf,Object);t.exports=n},{"./_overArg":471}],431:[function(e,t,r){var n=e("./_Symbol"),i=Object.prototype,s=i.hasOwnProperty,a=i.toString,o=n?n.toStringTag:void 0;t.exports=function(e){var t=s.call(e,o),r=e[o];try{e[o]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[o]=r:delete e[o]),i}},{"./_Symbol":334}],432:[function(e,t,r){var n=e("./_arrayFilter"),i=e("./stubArray"),s=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,o=a?function(e){return null==e?[]:(e=Object(e),n(a(e),function(t){return s.call(e,t)}))}:i;t.exports=o},{"./_arrayFilter":341,"./stubArray":533}],433:[function(e,t,r){var n=e("./_arrayPush"),i=e("./_getPrototype"),s=e("./_getSymbols"),a=e("./stubArray"),o=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)n(t,s(e)),e=i(e);return t}:a;t.exports=o},{"./_arrayPush":346,"./_getPrototype":430,"./_getSymbols":432,"./stubArray":533}],434:[function(e,t,r){var n=e("./_DataView"),i=e("./_Map"),s=e("./_Promise"),a=e("./_Set"),o=e("./_WeakMap"),u=e("./_baseGetTag"),l=e("./_toSource"),c=l(n),p=l(i),h=l(s),f=l(a),d=l(o),m=u;(n&&"[object DataView]"!=m(new n(new ArrayBuffer(1)))||i&&"[object Map]"!=m(new i)||s&&"[object Promise]"!=m(s.resolve())||a&&"[object Set]"!=m(new a)||o&&"[object WeakMap]"!=m(new o))&&(m=function(e){var t=u(e),r="[object Object]"==t?e.constructor:void 0,n=r?l(r):"";if(n)switch(n){case c:return"[object DataView]";case p:return"[object Map]";case h:return"[object Promise]";case f:return"[object Set]";case d:return"[object WeakMap]"}return t}),t.exports=m},{"./_DataView":325,"./_Map":328,"./_Promise":330,"./_Set":331,"./_WeakMap":336,"./_baseGetTag":365,"./_toSource":487}],435:[function(e,t,r){t.exports=function(e,t){return null==e?void 0:e[t]}},{}],436:[function(e,t,r){var n=e("./_castPath"),i=e("./isArguments"),s=e("./isArray"),a=e("./_isIndex"),o=e("./isLength"),u=e("./_toKey");t.exports=function(e,t,r){for(var l=-1,c=(t=n(t,e)).length,p=!1;++l<c;){var h=u(t[l]);if(!(p=null!=e&&r(e,h)))break;e=e[h]}return p||++l!=c?p:!!(c=null==e?0:e.length)&&o(c)&&a(h,c)&&(s(e)||i(e))}},{"./_castPath":398,"./_isIndex":446,"./_toKey":486,"./isArguments":508,"./isArray":509,"./isLength":515}],437:[function(e,t,r){var n=e("./_nativeCreate");t.exports=function(){this.__data__=n?n(null):{},this.size=0}},{"./_nativeCreate":466}],438:[function(e,t,r){t.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},{}],439:[function(e,t,r){var n=e("./_nativeCreate"),i="__lodash_hash_undefined__",s=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(n){var r=t[e];return r===i?void 0:r}return s.call(t,e)?t[e]:void 0}},{"./_nativeCreate":466}],440:[function(e,t,r){var n=e("./_nativeCreate"),i=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return n?void 0!==t[e]:i.call(t,e)}},{"./_nativeCreate":466}],441:[function(e,t,r){var n=e("./_nativeCreate"),i="__lodash_hash_undefined__";t.exports=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?i:t,this}},{"./_nativeCreate":466}],442:[function(e,t,r){var n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},{}],443:[function(e,t,r){var n=e("./_cloneArrayBuffer"),i=e("./_cloneDataView"),s=e("./_cloneMap"),a=e("./_cloneRegExp"),o=e("./_cloneSet"),u=e("./_cloneSymbol"),l=e("./_cloneTypedArray"),c="[object Boolean]",p="[object Date]",h="[object Map]",f="[object Number]",d="[object RegExp]",m="[object Set]",y="[object String]",g="[object Symbol]",b="[object ArrayBuffer]",v="[object DataView]",x="[object Float32Array]",E="[object Float64Array]",A="[object Int8Array]",D="[object Int16Array]",S="[object Int32Array]",C="[object Uint8Array]",_="[object Uint8ClampedArray]",w="[object Uint16Array]",k="[object Uint32Array]";t.exports=function(e,t,r,F){var T=e.constructor;switch(t){case b:return n(e);case c:case p:return new T(+e);case v:return i(e,F);case x:case E:case A:case D:case S:case C:case _:case w:case k:return l(e,F);case h:return s(e,F,r);case f:case y:return new T(e);case d:return a(e);case m:return o(e,F,r);case g:return u(e)}}},{"./_cloneArrayBuffer":399,"./_cloneDataView":401,"./_cloneMap":402,"./_cloneRegExp":403,"./_cloneSet":404,"./_cloneSymbol":405,"./_cloneTypedArray":406}],444:[function(e,t,r){var n=e("./_baseCreate"),i=e("./_getPrototype"),s=e("./_isPrototype");t.exports=function(e){return"function"!=typeof e.constructor||s(e)?{}:n(i(e))}},{"./_baseCreate":357,"./_getPrototype":430,"./_isPrototype":451}],445:[function(e,t,r){var n=e("./_Symbol"),i=e("./isArguments"),s=e("./isArray"),a=n?n.isConcatSpreadable:void 0;t.exports=function(e){return s(e)||i(e)||!!(a&&e&&e[a])}},{"./_Symbol":334,"./isArguments":508,"./isArray":509}],446:[function(e,t,r){var n=9007199254740991,i=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||i.test(e))&&e>-1&&e%1==0&&e<t}},{}],447:[function(e,t,r){var n=e("./eq"),i=e("./isArrayLike"),s=e("./_isIndex"),a=e("./isObject");t.exports=function(e,t,r){if(!a(r))return!1;var o=typeof t;return!!("number"==o?i(r)&&s(t,r.length):"string"==o&&t in r)&&n(r[t],e)}},{"./_isIndex":446,"./eq":496,"./isArrayLike":510,"./isObject":516}],448:[function(e,t,r){var n=e("./isArray"),i=e("./isSymbol"),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(e,t){if(n(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!i(e))||a.test(e)||!s.test(e)||null!=t&&e in Object(t)}},{"./isArray":509,"./isSymbol":521}],449:[function(e,t,r){t.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},{}],450:[function(e,t,r){var n=e("./_coreJsData"),i=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();t.exports=function(e){return!!i&&i in e}},{"./_coreJsData":413}],451:[function(e,t,r){var n=Object.prototype;t.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},{}],452:[function(e,t,r){var n=e("./isObject");t.exports=function(e){return e==e&&!n(e)}},{"./isObject":516}],453:[function(e,t,r){t.exports=function(){this.__data__=[],this.size=0}},{}],454:[function(e,t,r){var n=e("./_assocIndexOf"),i=Array.prototype.splice;t.exports=function(e){var t=this.__data__,r=n(t,e);return!(r<0||(r==t.length-1?t.pop():i.call(t,r,1),--this.size,0))}},{"./_assocIndexOf":351}],455:[function(e,t,r){var n=e("./_assocIndexOf");t.exports=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}},{"./_assocIndexOf":351}],456:[function(e,t,r){var n=e("./_assocIndexOf");t.exports=function(e){return n(this.__data__,e)>-1}},{"./_assocIndexOf":351}],457:[function(e,t,r){var n=e("./_assocIndexOf");t.exports=function(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}},{"./_assocIndexOf":351}],458:[function(e,t,r){var n=e("./_Hash"),i=e("./_ListCache"),s=e("./_Map");t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(s||i),string:new n}}},{"./_Hash":326,"./_ListCache":327,"./_Map":328}],459:[function(e,t,r){var n=e("./_getMapData");t.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},{"./_getMapData":427}],460:[function(e,t,r){var n=e("./_getMapData");t.exports=function(e){return n(this,e).get(e)}},{"./_getMapData":427}],461:[function(e,t,r){var n=e("./_getMapData");t.exports=function(e){return n(this,e).has(e)}},{"./_getMapData":427}],462:[function(e,t,r){var n=e("./_getMapData");t.exports=function(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}},{"./_getMapData":427}],463:[function(e,t,r){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}},{}],464:[function(e,t,r){t.exports=function(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}},{}],465:[function(e,t,r){var n=e("./memoize"),i=500;t.exports=function(e){var t=n(e,function(e){return r.size===i&&r.clear(),e}),r=t.cache;return t}},{"./memoize":526}],466:[function(e,t,r){var n=e("./_getNative")(Object,"create");t.exports=n},{"./_getNative":429}],467:[function(e,t,r){var n=e("./_overArg")(Object.keys,Object);t.exports=n},{"./_overArg":471}],468:[function(e,t,r){t.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},{}],469:[function(e,t,r){var n=e("./_freeGlobal"),i="object"==typeof r&&r&&!r.nodeType&&r,s=i&&"object"==typeof t&&t&&!t.nodeType&&t,a=s&&s.exports===i&&n.process,o=function(){try{return a&&a.binding&&a.binding("util")}catch(e){}}();t.exports=o},{"./_freeGlobal":424}],470:[function(e,t,r){var n=Object.prototype.toString;t.exports=function(e){return n.call(e)}},{}],471:[function(e,t,r){t.exports=function(e,t){return function(r){return e(t(r))}}},{}],472:[function(e,t,r){var n=e("./_apply"),i=Math.max;t.exports=function(e,t,r){return t=i(void 0===t?e.length-1:t,0),function(){for(var s=arguments,a=-1,o=i(s.length-t,0),u=Array(o);++a<o;)u[a]=s[t+a];a=-1;for(var l=Array(t+1);++a<t;)l[a]=s[a];return l[t]=r(u),n(e,this,l)}}},{"./_apply":339}],473:[function(e,t,r){var n=e("./_freeGlobal"),i="object"==typeof self&&self&&self.Object===Object&&self,s=n||i||Function("return this")();t.exports=s},{"./_freeGlobal":424}],474:[function(e,t,r){var n="__lodash_hash_undefined__";t.exports=function(e){return this.__data__.set(e,n),this}},{}],475:[function(e,t,r){t.exports=function(e){return this.__data__.has(e)}},{}],476:[function(e,t,r){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}},{}],477:[function(e,t,r){var n=e("./_baseSetToString"),i=e("./_shortOut")(n);t.exports=i},{"./_baseSetToString":390,"./_shortOut":478}],478:[function(e,t,r){var n=800,i=16,s=Date.now;t.exports=function(e){var t=0,r=0;return function(){var a=s(),o=i-(a-r);if(r=a,o>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},{}],479:[function(e,t,r){var n=e("./_ListCache");t.exports=function(){this.__data__=new n,this.size=0}},{"./_ListCache":327}],480:[function(e,t,r){t.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}},{}],481:[function(e,t,r){t.exports=function(e){return this.__data__.get(e)}},{}],482:[function(e,t,r){t.exports=function(e){return this.__data__.has(e)}},{}],483:[function(e,t,r){var n=e("./_ListCache"),i=e("./_Map"),s=e("./_MapCache"),a=200;t.exports=function(e,t){var r=this.__data__;if(r instanceof n){var o=r.__data__;if(!i||o.length<a-1)return o.push([e,t]),this.size=++r.size,this;r=this.__data__=new s(o)}return r.set(e,t),this.size=r.size,this}},{"./_ListCache":327,"./_Map":328,"./_MapCache":329}],484:[function(e,t,r){t.exports=function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}},{}],485:[function(e,t,r){var n=/^\./,i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,a=e("./_memoizeCapped")(function(e){var t=[];return n.test(e)&&t.push(""),e.replace(i,function(e,r,n,i){t.push(n?i.replace(s,"$1"):r||e)}),t});t.exports=a},{"./_memoizeCapped":465}],486:[function(e,t,r){var n=e("./isSymbol"),i=1/0;t.exports=function(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-i?"-0":t}},{"./isSymbol":521}],487:[function(e,t,r){var n=Function.prototype.toString;t.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},{}],488:[function(e,t,r){var n=e("./_assignValue"),i=e("./_copyObject"),s=e("./_createAssigner"),a=e("./isArrayLike"),o=e("./_isPrototype"),u=e("./keys"),l=Object.prototype.hasOwnProperty,c=s(function(e,t){if(o(t)||a(t))i(t,u(t),e);else for(var r in t)l.call(t,r)&&n(e,r,t[r])});t.exports=c},{"./_assignValue":350,"./_copyObject":410,"./_createAssigner":414,"./_isPrototype":451,"./isArrayLike":510,"./keys":523}],489:[function(e,t,r){var n=e("./_copyObject"),i=e("./_createAssigner"),s=e("./keysIn"),a=i(function(e,t){n(t,s(t),e)});t.exports=a},{"./_copyObject":410,"./_createAssigner":414,"./keysIn":524}],490:[function(e,t,r){var n=e("./_copyObject"),i=e("./_createAssigner"),s=e("./keysIn"),a=i(function(e,t,r,i){n(t,s(t),e,i)});t.exports=a},{"./_copyObject":410,"./_createAssigner":414,"./keysIn":524}],491:[function(e,t,r){var n=e("./_baseClone"),i=4;t.exports=function(e){return n(e,i)}},{"./_baseClone":356}],492:[function(e,t,r){var n=e("./_baseClone"),i=1,s=4;t.exports=function(e){return n(e,i|s)}},{"./_baseClone":356}],493:[function(e,t,r){var n=e("./_baseClone"),i=1,s=4;t.exports=function(e,t){return t="function"==typeof t?t:void 0,n(e,i|s,t)}},{"./_baseClone":356}],494:[function(e,t,r){t.exports=function(e){return function(){return e}}},{}],495:[function(e,t,r){var n=e("./_apply"),i=e("./assignInWith"),s=e("./_baseRest"),a=e("./_customDefaultsAssignIn"),o=s(function(e){return e.push(void 0,a),n(i,void 0,e)});t.exports=o},{"./_apply":339,"./_baseRest":389,"./_customDefaultsAssignIn":419,"./assignInWith":490}],496:[function(e,t,r){t.exports=function(e,t){return e===t||e!=e&&t!=t}},{}],497:[function(e,t,r){var n=e("./toString"),i=/[\\^$.*+?()[\]{}|]/g,s=RegExp(i.source);t.exports=function(e){return(e=n(e))&&s.test(e)?e.replace(i,"\\$&"):e}},{"./toString":539}],498:[function(e,t,r){t.exports=e("./assignIn")},{"./assignIn":489}],499:[function(e,t,r){var n=e("./_createFind")(e("./findIndex"));t.exports=n},{"./_createFind":417,"./findIndex":500}],500:[function(e,t,r){var n=e("./_baseFindIndex"),i=e("./_baseIteratee"),s=e("./toInteger"),a=Math.max;t.exports=function(e,t,r){var o=null==e?0:e.length;if(!o)return-1;var u=null==r?0:s(r);return u<0&&(u=a(o+u,0)),n(e,i(t,3),u)}},{"./_baseFindIndex":359,"./_baseIteratee":377,"./toInteger":536}],501:[function(e,t,r){var n=e("./_createFind")(e("./findLastIndex"));t.exports=n},{"./_createFind":417,"./findLastIndex":502}],502:[function(e,t,r){var n=e("./_baseFindIndex"),i=e("./_baseIteratee"),s=e("./toInteger"),a=Math.max,o=Math.min;t.exports=function(e,t,r){var u=null==e?0:e.length;if(!u)return-1;var l=u-1;return void 0!==r&&(l=s(r),l=r<0?a(u+l,0):o(l,u-1)),n(e,i(t,3),l,!0)}},{"./_baseFindIndex":359,"./_baseIteratee":377,"./toInteger":536}],503:[function(e,t,r){var n=e("./_baseGet");t.exports=function(e,t,r){var i=null==e?void 0:n(e,t);return void 0===i?r:i}},{"./_baseGet":363}],504:[function(e,t,r){var n=e("./_baseHas"),i=e("./_hasPath");t.exports=function(e,t){return null!=e&&i(e,t,n)}},{"./_baseHas":366,"./_hasPath":436}],505:[function(e,t,r){var n=e("./_baseHasIn"),i=e("./_hasPath");t.exports=function(e,t){return null!=e&&i(e,t,n)}},{"./_baseHasIn":367,"./_hasPath":436}],506:[function(e,t,r){t.exports=function(e){return e}},{}],507:[function(e,t,r){var n=e("./_baseIndexOf"),i=e("./isArrayLike"),s=e("./isString"),a=e("./toInteger"),o=e("./values"),u=Math.max;t.exports=function(e,t,r,l){e=i(e)?e:o(e),r=r&&!l?a(r):0;var c=e.length;return r<0&&(r=u(c+r,0)),s(e)?r<=c&&e.indexOf(t,r)>-1:!!c&&n(e,t,r)>-1}},{"./_baseIndexOf":368,"./isArrayLike":510,"./isString":520,"./toInteger":536,"./values":541}],508:[function(e,t,r){var n=e("./_baseIsArguments"),i=e("./isObjectLike"),s=Object.prototype,a=s.hasOwnProperty,o=s.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(e){return i(e)&&a.call(e,"callee")&&!o.call(e,"callee")};t.exports=u},{"./_baseIsArguments":369,"./isObjectLike":517}],509:[function(e,t,r){var n=Array.isArray;t.exports=n},{}],510:[function(e,t,r){var n=e("./isFunction"),i=e("./isLength");t.exports=function(e){return null!=e&&i(e.length)&&!n(e)}},{"./isFunction":513,"./isLength":515}],511:[function(e,t,r){var n=e("./isArrayLike"),i=e("./isObjectLike");t.exports=function(e){return i(e)&&n(e)}},{"./isArrayLike":510,"./isObjectLike":517}],512:[function(e,t,r){var n=e("./_root"),i=e("./stubFalse"),s="object"==typeof r&&r&&!r.nodeType&&r,a=s&&"object"==typeof t&&t&&!t.nodeType&&t,o=a&&a.exports===s?n.Buffer:void 0,u=(o?o.isBuffer:void 0)||i;t.exports=u},{"./_root":473,"./stubFalse":534}],513:[function(e,t,r){var n=e("./_baseGetTag"),i=e("./isObject"),s="[object AsyncFunction]",a="[object Function]",o="[object GeneratorFunction]",u="[object Proxy]";t.exports=function(e){if(!i(e))return!1;var t=n(e);return t==a||t==o||t==s||t==u}},{"./_baseGetTag":365,"./isObject":516}],514:[function(e,t,r){var n=e("./toInteger");t.exports=function(e){return"number"==typeof e&&e==n(e)}},{"./toInteger":536}],515:[function(e,t,r){var n=9007199254740991;t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}},{}],516:[function(e,t,r){t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},{}],517:[function(e,t,r){t.exports=function(e){return null!=e&&"object"==typeof e}},{}],518:[function(e,t,r){var n=e("./_baseGetTag"),i=e("./_getPrototype"),s=e("./isObjectLike"),a="[object Object]",o=Function.prototype,u=Object.prototype,l=o.toString,c=u.hasOwnProperty,p=l.call(Object);t.exports=function(e){if(!s(e)||n(e)!=a)return!1;var t=i(e);if(null===t)return!0;var r=c.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&l.call(r)==p}},{"./_baseGetTag":365,"./_getPrototype":430,"./isObjectLike":517}],519:[function(e,t,r){var n=e("./_baseIsRegExp"),i=e("./_baseUnary"),s=e("./_nodeUtil"),a=s&&s.isRegExp,o=a?i(a):n;t.exports=o},{"./_baseIsRegExp":375,"./_baseUnary":394,"./_nodeUtil":469}],520:[function(e,t,r){var n=e("./_baseGetTag"),i=e("./isArray"),s=e("./isObjectLike"),a="[object String]";t.exports=function(e){return"string"==typeof e||!i(e)&&s(e)&&n(e)==a}},{"./_baseGetTag":365,"./isArray":509,"./isObjectLike":517}],521:[function(e,t,r){var n=e("./_baseGetTag"),i=e("./isObjectLike"),s="[object Symbol]";t.exports=function(e){return"symbol"==typeof e||i(e)&&n(e)==s}},{"./_baseGetTag":365,"./isObjectLike":517}],522:[function(e,t,r){var n=e("./_baseIsTypedArray"),i=e("./_baseUnary"),s=e("./_nodeUtil"),a=s&&s.isTypedArray,o=a?i(a):n;t.exports=o},{"./_baseIsTypedArray":376,"./_baseUnary":394,"./_nodeUtil":469}],523:[function(e,t,r){var n=e("./_arrayLikeKeys"),i=e("./_baseKeys"),s=e("./isArrayLike");t.exports=function(e){return s(e)?n(e):i(e)}},{"./_arrayLikeKeys":344,"./_baseKeys":378,"./isArrayLike":510}],524:[function(e,t,r){var n=e("./_arrayLikeKeys"),i=e("./_baseKeysIn"),s=e("./isArrayLike");t.exports=function(e){return s(e)?n(e,!0):i(e)}},{"./_arrayLikeKeys":344,"./_baseKeysIn":379,"./isArrayLike":510}],525:[function(e,t,r){var n=e("./_arrayMap"),i=e("./_baseIteratee"),s=e("./_baseMap"),a=e("./isArray");t.exports=function(e,t){return(a(e)?n:s)(e,i(t,3))}},{"./_arrayMap":345,"./_baseIteratee":377,"./_baseMap":380,"./isArray":509}],526:[function(e,t,r){function n(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(s);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=e.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(n.Cache||i),r}var i=e("./_MapCache"),s="Expected a function";n.Cache=i,t.exports=n},{"./_MapCache":329}],527:[function(e,t,r){var n=e("./_baseMerge"),i=e("./_createAssigner")(function(e,t,r,i){n(e,t,r,i)});t.exports=i},{"./_baseMerge":383,"./_createAssigner":414}],528:[function(e,t,r){t.exports=function(){}},{}],529:[function(e,t,r){var n=e("./_baseProperty"),i=e("./_basePropertyDeep"),s=e("./_isKey"),a=e("./_toKey");t.exports=function(e){return s(e)?n(a(e)):i(e)}},{"./_baseProperty":386,"./_basePropertyDeep":387,"./_isKey":448,"./_toKey":486}],530:[function(e,t,r){var n=e("./_baseRepeat"),i=e("./_isIterateeCall"),s=e("./toInteger"),a=e("./toString");t.exports=function(e,t,r){return t=(r?i(e,t,r):void 0===t)?1:s(t),n(a(e),t)}},{"./_baseRepeat":388,"./_isIterateeCall":447,"./toInteger":536,"./toString":539}],531:[function(e,t,r){var n=e("./_baseFlatten"),i=e("./_baseOrderBy"),s=e("./_baseRest"),a=e("./_isIterateeCall"),o=s(function(e,t){if(null==e)return[];var r=t.length;return r>1&&a(e,t[0],t[1])?t=[]:r>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),i(e,n(t,1),[])});t.exports=o},{"./_baseFlatten":360,"./_baseOrderBy":385,"./_baseRest":389,"./_isIterateeCall":447}],532:[function(e,t,r){var n=e("./_baseClamp"),i=e("./_baseToString"),s=e("./toInteger"),a=e("./toString");t.exports=function(e,t,r){return e=a(e),r=null==r?0:n(s(r),0,e.length),t=i(t),e.slice(r,r+t.length)==t}},{"./_baseClamp":355,"./_baseToString":393,"./toInteger":536,"./toString":539}],533:[function(e,t,r){t.exports=function(){return[]}},{}],534:[function(e,t,r){t.exports=function(){return!1}},{}],535:[function(e,t,r){var n=e("./toNumber"),i=1/0,s=1.7976931348623157e308;t.exports=function(e){if(!e)return 0===e?e:0;if((e=n(e))===i||e===-i)return(e<0?-1:1)*s;return e==e?e:0}},{"./toNumber":537}],536:[function(e,t,r){var n=e("./toFinite");t.exports=function(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}},{"./toFinite":535}],537:[function(e,t,r){var n=e("./isObject"),i=e("./isSymbol"),s=NaN,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(i(e))return s;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var r=u.test(e);return r||l.test(e)?c(e.slice(2),r?2:8):o.test(e)?s:+e}},{"./isObject":516,"./isSymbol":521}],538:[function(e,t,r){var n=e("./_copyObject"),i=e("./keysIn");t.exports=function(e){return n(e,i(e))}},{"./_copyObject":410,"./keysIn":524}],539:[function(e,t,r){var n=e("./_baseToString");t.exports=function(e){return null==e?"":n(e)}},{"./_baseToString":393}],540:[function(e,t,r){var n=e("./_baseUniq");t.exports=function(e){return e&&e.length?n(e):[]}},{"./_baseUniq":395}],541:[function(e,t,r){var n=e("./_baseValues"),i=e("./keys");t.exports=function(e){return null==e?[]:n(e,i(e))}},{"./_baseValues":396,"./keys":523}],542:[function(e,t,r){function n(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function i(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new s(t,r).match(e))}function s(e,t){if(!(this instanceof s))return new s(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==o.sep&&(e=e.split(o.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function a(e,t){if(t||(t=this instanceof s?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:l(e)}t.exports=i,i.Minimatch=s;var o={sep:"/"};try{o=e("path")}catch(e){}var u=i.GLOBSTAR=s.GLOBSTAR={},l=e("brace-expansion"),c={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},p="[^/]",h=p+"*?",f="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",d="(?:(?!(?:\\/|^)\\.).)*?",m=function(e){return e.split("").reduce(function(e,t){return e[t]=!0,e},{})}("().*{}+?[]^$\\!"),y=/\/+/;i.filter=function(e,t){return t=t||{},function(r,n,s){return i(r,e,t)}},i.defaults=function(e){if(!e||!Object.keys(e).length)return i;var t=i,r=function(r,i,s){return t.minimatch(r,i,n(e,s))};return r.Minimatch=function(r,i){return new t.Minimatch(r,n(e,i))},r},s.defaults=function(e){return e&&Object.keys(e).length?i.defaults(e).Minimatch:s},s.prototype.debug=function(){},s.prototype.make=function(){if(!this._made){var e=this.pattern,t=this.options;if(t.nocomment||"#"!==e.charAt(0))if(e){this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error),this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(y)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r}else this.empty=!0;else this.comment=!0}},s.prototype.parseNegate=function(){var e=this.pattern,t=!1,r=0;if(!this.options.nonegate){for(var n=0,i=e.length;n<i&&"!"===e.charAt(n);n++)t=!t,r++;r&&(this.pattern=e.substr(r)),this.negate=t}},i.braceExpand=function(e,t){return a(e,t)},s.prototype.braceExpand=a,s.prototype.parse=function(e,t){function r(){if(i){switch(i){case"*":a+=h,o=!0;break;case"?":a+=p,o=!0;break;default:a+="\\"+i}E.debug("clearStateChar %j %j",i,a),i=!1}}if(e.length>65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===e)return u;if(""===e)return"";for(var i,s,a="",o=!!n.nocase,l=!1,f=[],d=[],y=!1,b=-1,v=-1,x="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",E=this,A=0,D=e.length;A<D&&(s=e.charAt(A));A++)if(this.debug("%s\t%s %s %j",e,A,a,s),l&&m[s])a+="\\"+s,l=!1;else switch(s){case"/":return!1;case"\\":r(),l=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,A,a,s),y){this.debug(" in class"),"!"===s&&A===v+1&&(s="^"),a+=s;continue}E.debug("call clearStateChar %j",i),r(),i=s,n.noext&&r();continue;case"(":if(y){a+="(";continue}if(!i){a+="\\(";continue}f.push({type:i,start:A-1,reStart:a.length,open:c[i].open,close:c[i].close}),a+="!"===i?"(?:(?!(?:":"(?:",this.debug("plType %j %j",i,a),i=!1;continue;case")":if(y||!f.length){a+="\\)";continue}r(),o=!0;var S=f.pop();a+=S.close,"!"===S.type&&d.push(S),S.reEnd=a.length;continue;case"|":if(y||!f.length||l){a+="\\|",l=!1;continue}r(),a+="|";continue;case"[":if(r(),y){a+="\\"+s;continue}y=!0,v=A,b=a.length,a+=s;continue;case"]":if(A===v+1||!y){a+="\\"+s,l=!1;continue}if(y){var C=e.substring(v+1,A);try{RegExp("["+C+"]")}catch(e){var _=this.parse(C,g);a=a.substr(0,b)+"\\["+_[0]+"\\]",o=o||_[1],y=!1;continue}}o=!0,y=!1,a+=s;continue;default:r(),l?l=!1:!m[s]||"^"===s&&y||(a+="\\"),a+=s}for(y&&(C=e.substr(v+1),_=this.parse(C,g),a=a.substr(0,b)+"\\["+_[0],o=o||_[1]),S=f.pop();S;S=f.pop()){var w=a.slice(S.reStart+S.open.length);this.debug("setting tail",a,S),w=w.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",w,w,S,a);var k="*"===S.type?h:"?"===S.type?p:"\\"+S.type;o=!0,a=a.slice(0,S.reStart)+k+"\\("+w}r(),l&&(a+="\\\\");var F=!1;switch(a.charAt(0)){case".":case"[":case"(":F=!0}for(var T=d.length-1;T>-1;T--){var P=d[T],B=a.slice(0,P.reStart),O=a.slice(P.reStart,P.reEnd-8),N=a.slice(P.reEnd-8,P.reEnd),j=a.slice(P.reEnd);N+=j;var I=B.split("(").length-1,L=j;for(A=0;A<I;A++)L=L.replace(/\)[+*?]?/,"");var M="";""===(j=L)&&t!==g&&(M="$"),a=B+O+j+M+N}if(""!==a&&o&&(a="(?=.)"+a),F&&(a=x+a),t===g)return[a,o];if(!o)return function(e){return e.replace(/\\(.)/g,"$1")}(e);var R=n.nocase?"i":"";try{var V=new RegExp("^"+a+"$",R)}catch(e){return new RegExp("$.")}return V._glob=e,V._src=a,V};var g={};i.makeRe=function(e,t){return new s(e,t||{}).makeRe()},s.prototype.makeRe=function(){if(this.regexp||!1===this.regexp)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?h:t.dot?f:d,n=t.nocase?"i":"",i=e.map(function(e){return e.map(function(e){return e===u?r:"string"==typeof e?function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}(e):e._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch(e){this.regexp=!1}return this.regexp},i.match=function(e,t,r){var n=new s(t,r=r||{});return e=e.filter(function(e){return n.match(e)}),n.options.nonull&&!e.length&&e.push(t),e},s.prototype.match=function(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var r=this.options;"/"!==o.sep&&(e=e.split(o.sep).join("/")),e=e.split(y),this.debug(this.pattern,"split",e);var n=this.set;this.debug(this.pattern,"set",n);var i,s;for(s=e.length-1;s>=0&&!(i=e[s]);s--);for(s=0;s<n.length;s++){var a=n[s],u=e;if(r.matchBase&&1===a.length&&(u=[i]),this.matchOne(u,a,t))return!!r.flipNegate||!this.negate}return!r.flipNegate&&this.negate},s.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,s=0,a=e.length,o=t.length;i<a&&s<o;i++,s++){this.debug("matchOne loop");var l=t[s],c=e[i];if(this.debug(t,l,c),!1===l)return!1;if(l===u){this.debug("GLOBSTAR",[t,l,c]);var p=i,h=s+1;if(h===o){for(this.debug("** at the end");i<a;i++)if("."===e[i]||".."===e[i]||!n.dot&&"."===e[i].charAt(0))return!1;return!0}for(;p<a;){var f=e[p];if(this.debug("\nglobstar while",e,p,t,h,f),this.matchOne(e.slice(p),t.slice(h),r))return this.debug("globstar found match!",p,a,f),!0;if("."===f||".."===f||!n.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,p,t,h);break}this.debug("globstar swallow a segment, and continue"),p++}return!(!r||(this.debug("\n>>> no match, partial?",e,p,t,h),p!==a))}var d;if("string"==typeof l?(d=n.nocase?c.toLowerCase()===l.toLowerCase():c===l,this.debug("string match",l,c,d)):(d=c.match(l),this.debug("pattern match",l,c,d)),!d)return!1}if(i===a&&s===o)return!0;if(i===a)return r;if(s===o){return i===a-1&&""===e[i]}throw new Error("wtf?")}},{"brace-expansion":191,path:546}],543:[function(e,t,r){function n(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var i=1e3,s=60*i,a=60*s,o=24*a,u=365.25*o;t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*u;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*a;case"minutes":case"minute":case"mins":case"min":case"m":return r*s;case"seconds":case"second":case"secs":case"sec":case"s":return r*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===r&&!1===isNaN(e))return t.long?function(e){return n(e,o,"day")||n(e,a,"hour")||n(e,s,"minute")||n(e,i,"second")||e+" ms"}(e):function(e){return e>=o?Math.round(e/o)+"d":e>=a?Math.round(e/a)+"h":e>=s?Math.round(e/s)+"m":e>=i?Math.round(e/i)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],544:[function(e,t,r){"use strict";t.exports=Number.isNaN||function(e){return e!=e}},{}],545:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n",r.homedir=function(){return"/"}},{}],546:[function(e,t,r){(function(e){function t(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return i.exec(e).slice(1)};r.resolve=function(){for(var r="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var a=s>=0?arguments[s]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),s="/"===a(e,-1);return(e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&s&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),s=n(t.split("/")),a=Math.min(i.length,s.length),o=a,u=0;u<a;u++)if(i[u]!==s[u]){o=u;break}var l=[];for(u=o;u<i.length;u++)l.push("..");return(l=l.concat(s.slice(o))).join("/")},r.sep="/",r.delimiter=":",r.dirname=function(e){var t=s(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},r.basename=function(e,t){var r=s(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},r.extname=function(e){return s(e)[3]};var a="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,e("_process"))},{_process:550}],547:[function(e,t,r){(function(e){"use strict";function r(e){return"/"===e.charAt(0)}function n(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(e),r=t[1]||"",n=Boolean(r&&":"!==r.charAt(1));return Boolean(t[2]||n)}t.exports="win32"===e.platform?n:r,t.exports.posix=r,t.exports.win32=n}).call(this,e("_process"))},{_process:550}],548:[function(e,t,r){"use strict";function n(e,t,r){if(u)try{u.call(o,e,t,{value:r})}catch(n){e[t]=r}else e[t]=r}function i(e){return e&&(n(e,"call",e.call),n(e,"apply",e.apply)),e}function s(e){return l?l.call(o,e):(f.prototype=e||null,new f)}function a(){do{var e=function(e){var t={};return t[e]=!0,Object.keys(t)[0]}(h.call(p.call(d(),36),2))}while(c.call(m,e));return m[e]=e}var o=Object,u=Object.defineProperty,l=Object.create;i(u),i(l);var c=i(Object.prototype.hasOwnProperty),p=i(Number.prototype.toString),h=i(String.prototype.slice),f=function(){},d=Math.random,m=s(null);r.makeUniqueKey=a;var y=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function(e){for(var t=y(e),r=0,n=0,i=t.length;r<i;++r)c.call(m,t[r])||(r>n&&(t[n]=t[r]),++n);return t.length=n,t},r.makeAccessor=function(e){function t(t){return c.call(t,r)||function(t){var s;n(t,r,function(r,n){if(r===i)return n?s=null:s||(s=e(t))})}(t),t[r](i)}var r=a(),i=s(null);return e=e||function(e){return s(null)},t.forget=function(e){c.call(e,r)&&e[r](i,!0)},t}},{}],549:[function(e,t,r){(function(e){"use strict";!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports=function(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var s,a,o=arguments.length;switch(o){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,r)});case 3:return e.nextTick(function(){t.call(null,r,n)});case 4:return e.nextTick(function(){t.call(null,r,n,i)});default:for(s=new Array(o-1),a=0;a<s.length;)s[a++]=arguments[a];return e.nextTick(function(){t.apply(null,s)})}}:t.exports=e.nextTick}).call(this,e("_process"))},{_process:550}],550:[function(e,t,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(){m&&f&&(m=!1,f.length?d=f.concat(d):y=-1,d.length&&o())}function o(){if(!m){var e=s(a);m=!0;for(var t=d.length;t;){for(f=d,d=[];++y<t;)f&&f[y].run();y=-1,t=d.length}f=null,m=!1,function(e){if(p===clearTimeout)return clearTimeout(e);if((p===i||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}(e)}}function u(e,t){this.fun=e,this.array=t}function l(){}var c,p,h=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{p="function"==typeof clearTimeout?clearTimeout:i}catch(e){p=i}}();var f,d=[],m=!1,y=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];d.push(new u(e,t)),1!==d.length||m||s(o)},u.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.prependListener=l,h.prependOnceListener=l,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],551:[function(e,t,r){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":552}],552:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);l.call(this,e),c.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",i)}function i(){this.allowHalfOpen||this._writableState.ended||a(s,this)}function s(e){e.end()}var a=e("process-nextick-args"),o=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=n;var u=e("core-util-is");u.inherits=e("inherits");var l=e("./_stream_readable"),c=e("./_stream_writable");u.inherits(n,l);for(var p=o(c.prototype),h=0;h<p.length;h++){var f=p[h];n.prototype[f]||(n.prototype[f]=c.prototype[f])}Object.defineProperty(n.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),n.prototype._destroy=function(e,t){this.push(null),this.end(),a(t,e)}},{"./_stream_readable":554,"./_stream_writable":556,"core-util-is":310,inherits:317,"process-nextick-args":549}],553:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}t.exports=n;var i=e("./_stream_transform"),s=e("core-util-is");s.inherits=e("inherits"),s.inherits(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":555,"core-util-is":310,inherits:317}],554:[function(e,t,r){(function(r,n){"use strict";function i(t,r){E=E||e("./_stream_duplex"),t=t||{},this.objectMode=!!t.objectMode,r instanceof E&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new P,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(T||(T=e("string_decoder/").StringDecoder),this.decoder=new T(t.encoding),this.encoding=t.encoding)}function s(t){if(E=E||e("./_stream_duplex"),!(this instanceof s))return new s(t);this._readableState=new i(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),S.call(this)}function a(e,t,r,n,i){var s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,l(e)}(e,s);else{var a;i||(a=function(e,t){var r;(function(e){return C.isBuffer(e)||e instanceof _})(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(s,t)),a?e.emit("error",a):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===C.prototype||(t=function(e){return C.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):o(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?o(e,s,t,!1):p(e,s)):o(e,s,t,!1))):n||(s.reading=!1)}return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(s)}function o(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&l(e)),p(e,t)}function u(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=N?e=N:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(F("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(c,e):c(e))}function c(e){F("emit readable"),e.emit("readable"),m(e)}function p(e,t){t.readingMore||(t.readingMore=!0,x(h,e,t))}function h(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(F("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function f(e){F("readable nexttick read 0"),e.read(0)}function d(e,t){t.reading||(F("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),m(e),t.flowing&&!t.reading&&e.read(0)}function m(e){var t=e._readableState;for(F("flow",t.flowing);t.flowing&&null!==e.read(););}function y(e,t){if(0===t.length)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;e-=i.length;for(;r=r.next;){var s=r.data,a=e>s.length?s.length:e;if(a===s.length?i+=s:i+=s.slice(0,e),0===(e-=a)){a===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=C.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var s=n.data,a=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,a),0===(e-=a)){a===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r}function g(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,x(b,t,e))}function b(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function v(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}var x=e("process-nextick-args");t.exports=s;var E,A=e("isarray");s.ReadableState=i;e("events").EventEmitter;var D=function(e,t){return e.listeners(t).length},S=e("./internal/streams/stream"),C=e("safe-buffer").Buffer,_=n.Uint8Array||function(){},w=e("core-util-is");w.inherits=e("inherits");var k=e("util"),F=void 0;F=k&&k.debuglog?k.debuglog("stream"):function(){};var T,P=e("./internal/streams/BufferList"),B=e("./internal/streams/destroy");w.inherits(s,S);var O=["error","close","destroy","pause","resume"];Object.defineProperty(s.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),s.prototype.destroy=B.destroy,s.prototype._undestroy=B.undestroy,s.prototype._destroy=function(e,t){this.push(null),t(e)},s.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=C.from(e,t),t=""),r=!0),a(this,e,t,!1,r)},s.prototype.unshift=function(e){return a(this,e,null,!0,!1)},s.prototype.isPaused=function(){return!1===this._readableState.flowing},s.prototype.setEncoding=function(t){return T||(T=e("string_decoder/").StringDecoder),this._readableState.decoder=new T(t),this._readableState.encoding=t,this};var N=8388608;s.prototype.read=function(e){F("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return F("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?g(this):l(this),null;if(0===(e=u(e,t))&&t.ended)return 0===t.length&&g(this),null;var n=t.needReadable;F("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&F("length less than watermark",n=!0),t.ended||t.reading?F("reading or ended",n=!1):n&&(F("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=u(r,t)));var i;return null===(i=e>0?y(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&g(this)),null!==i&&this.emit("data",i),i},s.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},s.prototype.pipe=function(e,t){function n(t,r){F("onunpipe"),t===c&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,F("cleanup"),e.removeListener("close",o),e.removeListener("finish",u),e.removeListener("drain",f),e.removeListener("error",a),e.removeListener("unpipe",n),c.removeListener("end",i),c.removeListener("end",l),c.removeListener("data",s),d=!0,!p.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function i(){F("onend"),e.end()}function s(t){F("ondata"),y=!1;!1!==e.write(t)||y||((1===p.pipesCount&&p.pipes===e||p.pipesCount>1&&-1!==v(p.pipes,e))&&!d&&(F("false write response, pause",c._readableState.awaitDrain),c._readableState.awaitDrain++,y=!0),c.pause())}function a(t){F("onerror",t),l(),e.removeListener("error",a),0===D(e,"error")&&e.emit("error",t)}function o(){e.removeListener("finish",u),l()}function u(){F("onfinish"),e.removeListener("close",o),l()}function l(){F("unpipe"),c.unpipe(e)}var c=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=e;break;case 1:p.pipes=[p.pipes,e];break;default:p.pipes.push(e)}p.pipesCount+=1,F("pipe count=%d opts=%j",p.pipesCount,t);var h=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?i:l;p.endEmitted?x(h):c.once("end",h),e.on("unpipe",n);var f=function(e){return function(){var t=e._readableState;F("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&D(e,"data")&&(t.flowing=!0,m(e))}}(c);e.on("drain",f);var d=!1,y=!1;return c.on("data",s),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?A(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",a),e.once("close",o),e.once("finish",u),e.emit("pipe",c),p.flowing||(F("pipe resume"),c.resume()),e},s.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,r);return this}var a=v(t.pipes,e);return-1===a?this:(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)},s.prototype.on=function(e,t){var r=S.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&l(this):x(f,this))}return r},s.prototype.addListener=s.prototype.on,s.prototype.resume=function(){var e=this._readableState;return e.flowing||(F("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,x(d,e,t))}(this,e)),this},s.prototype.pause=function(){return F("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(F("pause"),this._readableState.flowing=!1,this.emit("pause")),this},s.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;e.on("end",function(){if(F("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)}),e.on("data",function(i){if(F("wrapped data"),t.decoder&&(i=t.decoder.write(i)),(!t.objectMode||null!==i&&void 0!==i)&&(t.objectMode||i&&i.length)){n.push(i)||(r=!0,e.pause())}});for(var i in e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<O.length;s++)e.on(O[s],n.emit.bind(n,O[s]));return n._read=function(t){F("wrapped _read",t),r&&(r=!1,e.resume())},n},s._fromList=y}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":552,"./internal/streams/BufferList":557,"./internal/streams/destroy":558,"./internal/streams/stream":559,_process:550,"core-util-is":310,events:313,inherits:317,isarray:321,"process-nextick-args":549,"safe-buffer":602,"string_decoder/":605,util:192}],555:[function(e,t,r){"use strict";function n(e){this.afterTransform=function(t,r){return function(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!==r&&void 0!==r&&e.push(r);i(t);var s=e._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&e._read(s.highWaterMark)}(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function i(e){if(!(this instanceof i))return new i(e);a.call(this,e),this._transformState=new n(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(e,r){s(t,e,r)}):s(t)})}function s(e,t,r){if(t)return e.emit("error",t);null!==r&&void 0!==r&&e.push(r);var n=e._writableState,i=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(i.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}t.exports=i;var a=e("./_stream_duplex"),o=e("core-util-is");o.inherits=e("inherits"),o.inherits(i,a),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,a.prototype.push.call(this,e,t)},i.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},i.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},i.prototype._destroy=function(e,t){var r=this;a.prototype._destroy.call(this,e,function(e){t(e),r.emit("close")})}},{"./_stream_duplex":552,"core-util-is":310,inherits:317}],556:[function(e,t,r){(function(r,n){"use strict";function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}function s(){}function a(t,r){y=y||e("./_stream_duplex"),t=t||{},this.objectMode=!!t.objectMode,r instanceof y&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:s,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(m(i,n),m(d,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),d(e,t))}(e,r,n,t,i);else{var s=h(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||p(e,r),n?g(c,e,r,s,i):c(e,r,s,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function o(t){if(y=y||e("./_stream_duplex"),!(S.call(o,this)||this instanceof y))return new o(t);this._writableState=new a(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),x.call(this)}function u(e,t,r,n,i,s){if(!r){var a=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=E.from(t,r)),t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var o=t.objectMode?1:n.length;t.length+=o;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else l(e,t,!1,o,n,i,s);return u}function l(e,t,r,n,i,s,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function c(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),d(e,t)}function p(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,s=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var o=0,u=!0;r;)s[o]=r,r.isBuf||(u=!1),r=r.next,o+=1;s.allBuffers=u,l(e,t,!0,t.length,s,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new i(t)}else{for(;r;){var c=r.chunk,p=r.encoding,h=r.callback;if(l(e,t,!1,t.objectMode?1:c.length,c,p,h),r=r.next,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=r,t.bufferProcessing=!1}function h(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function f(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),d(e,t)})}function d(e,t){var r=h(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,m(f,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}var m=e("process-nextick-args");t.exports=o;var y,g=!r.browser&&["v0.10","v0.9."].indexOf(r.version.slice(0,5))>-1?setImmediate:m;o.WritableState=a;var b=e("core-util-is");b.inherits=e("inherits");var v={deprecate:e("util-deprecate")},x=e("./internal/streams/stream"),E=e("safe-buffer").Buffer,A=n.Uint8Array||function(){},D=e("./internal/streams/destroy");b.inherits(o,x),a.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(a.prototype,"buffer",{get:v.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}();var S;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(S=Function.prototype[Symbol.hasInstance],Object.defineProperty(o,Symbol.hasInstance,{value:function(e){return!!S.call(this,e)||e&&e._writableState instanceof a}})):S=function(e){return e instanceof this},o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},o.prototype.write=function(e,t,r){var n=this._writableState,i=!1,a=function(e){return E.isBuffer(e)||e instanceof A}(e)&&!n.objectMode;return a&&!E.isBuffer(e)&&(e=function(e){return E.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=s),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),m(t,r)}(this,r):(a||function(e,t,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),m(n,s),i=!1),i}(this,n,e,r))&&(n.pendingcb++,i=u(this,n,a,e,t,r)),i},o.prototype.cork=function(){this._writableState.corked++},o.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||p(this,e))},o.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},o.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},o.prototype._writev=null,o.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,d(e,t),r&&(t.finished?m(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(o.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),o.prototype.destroy=D.destroy,o.prototype._undestroy=D.undestroy,o.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":552,"./internal/streams/destroy":558,"./internal/streams/stream":559,_process:550,"core-util-is":310,inherits:317,"process-nextick-args":549,"safe-buffer":602,"util-deprecate":610}],557:[function(e,t,r){"use strict";function n(e,t,r){e.copy(t,r)}var i=e("safe-buffer").Buffer;t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t=i.allocUnsafe(e>>>0),r=this.head,s=0;r;)n(r.data,t,s),s+=r.data.length,r=r.next;return t},e}()},{"safe-buffer":602}],558:[function(e,t,r){"use strict";function n(e,t){e.emit("error",t)}var i=e("process-nextick-args");t.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;s||a?t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i(n,this,e):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(i(n,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)}))},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":549}],559:[function(e,t,r){t.exports=e("events").EventEmitter},{events:313}],560:[function(e,t,r){t.exports=e("./readable").PassThrough},{"./readable":561}],561:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":552,"./lib/_stream_passthrough.js":553,"./lib/_stream_readable.js":554,"./lib/_stream_transform.js":555,"./lib/_stream_writable.js":556}],562:[function(e,t,r){t.exports=e("./readable").Transform},{"./readable":561}],563:[function(e,t,r){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":556}],564:[function(e,t,r){function n(e,t,r){if(e){if(g.fixFaultyLocations(e,t),r){if(p.Node.check(e)&&p.SourceLocation.check(e.loc)){for(var i=r.length-1;i>=0&&!(b(r[i].loc.end,e.loc.start)<=0);--i);return void r.splice(i+1,0,e)}}else if(e[v])return e[v];var s;if(h.check(e))s=Object.keys(e);else{if(!f.check(e))return;s=c.getFieldNames(e)}r||Object.defineProperty(e,v,{value:r=[],enumerable:!1});i=0;for(var a=s.length;i<a;++i)n(e[s[i]],t,r);return r}}function i(e,t,r){for(var s=n(e,r),a=0,o=s.length;a<o;){var u=a+o>>1,l=s[u];if(b(l.loc.start,t.loc.start)<=0&&b(t.loc.end,l.loc.end)<=0)return void i(t.enclosingNode=l,t,r);if(b(l.loc.end,t.loc.start)<=0){var c=l;a=u+1}else{if(!(b(t.loc.end,l.loc.start)<=0))throw new Error("Comment location overlaps with node location");var p=l;o=u}}c&&(t.precedingNode=c),p&&(t.followingNode=p)}function s(e,t){var r=e.length;if(0!==r){for(var n=e[0].precedingNode,i=e[0].followingNode,s=i.loc.start,a=r;a>0;--a){var c=e[a-1];l.strictEqual(c.precedingNode,n),l.strictEqual(c.followingNode,i);var p=t.sliceString(c.loc.end,s);if(/\S/.test(p))break;s=c.loc.start}for(;a<=r&&(c=e[a])&&("Line"===c.type||"CommentLine"===c.type)&&c.loc.start.column>i.loc.start.column;)++a;e.forEach(function(e,t){t<a?u(n,e):o(i,e)}),e.length=0}}function a(e,t){(e.comments||(e.comments=[])).push(t)}function o(e,t){t.leading=!0,t.trailing=!1,a(e,t)}function u(e,t){t.leading=!1,t.trailing=!0,a(e,t)}var l=e("assert"),c=e("./types"),p=c.namedTypes,h=c.builtInTypes.array,f=c.builtInTypes.object,d=e("./lines"),m=(d.fromString,d.Lines),y=d.concat,g=e("./util"),b=g.comparePos,v=e("private").makeUniqueKey();r.attach=function(e,t,r){if(h.check(e)){var n=[];e.forEach(function(e){e.loc.lines=r,i(t,e,r);var c=e.precedingNode,p=e.enclosingNode,h=e.followingNode;if(c&&h){var f=n.length;if(f>0){var d=n[f-1];l.strictEqual(d.precedingNode===e.precedingNode,d.followingNode===e.followingNode),d.followingNode!==e.followingNode&&s(n,r)}n.push(e)}else if(c)s(n,r),u(c,e);else if(h)s(n,r),o(h,e);else{if(!p)throw new Error("AST contains no nodes at all?");s(n,r),function(e,t){t.leading=!1,t.trailing=!1,a(e,t)}(p,e)}}),s(n,r),e.forEach(function(e){delete e.precedingNode,delete e.enclosingNode,delete e.followingNode})}},r.printComments=function(e,t){var r=e.getValue(),n=t(e),i=p.Node.check(r)&&c.getFieldValue(r,"comments");if(!i||0===i.length)return n;var s=[],a=[n];return e.each(function(e){var n=e.getValue(),i=c.getFieldValue(n,"leading"),o=c.getFieldValue(n,"trailing");i||o&&!p.Statement.check(r)&&"Block"!==n.type&&"CommentBlock"!==n.type?s.push(function(e,t){var r=e.getValue();p.Comment.assert(r);var n=r.loc,i=n&&n.lines,s=[t(e)];if(r.trailing)s.push("\n");else if(i instanceof m){var a=i.slice(n.end,i.skipSpaces(n.end));1===a.length?s.push(a):s.push(new Array(a.length).join("\n"))}else s.push("\n");return y(s)}(e,t)):o&&a.push(function(e,t){var r=e.getValue(e);p.Comment.assert(r);var n=r.loc,i=n&&n.lines,s=[];if(i instanceof m){var a=i.skipSpaces(n.start,!0)||i.firstPos(),o=i.slice(a,n.start);1===o.length?s.push(o):s.push(new Array(o.length).join("\n"))}return s.push(t(e)),y(s)}(e,t))},"comments"),s.push.apply(s,a),y(s)}},{"./lines":566,"./types":572,"./util":573,assert:1,private:548}],565:[function(e,t,r){function n(e){o.ok(this instanceof n),this.stack=[e]}function i(e,t){for(var r=e.stack,n=r.length-1;n>=0;n-=2){var i=r[n];if(l.Node.check(i)&&--t<0)return i}return null}function s(e){return l.BinaryExpression.check(e)||l.LogicalExpression.check(e)}function a(e){return!!l.CallExpression.check(e)||(c.check(e)?e.some(a):!!l.Node.check(e)&&u.someField(e,function(e,t){return a(t)}))}var o=e("assert"),u=e("./types"),l=u.namedTypes,c=(l.Node,u.builtInTypes.array),p=u.builtInTypes.number,h=n.prototype;t.exports=n,n.from=function(e){if(e instanceof n)return e.copy();if(e instanceof u.NodePath){for(var t,r=Object.create(n.prototype),i=[e.value];t=e.parentPath;e=t)i.push(e.name,t.value);return r.stack=i.reverse(),r}return new n(e)},h.copy=function(){var e=Object.create(n.prototype);return e.stack=this.stack.slice(0),e},h.getName=function(){var e=this.stack,t=e.length;return t>1?e[t-2]:null},h.getValue=function(){var e=this.stack;return e[e.length-1]},h.getNode=function(e){return i(this,~~e)},h.getParentNode=function(e){return i(this,1+~~e)},h.getRootValue=function(){var e=this.stack;return e.length%2==0?e[1]:e[0]},h.call=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,s=1;s<i;++s){var a=arguments[s];n=n[a],t.push(a,n)}var o=e(this);return t.length=r,o},h.each=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,s=1;s<i;++s){var a=arguments[s];n=n[a],t.push(a,n)}for(s=0;s<n.length;++s)s in n&&(t.push(s,n[s]),e(this),t.length-=2);t.length=r},h.map=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,s=1;s<i;++s){var a=arguments[s];n=n[a],t.push(a,n)}var o=new Array(n.length);for(s=0;s<n.length;++s)s in n&&(t.push(s,n[s]),o[s]=e(this,s),t.length-=2);return t.length=r,o},h.needsParens=function(e){var t=this.getParentNode();if(!t)return!1;var r=this.getName(),n=this.getNode();if(this.getValue()!==n)return!1;if(l.Statement.check(n))return!1;if("Identifier"===n.type)return!1;if("ParenthesizedExpression"===t.type)return!1;switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===t.type&&"object"===r&&t.object===n;case"BinaryExpression":case"LogicalExpression":switch(t.type){case"CallExpression":return"callee"===r&&t.callee===n;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===r&&t.object===n;case"BinaryExpression":case"LogicalExpression":var i=t.operator,u=f[i],c=n.operator,h=f[c];if(u>h)return!0;if(u===h&&"right"===r)return o.strictEqual(t.right,n),!0;default:return!1}case"SequenceExpression":switch(t.type){case"ReturnStatement":case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==r;default:return!0}case"YieldExpression":switch(t.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"IntersectionTypeAnnotation":case"UnionTypeAnnotation":return"NullableTypeAnnotation"===t.type;case"Literal":return"MemberExpression"===t.type&&p.check(n.value)&&"object"===r&&t.object===n;case"AssignmentExpression":case"ConditionalExpression":switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===r&&t.callee===n;case"ConditionalExpression":return"test"===r&&t.test===n;case"MemberExpression":return"object"===r&&t.object===n;default:return!1}case"ArrowFunctionExpression":return!(!l.CallExpression.check(t)||"callee"!==r)||(!(!l.MemberExpression.check(t)||"object"!==r)||s(t));case"ObjectExpression":if("ArrowFunctionExpression"===t.type&&"body"===r)return!0;default:if("NewExpression"===t.type&&"callee"===r&&t.callee===n)return a(n)}return!(!0===e||this.canBeFirstInStatement()||!this.firstInStatement())};var f={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%","**"]].forEach(function(e,t){e.forEach(function(e){f[e]=t})}),h.canBeFirstInStatement=function(){var e=this.getNode();return!l.FunctionExpression.check(e)&&!l.ObjectExpression.check(e)},h.firstInStatement=function(){for(var e,t,r,n,i=this.stack,a=i.length-1;a>=0;a-=2)if(l.Node.check(i[a])&&(r=e,n=t,e=i[a-1],t=i[a]),t&&n){if(l.BlockStatement.check(t)&&"body"===e&&0===r)return o.strictEqual(t.body[0],n),!0;if(l.ExpressionStatement.check(t)&&"expression"===r)return o.strictEqual(t.expression,n),!0;if(l.SequenceExpression.check(t)&&"expressions"===e&&0===r)o.strictEqual(t.expressions[0],n);else if(l.CallExpression.check(t)&&"callee"===r)o.strictEqual(t.callee,n);else if(l.MemberExpression.check(t)&&"object"===r)o.strictEqual(t.object,n);else if(l.ConditionalExpression.check(t)&&"test"===r)o.strictEqual(t.test,n);else if(s(t)&&"left"===r)o.strictEqual(t.left,n);else{if(!l.UnaryExpression.check(t)||t.prefix||"argument"!==r)return!1;o.strictEqual(t.argument,n)}}return!0}},{"./types":572,assert:1}],566:[function(e,t,r){function n(e){return e[f]}function i(e,t){c.ok(this instanceof i),c.ok(e.length>0),t?d.assert(t):t=null,Object.defineProperty(this,f,{value:{infos:e,mappings:[],name:t,cachedSourceMap:null}}),t&&n(this).mappings.push(new y(this,{start:this.firstPos(),end:this.lastPos()}))}function s(e){return{line:e.line,indent:e.indent,locked:e.locked,sliceStart:e.sliceStart,sliceEnd:e.sliceEnd}}function a(e,t){for(var r=0,n=e.length,i=0;i<n;++i)switch(e.charCodeAt(i)){case 9:c.strictEqual(typeof t,"number"),c.ok(t>0);var s=Math.ceil(r/t)*t;s===r?r+=t:r=s;break;case 11:case 12:case 13:case 65279:break;case 32:default:r+=1}return r}function o(e,t){if(e instanceof i)return e;e+="";var r=t&&t.tabWidth,n=e.indexOf("\t")<0,s=!(!t||!t.locked),o=!t&&n&&e.length<=x;if(c.ok(r||n,"No tab width specified but encountered tabs in string\n"+e),o&&v.call(b,e))return b[e];var u=new i(e.split(A).map(function(e){var t=E.exec(e)[0];return{line:e,indent:a(t,r),locked:s,sliceStart:t.length,sliceEnd:e.length}}),h(t).sourceFileName);return o&&(b[e]=u),u}function u(e){return!/\S/.test(e)}function l(e,t,r){var n=e.sliceStart,i=e.sliceEnd,s=Math.max(e.indent,0),a=s+i-n;return void 0===r&&(r=a),t=Math.max(t,0),r=Math.min(r,a),(r=Math.max(r,t))<s?(s=r,i=n):i-=a-r,a=r,a-=t,t<s?s-=t:(t-=s,s=0,n+=t),c.ok(s>=0),c.ok(n<=i),c.strictEqual(a,s+i-n),e.indent===s&&e.sliceStart===n&&e.sliceEnd===i?e:{line:e.line,indent:s,locked:!1,sliceStart:n,sliceEnd:i}}var c=e("assert"),p=e("source-map"),h=e("./options").normalize,f=e("private").makeUniqueKey(),d=e("./types").builtInTypes.string,m=e("./util").comparePos,y=e("./mapping");r.Lines=i;var g=i.prototype;Object.defineProperties(g,{length:{get:function(){return n(this).infos.length}},name:{get:function(){return n(this).name}}});var b={},v=b.hasOwnProperty,x=10;r.countSpaces=a;var E=/^\s*/,A=/\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/;r.fromString=o,g.toString=function(e){return this.sliceString(this.firstPos(),this.lastPos(),e)},g.getSourceMap=function(e,t){function r(r){return r=r||{},d.assert(e),r.file=e,t&&(d.assert(t),r.sourceRoot=t),r}if(!e)return null;var i=this,s=n(i);if(s.cachedSourceMap)return r(s.cachedSourceMap.toJSON());var a=new p.SourceMapGenerator(r()),o={};return s.mappings.forEach(function(e){for(var t=e.sourceLines.skipSpaces(e.sourceLoc.start)||e.sourceLines.lastPos(),r=i.skipSpaces(e.targetLoc.start)||i.lastPos();m(t,e.sourceLoc.end)<0&&m(r,e.targetLoc.end)<0;){var n=e.sourceLines.charAt(t),s=i.charAt(r);c.strictEqual(n,s);var u=e.sourceLines.name;if(a.addMapping({source:u,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column}}),!v.call(o,u)){var l=e.sourceLines.toString();a.setSourceContent(u,l),o[u]=l}i.nextPos(r,!0),e.sourceLines.nextPos(t,!0)}}),s.cachedSourceMap=a,a.toJSON()},g.bootstrapCharAt=function(e){c.strictEqual(typeof e,"object"),c.strictEqual(typeof e.line,"number"),c.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,n=this.toString().split(A),i=n[t-1];return void 0===i?"":r===i.length&&t<n.length?"\n":r>=i.length?"":i.charAt(r)},g.charAt=function(e){c.strictEqual(typeof e,"object"),c.strictEqual(typeof e.line,"number"),c.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,i=n(this).infos[t-1],s=r;if(void 0===i||s<0)return"";var a=this.getIndentAt(t);return s<a?" ":(s+=i.sliceStart-a)===i.sliceEnd&&t<this.length?"\n":s>=i.sliceEnd?"":i.line.charAt(s)},g.stripMargin=function(e,t){if(0===e)return this;if(c.ok(e>0,"negative margin: "+e),t&&1===this.length)return this;var r=n(this),a=new i(r.infos.map(function(r,n){return r.line&&(n>0||!t)&&((r=s(r)).indent=Math.max(0,r.indent-e)),r}));if(r.mappings.length>0){var o=n(a).mappings;c.strictEqual(o.length,0),r.mappings.forEach(function(r){o.push(r.indent(e,t,!0))})}return a},g.indent=function(e){if(0===e)return this;var t=n(this),r=new i(t.infos.map(function(t){return t.line&&!t.locked&&((t=s(t)).indent+=e),t}));if(t.mappings.length>0){var a=n(r).mappings;c.strictEqual(a.length,0),t.mappings.forEach(function(t){a.push(t.indent(e))})}return r},g.indentTail=function(e){if(0===e)return this;if(this.length<2)return this;var t=n(this),r=new i(t.infos.map(function(t,r){return r>0&&t.line&&!t.locked&&((t=s(t)).indent+=e),t}));if(t.mappings.length>0){var a=n(r).mappings;c.strictEqual(a.length,0),t.mappings.forEach(function(t){a.push(t.indent(e,!0))})}return r},g.lockIndentTail=function(){if(this.length<2)return this;return new i(n(this).infos.map(function(e,t){return e=s(e),e.locked=t>0,e}))},g.getIndentAt=function(e){c.ok(e>=1,"no line "+e+" (line numbers start from 1)");var t=n(this).infos[e-1];return Math.max(t.indent,0)},g.guessTabWidth=function(){var e=n(this);if(v.call(e,"cachedTabWidth"))return e.cachedTabWidth;for(var t=[],r=0,i=1,s=this.length;i<=s;++i){var a=e.infos[i-1];if(!u(a.line.slice(a.sliceStart,a.sliceEnd))){var o=Math.abs(a.indent-r);t[o]=1+~~t[o],r=a.indent}}for(var l=-1,c=2,p=1;p<t.length;p+=1)v.call(t,p)&&t[p]>l&&(l=t[p],c=p);return e.cachedTabWidth=c},g.startsWithComment=function(){var e=n(this);if(0===e.infos.length)return!1;var t=e.infos[0],r=t.sliceStart,i=t.sliceEnd,s=t.line.slice(r,i).trim();return 0===s.length||"//"===s.slice(0,2)||"/*"===s.slice(0,2)},g.isOnlyWhitespace=function(){return u(this.toString())},g.isPrecededOnlyByWhitespace=function(e){var t=n(this).infos[e.line-1],r=Math.max(t.indent,0),i=e.column-r;if(i<=0)return!0;var s=t.sliceStart,a=Math.min(s+i,t.sliceEnd);return u(t.line.slice(s,a))},g.getLineLength=function(e){var t=n(this).infos[e-1];return this.getIndentAt(e)+t.sliceEnd-t.sliceStart},g.nextPos=function(e,t){var r=Math.max(e.line,0);return Math.max(e.column,0)<this.getLineLength(r)?(e.column+=1,!t||!!this.skipSpaces(e,!1,!0)):r<this.length&&(e.line+=1,e.column=0,!t||!!this.skipSpaces(e,!1,!0))},g.prevPos=function(e,t){var r=e.line,n=e.column;if(n<1){if((r-=1)<1)return!1;n=this.getLineLength(r)}else n=Math.min(n-1,this.getLineLength(r));return e.line=r,e.column=n,!t||!!this.skipSpaces(e,!0,!0)},g.firstPos=function(){return{line:1,column:0}},g.lastPos=function(){return{line:this.length,column:this.getLineLength(this.length)}},g.skipSpaces=function(e,t,r){if(e=e?r?e:{line:e.line,column:e.column}:t?this.lastPos():this.firstPos(),t){for(;this.prevPos(e);)if(!u(this.charAt(e))&&this.nextPos(e))return e;return null}for(;u(this.charAt(e));)if(!this.nextPos(e))return null;return e},g.trimLeft=function(){var e=this.skipSpaces(this.firstPos(),!1,!0);return e?this.slice(e):D},g.trimRight=function(){var e=this.skipSpaces(this.lastPos(),!0,!0);return e?this.slice(this.firstPos(),e):D},g.trim=function(){var e=this.skipSpaces(this.firstPos(),!1,!0);if(null===e)return D;var t=this.skipSpaces(this.lastPos(),!0,!0);return c.notStrictEqual(t,null),this.slice(e,t)},g.eachPos=function(e,t,r){var n=this.firstPos();if(t&&(n.line=t.line,n.column=t.column),!r||this.skipSpaces(n,!1,!0))do{e.call(this,n)}while(this.nextPos(n,r))},g.bootstrapSlice=function(e,t){var r=this.toString().split(A).slice(e.line-1,t.line);return r.push(r.pop().slice(0,t.column)),r[0]=r[0].slice(e.column),o(r.join("\n"))},g.slice=function(e,t){if(!t){if(!e)return this;t=this.lastPos()}var r=n(this),s=r.infos.slice(e.line-1,t.line);e.line===t.line?s[0]=l(s[0],e.column,t.column):(c.ok(e.line<t.line),s[0]=l(s[0],e.column),s.push(l(s.pop(),0,t.column)));var a=new i(s);if(r.mappings.length>0){var o=n(a).mappings;c.strictEqual(o.length,0),r.mappings.forEach(function(r){var n=r.slice(this,e,t);n&&o.push(n)},this)}return a},g.bootstrapSliceString=function(e,t,r){return this.slice(e,t).toString(r)},g.sliceString=function(e,t,r){if(!t){if(!e)return this;t=this.lastPos()}r=h(r);for(var i=n(this).infos,s=[],o=r.tabWidth,c=e.line;c<=t.line;++c){var p=i[c-1];c===e.line?p=c===t.line?l(p,e.column,t.column):l(p,e.column):c===t.line&&(p=l(p,0,t.column));var f=Math.max(p.indent,0),d=p.line.slice(0,p.sliceStart);if(r.reuseWhitespace&&u(d)&&a(d,r.tabWidth)===f)s.push(p.line.slice(0,p.sliceEnd));else{var m=0,y=f;r.useTabs&&(y-=(m=Math.floor(f/o))*o);var g="";m>0&&(g+=new Array(m+1).join("\t")),y>0&&(g+=new Array(y+1).join(" ")),g+=p.line.slice(p.sliceStart,p.sliceEnd),s.push(g)}}return s.join(r.lineTerminator)},g.isEmpty=function(){return this.length<2&&this.getLineLength(1)<1},g.join=function(e){function t(e){if(null!==e){if(r){var t=e.infos[0],n=new Array(t.indent+1).join(" "),i=u.length,a=Math.max(r.indent,0)+r.sliceEnd-r.sliceStart;r.line=r.line.slice(0,r.sliceEnd)+n+t.line.slice(t.sliceStart,t.sliceEnd),r.locked=r.locked||t.locked,r.sliceEnd=r.line.length,e.mappings.length>0&&e.mappings.forEach(function(e){l.push(e.add(i,a))})}else e.mappings.length>0&&l.push.apply(l,e.mappings);e.infos.forEach(function(e,t){(!r||t>0)&&(r=s(e),u.push(r))})}}var r,a=n(this),u=[],l=[];if(e.map(function(e){var t=o(e);return t.isEmpty()?null:n(t)}).forEach(this.isEmpty()?t:function(e,r){r>0&&t(a),t(e)}),u.length<1)return D;var c=new i(u);return n(c).mappings=l,c},r.concat=function(e){return D.join(e)},g.concat=function(e){var t=arguments,r=[this];return r.push.apply(r,t),c.strictEqual(r.length,t.length+1),D.join(r)};var D=o("")},{"./mapping":567,"./options":568,"./types":572,"./util":573,assert:1,private:548,"source-map":586}],567:[function(e,t,r){function n(e,t,r){a.ok(this instanceof n),a.ok(e instanceof p.Lines),l.assert(t),r?a.ok(u.check(r.start.line)&&u.check(r.start.column)&&u.check(r.end.line)&&u.check(r.end.column)):r=t,Object.defineProperties(this,{sourceLines:{value:e},sourceLoc:{value:t},targetLoc:{value:r}})}function i(e,t,r){return{line:e.line+t-1,column:1===e.line?e.column+r:e.column}}function s(e,t,r){return{line:e.line-t+1,column:e.line===t?e.column-r:e.column}}var a=e("assert"),o=e("./types"),u=(o.builtInTypes.string,o.builtInTypes.number),l=o.namedTypes.SourceLocation,c=o.namedTypes.Position,p=e("./lines"),h=e("./util").comparePos,f=n.prototype;t.exports=n,f.slice=function(e,t,r){function i(n){var i=u[n],s=l[n],f=t;return"end"===n?f=r:a.strictEqual(n,"start"),function(e,t,r,n,i){a.ok(e instanceof p.Lines),a.ok(r instanceof p.Lines),c.assert(t),c.assert(n),c.assert(i);var s=h(n,i);if(0===s)return t;if(s<0){var o=e.skipSpaces(t),u=r.skipSpaces(n),l=i.line-u.line;for(o.line+=l,u.line+=l,l>0?(o.column=0,u.column=0):a.strictEqual(l,0);h(u,i)<0&&r.nextPos(u,!0);)a.ok(e.nextPos(o,!0)),a.strictEqual(e.charAt(o),r.charAt(u))}else for(o=e.skipSpaces(t,!0),u=r.skipSpaces(n,!0),l=i.line-u.line,o.line+=l,u.line+=l,l<0?(o.column=e.getLineLength(o.line),u.column=r.getLineLength(u.line)):a.strictEqual(l,0);h(i,u)<0&&r.prevPos(u,!0);)a.ok(e.prevPos(o,!0)),a.strictEqual(e.charAt(o),r.charAt(u));return o}(o,i,e,s,f)}a.ok(e instanceof p.Lines),c.assert(t),r?c.assert(r):r=e.lastPos();var o=this.sourceLines,u=this.sourceLoc,l=this.targetLoc;if(h(t,l.start)<=0)if(h(l.end,r)<=0)l={start:s(l.start,t.line,t.column),end:s(l.end,t.line,t.column)};else{if(h(r,l.start)<=0)return null;u={start:u.start,end:i("end")},l={start:s(l.start,t.line,t.column),end:s(r,t.line,t.column)}}else{if(h(l.end,t)<=0)return null;h(l.end,r)<=0?(u={start:i("start"),end:u.end},l={start:{line:1,column:0},end:s(l.end,t.line,t.column)}):(u={start:i("start"),end:i("end")},l={start:{line:1,column:0},end:s(r,t.line,t.column)})}return new n(this.sourceLines,u,l)},f.add=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:i(this.targetLoc.start,e,t),end:i(this.targetLoc.end,e,t)})},f.subtract=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:s(this.targetLoc.start,e,t),end:s(this.targetLoc.end,e,t)})},f.indent=function(e,t,r){if(0===e)return this;var i=this.targetLoc,s=i.start.line,a=i.end.line;if(t&&1===s&&1===a)return this;if(i={start:i.start,end:i.end},!t||s>1){var o=i.start.column+e;i.start={line:s,column:r?Math.max(0,o):o}}if(!t||a>1){var u=i.end.column+e;i.end={line:a,column:r?Math.max(0,u):u}}return new n(this.sourceLines,this.sourceLoc,i)}},{"./lines":566,"./types":572,"./util":573,assert:1}],568:[function(e,t,r){var n={parser:e("esprima"),tabWidth:4,useTabs:!1,reuseWhitespace:!0,lineTerminator:e("os").EOL,wrapColumn:74,sourceFileName:null,sourceMapName:null,sourceRoot:null,inputSourceMap:null,range:!1,tolerant:!0,quote:null,trailingComma:!1,arrayBracketSpacing:!1,objectCurlySpacing:!0,arrowParensAlways:!1,flowObjectCommas:!0},i=n.hasOwnProperty;r.normalize=function(e){function t(t){return i.call(e,t)?e[t]:n[t]}return e=e||n,{tabWidth:+t("tabWidth"),useTabs:!!t("useTabs"),reuseWhitespace:!!t("reuseWhitespace"),lineTerminator:t("lineTerminator"),wrapColumn:Math.max(t("wrapColumn"),0),sourceFileName:t("sourceFileName"),sourceMapName:t("sourceMapName"),sourceRoot:t("sourceRoot"),inputSourceMap:t("inputSourceMap"),parser:t("esprima")||t("parser"),range:t("range"),tolerant:t("tolerant"),quote:t("quote"),trailingComma:t("trailingComma"),arrayBracketSpacing:t("arrayBracketSpacing"),objectCurlySpacing:t("objectCurlySpacing"),arrowParensAlways:t("arrowParensAlways"),flowObjectCommas:t("flowObjectCommas")}}},{esprima:575,os:545}],569:[function(e,t,r){function n(e){i.ok(this instanceof n),this.lines=e,this.indent=0}var i=e("assert"),s=e("./types"),a=(s.namedTypes,s.builders),o=s.builtInTypes.object,u=s.builtInTypes.array,l=(s.builtInTypes.function,e("./patcher").Patcher,e("./options").normalize),c=e("./lines").fromString,p=e("./comments").attach,h=e("./util");r.parse=function(e,t){t=l(t);var r=c(e,t),i=r.toString({tabWidth:t.tabWidth,reuseWhitespace:!1,useTabs:!1}),s=[],o=t.parser.parse(i,{jsx:!0,loc:!0,locations:!0,range:t.range,comment:!0,onComment:s,tolerant:t.tolerant,ecmaVersion:6,sourceType:"module"});h.fixFaultyLocations(o,r),o.loc=o.loc||{start:r.firstPos(),end:r.lastPos()},o.loc.lines=r,o.loc.indent=0;var u=h.getTrueLoc(o,r);o.loc.start=u.start,o.loc.end=u.end,o.comments&&(s=o.comments,delete o.comments);if("Program"===(f=o).type){var f;(f=a.file(o,t.sourceFileName||null)).loc={lines:r,indent:0,start:r.firstPos(),end:r.lastPos()}}else"File"===f.type&&(o=f.program);return p(s,o.body.length?f.program:f,r),new n(r).copy(f)};n.prototype.copy=function(e){if(u.check(e))return e.map(this.copy,this);if(!o.check(e))return e;h.fixFaultyLocations(e,this.lines);var t=Object.create(Object.getPrototypeOf(e),{original:{value:e,configurable:!1,enumerable:!1,writable:!0}}),r=e.loc,n=this.indent,i=n;r&&(("Block"===e.type||"Line"===e.type||"CommentBlock"===e.type||"CommentLine"===e.type||this.lines.isPrecededOnlyByWhitespace(r.start))&&(i=this.indent=r.start.column),r.lines=this.lines,r.indent=i);for(var s=Object.keys(e),a=s.length,l=0;l<a;++l){var c=s[l];"loc"===c?t[c]=e[c]:"tokens"===c&&"File"===e.type?t[c]=e[c]:t[c]=this.copy(e[c])}return this.indent=n,t}},{"./comments":564,"./lines":566,"./options":568,"./patcher":570,"./types":572,"./util":573,assert:1}],570:[function(e,t,r){function n(e){c.ok(this instanceof n),c.ok(e instanceof p.Lines);var t=[];this.replace=function(e,r){A.check(r)&&(r=p.fromString(r)),t.push({lines:r,start:e.start,end:e.end})},this.get=function(r){function n(t,r){c.ok(b(t,r)<=0),s.push(e.slice(t,r))}var i=(r=r||{start:{line:1,column:0},end:{line:e.length,column:e.getLineLength(e.length)}}).start,s=[];return t.sort(function(e,t){return b(e.start,t.start)}).forEach(function(e){b(i,e.start)>0||(n(i,e.start),s.push(e.lines),i=e.end)}),n(i,r.end),p.concat(s)}}function i(e){var t=[];return e.comments&&e.comments.length>0&&e.comments.forEach(function(e){(e.leading||e.trailing)&&t.push(e)}),t}function s(e,t,r){var n=e.getValue();return n===t.getValue()||(E.check(n)?a(e,t,r):!!x.check(n)&&function(e,t,r){var n=e.getValue();if(x.assert(n),null===n.original)return!1;var i=t.getValue();if(!x.check(i))return!1;if(f.check(n)){if(!f.check(i))return!1;if(n.type===i.type){var s=[];if(l(e,t,s))r.push.apply(r,s);else{if(!i.loc)return!1;r.push({oldPath:t.copy(),newPath:e.copy()})}return!0}return!!(d.check(n)&&d.check(i)&&i.loc)&&(r.push({oldPath:t.copy(),newPath:e.copy()}),!0)}return l(e,t,r)}(e,t,r))}function a(e,t,r){var n=e.getValue(),i=t.getValue();E.assert(n);var a=n.length;if(!E.check(i)||i.length!==a)return!1;for(var o=0;o<a;++o){e.stack.push(o,n[o]),t.stack.push(o,i[o]);var u=s(e,t,r);if(e.stack.length-=2,t.stack.length-=2,!u)return!1}return!0}function o(e){var t=e.getValue().loc,r=t&&t.lines;if(r){var n=C;for(n.line=t.start.line,n.column=t.start.column;r.prevPos(n);){var i=r.charAt(n);if("("===i)return b(e.getRootValue().loc.start,n)<=0;if(_.test(i))return!1}}return!1}function u(e){return o(e)&&function(e){var t=e.getValue().loc,r=t&&t.lines;if(r){var n=C;n.line=t.end.line,n.column=t.end.column;do{var i=r.charAt(n);if(")"===i)return b(n,e.getRootValue().loc.end)<=0;if(_.test(i))return!1}while(r.nextPos(n))}return!1}(e)}function l(e,t,r){var n=e.getValue(),i=t.getValue();if(x.assert(n),x.assert(i),null===n.original)return!1;if(!e.canBeFirstInStatement()&&e.firstInStatement()&&!o(t))return!1;if(e.needsParens(!0)&&!u(t))return!1;var a=g.getUnionOfKeys(i,n);"File"!==i.type&&"File"!==n.type||delete a.tokens,delete a.loc;var l=r.length;for(var c in a){e.stack.push(c,h.getFieldValue(n,c)),t.stack.push(c,h.getFieldValue(i,c));var p=s(e,t,r);if(e.stack.length-=2,t.stack.length-=2,!p)return!1}return!(m.check(e.getNode())&&r.length>l)}var c=e("assert"),p=e("./lines"),h=e("./types"),f=(h.getFieldValue,h.namedTypes.Printable),d=h.namedTypes.Expression,m=h.namedTypes.ReturnStatement,y=h.namedTypes.SourceLocation,g=e("./util"),b=g.comparePos,v=e("./fast-path"),x=h.builtInTypes.object,E=h.builtInTypes.array,A=h.builtInTypes.string,D=/[0-9a-z_$]/i;r.Patcher=n;var S=n.prototype;S.tryToReprintComments=function(e,t,r){var n=this;if(!e.comments&&!t.comments)return!0;var s=v.from(e),o=v.from(t);s.stack.push("comments",i(e)),o.stack.push("comments",i(t));var u=[],l=a(s,o,u);return l&&u.length>0&&u.forEach(function(e){var t=e.oldPath.getValue();c.ok(t.leading||t.trailing),n.replace(t.loc,r(e.newPath).indentTail(t.loc.indent))}),l},S.deleteComments=function(e){if(e.comments){var t=this;e.comments.forEach(function(r){r.leading?t.replace({start:r.loc.start,end:e.loc.lines.skipSpaces(r.loc.end,!1,!1)},""):r.trailing&&t.replace({start:e.loc.lines.skipSpaces(r.loc.start,!0,!1),end:r.loc.end},"")})}},r.getReprinter=function(e){c.ok(e instanceof v);var t=e.getValue();if(f.check(t)){var r=t.original,i=r&&r.loc,s=i&&i.lines,a=[];if(s&&function(e,t){var r=e.getValue();f.assert(r);var n=r.original;if(f.assert(n),c.deepEqual(t,[]),r.type!==n.type)return!1;var i=l(e,new v(n),t);return i||(t.length=0),i}(e,a))return function(e){var t=new n(s);return a.forEach(function(r){var n=r.newPath.getValue(),i=r.oldPath.getValue();y.assert(i.loc,!0);var a=!t.tryToReprintComments(n,i,e);a&&t.deleteComments(i);var o=e(r.newPath,a).indentTail(i.loc.indent),u=function(e,t,r){var n=g.copyPos(t.start),i=e.prevPos(n)&&e.charAt(n),s=r.charAt(r.firstPos());return i&&D.test(i)&&s&&D.test(s)}(s,i.loc,o),l=function(e,t,r){var n=e.charAt(t.end),i=r.lastPos(),s=r.prevPos(i)&&r.charAt(i);return s&&D.test(s)&&n&&D.test(n)}(s,i.loc,o);if(u||l){var c=[];u&&c.push(" "),c.push(o),l&&c.push(" "),o=p.concat(c)}t.replace(i.loc,o)}),t.get(i).indentTail(-r.loc.indent)}}};var C={line:1,column:0},_=/\S/},{"./fast-path":565,"./lines":566,"./types":572,"./util":573,assert:1}],571:[function(e,t,r){function n(e,t){v.ok(this instanceof n),k.assert(e),this.code=e,t&&(F.assert(t),this.map=t)}function i(e){function t(e){return v.ok(e instanceof T),x(e,r)}function r(e,r){if(r)return t(e);if(v.ok(e instanceof T),!l){var n=c.tabWidth,i=e.getNode().loc;if(i&&i.lines&&i.lines.guessTabWidth){c.tabWidth=i.lines.guessTabWidth();var s=a(e);return c.tabWidth=n,s}}return a(e)}function a(e){var t=C(e);return t?function(e,t){return e.needsParens()?D(["(",t,")"]):t}(e,t(r)):o(e)}function o(e,r){return r?x(e,o):s(e,c,t)}function u(e){return s(e,c,u)}v.ok(this instanceof i);var l=e&&e.tabWidth,c=S(e);v.notStrictEqual(c,e),c.sourceFileName=null,this.print=function(e){if(!e)return O;var t=r(T.from(e),!0);return new n(t.toString(c),P.composeSourceMaps(c.inputSourceMap,t.getSourceMap(c.sourceMapName,c.sourceRoot)))},this.printGenerically=function(e){if(!e)return O;var t=T.from(e),r=c.reuseWhitespace;c.reuseWhitespace=!1;var i=new n(u(t).toString(c));return c.reuseWhitespace=r,i}}function s(e,t,r){v.ok(e instanceof T);var n=e.getValue(),i=[],s=!1,m=function(e,t,r){var n=e.getValue();if(!n)return A("");if("string"==typeof n)return A(n,t);w.Printable.assert(n);var i=[];switch(n.type){case"File":return e.call(r,"program");case"Program":return n.directives&&e.each(function(e){i.push(r(e),";\n")},"directives"),i.push(e.call(function(e){return a(e,t,r)},"body")),D(i);case"Noop":case"EmptyStatement":return A("");case"ExpressionStatement":return D([e.call(r,"expression"),";"]);case"ParenthesizedExpression":return D(["(",e.call(r,"expression"),")"]);case"BinaryExpression":case"LogicalExpression":case"AssignmentExpression":return A(" ").join([e.call(r,"left"),n.operator,e.call(r,"right")]);case"AssignmentPattern":return D([e.call(r,"left")," = ",e.call(r,"right")]);case"MemberExpression":i.push(e.call(r,"object"));var s=e.call(r,"property");return n.computed?i.push("[",s,"]"):i.push(".",s),D(i);case"MetaProperty":return D([e.call(r,"meta"),".",e.call(r,"property")]);case"BindExpression":return n.object&&i.push(e.call(r,"object")),i.push("::",e.call(r,"callee")),D(i);case"Path":return A(".").join(n.body);case"Identifier":return D([A(n.name,t),e.call(r,"typeAnnotation")]);case"SpreadElement":case"SpreadElementPattern":case"RestProperty":case"SpreadProperty":case"SpreadPropertyPattern":case"RestElement":return D(["...",e.call(r,"argument")]);case"FunctionDeclaration":case"FunctionExpression":return n.async&&i.push("async "),i.push("function"),n.generator&&i.push("*"),n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),i.push("(",l(e,t,r),")",e.call(r,"returnType")," ",e.call(r,"body")),D(i);case"ArrowFunctionExpression":return n.async&&i.push("async "),n.typeParameters&&i.push(e.call(r,"typeParameters")),t.arrowParensAlways||1!==n.params.length||n.rest||"Identifier"!==n.params[0].type||n.params[0].typeAnnotation||n.returnType?i.push("(",l(e,t,r),")",e.call(r,"returnType")):i.push(e.call(r,"params",0)),i.push(" => ",e.call(r,"body")),D(i);case"MethodDefinition":return n.static&&i.push("static "),i.push(o(e,t,r)),D(i);case"YieldExpression":return i.push("yield"),n.delegate&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),D(i);case"AwaitExpression":return i.push("await"),n.all&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),D(i);case"ModuleDeclaration":return i.push("module",e.call(r,"id")),n.source?(v.ok(!n.body),i.push("from",e.call(r,"source"))):i.push(e.call(r,"body")),A(" ").join(i);case"ImportSpecifier":return n.imported?(i.push(e.call(r,"imported")),n.local&&n.local.name!==n.imported.name&&i.push(" as ",e.call(r,"local"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),D(i);case"ExportSpecifier":return n.local?(i.push(e.call(r,"local")),n.exported&&n.exported.name!==n.local.name&&i.push(" as ",e.call(r,"exported"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),D(i);case"ExportBatchSpecifier":return A("*");case"ImportNamespaceSpecifier":return i.push("* as "),n.local?i.push(e.call(r,"local")):n.id&&i.push(e.call(r,"id")),D(i);case"ImportDefaultSpecifier":return n.local?e.call(r,"local"):e.call(r,"id");case"ExportDeclaration":case"ExportDefaultDeclaration":case"ExportNamedDeclaration":return h(e,t,r);case"ExportAllDeclaration":return i.push("export *"),n.exported&&i.push(" as ",e.call(r,"exported")),i.push(" from ",e.call(r,"source")),D(i);case"ExportNamespaceSpecifier":return D(["* as ",e.call(r,"exported")]);case"ExportDefaultSpecifier":return e.call(r,"exported");case"Import":return A("import",t);case"ImportDeclaration":if(i.push("import "),n.importKind&&"value"!==n.importKind&&i.push(n.importKind+" "),n.specifiers&&n.specifiers.length>0){var m=!1;e.each(function(e){var n=e.getName();n>0&&i.push(", ");var s=e.getValue();w.ImportDefaultSpecifier.check(s)||w.ImportNamespaceSpecifier.check(s)?v.strictEqual(m,!1):(w.ImportSpecifier.assert(s),m||(m=!0,i.push(t.objectCurlySpacing?"{ ":"{"))),i.push(r(e))},"specifiers"),m&&i.push(t.objectCurlySpacing?" }":"}"),i.push(" from ")}return i.push(e.call(r,"source"),";"),D(i);case"BlockStatement":var g=e.call(function(e){return a(e,t,r)},"body");return!g.isEmpty()||n.directives&&0!==n.directives.length?(i.push("{\n"),n.directives&&e.each(function(e){i.push(r(e).indent(t.tabWidth),";",n.directives.length>1||!g.isEmpty()?"\n":"")},"directives"),i.push(g.indent(t.tabWidth)),i.push("\n}"),D(i)):A("{}");case"ReturnStatement":if(i.push("return"),n.argument){var x=e.call(r,"argument");x.startsWithComment()||x.length>1&&w.JSXElement&&w.JSXElement.check(n.argument)?i.push(" (\n",x.indent(t.tabWidth),"\n)"):i.push(" ",x)}return i.push(";"),D(i);case"CallExpression":return D([e.call(r,"callee"),u(e,t,r)]);case"ObjectExpression":case"ObjectPattern":case"ObjectTypeAnnotation":var E=!1,S="ObjectTypeAnnotation"===n.type,C=t.flowObjectCommas?",":S?";":",",_=[];S&&_.push("indexers","callProperties"),_.push("properties");var k=0;_.forEach(function(e){k+=n[e].length});var F=S&&1===k||0===k,T=n.exact?"{|":"{",B=n.exact?"|}":"}";i.push(F?T:T+"\n");var O=i.length-1,N=0;return _.forEach(function(n){e.each(function(e){var n=r(e);F||(n=n.indent(t.tabWidth));var s=!S&&n.length>1;s&&E&&i.push("\n"),i.push(n),N<k-1?(i.push(C+(s?"\n\n":"\n")),E=!s):1!==k&&S?i.push(C):!F&&P.isTrailingCommaEnabled(t,"objects")&&i.push(C),N++},n)}),i.push(F?B:"\n"+B),0!==N&&F&&t.objectCurlySpacing&&(i[O]=T+" ",i[i.length-1]=" "+B),D(i);case"PropertyPattern":return D([e.call(r,"key"),": ",e.call(r,"pattern")]);case"ObjectProperty":case"Property":if(n.method||"get"===n.kind||"set"===n.kind)return o(e,t,r);var j=e.call(r,"key");return n.computed?i.push("[",j,"]"):i.push(j),n.shorthand||i.push(": ",e.call(r,"value")),D(i);case"ClassMethod":return n.static&&i.push("static "),D([i,c(e,t,r)]);case"ObjectMethod":return c(e,t,r);case"Decorator":return D(["@",e.call(r,"expression")]);case"ArrayExpression":case"ArrayPattern":var I=n.elements,k=I.length,L=e.map(r,"elements"),M=A(", ").join(L),F=M.getLineLength(1)<=t.wrapColumn;return F?t.arrayBracketSpacing?i.push("[ "):i.push("["):i.push("[\n"),e.each(function(e){var r=e.getName(),n=e.getValue();if(n){var s=L[r];F?r>0&&i.push(" "):s=s.indent(t.tabWidth),i.push(s),(r<k-1||!F&&P.isTrailingCommaEnabled(t,"arrays"))&&i.push(","),F||i.push("\n")}else i.push(",")},"elements"),F&&t.arrayBracketSpacing?i.push(" ]"):i.push("]"),D(i);case"SequenceExpression":return A(", ").join(e.map(r,"expressions"));case"ThisExpression":return A("this");case"Super":return A("super");case"NullLiteral":return A("null");case"RegExpLiteral":return A(n.extra.raw);case"BooleanLiteral":case"NumericLiteral":case"StringLiteral":case"Literal":return"string"!=typeof n.value?A(n.value,t):A(b(n.value,t),t);case"Directive":return e.call(r,"value");case"DirectiveLiteral":return A(b(n.value,t));case"ModuleSpecifier":if(n.local)throw new Error("The ESTree ModuleSpecifier type should be abstract");return A(b(n.value,t),t);case"UnaryExpression":return i.push(n.operator),/[a-z]$/.test(n.operator)&&i.push(" "),i.push(e.call(r,"argument")),D(i);case"UpdateExpression":return i.push(e.call(r,"argument"),n.operator),n.prefix&&i.reverse(),D(i);case"ConditionalExpression":return D(["(",e.call(r,"test")," ? ",e.call(r,"consequent")," : ",e.call(r,"alternate"),")"]);case"NewExpression":i.push("new ",e.call(r,"callee"));var R=n.arguments;return R&&i.push(u(e,t,r)),D(i);case"VariableDeclaration":i.push(n.kind," ");var V=0,L=e.map(function(e){var t=r(e);return V=Math.max(t.length,V),t},"declarations");1===V?i.push(A(", ").join(L)):L.length>1?i.push(A(",\n").join(L).indentTail(n.kind.length+1)):i.push(L[0]);var U=e.getParentNode();return w.ForStatement.check(U)||w.ForInStatement.check(U)||w.ForOfStatement&&w.ForOfStatement.check(U)||w.ForAwaitStatement&&w.ForAwaitStatement.check(U)||i.push(";"),D(i);case"VariableDeclarator":return n.init?A(" = ").join([e.call(r,"id"),e.call(r,"init")]):e.call(r,"id");case"WithStatement":return D(["with (",e.call(r,"object"),") ",e.call(r,"body")]);case"IfStatement":var q=d(e.call(r,"consequent"),t),i=["if (",e.call(r,"test"),")",q];return n.alternate&&i.push(y(q)?" else":"\nelse",d(e.call(r,"alternate"),t)),D(i);case"ForStatement":var G=e.call(r,"init"),X=G.length>1?";\n":"; ",J=A(X).join([G,e.call(r,"test"),e.call(r,"update")]).indentTail("for (".length),W=D(["for (",J,")"]),K=d(e.call(r,"body"),t),i=[W];return W.length>1&&(i.push("\n"),K=K.trimLeft()),i.push(K),D(i);case"WhileStatement":return D(["while (",e.call(r,"test"),")",d(e.call(r,"body"),t)]);case"ForInStatement":return D([n.each?"for each (":"for (",e.call(r,"left")," in ",e.call(r,"right"),")",d(e.call(r,"body"),t)]);case"ForOfStatement":return D(["for (",e.call(r,"left")," of ",e.call(r,"right"),")",d(e.call(r,"body"),t)]);case"ForAwaitStatement":return D(["for await (",e.call(r,"left")," of ",e.call(r,"right"),")",d(e.call(r,"body"),t)]);case"DoWhileStatement":var z=D(["do",d(e.call(r,"body"),t)]),i=[z];return y(z)?i.push(" while"):i.push("\nwhile"),i.push(" (",e.call(r,"test"),");"),D(i);case"DoExpression":var Y=e.call(function(e){return a(e,t,r)},"body");return D(["do {\n",Y.indent(t.tabWidth),"\n}"]);case"BreakStatement":return i.push("break"),n.label&&i.push(" ",e.call(r,"label")),i.push(";"),D(i);case"ContinueStatement":return i.push("continue"),n.label&&i.push(" ",e.call(r,"label")),i.push(";"),D(i);case"LabeledStatement":return D([e.call(r,"label"),":\n",e.call(r,"body")]);case"TryStatement":return i.push("try ",e.call(r,"block")),n.handler?i.push(" ",e.call(r,"handler")):n.handlers&&e.each(function(e){i.push(" ",r(e))},"handlers"),n.finalizer&&i.push(" finally ",e.call(r,"finalizer")),D(i);case"CatchClause":return i.push("catch (",e.call(r,"param")),n.guard&&i.push(" if ",e.call(r,"guard")),i.push(") ",e.call(r,"body")),D(i);case"ThrowStatement":return D(["throw ",e.call(r,"argument"),";"]);case"SwitchStatement":return D(["switch (",e.call(r,"discriminant"),") {\n",A("\n").join(e.map(r,"cases")),"\n}"]);case"SwitchCase":return n.test?i.push("case ",e.call(r,"test"),":"):i.push("default:"),n.consequent.length>0&&i.push("\n",e.call(function(e){return a(e,t,r)},"consequent").indent(t.tabWidth)),D(i);case"DebuggerStatement":return A("debugger;");case"JSXAttribute":return i.push(e.call(r,"name")),n.value&&i.push("=",e.call(r,"value")),D(i);case"JSXIdentifier":return A(n.name,t);case"JSXNamespacedName":return A(":").join([e.call(r,"namespace"),e.call(r,"name")]);case"JSXMemberExpression":return A(".").join([e.call(r,"object"),e.call(r,"property")]);case"JSXSpreadAttribute":return D(["{...",e.call(r,"argument"),"}"]);case"JSXExpressionContainer":return D(["{",e.call(r,"expression"),"}"]);case"JSXElement":var H=e.call(r,"openingElement");if(n.openingElement.selfClosing)return v.ok(!n.closingElement),H;var $=D(e.map(function(e){var t=e.getValue();if(w.Literal.check(t)&&"string"==typeof t.value){if(/\S/.test(t.value))return t.value.replace(/^\s+|\s+$/g,"");if(/\n/.test(t.value))return"\n"}return r(e)},"children")).indentTail(t.tabWidth),Q=e.call(r,"closingElement");return D([H,$,Q]);case"JSXOpeningElement":i.push("<",e.call(r,"name"));var Z=[];e.each(function(e){Z.push(" ",r(e))},"attributes");var ee=D(Z),te=ee.length>1||ee.getLineLength(1)>t.wrapColumn;return te&&(Z.forEach(function(e,t){" "===e&&(v.strictEqual(t%2,0),Z[t]="\n")}),ee=D(Z).indentTail(t.tabWidth)),i.push(ee,n.selfClosing?" />":">"),D(i);case"JSXClosingElement":return D(["</",e.call(r,"name"),">"]);case"JSXText":return A(n.value,t);case"JSXEmptyExpression":return A("");case"TypeAnnotatedIdentifier":return D([e.call(r,"annotation")," ",e.call(r,"identifier")]);case"ClassBody":return 0===n.body.length?A("{}"):D(["{\n",e.call(function(e){return a(e,t,r)},"body").indent(t.tabWidth),"\n}"]);case"ClassPropertyDefinition":return i.push("static ",e.call(r,"definition")),w.MethodDefinition.check(n.definition)||i.push(";"),D(i);case"ClassProperty":n.static&&i.push("static ");var j=e.call(r,"key");return n.computed?j=D(["[",j,"]"]):"plus"===n.variance?j=D(["+",j]):"minus"===n.variance&&(j=D(["-",j])),i.push(j),n.typeAnnotation&&i.push(e.call(r,"typeAnnotation")),n.value&&i.push(" = ",e.call(r,"value")),i.push(";"),D(i);case"ClassDeclaration":case"ClassExpression":return i.push("class"),n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),n.superClass&&i.push(" extends ",e.call(r,"superClass"),e.call(r,"superTypeParameters")),n.implements&&n.implements.length>0&&i.push(" implements ",A(", ").join(e.map(r,"implements"))),i.push(" ",e.call(r,"body")),D(i);case"TemplateElement":return A(n.value.raw,t).lockIndentTail();case"TemplateLiteral":var re=e.map(r,"expressions");return i.push("`"),e.each(function(e){var t=e.getName();i.push(r(e)),t<re.length&&i.push("${",re[t],"}")},"quasis"),i.push("`"),D(i).lockIndentTail();case"TaggedTemplateExpression":return D([e.call(r,"tag"),e.call(r,"quasi")]);case"Node":case"Printable":case"SourceLocation":case"Position":case"Statement":case"Function":case"Pattern":case"Expression":case"Declaration":case"Specifier":case"NamedSpecifier":case"Comment":case"MemberTypeAnnotation":case"TupleTypeAnnotation":case"Type":throw new Error("unprintable type: "+JSON.stringify(n.type));case"CommentBlock":case"Block":return D(["/*",A(n.value,t),"*/"]);case"CommentLine":case"Line":return D(["//",A(n.value,t)]);case"TypeAnnotation":return n.typeAnnotation?("FunctionTypeAnnotation"!==n.typeAnnotation.type&&i.push(": "),i.push(e.call(r,"typeAnnotation")),D(i)):A("");case"ExistentialTypeParam":case"ExistsTypeAnnotation":return A("*",t);case"EmptyTypeAnnotation":return A("empty",t);case"AnyTypeAnnotation":return A("any",t);case"MixedTypeAnnotation":return A("mixed",t);case"ArrayTypeAnnotation":return D([e.call(r,"elementType"),"[]"]);case"BooleanTypeAnnotation":return A("boolean",t);case"BooleanLiteralTypeAnnotation":return v.strictEqual(typeof n.value,"boolean"),A(""+n.value,t);case"DeclareClass":return f(e,["class ",e.call(r,"id")," ",e.call(r,"body")]);case"DeclareFunction":return f(e,["function ",e.call(r,"id"),";"]);case"DeclareModule":return f(e,["module ",e.call(r,"id")," ",e.call(r,"body")]);case"DeclareModuleExports":return f(e,["module.exports",e.call(r,"typeAnnotation")]);case"DeclareVariable":return f(e,["var ",e.call(r,"id"),";"]);case"DeclareExportDeclaration":case"DeclareExportAllDeclaration":return D(["declare ",h(e,t,r)]);case"FunctionTypeAnnotation":var ne=e.getParentNode(0),ie=!(w.ObjectTypeCallProperty.check(ne)||w.DeclareFunction.check(e.getParentNode(2))),se=ie&&!w.FunctionTypeParam.check(ne);return se&&i.push(": "),i.push("(",A(", ").join(e.map(r,"params")),")"),n.returnType&&i.push(ie?" => ":": ",e.call(r,"returnType")),D(i);case"FunctionTypeParam":return D([e.call(r,"name"),n.optional?"?":"",": ",e.call(r,"typeAnnotation")]);case"GenericTypeAnnotation":return D([e.call(r,"id"),e.call(r,"typeParameters")]);case"DeclareInterface":i.push("declare ");case"InterfaceDeclaration":return i.push(A("interface ",t),e.call(r,"id"),e.call(r,"typeParameters")," "),n.extends&&i.push("extends ",A(", ").join(e.map(r,"extends"))),i.push(" ",e.call(r,"body")),D(i);case"ClassImplements":case"InterfaceExtends":return D([e.call(r,"id"),e.call(r,"typeParameters")]);case"IntersectionTypeAnnotation":return A(" & ").join(e.map(r,"types"));case"NullableTypeAnnotation":return D(["?",e.call(r,"typeAnnotation")]);case"NullLiteralTypeAnnotation":return A("null",t);case"ThisTypeAnnotation":return A("this",t);case"NumberTypeAnnotation":return A("number",t);case"ObjectTypeCallProperty":return e.call(r,"value");case"ObjectTypeIndexer":var ae="plus"===n.variance?"+":"minus"===n.variance?"-":"";return D([ae,"[",e.call(r,"id"),": ",e.call(r,"key"),"]: ",e.call(r,"value")]);case"ObjectTypeProperty":var ae="plus"===n.variance?"+":"minus"===n.variance?"-":"";return D([ae,e.call(r,"key"),n.optional?"?":"",": ",e.call(r,"value")]);case"QualifiedTypeIdentifier":return D([e.call(r,"qualification"),".",e.call(r,"id")]);case"StringLiteralTypeAnnotation":return A(b(n.value,t),t);case"NumberLiteralTypeAnnotation":case"NumericLiteralTypeAnnotation":return v.strictEqual(typeof n.value,"number"),A(JSON.stringify(n.value),t);case"StringTypeAnnotation":return A("string",t);case"DeclareTypeAlias":i.push("declare ");case"TypeAlias":return D(["type ",e.call(r,"id"),e.call(r,"typeParameters")," = ",e.call(r,"right"),";"]);case"TypeCastExpression":return D(["(",e.call(r,"expression"),e.call(r,"typeAnnotation"),")"]);case"TypeParameterDeclaration":case"TypeParameterInstantiation":return D(["<",A(", ").join(e.map(r,"params")),">"]);case"TypeParameter":switch(n.variance){case"plus":i.push("+");break;case"minus":i.push("-")}return i.push(e.call(r,"name")),n.bound&&i.push(e.call(r,"bound")),n.default&&i.push("=",e.call(r,"default")),D(i);case"TypeofTypeAnnotation":return D([A("typeof ",t),e.call(r,"argument")]);case"UnionTypeAnnotation":return A(" | ").join(e.map(r,"types"));case"VoidTypeAnnotation":return A("void",t);case"NullTypeAnnotation":return A("null",t);case"ClassHeritage":case"ComprehensionBlock":case"ComprehensionExpression":case"Glob":case"GeneratorExpression":case"LetStatement":case"LetExpression":case"GraphExpression":case"GraphIndexExpression":case"XMLDefaultDeclaration":case"XMLAnyName":case"XMLQualifiedIdentifier":case"XMLFunctionQualifiedIdentifier":case"XMLAttributeSelector":case"XMLFilterExpression":case"XML":case"XMLElement":case"XMLList":case"XMLEscape":case"XMLText":case"XMLStartTag":case"XMLEndTag":case"XMLPointTag":case"XMLName":case"XMLAttribute":case"XMLCdata":case"XMLComment":case"XMLProcessingInstruction":default:throw new Error("unknown type: "+JSON.stringify(n.type))}return p}(e,t,r);return!n||m.isEmpty()?m:(n.decorators&&n.decorators.length>0&&!P.getParentExportDeclaration(e)?e.each(function(e){i.push(r(e),"\n")},"decorators"):P.isExportDeclaration(n)&&n.declaration&&n.declaration.decorators?e.each(function(e){i.push(r(e),"\n")},"declaration","decorators"):s=e.needsParens(),s&&i.unshift("("),i.push(m),s&&i.push(")"),D(i))}function a(e,t,r){w.ClassBody&&w.ClassBody.check(e.getParentNode());var n=[],i=!1,s=!1;e.each(function(e){e.getName();var t=e.getValue();t&&"EmptyStatement"!==t.type&&(w.Comment.check(t)?i=!0:w.Statement.check(t)?s=!0:k.assert(t),n.push({node:t,printed:r(e)}))}),i&&v.strictEqual(s,!1,"Comments may appear as statements in otherwise empty statement lists, but may not coexist with non-Comment nodes.");var a=null,o=n.length,u=[];return n.forEach(function(e,r){var n,i,s=e.printed,l=e.node,c=s.length>1,p=r>0,h=r<o-1,f=l&&l.loc&&l.loc.lines,d=f&&t.reuseWhitespace&&P.getTrueLoc(l,f);if(p)if(d){var m=f.skipSpaces(d.start,!0),y=m?m.line:1,g=d.start.line-y;n=Array(g+1).join("\n")}else n=c?"\n\n":"\n";else n="";if(h)if(d){var b=f.skipSpaces(d.end),v=(b?b.line:f.length)-d.end.line;i=Array(v+1).join("\n")}else i=c?"\n\n":"\n";else i="";u.push(function(e,t){if(!e&&!t)return A("");if(!e)return A(t);if(!t)return A(e);var r=A(e),n=A(t);if(n.length>r.length)return n;return r}(a,n),s),h?a=i:i&&u.push(i)}),D(u)}function o(e,t,r){var n=e.getNode(),i=n.kind,s=[];"ObjectMethod"===n.type||"ClassMethod"===n.type?n.value=n:w.FunctionExpression.assert(n.value),n.value.async&&s.push("async "),i&&"init"!==i&&"method"!==i&&"constructor"!==i?(v.ok("get"===i||"set"===i),s.push(i," ")):n.value.generator&&s.push("*");var a=e.call(r,"key");return n.computed&&(a=D(["[",a,"]"])),s.push(a,e.call(r,"value","typeParameters"),"(",e.call(function(e){return l(e,t,r)},"value"),")",e.call(r,"value","returnType")," ",e.call(r,"value","body")),D(s)}function u(e,t,r){var n=e.map(r,"arguments"),i=P.isTrailingCommaEnabled(t,"parameters"),s=A(", ").join(n);return s.getLineLength(1)>t.wrapColumn?(s=A(",\n").join(n),D(["(\n",s.indent(t.tabWidth),i?",\n)":"\n)"])):D(["(",s,")"])}function l(e,t,r){var n=e.getValue();w.Function.assert(n);var i=e.map(r,"params");n.defaults&&e.each(function(e){var t=e.getName(),n=i[t];n&&e.getValue()&&(i[t]=D([n," = ",r(e)]))},"defaults"),n.rest&&i.push(D(["...",e.call(r,"rest")]));var s=A(", ").join(i);return s.length>1||s.getLineLength(1)>t.wrapColumn?(s=A(",\n").join(i),s=P.isTrailingCommaEnabled(t,"parameters")&&!n.rest&&"RestElement"!==n.params[n.params.length-1].type?D([s,",\n"]):D([s,"\n"]),D(["\n",s.indent(t.tabWidth)])):s}function c(e,t,r){var n=e.getValue(),i=[];if(n.async&&i.push("async "),n.generator&&i.push("*"),n.method||"get"===n.kind||"set"===n.kind)return o(e,t,r);var s=e.call(r,"key");return n.computed?i.push("[",s,"]"):i.push(s),i.push("(",l(e,t,r),")",e.call(r,"returnType")," ",e.call(r,"body")),D(i)}function h(e,t,r){var n=e.getValue(),i=["export "],s=t.objectCurlySpacing;w.Declaration.assert(n),(n.default||"ExportDefaultDeclaration"===n.type)&&i.push("default "),n.declaration?i.push(e.call(r,"declaration")):n.specifiers&&n.specifiers.length>0&&(1===n.specifiers.length&&"ExportBatchSpecifier"===n.specifiers[0].type?i.push("*"):i.push(s?"{ ":"{",A(", ").join(e.map(r,"specifiers")),s?" }":"}"),n.source&&i.push(" from ",e.call(r,"source")));var a=D(i);return";"===m(a)||n.declaration&&("FunctionDeclaration"===n.declaration.type||"ClassDeclaration"===n.declaration.type)||(a=D([a,";"])),a}function f(e,t){var r=P.getParentExportDeclaration(e);return r?v.strictEqual(r.type,"DeclareExportDeclaration"):t.unshift("declare "),D(t)}function d(e,t){return e.length>1?D([" ",e]):D(["\n",function(e){var t=m(e);return!t||"\n};".indexOf(t)<0?D([e,";"]):e}(e).indent(t.tabWidth)])}function m(e){var t=e.lastPos();do{var r=e.charAt(t);if(/\S/.test(r))return r}while(e.prevPos(t))}function y(e){return"}"===m(e)}function g(e){return e.replace(/['"]/g,function(e){return'"'===e?"'":'"'})}function b(e,t){switch(k.assert(e),t.quote){case"auto":var r=JSON.stringify(e),n=g(JSON.stringify(g(e)));return r.length>n.length?n:r;case"single":return g(JSON.stringify(g(e)));case"double":default:return JSON.stringify(e)}}var v=e("assert"),x=(e("source-map"),e("./comments").printComments),E=e("./lines"),A=E.fromString,D=E.concat,S=e("./options").normalize,C=e("./patcher").getReprinter,_=e("./types"),w=_.namedTypes,k=_.builtInTypes.string,F=_.builtInTypes.object,T=e("./fast-path"),P=e("./util"),B=!1;n.prototype.toString=function(){return B||(console.warn("Deprecation warning: recast.print now returns an object with a .code property. You appear to be treating the object as a string, which might still work but is strongly discouraged."),B=!0),this.code};var O=new n("");r.Printer=i},{"./comments":564,"./fast-path":565,"./lines":566,"./options":568,"./patcher":570,"./types":572,"./util":573,assert:1,"source-map":586}],572:[function(e,t,r){t.exports=e("ast-types")},{"ast-types":20}],573:[function(e,t,r){function n(e,t){return e.line-t.line||e.column-t.column}function i(e){return{line:e.line,column:e.column}}function s(e,t){e&&t&&(n(t.start,e.start)<0&&(e.start=t.start),n(e.end,t.end)<0&&(e.end=t.end))}var a=e("assert"),o=e("./types"),u=(o.getFieldValue,o.namedTypes),l=e("source-map"),c=l.SourceMapConsumer,p=l.SourceMapGenerator,h=Object.prototype.hasOwnProperty,f=r;f.getUnionOfKeys=function(){for(var e={},t=arguments.length,r=0;r<t;++r)for(var n=Object.keys(arguments[r]),i=n.length,s=0;s<i;++s)e[n[s]]=!0;return e},f.comparePos=n,f.copyPos=i,f.composeSourceMaps=function(e,t){if(!e)return t||null;if(!t)return e;var r=new c(e),n=new c(t),s=new p({file:t.file,sourceRoot:t.sourceRoot}),a={};return n.eachMapping(function(e){var t=r.originalPositionFor({line:e.originalLine,column:e.originalColumn}),n=t.source;if(null!==n){s.addMapping({source:n,original:i(t),generated:{line:e.generatedLine,column:e.generatedColumn},name:e.name});var o=r.sourceContentFor(n);o&&!h.call(a,n)&&(a[n]=o,s.setSourceContent(n,o))}}),s.toJSON()},f.getTrueLoc=function(e,t){function r(e){s(a,e.loc)}if(!e.loc)return null;var a={start:e.loc.start,end:e.loc.end};return e.comments&&e.comments.forEach(r),e.declaration&&f.isExportDeclaration(e)&&e.declaration.decorators&&e.declaration.decorators.forEach(r),n(a.start,a.end)<0&&(a.start=i(a.start),t.skipSpaces(a.start,!1,!0),n(a.start,a.end)<0&&(a.end=i(a.end),t.skipSpaces(a.end,!0,!0))),a},f.fixFaultyLocations=function(e,t){if((o=e.loc)&&(o.start.line<1&&(o.start.line=1),o.end.line<1&&(o.end.line=1)),"File"===e.type&&(o.start=t.firstPos(),o.end=t.lastPos()),"TemplateLiteral"===e.type)!function(e,t){if(a.strictEqual(e.type,"TemplateLiteral"),0!==e.quasis.length){var r=i(e.loc.start);a.strictEqual(t.charAt(r),"`"),a.ok(t.nextPos(r));var s=e.quasis[0];n(s.loc.start,r)<0&&(s.loc.start=r);var o=i(e.loc.end);a.ok(t.prevPos(o)),a.strictEqual(t.charAt(o),"`");var u=e.quasis[e.quasis.length-1];n(o,u.loc.end)<0&&(u.loc.end=o),e.expressions.forEach(function(r,i){var s=t.skipSpaces(r.loc.start,!0,!1);if(t.prevPos(s)&&"{"===t.charAt(s)&&t.prevPos(s)&&"$"===t.charAt(s)){var o=e.quasis[i];n(s,o.loc.end)<0&&(o.loc.end=s)}var u=t.skipSpaces(r.loc.end,!1,!1);if("}"===t.charAt(u)){a.ok(t.nextPos(u));var l=e.quasis[i+1];n(l.loc.start,u)<0&&(l.loc.start=u)}})}}(e,t);else if(o&&e.decorators)e.decorators.forEach(function(e){s(o,e.loc)});else if(e.declaration&&f.isExportDeclaration(e)){e.declaration.loc=null;var r=e.declaration.decorators;r&&r.forEach(function(e){s(o,e.loc)})}else if(u.MethodDefinition&&u.MethodDefinition.check(e)||u.Property.check(e)&&(e.method||e.shorthand))e.value.loc=null,u.FunctionExpression.check(e.value)&&(e.value.id=null);else if("ObjectTypeProperty"===e.type){var o,l=(o=e.loc)&&o.end;l&&(l=i(l),t.prevPos(l)&&","===t.charAt(l)&&(l=t.skipSpaces(l,!0,!0))&&(o.end=l))}},f.isExportDeclaration=function(e){if(e)switch(e.type){case"ExportDeclaration":case"ExportDefaultDeclaration":case"ExportDefaultSpecifier":case"DeclareExportDeclaration":case"ExportNamedDeclaration":case"ExportAllDeclaration":return!0}return!1},f.getParentExportDeclaration=function(e){var t=e.getParentNode();return"declaration"===e.getName()&&f.isExportDeclaration(t)?t:null},f.isTrailingCommaEnabled=function(e,t){var r=e.trailingComma;return"object"==typeof r?!!r[t]:!!r}},{"./types":572,assert:1,"source-map":586}],574:[function(e,t,r){(function(t){function n(e,t){return new a(t).print(e)}var i=e("./lib/types"),s=e("./lib/parser").parse,a=e("./lib/printer").Printer;Object.defineProperties(r,{parse:{enumerable:!0,value:s},visit:{enumerable:!0,value:i.visit},print:{enumerable:!0,value:n},prettyPrint:{enumerable:!1,value:function(e,t){return new a(t).printGenerically(e)}},types:{enumerable:!1,value:i},run:{enumerable:!1,value:function(r,i){return function(r,i,a){e("fs").readFile(r,"utf-8",function(e,r){e?console.error(e):function(e,r,i){var a=i&&i.writeback||function(e){t.stdout.write(e)};r(s(e,i),function(e){a(n(e,i).code)})}(r,i,a)})}(t.argv[2],r,i)}}})}).call(this,e("_process"))},{"./lib/parser":569,"./lib/printer":571,"./lib/types":572,_process:550,fs:192}],575:[function(e,t,r){!function(e,n){"object"==typeof r&&"object"==typeof t?t.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof r?r.esprima=n():e.esprima=n()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";var n=r(1),i=r(3),s=r(11),a=r(15);t.parse=function(e,t,r){var a=null,o=function(e,t){r&&r(e,t),a&&a.visit(e,t)},u="function"==typeof r?o:null,l=!1;if(t){l="boolean"==typeof t.comment&&t.comment;var c="boolean"==typeof t.attachComment&&t.attachComment;(l||c)&&((a=new n.CommentHandler).attach=c,t.comment=!0,u=o)}var p,h=(p=t&&"boolean"==typeof t.jsx&&t.jsx?new s.JSXParser(e,t,u):new i.Parser(e,t,u)).parseProgram();return l&&(h.comments=a.comments),p.config.tokens&&(h.tokens=p.tokens),p.config.tolerant&&(h.errors=p.errorHandler.errors),h},t.tokenize=function(e,t,r){var n,i=new a.Tokenizer(e,t);n=[];try{for(;;){var s=i.getNextToken();if(!s)break;r&&(s=r(s)),n.push(s)}}catch(e){i.errorHandler.tolerate(e)}return i.errorHandler.tolerant&&(n.errors=i.errors()),n};var o=r(2);t.Syntax=o.Syntax,t.version="3.1.3"},function(e,t,r){"use strict";var n=r(2),i=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===n.Syntax.BlockStatement&&0===e.body.length){for(var r=[],i=this.leading.length-1;i>=0;--i){var s=this.leading[i];t.end.offset>=s.start&&(r.unshift(s.comment),this.leading.splice(i,1),this.trailing.splice(i,1))}r.length&&(e.innerComments=r)}},e.prototype.findTrailingComments=function(e,t){var r=[];if(this.trailing.length>0){for(var n=this.trailing.length-1;n>=0;--n){var i=this.trailing[n];i.start>=t.end.offset&&r.unshift(i.comment)}return this.trailing.length=0,r}var s=this.stack[this.stack.length-1];if(s&&s.node.trailingComments){var a=s.node.trailingComments[0];a&&a.range[0]>=t.end.offset&&(r=s.node.trailingComments,delete s.node.trailingComments)}return r},e.prototype.findLeadingComments=function(e,t){for(var r,n=[];this.stack.length>0;){if(!((a=this.stack[this.stack.length-1])&&a.start>=t.start.offset))break;r=this.stack.pop().node}if(r){for(var i=(r.leadingComments?r.leadingComments.length:0)-1;i>=0;--i){var s=r.leadingComments[i];s.range[1]<=t.start.offset&&(n.unshift(s),r.leadingComments.splice(i,1))}return r.leadingComments&&0===r.leadingComments.length&&delete r.leadingComments,n}for(i=this.leading.length-1;i>=0;--i){var a;(a=this.leading[i]).start<=t.start.offset&&(n.unshift(a.comment),this.leading.splice(i,1))}return n},e.prototype.visitNode=function(e,t){if(!(e.type===n.Syntax.Program&&e.body.length>0)){this.insertInnerComments(e,t);var r=this.findTrailingComments(e,t),i=this.findLeadingComments(e,t);i.length>0&&(e.leadingComments=i),r.length>0&&(e.trailingComments=r),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var r="L"===e.type[0]?"Line":"Block",n={type:r,value:e.value};if(e.range&&(n.range=e.range),e.loc&&(n.loc=e.loc),this.comments.push(n),this.attach){var i={comment:{type:r,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(i.comment.loc=e.loc),e.type=r,this.leading.push(i),this.trailing.push(i)}},e.prototype.visit=function(e,t){"LineComment"===e.type?this.visitComment(e,t):"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=i},function(e,t){"use strict";t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,r){"use strict";var n=r(4),i=r(5),s=r(6),a=r(7),o=r(8),u=r(2),l=r(10),c="ArrowParameterPlaceHolder",p=function(){function e(e,t,r){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=String(t.source)),this.delegate=r,this.errorHandler=new s.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.sourceType=t&&"module"===t.sourceType?"module":"script",this.lookahead=null,this.hasLineTerminator=!1,this.context={allowIn:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:"module"===this.sourceType},this.tokens=[],this.startMarker={index:0,lineNumber:this.scanner.lineNumber,lineStart:0},this.lastMarker={index:0,lineNumber:this.scanner.lineNumber,lineStart:0},this.nextToken(),this.lastMarker={index:this.scanner.index,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var i=Array.prototype.slice.call(arguments,1),s=e.replace(/%(\d)/g,function(e,t){return n.assert(t<i.length,"Message reference must be in range"),i[t]}),a=this.lastMarker.index,o=this.lastMarker.lineNumber,u=this.lastMarker.index-this.lastMarker.lineStart+1;throw this.errorHandler.createError(a,o,u,s)},e.prototype.tolerateError=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var i=Array.prototype.slice.call(arguments,1),s=e.replace(/%(\d)/g,function(e,t){return n.assert(t<i.length,"Message reference must be in range"),i[t]}),a=this.lastMarker.index,o=this.scanner.lineNumber,u=this.lastMarker.index-this.lastMarker.lineStart+1;this.errorHandler.tolerateError(a,o,u,s)},e.prototype.unexpectedTokenError=function(e,t){var r,n=t||i.Messages.UnexpectedToken;if(e?(t||(n=e.type===a.Token.EOF?i.Messages.UnexpectedEOS:e.type===a.Token.Identifier?i.Messages.UnexpectedIdentifier:e.type===a.Token.NumericLiteral?i.Messages.UnexpectedNumber:e.type===a.Token.StringLiteral?i.Messages.UnexpectedString:e.type===a.Token.Template?i.Messages.UnexpectedTemplate:i.Messages.UnexpectedToken,e.type===a.Token.Keyword&&(this.scanner.isFutureReservedWord(e.value)?n=i.Messages.UnexpectedReserved:this.context.strict&&this.scanner.isStrictModeReservedWord(e.value)&&(n=i.Messages.StrictReservedWord))),r=e.type===a.Token.Template?e.value.raw:e.value):r="ILLEGAL",n=n.replace("%0",r),e&&"number"==typeof e.lineNumber){var s=e.start,o=e.lineNumber,u=e.start-this.lastMarker.lineStart+1;return this.errorHandler.createError(s,o,u,n)}s=this.lastMarker.index,o=this.lastMarker.lineNumber,u=s-this.lastMarker.lineStart+1;return this.errorHandler.createError(s,o,u,n)},e.prototype.throwUnexpectedToken=function(e,t){throw this.unexpectedTokenError(e,t)},e.prototype.tolerateUnexpectedToken=function(e,t){this.errorHandler.tolerate(this.unexpectedTokenError(e,t))},e.prototype.collectComments=function(){if(this.config.comment){var e=this.scanner.scanComments();if(e.length>0&&this.delegate)for(var t=0;t<e.length;++t){var r=e[t],n=void 0;n={type:r.multiLine?"BlockComment":"LineComment",value:this.scanner.source.slice(r.slice[0],r.slice[1])},this.config.range&&(n.range=r.range),this.config.loc&&(n.loc=r.loc);var i={start:{line:r.loc.start.line,column:r.loc.start.column,offset:r.range[0]},end:{line:r.loc.end.line,column:r.loc.end.column,offset:r.range[1]}};this.delegate(n,i)}}else this.scanner.scanComments()},e.prototype.getTokenRaw=function(e){return this.scanner.source.slice(e.start,e.end)},e.prototype.convertToken=function(e){var t;return t={type:a.TokenName[e.type],value:this.getTokenRaw(e)},this.config.range&&(t.range=[e.start,e.end]),this.config.loc&&(t.loc={start:{line:this.startMarker.lineNumber,column:this.startMarker.index-this.startMarker.lineStart},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}),e.regex&&(t.regex=e.regex),t},e.prototype.nextToken=function(){var e=this.lookahead;this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;var t;return t=this.scanner.lex(),this.hasLineTerminator=!(!e||!t)&&e.lineNumber!==t.lineNumber,t&&this.context.strict&&t.type===a.Token.Identifier&&this.scanner.isStrictModeReservedWord(t.value)&&(t.type=a.Token.Keyword),this.lookahead=t,this.config.tokens&&t.type!==a.Token.EOF&&this.tokens.push(this.convertToken(t)),e},e.prototype.nextRegexToken=function(){this.collectComments();var e=this.scanner.scanRegExp();return this.config.tokens&&(this.tokens.pop(),this.tokens.push(this.convertToken(e))),this.lookahead=e,this.nextToken(),e},e.prototype.createNode=function(){return{index:this.startMarker.index,line:this.startMarker.lineNumber,column:this.startMarker.index-this.startMarker.lineStart}},e.prototype.startNode=function(e){return{index:e.start,line:e.lineNumber,column:e.start-e.lineStart}},e.prototype.finalize=function(e,t){if(this.config.range&&(t.range=[e.index,this.lastMarker.index]),this.config.loc&&(t.loc={start:{line:e.line,column:e.column},end:{line:this.lastMarker.lineNumber,column:this.lastMarker.index-this.lastMarker.lineStart}},this.config.source&&(t.loc.source=this.config.source)),this.delegate){var r={start:{line:e.line,column:e.column,offset:e.index},end:{line:this.lastMarker.lineNumber,column:this.lastMarker.index-this.lastMarker.lineStart,offset:this.lastMarker.index}};this.delegate(t,r)}return t},e.prototype.expect=function(e){var t=this.nextToken();t.type===a.Token.Punctuator&&t.value===e||this.throwUnexpectedToken(t)},e.prototype.expectCommaSeparator=function(){if(this.config.tolerant){var e=this.lookahead;e.type===a.Token.Punctuator&&","===e.value?this.nextToken():e.type===a.Token.Punctuator&&";"===e.value?(this.nextToken(),this.tolerateUnexpectedToken(e)):this.tolerateUnexpectedToken(e,i.Messages.UnexpectedToken)}else this.expect(",")},e.prototype.expectKeyword=function(e){var t=this.nextToken();t.type===a.Token.Keyword&&t.value===e||this.throwUnexpectedToken(t)},e.prototype.match=function(e){return this.lookahead.type===a.Token.Punctuator&&this.lookahead.value===e},e.prototype.matchKeyword=function(e){return this.lookahead.type===a.Token.Keyword&&this.lookahead.value===e},e.prototype.matchContextualKeyword=function(e){return this.lookahead.type===a.Token.Identifier&&this.lookahead.value===e},e.prototype.matchAssign=function(){if(this.lookahead.type!==a.Token.Punctuator)return!1;var e=this.lookahead.value;return"="===e||"*="===e||"**="===e||"/="===e||"%="===e||"+="===e||"-="===e||"<<="===e||">>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,r=this.context.isAssignmentTarget,n=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var i=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=r,this.context.firstCoverInitializedNameError=n,i},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,r=this.context.isAssignmentTarget,n=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var i=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&r,this.context.firstCoverInitializedNameError=n||this.context.firstCoverInitializedNameError,i},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(this.lookahead.type===a.Token.EOF||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.lineNumber=this.startMarker.lineNumber,this.lastMarker.lineStart=this.startMarker.lineStart)},e.prototype.parsePrimaryExpression=function(){var e,t,r,n=this.createNode();switch(this.lookahead.type){case a.Token.Identifier:"module"===this.sourceType&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.finalize(n,new l.Identifier(this.nextToken().value));break;case a.Token.NumericLiteral:case a.Token.StringLiteral:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,t=this.nextToken(),r=this.getTokenRaw(t),e=this.finalize(n,new l.Literal(t.value,r));break;case a.Token.BooleanLiteral:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,(t=this.nextToken()).value="true"===t.value,r=this.getTokenRaw(t),e=this.finalize(n,new l.Literal(t.value,r));break;case a.Token.NullLiteral:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,(t=this.nextToken()).value=null,r=this.getTokenRaw(t),e=this.finalize(n,new l.Literal(t.value,r));break;case a.Token.Template:e=this.parseTemplateLiteral();break;case a.Token.Punctuator:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,t=this.nextRegexToken(),r=this.getTokenRaw(t),e=this.finalize(n,new l.RegexLiteral(t.value,r,t.regex));break;default:this.throwUnexpectedToken(this.nextToken())}break;case a.Token.Keyword:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(n,new l.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(n,new l.ThisExpression)):this.matchKeyword("class")?e=this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:this.throwUnexpectedToken(this.nextToken())}return e},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new l.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var r=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(r)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new l.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,r},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!1;var r=this.parseFormalParameters(),n=this.parsePropertyMethod(r);return this.context.allowYield=t,this.finalize(e,new l.FunctionExpression(null,r.params,n,!1))},e.prototype.parseObjectPropertyKey=function(){var e=this.createNode(),t=this.nextToken(),r=null;switch(t.type){case a.Token.StringLiteral:case a.Token.NumericLiteral:this.context.strict&&t.octal&&this.tolerateUnexpectedToken(t,i.Messages.StrictOctalLiteral);var n=this.getTokenRaw(t);r=this.finalize(e,new l.Literal(t.value,n));break;case a.Token.Identifier:case a.Token.BooleanLiteral:case a.Token.NullLiteral:case a.Token.Keyword:r=this.finalize(e,new l.Identifier(t.value));break;case a.Token.Punctuator:"["===t.value?(r=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):this.throwUnexpectedToken(t);break;default:this.throwUnexpectedToken(t)}return r},e.prototype.isPropertyKey=function(e,t){return e.type===u.Syntax.Identifier&&e.name===t||e.type===u.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t,r,n,s=this.createNode(),o=this.lookahead,u=!1,c=!1,p=!1;o.type===a.Token.Identifier?(this.nextToken(),r=this.finalize(s,new l.Identifier(o.value))):this.match("*")?this.nextToken():(u=this.match("["),r=this.parseObjectPropertyKey());var h=this.qualifiedPropertyName(this.lookahead);if(o.type===a.Token.Identifier&&"get"===o.value&&h)t="get",u=this.match("["),r=this.parseObjectPropertyKey(),this.context.allowYield=!1,n=this.parseGetterMethod();else if(o.type===a.Token.Identifier&&"set"===o.value&&h)t="set",u=this.match("["),r=this.parseObjectPropertyKey(),n=this.parseSetterMethod();else if(o.type===a.Token.Punctuator&&"*"===o.value&&h)t="init",u=this.match("["),r=this.parseObjectPropertyKey(),n=this.parseGeneratorMethod(),c=!0;else if(r||this.throwUnexpectedToken(this.lookahead),t="init",this.match(":"))!u&&this.isPropertyKey(r,"__proto__")&&(e.value&&this.tolerateError(i.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),n=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))n=this.parsePropertyMethodFunction(),c=!0;else if(o.type===a.Token.Identifier){var f=this.finalize(s,new l.Identifier(o.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),p=!0;var d=this.isolateCoverGrammar(this.parseAssignmentExpression);n=this.finalize(s,new l.AssignmentPattern(f,d))}else p=!0,n=f}else this.throwUnexpectedToken(this.nextToken());return this.finalize(s,new l.Property(t,r,u,n,c,p))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],r={value:!1};!this.match("}");)t.push(this.parseObjectProperty(r)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new l.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){n.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),r={raw:t.value.raw,cooked:t.value.cooked};return this.finalize(e,new l.TemplateElement(r,t.tail))},e.prototype.parseTemplateElement=function(){this.lookahead.type!==a.Token.Template&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),r={raw:t.value.raw,cooked:t.value.cooked};return this.finalize(e,new l.TemplateElement(r,t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],r=[],n=this.parseTemplateHead();for(r.push(n);!n.tail;)t.push(this.parseExpression()),n=this.parseTemplateElement(),r.push(n);return this.finalize(e,new l.TemplateLiteral(r,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case u.Syntax.Identifier:case u.Syntax.MemberExpression:case u.Syntax.RestElement:case u.Syntax.AssignmentPattern:break;case u.Syntax.SpreadElement:e.type=u.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case u.Syntax.ArrayExpression:e.type=u.Syntax.ArrayPattern;for(var t=0;t<e.elements.length;t++)null!==e.elements[t]&&this.reinterpretExpressionAsPattern(e.elements[t]);break;case u.Syntax.ObjectExpression:e.type=u.Syntax.ObjectPattern;for(t=0;t<e.properties.length;t++)this.reinterpretExpressionAsPattern(e.properties[t].value);break;case u.Syntax.AssignmentExpression:e.type=u.Syntax.AssignmentPattern,delete e.operator,this.reinterpretExpressionAsPattern(e.left)}},e.prototype.parseGroupExpression=function(){var e;if(this.expect("("),this.match(")"))this.nextToken(),this.match("=>")||this.expect("=>"),e={type:c,params:[]};else{var t=this.lookahead,r=[];if(this.match("..."))e=this.parseRestElement(r),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:c,params:[e]};else{var n=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var i=[];for(this.context.isAssignmentTarget=!1,i.push(e);this.startMarker.index<this.scanner.length&&this.match(",");){if(this.nextToken(),this.match("...")){this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),i.push(this.parseRestElement(r)),this.expect(")"),this.match("=>")||this.expect("=>"),this.context.isBindingElement=!1;for(var s=0;s<i.length;s++)this.reinterpretExpressionAsPattern(i[s]);n=!0,e={type:c,params:i}}else i.push(this.inheritCoverGrammar(this.parseAssignmentExpression));if(n)break}n||(e=this.finalize(this.startNode(t),new l.SequenceExpression(i)))}if(!n){if(this.expect(")"),this.match("=>")&&(e.type===u.Syntax.Identifier&&"yield"===e.name&&(n=!0,e={type:c,params:[e]}),!n)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===u.Syntax.SequenceExpression)for(s=0;s<e.expressions.length;s++)this.reinterpretExpressionAsPattern(e.expressions[s]);else this.reinterpretExpressionAsPattern(e);var a=e.type===u.Syntax.SequenceExpression?e.expressions:[e];e={type:c,params:a}}this.context.isBindingElement=!1}}}return e},e.prototype.parseArguments=function(){this.expect("(");var e=[];if(!this.match(")"))for(;;){var t=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAssignmentExpression);if(e.push(t),this.match(")"))break;this.expectCommaSeparator()}return this.expect(")"),e},e.prototype.isIdentifierName=function(e){return e.type===a.Token.Identifier||e.type===a.Token.Keyword||e.type===a.Token.BooleanLiteral||e.type===a.Token.NullLiteral},e.prototype.parseIdentifierName=function(){var e=this.createNode(),t=this.nextToken();return this.isIdentifierName(t)||this.throwUnexpectedToken(t),this.finalize(e,new l.Identifier(t.value))},e.prototype.parseNewExpression=function(){var e=this.createNode(),t=this.parseIdentifierName();n.assert("new"===t.name,"New expression must start with `new`");var r;if(this.match("."))if(this.nextToken(),this.lookahead.type===a.Token.Identifier&&this.context.inFunctionBody&&"target"===this.lookahead.value){var i=this.parseIdentifierName();r=new l.MetaProperty(t,i)}else this.throwUnexpectedToken(this.lookahead);else{var s=this.isolateCoverGrammar(this.parseLeftHandSideExpression),o=this.match("(")?this.parseArguments():[];r=new l.NewExpression(s,o),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return this.finalize(e,r)},e.prototype.parseLeftHandSideExpressionAllowCall=function(){var e=this.lookahead,t=this.context.allowIn;this.context.allowIn=!0;var r;for(this.matchKeyword("super")&&this.context.inFunctionBody?(r=this.createNode(),this.nextToken(),r=this.finalize(r,new l.Super),this.match("(")||this.match(".")||this.match("[")||this.throwUnexpectedToken(this.lookahead)):r=this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression);;)if(this.match(".")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect(".");var n=this.parseIdentifierName();r=this.finalize(this.startNode(e),new l.StaticMemberExpression(r,n))}else if(this.match("(")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!1;var i=this.parseArguments();r=this.finalize(this.startNode(e),new l.CallExpression(r,i))}else if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");n=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),r=this.finalize(this.startNode(e),new l.ComputedMemberExpression(r,n))}else{if(this.lookahead.type!==a.Token.Template||!this.lookahead.head)break;var s=this.parseTemplateLiteral();r=this.finalize(this.startNode(e),new l.TaggedTemplateExpression(r,s))}return this.context.allowIn=t,r},e.prototype.parseSuper=function(){var e=this.createNode();return this.expectKeyword("super"),this.match("[")||this.match(".")||this.throwUnexpectedToken(this.lookahead),this.finalize(e,new l.Super)},e.prototype.parseLeftHandSideExpression=function(){n.assert(this.context.allowIn,"callee of new expression always allow in keyword.");for(var e=this.startNode(this.lookahead),t=this.matchKeyword("super")&&this.context.inFunctionBody?this.parseSuper():this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression);;)if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var r=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),t=this.finalize(e,new l.ComputedMemberExpression(t,r))}else if(this.match(".")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect(".");r=this.parseIdentifierName();t=this.finalize(e,new l.StaticMemberExpression(t,r))}else{if(this.lookahead.type!==a.Token.Template||!this.lookahead.head)break;var i=this.parseTemplateLiteral();t=this.finalize(e,new l.TaggedTemplateExpression(t,i))}return t},e.prototype.parseUpdateExpression=function(){var e,t=this.lookahead;if(this.match("++")||this.match("--")){var r=this.startNode(t),n=this.nextToken();e=this.inheritCoverGrammar(this.parseUnaryExpression),this.context.strict&&e.type===u.Syntax.Identifier&&this.scanner.isRestrictedWord(e.name)&&this.tolerateError(i.Messages.StrictLHSPrefix),this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment);var s=!0;e=this.finalize(r,new l.UpdateExpression(n.value,e,s)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else if(e=this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall),!this.hasLineTerminator&&this.lookahead.type===a.Token.Punctuator&&(this.match("++")||this.match("--"))){this.context.strict&&e.type===u.Syntax.Identifier&&this.scanner.isRestrictedWord(e.name)&&this.tolerateError(i.Messages.StrictLHSPostfix),this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=this.nextToken().value;s=!1;e=this.finalize(this.startNode(t),new l.UpdateExpression(o,e,s))}return e},e.prototype.parseUnaryExpression=function(){var e;if(this.match("+")||this.match("-")||this.match("~")||this.match("!")||this.matchKeyword("delete")||this.matchKeyword("void")||this.matchKeyword("typeof")){var t=this.startNode(this.lookahead),r=this.nextToken();e=this.inheritCoverGrammar(this.parseUnaryExpression),e=this.finalize(t,new l.UnaryExpression(r.value,e)),this.context.strict&&"delete"===e.operator&&e.argument.type===u.Syntax.Identifier&&this.tolerateError(i.Messages.StrictDelete),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else e=this.parseUpdateExpression();return e},e.prototype.parseExponentiationExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseUnaryExpression);if(t.type!==u.Syntax.UnaryExpression&&this.match("**")){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var r=t,n=this.isolateCoverGrammar(this.parseExponentiationExpression);t=this.finalize(this.startNode(e),new l.BinaryExpression("**",r,n))}return t},e.prototype.binaryPrecedence=function(e){var t=e.value;return e.type===a.Token.Punctuator?this.operatorPrecedence[t]||0:e.type===a.Token.Keyword&&("instanceof"===t||this.context.allowIn&&"in"===t)?7:0},e.prototype.parseBinaryExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseExponentiationExpression),r=this.lookahead,n=this.binaryPrecedence(r);if(n>0){this.nextToken(),r.prec=n,this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var i=[e,this.lookahead],s=t,a=this.isolateCoverGrammar(this.parseExponentiationExpression),o=[s,r,a];!((n=this.binaryPrecedence(this.lookahead))<=0);){for(;o.length>2&&n<=o[o.length-2].prec;){a=o.pop();var u=o.pop().value;s=o.pop(),i.pop();var c=this.startNode(i[i.length-1]);o.push(this.finalize(c,new l.BinaryExpression(u,s,a)))}(r=this.nextToken()).prec=n,o.push(r),i.push(this.lookahead),o.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var p=o.length-1;for(t=o[p],i.pop();p>1;){c=this.startNode(i.pop());t=this.finalize(c,new l.BinaryExpression(o[p-1].value,o[p-2],t)),p-=2}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var r=this.context.allowIn;this.context.allowIn=!0;var n=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=r,this.expect(":");var i=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new l.ConditionalExpression(t,n,i)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case u.Syntax.Identifier:this.validateParam(e,t,t.name);break;case u.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case u.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case u.Syntax.ArrayPattern:for(var r=0;r<t.elements.length;r++)null!==t.elements[r]&&this.checkPatternParam(e,t.elements[r]);break;case u.Syntax.YieldExpression:break;default:n.assert(t.type===u.Syntax.ObjectPattern,"Invalid type");for(r=0;r<t.properties.length;r++)this.checkPatternParam(e,t.properties[r].value)}},e.prototype.reinterpretAsCoverFormalsList=function(e){var t,r=[e];switch(e.type){case u.Syntax.Identifier:break;case c:r=e.params;break;default:return null}t={paramSet:{}};for(var n=0;n<r.length;++n){(s=r[n]).type===u.Syntax.AssignmentPattern&&s.right.type===u.Syntax.YieldExpression&&(s.right.argument&&this.throwUnexpectedToken(this.lookahead),s.right.type=u.Syntax.Identifier,s.right.name="yield",delete s.right.argument,delete s.right.delegate),this.checkPatternParam(t,s),r[n]=s}if(this.context.strict||!this.context.allowYield)for(n=0;n<r.length;++n){var s;(s=r[n]).type===u.Syntax.YieldExpression&&this.throwUnexpectedToken(this.lookahead)}if(t.message===i.Messages.StrictParamDupe){var a=this.context.strict?t.stricted:t.firstRestricted;this.throwUnexpectedToken(a,t.message)}return{params:r,stricted:t.stricted,firstRestricted:t.firstRestricted,message:t.message}},e.prototype.parseAssignmentExpression=function(){var e;if(!this.context.allowYield&&this.matchKeyword("yield"))e=this.parseYieldExpression();else{var t=this.lookahead,r=t;if((e=this.parseConditionalExpression()).type===c||this.match("=>")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var n=this.reinterpretAsCoverFormalsList(e);if(n){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var s=this.context.strict,a=this.context.allowYield;this.context.allowYield=!0;var o=this.startNode(t);this.expect("=>");var p=this.match("{")?this.parseFunctionSourceElements():this.isolateCoverGrammar(this.parseAssignmentExpression),h=p.type!==u.Syntax.BlockStatement;this.context.strict&&n.firstRestricted&&this.throwUnexpectedToken(n.firstRestricted,n.message),this.context.strict&&n.stricted&&this.tolerateUnexpectedToken(n.stricted,n.message),e=this.finalize(o,new l.ArrowFunctionExpression(n.params,p,h)),this.context.strict=s,this.context.allowYield=a}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(i.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===u.Syntax.Identifier){var f=e;this.scanner.isRestrictedWord(f.name)&&this.tolerateUnexpectedToken(r,i.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(f.name)&&this.tolerateUnexpectedToken(r,i.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),r=this.nextToken();var d=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new l.AssignmentExpression(r.value,e,d)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var r=[];for(r.push(t);this.startMarker.index<this.scanner.length&&this.match(",");)this.nextToken(),r.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new l.SequenceExpression(r))}return t},e.prototype.parseStatementListItem=function(){var e=null;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,this.lookahead.type===a.Token.Keyword)switch(this.lookahead.value){case"export":"module"!==this.sourceType&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":"module"!==this.sourceType&&this.tolerateUnexpectedToken(this.lookahead,i.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement()}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new l.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var r=this.createNode(),n=this.parsePattern([],e);this.context.strict&&n.type===u.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(i.Messages.StrictVarName);var s=null;return"const"===e?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.expect("="),s=this.isolateCoverGrammar(this.parseAssignmentExpression)):(!t.inFor&&n.type!==u.Syntax.Identifier||this.match("="))&&(this.expect("="),s=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(r,new l.VariableDeclarator(n,s))},e.prototype.parseBindingList=function(e,t){for(var r=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),r.push(this.parseLexicalBinding(e,t));return r},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.index,t=this.scanner.lineNumber,r=this.scanner.lineStart;this.collectComments();var n=this.scanner.lex();return this.scanner.index=e,this.scanner.lineNumber=t,this.scanner.lineStart=r,n.type===a.Token.Identifier||n.type===a.Token.Punctuator&&"["===n.value||n.type===a.Token.Punctuator&&"{"===n.value||n.type===a.Token.Keyword&&"let"===n.value||n.type===a.Token.Keyword&&"yield"===n.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),r=this.nextToken().value;n.assert("let"===r||"const"===r,"Lexical declaration must be either let or const");var i=this.parseBindingList(r,e);return this.consumeSemicolon(),this.finalize(t,new l.VariableDeclaration(i,r))},e.prototype.parseBindingRestElement=function(e,t){var r=this.createNode();this.expect("...");var n=this.parsePattern(e,t);return this.finalize(r,new l.RestElement(n))},e.prototype.parseArrayPattern=function(e,t){var r=this.createNode();this.expect("[");for(var n=[];!this.match("]");)if(this.match(","))this.nextToken(),n.push(null);else{if(this.match("...")){n.push(this.parseBindingRestElement(e,t));break}n.push(this.parsePatternWithDefault(e,t)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(r,new l.ArrayPattern(n))},e.prototype.parsePropertyPattern=function(e,t){var r,n,i=this.createNode(),s=!1,o=!1;if(this.lookahead.type===a.Token.Identifier){var u=this.lookahead;r=this.parseVariableIdentifier();var c=this.finalize(i,new l.Identifier(u.value));if(this.match("=")){e.push(u),o=!0,this.nextToken();var p=this.parseAssignmentExpression();n=this.finalize(this.startNode(u),new l.AssignmentPattern(c,p))}else this.match(":")?(this.expect(":"),n=this.parsePatternWithDefault(e,t)):(e.push(u),o=!0,n=c)}else s=this.match("["),r=this.parseObjectPropertyKey(),this.expect(":"),n=this.parsePatternWithDefault(e,t);return this.finalize(i,new l.Property("init",r,s,n,!1,o))},e.prototype.parseObjectPattern=function(e,t){var r=this.createNode(),n=[];for(this.expect("{");!this.match("}");)n.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(r,new l.ObjectPattern(n))},e.prototype.parsePattern=function(e,t){var r;return this.match("[")?r=this.parseArrayPattern(e,t):this.match("{")?r=this.parseObjectPattern(e,t):(!this.matchKeyword("let")||"const"!==t&&"let"!==t||this.tolerateUnexpectedToken(this.lookahead,i.Messages.UnexpectedToken),e.push(this.lookahead),r=this.parseVariableIdentifier(t)),r},e.prototype.parsePatternWithDefault=function(e,t){var r=this.lookahead,n=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var i=this.context.allowYield;this.context.allowYield=!0;var s=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=i,n=this.finalize(this.startNode(r),new l.AssignmentPattern(n,s))}return n},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),r=this.nextToken();return r.type===a.Token.Keyword&&"yield"===r.value?(this.context.strict&&this.tolerateUnexpectedToken(r,i.Messages.StrictReservedWord),this.context.allowYield||this.throwUnexpectedToken(r)):r.type!==a.Token.Identifier?this.context.strict&&r.type===a.Token.Keyword&&this.scanner.isStrictModeReservedWord(r.value)?this.tolerateUnexpectedToken(r,i.Messages.StrictReservedWord):(this.context.strict||"let"!==r.value||"var"!==e)&&this.throwUnexpectedToken(r):"module"===this.sourceType&&r.type===a.Token.Identifier&&"await"===r.value&&this.tolerateUnexpectedToken(r),this.finalize(t,new l.Identifier(r.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),r=this.parsePattern([],"var");this.context.strict&&r.type===u.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictVarName);var n=null;return this.match("=")?(this.nextToken(),n=this.isolateCoverGrammar(this.parseAssignmentExpression)):r.type===u.Syntax.Identifier||e.inFor||this.expect("="),this.finalize(t,new l.VariableDeclarator(r,n))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},r=[];for(r.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),r.push(this.parseVariableDeclaration(t));return r},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new l.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new l.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new l.ExpressionStatement(t))},e.prototype.parseIfStatement=function(){var e,t=this.createNode(),r=null;this.expectKeyword("if"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new l.EmptyStatement)):(this.expect(")"),e=this.parseStatement(),this.matchKeyword("else")&&(this.nextToken(),r=this.parseStatement())),this.finalize(t,new l.IfStatement(n,e,r))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var r=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();return this.expect(")"),this.match(";")&&this.nextToken(),this.finalize(e,new l.DoWhileStatement(r,n))},e.prototype.parseWhileStatement=function(){var e,t=this.createNode();this.expectKeyword("while"),this.expect("(");var r=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var n=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=n}return this.finalize(t,new l.WhileStatement(r,e))},e.prototype.parseForStatement=function(){var e,t,r=null,n=null,s=null,a=!0,o=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){r=this.createNode(),this.nextToken();var c=this.context.allowIn;this.context.allowIn=!1;var p=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=c,1===p.length&&this.matchKeyword("in")){var h=p[0];h.init&&(h.id.type===u.Syntax.ArrayPattern||h.id.type===u.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(i.Messages.ForInOfLoopInitializer,"for-in"),r=this.finalize(r,new l.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseExpression(),r=null}else 1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new l.VariableDeclaration(p,"var")),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,a=!1):(r=this.finalize(r,new l.VariableDeclaration(p,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){r=this.createNode();var f=this.nextToken().value;if(this.context.strict||"in"!==this.lookahead.value){c=this.context.allowIn;this.context.allowIn=!1;p=this.parseBindingList(f,{inFor:!0});this.context.allowIn=c,1===p.length&&null===p[0].init&&this.matchKeyword("in")?(r=this.finalize(r,new l.VariableDeclaration(p,f)),this.nextToken(),e=r,t=this.parseExpression(),r=null):1===p.length&&null===p[0].init&&this.matchContextualKeyword("of")?(r=this.finalize(r,new l.VariableDeclaration(p,f)),this.nextToken(),e=r,t=this.parseAssignmentExpression(),r=null,a=!1):(this.consumeSemicolon(),r=this.finalize(r,new l.VariableDeclaration(p,f)))}else r=this.finalize(r,new l.Identifier(f)),this.nextToken(),e=r,t=this.parseExpression(),r=null}else{var d=this.lookahead;c=this.context.allowIn;if(this.context.allowIn=!1,r=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=c,this.matchKeyword("in"))this.context.isAssignmentTarget&&r.type!==u.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseExpression(),r=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&r.type!==u.Syntax.AssignmentExpression||this.tolerateError(i.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(r),e=r,t=this.parseAssignmentExpression(),r=null,a=!1;else{if(this.match(",")){for(var m=[r];this.match(",");)this.nextToken(),m.push(this.isolateCoverGrammar(this.parseAssignmentExpression));r=this.finalize(this.startNode(d),new l.SequenceExpression(m))}this.expect(";")}}void 0===e&&(this.match(";")||(n=this.parseExpression()),this.expect(";"),this.match(")")||(s=this.parseExpression()));var y;if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),y=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var g=this.context.inIteration;this.context.inIteration=!0,y=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=g}return void 0===e?this.finalize(o,new l.ForStatement(r,n,s,y)):a?this.finalize(o,new l.ForInStatement(e,t,y)):this.finalize(o,new l.ForOfStatement(e,t,y))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(this.lookahead.type===a.Token.Identifier&&!this.hasLineTerminator){var r="$"+(t=this.parseVariableIdentifier()).name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,t.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(i.Messages.IllegalContinue),this.finalize(e,new l.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(this.lookahead.type===a.Token.Identifier&&!this.hasLineTerminator){var r="$"+(t=this.parseVariableIdentifier()).name;Object.prototype.hasOwnProperty.call(this.context.labelSet,r)||this.throwError(i.Messages.UnknownLabel,t.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(i.Messages.IllegalBreak),this.finalize(e,new l.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(i.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&this.lookahead.type!==a.Token.EOF?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(e,new l.ReturnStatement(t))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(i.Messages.StrictModeWith);var e=this.createNode();this.expectKeyword("with"),this.expect("(");var t=this.parseExpression();this.expect(")");var r=this.parseStatement();return this.finalize(e,new l.WithStatement(t,r))},e.prototype.parseSwitchCase=function(){var e,t=this.createNode();this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");for(var r=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)r.push(this.parseStatementListItem());return this.finalize(t,new l.SwitchCase(e,r))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var r=this.context.inSwitch;this.context.inSwitch=!0;var n=[],s=!1;for(this.expect("{");!this.match("}");){var a=this.parseSwitchCase();null===a.test&&(s&&this.throwError(i.Messages.MultipleDefaultsInSwitch),s=!0),n.push(a)}return this.expect("}"),this.context.inSwitch=r,this.finalize(e,new l.SwitchStatement(t,n))},e.prototype.parseLabelledStatement=function(){var e,t=this.createNode(),r=this.parseExpression();if(r.type===u.Syntax.Identifier&&this.match(":")){this.nextToken();var n=r,s="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,s)&&this.throwError(i.Messages.Redeclaration,"Label",n.name),this.context.labelSet[s]=!0;var a=this.parseStatement();delete this.context.labelSet[s],e=new l.LabeledStatement(n,a)}else this.consumeSemicolon(),e=new l.ExpressionStatement(r);return this.finalize(t,e)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(i.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new l.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],r=this.parsePattern(t),n={},s=0;s<t.length;s++){var a="$"+t[s].value;Object.prototype.hasOwnProperty.call(n,a)&&this.tolerateError(i.Messages.DuplicateBinding,t[s].value),n[a]=!0}this.context.strict&&r.type===u.Syntax.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(i.Messages.StrictCatchVariable),this.expect(")");var o=this.parseBlock();return this.finalize(e,new l.CatchClause(r,o))},e.prototype.parseFinallyClause=function(){return this.expectKeyword("finally"),this.parseBlock()},e.prototype.parseTryStatement=function(){var e=this.createNode();this.expectKeyword("try");var t=this.parseBlock(),r=this.matchKeyword("catch")?this.parseCatchClause():null,n=this.matchKeyword("finally")?this.parseFinallyClause():null;return r||n||this.throwError(i.Messages.NoCatchOrFinally),this.finalize(e,new l.TryStatement(t,r,n))},e.prototype.parseDebuggerStatement=function(){var e=this.createNode();return this.expectKeyword("debugger"),this.consumeSemicolon(),this.finalize(e,new l.DebuggerStatement)},e.prototype.parseStatement=function(){var e=null;switch(this.lookahead.type){case a.Token.BooleanLiteral:case a.Token.NullLiteral:case a.Token.NumericLiteral:case a.Token.StringLiteral:case a.Token.Template:case a.Token.RegularExpression:e=this.parseExpressionStatement();break;case a.Token.Punctuator:var t=this.lookahead.value;e="{"===t?this.parseBlock():"("===t?this.parseExpressionStatement():";"===t?this.parseEmptyStatement():this.parseExpressionStatement();break;case a.Token.Identifier:e=this.parseLabelledStatement();break;case a.Token.Keyword:switch(this.lookahead.value){case"break":e=this.parseBreakStatement();break;case"continue":e=this.parseContinueStatement();break;case"debugger":e=this.parseDebuggerStatement();break;case"do":e=this.parseDoWhileStatement();break;case"for":e=this.parseForStatement();break;case"function":e=this.parseFunctionDeclaration();break;case"if":e=this.parseIfStatement();break;case"return":e=this.parseReturnStatement();break;case"switch":e=this.parseSwitchStatement();break;case"throw":e=this.parseThrowStatement();break;case"try":e=this.parseTryStatement();break;case"var":e=this.parseVariableStatement();break;case"while":e=this.parseWhileStatement();break;case"with":e=this.parseWithStatement();break;default:e=this.parseExpressionStatement()}break;default:this.throwUnexpectedToken(this.lookahead)}return e},e.prototype.parseFunctionSourceElements=function(){var e=this.createNode();this.expect("{");var t=this.parseDirectivePrologues(),r=this.context.labelSet,n=this.context.inIteration,i=this.context.inSwitch,s=this.context.inFunctionBody;for(this.context.labelSet={},this.context.inIteration=!1,this.context.inSwitch=!1,this.context.inFunctionBody=!0;this.startMarker.index<this.scanner.length&&!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.context.labelSet=r,this.context.inIteration=n,this.context.inSwitch=i,this.context.inFunctionBody=s,this.finalize(e,new l.BlockStatement(t))},e.prototype.validateParam=function(e,t,r){var n="$"+r;this.context.strict?(this.scanner.isRestrictedWord(r)&&(e.stricted=t,e.message=i.Messages.StrictParamName),Object.prototype.hasOwnProperty.call(e.paramSet,n)&&(e.stricted=t,e.message=i.Messages.StrictParamDupe)):e.firstRestricted||(this.scanner.isRestrictedWord(r)?(e.firstRestricted=t,e.message=i.Messages.StrictParamName):this.scanner.isStrictModeReservedWord(r)?(e.firstRestricted=t,e.message=i.Messages.StrictReservedWord):Object.prototype.hasOwnProperty.call(e.paramSet,n)&&(e.stricted=t,e.message=i.Messages.StrictParamDupe)),"function"==typeof Object.defineProperty?Object.defineProperty(e.paramSet,n,{value:!0,enumerable:!0,writable:!0,configurable:!0}):e.paramSet[n]=!0},e.prototype.parseRestElement=function(e){var t=this.createNode();this.expect("...");var r=this.parsePattern(e);return this.match("=")&&this.throwError(i.Messages.DefaultRestParameter),this.match(")")||this.throwError(i.Messages.ParameterAfterRestParameter),this.finalize(t,new l.RestElement(r))},e.prototype.parseFormalParameter=function(e){for(var t=[],r=this.match("...")?this.parseRestElement(t):this.parsePatternWithDefault(t),n=0;n<t.length;n++)this.validateParam(e,t[n],t[n].value);return e.params.push(r),!this.match(")")},e.prototype.parseFormalParameters=function(e){var t;if(t={params:[],firstRestricted:e},this.expect("("),!this.match(")"))for(t.paramSet={};this.startMarker.index<this.scanner.length&&this.parseFormalParameter(t);)this.expect(",");return this.expect(")"),{params:t.params,stricted:t.stricted,firstRestricted:t.firstRestricted,message:t.message}},e.prototype.parseFunctionDeclaration=function(e){var t=this.createNode();this.expectKeyword("function");var r=this.match("*");r&&this.nextToken();var n,s=null,a=null;if(!e||!this.match("(")){var o=this.lookahead;s=this.parseVariableIdentifier(),this.context.strict?this.scanner.isRestrictedWord(o.value)&&this.tolerateUnexpectedToken(o,i.Messages.StrictFunctionName):this.scanner.isRestrictedWord(o.value)?(a=o,n=i.Messages.StrictFunctionName):this.scanner.isStrictModeReservedWord(o.value)&&(a=o,n=i.Messages.StrictReservedWord)}var u=this.context.allowYield;this.context.allowYield=!r;var c=this.parseFormalParameters(a),p=c.params,h=c.stricted;a=c.firstRestricted,c.message&&(n=c.message);var f=this.context.strict,d=this.parseFunctionSourceElements();return this.context.strict&&a&&this.throwUnexpectedToken(a,n),this.context.strict&&h&&this.tolerateUnexpectedToken(h,n),this.context.strict=f,this.context.allowYield=u,this.finalize(t,new l.FunctionDeclaration(s,p,d,r))},e.prototype.parseFunctionExpression=function(){var e=this.createNode();this.expectKeyword("function");var t=this.match("*");t&&this.nextToken();var r,n,s=null,a=this.context.allowYield;if(this.context.allowYield=!t,!this.match("(")){var o=this.lookahead;s=this.context.strict||t||!this.matchKeyword("yield")?this.parseVariableIdentifier():this.parseIdentifierName(),this.context.strict?this.scanner.isRestrictedWord(o.value)&&this.tolerateUnexpectedToken(o,i.Messages.StrictFunctionName):this.scanner.isRestrictedWord(o.value)?(n=o,r=i.Messages.StrictFunctionName):this.scanner.isStrictModeReservedWord(o.value)&&(n=o,r=i.Messages.StrictReservedWord)}var u=this.parseFormalParameters(n),c=u.params,p=u.stricted;n=u.firstRestricted,u.message&&(r=u.message);var h=this.context.strict,f=this.parseFunctionSourceElements();return this.context.strict&&n&&this.throwUnexpectedToken(n,r),this.context.strict&&p&&this.tolerateUnexpectedToken(p,r),this.context.strict=h,this.context.allowYield=a,this.finalize(e,new l.FunctionExpression(s,c,f,t))},e.prototype.parseDirective=function(){var e=this.lookahead,t=null,r=this.createNode(),n=this.parseExpression();return n.type===u.Syntax.Literal&&(t=this.getTokenRaw(e).slice(1,-1)),this.consumeSemicolon(),this.finalize(r,t?new l.Directive(n,t):new l.ExpressionStatement(n))},e.prototype.parseDirectivePrologues=function(){for(var e=null,t=[];;){var r=this.lookahead;if(r.type!==a.Token.StringLiteral)break;var n=this.parseDirective();t.push(n);var s=n.directive;if("string"!=typeof s)break;"use strict"===s?(this.context.strict=!0,e&&this.tolerateUnexpectedToken(e,i.Messages.StrictOctalLiteral)):!e&&r.octal&&(e=r)}return t},e.prototype.qualifiedPropertyName=function(e){switch(e.type){case a.Token.Identifier:case a.Token.StringLiteral:case a.Token.BooleanLiteral:case a.Token.NullLiteral:case a.Token.NumericLiteral:case a.Token.Keyword:return!0;case a.Token.Punctuator:return"["===e.value}return!1},e.prototype.parseGetterMethod=function(){var e=this.createNode();this.expect("("),this.expect(")");var t={params:[],stricted:null,firstRestricted:null,message:null},r=this.context.allowYield;this.context.allowYield=!1;var n=this.parsePropertyMethod(t);return this.context.allowYield=r,this.finalize(e,new l.FunctionExpression(null,t.params,n,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t={params:[],firstRestricted:null,paramSet:{}},r=this.context.allowYield;this.context.allowYield=!1,this.expect("("),this.match(")")?this.tolerateUnexpectedToken(this.lookahead):this.parseFormalParameter(t),this.expect(")");var n=this.parsePropertyMethod(t);return this.context.allowYield=r,this.finalize(e,new l.FunctionExpression(null,t.params,n,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var r=this.parseFormalParameters();this.context.allowYield=!1;var n=this.parsePropertyMethod(r);return this.context.allowYield=t,this.finalize(e,new l.FunctionExpression(null,r.params,n,!0))},e.prototype.isStartOfExpression=function(){var e=!0,t=this.lookahead.value;switch(this.lookahead.type){case a.Token.Punctuator:e="["===t||"("===t||"{"===t||"+"===t||"-"===t||"!"===t||"~"===t||"++"===t||"--"===t||"/"===t||"/="===t;break;case a.Token.Keyword:e="class"===t||"delete"===t||"function"===t||"let"===t||"new"===t||"super"===t||"this"===t||"typeof"===t||"void"===t||"yield"===t}return e},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,r=!1;if(!this.hasLineTerminator){var n=this.context.allowYield;this.context.allowYield=!1,(r=this.match("*"))?(this.nextToken(),t=this.parseAssignmentExpression()):this.isStartOfExpression()&&(t=this.parseAssignmentExpression()),this.context.allowYield=n}return this.finalize(e,new l.YieldExpression(t,r))},e.prototype.parseClassElement=function(e){var t,r,n,s=this.lookahead,o=this.createNode(),u=!1,c=!1,p=!1;if(this.match("*"))this.nextToken();else{u=this.match("[");"static"===(r=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(s=this.lookahead,p=!0,u=this.match("["),this.match("*")?this.nextToken():r=this.parseObjectPropertyKey())}var h=this.qualifiedPropertyName(this.lookahead);return s.type===a.Token.Identifier?"get"===s.value&&h?(t="get",u=this.match("["),r=this.parseObjectPropertyKey(),this.context.allowYield=!1,n=this.parseGetterMethod()):"set"===s.value&&h&&(t="set",u=this.match("["),r=this.parseObjectPropertyKey(),n=this.parseSetterMethod()):s.type===a.Token.Punctuator&&"*"===s.value&&h&&(t="init",u=this.match("["),r=this.parseObjectPropertyKey(),n=this.parseGeneratorMethod(),c=!0),!t&&r&&this.match("(")&&(t="init",n=this.parsePropertyMethodFunction(),c=!0),t||this.throwUnexpectedToken(this.lookahead),"init"===t&&(t="method"),u||(p&&this.isPropertyKey(r,"prototype")&&this.throwUnexpectedToken(s,i.Messages.StaticPrototype),!p&&this.isPropertyKey(r,"constructor")&&("method"===t&&c&&!n.generator||this.throwUnexpectedToken(s,i.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(s,i.Messages.DuplicateConstructor):e.value=!0,t="constructor")),this.finalize(o,new l.MethodDefinition(r,u,n,t,p))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new l.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),r=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=e&&this.lookahead.type!==a.Token.Identifier?null:this.parseVariableIdentifier(),i=null;this.matchKeyword("extends")&&(this.nextToken(),i=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var s=this.parseClassBody();return this.context.strict=r,this.finalize(t,new l.ClassDeclaration(n,i,s))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var r=this.lookahead.type===a.Token.Identifier?this.parseVariableIdentifier():null,n=null;this.matchKeyword("extends")&&(this.nextToken(),n=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var i=this.parseClassBody();return this.context.strict=t,this.finalize(e,new l.ClassExpression(r,n,i))},e.prototype.parseProgram=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();this.startMarker.index<this.scanner.length;)t.push(this.parseStatementListItem());return this.finalize(e,new l.Program(t,this.sourceType))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();this.lookahead.type!==a.Token.StringLiteral&&this.throwError(i.Messages.InvalidModuleSpecifier);var t=this.nextToken(),r=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,r))},e.prototype.parseImportSpecifier=function(){var e,t,r=this.createNode();return this.lookahead.type===a.Token.Identifier?(t=e=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),t=this.parseVariableIdentifier())):(t=e=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),t=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(r,new l.ImportSpecifier(t,e))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new l.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(i.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new l.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalImportDeclaration);var e=this.createNode();this.expectKeyword("import");var t,r=[];if(this.lookahead.type===a.Token.StringLiteral)t=this.parseModuleSpecifier();else{if(this.match("{")?r=r.concat(this.parseNamedImports()):this.match("*")?r.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(r.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?r.push(this.parseImportNamespaceSpecifier()):this.match("{")?r=r.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var n=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(n,this.lookahead.value)}this.nextToken(),t=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(e,new l.ImportDeclaration(r,t))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),r=t;return this.matchContextualKeyword("as")&&(this.nextToken(),r=this.parseIdentifierName()),this.finalize(e,new l.ExportSpecifier(t,r))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(i.Messages.IllegalExportDeclaration);var e=this.createNode();this.expectKeyword("export");var t;if(this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var r=this.parseFunctionDeclaration(!0);t=this.finalize(e,new l.ExportDefaultDeclaration(r))}else if(this.matchKeyword("class")){r=this.parseClassDeclaration(!0);t=this.finalize(e,new l.ExportDefaultDeclaration(r))}else{this.matchContextualKeyword("from")&&this.throwError(i.Messages.UnexpectedToken,this.lookahead.value);r=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();this.consumeSemicolon(),t=this.finalize(e,new l.ExportDefaultDeclaration(r))}else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var n=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(n,this.lookahead.value)}this.nextToken();var s=this.parseModuleSpecifier();this.consumeSemicolon(),t=this.finalize(e,new l.ExportAllDeclaration(s))}else if(this.lookahead.type===a.Token.Keyword){r=void 0;switch(this.lookahead.value){case"let":case"const":r=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":r=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}t=this.finalize(e,new l.ExportNamedDeclaration(r,[],null))}else{var o=[],u=null,c=!1;for(this.expect("{");!this.match("}");)c=c||this.matchKeyword("default"),o.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.nextToken(),u=this.parseModuleSpecifier(),this.consumeSemicolon();else if(c){n=this.lookahead.value?i.Messages.UnexpectedToken:i.Messages.MissingFromClause;this.throwError(n,this.lookahead.value)}else this.consumeSemicolon();t=this.finalize(e,new l.ExportNamedDeclaration(null,o,u))}return t},e}();t.Parser=p},function(e,t){"use strict";t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";t.Messages={UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",DefaultRestParameter:"Unexpected token =",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ConstructorSpecialMethod:"Class constructor may not be an accessor",DuplicateConstructor:"A class may only have one constructor",StaticPrototype:"Classes may not have static property named prototype",MissingFromClause:"Unexpected token",NoAsAfterImportNamespace:"Unexpected token",InvalidModuleSpecifier:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalExportDeclaration:"Unexpected token",DuplicateBinding:"Duplicate binding %0",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer"}},function(e,t){"use strict";var r=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(!this.tolerant)throw e;this.recordError(e)},e.prototype.constructError=function(e,t){var r=new Error(e);try{throw r}catch(e){Object.create&&Object.defineProperty&&(r=Object.create(e),Object.defineProperty(r,"column",{value:t}))}finally{return r}},e.prototype.createError=function(e,t,r,n){var i="Line "+t+": "+n,s=this.constructError(i,r);return s.index=e,s.lineNumber=t,s.description=n,s},e.prototype.throwError=function(e,t,r,n){throw this.createError(e,t,r,n)},e.prototype.tolerateError=function(e,t,r,n){var i=this.createError(e,t,r,n);if(!this.tolerant)throw i;this.recordError(i)},e}();t.ErrorHandler=r},function(e,t){"use strict";!function(e){e[e.BooleanLiteral=1]="BooleanLiteral",e[e.EOF=2]="EOF",e[e.Identifier=3]="Identifier",e[e.Keyword=4]="Keyword",e[e.NullLiteral=5]="NullLiteral",e[e.NumericLiteral=6]="NumericLiteral",e[e.Punctuator=7]="Punctuator",e[e.StringLiteral=8]="StringLiteral",e[e.RegularExpression=9]="RegularExpression",e[e.Template=10]="Template"}(t.Token||(t.Token={}));var r=t.Token;t.TokenName={},t.TokenName[r.BooleanLiteral]="Boolean",t.TokenName[r.EOF]="<end>",t.TokenName[r.Identifier]="Identifier",t.TokenName[r.Keyword]="Keyword",t.TokenName[r.NullLiteral]="Null",t.TokenName[r.NumericLiteral]="Numeric",t.TokenName[r.Punctuator]="Punctuator",t.TokenName[r.StringLiteral]="String",t.TokenName[r.RegularExpression]="RegularExpression",t.TokenName[r.Template]="Template"},function(e,t,r){"use strict";function n(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function i(e){return"01234567".indexOf(e)}var s=r(4),a=r(5),o=r(9),u=r(7),l=function(){function e(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.length=e.length,this.index=0,this.lineNumber=e.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return e.prototype.eof=function(){return this.index>=this.length},e.prototype.throwUnexpectedToken=function(e){void 0===e&&(e=a.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},e.prototype.tolerateUnexpectedToken=function(){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,a.Messages.UnexpectedTokenIllegal)},e.prototype.skipSingleLineComment=function(e){var t,r,n;for(this.trackComment&&(t=[],r=this.index-e,n={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var i=this.source.charCodeAt(this.index);if(++this.index,o.Character.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};var s={multiLine:!1,slice:[r+e,this.index-1],range:[r,this.index-1],loc:n};t.push(s)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t}}if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart};s={multiLine:!1,slice:[r+e,this.index],range:[r,this.index],loc:n};t.push(s)}return t},e.prototype.skipMultiLineComment=function(){var e,t,r;for(this.trackComment&&(e=[],t=this.index-2,r={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var n=this.source.charCodeAt(this.index);if(o.Character.isLineTerminator(n))13===n&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===n){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){r.end={line:this.lineNumber,column:this.index-this.lineStart};var i={multiLine:!0,slice:[t+2,this.index-2],range:[t,this.index],loc:r};e.push(i)}return e}++this.index}else++this.index}if(this.trackComment){r.end={line:this.lineNumber,column:this.index-this.lineStart};i={multiLine:!0,slice:[t+2,this.index],range:[t,this.index],loc:r};e.push(i)}return this.tolerateUnexpectedToken(),e},e.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index;!this.eof();){var r=this.source.charCodeAt(this.index);if(o.Character.isWhiteSpace(r))++this.index;else if(o.Character.isLineTerminator(r))++this.index,13===r&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===r)if(47===(r=this.source.charCodeAt(this.index+1))){this.index+=2;var n=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(n)),t=!0}else{if(42!==r)break;this.index+=2;n=this.skipMultiLineComment();this.trackComment&&(e=e.concat(n))}else if(t&&45===r){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3;n=this.skipSingleLineComment(3);this.trackComment&&(e=e.concat(n))}else{if(60!==r)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4;n=this.skipSingleLineComment(4);this.trackComment&&(e=e.concat(n))}}return e},e.prototype.isFutureReservedWord=function(e){switch(e){case"enum":case"export":case"import":case"super":return!0;default:return!1}},e.prototype.isStrictModeReservedWord=function(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},e.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},e.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}},e.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(t>=55296&&t<=56319){var r=this.source.charCodeAt(e+1);if(r>=56320&&r<=57343){t=1024*(t-55296)+r-56320+65536}}return t},e.prototype.scanHexEscape=function(e){for(var t="u"===e?4:2,r=0,i=0;i<t;++i){if(this.eof()||!o.Character.isHexDigit(this.source.charCodeAt(this.index)))return"";r=16*r+n(this.source[this.index++])}return String.fromCharCode(r)},e.prototype.scanUnicodeCodePointEscape=function(){var e=this.source[this.index],t=0;for("}"===e&&this.throwUnexpectedToken();!this.eof()&&(e=this.source[this.index++],o.Character.isHexDigit(e.charCodeAt(0)));)t=16*t+n(e);return(t>1114111||"}"!==e)&&this.throwUnexpectedToken(),o.Character.fromCodePoint(t)},e.prototype.getIdentifier=function(){for(var e=this.index++;!this.eof();){var t=this.source.charCodeAt(this.index);if(92===t)return this.index=e,this.getComplexIdentifier();if(t>=55296&&t<57343)return this.index=e,this.getComplexIdentifier();if(!o.Character.isIdentifierPart(t))break;++this.index}return this.source.slice(e,this.index)},e.prototype.getComplexIdentifier=function(){var e=this.codePointAt(this.index),t=o.Character.fromCodePoint(e);this.index+=t.length;var r;for(92===e&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,r=this.scanUnicodeCodePointEscape()):(e=(r=this.scanHexEscape("u")).charCodeAt(0),r&&"\\"!==r&&o.Character.isIdentifierStart(e)||this.throwUnexpectedToken()),t=r);!this.eof()&&(e=this.codePointAt(this.index),o.Character.isIdentifierPart(e));)t+=r=o.Character.fromCodePoint(e),this.index+=r.length,92===e&&(t=t.substr(0,t.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,r=this.scanUnicodeCodePointEscape()):(e=(r=this.scanHexEscape("u")).charCodeAt(0),r&&"\\"!==r&&o.Character.isIdentifierPart(e)||this.throwUnexpectedToken()),t+=r);return t},e.prototype.octalToDecimal=function(e){var t="0"!==e,r=i(e);return!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,r=8*r+i(this.source[this.index++]),"0123".indexOf(e)>=0&&!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(r=8*r+i(this.source[this.index++]))),{code:r,octal:t}},e.prototype.scanIdentifier=function(){var e,t=this.index,r=92===this.source.charCodeAt(t)?this.getComplexIdentifier():this.getIdentifier();return e=1===r.length?u.Token.Identifier:this.isKeyword(r)?u.Token.Keyword:"null"===r?u.Token.NullLiteral:"true"===r||"false"===r?u.Token.BooleanLiteral:u.Token.Identifier,{type:e,value:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.scanPunctuator=function(){var e={type:u.Token.Punctuator,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index},t=this.source[this.index];switch(t){case"(":case"{":"{"===t&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(t=this.source.substr(this.index,4))?this.index+=4:"==="===(t=t.substr(0,3))||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:"&&"===(t=t.substr(0,2))||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],"<>=!+-*%&|^/".indexOf(t)>=0&&++this.index)}return this.index===e.start&&this.throwUnexpectedToken(),e.end=this.index,e.value=t,e},e.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&o.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:u.Token.NumericLiteral,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanBinaryLiteral=function(e){for(var t,r="";!this.eof()&&("0"===(t=this.source[this.index])||"1"===t);)r+=this.source[this.index++];return 0===r.length&&this.throwUnexpectedToken(),this.eof()||(t=this.source.charCodeAt(this.index),(o.Character.isIdentifierStart(t)||o.Character.isDecimalDigit(t))&&this.throwUnexpectedToken()),{type:u.Token.NumericLiteral,value:parseInt(r,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanOctalLiteral=function(e,t){var r="",n=!1;for(o.Character.isOctalDigit(e.charCodeAt(0))?(n=!0,r="0"+this.source[this.index++]):++this.index;!this.eof()&&o.Character.isOctalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];return n||0!==r.length||this.throwUnexpectedToken(),(o.Character.isIdentifierStart(this.source.charCodeAt(this.index))||o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:u.Token.NumericLiteral,value:parseInt(r,8),octal:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},e.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1;e<this.length;++e){var t=this.source[e];if("8"===t||"9"===t)return!1;if(!o.Character.isOctalDigit(t.charCodeAt(0)))return!0}return!0},e.prototype.scanNumericLiteral=function(){var e=this.index,t=this.source[e];s.assert(o.Character.isDecimalDigit(t.charCodeAt(0))||"."===t,"Numeric literal must start with a decimal digit or a decimal point");var r="";if("."!==t){if(r=this.source[this.index++],t=this.source[this.index],"0"===r){if("x"===t||"X"===t)return++this.index,this.scanHexLiteral(e);if("b"===t||"B"===t)return++this.index,this.scanBinaryLiteral(e);if("o"===t||"O"===t)return this.scanOctalLiteral(t,e);if(t&&o.Character.isOctalDigit(t.charCodeAt(0))&&this.isImplicitOctalLiteral())return this.scanOctalLiteral(t,e)}for(;o.Character.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];t=this.source[this.index]}if("."===t){for(r+=this.source[this.index++];o.Character.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];t=this.source[this.index]}if("e"===t||"E"===t)if(r+=this.source[this.index++],"+"!==(t=this.source[this.index])&&"-"!==t||(r+=this.source[this.index++]),o.Character.isDecimalDigit(this.source.charCodeAt(this.index)))for(;o.Character.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];else this.throwUnexpectedToken();return o.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:u.Token.NumericLiteral,value:parseFloat(r),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanStringLiteral=function(){var e=this.index,t=this.source[e];s.assert("'"===t||'"'===t,"String literal must starts with a quote"),++this.index;for(var r=!1,n="";!this.eof();){var i=this.source[this.index++];if(i===t){t="";break}if("\\"===i)if((i=this.source[this.index++])&&o.Character.isLineTerminator(i.charCodeAt(0)))++this.lineNumber,"\r"===i&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(i){case"u":case"x":if("{"===this.source[this.index])++this.index,n+=this.scanUnicodeCodePointEscape();else{var a=this.scanHexEscape(i);a||this.throwUnexpectedToken(),n+=a}break;case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;case"8":case"9":n+=i,this.tolerateUnexpectedToken();break;default:if(i&&o.Character.isOctalDigit(i.charCodeAt(0))){var l=this.octalToDecimal(i);r=l.octal||r,n+=String.fromCharCode(l.code)}else n+=i}else{if(o.Character.isLineTerminator(i.charCodeAt(0)))break;n+=i}}return""!==t&&(this.index=e,this.throwUnexpectedToken()),{type:u.Token.StringLiteral,value:n,octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.scanTemplate=function(){var e="",t=!1,r=this.index,n="`"===this.source[r],i=!1,s=2;for(++this.index;!this.eof();){var l=this.source[this.index++];if("`"===l){s=1,i=!0,t=!0;break}if("$"===l){if("{"===this.source[this.index]){this.curlyStack.push("${"),++this.index,t=!0;break}e+=l}else if("\\"===l)if(l=this.source[this.index++],o.Character.isLineTerminator(l.charCodeAt(0)))++this.lineNumber,"\r"===l&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(l){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"u":case"x":if("{"===this.source[this.index])++this.index,e+=this.scanUnicodeCodePointEscape();else{var c=this.index,p=this.scanHexEscape(l);p?e+=p:(this.index=c,e+=l)}break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:"0"===l?(o.Character.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(a.Messages.TemplateOctalLiteral),e+="\0"):o.Character.isOctalDigit(l.charCodeAt(0))?this.throwUnexpectedToken(a.Messages.TemplateOctalLiteral):e+=l}else o.Character.isLineTerminator(l.charCodeAt(0))?(++this.lineNumber,"\r"===l&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index,e+="\n"):e+=l}return t||this.throwUnexpectedToken(),n||this.curlyStack.pop(),{type:u.Token.Template,value:{cooked:e,raw:this.source.slice(r+1,this.index-s)},head:n,tail:i,lineNumber:this.lineNumber,lineStart:this.lineStart,start:r,end:this.index}},e.prototype.testRegExp=function(e,t){var r=e,n=this;t.indexOf("u")>=0&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,function(e,t,r){var i=parseInt(t||r,16);return i>1114111&&n.throwUnexpectedToken(a.Messages.InvalidRegExp),i<=65535?String.fromCharCode(i):"￿"}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(r)}catch(e){this.throwUnexpectedToken(a.Messages.InvalidRegExp)}try{return new RegExp(e,t)}catch(e){return null}},e.prototype.scanRegExpBody=function(){var e=this.source[this.index];s.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],r=!1,n=!1;!this.eof();)if(e=this.source[this.index++],t+=e,"\\"===e)e=this.source[this.index++],o.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(a.Messages.UnterminatedRegExp),t+=e;else if(o.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(a.Messages.UnterminatedRegExp);else if(r)"]"===e&&(r=!1);else{if("/"===e){n=!0;break}"["===e&&(r=!0)}n||this.throwUnexpectedToken(a.Messages.UnterminatedRegExp);return{value:t.substr(1,t.length-2),literal:t}},e.prototype.scanRegExpFlags=function(){for(var e="",t="";!this.eof();){var r=this.source[this.index];if(!o.Character.isIdentifierPart(r.charCodeAt(0)))break;if(++this.index,"\\"!==r||this.eof())t+=r,e+=r;else if("u"===(r=this.source[this.index])){++this.index;var n=this.index;if(r=this.scanHexEscape("u"))for(t+=r,e+="\\u";n<this.index;++n)e+=this.source[n];else this.index=n,t+="u",e+="\\u";this.tolerateUnexpectedToken()}else e+="\\",this.tolerateUnexpectedToken()}return{value:t,literal:e}},e.prototype.scanRegExp=function(){var e=this.index,t=this.scanRegExpBody(),r=this.scanRegExpFlags(),n=this.testRegExp(t.value,r.value);return{type:u.Token.RegularExpression,value:n,literal:t.literal+r.literal,regex:{pattern:t.value,flags:r.value},lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},e.prototype.lex=function(){if(this.eof())return{type:u.Token.EOF,lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};var e=this.source.charCodeAt(this.index);return o.Character.isIdentifierStart(e)?this.scanIdentifier():40===e||41===e||59===e?this.scanPunctuator():39===e||34===e?this.scanStringLiteral():46===e?o.Character.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():o.Character.isDecimalDigit(e)?this.scanNumericLiteral():96===e||125===e&&"${"===this.curlyStack[this.curlyStack.length-1]?this.scanTemplate():e>=55296&&e<57343&&o.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},e}();t.Scanner=l},function(e,t){"use strict";var r={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};t.Character={fromCodePoint:function(e){return e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&r.NonAsciiIdentifierStart.test(t.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&r.NonAsciiIdentifierPart.test(t.Character.fromCodePoint(e))},isDecimalDigit:function(e){return e>=48&&e<=57},isHexDigit:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},isOctalDigit:function(e){return e>=48&&e<=55}}},function(e,t,r){"use strict";var n=r(2),i=function(){return function(e){this.type=n.Syntax.ArrayExpression,this.elements=e}}();t.ArrayExpression=i;var s=function(){return function(e){this.type=n.Syntax.ArrayPattern,this.elements=e}}();t.ArrayPattern=s;var a=function(){return function(e,t,r){this.type=n.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=r}}();t.ArrowFunctionExpression=a;var o=function(){return function(e,t,r){this.type=n.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=r}}();t.AssignmentExpression=o;var u=function(){return function(e,t){this.type=n.Syntax.AssignmentPattern,this.left=e,this.right=t}}();t.AssignmentPattern=u;var l=function(){return function(e,t,r){var i="||"===e||"&&"===e;this.type=i?n.Syntax.LogicalExpression:n.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=r}}();t.BinaryExpression=l;var c=function(){return function(e){this.type=n.Syntax.BlockStatement,this.body=e}}();t.BlockStatement=c;var p=function(){return function(e){this.type=n.Syntax.BreakStatement,this.label=e}}();t.BreakStatement=p;var h=function(){return function(e,t){this.type=n.Syntax.CallExpression,this.callee=e,this.arguments=t}}();t.CallExpression=h;var f=function(){return function(e,t){this.type=n.Syntax.CatchClause,this.param=e,this.body=t}}();t.CatchClause=f;var d=function(){return function(e){this.type=n.Syntax.ClassBody,this.body=e}}();t.ClassBody=d;var m=function(){return function(e,t,r){this.type=n.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=r}}();t.ClassDeclaration=m;var y=function(){return function(e,t,r){this.type=n.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=r}}();t.ClassExpression=y;var g=function(){return function(e,t){this.type=n.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t}}();t.ComputedMemberExpression=g;var b=function(){return function(e,t,r){this.type=n.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=r}}();t.ConditionalExpression=b;var v=function(){return function(e){this.type=n.Syntax.ContinueStatement,this.label=e}}();t.ContinueStatement=v;var x=function(){return function(){this.type=n.Syntax.DebuggerStatement}}();t.DebuggerStatement=x;var E=function(){return function(e,t){this.type=n.Syntax.ExpressionStatement,this.expression=e,this.directive=t}}();t.Directive=E;var A=function(){return function(e,t){this.type=n.Syntax.DoWhileStatement,this.body=e,this.test=t}}();t.DoWhileStatement=A;var D=function(){return function(){this.type=n.Syntax.EmptyStatement}}();t.EmptyStatement=D;var S=function(){return function(e){this.type=n.Syntax.ExportAllDeclaration,this.source=e}}();t.ExportAllDeclaration=S;var C=function(){return function(e){this.type=n.Syntax.ExportDefaultDeclaration,this.declaration=e}}();t.ExportDefaultDeclaration=C;var _=function(){return function(e,t,r){this.type=n.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=r}}();t.ExportNamedDeclaration=_;var w=function(){return function(e,t){this.type=n.Syntax.ExportSpecifier,this.exported=t,this.local=e}}();t.ExportSpecifier=w;var k=function(){return function(e){this.type=n.Syntax.ExpressionStatement,this.expression=e}}();t.ExpressionStatement=k;var F=function(){return function(e,t,r){this.type=n.Syntax.ForInStatement,this.left=e,this.right=t,this.body=r,this.each=!1}}();t.ForInStatement=F;var T=function(){return function(e,t,r){this.type=n.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=r}}();t.ForOfStatement=T;var P=function(){return function(e,t,r,i){this.type=n.Syntax.ForStatement,this.init=e,this.test=t,this.update=r,this.body=i}}();t.ForStatement=P;var B=function(){return function(e,t,r,i){this.type=n.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=r,this.generator=i,this.expression=!1}}();t.FunctionDeclaration=B;var O=function(){return function(e,t,r,i){this.type=n.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=r,this.generator=i,this.expression=!1}}();t.FunctionExpression=O;var N=function(){return function(e){this.type=n.Syntax.Identifier,this.name=e}}();t.Identifier=N;var j=function(){return function(e,t,r){this.type=n.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=r}}();t.IfStatement=j;var I=function(){return function(e,t){this.type=n.Syntax.ImportDeclaration,this.specifiers=e,this.source=t}}();t.ImportDeclaration=I;var L=function(){return function(e){this.type=n.Syntax.ImportDefaultSpecifier,this.local=e}}();t.ImportDefaultSpecifier=L;var M=function(){return function(e){this.type=n.Syntax.ImportNamespaceSpecifier,this.local=e}}();t.ImportNamespaceSpecifier=M;var R=function(){return function(e,t){this.type=n.Syntax.ImportSpecifier,this.local=e,this.imported=t}}();t.ImportSpecifier=R;var V=function(){return function(e,t){this.type=n.Syntax.LabeledStatement,this.label=e,this.body=t}}();t.LabeledStatement=V;var U=function(){return function(e,t){this.type=n.Syntax.Literal,this.value=e,this.raw=t}}();t.Literal=U;var q=function(){return function(e,t){this.type=n.Syntax.MetaProperty,this.meta=e,this.property=t}}();t.MetaProperty=q;var G=function(){return function(e,t,r,i,s){this.type=n.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=r,this.kind=i,this.static=s}}();t.MethodDefinition=G;var X=function(){return function(e,t){this.type=n.Syntax.NewExpression,this.callee=e,this.arguments=t}}();t.NewExpression=X;var J=function(){return function(e){this.type=n.Syntax.ObjectExpression,this.properties=e}}();t.ObjectExpression=J;var W=function(){return function(e){this.type=n.Syntax.ObjectPattern,this.properties=e}}();t.ObjectPattern=W;var K=function(){return function(e,t){this.type=n.Syntax.Program,this.body=e,this.sourceType=t}}();t.Program=K;var z=function(){return function(e,t,r,i,s,a){this.type=n.Syntax.Property,this.key=t,this.computed=r,this.value=i,this.kind=e,this.method=s,this.shorthand=a}}();t.Property=z;var Y=function(){return function(e,t,r){this.type=n.Syntax.Literal,this.value=e,this.raw=t,this.regex=r}}();t.RegexLiteral=Y;var H=function(){return function(e){this.type=n.Syntax.RestElement,this.argument=e}}();t.RestElement=H;var $=function(){return function(e){this.type=n.Syntax.ReturnStatement,this.argument=e}}();t.ReturnStatement=$;var Q=function(){return function(e){this.type=n.Syntax.SequenceExpression,this.expressions=e}}();t.SequenceExpression=Q;var Z=function(){return function(e){this.type=n.Syntax.SpreadElement,this.argument=e}}();t.SpreadElement=Z;var ee=function(){return function(e,t){this.type=n.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t}}();t.StaticMemberExpression=ee;var te=function(){return function(){this.type=n.Syntax.Super}}();t.Super=te;var re=function(){return function(e,t){this.type=n.Syntax.SwitchCase,this.test=e,this.consequent=t}}();t.SwitchCase=re;var ne=function(){return function(e,t){this.type=n.Syntax.SwitchStatement,this.discriminant=e,this.cases=t}}();t.SwitchStatement=ne;var ie=function(){return function(e,t){this.type=n.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t}}();t.TaggedTemplateExpression=ie;var se=function(){return function(e,t){this.type=n.Syntax.TemplateElement,this.value=e,this.tail=t}}();t.TemplateElement=se;var ae=function(){return function(e,t){this.type=n.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t}}();t.TemplateLiteral=ae;var oe=function(){return function(){this.type=n.Syntax.ThisExpression}}();t.ThisExpression=oe;var ue=function(){return function(e){this.type=n.Syntax.ThrowStatement,this.argument=e}}();t.ThrowStatement=ue;var le=function(){return function(e,t,r){this.type=n.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=r}}();t.TryStatement=le;var ce=function(){return function(e,t){this.type=n.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0}}();t.UnaryExpression=ce;var pe=function(){return function(e,t,r){this.type=n.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=r}}();t.UpdateExpression=pe;var he=function(){return function(e,t){this.type=n.Syntax.VariableDeclaration,this.declarations=e,this.kind=t}}();t.VariableDeclaration=he;var fe=function(){return function(e,t){this.type=n.Syntax.VariableDeclarator,this.id=e,this.init=t}}();t.VariableDeclarator=fe;var de=function(){return function(e,t){this.type=n.Syntax.WhileStatement,this.test=e,this.body=t}}();t.WhileStatement=de;var me=function(){return function(e,t){this.type=n.Syntax.WithStatement,this.object=e,this.body=t}}();t.WithStatement=me;var ye=function(){return function(e,t){this.type=n.Syntax.YieldExpression,this.argument=e,this.delegate=t}}();t.YieldExpression=ye},function(e,t,r){"use strict";function n(e){var t;switch(e.type){case c.JSXSyntax.JSXIdentifier:t=e.name;break;case c.JSXSyntax.JSXNamespacedName:var r=e;t=n(r.namespace)+":"+n(r.name);break;case c.JSXSyntax.JSXMemberExpression:var i=e;t=n(i.object)+"."+n(i.property)}return t}var i,s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=r(9),o=r(7),u=r(3),l=r(12),c=r(13),p=r(10),h=r(14);!function(e){e[e.Identifier=100]="Identifier",e[e.Text=101]="Text"}(i||(i={})),o.TokenName[i.Identifier]="JSXIdentifier",o.TokenName[i.Text]="JSXText";var f=function(e){function t(t,r,n){e.call(this,t,r,n)}return s(t,e),t.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():e.prototype.parsePrimaryExpression.call(this)},t.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.lineNumber,this.scanner.lineStart=this.startMarker.lineStart},t.prototype.finishJSX=function(){this.nextToken()},t.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},t.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},t.prototype.scanXHTMLEntity=function(e){for(var t="&",r=!0,n=!1,i=!1,s=!1;!this.scanner.eof()&&r&&!n;){var o=this.scanner.source[this.scanner.index];if(o===e)break;if(n=";"===o,t+=o,++this.scanner.index,!n)switch(t.length){case 2:i="#"===o;break;case 3:i&&(r=(s="x"===o)||a.Character.isDecimalDigit(o.charCodeAt(0)),i=i&&!s);break;default:r=(r=r&&!(i&&!a.Character.isDecimalDigit(o.charCodeAt(0))))&&!(s&&!a.Character.isHexDigit(o.charCodeAt(0)))}}if(r&&n&&t.length>2){var u=t.substr(1,t.length-2);i&&u.length>1?t=String.fromCharCode(parseInt(u.substr(1),10)):s&&u.length>2?t=String.fromCharCode(parseInt("0"+u.substr(1),16)):i||s||!l.XHTMLEntities[u]||(t=l.XHTMLEntities[u])}return t},t.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e){var t=this.scanner.source[this.scanner.index++];return{type:o.Token.Punctuator,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(34===e||39===e){for(var r=this.scanner.index,n=this.scanner.source[this.scanner.index++],s="";!this.scanner.eof();){if((c=this.scanner.source[this.scanner.index++])===n)break;s+="&"===c?this.scanXHTMLEntity(n):c}return{type:o.Token.StringLiteral,value:s,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}if(46===e){var u=this.scanner.source.charCodeAt(this.scanner.index+1),l=this.scanner.source.charCodeAt(this.scanner.index+2);t=46===u&&46===l?"...":".",r=this.scanner.index;return this.scanner.index+=t.length,{type:o.Token.Punctuator,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}if(96===e)return{type:o.Token.Template,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(a.Character.isIdentifierStart(e)&&92!==e){r=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){var c=this.scanner.source.charCodeAt(this.scanner.index);if(a.Character.isIdentifierPart(c)&&92!==c)++this.scanner.index;else{if(45!==c)break;++this.scanner.index}}var p=this.scanner.source.slice(r,this.scanner.index);return{type:i.Identifier,value:p,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}this.scanner.throwUnexpectedToken()},t.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},t.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;for(var e=this.scanner.index,t="";!this.scanner.eof();){var r=this.scanner.source[this.scanner.index];if("{"===r||"<"===r)break;++this.scanner.index,t+=r,a.Character.isLineTerminator(r.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===r&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart;var n={type:i.Text,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return t.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(n)),n},t.prototype.peekJSXToken=function(){var e=this.scanner.index,t=this.scanner.lineNumber,r=this.scanner.lineStart;this.scanner.scanComments();var n=this.lexJSX();return this.scanner.index=e,this.scanner.lineNumber=t,this.scanner.lineStart=r,n},t.prototype.expectJSX=function(e){var t=this.nextJSXToken();t.type===o.Token.Punctuator&&t.value===e||this.throwUnexpectedToken(t)},t.prototype.matchJSX=function(e){var t=this.peekJSXToken();return t.type===o.Token.Punctuator&&t.value===e},t.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return t.type!==i.Identifier&&this.throwUnexpectedToken(t),this.finalize(e,new h.JSXIdentifier(t.value))},t.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var r=t;this.expectJSX(":");var n=this.parseJSXIdentifier();t=this.finalize(e,new h.JSXNamespacedName(r,n))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var i=t;this.expectJSX(".");var s=this.parseJSXIdentifier();t=this.finalize(e,new h.JSXMemberExpression(i,s))}return t},t.prototype.parseJSXAttributeName=function(){var e,t=this.createJSXNode(),r=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=r;this.expectJSX(":");var i=this.parseJSXIdentifier();e=this.finalize(t,new h.JSXNamespacedName(n,i))}else e=r;return e},t.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();t.type!==o.Token.StringLiteral&&this.throwUnexpectedToken(t);var r=this.getTokenRaw(t);return this.finalize(e,new p.Literal(t.value,r))},t.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new h.JSXExpressionContainer(t))},t.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},t.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),r=null;return this.matchJSX("=")&&(this.expectJSX("="),r=this.parseJSXAttributeValue()),this.finalize(e,new h.JSXAttribute(t,r))},t.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(e,new h.JSXSpreadAttribute(t))},t.prototype.parseJSXAttributes=function(){for(var e=[];!this.matchJSX("/")&&!this.matchJSX(">");){var t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();e.push(t)}return e},t.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),r=this.parseJSXAttributes(),n=this.matchJSX("/");return n&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new h.JSXOpeningElement(t,n,r))},t.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new h.JSXClosingElement(t))}var r=this.parseJSXElementName(),n=this.parseJSXAttributes(),i=this.matchJSX("/");return i&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new h.JSXOpeningElement(r,i,n))},t.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.finalize(e,new h.JSXEmptyExpression)},t.prototype.parseJSXExpressionContainer=function(){var e=this.createJSXNode();this.expectJSX("{");var t;return this.matchJSX("}")?(t=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),t=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(e,new h.JSXExpressionContainer(t))},t.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),r=this.nextJSXText();if(r.start<r.end){var n=this.getTokenRaw(r),i=this.finalize(t,new h.JSXText(r.value,n));e.push(i)}if("{"!==this.scanner.source[this.scanner.index])break;var s=this.parseJSXExpressionContainer();e.push(s)}return e},t.prototype.parseComplexJSXElement=function(e){for(var t=[];!this.scanner.eof();){e.children=e.children.concat(this.parseJSXChildren());var r=this.createJSXChildNode(),i=this.parseJSXBoundaryElement();if(i.type===c.JSXSyntax.JSXOpeningElement){var s=i;if(s.selfClosing){var a=this.finalize(r,new h.JSXElement(s,[],null));e.children.push(a)}else t.push(e),e={node:r,opening:s,closing:null,children:[]}}if(i.type===c.JSXSyntax.JSXClosingElement){e.closing=i;var o=n(e.opening.name);if(o!==n(e.closing.name)&&this.tolerateError("Expected corresponding JSX closing tag for %0",o),!(t.length>0))break;a=this.finalize(e.node,new h.JSXElement(e.opening,e.children,e.closing));(e=t.pop()).children.push(a)}}return e},t.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),r=[],n=null;if(!t.selfClosing){var i=this.parseComplexJSXElement({node:e,opening:t,closing:n,children:r});r=i.children,n=i.closing}return this.finalize(e,new h.JSXElement(t,r,n))},t.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},t}(u.Parser);t.JSXParser=f},function(e,t){"use strict";t.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(e,t){"use strict";t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,r){"use strict";var n=r(13),i=function(){return function(e){this.type=n.JSXSyntax.JSXClosingElement,this.name=e}}();t.JSXClosingElement=i;var s=function(){return function(e,t,r){this.type=n.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=r}}();t.JSXElement=s;var a=function(){return function(){this.type=n.JSXSyntax.JSXEmptyExpression}}();t.JSXEmptyExpression=a;var o=function(){return function(e){this.type=n.JSXSyntax.JSXExpressionContainer,this.expression=e}}();t.JSXExpressionContainer=o;var u=function(){return function(e){this.type=n.JSXSyntax.JSXIdentifier,this.name=e}}();t.JSXIdentifier=u;var l=function(){return function(e,t){this.type=n.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t}}();t.JSXMemberExpression=l;var c=function(){return function(e,t){this.type=n.JSXSyntax.JSXAttribute,this.name=e,this.value=t}}();t.JSXAttribute=c;var p=function(){return function(e,t){this.type=n.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t}}();t.JSXNamespacedName=p;var h=function(){return function(e,t,r){this.type=n.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=r}}();t.JSXOpeningElement=h;var f=function(){return function(e){this.type=n.JSXSyntax.JSXSpreadAttribute,this.argument=e}}();t.JSXSpreadAttribute=f;var d=function(){return function(e,t){this.type=n.JSXSyntax.JSXText,this.value=e,this.raw=t}}();t.JSXText=d},function(e,t,r){"use strict";var n=r(8),i=r(6),s=r(7),a=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)>=0},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var r=this.values[this.paren-1];t="if"===r||"while"===r||"for"===r||"with"===r;break;case"}":if(t=!1,"function"===this.values[this.curly-3]){var n=this.values[this.curly-4];t=!!n&&!this.beforeFunctionExpression(n)}else if("function"===this.values[this.curly-4]){var i=this.values[this.curly-5];t=!i||!this.beforeFunctionExpression(i)}}return t},e.prototype.push=function(e){e.type===s.Token.Punctuator||e.type===s.Token.Keyword?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e}(),o=function(){function e(e,t){this.errorHandler=new i.ErrorHandler,this.errorHandler.tolerant=!!t&&("boolean"==typeof t.tolerant&&t.tolerant),this.scanner=new n.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&("boolean"==typeof t.comment&&t.comment),this.trackRange=!!t&&("boolean"==typeof t.range&&t.range),this.trackLoc=!!t&&("boolean"==typeof t.loc&&t.loc),this.buffer=[],this.reader=new a}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var e=this.scanner.scanComments();if(this.scanner.trackComment)for(var t=0;t<e.length;++t){var r=e[t],n=void 0,i=this.scanner.source.slice(r.slice[0],r.slice[1]);n={type:r.multiLine?"BlockComment":"LineComment",value:i},this.trackRange&&(n.range=r.range),this.trackLoc&&(n.loc=r.loc),this.buffer.push(n)}if(!this.scanner.eof()){var a=void 0;this.trackLoc&&(a={start:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart},end:{}});var o=void 0;o="/"===this.scanner.source[this.scanner.index]?this.reader.isRegexStart()?this.scanner.scanRegExp():this.scanner.scanPunctuator():this.scanner.lex(),this.reader.push(o);var u=void 0;u={type:s.TokenName[o.type],value:this.scanner.source.slice(o.start,o.end)},this.trackRange&&(u.range=[o.start,o.end]),this.trackLoc&&(a.end={line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart},u.loc=a),o.regex&&(u.regex=o.regex),this.buffer.push(u)}}return this.buffer.shift()},e}();t.Tokenizer=o}])})},{}],576:[function(e,t,r){arguments[4][62][0].apply(r,arguments)},{"./util":585,dup:62}],577:[function(e,t,r){arguments[4][63][0].apply(r,arguments)},{"./base64":578,dup:63}],578:[function(e,t,r){arguments[4][64][0].apply(r,arguments)},{dup:64}],579:[function(e,t,r){arguments[4][65][0].apply(r,arguments)},{dup:65}],580:[function(e,t,r){arguments[4][66][0].apply(r,arguments)},{"./util":585,dup:66}],581:[function(e,t,r){arguments[4][67][0].apply(r,arguments)},{dup:67}],582:[function(e,t,r){arguments[4][68][0].apply(r,arguments)},{"./array-set":576,"./base64-vlq":577,"./binary-search":579,"./quick-sort":581,"./util":585,dup:68}],583:[function(e,t,r){arguments[4][69][0].apply(r,arguments)},{"./array-set":576,"./base64-vlq":577,"./mapping-list":580,"./util":585,dup:69}],584:[function(e,t,r){arguments[4][70][0].apply(r,arguments)},{"./source-map-generator":583,"./util":585,dup:70}],585:[function(e,t,r){arguments[4][71][0].apply(r,arguments)},{dup:71}],586:[function(e,t,r){arguments[4][72][0].apply(r,arguments)},{"./lib/source-map-consumer":582,"./lib/source-map-generator":583,"./lib/source-node":584,dup:72}],587:[function(e,t,r){t.exports={plugins:[e("babel-plugin-syntax-async-functions"),e("babel-plugin-syntax-async-generators"),e("babel-plugin-transform-es2015-classes"),e("babel-plugin-transform-es2015-arrow-functions"),e("babel-plugin-transform-es2015-block-scoping"),e("babel-plugin-transform-es2015-for-of"),e("regenerator-transform").default]}},{"babel-plugin-syntax-async-functions":111,"babel-plugin-syntax-async-generators":112,"babel-plugin-transform-es2015-arrow-functions":113,"babel-plugin-transform-es2015-block-scoping":114,"babel-plugin-transform-es2015-classes":116,"babel-plugin-transform-es2015-for-of":119,"regenerator-transform":593}],588:[function(e,t,r){(function(t){r.path=e("path").join(t,"runtime.js")}).call(this,"/node_modules/regenerator-runtime")},{path:546}],589:[function(e,t,r){var n=function(){return this}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,s=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=e("./runtime"),i)n.regeneratorRuntime=s;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},{"./runtime":590}],590:[function(e,t,r){!function(e){"use strict";function r(e,t,r,s){var a=t&&t.prototype instanceof i?t:i,o=Object.create(a.prototype),u=new h(s||[]);return o._invoke=function(e,t,r){var i=S;return function(s,a){if(i===_)throw new Error("Generator is already running");if(i===w){if("throw"===s)throw a;return d()}for(r.method=s,r.arg=a;;){var o=r.delegate;if(o){var u=l(o,r);if(u){if(u===k)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===S)throw i=w,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=_;var c=n(e,t,r);if("normal"===c.type){if(i=r.done?w:C,c.arg===k)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=w,r.method="throw",r.arg=c.arg)}}}(e,r,u),o}function n(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function i(){}function s(){}function a(){}function o(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function u(e){function t(r,i,s,a){var o=n(e[r],e,i);if("throw"!==o.type){var u=o.arg,l=u.value;return l&&"object"==typeof l&&g.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,s,a)},function(e){t("throw",e,s,a)}):Promise.resolve(l).then(function(e){u.value=e,s(u)},a)}a(o.arg)}var r;this._invoke=function(e,n){function i(){return new Promise(function(r,i){t(e,n,r,i)})}return r=r?r.then(i,i):i()}}function l(e,t){var r=e.iterator[t.method];if(r===m){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=m,l(e,t),"throw"===t.method))return k;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var i=n(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,k;var s=i.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=m),t.delegate=null,k):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,k)}function c(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function p(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(c,this),this.reset(!0)}function f(e){if(e){var t=e[v];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(g.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=m,t.done=!0,t};return n.next=n}}return{next:d}}function d(){return{value:m,done:!0}}var m,y=Object.prototype,g=y.hasOwnProperty,b="function"==typeof Symbol?Symbol:{},v=b.iterator||"@@iterator",x=b.asyncIterator||"@@asyncIterator",E=b.toStringTag||"@@toStringTag",A="object"==typeof t,D=e.regeneratorRuntime;if(D)A&&(t.exports=D);else{(D=e.regeneratorRuntime=A?t.exports:{}).wrap=r;var S="suspendedStart",C="suspendedYield",_="executing",w="completed",k={},F={};F[v]=function(){return this};var T=Object.getPrototypeOf,P=T&&T(T(f([])));P&&P!==y&&g.call(P,v)&&(F=P);var B=a.prototype=i.prototype=Object.create(F);s.prototype=B.constructor=a,a.constructor=s,a[E]=s.displayName="GeneratorFunction",D.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===s||"GeneratorFunction"===(t.displayName||t.name))},D.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,E in e||(e[E]="GeneratorFunction")),e.prototype=Object.create(B),e},D.awrap=function(e){return{__await:e}},o(u.prototype),u.prototype[x]=function(){return this},D.AsyncIterator=u,D.async=function(e,t,n,i){var s=new u(r(e,t,n,i));return D.isGeneratorFunction(t)?s:s.next().then(function(e){return e.done?e.value:s.next()})},o(B),B[E]="Generator",B[v]=function(){return this},B.toString=function(){return"[object Generator]"},D.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},D.values=f,h.prototype={constructor:h,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=m,this.done=!1,this.delegate=null,this.method="next",this.arg=m,this.tryEntries.forEach(p),!e)for(var t in this)"t"===t.charAt(0)&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=m)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){function t(t,n){return s.type="throw",s.arg=e,r.next=t,n&&(r.method="next",r.arg=m),!!n}if(this.done)throw e;for(var r=this,n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],s=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=g.call(i,"catchLoc"),o=g.call(i,"finallyLoc");if(a&&o){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&g.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,k):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),k},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),p(r),k}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;p(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:f(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=m),k}}}}(function(){return this}()||Function("return this")())},{}],591:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){o.default.ok(this instanceof i),c.getTypes().assertIdentifier(e),this.nextTempId=0,this.contextId=e,this.listing=[],this.marked=[!0],this.finalLoc=s(),this.tryEntries=[],this.leapManager=new u.LeapManager(this)}function s(){return c.getTypes().numericLiteral(-1)}function a(e){return new Error("all declarations should have been transformed into assignments before the Exploder began its work: "+JSON.stringify(e))}var o=function(e){return e&&e.__esModule?e:{default:e}}(e("assert")),u=n(e("./leap")),l=n(e("./meta")),c=n(e("./util")),p=Object.prototype.hasOwnProperty,h=i.prototype;r.Emitter=i,h.mark=function(e){c.getTypes().assertLiteral(e);var t=this.listing.length;return-1===e.value?e.value=t:o.default.strictEqual(e.value,t),this.marked[t]=!0,e},h.emit=function(e){var t=c.getTypes();t.isExpression(e)&&(e=t.expressionStatement(e)),t.assertStatement(e),this.listing.push(e)},h.emitAssign=function(e,t){return this.emit(this.assign(e,t)),e},h.assign=function(e,t){var r=c.getTypes();return r.expressionStatement(r.assignmentExpression("=",e,t))},h.contextProperty=function(e,t){var r=c.getTypes();return r.memberExpression(this.contextId,t?r.stringLiteral(e):r.identifier(e),!!t)},h.stop=function(e){e&&this.setReturnValue(e),this.jump(this.finalLoc)},h.setReturnValue=function(e){c.getTypes().assertExpression(e.value),this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))},h.clearPendingException=function(e,t){var r=c.getTypes();r.assertLiteral(e);var n=r.callExpression(this.contextProperty("catch",!0),[e]);t?this.emitAssign(t,n):this.emit(n)},h.jump=function(e){this.emitAssign(this.contextProperty("next"),e),this.emit(c.getTypes().breakStatement())},h.jumpIf=function(e,t){var r=c.getTypes();r.assertExpression(e),r.assertLiteral(t),this.emit(r.ifStatement(e,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))},h.jumpIfNot=function(e,t){var r=c.getTypes();r.assertExpression(e),r.assertLiteral(t);var n=void 0;n=r.isUnaryExpression(e)&&"!"===e.operator?e.argument:r.unaryExpression("!",e),this.emit(r.ifStatement(n,r.blockStatement([this.assign(this.contextProperty("next"),t),r.breakStatement()])))},h.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)},h.getContextFunction=function(e){var t=c.getTypes();return t.functionExpression(e||null,[this.contextId],t.blockStatement([this.getDispatchLoop()]),!1,!1)},h.getDispatchLoop=function(){var e=this,t=c.getTypes(),r=[],n=void 0,i=!1;return e.listing.forEach(function(s,a){e.marked.hasOwnProperty(a)&&(r.push(t.switchCase(t.numericLiteral(a),n=[])),i=!1),i||(n.push(s),t.isCompletionStatement(s)&&(i=!0))}),this.finalLoc.value=this.listing.length,r.push(t.switchCase(this.finalLoc,[]),t.switchCase(t.stringLiteral("end"),[t.returnStatement(t.callExpression(this.contextProperty("stop"),[]))])),t.whileStatement(t.numericLiteral(1),t.switchStatement(t.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),r))},h.getTryLocsList=function(){if(0===this.tryEntries.length)return null;var e=c.getTypes(),t=0;return e.arrayExpression(this.tryEntries.map(function(r){var n=r.firstLoc.value;o.default.ok(n>=t,"try entries out of order"),t=n;var i=r.catchEntry,s=r.finallyEntry,a=[r.firstLoc,i?i.firstLoc:null];return s&&(a[2]=s.firstLoc,a[3]=s.afterLoc),e.arrayExpression(a)}))},h.explode=function(e,t){var r=c.getTypes(),n=e.node;if(r.assertNode(n),r.isDeclaration(n))throw a(n);if(r.isStatement(n))return this.explodeStatement(e);if(r.isExpression(n))return this.explodeExpression(e,t);switch(n.type){case"Program":return e.get("body").map(this.explodeStatement,this);case"VariableDeclarator":throw a(n);case"Property":case"SwitchCase":case"CatchClause":throw new Error(n.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(n.type))}},h.explodeStatement=function(e,t){var r=c.getTypes(),n=e.node,i=this,a=void 0,p=void 0,h=void 0;if(r.assertStatement(n),t?r.assertIdentifier(t):t=null,r.isBlockStatement(n))e.get("body").forEach(function(e){i.explodeStatement(e)});else if(l.containsLeap(n))switch(n.type){case"ExpressionStatement":i.explodeExpression(e.get("expression"),!0);break;case"LabeledStatement":p=s(),i.leapManager.withEntry(new u.LabeledEntry(p,n.label),function(){i.explodeStatement(e.get("body"),n.label)}),i.mark(p);break;case"WhileStatement":a=s(),p=s(),i.mark(a),i.jumpIfNot(i.explodeExpression(e.get("test")),p),i.leapManager.withEntry(new u.LoopEntry(p,a,t),function(){i.explodeStatement(e.get("body"))}),i.jump(a),i.mark(p);break;case"DoWhileStatement":var d=s(),m=s();p=s(),i.mark(d),i.leapManager.withEntry(new u.LoopEntry(p,m,t),function(){i.explode(e.get("body"))}),i.mark(m),i.jumpIf(i.explodeExpression(e.get("test")),d),i.mark(p);break;case"ForStatement":h=s();var y=s();p=s(),n.init&&i.explode(e.get("init"),!0),i.mark(h),n.test&&i.jumpIfNot(i.explodeExpression(e.get("test")),p),i.leapManager.withEntry(new u.LoopEntry(p,y,t),function(){i.explodeStatement(e.get("body"))}),i.mark(y),n.update&&i.explode(e.get("update"),!0),i.jump(h),i.mark(p);break;case"TypeCastExpression":return i.explodeExpression(e.get("expression"));case"ForInStatement":h=s(),p=s();var g=i.makeTempVar();i.emitAssign(g,r.callExpression(c.runtimeProperty("keys"),[i.explodeExpression(e.get("right"))])),i.mark(h);var b=i.makeTempVar();i.jumpIf(r.memberExpression(r.assignmentExpression("=",b,r.callExpression(g,[])),r.identifier("done"),!1),p),i.emitAssign(n.left,r.memberExpression(b,r.identifier("value"),!1)),i.leapManager.withEntry(new u.LoopEntry(p,h,t),function(){i.explodeStatement(e.get("body"))}),i.jump(h),i.mark(p);break;case"BreakStatement":i.emitAbruptCompletion({type:"break",target:i.leapManager.getBreakLoc(n.label)});break;case"ContinueStatement":i.emitAbruptCompletion({type:"continue",target:i.leapManager.getContinueLoc(n.label)});break;case"SwitchStatement":var v=i.emitAssign(i.makeTempVar(),i.explodeExpression(e.get("discriminant")));p=s();for(var x=s(),E=x,A=[],D=n.cases||[],S=D.length-1;S>=0;--S){var C=D[S];r.assertSwitchCase(C),C.test?E=r.conditionalExpression(r.binaryExpression("===",v,C.test),A[S]=s(),E):A[S]=x}var _=e.get("discriminant");c.replaceWithOrRemove(_,E),i.jump(i.explodeExpression(_)),i.leapManager.withEntry(new u.SwitchEntry(p),function(){e.get("cases").forEach(function(e){var t=e.key;i.mark(A[t]),e.get("consequent").forEach(function(e){i.explodeStatement(e)})})}),i.mark(p),-1===x.value&&(i.mark(x),o.default.strictEqual(p.value,x.value));break;case"IfStatement":var w=n.alternate&&s();p=s(),i.jumpIfNot(i.explodeExpression(e.get("test")),w||p),i.explodeStatement(e.get("consequent")),w&&(i.jump(p),i.mark(w),i.explodeStatement(e.get("alternate"))),i.mark(p);break;case"ReturnStatement":i.emitAbruptCompletion({type:"return",value:i.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error("WithStatement not supported in generator functions.");case"TryStatement":p=s();var k=n.handler,F=k&&s(),T=F&&new u.CatchEntry(F,k.param),P=n.finalizer&&s(),B=P&&new u.FinallyEntry(P,p),O=new u.TryEntry(i.getUnmarkedCurrentLoc(),T,B);i.tryEntries.push(O),i.updateContextPrevLoc(O.firstLoc),i.leapManager.withEntry(O,function(){if(i.explodeStatement(e.get("block")),F){P?i.jump(P):i.jump(p),i.updateContextPrevLoc(i.mark(F));var t=e.get("handler.body"),n=i.makeTempVar();i.clearPendingException(O.firstLoc,n),t.traverse(f,{safeParam:n,catchParamName:k.param.name}),i.leapManager.withEntry(T,function(){i.explodeStatement(t)})}P&&(i.updateContextPrevLoc(i.mark(P)),i.leapManager.withEntry(B,function(){i.explodeStatement(e.get("finalizer"))}),i.emit(r.returnStatement(r.callExpression(i.contextProperty("finish"),[B.firstLoc]))))}),i.mark(p);break;case"ThrowStatement":i.emit(r.throwStatement(i.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(n.type))}else i.emit(n)};var f={Identifier:function(e,t){e.node.name===t.catchParamName&&c.isReference(e)&&c.replaceWithOrRemove(e,t.safeParam)},Scope:function(e,t){e.scope.hasOwnBinding(t.catchParamName)&&e.skip()}};h.emitAbruptCompletion=function(e){(function(e){var t=e.type;return"normal"===t?!p.call(e,"target"):"break"===t||"continue"===t?!p.call(e,"value")&&c.getTypes().isLiteral(e.target):("return"===t||"throw"===t)&&p.call(e,"value")&&!p.call(e,"target")})(e)||o.default.ok(!1,"invalid completion record: "+JSON.stringify(e)),o.default.notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=c.getTypes(),r=[t.stringLiteral(e.type)];"break"===e.type||"continue"===e.type?(t.assertLiteral(e.target),r[1]=e.target):"return"!==e.type&&"throw"!==e.type||e.value&&(t.assertExpression(e.value),r[1]=e.value),this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"),r)))},h.getUnmarkedCurrentLoc=function(){return c.getTypes().numericLiteral(this.listing.length)},h.updateContextPrevLoc=function(e){e?(c.getTypes().assertLiteral(e),-1===e.value?e.value=this.listing.length:o.default.strictEqual(e.value,this.listing.length)):e=this.getUnmarkedCurrentLoc(),this.emitAssign(this.contextProperty("prev"),e)},h.explodeExpression=function(e,t){function r(e){if(i.assertExpression(e),!t)return e;u.emit(e)}function n(e,t,r){o.default.ok(!r||!e,"Ignoring the result of a child expression but forcing it to be assigned to a temporary variable?");var n=u.explodeExpression(t,r);return r||(e||f&&!i.isLiteral(n))&&(n=u.emitAssign(e||u.makeTempVar(),n)),n}var i=c.getTypes(),a=e.node;if(!a)return a;i.assertExpression(a);var u=this,p=void 0,h=void 0;if(!l.containsLeap(a))return r(a);var f=l.containsLeap.onlyChildren(a);switch(a.type){case"MemberExpression":return r(i.memberExpression(u.explodeExpression(e.get("object")),a.computed?n(null,e.get("property")):a.property,a.computed));case"CallExpression":var d=e.get("callee"),m=e.get("arguments"),y=void 0,g=[],b=!1;if(m.forEach(function(e){b=b||l.containsLeap(e.node)}),i.isMemberExpression(d.node))if(b){var v=n(u.makeTempVar(),d.get("object")),x=d.node.computed?n(null,d.get("property")):d.node.property;g.unshift(v),y=i.memberExpression(i.memberExpression(v,x,d.node.computed),i.identifier("call"),!1)}else y=u.explodeExpression(d);else y=n(null,d),i.isMemberExpression(y)&&(y=i.sequenceExpression([i.numericLiteral(0),y]));return m.forEach(function(e){g.push(n(null,e))}),r(i.callExpression(y,g));case"NewExpression":return r(i.newExpression(n(null,e.get("callee")),e.get("arguments").map(function(e){return n(null,e)})));case"ObjectExpression":return r(i.objectExpression(e.get("properties").map(function(e){return e.isObjectProperty()?i.objectProperty(e.node.key,n(null,e.get("value")),e.node.computed):e.node})));case"ArrayExpression":return r(i.arrayExpression(e.get("elements").map(function(e){return n(null,e)})));case"SequenceExpression":var E=a.expressions.length-1;return e.get("expressions").forEach(function(e){e.key===E?p=u.explodeExpression(e,t):u.explodeExpression(e,!0)}),p;case"LogicalExpression":h=s(),t||(p=u.makeTempVar());var A=n(p,e.get("left"));return"&&"===a.operator?u.jumpIfNot(A,h):(o.default.strictEqual(a.operator,"||"),u.jumpIf(A,h)),n(p,e.get("right"),t),u.mark(h),p;case"ConditionalExpression":var D=s();h=s();var S=u.explodeExpression(e.get("test"));return u.jumpIfNot(S,D),t||(p=u.makeTempVar()),n(p,e.get("consequent"),t),u.jump(h),u.mark(D),n(p,e.get("alternate"),t),u.mark(h),p;case"UnaryExpression":return r(i.unaryExpression(a.operator,u.explodeExpression(e.get("argument")),!!a.prefix));case"BinaryExpression":return r(i.binaryExpression(a.operator,n(null,e.get("left")),n(null,e.get("right"))));case"AssignmentExpression":return r(i.assignmentExpression(a.operator,u.explodeExpression(e.get("left")),u.explodeExpression(e.get("right"))));case"UpdateExpression":return r(i.updateExpression(a.operator,u.explodeExpression(e.get("argument")),a.prefix));case"YieldExpression":h=s();var C=a.argument&&u.explodeExpression(e.get("argument"));if(C&&a.delegate){var _=u.makeTempVar();return u.emit(i.returnStatement(i.callExpression(u.contextProperty("delegateYield"),[C,i.stringLiteral(_.property.name),h]))),u.mark(h),_}return u.emitAssign(u.contextProperty("next"),h),u.emit(i.returnStatement(C||null)),u.mark(h),u.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(a.type))}}},{"./leap":594,"./meta":595,"./util":597,assert:1}],592:[function(e,t,r){"use strict";var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./util")),i=Object.prototype.hasOwnProperty;r.hoist=function(e){function t(e,t){r.assertVariableDeclaration(e);var n=[];return e.declarations.forEach(function(e){s[e.id.name]=r.identifier(e.id.name),e.init?n.push(r.assignmentExpression("=",e.id,e.init)):t&&n.push(e.id)}),0===n.length?null:1===n.length?n[0]:r.sequenceExpression(n)}var r=n.getTypes();r.assertFunction(e.node);var s={};e.get("body").traverse({VariableDeclaration:{exit:function(e){var i=t(e.node,!1);null===i?e.remove():n.replaceWithOrRemove(e,r.expressionStatement(i)),e.skip()}},ForStatement:function(e){var i=e.node.init;r.isVariableDeclaration(i)&&n.replaceWithOrRemove(e.get("init"),t(i,!1))},ForXStatement:function(e){var r=e.get("left");r.isVariableDeclaration()&&n.replaceWithOrRemove(r,t(r.node,!0))},FunctionDeclaration:function(e){var t=e.node;s[t.id.name]=t.id;var i=r.expressionStatement(r.assignmentExpression("=",t.id,r.functionExpression(t.id,t.params,t.body,t.generator,t.expression)));e.parentPath.isBlockStatement()?(e.parentPath.unshiftContainer("body",i),e.remove()):n.replaceWithOrRemove(e,i),e.skip()},FunctionExpression:function(e){e.skip()},ArrowFunctionExpression:function(e){e.skip()}});var a={};e.get("params").forEach(function(e){var t=e.node;r.isIdentifier(t)&&(a[t.name]=t)});var o=[];return Object.keys(s).forEach(function(e){i.call(a,e)||o.push(r.variableDeclarator(s[e],null))}),0===o.length?null:r.variableDeclaration("var",o)}},{"./util":597}],593:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(t){var r={visitor:e("./visit").getVisitor(t)},n=t&&t.version;return n&&parseInt(n,10)>=7&&(r.name="regenerator-transform"),r}},{"./visit":598}],594:[function(e,t,r){"use strict";function n(){h.default.ok(this instanceof n)}function i(e){n.call(this),(0,d.getTypes)().assertLiteral(e),this.returnLoc=e}function s(e,t,r){n.call(this);var i=(0,d.getTypes)();i.assertLiteral(e),i.assertLiteral(t),r?i.assertIdentifier(r):r=null,this.breakLoc=e,this.continueLoc=t,this.label=r}function a(e){n.call(this),(0,d.getTypes)().assertLiteral(e),this.breakLoc=e}function o(e,t,r){n.call(this);(0,d.getTypes)().assertLiteral(e),t?h.default.ok(t instanceof u):t=null,r?h.default.ok(r instanceof l):r=null,h.default.ok(t||r),this.firstLoc=e,this.catchEntry=t,this.finallyEntry=r}function u(e,t){n.call(this);var r=(0,d.getTypes)();r.assertLiteral(e),r.assertIdentifier(t),this.firstLoc=e,this.paramId=t}function l(e,t){n.call(this);var r=(0,d.getTypes)();r.assertLiteral(e),r.assertLiteral(t),this.firstLoc=e,this.afterLoc=t}function c(e,t){n.call(this);var r=(0,d.getTypes)();r.assertLiteral(e),r.assertIdentifier(t),this.breakLoc=e,this.label=t}function p(t){h.default.ok(this instanceof p);var r=e("./emit").Emitter;h.default.ok(t instanceof r),this.emitter=t,this.entryStack=[new i(t.finalLoc)]}var h=function(e){return e&&e.__esModule?e:{default:e}}(e("assert")),f=e("util"),d=e("./util.js");(0,f.inherits)(i,n),r.FunctionEntry=i,(0,f.inherits)(s,n),r.LoopEntry=s,(0,f.inherits)(a,n),r.SwitchEntry=a,(0,f.inherits)(o,n),r.TryEntry=o,(0,f.inherits)(u,n),r.CatchEntry=u,(0,f.inherits)(l,n),r.FinallyEntry=l,(0,f.inherits)(c,n),r.LabeledEntry=c;var m=p.prototype;r.LeapManager=p,m.withEntry=function(e,t){h.default.ok(e instanceof n),this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();h.default.strictEqual(r,e)}},m._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var n=this.entryStack[r],i=n[e];if(i)if(t){if(n.label&&n.label.name===t.name)return i}else if(!(n instanceof c))return i}return null},m.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)},m.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{"./emit":591,"./util.js":597,assert:1,util:613}],595:[function(e,t,r){"use strict";function n(e,t){function r(e){function t(e){return a||(Array.isArray(e)?e.some(t):r.isNode(e)&&(i.default.strictEqual(a,!1),a=n(e))),a}var r=(0,s.getTypes)();r.assertNode(e);var a=!1,o=r.VISITOR_KEYS[e.type];if(o)for(var u=0;u<o.length;u++){t(e[o[u]])}return a}function n(n){(0,s.getTypes)().assertNode(n);var i=a(n);return o.call(i,e)?i[e]:o.call(u,n.type)?i[e]=!1:o.call(t,n.type)?i[e]=!0:i[e]=r(n)}return n.onlyChildren=r,n}var i=function(e){return e&&e.__esModule?e:{default:e}}(e("assert")),s=e("./util.js"),a=e("private").makeAccessor(),o=Object.prototype.hasOwnProperty,u={FunctionExpression:!0,ArrowFunctionExpression:!0},l={CallExpression:!0,ForInStatement:!0,UnaryExpression:!0,BinaryExpression:!0,AssignmentExpression:!0,UpdateExpression:!0,NewExpression:!0},c={YieldExpression:!0,BreakStatement:!0,ContinueStatement:!0,ReturnStatement:!0,ThrowStatement:!0};for(var p in c)o.call(c,p)&&(l[p]=c[p]);r.hasSideEffects=n("hasSideEffects",l),r.containsLeap=n("containsLeap",c)},{"./util.js":597,assert:1,private:548}],596:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){var t=n.getTypes();if(!e.node||!t.isFunction(e.node))throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths.");if(!t.isObjectMethod(e.node))return e;if(!e.node.generator)return e;var r=e.node.params.map(function(e){return t.cloneDeep(e)}),i=t.functionExpression(null,r,t.cloneDeep(e.node.body),e.node.generator,e.node.async);return n.replaceWithOrRemove(e,t.objectProperty(t.cloneDeep(e.node.key),i,e.node.computed,!1)),e.get("value")};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./util"))},{"./util":597}],597:[function(e,t,r){"use strict";function n(){return i}r.__esModule=!0,r.wrapWithTypes=function(e,t){return function(){var r=i;i=e;try{for(var n=arguments.length,s=Array(n),a=0;a<n;a++)s[a]=arguments[a];return t.apply(this,s)}finally{i=r}}},r.getTypes=n,r.runtimeProperty=function(e){var t=n();return t.memberExpression(t.identifier("regeneratorRuntime"),t.identifier(e),!1)},r.isReference=function(e){return e.isReferenced()||e.parentPath.isAssignmentExpression({left:e.node})},r.replaceWithOrRemove=function(e,t){t?e.replaceWith(t):e.remove()};var i=null},{}],598:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=l.getTypes(),r=e.node;return t.assertFunction(r),r.id||(r.id=e.scope.parent.generateUidIdentifier("callee")),r.generator&&t.isFunctionDeclaration(r)?function(e){var t=l.getTypes(),r=e.node;t.assertIdentifier(r.id);var n=e.findParent(function(e){return e.isProgram()||e.isBlockStatement()});if(!n)return r.id;var i=n.node;s.default.ok(Array.isArray(i.body));var a=c(i);a.decl||(a.decl=t.variableDeclaration("var",[]),n.unshiftContainer("body",a.decl),a.declPath=n.get("body.0"));s.default.strictEqual(a.declPath.node,a.decl);var o=n.scope.generateUidIdentifier("marked"),u=t.callExpression(l.runtimeProperty("mark"),[r.id]),p=a.decl.declarations.push(t.variableDeclarator(o,u))-1,h=a.declPath.get("declarations."+p+".init");return s.default.strictEqual(h.node,u),h.addComment("leading","#__PURE__"),o}(e):r.id}var s=n(e("assert")),a=e("./hoist"),o=e("./emit"),u=n(e("./replaceShorthandObjectMethod")),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./util"));r.getVisitor=function(e){var t=e.types;return{Function:{exit:l.wrapWithTypes(t,function(e,r){var n=e.node;if(n.generator){if(n.async){if(!1===r.opts.asyncGenerators)return}else if(!1===r.opts.generators)return}else{if(!n.async)return;if(!1===r.opts.async)return}n=(e=(0,u.default)(e)).node;var s=e.scope.generateUidIdentifier("context"),c=e.scope.generateUidIdentifier("args");e.ensureBlock();var d=e.get("body");n.async&&d.traverse(f),d.traverse(h,{context:s});var m=[],y=[];d.get("body").forEach(function(e){var r=e.node;t.isExpressionStatement(r)&&t.isStringLiteral(r.expression)?m.push(r):r&&null!=r._blockHoist?m.push(r):y.push(r)}),m.length>0&&(d.node.body=y);var g=i(e);t.assertIdentifier(n.id);var b=t.identifier(n.id.name+"$"),v=(0,a.hoist)(e);if(function(e,t){var r={didRenameArguments:!1,argsId:t};return e.traverse(p,r),r.didRenameArguments}(e,c)){v=v||t.variableDeclaration("var",[]);var x=t.identifier("arguments");x._shadowedFunctionLiteral=e,v.declarations.push(t.variableDeclarator(c,x))}var E=new o.Emitter(s);E.explode(e.get("body")),v&&v.declarations.length>0&&m.push(v);var A=[E.getContextFunction(b),n.generator?g:t.nullLiteral(),t.thisExpression()],D=E.getTryLocsList();D&&A.push(D);var S=t.callExpression(l.runtimeProperty(n.async?"async":"wrap"),A);m.push(t.returnStatement(S)),n.body=t.blockStatement(m);var C=d.node.directives;C&&(n.body.directives=C);var _=n.generator;_&&(n.generator=!1),n.async&&(n.async=!1),_&&t.isExpression(n)&&(l.replaceWithOrRemove(e,t.callExpression(l.runtimeProperty("mark"),[n])),e.addComment("leading","#__PURE__")),e.requeue()})}}};var c=e("private").makeAccessor(),p={"FunctionExpression|FunctionDeclaration":function(e){e.skip()},Identifier:function(e,t){"arguments"===e.node.name&&l.isReference(e)&&(l.replaceWithOrRemove(e,t.argsId),t.didRenameArguments=!0)}},h={MetaProperty:function(e){var t=e.node;if("function"===t.meta.name&&"sent"===t.property.name){var r=l.getTypes();l.replaceWithOrRemove(e,r.memberExpression(this.context,r.identifier("_sent")))}}},f={Function:function(e){e.skip()},AwaitExpression:function(e){var t=l.getTypes(),r=e.node.argument;l.replaceWithOrRemove(e,t.yieldExpression(t.callExpression(l.runtimeProperty("awrap"),[r]),!1))}}},{"./emit":591,"./hoist":592,"./replaceShorthandObjectMethod":596,"./util":597,assert:1,private:548}],599:[function(e,t,r){e("assert");var n=e("recast").types,i=n.namedTypes,s=n.builders,a=Object.prototype.hasOwnProperty;r.defaults=function(e){for(var t,r=arguments.length,n=1;n<r;++n)if(t=arguments[n])for(var i in t)a.call(t,i)&&!a.call(e,i)&&(e[i]=t[i]);return e},r.runtimeProperty=function(e){return s.memberExpression(s.identifier("regeneratorRuntime"),s.identifier(e),!1)},r.isReference=function(e,t){var r=e.value;if(!i.Identifier.check(r))return!1;if(t&&r.name!==t)return!1;var n=e.parent.value;switch(n.type){case"VariableDeclarator":return"init"===e.name;case"MemberExpression":return"object"===e.name||n.computed&&"property"===e.name;case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":return"id"!==e.name&&("params"!==e.parentPath.name||n.params!==e.parentPath.value||n.params[e.name]!==r);case"ClassDeclaration":case"ClassExpression":return"id"!==e.name;case"CatchClause":return"param"!==e.name;case"Property":case"MethodDefinition":return"key"!==e.name;case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return!1;default:return!0}}},{assert:1,recast:574}],600:[function(e,t,r){var n=e("recast"),i=n.types.namedTypes,s=e("./util.js");r.transform=function(t,r){r=s.defaults(r||{},{includeRuntime:!1});return t=e("babel-core").transformFromAst(t,null,{presets:[e("regenerator-preset")],code:!1,ast:!0}).ast,!0===r.includeRuntime&&function(t){i.Program.assert(t);var r=e("..").runtime.path,s=fs.readFileSync(r,"utf8"),a=n.parse(s,{sourceFileName:r}).program.body,o=t.body;o.unshift.apply(o,a)}(i.File.check(t)?t.program:t),t}},{"..":"regenerator","./util.js":599,"babel-core":31,recast:574,"regenerator-preset":587}],601:[function(e,t,r){"use strict";var n=e("is-finite");t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected `input` to be a string");if(t<0||!n(t))throw new TypeError("Expected `count` to be a positive finite number");var r="";do{1&t&&(r+=e),e+=e}while(t>>=1);return r}},{"is-finite":320}],602:[function(e,t,r){function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return a(e,t,r)}var s=e("buffer"),a=s.Buffer;a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?t.exports=s:(n(s,r),r.Buffer=i),n(a,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return a(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=a(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s.SlowBuffer(e)}},{buffer:194}],603:[function(e,t,r){"use strict";t.exports=function(e){var t=/^\\\\\?\\/.test(e),r=/[^\x00-\x80]+/.test(e);return t||r?e:e.replace(/\\/g,"/")}},{}],604:[function(e,t,r){function n(){i.call(this)}t.exports=n;var i=e("events").EventEmitter;e("inherits")(n,i),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),n.Stream=n,n.prototype.pipe=function(e,t){function r(t){e.writable&&!1===e.write(t)&&l.pause&&l.pause()}function n(){l.readable&&l.resume&&l.resume()}function s(){c||(c=!0,e.end())}function a(){c||(c=!0,"function"==typeof e.destroy&&e.destroy())}function o(e){if(u(),0===i.listenerCount(this,"error"))throw e}function u(){l.removeListener("data",r),e.removeListener("drain",n),l.removeListener("end",s),l.removeListener("close",a),l.removeListener("error",o),e.removeListener("error",o),l.removeListener("end",u),l.removeListener("close",u),e.removeListener("close",u)}var l=this;l.on("data",r),e.on("drain",n),e._isStdio||t&&!1===t.end||(l.on("end",s),l.on("close",a));var c=!1;return l.on("error",o),e.on("error",o),l.on("end",u),l.on("close",u),e.on("close",u),e.emit("pipe",l),e}},{events:313,inherits:317,"readable-stream/duplex.js":551,"readable-stream/passthrough.js":560,"readable-stream/readable.js":561,"readable-stream/transform.js":562,"readable-stream/writable.js":563}],605:[function(e,t,r){"use strict";function n(e){this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(h.isEncoding===f||!f(e)))throw new Error("Unknown encoding: "+e);return t||e}(e);var t;switch(this.encoding){case"utf16le":this.text=a,this.end=o,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=u,this.end=l,t=3;break;default:return this.write=c,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=h.allocUnsafe(t)}function i(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:-1}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�".repeat(r);if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�".repeat(r+1);if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�".repeat(r+2)}}(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function a(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function o(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function c(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}var h=e("safe-buffer").Buffer,f=h.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};r.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t},n.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var s=i(t[n]);return s>=0?(s>0&&(e.lastNeed=s-1),s):--n<r?0:(s=i(t[n]))>=0?(s>0&&(e.lastNeed=s-2),s):--n<r?0:(s=i(t[n]))>=0?(s>0&&(2===s?s=0:e.lastNeed=s-3),s):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":602}],606:[function(e,t,r){(function(r){function n(e,t,n){function s(){for(;u.length&&!c.paused;){var e=u.shift();if(null===e)return c.emit("end");c.emit("data",e)}}e=e||function(e){this.queue(e)},t=t||function(){this.queue(null)};var a=!1,o=!1,u=[],l=!1,c=new i;return c.readable=c.writable=!0,c.paused=!1,c.autoDestroy=!(n&&!1===n.autoDestroy),c.write=function(t){return e.call(this,t),!c.paused},c.queue=c.push=function(e){return l?c:(null===e&&(l=!0),u.push(e),s(),c)},c.on("end",function(){c.readable=!1,!c.writable&&c.autoDestroy&&r.nextTick(function(){c.destroy()})}),c.end=function(e){if(!a)return a=!0,arguments.length&&c.write(e),c.writable=!1,t.call(c),!c.readable&&c.autoDestroy&&c.destroy(),c},c.destroy=function(){if(!o)return o=!0,a=!0,u.length=0,c.writable=c.readable=!1,c.emit("close"),c},c.pause=function(){if(!c.paused)return c.paused=!0,c},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),s(),c.paused||c.emit("drain"),c},c}var i=e("stream");t.exports=n,n.through=n}).call(this,e("_process"))},{_process:550,stream:604}],607:[function(e,t,r){"use strict";t.exports=function e(t){function r(){}function n(){return typeof i.foo}r.prototype=t;var i=new r;return n(),n(),t}},{}],608:[function(e,t,r){"use strict";t.exports=function(e){for(var t=e.length;/[\s\uFEFF\u00A0]/.test(e[t-1]);)t--;return e.slice(0,t)}},{}],609:[function(e,t,r){r.isatty=function(){return!1},r.ReadStream=function(){throw new Error("tty.ReadStream is not implemented")},r.WriteStream=function(){throw new Error("tty.ReadStream is not implemented")}},{}],610:[function(e,t,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],611:[function(e,t,r){arguments[4][317][0].apply(r,arguments)},{dup:317}],612:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],613:[function(e,t,r){(function(t,n){function i(e,t){var n={seen:[],stylize:a};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(t)?n.showHidden=t:t&&r._extend(n,t),m(n.showHidden)&&(n.showHidden=!1),m(n.depth)&&(n.depth=2),m(n.colors)&&(n.colors=!1),m(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),o(n,e,n.depth)}function s(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function a(e,t){return e}function o(e,t,n){if(e.customInspect&&t&&x(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return d(i)||(i=o(e,i,n)),i}var s=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(d(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(f(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(h(t))return e.stylize("null","null")}(e,t);if(s)return s;var a=Object.keys(t),g=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(t)),v(t)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return u(t);if(0===a.length){if(x(t)){var E=t.name?": "+t.name:"";return e.stylize("[Function"+E+"]","special")}if(y(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(b(t))return e.stylize(Date.prototype.toString.call(t),"date");if(v(t))return u(t)}var A="",S=!1,C=["{","}"];if(c(t)&&(S=!0,C=["[","]"]),x(t)){A=" [Function"+(t.name?": "+t.name:"")+"]"}if(y(t)&&(A=" "+RegExp.prototype.toString.call(t)),b(t)&&(A=" "+Date.prototype.toUTCString.call(t)),v(t)&&(A=" "+u(t)),0===a.length&&(!S||0==t.length))return C[0]+A+C[1];if(n<0)return y(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var _;return _=S?function(e,t,r,n,i){for(var s=[],a=0,o=t.length;a<o;++a)D(t,String(a))?s.push(l(e,t,r,n,String(a),!0)):s.push("");return i.forEach(function(i){i.match(/^\d+$/)||s.push(l(e,t,r,n,i,!0))}),s}(e,t,n,g,a):a.map(function(r){return l(e,t,n,g,r,S)}),e.seen.pop(),function(e,t,r){if(e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(_,A,C)}function u(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,n,i,s){var a,u,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?u=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(u=e.stylize("[Setter]","special")),D(n,i)||(a="["+i+"]"),u||(e.seen.indexOf(l.value)<0?(u=h(r)?o(e,l.value,null):o(e,l.value,r-1)).indexOf("\n")>-1&&(u=s?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n")):u=e.stylize("[Circular]","special")),m(a)){if(s&&i.match(/^\d+$/))return u;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+u}function c(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function h(e){return null===e}function f(e){return"number"==typeof e}function d(e){return"string"==typeof e}function m(e){return void 0===e}function y(e){return g(e)&&"[object RegExp]"===E(e)}function g(e){return"object"==typeof e&&null!==e}function b(e){return g(e)&&"[object Date]"===E(e)}function v(e){return g(e)&&("[object Error]"===E(e)||e instanceof Error)}function x(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}function D(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var S=/%[sdj%]/g;r.format=function(e){if(!d(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(i(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,s=n.length,a=String(e).replace(S,function(e){if("%%"===e)return"%";if(r>=s)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),o=n[r];r<s;o=n[++r])h(o)||!g(o)?a+=" "+o:a+=" "+i(o);return a},r.deprecate=function(e,i){if(m(n.process))return function(){return r.deprecate(e,i).apply(this,arguments)};if(!0===t.noDeprecation)return e;var s=!1;return function(){if(!s){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),s=!0}return e.apply(this,arguments)}};var C,_={};r.debuglog=function(e){if(m(C)&&(C=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!_[e])if(new RegExp("\\b"+e+"\\b","i").test(C)){var n=t.pid;_[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,n,t)}}else _[e]=function(){};return _[e]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=c,r.isBoolean=p,r.isNull=h,r.isNullOrUndefined=function(e){return null==e},r.isNumber=f,r.isString=d,r.isSymbol=function(e){return"symbol"==typeof e},r.isUndefined=m,r.isRegExp=y,r.isObject=g,r.isDate=b,r.isError=v,r.isFunction=x,r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},r.isBuffer=e("./support/isBuffer");var w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",function(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),w[e.getMonth()],t].join(" ")}(),r.format.apply(r,arguments))},r.inherits=e("inherits"),r._extend=function(e,t){if(!t||!g(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":612,_process:550,inherits:611}],regenerator:[function(e,t,r){function r(e,t){var r=[];return a(function(e){r.push(e)},function(){try{this.queue(i(r.join(""),t).code),this.queue(null)}catch(e){this.emit("error",e)}})}function n(){regeneratorRuntime=e("regenerator-runtime")}function i(t,r){var i;return r=u.defaults(r||{},{includeRuntime:!1}),i=l.test(t)?e("babel-core").transform(t,p):{code:t},!0===r.includeRuntime&&(i.code=(c||(c=s.readFileSync(n.path,"utf8")))+"\n"+i.code),i}var s=e("fs"),a=e("through"),o=e("./lib/visit").transform,u=e("./lib/util"),l=/\bfunction\s*\*|\basync\b/;t.exports=r,r.runtime=n,n.path=e("regenerator-runtime/path.js").path;var c,p={presets:[e("regenerator-preset")],parserOpts:{sourceType:"module",allowImportExportEverywhere:!0,allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,strictMode:!1,plugins:["*","jsx","flow"]}};r.types=e("recast").types,r.compile=i,r.transform=o},{"./lib/util":599,"./lib/visit":600,"babel-core":31,fs:193,recast:574,"regenerator-preset":587,"regenerator-runtime":589,"regenerator-runtime/path.js":588,through:606}]},{},[]); \ No newline at end of file diff --git a/appasar/canary/node_modules/ajv/lib/$data.js b/appasar/canary/node_modules/ajv/lib/$data.js new file mode 100644 index 0000000..60cfc2d --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/$data.js @@ -0,0 +1,49 @@ +'use strict'; + +var KEYWORDS = [ + 'multipleOf', + 'maximum', + 'exclusiveMaximum', + 'minimum', + 'exclusiveMinimum', + 'maxLength', + 'minLength', + 'pattern', + 'additionalItems', + 'maxItems', + 'minItems', + 'uniqueItems', + 'maxProperties', + 'minProperties', + 'required', + 'additionalProperties', + 'enum', + 'format', + 'const' +]; + +module.exports = function (metaSchema, keywordsJsonPointers) { + for (var i=0; i<keywordsJsonPointers.length; i++) { + metaSchema = JSON.parse(JSON.stringify(metaSchema)); + var segments = keywordsJsonPointers[i].split('/'); + var keywords = metaSchema; + var j; + for (j=1; j<segments.length; j++) + keywords = keywords[segments[j]]; + + for (j=0; j<KEYWORDS.length; j++) { + var key = KEYWORDS[j]; + var schema = keywords[key]; + if (schema) { + keywords[key] = { + anyOf: [ + schema, + { $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#' } + ] + }; + } + } + } + + return metaSchema; +}; diff --git a/appasar/canary/node_modules/ajv/lib/ajv.d.ts b/appasar/canary/node_modules/ajv/lib/ajv.d.ts new file mode 100644 index 0000000..b815fda --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/ajv.d.ts @@ -0,0 +1,358 @@ +declare var ajv: { + (options?: ajv.Options): ajv.Ajv; + new (options?: ajv.Options): ajv.Ajv; + ValidationError: ValidationError; + MissingRefError: MissingRefError; + $dataMetaSchema: object; +} + +declare namespace ajv { + interface Ajv { + /** + * Validate data using schema + * Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default). + * @param {string|object|Boolean} schemaKeyRef key, ref or schema object + * @param {Any} data to be validated + * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). + */ + validate(schemaKeyRef: object | string | boolean, data: any): boolean | Thenable<any>; + /** + * Create validating function for passed schema. + * @param {object|Boolean} schema schema object + * @return {Function} validating function + */ + compile(schema: object | boolean): ValidateFunction; + /** + * Creates validating function for passed schema with asynchronous loading of missing schemas. + * `loadSchema` option should be a function that accepts schema uri and node-style callback. + * @this Ajv + * @param {object|Boolean} schema schema object + * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped + * @param {Function} callback optional node-style callback, it is always called with 2 parameters: error (or null) and validating function. + * @return {Thenable<ValidateFunction>} validating function + */ + compileAsync(schema: object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): Thenable<ValidateFunction>; + /** + * Adds schema to the instance. + * @param {object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. + * @param {string} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + * @return {Ajv} this for method chaining + */ + addSchema(schema: Array<object> | object, key?: string): Ajv; + /** + * Add schema that will be used to validate other schemas + * options in META_IGNORE_OPTIONS are alway set to false + * @param {object} schema schema object + * @param {string} key optional schema key + * @return {Ajv} this for method chaining + */ + addMetaSchema(schema: object, key?: string): Ajv; + /** + * Validate schema + * @param {object|Boolean} schema schema to validate + * @return {Boolean} true if schema is valid + */ + validateSchema(schema: object | boolean): boolean; + /** + * Get compiled schema from the instance by `key` or `ref`. + * @param {string} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id). + * @return {Function} schema validating function (with property `schema`). + */ + getSchema(keyRef: string): ValidateFunction; + /** + * Remove cached schema(s). + * If no parameter is passed all schemas but meta-schemas are removed. + * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + * Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + * @param {string|object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object + * @return {Ajv} this for method chaining + */ + removeSchema(schemaKeyRef?: object | string | RegExp | boolean): Ajv; + /** + * Add custom format + * @param {string} name format name + * @param {string|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) + * @return {Ajv} this for method chaining + */ + addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv; + /** + * Define custom keyword + * @this Ajv + * @param {string} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords. + * @param {object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. + * @return {Ajv} this for method chaining + */ + addKeyword(keyword: string, definition: KeywordDefinition): Ajv; + /** + * Get keyword definition + * @this Ajv + * @param {string} keyword pre-defined or custom keyword. + * @return {object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise. + */ + getKeyword(keyword: string): object | boolean; + /** + * Remove keyword + * @this Ajv + * @param {string} keyword pre-defined or custom keyword. + * @return {Ajv} this for method chaining + */ + removeKeyword(keyword: string): Ajv; + /** + * Convert array of error message objects to string + * @param {Array<object>} errors optional array of validation errors, if not passed errors from the instance are used. + * @param {object} options optional options with properties `separator` and `dataVar`. + * @return {string} human readable string with all errors descriptions + */ + errorsText(errors?: Array<ErrorObject>, options?: ErrorsTextOptions): string; + errors?: Array<ErrorObject>; + } + + interface Thenable <R> { + then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>; + } + + interface ValidateFunction { + ( + data: any, + dataPath?: string, + parentData?: object | Array<any>, + parentDataProperty?: string | number, + rootData?: object | Array<any> + ): boolean | Thenable<any>; + schema?: object | boolean; + errors?: null | Array<ErrorObject>; + refs?: object; + refVal?: Array<any>; + root?: ValidateFunction | object; + $async?: true; + source?: object; + } + + interface Options { + $data?: boolean; + allErrors?: boolean; + verbose?: boolean; + jsonPointers?: boolean; + uniqueItems?: boolean; + unicode?: boolean; + format?: string; + formats?: object; + unknownFormats?: true | string[] | 'ignore'; + schemas?: Array<object> | object; + schemaId?: '$id' | 'id'; + missingRefs?: true | 'ignore' | 'fail'; + extendRefs?: true | 'ignore' | 'fail'; + loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => Thenable<object | boolean>; + removeAdditional?: boolean | 'all' | 'failing'; + useDefaults?: boolean | 'shared'; + coerceTypes?: boolean | 'array'; + async?: boolean | string; + transpile?: string | ((code: string) => string); + meta?: boolean | object; + validateSchema?: boolean | 'log'; + addUsedSchema?: boolean; + inlineRefs?: boolean | number; + passContext?: boolean; + loopRequired?: number; + ownProperties?: boolean; + multipleOfPrecision?: boolean | number; + errorDataPath?: string, + messages?: boolean; + sourceCode?: boolean; + processCode?: (code: string) => string; + cache?: object; + } + + type FormatValidator = string | RegExp | ((data: string) => boolean | Thenable<any>); + + interface FormatDefinition { + validate: FormatValidator; + compare: (data1: string, data2: string) => number; + async?: boolean; + } + + interface KeywordDefinition { + type?: string | Array<string>; + async?: boolean; + $data?: boolean; + errors?: boolean | string; + metaSchema?: object; + // schema: false makes validate not to expect schema (ValidateFunction) + schema?: boolean; + modifying?: boolean; + valid?: boolean; + // one and only one of the following properties should be present + validate?: SchemaValidateFunction | ValidateFunction; + compile?: (schema: any, parentSchema: object, it: CompilationContext) => ValidateFunction; + macro?: (schema: any, parentSchema: object, it: CompilationContext) => object | boolean; + inline?: (it: CompilationContext, keyword: string, schema: any, parentSchema: object) => string; + } + + interface CompilationContext { + level: number; + dataLevel: number; + schema: any; + schemaPath: string; + baseId: string; + async: boolean; + opts: Options; + formats: { + [index: string]: FormatDefinition | undefined; + }; + compositeRule: boolean; + validate: (schema: object) => boolean; + util: { + copy(obj: any, target?: any): any; + toHash(source: string[]): { [index: string]: true | undefined }; + equal(obj: any, target: any): boolean; + getProperty(str: string): string; + schemaHasRules(schema: object, rules: any): string; + escapeQuotes(str: string): string; + toQuotedString(str: string): string; + getData(jsonPointer: string, dataLevel: number, paths: string[]): string; + escapeJsonPointer(str: string): string; + unescapeJsonPointer(str: string): string; + escapeFragment(str: string): string; + unescapeFragment(str: string): string; + }; + self: Ajv; + } + + interface SchemaValidateFunction { + ( + schema: any, + data: any, + parentSchema?: object, + dataPath?: string, + parentData?: object | Array<any>, + parentDataProperty?: string | number, + rootData?: object | Array<any> + ): boolean | Thenable<any>; + errors?: Array<ErrorObject>; + } + + interface ErrorsTextOptions { + separator?: string; + dataVar?: string; + } + + interface ErrorObject { + keyword: string; + dataPath: string; + schemaPath: string; + params: ErrorParameters; + // Added to validation errors of propertyNames keyword schema + propertyName?: string; + // Excluded if messages set to false. + message?: string; + // These are added with the `verbose` option. + schema?: any; + parentSchema?: object; + data?: any; + } + + type ErrorParameters = RefParams | LimitParams | AdditionalPropertiesParams | + DependenciesParams | FormatParams | ComparisonParams | + MultipleOfParams | PatternParams | RequiredParams | + TypeParams | UniqueItemsParams | CustomParams | + PatternGroupsParams | PatternRequiredParams | + PropertyNamesParams | SwitchParams | NoParams | EnumParams; + + interface RefParams { + ref: string; + } + + interface LimitParams { + limit: number; + } + + interface AdditionalPropertiesParams { + additionalProperty: string; + } + + interface DependenciesParams { + property: string; + missingProperty: string; + depsCount: number; + deps: string; + } + + interface FormatParams { + format: string + } + + interface ComparisonParams { + comparison: string; + limit: number | string; + exclusive: boolean; + } + + interface MultipleOfParams { + multipleOf: number; + } + + interface PatternParams { + pattern: string; + } + + interface RequiredParams { + missingProperty: string; + } + + interface TypeParams { + type: string; + } + + interface UniqueItemsParams { + i: number; + j: number; + } + + interface CustomParams { + keyword: string; + } + + interface PatternGroupsParams { + reason: string; + limit: number; + pattern: string; + } + + interface PatternRequiredParams { + missingPattern: string; + } + + interface PropertyNamesParams { + propertyName: string; + } + + interface SwitchParams { + caseIndex: number; + } + + interface NoParams {} + + interface EnumParams { + allowedValues: Array<any>; + } +} + +declare class ValidationError extends Error { + constructor(errors: Array<ajv.ErrorObject>); + + message: string; + errors: Array<ajv.ErrorObject>; + ajv: true; + validation: true; +} + +declare class MissingRefError extends Error { + constructor(baseId: string, ref: string, message?: string); + static message: (baseId: string, ref: string) => string; + + message: string; + missingRef: string; + missingSchema: string; +} + +export = ajv; diff --git a/appasar/canary/node_modules/ajv/lib/ajv.js b/appasar/canary/node_modules/ajv/lib/ajv.js new file mode 100644 index 0000000..3148b8e --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/ajv.js @@ -0,0 +1,502 @@ +'use strict'; + +var compileSchema = require('./compile') + , resolve = require('./compile/resolve') + , Cache = require('./cache') + , SchemaObject = require('./compile/schema_obj') + , stableStringify = require('fast-json-stable-stringify') + , formats = require('./compile/formats') + , rules = require('./compile/rules') + , $dataMetaSchema = require('./$data') + , patternGroups = require('./patternGroups') + , util = require('./compile/util') + , co = require('co'); + +module.exports = Ajv; + +Ajv.prototype.validate = validate; +Ajv.prototype.compile = compile; +Ajv.prototype.addSchema = addSchema; +Ajv.prototype.addMetaSchema = addMetaSchema; +Ajv.prototype.validateSchema = validateSchema; +Ajv.prototype.getSchema = getSchema; +Ajv.prototype.removeSchema = removeSchema; +Ajv.prototype.addFormat = addFormat; +Ajv.prototype.errorsText = errorsText; + +Ajv.prototype._addSchema = _addSchema; +Ajv.prototype._compile = _compile; + +Ajv.prototype.compileAsync = require('./compile/async'); +var customKeyword = require('./keyword'); +Ajv.prototype.addKeyword = customKeyword.add; +Ajv.prototype.getKeyword = customKeyword.get; +Ajv.prototype.removeKeyword = customKeyword.remove; + +var errorClasses = require('./compile/error_classes'); +Ajv.ValidationError = errorClasses.Validation; +Ajv.MissingRefError = errorClasses.MissingRef; +Ajv.$dataMetaSchema = $dataMetaSchema; + +var META_SCHEMA_ID = 'http://json-schema.org/draft-06/schema'; + +var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes' ]; +var META_SUPPORT_DATA = ['/properties']; + +/** + * Creates validator instance. + * Usage: `Ajv(opts)` + * @param {Object} opts optional options + * @return {Object} ajv instance + */ +function Ajv(opts) { + if (!(this instanceof Ajv)) return new Ajv(opts); + opts = this._opts = util.copy(opts) || {}; + setLogger(this); + this._schemas = {}; + this._refs = {}; + this._fragments = {}; + this._formats = formats(opts.format); + var schemaUriFormat = this._schemaUriFormat = this._formats['uri-reference']; + this._schemaUriFormatFunc = function (str) { return schemaUriFormat.test(str); }; + + this._cache = opts.cache || new Cache; + this._loadingSchemas = {}; + this._compilations = []; + this.RULES = rules(); + this._getId = chooseGetId(opts); + + opts.loopRequired = opts.loopRequired || Infinity; + if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true; + if (opts.serialize === undefined) opts.serialize = stableStringify; + this._metaOpts = getMetaSchemaOptions(this); + + if (opts.formats) addInitialFormats(this); + addDraft6MetaSchema(this); + if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta); + addInitialSchemas(this); + if (opts.patternGroups) patternGroups(this); +} + + + +/** + * Validate data using schema + * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize. + * @this Ajv + * @param {String|Object} schemaKeyRef key, ref or schema object + * @param {Any} data to be validated + * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). + */ +function validate(schemaKeyRef, data) { + var v; + if (typeof schemaKeyRef == 'string') { + v = this.getSchema(schemaKeyRef); + if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"'); + } else { + var schemaObj = this._addSchema(schemaKeyRef); + v = schemaObj.validate || this._compile(schemaObj); + } + + var valid = v(data); + if (v.$async === true) + return this._opts.async == '*' ? co(valid) : valid; + this.errors = v.errors; + return valid; +} + + +/** + * Create validating function for passed schema. + * @this Ajv + * @param {Object} schema schema object + * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. + * @return {Function} validating function + */ +function compile(schema, _meta) { + var schemaObj = this._addSchema(schema, undefined, _meta); + return schemaObj.validate || this._compile(schemaObj); +} + + +/** + * Adds schema to the instance. + * @this Ajv + * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. + * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. + * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + * @return {Ajv} this for method chaining + */ +function addSchema(schema, key, _skipValidation, _meta) { + if (Array.isArray(schema)){ + for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta); + return this; + } + var id = this._getId(schema); + if (id !== undefined && typeof id != 'string') + throw new Error('schema id must be string'); + key = resolve.normalizeId(key || id); + checkUnique(this, key); + this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true); + return this; +} + + +/** + * Add schema that will be used to validate other schemas + * options in META_IGNORE_OPTIONS are alway set to false + * @this Ajv + * @param {Object} schema schema object + * @param {String} key optional schema key + * @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema + * @return {Ajv} this for method chaining + */ +function addMetaSchema(schema, key, skipValidation) { + this.addSchema(schema, key, skipValidation, true); + return this; +} + + +/** + * Validate schema + * @this Ajv + * @param {Object} schema schema to validate + * @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid + * @return {Boolean} true if schema is valid + */ +function validateSchema(schema, throwOrLogError) { + var $schema = schema.$schema; + if ($schema !== undefined && typeof $schema != 'string') + throw new Error('$schema must be a string'); + $schema = $schema || this._opts.defaultMeta || defaultMeta(this); + if (!$schema) { + this.logger.warn('meta-schema not available'); + this.errors = null; + return true; + } + var currentUriFormat = this._formats.uri; + this._formats.uri = typeof currentUriFormat == 'function' + ? this._schemaUriFormatFunc + : this._schemaUriFormat; + var valid; + try { valid = this.validate($schema, schema); } + finally { this._formats.uri = currentUriFormat; } + if (!valid && throwOrLogError) { + var message = 'schema is invalid: ' + this.errorsText(); + if (this._opts.validateSchema == 'log') this.logger.error(message); + else throw new Error(message); + } + return valid; +} + + +function defaultMeta(self) { + var meta = self._opts.meta; + self._opts.defaultMeta = typeof meta == 'object' + ? self._getId(meta) || meta + : self.getSchema(META_SCHEMA_ID) + ? META_SCHEMA_ID + : undefined; + return self._opts.defaultMeta; +} + + +/** + * Get compiled schema from the instance by `key` or `ref`. + * @this Ajv + * @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id). + * @return {Function} schema validating function (with property `schema`). + */ +function getSchema(keyRef) { + var schemaObj = _getSchemaObj(this, keyRef); + switch (typeof schemaObj) { + case 'object': return schemaObj.validate || this._compile(schemaObj); + case 'string': return this.getSchema(schemaObj); + case 'undefined': return _getSchemaFragment(this, keyRef); + } +} + + +function _getSchemaFragment(self, ref) { + var res = resolve.schema.call(self, { schema: {} }, ref); + if (res) { + var schema = res.schema + , root = res.root + , baseId = res.baseId; + var v = compileSchema.call(self, schema, root, undefined, baseId); + self._fragments[ref] = new SchemaObject({ + ref: ref, + fragment: true, + schema: schema, + root: root, + baseId: baseId, + validate: v + }); + return v; + } +} + + +function _getSchemaObj(self, keyRef) { + keyRef = resolve.normalizeId(keyRef); + return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef]; +} + + +/** + * Remove cached schema(s). + * If no parameter is passed all schemas but meta-schemas are removed. + * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + * Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + * @this Ajv + * @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object + * @return {Ajv} this for method chaining + */ +function removeSchema(schemaKeyRef) { + if (schemaKeyRef instanceof RegExp) { + _removeAllSchemas(this, this._schemas, schemaKeyRef); + _removeAllSchemas(this, this._refs, schemaKeyRef); + return this; + } + switch (typeof schemaKeyRef) { + case 'undefined': + _removeAllSchemas(this, this._schemas); + _removeAllSchemas(this, this._refs); + this._cache.clear(); + return this; + case 'string': + var schemaObj = _getSchemaObj(this, schemaKeyRef); + if (schemaObj) this._cache.del(schemaObj.cacheKey); + delete this._schemas[schemaKeyRef]; + delete this._refs[schemaKeyRef]; + return this; + case 'object': + var serialize = this._opts.serialize; + var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef; + this._cache.del(cacheKey); + var id = this._getId(schemaKeyRef); + if (id) { + id = resolve.normalizeId(id); + delete this._schemas[id]; + delete this._refs[id]; + } + } + return this; +} + + +function _removeAllSchemas(self, schemas, regex) { + for (var keyRef in schemas) { + var schemaObj = schemas[keyRef]; + if (!schemaObj.meta && (!regex || regex.test(keyRef))) { + self._cache.del(schemaObj.cacheKey); + delete schemas[keyRef]; + } + } +} + + +/* @this Ajv */ +function _addSchema(schema, skipValidation, meta, shouldAddSchema) { + if (typeof schema != 'object' && typeof schema != 'boolean') + throw new Error('schema should be object or boolean'); + var serialize = this._opts.serialize; + var cacheKey = serialize ? serialize(schema) : schema; + var cached = this._cache.get(cacheKey); + if (cached) return cached; + + shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false; + + var id = resolve.normalizeId(this._getId(schema)); + if (id && shouldAddSchema) checkUnique(this, id); + + var willValidate = this._opts.validateSchema !== false && !skipValidation; + var recursiveMeta; + if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema))) + this.validateSchema(schema, true); + + var localRefs = resolve.ids.call(this, schema); + + var schemaObj = new SchemaObject({ + id: id, + schema: schema, + localRefs: localRefs, + cacheKey: cacheKey, + meta: meta + }); + + if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj; + this._cache.put(cacheKey, schemaObj); + + if (willValidate && recursiveMeta) this.validateSchema(schema, true); + + return schemaObj; +} + + +/* @this Ajv */ +function _compile(schemaObj, root) { + if (schemaObj.compiling) { + schemaObj.validate = callValidate; + callValidate.schema = schemaObj.schema; + callValidate.errors = null; + callValidate.root = root ? root : callValidate; + if (schemaObj.schema.$async === true) + callValidate.$async = true; + return callValidate; + } + schemaObj.compiling = true; + + var currentOpts; + if (schemaObj.meta) { + currentOpts = this._opts; + this._opts = this._metaOpts; + } + + var v; + try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); } + finally { + schemaObj.compiling = false; + if (schemaObj.meta) this._opts = currentOpts; + } + + schemaObj.validate = v; + schemaObj.refs = v.refs; + schemaObj.refVal = v.refVal; + schemaObj.root = v.root; + return v; + + + function callValidate() { + var _validate = schemaObj.validate; + var result = _validate.apply(null, arguments); + callValidate.errors = _validate.errors; + return result; + } +} + + +function chooseGetId(opts) { + switch (opts.schemaId) { + case '$id': return _get$Id; + case 'id': return _getId; + default: return _get$IdOrId; + } +} + +/* @this Ajv */ +function _getId(schema) { + if (schema.$id) this.logger.warn('schema $id ignored', schema.$id); + return schema.id; +} + +/* @this Ajv */ +function _get$Id(schema) { + if (schema.id) this.logger.warn('schema id ignored', schema.id); + return schema.$id; +} + + +function _get$IdOrId(schema) { + if (schema.$id && schema.id && schema.$id != schema.id) + throw new Error('schema $id is different from id'); + return schema.$id || schema.id; +} + + +/** + * Convert array of error message objects to string + * @this Ajv + * @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used. + * @param {Object} options optional options with properties `separator` and `dataVar`. + * @return {String} human readable string with all errors descriptions + */ +function errorsText(errors, options) { + errors = errors || this.errors; + if (!errors) return 'No errors'; + options = options || {}; + var separator = options.separator === undefined ? ', ' : options.separator; + var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; + + var text = ''; + for (var i=0; i<errors.length; i++) { + var e = errors[i]; + if (e) text += dataVar + e.dataPath + ' ' + e.message + separator; + } + return text.slice(0, -separator.length); +} + + +/** + * Add custom format + * @this Ajv + * @param {String} name format name + * @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) + * @return {Ajv} this for method chaining + */ +function addFormat(name, format) { + if (typeof format == 'string') format = new RegExp(format); + this._formats[name] = format; + return this; +} + + +function addDraft6MetaSchema(self) { + var $dataSchema; + if (self._opts.$data) { + $dataSchema = require('./refs/$data.json'); + self.addMetaSchema($dataSchema, $dataSchema.$id, true); + } + if (self._opts.meta === false) return; + var metaSchema = require('./refs/json-schema-draft-06.json'); + if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA); + self.addMetaSchema(metaSchema, META_SCHEMA_ID, true); + self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID; +} + + +function addInitialSchemas(self) { + var optsSchemas = self._opts.schemas; + if (!optsSchemas) return; + if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas); + else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key); +} + + +function addInitialFormats(self) { + for (var name in self._opts.formats) { + var format = self._opts.formats[name]; + self.addFormat(name, format); + } +} + + +function checkUnique(self, id) { + if (self._schemas[id] || self._refs[id]) + throw new Error('schema with key or id "' + id + '" already exists'); +} + + +function getMetaSchemaOptions(self) { + var metaOpts = util.copy(self._opts); + for (var i=0; i<META_IGNORE_OPTIONS.length; i++) + delete metaOpts[META_IGNORE_OPTIONS[i]]; + return metaOpts; +} + + +function setLogger(self) { + var logger = self._opts.logger; + if (logger === false) { + self.logger = {log: noop, warn: noop, error: noop}; + } else { + if (logger === undefined) logger = console; + if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error)) + throw new Error('logger must implement log, warn and error methods'); + self.logger = logger; + } +} + + +function noop() {} diff --git a/appasar/canary/node_modules/ajv/lib/cache.js b/appasar/canary/node_modules/ajv/lib/cache.js new file mode 100644 index 0000000..7558874 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/cache.js @@ -0,0 +1,26 @@ +'use strict'; + + +var Cache = module.exports = function Cache() { + this._cache = {}; +}; + + +Cache.prototype.put = function Cache_put(key, value) { + this._cache[key] = value; +}; + + +Cache.prototype.get = function Cache_get(key) { + return this._cache[key]; +}; + + +Cache.prototype.del = function Cache_del(key) { + delete this._cache[key]; +}; + + +Cache.prototype.clear = function Cache_clear() { + this._cache = {}; +}; diff --git a/appasar/canary/node_modules/ajv/lib/compile/_rules.js b/appasar/canary/node_modules/ajv/lib/compile/_rules.js new file mode 100644 index 0000000..3fe6997 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/_rules.js @@ -0,0 +1,31 @@ +'use strict'; + +//all requires must be explicit because browserify won't work with dynamic requires +module.exports = { + '$ref': require('../dotjs/ref'), + allOf: require('../dotjs/allOf'), + anyOf: require('../dotjs/anyOf'), + const: require('../dotjs/const'), + contains: require('../dotjs/contains'), + dependencies: require('../dotjs/dependencies'), + 'enum': require('../dotjs/enum'), + format: require('../dotjs/format'), + items: require('../dotjs/items'), + maximum: require('../dotjs/_limit'), + minimum: require('../dotjs/_limit'), + maxItems: require('../dotjs/_limitItems'), + minItems: require('../dotjs/_limitItems'), + maxLength: require('../dotjs/_limitLength'), + minLength: require('../dotjs/_limitLength'), + maxProperties: require('../dotjs/_limitProperties'), + minProperties: require('../dotjs/_limitProperties'), + multipleOf: require('../dotjs/multipleOf'), + not: require('../dotjs/not'), + oneOf: require('../dotjs/oneOf'), + pattern: require('../dotjs/pattern'), + properties: require('../dotjs/properties'), + propertyNames: require('../dotjs/propertyNames'), + required: require('../dotjs/required'), + uniqueItems: require('../dotjs/uniqueItems'), + validate: require('../dotjs/validate') +}; diff --git a/appasar/canary/node_modules/ajv/lib/compile/async.js b/appasar/canary/node_modules/ajv/lib/compile/async.js new file mode 100644 index 0000000..6a30b88 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/async.js @@ -0,0 +1,90 @@ +'use strict'; + +var MissingRefError = require('./error_classes').MissingRef; + +module.exports = compileAsync; + + +/** + * Creates validating function for passed schema with asynchronous loading of missing schemas. + * `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. + * @this Ajv + * @param {Object} schema schema object + * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped + * @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function. + * @return {Promise} promise that resolves with a validating function. + */ +function compileAsync(schema, meta, callback) { + /* eslint no-shadow: 0 */ + /* global Promise */ + /* jshint validthis: true */ + var self = this; + if (typeof this._opts.loadSchema != 'function') + throw new Error('options.loadSchema should be a function'); + + if (typeof meta == 'function') { + callback = meta; + meta = undefined; + } + + var p = loadMetaSchemaOf(schema).then(function () { + var schemaObj = self._addSchema(schema, undefined, meta); + return schemaObj.validate || _compileAsync(schemaObj); + }); + + if (callback) { + p.then( + function(v) { callback(null, v); }, + callback + ); + } + + return p; + + + function loadMetaSchemaOf(sch) { + var $schema = sch.$schema; + return $schema && !self.getSchema($schema) + ? compileAsync.call(self, { $ref: $schema }, true) + : Promise.resolve(); + } + + + function _compileAsync(schemaObj) { + try { return self._compile(schemaObj); } + catch(e) { + if (e instanceof MissingRefError) return loadMissingSchema(e); + throw e; + } + + + function loadMissingSchema(e) { + var ref = e.missingSchema; + if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved'); + + var schemaPromise = self._loadingSchemas[ref]; + if (!schemaPromise) { + schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref); + schemaPromise.then(removePromise, removePromise); + } + + return schemaPromise.then(function (sch) { + if (!added(ref)) { + return loadMetaSchemaOf(sch).then(function () { + if (!added(ref)) self.addSchema(sch, ref, undefined, meta); + }); + } + }).then(function() { + return _compileAsync(schemaObj); + }); + + function removePromise() { + delete self._loadingSchemas[ref]; + } + + function added(ref) { + return self._refs[ref] || self._schemas[ref]; + } + } + } +} diff --git a/appasar/canary/node_modules/ajv/lib/compile/equal.js b/appasar/canary/node_modules/ajv/lib/compile/equal.js new file mode 100644 index 0000000..911774c --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/equal.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('fast-deep-equal'); diff --git a/appasar/canary/node_modules/ajv/lib/compile/error_classes.js b/appasar/canary/node_modules/ajv/lib/compile/error_classes.js new file mode 100644 index 0000000..0b0ec4e --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/error_classes.js @@ -0,0 +1,34 @@ +'use strict'; + +var resolve = require('./resolve'); + +module.exports = { + Validation: errorSubclass(ValidationError), + MissingRef: errorSubclass(MissingRefError) +}; + + +function ValidationError(errors) { + this.message = 'validation failed'; + this.errors = errors; + this.ajv = this.validation = true; +} + + +MissingRefError.message = function (baseId, ref) { + return 'can\'t resolve reference ' + ref + ' from id ' + baseId; +}; + + +function MissingRefError(baseId, ref, message) { + this.message = message || MissingRefError.message(baseId, ref); + this.missingRef = resolve.url(baseId, ref); + this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef)); +} + + +function errorSubclass(Subclass) { + Subclass.prototype = Object.create(Error.prototype); + Subclass.prototype.constructor = Subclass; + return Subclass; +} diff --git a/appasar/canary/node_modules/ajv/lib/compile/formats.js b/appasar/canary/node_modules/ajv/lib/compile/formats.js new file mode 100644 index 0000000..b3a1541 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/formats.js @@ -0,0 +1,135 @@ +'use strict'; + +var util = require('./util'); + +var DATE = /^\d\d\d\d-(\d\d)-(\d\d)$/; +var DAYS = [0,31,29,31,30,31,30,31,31,30,31,30,31]; +var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i; +var HOSTNAME = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i; +var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +// uri-template: https://tools.ietf.org/html/rfc6570 +var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; +// For the source: https://gist.github.com/dperini/729294 +// For test cases: https://mathiasbynens.be/demo/url-regex +// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. +// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; +var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; +var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; +var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$|^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; +var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; + + +module.exports = formats; + +function formats(mode) { + mode = mode == 'full' ? 'full' : 'fast'; + return util.copy(formats[mode]); +} + + +formats.fast = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: /^[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i, + 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i, + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+-.]*)(?::|\/)\/?[^\s]*$/i, + 'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i, + 'uri-template': URITEMPLATE, + url: URL, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') + email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, + hostname: HOSTNAME, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses + ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, + regex: regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: UUID, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + 'json-pointer': JSON_POINTER, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + 'relative-json-pointer': RELATIVE_JSON_POINTER +}; + + +formats.full = { + date: date, + time: time, + 'date-time': date_time, + uri: uri, + 'uri-reference': URIREF, + 'uri-template': URITEMPLATE, + url: URL, + email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: hostname, + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, + regex: regex, + uuid: UUID, + 'json-pointer': JSON_POINTER, + 'relative-json-pointer': RELATIVE_JSON_POINTER +}; + + +function date(str) { + // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 + var matches = str.match(DATE); + if (!matches) return false; + + var month = +matches[1]; + var day = +matches[2]; + return month >= 1 && month <= 12 && day >= 1 && day <= DAYS[month]; +} + + +function time(str, full) { + var matches = str.match(TIME); + if (!matches) return false; + + var hour = matches[1]; + var minute = matches[2]; + var second = matches[3]; + var timeZone = matches[5]; + return hour <= 23 && minute <= 59 && second <= 59 && (!full || timeZone); +} + + +var DATE_TIME_SEPARATOR = /t|\s/i; +function date_time(str) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + var dateTime = str.split(DATE_TIME_SEPARATOR); + return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); +} + + +function hostname(str) { + // https://tools.ietf.org/html/rfc1034#section-3.5 + // https://tools.ietf.org/html/rfc1123#section-2 + return str.length <= 255 && HOSTNAME.test(str); +} + + +var NOT_URI_FRAGMENT = /\/|:/; +function uri(str) { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str); +} + + +var Z_ANCHOR = /[^\\]\\Z/; +function regex(str) { + if (Z_ANCHOR.test(str)) return false; + try { + new RegExp(str); + return true; + } catch(e) { + return false; + } +} diff --git a/appasar/canary/node_modules/ajv/lib/compile/index.js b/appasar/canary/node_modules/ajv/lib/compile/index.js new file mode 100644 index 0000000..cf4f5b8 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/index.js @@ -0,0 +1,380 @@ +'use strict'; + +var resolve = require('./resolve') + , util = require('./util') + , errorClasses = require('./error_classes') + , stableStringify = require('fast-json-stable-stringify'); + +var validateGenerator = require('../dotjs/validate'); + +/** + * Functions below are used inside compiled validations function + */ + +var co = require('co'); +var ucs2length = util.ucs2length; +var equal = require('fast-deep-equal'); + +// this error is thrown by async schemas to return validation errors via exception +var ValidationError = errorClasses.Validation; + +module.exports = compile; + + +/** + * Compiles schema to validation function + * @this Ajv + * @param {Object} schema schema object + * @param {Object} root object with information about the root schema for this schema + * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution + * @param {String} baseId base ID for IDs in the schema + * @return {Function} validation function + */ +function compile(schema, root, localRefs, baseId) { + /* jshint validthis: true, evil: true */ + /* eslint no-shadow: 0 */ + var self = this + , opts = this._opts + , refVal = [ undefined ] + , refs = {} + , patterns = [] + , patternsHash = {} + , defaults = [] + , defaultsHash = {} + , customRules = []; + + root = root || { schema: schema, refVal: refVal, refs: refs }; + + var c = checkCompiling.call(this, schema, root, baseId); + var compilation = this._compilations[c.index]; + if (c.compiling) return (compilation.callValidate = callValidate); + + var formats = this._formats; + var RULES = this.RULES; + + try { + var v = localCompile(schema, root, localRefs, baseId); + compilation.validate = v; + var cv = compilation.callValidate; + if (cv) { + cv.schema = v.schema; + cv.errors = null; + cv.refs = v.refs; + cv.refVal = v.refVal; + cv.root = v.root; + cv.$async = v.$async; + if (opts.sourceCode) cv.source = v.source; + } + return v; + } finally { + endCompiling.call(this, schema, root, baseId); + } + + function callValidate() { + var validate = compilation.validate; + var result = validate.apply(null, arguments); + callValidate.errors = validate.errors; + return result; + } + + function localCompile(_schema, _root, localRefs, baseId) { + var isRoot = !_root || (_root && _root.schema == _schema); + if (_root.schema != root.schema) + return compile.call(self, _schema, _root, localRefs, baseId); + + var $async = _schema.$async === true; + + var sourceCode = validateGenerator({ + isTop: true, + schema: _schema, + isRoot: isRoot, + baseId: baseId, + root: _root, + schemaPath: '', + errSchemaPath: '#', + errorPath: '""', + MissingRefError: errorClasses.MissingRef, + RULES: RULES, + validate: validateGenerator, + util: util, + resolve: resolve, + resolveRef: resolveRef, + usePattern: usePattern, + useDefault: useDefault, + useCustomRule: useCustomRule, + opts: opts, + formats: formats, + logger: self.logger, + self: self + }); + + sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) + + vars(defaults, defaultCode) + vars(customRules, customRuleCode) + + sourceCode; + + if (opts.processCode) sourceCode = opts.processCode(sourceCode); + // console.log('\n\n\n *** \n', JSON.stringify(sourceCode)); + var validate; + try { + var makeValidate = new Function( + 'self', + 'RULES', + 'formats', + 'root', + 'refVal', + 'defaults', + 'customRules', + 'co', + 'equal', + 'ucs2length', + 'ValidationError', + sourceCode + ); + + validate = makeValidate( + self, + RULES, + formats, + root, + refVal, + defaults, + customRules, + co, + equal, + ucs2length, + ValidationError + ); + + refVal[0] = validate; + } catch(e) { + self.logger.error('Error compiling schema, function code:', sourceCode); + throw e; + } + + validate.schema = _schema; + validate.errors = null; + validate.refs = refs; + validate.refVal = refVal; + validate.root = isRoot ? validate : _root; + if ($async) validate.$async = true; + if (opts.sourceCode === true) { + validate.source = { + code: sourceCode, + patterns: patterns, + defaults: defaults + }; + } + + return validate; + } + + function resolveRef(baseId, ref, isRoot) { + ref = resolve.url(baseId, ref); + var refIndex = refs[ref]; + var _refVal, refCode; + if (refIndex !== undefined) { + _refVal = refVal[refIndex]; + refCode = 'refVal[' + refIndex + ']'; + return resolvedRef(_refVal, refCode); + } + if (!isRoot && root.refs) { + var rootRefId = root.refs[ref]; + if (rootRefId !== undefined) { + _refVal = root.refVal[rootRefId]; + refCode = addLocalRef(ref, _refVal); + return resolvedRef(_refVal, refCode); + } + } + + refCode = addLocalRef(ref); + var v = resolve.call(self, localCompile, root, ref); + if (v === undefined) { + var localSchema = localRefs && localRefs[ref]; + if (localSchema) { + v = resolve.inlineRef(localSchema, opts.inlineRefs) + ? localSchema + : compile.call(self, localSchema, root, localRefs, baseId); + } + } + + if (v === undefined) { + removeLocalRef(ref); + } else { + replaceLocalRef(ref, v); + return resolvedRef(v, refCode); + } + } + + function addLocalRef(ref, v) { + var refId = refVal.length; + refVal[refId] = v; + refs[ref] = refId; + return 'refVal' + refId; + } + + function removeLocalRef(ref) { + delete refs[ref]; + } + + function replaceLocalRef(ref, v) { + var refId = refs[ref]; + refVal[refId] = v; + } + + function resolvedRef(refVal, code) { + return typeof refVal == 'object' || typeof refVal == 'boolean' + ? { code: code, schema: refVal, inline: true } + : { code: code, $async: refVal && refVal.$async }; + } + + function usePattern(regexStr) { + var index = patternsHash[regexStr]; + if (index === undefined) { + index = patternsHash[regexStr] = patterns.length; + patterns[index] = regexStr; + } + return 'pattern' + index; + } + + function useDefault(value) { + switch (typeof value) { + case 'boolean': + case 'number': + return '' + value; + case 'string': + return util.toQuotedString(value); + case 'object': + if (value === null) return 'null'; + var valueStr = stableStringify(value); + var index = defaultsHash[valueStr]; + if (index === undefined) { + index = defaultsHash[valueStr] = defaults.length; + defaults[index] = value; + } + return 'default' + index; + } + } + + function useCustomRule(rule, schema, parentSchema, it) { + var validateSchema = rule.definition.validateSchema; + if (validateSchema && self._opts.validateSchema !== false) { + var valid = validateSchema(schema); + if (!valid) { + var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); + if (self._opts.validateSchema == 'log') self.logger.error(message); + else throw new Error(message); + } + } + + var compile = rule.definition.compile + , inline = rule.definition.inline + , macro = rule.definition.macro; + + var validate; + if (compile) { + validate = compile.call(self, schema, parentSchema, it); + } else if (macro) { + validate = macro.call(self, schema, parentSchema, it); + if (opts.validateSchema !== false) self.validateSchema(validate, true); + } else if (inline) { + validate = inline.call(self, it, rule.keyword, schema, parentSchema); + } else { + validate = rule.definition.validate; + if (!validate) return; + } + + if (validate === undefined) + throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); + + var index = customRules.length; + customRules[index] = validate; + + return { + code: 'customRule' + index, + validate: validate + }; + } +} + + +/** + * Checks if the schema is currently compiled + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean) + */ +function checkCompiling(schema, root, baseId) { + /* jshint validthis: true */ + var index = compIndex.call(this, schema, root, baseId); + if (index >= 0) return { index: index, compiling: true }; + index = this._compilations.length; + this._compilations[index] = { + schema: schema, + root: root, + baseId: baseId + }; + return { index: index, compiling: false }; +} + + +/** + * Removes the schema from the currently compiled list + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + */ +function endCompiling(schema, root, baseId) { + /* jshint validthis: true */ + var i = compIndex.call(this, schema, root, baseId); + if (i >= 0) this._compilations.splice(i, 1); +} + + +/** + * Index of schema compilation in the currently compiled list + * @this Ajv + * @param {Object} schema schema to compile + * @param {Object} root root object + * @param {String} baseId base schema ID + * @return {Integer} compilation index + */ +function compIndex(schema, root, baseId) { + /* jshint validthis: true */ + for (var i=0; i<this._compilations.length; i++) { + var c = this._compilations[i]; + if (c.schema == schema && c.root == root && c.baseId == baseId) return i; + } + return -1; +} + + +function patternCode(i, patterns) { + return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');'; +} + + +function defaultCode(i) { + return 'var default' + i + ' = defaults[' + i + '];'; +} + + +function refValCode(i, refVal) { + return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];'; +} + + +function customRuleCode(i) { + return 'var customRule' + i + ' = customRules[' + i + '];'; +} + + +function vars(arr, statement) { + if (!arr.length) return ''; + var code = ''; + for (var i=0; i<arr.length; i++) + code += statement(i, arr); + return code; +} diff --git a/appasar/canary/node_modules/ajv/lib/compile/resolve.js b/appasar/canary/node_modules/ajv/lib/compile/resolve.js new file mode 100644 index 0000000..7d06afa --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/resolve.js @@ -0,0 +1,271 @@ +'use strict'; + +var url = require('url') + , equal = require('fast-deep-equal') + , util = require('./util') + , SchemaObject = require('./schema_obj') + , traverse = require('json-schema-traverse'); + +module.exports = resolve; + +resolve.normalizeId = normalizeId; +resolve.fullPath = getFullPath; +resolve.url = resolveUrl; +resolve.ids = resolveIds; +resolve.inlineRef = inlineRef; +resolve.schema = resolveSchema; + +/** + * [resolve and compile the references ($ref)] + * @this Ajv + * @param {Function} compile reference to schema compilation funciton (localCompile) + * @param {Object} root object with information about the root schema for the current schema + * @param {String} ref reference to resolve + * @return {Object|Function} schema object (if the schema can be inlined) or validation function + */ +function resolve(compile, root, ref) { + /* jshint validthis: true */ + var refVal = this._refs[ref]; + if (typeof refVal == 'string') { + if (this._refs[refVal]) refVal = this._refs[refVal]; + else return resolve.call(this, compile, root, refVal); + } + + refVal = refVal || this._schemas[ref]; + if (refVal instanceof SchemaObject) { + return inlineRef(refVal.schema, this._opts.inlineRefs) + ? refVal.schema + : refVal.validate || this._compile(refVal); + } + + var res = resolveSchema.call(this, root, ref); + var schema, v, baseId; + if (res) { + schema = res.schema; + root = res.root; + baseId = res.baseId; + } + + if (schema instanceof SchemaObject) { + v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId); + } else if (schema !== undefined) { + v = inlineRef(schema, this._opts.inlineRefs) + ? schema + : compile.call(this, schema, root, undefined, baseId); + } + + return v; +} + + +/** + * Resolve schema, its root and baseId + * @this Ajv + * @param {Object} root root object with properties schema, refVal, refs + * @param {String} ref reference to resolve + * @return {Object} object with properties schema, root, baseId + */ +function resolveSchema(root, ref) { + /* jshint validthis: true */ + var p = url.parse(ref, false, true) + , refPath = _getFullPath(p) + , baseId = getFullPath(this._getId(root.schema)); + if (refPath !== baseId) { + var id = normalizeId(refPath); + var refVal = this._refs[id]; + if (typeof refVal == 'string') { + return resolveRecursive.call(this, root, refVal, p); + } else if (refVal instanceof SchemaObject) { + if (!refVal.validate) this._compile(refVal); + root = refVal; + } else { + refVal = this._schemas[id]; + if (refVal instanceof SchemaObject) { + if (!refVal.validate) this._compile(refVal); + if (id == normalizeId(ref)) + return { schema: refVal, root: root, baseId: baseId }; + root = refVal; + } else { + return; + } + } + if (!root.schema) return; + baseId = getFullPath(this._getId(root.schema)); + } + return getJsonPointer.call(this, p, baseId, root.schema, root); +} + + +/* @this Ajv */ +function resolveRecursive(root, ref, parsedRef) { + /* jshint validthis: true */ + var res = resolveSchema.call(this, root, ref); + if (res) { + var schema = res.schema; + var baseId = res.baseId; + root = res.root; + var id = this._getId(schema); + if (id) baseId = resolveUrl(baseId, id); + return getJsonPointer.call(this, parsedRef, baseId, schema, root); + } +} + + +var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']); +/* @this Ajv */ +function getJsonPointer(parsedRef, baseId, schema, root) { + /* jshint validthis: true */ + parsedRef.hash = parsedRef.hash || ''; + if (parsedRef.hash.slice(0,2) != '#/') return; + var parts = parsedRef.hash.split('/'); + + for (var i = 1; i < parts.length; i++) { + var part = parts[i]; + if (part) { + part = util.unescapeFragment(part); + schema = schema[part]; + if (schema === undefined) break; + var id; + if (!PREVENT_SCOPE_CHANGE[part]) { + id = this._getId(schema); + if (id) baseId = resolveUrl(baseId, id); + if (schema.$ref) { + var $ref = resolveUrl(baseId, schema.$ref); + var res = resolveSchema.call(this, root, $ref); + if (res) { + schema = res.schema; + root = res.root; + baseId = res.baseId; + } + } + } + } + } + if (schema !== undefined && schema !== root.schema) + return { schema: schema, root: root, baseId: baseId }; +} + + +var SIMPLE_INLINED = util.toHash([ + 'type', 'format', 'pattern', + 'maxLength', 'minLength', + 'maxProperties', 'minProperties', + 'maxItems', 'minItems', + 'maximum', 'minimum', + 'uniqueItems', 'multipleOf', + 'required', 'enum' +]); +function inlineRef(schema, limit) { + if (limit === false) return false; + if (limit === undefined || limit === true) return checkNoRef(schema); + else if (limit) return countKeys(schema) <= limit; +} + + +function checkNoRef(schema) { + var item; + if (Array.isArray(schema)) { + for (var i=0; i<schema.length; i++) { + item = schema[i]; + if (typeof item == 'object' && !checkNoRef(item)) return false; + } + } else { + for (var key in schema) { + if (key == '$ref') return false; + item = schema[key]; + if (typeof item == 'object' && !checkNoRef(item)) return false; + } + } + return true; +} + + +function countKeys(schema) { + var count = 0, item; + if (Array.isArray(schema)) { + for (var i=0; i<schema.length; i++) { + item = schema[i]; + if (typeof item == 'object') count += countKeys(item); + if (count == Infinity) return Infinity; + } + } else { + for (var key in schema) { + if (key == '$ref') return Infinity; + if (SIMPLE_INLINED[key]) { + count++; + } else { + item = schema[key]; + if (typeof item == 'object') count += countKeys(item) + 1; + if (count == Infinity) return Infinity; + } + } + } + return count; +} + + +function getFullPath(id, normalize) { + if (normalize !== false) id = normalizeId(id); + var p = url.parse(id, false, true); + return _getFullPath(p); +} + + +function _getFullPath(p) { + var protocolSeparator = p.protocol || p.href.slice(0,2) == '//' ? '//' : ''; + return (p.protocol||'') + protocolSeparator + (p.host||'') + (p.path||'') + '#'; +} + + +var TRAILING_SLASH_HASH = /#\/?$/; +function normalizeId(id) { + return id ? id.replace(TRAILING_SLASH_HASH, '') : ''; +} + + +function resolveUrl(baseId, id) { + id = normalizeId(id); + return url.resolve(baseId, id); +} + + +/* @this Ajv */ +function resolveIds(schema) { + var schemaId = normalizeId(this._getId(schema)); + var baseIds = {'': schemaId}; + var fullPaths = {'': getFullPath(schemaId, false)}; + var localRefs = {}; + var self = this; + + traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (jsonPtr === '') return; + var id = self._getId(sch); + var baseId = baseIds[parentJsonPtr]; + var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword; + if (keyIndex !== undefined) + fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex)); + + if (typeof id == 'string') { + id = baseId = normalizeId(baseId ? url.resolve(baseId, id) : id); + + var refVal = self._refs[id]; + if (typeof refVal == 'string') refVal = self._refs[refVal]; + if (refVal && refVal.schema) { + if (!equal(sch, refVal.schema)) + throw new Error('id "' + id + '" resolves to more than one schema'); + } else if (id != normalizeId(fullPath)) { + if (id[0] == '#') { + if (localRefs[id] && !equal(sch, localRefs[id])) + throw new Error('id "' + id + '" resolves to more than one schema'); + localRefs[id] = sch; + } else { + self._refs[id] = fullPath; + } + } + } + baseIds[jsonPtr] = baseId; + fullPaths[jsonPtr] = fullPath; + }); + + return localRefs; +} diff --git a/appasar/canary/node_modules/ajv/lib/compile/rules.js b/appasar/canary/node_modules/ajv/lib/compile/rules.js new file mode 100644 index 0000000..44830ad --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/rules.js @@ -0,0 +1,58 @@ +'use strict'; + +var ruleModules = require('./_rules') + , toHash = require('./util').toHash; + +module.exports = function rules() { + var RULES = [ + { type: 'number', + rules: [ { 'maximum': ['exclusiveMaximum'] }, + { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] }, + { type: 'string', + rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] }, + { type: 'array', + rules: [ 'maxItems', 'minItems', 'uniqueItems', 'contains', 'items' ] }, + { type: 'object', + rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames', + { 'properties': ['additionalProperties', 'patternProperties'] } ] }, + { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf' ] } + ]; + + var ALL = [ 'type' ]; + var KEYWORDS = [ + 'additionalItems', '$schema', '$id', 'id', 'title', + 'description', 'default', 'definitions' + ]; + var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ]; + RULES.all = toHash(ALL); + RULES.types = toHash(TYPES); + + RULES.forEach(function (group) { + group.rules = group.rules.map(function (keyword) { + var implKeywords; + if (typeof keyword == 'object') { + var key = Object.keys(keyword)[0]; + implKeywords = keyword[key]; + keyword = key; + implKeywords.forEach(function (k) { + ALL.push(k); + RULES.all[k] = true; + }); + } + ALL.push(keyword); + var rule = RULES.all[keyword] = { + keyword: keyword, + code: ruleModules[keyword], + implements: implKeywords + }; + return rule; + }); + + if (group.type) RULES.types[group.type] = group; + }); + + RULES.keywords = toHash(ALL.concat(KEYWORDS)); + RULES.custom = {}; + + return RULES; +}; diff --git a/appasar/canary/node_modules/ajv/lib/compile/schema_obj.js b/appasar/canary/node_modules/ajv/lib/compile/schema_obj.js new file mode 100644 index 0000000..e7903b0 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/schema_obj.js @@ -0,0 +1,9 @@ +'use strict'; + +var util = require('./util'); + +module.exports = SchemaObject; + +function SchemaObject(obj) { + util.copy(obj, this); +} diff --git a/appasar/canary/node_modules/ajv/lib/compile/ucs2length.js b/appasar/canary/node_modules/ajv/lib/compile/ucs2length.js new file mode 100644 index 0000000..d193fb1 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/ucs2length.js @@ -0,0 +1,20 @@ +'use strict'; + +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +module.exports = function ucs2length(str) { + var length = 0 + , len = str.length + , pos = 0 + , value; + while (pos < len) { + length++; + value = str.charCodeAt(pos++); + if (value >= 0xD800 && value <= 0xDBFF && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos); + if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate + } + } + return length; +}; diff --git a/appasar/canary/node_modules/ajv/lib/compile/util.js b/appasar/canary/node_modules/ajv/lib/compile/util.js new file mode 100644 index 0000000..263891c --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/compile/util.js @@ -0,0 +1,267 @@ +'use strict'; + + +module.exports = { + copy: copy, + checkDataType: checkDataType, + checkDataTypes: checkDataTypes, + coerceToTypes: coerceToTypes, + toHash: toHash, + getProperty: getProperty, + escapeQuotes: escapeQuotes, + equal: require('fast-deep-equal'), + ucs2length: require('./ucs2length'), + varOccurences: varOccurences, + varReplace: varReplace, + cleanUpCode: cleanUpCode, + finalCleanUpCode: finalCleanUpCode, + schemaHasRules: schemaHasRules, + schemaHasRulesExcept: schemaHasRulesExcept, + toQuotedString: toQuotedString, + getPathExpr: getPathExpr, + getPath: getPath, + getData: getData, + unescapeFragment: unescapeFragment, + unescapeJsonPointer: unescapeJsonPointer, + escapeFragment: escapeFragment, + escapeJsonPointer: escapeJsonPointer +}; + + +function copy(o, to) { + to = to || {}; + for (var key in o) to[key] = o[key]; + return to; +} + + +function checkDataType(dataType, data, negate) { + var EQUAL = negate ? ' !== ' : ' === ' + , AND = negate ? ' || ' : ' && ' + , OK = negate ? '!' : '' + , NOT = negate ? '' : '!'; + switch (dataType) { + case 'null': return data + EQUAL + 'null'; + case 'array': return OK + 'Array.isArray(' + data + ')'; + case 'object': return '(' + OK + data + AND + + 'typeof ' + data + EQUAL + '"object"' + AND + + NOT + 'Array.isArray(' + data + '))'; + case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + + NOT + '(' + data + ' % 1)' + + AND + data + EQUAL + data + ')'; + default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; + } +} + + +function checkDataTypes(dataTypes, data) { + switch (dataTypes.length) { + case 1: return checkDataType(dataTypes[0], data, true); + default: + var code = ''; + var types = toHash(dataTypes); + if (types.array && types.object) { + code = types.null ? '(': '(!' + data + ' || '; + code += 'typeof ' + data + ' !== "object")'; + delete types.null; + delete types.array; + delete types.object; + } + if (types.number) delete types.integer; + for (var t in types) + code += (code ? ' && ' : '' ) + checkDataType(t, data, true); + + return code; + } +} + + +var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); +function coerceToTypes(optionCoerceTypes, dataTypes) { + if (Array.isArray(dataTypes)) { + var types = []; + for (var i=0; i<dataTypes.length; i++) { + var t = dataTypes[i]; + if (COERCE_TO_TYPES[t]) types[types.length] = t; + else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t; + } + if (types.length) return types; + } else if (COERCE_TO_TYPES[dataTypes]) { + return [dataTypes]; + } else if (optionCoerceTypes === 'array' && dataTypes === 'array') { + return ['array']; + } +} + + +function toHash(arr) { + var hash = {}; + for (var i=0; i<arr.length; i++) hash[arr[i]] = true; + return hash; +} + + +var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; +var SINGLE_QUOTE = /'|\\/g; +function getProperty(key) { + return typeof key == 'number' + ? '[' + key + ']' + : IDENTIFIER.test(key) + ? '.' + key + : "['" + escapeQuotes(key) + "']"; +} + + +function escapeQuotes(str) { + return str.replace(SINGLE_QUOTE, '\\$&') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\f/g, '\\f') + .replace(/\t/g, '\\t'); +} + + +function varOccurences(str, dataVar) { + dataVar += '[^0-9]'; + var matches = str.match(new RegExp(dataVar, 'g')); + return matches ? matches.length : 0; +} + + +function varReplace(str, dataVar, expr) { + dataVar += '([^0-9])'; + expr = expr.replace(/\$/g, '$$$$'); + return str.replace(new RegExp(dataVar, 'g'), expr + '$1'); +} + + +var EMPTY_ELSE = /else\s*{\s*}/g + , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g + , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g; +function cleanUpCode(out) { + return out.replace(EMPTY_ELSE, '') + .replace(EMPTY_IF_NO_ELSE, '') + .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))'); +} + + +var ERRORS_REGEXP = /[^v.]errors/g + , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g + , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g + , RETURN_VALID = 'return errors === 0;' + , RETURN_TRUE = 'validate.errors = null; return true;' + , RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/ + , RETURN_DATA_ASYNC = 'return data;' + , ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g + , REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/; + +function finalCleanUpCode(out, async) { + var matches = out.match(ERRORS_REGEXP); + if (matches && matches.length == 2) { + out = async + ? out.replace(REMOVE_ERRORS_ASYNC, '') + .replace(RETURN_ASYNC, RETURN_DATA_ASYNC) + : out.replace(REMOVE_ERRORS, '') + .replace(RETURN_VALID, RETURN_TRUE); + } + + matches = out.match(ROOTDATA_REGEXP); + if (!matches || matches.length !== 3) return out; + return out.replace(REMOVE_ROOTDATA, ''); +} + + +function schemaHasRules(schema, rules) { + if (typeof schema == 'boolean') return !schema; + for (var key in schema) if (rules[key]) return true; +} + + +function schemaHasRulesExcept(schema, rules, exceptKeyword) { + if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not'; + for (var key in schema) if (key != exceptKeyword && rules[key]) return true; +} + + +function toQuotedString(str) { + return '\'' + escapeQuotes(str) + '\''; +} + + +function getPathExpr(currentPath, expr, jsonPointers, isNumber) { + var path = jsonPointers // false by default + ? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')') + : (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\''); + return joinPaths(currentPath, path); +} + + +function getPath(currentPath, prop, jsonPointers) { + var path = jsonPointers // false by default + ? toQuotedString('/' + escapeJsonPointer(prop)) + : toQuotedString(getProperty(prop)); + return joinPaths(currentPath, path); +} + + +var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; +var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function getData($data, lvl, paths) { + var up, jsonPointer, data, matches; + if ($data === '') return 'rootData'; + if ($data[0] == '/') { + if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data); + jsonPointer = $data; + data = 'rootData'; + } else { + matches = $data.match(RELATIVE_JSON_POINTER); + if (!matches) throw new Error('Invalid JSON-pointer: ' + $data); + up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer == '#') { + if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); + return paths[lvl - up]; + } + + if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); + data = 'data' + ((lvl - up) || ''); + if (!jsonPointer) return data; + } + + var expr = data; + var segments = jsonPointer.split('/'); + for (var i=0; i<segments.length; i++) { + var segment = segments[i]; + if (segment) { + data += getProperty(unescapeJsonPointer(segment)); + expr += ' && ' + data; + } + } + return expr; +} + + +function joinPaths (a, b) { + if (a == '""') return b; + return (a + ' + ' + b).replace(/' \+ '/g, ''); +} + + +function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); +} + + +function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); +} + + +function escapeJsonPointer(str) { + return str.replace(/~/g, '~0').replace(/\//g, '~1'); +} + + +function unescapeJsonPointer(str) { + return str.replace(/~1/g, '/').replace(/~0/g, '~'); +} diff --git a/appasar/canary/node_modules/ajv/lib/dot/_limit.jst b/appasar/canary/node_modules/ajv/lib/dot/_limit.jst new file mode 100644 index 0000000..13e7649 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/_limit.jst @@ -0,0 +1,96 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{## def.setExclusiveLimit: + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; +#}} + +{{ + var $isMax = $keyword == 'maximum' + , $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum' + , $schemaExcl = it.schema[$exclusiveKeyword] + , $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data + , $op = $isMax ? '<' : '>' + , $notOp = $isMax ? '>' : '<' + , $errorKeyword = undefined; +}} + +{{? $isDataExcl }} + {{ + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr) + , $exclusive = 'exclusive' + $lvl + , $exclType = 'exclType' + $lvl + , $exclIsNumber = 'exclIsNumber' + $lvl + , $opExpr = 'op' + $lvl + , $opStr = '\' + ' + $opExpr + ' + \''; + }} + var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}}; + {{ $schemaValueExcl = 'schemaExcl' + $lvl; }} + + var {{=$exclusive}}; + var {{=$exclType}} = typeof {{=$schemaValueExcl}}; + if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') { + {{ var $errorKeyword = $exclusiveKeyword; }} + {{# def.error:'_exclusiveLimit' }} + } else if ({{# def.$dataNotType:'number' }} + {{=$exclType}} == 'number' + ? ( + ({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}}) + ? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}} + : {{=$data}} {{=$notOp}} {{=$schemaValue}} + ) + : ( + ({{=$exclusive}} = {{=$schemaValueExcl}} === true) + ? {{=$data}} {{=$notOp}}= {{=$schemaValue}} + : {{=$data}} {{=$notOp}} {{=$schemaValue}} + ) + || {{=$data}} !== {{=$data}}) { + var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}='; +{{??}} + {{ + var $exclIsNumber = typeof $schemaExcl == 'number' + , $opStr = $op; /*used in error*/ + }} + + {{? $exclIsNumber && $isData }} + {{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }} + if ({{# def.$dataNotType:'number' }} + ( {{=$schemaValue}} === undefined + || {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}} + ? {{=$data}} {{=$notOp}}= {{=$schemaExcl}} + : {{=$data}} {{=$notOp}} {{=$schemaValue}} ) + || {{=$data}} !== {{=$data}}) { + {{??}} + {{ + if ($exclIsNumber && $schema === undefined) { + {{# def.setExclusiveLimit }} + $schemaValue = $schemaExcl; + $notOp += '='; + } else { + if ($exclIsNumber) + $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); + + if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { + {{# def.setExclusiveLimit }} + $notOp += '='; + } else { + $exclusive = false; + $opStr += '='; + } + } + + var $opExpr = '\'' + $opStr + '\''; /*used in error*/ + }} + + if ({{# def.$dataNotType:'number' }} + {{=$data}} {{=$notOp}} {{=$schemaValue}} + || {{=$data}} !== {{=$data}}) { + {{?}} +{{?}} + {{ $errorKeyword = $errorKeyword || $keyword; }} + {{# def.error:'_limit' }} + } {{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/_limitItems.jst b/appasar/canary/node_modules/ajv/lib/dot/_limitItems.jst new file mode 100644 index 0000000..a3e078e --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/_limitItems.jst @@ -0,0 +1,10 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }} +if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) { + {{ var $errorKeyword = $keyword; }} + {{# def.error:'_limitItems' }} +} {{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/_limitLength.jst b/appasar/canary/node_modules/ajv/lib/dot/_limitLength.jst new file mode 100644 index 0000000..cfc8dbb --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/_limitLength.jst @@ -0,0 +1,10 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }} +if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) { + {{ var $errorKeyword = $keyword; }} + {{# def.error:'_limitLength' }} +} {{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/_limitProperties.jst b/appasar/canary/node_modules/ajv/lib/dot/_limitProperties.jst new file mode 100644 index 0000000..da7ea77 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/_limitProperties.jst @@ -0,0 +1,10 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }} +if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) { + {{ var $errorKeyword = $keyword; }} + {{# def.error:'_limitProperties' }} +} {{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/allOf.jst b/appasar/canary/node_modules/ajv/lib/dot/allOf.jst new file mode 100644 index 0000000..4c28363 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/allOf.jst @@ -0,0 +1,34 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + +{{ + var $currentBaseId = $it.baseId + , $allSchemasEmpty = true; +}} + +{{~ $schema:$sch:$i }} + {{? {{# def.nonEmptySchema:$sch }} }} + {{ + $allSchemasEmpty = false; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + }} + + {{# def.insertSubschemaCode }} + + {{# def.ifResultValid }} + {{?}} +{{~}} + +{{? $breakOnError }} + {{? $allSchemasEmpty }} + if (true) { + {{??}} + {{= $closingBraces.slice(0,-1) }} + {{?}} +{{?}} + +{{# def.cleanUp }} diff --git a/appasar/canary/node_modules/ajv/lib/dot/anyOf.jst b/appasar/canary/node_modules/ajv/lib/dot/anyOf.jst new file mode 100644 index 0000000..086cf2b --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/anyOf.jst @@ -0,0 +1,48 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + +{{ + var $noEmptySchema = $schema.every(function($sch) { + return {{# def.nonEmptySchema:$sch }}; + }); +}} +{{? $noEmptySchema }} + {{ var $currentBaseId = $it.baseId; }} + var {{=$errs}} = errors; + var {{=$valid}} = false; + + {{# def.setCompositeRule }} + + {{~ $schema:$sch:$i }} + {{ + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + }} + + {{# def.insertSubschemaCode }} + + {{=$valid}} = {{=$valid}} || {{=$nextValid}}; + + if (!{{=$valid}}) { + {{ $closingBraces += '}'; }} + {{~}} + + {{# def.resetCompositeRule }} + + {{= $closingBraces }} + + if (!{{=$valid}}) { + {{# def.extraError:'anyOf' }} + } else { + {{# def.resetErrors }} + {{? it.opts.allErrors }} } {{?}} + + {{# def.cleanUp }} +{{??}} + {{? $breakOnError }} + if (true) { + {{?}} +{{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/coerce.def b/appasar/canary/node_modules/ajv/lib/dot/coerce.def new file mode 100644 index 0000000..86e0e18 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/coerce.def @@ -0,0 +1,61 @@ +{{## def.coerceType: + {{ + var $dataType = 'dataType' + $lvl + , $coerced = 'coerced' + $lvl; + }} + var {{=$dataType}} = typeof {{=$data}}; + {{? it.opts.coerceTypes == 'array'}} + if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array'; + {{?}} + + var {{=$coerced}} = undefined; + + {{ var $bracesCoercion = ''; }} + {{~ $coerceToTypes:$type:$i }} + {{? $i }} + if ({{=$coerced}} === undefined) { + {{ $bracesCoercion += '}'; }} + {{?}} + + {{? it.opts.coerceTypes == 'array' && $type != 'array' }} + if ({{=$dataType}} == 'array' && {{=$data}}.length == 1) { + {{=$coerced}} = {{=$data}} = {{=$data}}[0]; + {{=$dataType}} = typeof {{=$data}}; + /*if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';*/ + } + {{?}} + + {{? $type == 'string' }} + if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean') + {{=$coerced}} = '' + {{=$data}}; + else if ({{=$data}} === null) {{=$coerced}} = ''; + {{?? $type == 'number' || $type == 'integer' }} + if ({{=$dataType}} == 'boolean' || {{=$data}} === null + || ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}} + {{? $type == 'integer' }} && !({{=$data}} % 1){{?}})) + {{=$coerced}} = +{{=$data}}; + {{?? $type == 'boolean' }} + if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null) + {{=$coerced}} = false; + else if ({{=$data}} === 'true' || {{=$data}} === 1) + {{=$coerced}} = true; + {{?? $type == 'null' }} + if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false) + {{=$coerced}} = null; + {{?? it.opts.coerceTypes == 'array' && $type == 'array' }} + if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null) + {{=$coerced}} = [{{=$data}}]; + {{?}} + {{~}} + + {{= $bracesCoercion }} + + if ({{=$coerced}} === undefined) { + {{# def.error:'type' }} + } else { + {{# def.setParentData }} + {{=$data}} = {{=$coerced}}; + {{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}} + {{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}}; + } +#}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/const.jst b/appasar/canary/node_modules/ajv/lib/dot/const.jst new file mode 100644 index 0000000..2aa2298 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/const.jst @@ -0,0 +1,11 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{? !$isData }} + var schema{{=$lvl}} = validate.schema{{=$schemaPath}}; +{{?}} +var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}}); +{{# def.checkError:'const' }} +{{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/contains.jst b/appasar/canary/node_modules/ajv/lib/dot/contains.jst new file mode 100644 index 0000000..925d2c8 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/contains.jst @@ -0,0 +1,57 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + + +{{ + var $idx = 'i' + $lvl + , $dataNxt = $it.dataLevel = it.dataLevel + 1 + , $nextData = 'data' + $dataNxt + , $currentBaseId = it.baseId + , $nonEmptySchema = {{# def.nonEmptySchema:$schema }}; +}} + +var {{=$errs}} = errors; +var {{=$valid}}; + +{{? $nonEmptySchema }} + {{# def.setCompositeRule }} + + {{ + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + }} + + var {{=$nextValid}} = false; + + for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) { + {{ + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + }} + + {{# def.generateSubschemaCode }} + {{# def.optimizeValidate }} + + if ({{=$nextValid}}) break; + } + + {{# def.resetCompositeRule }} + {{= $closingBraces }} + + if (!{{=$nextValid}}) { +{{??}} + if ({{=$data}}.length == 0) { +{{?}} + + {{# def.error:'contains' }} + } else { + {{? $nonEmptySchema }} + {{# def.resetErrors }} + {{?}} + {{? it.opts.allErrors }} } {{?}} + +{{# def.cleanUp }} diff --git a/appasar/canary/node_modules/ajv/lib/dot/custom.jst b/appasar/canary/node_modules/ajv/lib/dot/custom.jst new file mode 100644 index 0000000..402028e --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/custom.jst @@ -0,0 +1,191 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{ + var $rule = this + , $definition = 'definition' + $lvl + , $rDef = $rule.definition + , $closingBraces = ''; + var $validate = $rDef.validate; + var $compile, $inline, $macro, $ruleValidate, $validateCode; +}} + +{{? $isData && $rDef.$data }} + {{ + $validateCode = 'keywordValidate' + $lvl; + var $validateSchema = $rDef.validateSchema; + }} + var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition; + var {{=$validateCode}} = {{=$definition}}.validate; +{{??}} + {{ + $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); + if (!$ruleValidate) return; + $schemaValue = 'validate.schema' + $schemaPath; + $validateCode = $ruleValidate.code; + $compile = $rDef.compile; + $inline = $rDef.inline; + $macro = $rDef.macro; + }} +{{?}} + +{{ + var $ruleErrs = $validateCode + '.errors' + , $i = 'i' + $lvl + , $ruleErr = 'ruleErr' + $lvl + , $asyncKeyword = $rDef.async; + + if ($asyncKeyword && !it.async) + throw new Error('async keyword in sync schema'); +}} + + +{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}} +var {{=$errs}} = errors; +var {{=$valid}}; + +{{## def.callRuleValidate: + {{=$validateCode}}.call( + {{? it.opts.passContext }}this{{??}}self{{?}} + {{? $compile || $rDef.schema === false }} + , {{=$data}} + {{??}} + , {{=$schemaValue}} + , {{=$data}} + , validate.schema{{=it.schemaPath}} + {{?}} + , {{# def.dataPath }} + {{# def.passParentData }} + , rootData + ) +#}} + +{{## def.extendErrors:_inline: + for (var {{=$i}}={{=$errs}}; {{=$i}}<errors; {{=$i}}++) { + var {{=$ruleErr}} = vErrors[{{=$i}}]; + if ({{=$ruleErr}}.dataPath === undefined) + {{=$ruleErr}}.dataPath = (dataPath || '') + {{= it.errorPath }}; + {{# _inline ? 'if (\{\{=$ruleErr\}\}.schemaPath === undefined) {' : '' }} + {{=$ruleErr}}.schemaPath = "{{=$errSchemaPath}}"; + {{# _inline ? '}' : '' }} + {{? it.opts.verbose }} + {{=$ruleErr}}.schema = {{=$schemaValue}}; + {{=$ruleErr}}.data = {{=$data}}; + {{?}} + } +#}} + + +{{? $isData && $rDef.$data }} + {{ $closingBraces += '}'; }} + if ({{=$schemaValue}} === undefined) { + {{=$valid}} = true; + } else { + {{? $validateSchema }} + {{ $closingBraces += '}'; }} + {{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}}); + if ({{=$valid}}) { + {{?}} +{{?}} + +{{? $inline }} + {{? $rDef.statements }} + {{= $ruleValidate.validate }} + {{??}} + {{=$valid}} = {{= $ruleValidate.validate }}; + {{?}} +{{?? $macro }} + {{# def.setupNextLevel }} + {{ + $it.schema = $ruleValidate.validate; + $it.schemaPath = ''; + }} + {{# def.setCompositeRule }} + {{ var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); }} + {{# def.resetCompositeRule }} + {{= $code }} +{{??}} + {{# def.beginDefOut}} + {{# def.callRuleValidate }} + {{# def.storeDefOut:def_callRuleValidate }} + + {{? $rDef.errors === false }} + {{=$valid}} = {{? $asyncKeyword }}{{=it.yieldAwait}}{{?}}{{= def_callRuleValidate }}; + {{??}} + {{? $asyncKeyword }} + {{ $ruleErrs = 'customErrors' + $lvl; }} + var {{=$ruleErrs}} = null; + try { + {{=$valid}} = {{=it.yieldAwait}}{{= def_callRuleValidate }}; + } catch (e) { + {{=$valid}} = false; + if (e instanceof ValidationError) {{=$ruleErrs}} = e.errors; + else throw e; + } + {{??}} + {{=$ruleErrs}} = null; + {{=$valid}} = {{= def_callRuleValidate }}; + {{?}} + {{?}} +{{?}} + +{{? $rDef.modifying }} + if ({{=$parentData}}) {{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}]; +{{?}} + +{{= $closingBraces }} + +{{## def.notValidationResult: + {{? $rDef.valid === undefined }} + !{{? $macro }}{{=$nextValid}}{{??}}{{=$valid}}{{?}} + {{??}} + {{= !$rDef.valid }} + {{?}} +#}} + +{{? $rDef.valid }} + {{? $breakOnError }} if (true) { {{?}} +{{??}} + if ({{# def.notValidationResult }}) { + {{ $errorKeyword = $rule.keyword; }} + {{# def.beginDefOut}} + {{# def.error:'custom' }} + {{# def.storeDefOut:def_customError }} + + {{? $inline }} + {{? $rDef.errors }} + {{? $rDef.errors != 'full' }} + {{# def.extendErrors:true }} + {{?}} + {{??}} + {{? $rDef.errors === false}} + {{= def_customError }} + {{??}} + if ({{=$errs}} == errors) { + {{= def_customError }} + } else { + {{# def.extendErrors:true }} + } + {{?}} + {{?}} + {{?? $macro }} + {{# def.extraError:'custom' }} + {{??}} + {{? $rDef.errors === false}} + {{= def_customError }} + {{??}} + if (Array.isArray({{=$ruleErrs}})) { + if (vErrors === null) vErrors = {{=$ruleErrs}}; + else vErrors = vErrors.concat({{=$ruleErrs}}); + errors = vErrors.length; + {{# def.extendErrors:false }} + } else { + {{= def_customError }} + } + {{?}} + {{?}} + + } {{? $breakOnError }} else { {{?}} +{{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/defaults.def b/appasar/canary/node_modules/ajv/lib/dot/defaults.def new file mode 100644 index 0000000..5ad8d1d --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/defaults.def @@ -0,0 +1,32 @@ +{{## def.assignDefault: + if ({{=$passData}} === undefined) + {{=$passData}} = {{? it.opts.useDefaults == 'shared' }} + {{= it.useDefault($sch.default) }} + {{??}} + {{= JSON.stringify($sch.default) }} + {{?}}; +#}} + + +{{## def.defaultProperties: + {{ + var $schema = it.schema.properties + , $schemaKeys = Object.keys($schema); }} + {{~ $schemaKeys:$propertyKey }} + {{ var $sch = $schema[$propertyKey]; }} + {{? $sch.default !== undefined }} + {{ var $passData = $data + it.util.getProperty($propertyKey); }} + {{# def.assignDefault }} + {{?}} + {{~}} +#}} + + +{{## def.defaultItems: + {{~ it.schema.items:$sch:$i }} + {{? $sch.default !== undefined }} + {{ var $passData = $data + '[' + $i + ']'; }} + {{# def.assignDefault }} + {{?}} + {{~}} +#}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/definitions.def b/appasar/canary/node_modules/ajv/lib/dot/definitions.def new file mode 100644 index 0000000..cdbe140 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/definitions.def @@ -0,0 +1,199 @@ +{{## def.setupKeyword: + {{ + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + }} +#}} + + +{{## def.setCompositeRule: + {{ + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + }} +#}} + + +{{## def.resetCompositeRule: + {{ it.compositeRule = $it.compositeRule = $wasComposite; }} +#}} + + +{{## def.setupNextLevel: + {{ + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + }} +#}} + + +{{## def.ifValid: + {{? $breakOnError }} + if ({{=$valid}}) { + {{ $closingBraces += '}'; }} + {{?}} +#}} + + +{{## def.ifResultValid: + {{? $breakOnError }} + if ({{=$nextValid}}) { + {{ $closingBraces += '}'; }} + {{?}} +#}} + + +{{## def.elseIfValid: + {{? $breakOnError }} + {{ $closingBraces += '}'; }} + else { + {{?}} +#}} + + +{{## def.nonEmptySchema:_schema: + it.util.schemaHasRules(_schema, it.RULES.all) +#}} + + +{{## def.strLength: + {{? it.opts.unicode === false }} + {{=$data}}.length + {{??}} + ucs2length({{=$data}}) + {{?}} +#}} + + +{{## def.willOptimize: + it.util.varOccurences($code, $nextData) < 2 +#}} + + +{{## def.generateSubschemaCode: + {{ + var $code = it.validate($it); + $it.baseId = $currentBaseId; + }} +#}} + + +{{## def.insertSubschemaCode: + {{= it.validate($it) }} + {{ $it.baseId = $currentBaseId; }} +#}} + + +{{## def._optimizeValidate: + it.util.varReplace($code, $nextData, $passData) +#}} + + +{{## def.optimizeValidate: + {{? {{# def.willOptimize}} }} + {{= {{# def._optimizeValidate }} }} + {{??}} + var {{=$nextData}} = {{=$passData}}; + {{= $code }} + {{?}} +#}} + + +{{## def.cleanUp: {{ out = it.util.cleanUpCode(out); }} #}} + + +{{## def.finalCleanUp: {{ out = it.util.finalCleanUpCode(out, $async); }} #}} + + +{{## def.$data: + {{ + var $isData = it.opts.$data && $schema && $schema.$data + , $schemaValue; + }} + {{? $isData }} + var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }}; + {{ $schemaValue = 'schema' + $lvl; }} + {{??}} + {{ $schemaValue = $schema; }} + {{?}} +#}} + + +{{## def.$dataNotType:_type: + {{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}} +#}} + + +{{## def.check$dataIsArray: + if (schema{{=$lvl}} === undefined) {{=$valid}} = true; + else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false; + else { +#}} + + +{{## def.beginDefOut: + {{ + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + }} +#}} + + +{{## def.storeDefOut:_variable: + {{ + var _variable = out; + out = $$outStack.pop(); + }} +#}} + + +{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}} + +{{## def.setParentData: + {{ + var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData' + , $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + }} +#}} + +{{## def.passParentData: + {{# def.setParentData }} + , {{= $parentData }} + , {{= $parentDataProperty }} +#}} + + +{{## def.iterateProperties: + {{? $ownProperties }} + {{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}}); + for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) { + var {{=$key}} = {{=$dataProperties}}[{{=$idx}}]; + {{??}} + for (var {{=$key}} in {{=$data}}) { + {{?}} +#}} + + +{{## def.noPropertyInData: + {{=$useData}} === undefined + {{? $ownProperties }} + || !{{# def.isOwnProperty }} + {{?}} +#}} + + +{{## def.isOwnProperty: + Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}') +#}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/dependencies.jst b/appasar/canary/node_modules/ajv/lib/dot/dependencies.jst new file mode 100644 index 0000000..c41f334 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/dependencies.jst @@ -0,0 +1,80 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.missing }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + + +{{## def.propertyInData: + {{=$data}}{{= it.util.getProperty($property) }} !== undefined + {{? $ownProperties }} + && Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}') + {{?}} +#}} + + +{{ + var $schemaDeps = {} + , $propertyDeps = {} + , $ownProperties = it.opts.ownProperties; + + for ($property in $schema) { + var $sch = $schema[$property]; + var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; + $deps[$property] = $sch; + } +}} + +var {{=$errs}} = errors; + +{{ var $currentErrorPath = it.errorPath; }} + +var missing{{=$lvl}}; +{{ for (var $property in $propertyDeps) { }} + {{ $deps = $propertyDeps[$property]; }} + {{? $deps.length }} + if ({{# def.propertyInData }} + {{? $breakOnError }} + && ({{# def.checkMissingProperty:$deps }})) { + {{# def.errorMissingProperty:'dependencies' }} + {{??}} + ) { + {{~ $deps:$propertyKey }} + {{# def.allErrorsMissingProperty:'dependencies' }} + {{~}} + {{?}} + } {{# def.elseIfValid }} + {{?}} +{{ } }} + +{{ + it.errorPath = $currentErrorPath; + var $currentBaseId = $it.baseId; +}} + + +{{ for (var $property in $schemaDeps) { }} + {{ var $sch = $schemaDeps[$property]; }} + {{? {{# def.nonEmptySchema:$sch }} }} + {{=$nextValid}} = true; + + if ({{# def.propertyInData }}) { + {{ + $it.schema = $sch; + $it.schemaPath = $schemaPath + it.util.getProperty($property); + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); + }} + + {{# def.insertSubschemaCode }} + } + + {{# def.ifResultValid }} + {{?}} +{{ } }} + +{{? $breakOnError }} + {{= $closingBraces }} + if ({{=$errs}} == errors) { +{{?}} + +{{# def.cleanUp }} diff --git a/appasar/canary/node_modules/ajv/lib/dot/enum.jst b/appasar/canary/node_modules/ajv/lib/dot/enum.jst new file mode 100644 index 0000000..357c2e8 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/enum.jst @@ -0,0 +1,30 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{ + var $i = 'i' + $lvl + , $vSchema = 'schema' + $lvl; +}} + +{{? !$isData }} + var {{=$vSchema}} = validate.schema{{=$schemaPath}}; +{{?}} +var {{=$valid}}; + +{{?$isData}}{{# def.check$dataIsArray }}{{?}} + +{{=$valid}} = false; + +for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++) + if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) { + {{=$valid}} = true; + break; + } + +{{? $isData }} } {{?}} + +{{# def.checkError:'enum' }} + +{{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/errors.def b/appasar/canary/node_modules/ajv/lib/dot/errors.def new file mode 100644 index 0000000..b79646f --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/errors.def @@ -0,0 +1,194 @@ +{{# def.definitions }} + +{{## def._error:_rule: + {{ 'istanbul ignore else'; }} + {{? it.createErrors !== false }} + { + keyword: '{{= $errorKeyword || _rule }}' + , dataPath: (dataPath || '') + {{= it.errorPath }} + , schemaPath: {{=it.util.toQuotedString($errSchemaPath)}} + , params: {{# def._errorParams[_rule] }} + {{? it.opts.messages !== false }} + , message: {{# def._errorMessages[_rule] }} + {{?}} + {{? it.opts.verbose }} + , schema: {{# def._errorSchemas[_rule] }} + , parentSchema: validate.schema{{=it.schemaPath}} + , data: {{=$data}} + {{?}} + } + {{??}} + {} + {{?}} +#}} + + +{{## def._addError:_rule: + if (vErrors === null) vErrors = [err]; + else vErrors.push(err); + errors++; +#}} + + +{{## def.addError:_rule: + var err = {{# def._error:_rule }}; + {{# def._addError:_rule }} +#}} + + +{{## def.error:_rule: + {{# def.beginDefOut}} + {{# def._error:_rule }} + {{# def.storeDefOut:__err }} + + {{? !it.compositeRule && $breakOnError }} + {{ 'istanbul ignore if'; }} + {{? it.async }} + throw new ValidationError([{{=__err}}]); + {{??}} + validate.errors = [{{=__err}}]; + return false; + {{?}} + {{??}} + var err = {{=__err}}; + {{# def._addError:_rule }} + {{?}} +#}} + + +{{## def.extraError:_rule: + {{# def.addError:_rule}} + {{? !it.compositeRule && $breakOnError }} + {{ 'istanbul ignore if'; }} + {{? it.async }} + throw new ValidationError(vErrors); + {{??}} + validate.errors = vErrors; + return false; + {{?}} + {{?}} +#}} + + +{{## def.checkError:_rule: + if (!{{=$valid}}) { + {{# def.error:_rule }} + } +#}} + + +{{## def.resetErrors: + errors = {{=$errs}}; + if (vErrors !== null) { + if ({{=$errs}}) vErrors.length = {{=$errs}}; + else vErrors = null; + } +#}} + + +{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}} +{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}} +{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}} + +{{## def._errorMessages = { + 'false schema': "'boolean schema is false'", + $ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'", + additionalItems: "'should NOT have more than {{=$schema.length}} items'", + additionalProperties: "'should NOT have additional properties'", + anyOf: "'should match some schema in anyOf'", + const: "'should be equal to constant'", + contains: "'should contain a valid item'", + dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'", + 'enum': "'should be equal to one of the allowed values'", + format: "'should match format \"{{#def.concatSchemaEQ}}\"'", + _limit: "'should be {{=$opStr}} {{#def.appendSchema}}", + _exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'", + _limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}less{{?}} than {{#def.concatSchema}} items'", + _limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'", + _limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}less{{?}} than {{#def.concatSchema}} properties'", + multipleOf: "'should be multiple of {{#def.appendSchema}}", + not: "'should NOT be valid'", + oneOf: "'should match exactly one schema in oneOf'", + pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'", + patternGroups: "'should NOT have {{=$moreOrLess}} than {{=$limit}} properties matching pattern \"{{=it.util.escapeQuotes($pgProperty)}}\"'", + propertyNames: "'property name \\'{{=$invalidName}}\\' is invalid'", + required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'", + type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'", + uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'", + custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'", + patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''", + switch: "'should pass \"switch\" keyword validation'", + _formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'", + _formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'" +} #}} + + +{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}} +{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}} + +{{## def._errorSchemas = { + 'false schema': "false", + $ref: "{{=it.util.toQuotedString($schema)}}", + additionalItems: "false", + additionalProperties: "false", + anyOf: "validate.schema{{=$schemaPath}}", + const: "validate.schema{{=$schemaPath}}", + contains: "validate.schema{{=$schemaPath}}", + dependencies: "validate.schema{{=$schemaPath}}", + 'enum': "validate.schema{{=$schemaPath}}", + format: "{{#def.schemaRefOrQS}}", + _limit: "{{#def.schemaRefOrVal}}", + _exclusiveLimit: "validate.schema{{=$schemaPath}}", + _limitItems: "{{#def.schemaRefOrVal}}", + _limitLength: "{{#def.schemaRefOrVal}}", + _limitProperties:"{{#def.schemaRefOrVal}}", + multipleOf: "{{#def.schemaRefOrVal}}", + not: "validate.schema{{=$schemaPath}}", + oneOf: "validate.schema{{=$schemaPath}}", + pattern: "{{#def.schemaRefOrQS}}", + patternGroups: "validate.schema{{=$schemaPath}}", + propertyNames: "validate.schema{{=$schemaPath}}", + required: "validate.schema{{=$schemaPath}}", + type: "validate.schema{{=$schemaPath}}", + uniqueItems: "{{#def.schemaRefOrVal}}", + custom: "validate.schema{{=$schemaPath}}", + patternRequired: "validate.schema{{=$schemaPath}}", + switch: "validate.schema{{=$schemaPath}}", + _formatLimit: "{{#def.schemaRefOrQS}}", + _formatExclusiveLimit: "validate.schema{{=$schemaPath}}" +} #}} + + +{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}} + +{{## def._errorParams = { + 'false schema': "{}", + $ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }", + additionalItems: "{ limit: {{=$schema.length}} }", + additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }", + anyOf: "{}", + const: "{}", + contains: "{}", + dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }", + 'enum': "{ allowedValues: schema{{=$lvl}} }", + format: "{ format: {{#def.schemaValueQS}} }", + _limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }", + _exclusiveLimit: "{}", + _limitItems: "{ limit: {{=$schemaValue}} }", + _limitLength: "{ limit: {{=$schemaValue}} }", + _limitProperties:"{ limit: {{=$schemaValue}} }", + multipleOf: "{ multipleOf: {{=$schemaValue}} }", + not: "{}", + oneOf: "{}", + pattern: "{ pattern: {{#def.schemaValueQS}} }", + patternGroups: "{ reason: '{{=$reason}}', limit: {{=$limit}}, pattern: '{{=it.util.escapeQuotes($pgProperty)}}' }", + propertyNames: "{ propertyName: '{{=$invalidName}}' }", + required: "{ missingProperty: '{{=$missingProperty}}' }", + type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }", + uniqueItems: "{ i: i, j: j }", + custom: "{ keyword: '{{=$rule.keyword}}' }", + patternRequired: "{ missingPattern: '{{=$missingPattern}}' }", + switch: "{ caseIndex: {{=$caseIndex}} }", + _formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }", + _formatExclusiveLimit: "{}" +} #}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/format.jst b/appasar/canary/node_modules/ajv/lib/dot/format.jst new file mode 100644 index 0000000..484dddf --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/format.jst @@ -0,0 +1,106 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} + +{{## def.skipFormat: + {{? $breakOnError }} if (true) { {{?}} + {{ return out; }} +#}} + +{{? it.opts.format === false }}{{# def.skipFormat }}{{?}} + + +{{# def.$data }} + + +{{## def.$dataCheckFormat: + {{# def.$dataNotType:'string' }} + ({{? $unknownFormats != 'ignore' }} + ({{=$schemaValue}} && !{{=$format}} + {{? $allowUnknown }} + && self._opts.unknownFormats.indexOf({{=$schemaValue}}) == -1 + {{?}}) || + {{?}} + ({{=$format}} && {{=$formatType}} == '{{=$ruleType}}' + && !(typeof {{=$format}} == 'function' + ? {{? it.async}} + (async{{=$lvl}} ? {{=it.yieldAwait}} {{=$format}}({{=$data}}) : {{=$format}}({{=$data}})) + {{??}} + {{=$format}}({{=$data}}) + {{?}} + : {{=$format}}.test({{=$data}})))) +#}} + +{{## def.checkFormat: + {{ + var $formatRef = 'formats' + it.util.getProperty($schema); + if ($isObject) $formatRef += '.validate'; + }} + {{? typeof $format == 'function' }} + {{=$formatRef}}({{=$data}}) + {{??}} + {{=$formatRef}}.test({{=$data}}) + {{?}} +#}} + + +{{ + var $unknownFormats = it.opts.unknownFormats + , $allowUnknown = Array.isArray($unknownFormats); +}} + +{{? $isData }} + {{ + var $format = 'format' + $lvl + , $isObject = 'isObject' + $lvl + , $formatType = 'formatType' + $lvl; + }} + var {{=$format}} = formats[{{=$schemaValue}}]; + var {{=$isObject}} = typeof {{=$format}} == 'object' + && !({{=$format}} instanceof RegExp) + && {{=$format}}.validate; + var {{=$formatType}} = {{=$isObject}} && {{=$format}}.type || 'string'; + if ({{=$isObject}}) { + {{? it.async}} + var async{{=$lvl}} = {{=$format}}.async; + {{?}} + {{=$format}} = {{=$format}}.validate; + } + if ({{# def.$dataCheckFormat }}) { +{{??}} + {{ var $format = it.formats[$schema]; }} + {{? !$format }} + {{? $unknownFormats == 'ignore' }} + {{ it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }} + {{# def.skipFormat }} + {{?? $allowUnknown && $unknownFormats.indexOf($schema) >= 0 }} + {{# def.skipFormat }} + {{??}} + {{ throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); }} + {{?}} + {{?}} + {{ + var $isObject = typeof $format == 'object' + && !($format instanceof RegExp) + && $format.validate; + var $formatType = $isObject && $format.type || 'string'; + if ($isObject) { + var $async = $format.async === true; + $format = $format.validate; + } + }} + {{? $formatType != $ruleType }} + {{# def.skipFormat }} + {{?}} + {{? $async }} + {{ + if (!it.async) throw new Error('async format in sync schema'); + var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; + }} + if (!({{=it.yieldAwait}} {{=$formatRef}}({{=$data}}))) { + {{??}} + if (!{{# def.checkFormat }}) { + {{?}} +{{?}} + {{# def.error:'format' }} + } {{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/items.jst b/appasar/canary/node_modules/ajv/lib/dot/items.jst new file mode 100644 index 0000000..8c0f5ac --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/items.jst @@ -0,0 +1,100 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + + +{{## def.validateItems:startFrom: + for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) { + {{ + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + }} + + {{# def.generateSubschemaCode }} + {{# def.optimizeValidate }} + + {{? $breakOnError }} + if (!{{=$nextValid}}) break; + {{?}} + } +#}} + +{{ + var $idx = 'i' + $lvl + , $dataNxt = $it.dataLevel = it.dataLevel + 1 + , $nextData = 'data' + $dataNxt + , $currentBaseId = it.baseId; +}} + +var {{=$errs}} = errors; +var {{=$valid}}; + +{{? Array.isArray($schema) }} + {{ /* 'items' is an array of schemas */}} + {{ var $additionalItems = it.schema.additionalItems; }} + {{? $additionalItems === false }} + {{=$valid}} = {{=$data}}.length <= {{= $schema.length }}; + {{ + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + '/additionalItems'; + }} + {{# def.checkError:'additionalItems' }} + {{ $errSchemaPath = $currErrSchemaPath; }} + {{# def.elseIfValid}} + {{?}} + + {{~ $schema:$sch:$i }} + {{? {{# def.nonEmptySchema:$sch }} }} + {{=$nextValid}} = true; + + if ({{=$data}}.length > {{=$i}}) { + {{ + var $passData = $data + '[' + $i + ']'; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); + $it.dataPathArr[$dataNxt] = $i; + }} + + {{# def.generateSubschemaCode }} + {{# def.optimizeValidate }} + } + + {{# def.ifResultValid }} + {{?}} + {{~}} + + {{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }} + {{ + $it.schema = $additionalItems; + $it.schemaPath = it.schemaPath + '.additionalItems'; + $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; + }} + {{=$nextValid}} = true; + + if ({{=$data}}.length > {{= $schema.length }}) { + {{# def.validateItems: $schema.length }} + } + + {{# def.ifResultValid }} + {{?}} + +{{?? {{# def.nonEmptySchema:$schema }} }} + {{ /* 'items' is a single schema */}} + {{ + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + }} + {{# def.validateItems: 0 }} +{{?}} + +{{? $breakOnError }} + {{= $closingBraces }} + if ({{=$errs}} == errors) { +{{?}} + +{{# def.cleanUp }} diff --git a/appasar/canary/node_modules/ajv/lib/dot/missing.def b/appasar/canary/node_modules/ajv/lib/dot/missing.def new file mode 100644 index 0000000..a73b9f9 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/missing.def @@ -0,0 +1,39 @@ +{{## def.checkMissingProperty:_properties: + {{~ _properties:$propertyKey:$i }} + {{?$i}} || {{?}} + {{ + var $prop = it.util.getProperty($propertyKey) + , $useData = $data + $prop; + }} + ( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) ) + {{~}} +#}} + + +{{## def.errorMissingProperty:_error: + {{ + var $propertyPath = 'missing' + $lvl + , $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.opts.jsonPointers + ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) + : $currentErrorPath + ' + ' + $propertyPath; + } + }} + {{# def.error:_error }} +#}} + + +{{## def.allErrorsMissingProperty:_error: + {{ + var $prop = it.util.getProperty($propertyKey) + , $missingProperty = it.util.escapeQuotes($propertyKey) + , $useData = $data + $prop; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + }} + if ({{# def.noPropertyInData }}) { + {{# def.addError:_error }} + } +#}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/multipleOf.jst b/appasar/canary/node_modules/ajv/lib/dot/multipleOf.jst new file mode 100644 index 0000000..5f8dd33 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/multipleOf.jst @@ -0,0 +1,20 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +var division{{=$lvl}}; +if ({{?$isData}} + {{=$schemaValue}} !== undefined && ( + typeof {{=$schemaValue}} != 'number' || + {{?}} + (division{{=$lvl}} = {{=$data}} / {{=$schemaValue}}, + {{? it.opts.multipleOfPrecision }} + Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}} + {{??}} + division{{=$lvl}} !== parseInt(division{{=$lvl}}) + {{?}} + ) + {{?$isData}} ) {{?}} ) { + {{# def.error:'multipleOf' }} +} {{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/not.jst b/appasar/canary/node_modules/ajv/lib/dot/not.jst new file mode 100644 index 0000000..e03185a --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/not.jst @@ -0,0 +1,43 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + +{{? {{# def.nonEmptySchema:$schema }} }} + {{ + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + }} + + var {{=$errs}} = errors; + + {{# def.setCompositeRule }} + + {{ + $it.createErrors = false; + var $allErrorsOption; + if ($it.opts.allErrors) { + $allErrorsOption = $it.opts.allErrors; + $it.opts.allErrors = false; + } + }} + {{= it.validate($it) }} + {{ + $it.createErrors = true; + if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; + }} + + {{# def.resetCompositeRule }} + + if ({{=$nextValid}}) { + {{# def.error:'not' }} + } else { + {{# def.resetErrors }} + {{? it.opts.allErrors }} } {{?}} +{{??}} + {{# def.addError:'not' }} + {{? $breakOnError}} + if (false) { + {{?}} +{{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/oneOf.jst b/appasar/canary/node_modules/ajv/lib/dot/oneOf.jst new file mode 100644 index 0000000..59a4355 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/oneOf.jst @@ -0,0 +1,44 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + +var {{=$errs}} = errors; +var prevValid{{=$lvl}} = false; +var {{=$valid}} = false; + +{{ var $currentBaseId = $it.baseId; }} +{{# def.setCompositeRule }} + +{{~ $schema:$sch:$i }} + {{? {{# def.nonEmptySchema:$sch }} }} + {{ + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + }} + + {{# def.insertSubschemaCode }} + {{??}} + var {{=$nextValid}} = true; + {{?}} + + {{? $i }} + if ({{=$nextValid}} && prevValid{{=$lvl}}) + {{=$valid}} = false; + else { + {{ $closingBraces += '}'; }} + {{?}} + + if ({{=$nextValid}}) {{=$valid}} = prevValid{{=$lvl}} = true; +{{~}} + +{{# def.resetCompositeRule }} + +{{= $closingBraces }} + +if (!{{=$valid}}) { + {{# def.extraError:'oneOf' }} +} else { + {{# def.resetErrors }} +{{? it.opts.allErrors }} } {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/pattern.jst b/appasar/canary/node_modules/ajv/lib/dot/pattern.jst new file mode 100644 index 0000000..3a37ef6 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/pattern.jst @@ -0,0 +1,14 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{ + var $regexp = $isData + ? '(new RegExp(' + $schemaValue + '))' + : it.usePattern($schema); +}} + +if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) { + {{# def.error:'pattern' }} +} {{? $breakOnError }} else { {{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/properties.jst b/appasar/canary/node_modules/ajv/lib/dot/properties.jst new file mode 100644 index 0000000..8d56324 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/properties.jst @@ -0,0 +1,327 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + + +{{## def.validateAdditional: + {{ /* additionalProperties is schema */ + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + '.additionalProperties'; + $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; + $it.errorPath = it.opts._errorDataPathProperty + ? it.errorPath + : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + }} + + {{# def.generateSubschemaCode }} + {{# def.optimizeValidate }} +#}} + + +{{ + var $key = 'key' + $lvl + , $idx = 'idx' + $lvl + , $dataNxt = $it.dataLevel = it.dataLevel + 1 + , $nextData = 'data' + $dataNxt + , $dataProperties = 'dataProperties' + $lvl; + + var $schemaKeys = Object.keys($schema || {}) + , $pProperties = it.schema.patternProperties || {} + , $pPropertyKeys = Object.keys($pProperties) + , $aProperties = it.schema.additionalProperties + , $someProperties = $schemaKeys.length || $pPropertyKeys.length + , $noAdditional = $aProperties === false + , $additionalIsSchema = typeof $aProperties == 'object' + && Object.keys($aProperties).length + , $removeAdditional = it.opts.removeAdditional + , $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional + , $ownProperties = it.opts.ownProperties + , $currentBaseId = it.baseId; + + var $required = it.schema.required; + if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired) + var $requiredHash = it.util.toHash($required); + + if (it.opts.patternGroups) { + var $pgProperties = it.schema.patternGroups || {} + , $pgPropertyKeys = Object.keys($pgProperties); + } +}} + + +var {{=$errs}} = errors; +var {{=$nextValid}} = true; +{{? $ownProperties }} + var {{=$dataProperties}} = undefined; +{{?}} + +{{? $checkAdditional }} + {{# def.iterateProperties }} + {{? $someProperties }} + var isAdditional{{=$lvl}} = !(false + {{? $schemaKeys.length }} + {{? $schemaKeys.length > 5 }} + || validate.schema{{=$schemaPath}}[{{=$key}}] + {{??}} + {{~ $schemaKeys:$propertyKey }} + || {{=$key}} == {{= it.util.toQuotedString($propertyKey) }} + {{~}} + {{?}} + {{?}} + {{? $pPropertyKeys.length }} + {{~ $pPropertyKeys:$pProperty:$i }} + || {{= it.usePattern($pProperty) }}.test({{=$key}}) + {{~}} + {{?}} + {{? it.opts.patternGroups && $pgPropertyKeys.length }} + {{~ $pgPropertyKeys:$pgProperty:$i }} + || {{= it.usePattern($pgProperty) }}.test({{=$key}}) + {{~}} + {{?}} + ); + + if (isAdditional{{=$lvl}}) { + {{?}} + {{? $removeAdditional == 'all' }} + delete {{=$data}}[{{=$key}}]; + {{??}} + {{ + var $currentErrorPath = it.errorPath; + var $additionalProperty = '\' + ' + $key + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + } + }} + {{? $noAdditional }} + {{? $removeAdditional }} + delete {{=$data}}[{{=$key}}]; + {{??}} + {{=$nextValid}} = false; + {{ + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + '/additionalProperties'; + }} + {{# def.error:'additionalProperties' }} + {{ $errSchemaPath = $currErrSchemaPath; }} + {{? $breakOnError }} break; {{?}} + {{?}} + {{?? $additionalIsSchema }} + {{? $removeAdditional == 'failing' }} + var {{=$errs}} = errors; + {{# def.setCompositeRule }} + + {{# def.validateAdditional }} + + if (!{{=$nextValid}}) { + errors = {{=$errs}}; + if (validate.errors !== null) { + if (errors) validate.errors.length = errors; + else validate.errors = null; + } + delete {{=$data}}[{{=$key}}]; + } + + {{# def.resetCompositeRule }} + {{??}} + {{# def.validateAdditional }} + {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} + {{?}} + {{?}} + {{ it.errorPath = $currentErrorPath; }} + {{?}} + {{? $someProperties }} + } + {{?}} + } + + {{# def.ifResultValid }} +{{?}} + +{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }} + +{{? $schemaKeys.length }} + {{~ $schemaKeys:$propertyKey }} + {{ var $sch = $schema[$propertyKey]; }} + + {{? {{# def.nonEmptySchema:$sch}} }} + {{ + var $prop = it.util.getProperty($propertyKey) + , $passData = $data + $prop + , $hasDefault = $useDefaults && $sch.default !== undefined; + $it.schema = $sch; + $it.schemaPath = $schemaPath + $prop; + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); + $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); + $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); + }} + + {{# def.generateSubschemaCode }} + + {{? {{# def.willOptimize }} }} + {{ + $code = {{# def._optimizeValidate }}; + var $useData = $passData; + }} + {{??}} + {{ var $useData = $nextData; }} + var {{=$nextData}} = {{=$passData}}; + {{?}} + + {{? $hasDefault }} + {{= $code }} + {{??}} + {{? $requiredHash && $requiredHash[$propertyKey] }} + if ({{# def.noPropertyInData }}) { + {{=$nextValid}} = false; + {{ + var $currentErrorPath = it.errorPath + , $currErrSchemaPath = $errSchemaPath + , $missingProperty = it.util.escapeQuotes($propertyKey); + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + $errSchemaPath = it.errSchemaPath + '/required'; + }} + {{# def.error:'required' }} + {{ $errSchemaPath = $currErrSchemaPath; }} + {{ it.errorPath = $currentErrorPath; }} + } else { + {{??}} + {{? $breakOnError }} + if ({{# def.noPropertyInData }}) { + {{=$nextValid}} = true; + } else { + {{??}} + if ({{=$useData}} !== undefined + {{? $ownProperties }} + && {{# def.isOwnProperty }} + {{?}} + ) { + {{?}} + {{?}} + + {{= $code }} + } + {{?}} {{ /* $hasDefault */ }} + {{?}} {{ /* def.nonEmptySchema */ }} + + {{# def.ifResultValid }} + {{~}} +{{?}} + +{{? $pPropertyKeys.length }} + {{~ $pPropertyKeys:$pProperty }} + {{ var $sch = $pProperties[$pProperty]; }} + + {{? {{# def.nonEmptySchema:$sch}} }} + {{ + $it.schema = $sch; + $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); + $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + + it.util.escapeFragment($pProperty); + }} + + {{# def.iterateProperties }} + if ({{= it.usePattern($pProperty) }}.test({{=$key}})) { + {{ + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + }} + + {{# def.generateSubschemaCode }} + {{# def.optimizeValidate }} + + {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} + } + {{? $breakOnError }} else {{=$nextValid}} = true; {{?}} + } + + {{# def.ifResultValid }} + {{?}} {{ /* def.nonEmptySchema */ }} + {{~}} +{{?}} + + +{{? it.opts.patternGroups && $pgPropertyKeys.length }} + {{~ $pgPropertyKeys:$pgProperty }} + {{ + var $pgSchema = $pgProperties[$pgProperty] + , $sch = $pgSchema.schema; + }} + + {{? {{# def.nonEmptySchema:$sch}} }} + {{ + $it.schema = $sch; + $it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema'; + $it.errSchemaPath = it.errSchemaPath + '/patternGroups/' + + it.util.escapeFragment($pgProperty) + + '/schema'; + }} + + var pgPropCount{{=$lvl}} = 0; + + {{# def.iterateProperties }} + if ({{= it.usePattern($pgProperty) }}.test({{=$key}})) { + pgPropCount{{=$lvl}}++; + + {{ + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + }} + + {{# def.generateSubschemaCode }} + {{# def.optimizeValidate }} + + {{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}} + } + {{? $breakOnError }} else {{=$nextValid}} = true; {{?}} + } + + {{# def.ifResultValid }} + + {{ + var $pgMin = $pgSchema.minimum + , $pgMax = $pgSchema.maximum; + }} + {{? $pgMin !== undefined || $pgMax !== undefined }} + var {{=$valid}} = true; + + {{ var $currErrSchemaPath = $errSchemaPath; }} + + {{? $pgMin !== undefined }} + {{ var $limit = $pgMin, $reason = 'minimum', $moreOrLess = 'less'; }} + {{=$valid}} = pgPropCount{{=$lvl}} >= {{=$pgMin}}; + {{ $errSchemaPath = it.errSchemaPath + '/patternGroups/minimum'; }} + {{# def.checkError:'patternGroups' }} + {{? $pgMax !== undefined }} + else + {{?}} + {{?}} + + {{? $pgMax !== undefined }} + {{ var $limit = $pgMax, $reason = 'maximum', $moreOrLess = 'more'; }} + {{=$valid}} = pgPropCount{{=$lvl}} <= {{=$pgMax}}; + {{ $errSchemaPath = it.errSchemaPath + '/patternGroups/maximum'; }} + {{# def.checkError:'patternGroups' }} + {{?}} + + {{ $errSchemaPath = $currErrSchemaPath; }} + + {{# def.ifValid }} + {{?}} + {{?}} {{ /* def.nonEmptySchema */ }} + {{~}} +{{?}} + + +{{? $breakOnError }} + {{= $closingBraces }} + if ({{=$errs}} == errors) { +{{?}} + +{{# def.cleanUp }} diff --git a/appasar/canary/node_modules/ajv/lib/dot/propertyNames.jst b/appasar/canary/node_modules/ajv/lib/dot/propertyNames.jst new file mode 100644 index 0000000..51caffc --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/propertyNames.jst @@ -0,0 +1,54 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.setupNextLevel }} + +{{? {{# def.nonEmptySchema:$schema }} }} + {{ + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + }} + + {{ + var $key = 'key' + $lvl + , $idx = 'idx' + $lvl + , $i = 'i' + $lvl + , $invalidName = '\' + ' + $key + ' + \'' + , $dataNxt = $it.dataLevel = it.dataLevel + 1 + , $nextData = 'data' + $dataNxt + , $dataProperties = 'dataProperties' + $lvl + , $ownProperties = it.opts.ownProperties + , $currentBaseId = it.baseId; + }} + + var {{=$errs}} = errors; + + {{? $ownProperties }} + var {{=$dataProperties}} = undefined; + {{?}} + {{# def.iterateProperties }} + var startErrs{{=$lvl}} = errors; + + {{ var $passData = $key; }} + {{# def.setCompositeRule }} + {{# def.generateSubschemaCode }} + {{# def.optimizeValidate }} + {{# def.resetCompositeRule }} + + if (!{{=$nextValid}}) { + for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}<errors; {{=$i}}++) { + vErrors[{{=$i}}].propertyName = {{=$key}}; + } + {{# def.extraError:'propertyNames' }} + {{? $breakOnError }} break; {{?}} + } + } +{{?}} + +{{? $breakOnError }} + {{= $closingBraces }} + if ({{=$errs}} == errors) { +{{?}} + +{{# def.cleanUp }} diff --git a/appasar/canary/node_modules/ajv/lib/dot/ref.jst b/appasar/canary/node_modules/ajv/lib/dot/ref.jst new file mode 100644 index 0000000..036bc29 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/ref.jst @@ -0,0 +1,85 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} + +{{## def._validateRef:_v: + {{? it.opts.passContext }} + {{=_v}}.call(this, + {{??}} + {{=_v}}( + {{?}} + {{=$data}}, {{# def.dataPath }}{{# def.passParentData }}, rootData) +#}} + +{{ var $async, $refCode; }} +{{? $schema == '#' || $schema == '#/' }} + {{ + if (it.isRoot) { + $async = it.async; + $refCode = 'validate'; + } else { + $async = it.root.schema.$async === true; + $refCode = 'root.refVal[0]'; + } + }} +{{??}} + {{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }} + {{? $refVal === undefined }} + {{ var $message = it.MissingRefError.message(it.baseId, $schema); }} + {{? it.opts.missingRefs == 'fail' }} + {{ it.logger.error($message); }} + {{# def.error:'$ref' }} + {{? $breakOnError }} if (false) { {{?}} + {{?? it.opts.missingRefs == 'ignore' }} + {{ it.logger.warn($message); }} + {{? $breakOnError }} if (true) { {{?}} + {{??}} + {{ throw new it.MissingRefError(it.baseId, $schema, $message); }} + {{?}} + {{?? $refVal.inline }} + {{# def.setupNextLevel }} + {{ + $it.schema = $refVal.schema; + $it.schemaPath = ''; + $it.errSchemaPath = $schema; + }} + {{ var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); }} + {{= $code }} + {{? $breakOnError}} + if ({{=$nextValid}}) { + {{?}} + {{??}} + {{ + $async = $refVal.$async === true; + $refCode = $refVal.code; + }} + {{?}} +{{?}} + +{{? $refCode }} + {{# def.beginDefOut}} + {{# def._validateRef:$refCode }} + {{# def.storeDefOut:__callValidate }} + + {{? $async }} + {{ if (!it.async) throw new Error('async schema referenced by sync schema'); }} + {{? $breakOnError }} var {{=$valid}}; {{?}} + try { + {{=it.yieldAwait}} {{=__callValidate}}; + {{? $breakOnError }} {{=$valid}} = true; {{?}} + } catch (e) { + if (!(e instanceof ValidationError)) throw e; + if (vErrors === null) vErrors = e.errors; + else vErrors = vErrors.concat(e.errors); + errors = vErrors.length; + {{? $breakOnError }} {{=$valid}} = false; {{?}} + } + {{? $breakOnError }} if ({{=$valid}}) { {{?}} + {{??}} + if (!{{=__callValidate}}) { + if (vErrors === null) vErrors = {{=$refCode}}.errors; + else vErrors = vErrors.concat({{=$refCode}}.errors); + errors = vErrors.length; + } {{? $breakOnError }} else { {{?}} + {{?}} +{{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/required.jst b/appasar/canary/node_modules/ajv/lib/dot/required.jst new file mode 100644 index 0000000..80fde35 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/required.jst @@ -0,0 +1,108 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.missing }} +{{# def.setupKeyword }} +{{# def.$data }} + +{{ var $vSchema = 'schema' + $lvl; }} + +{{## def.setupLoop: + {{? !$isData }} + var {{=$vSchema}} = validate.schema{{=$schemaPath}}; + {{?}} + + {{ + var $i = 'i' + $lvl + , $propertyPath = 'schema' + $lvl + '[' + $i + ']' + , $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + }} +#}} + + +{{## def.isRequiredOwnProperty: + Object.prototype.hasOwnProperty.call({{=$data}}, {{=$vSchema}}[{{=$i}}]) +#}} + + +{{? !$isData }} + {{? $schema.length < it.opts.loopRequired && + it.schema.properties && Object.keys(it.schema.properties).length }} + {{ var $required = []; }} + {{~ $schema:$property }} + {{ var $propertySch = it.schema.properties[$property]; }} + {{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }} + {{ $required[$required.length] = $property; }} + {{?}} + {{~}} + {{??}} + {{ var $required = $schema; }} + {{?}} +{{?}} + + +{{? $isData || $required.length }} + {{ + var $currentErrorPath = it.errorPath + , $loopRequired = $isData || $required.length >= it.opts.loopRequired + , $ownProperties = it.opts.ownProperties; + }} + + {{? $breakOnError }} + var missing{{=$lvl}}; + {{? $loopRequired }} + {{# def.setupLoop }} + var {{=$valid}} = true; + + {{?$isData}}{{# def.check$dataIsArray }}{{?}} + + for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) { + {{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined + {{? $ownProperties }} + && {{# def.isRequiredOwnProperty }} + {{?}}; + if (!{{=$valid}}) break; + } + + {{? $isData }} } {{?}} + + {{# def.checkError:'required' }} + else { + {{??}} + if ({{# def.checkMissingProperty:$required }}) { + {{# def.errorMissingProperty:'required' }} + } else { + {{?}} + {{??}} + {{? $loopRequired }} + {{# def.setupLoop }} + {{? $isData }} + if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) { + {{# def.addError:'required' }} + } else if ({{=$vSchema}} !== undefined) { + {{?}} + + for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) { + if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined + {{? $ownProperties }} + || !{{# def.isRequiredOwnProperty }} + {{?}}) { + {{# def.addError:'required' }} + } + } + + {{? $isData }} } {{?}} + {{??}} + {{~ $required:$propertyKey }} + {{# def.allErrorsMissingProperty:'required' }} + {{~}} + {{?}} + {{?}} + + {{ it.errorPath = $currentErrorPath; }} + +{{?? $breakOnError }} + if (true) { +{{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/uniqueItems.jst b/appasar/canary/node_modules/ajv/lib/dot/uniqueItems.jst new file mode 100644 index 0000000..dfc42b0 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/uniqueItems.jst @@ -0,0 +1,38 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.setupKeyword }} +{{# def.$data }} + + +{{? ($schema || $isData) && it.opts.uniqueItems !== false }} + {{? $isData }} + var {{=$valid}}; + if ({{=$schemaValue}} === false || {{=$schemaValue}} === undefined) + {{=$valid}} = true; + else if (typeof {{=$schemaValue}} != 'boolean') + {{=$valid}} = false; + else { + {{?}} + + var {{=$valid}} = true; + if ({{=$data}}.length > 1) { + var i = {{=$data}}.length, j; + outer: + for (;i--;) { + for (j = i; j--;) { + if (equal({{=$data}}[i], {{=$data}}[j])) { + {{=$valid}} = false; + break outer; + } + } + } + } + + {{? $isData }} } {{?}} + + if (!{{=$valid}}) { + {{# def.error:'uniqueItems' }} + } {{? $breakOnError }} else { {{?}} +{{??}} + {{? $breakOnError }} if (true) { {{?}} +{{?}} diff --git a/appasar/canary/node_modules/ajv/lib/dot/validate.jst b/appasar/canary/node_modules/ajv/lib/dot/validate.jst new file mode 100644 index 0000000..273e4c3 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dot/validate.jst @@ -0,0 +1,272 @@ +{{# def.definitions }} +{{# def.errors }} +{{# def.defaults }} +{{# def.coerce }} + +{{ /** + * schema compilation (render) time: + * it = { schema, RULES, _validate, opts } + * it.validate - this template function, + * it is used recursively to generate code for subschemas + * + * runtime: + * "validate" is a variable name to which this function will be assigned + * validateRef etc. are defined in the parent scope in index.js + */ }} + +{{ + var $async = it.schema.$async === true + , $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref') + , $id = it.self._getId(it.schema); +}} + +{{? it.isTop }} + {{? $async }} + {{ + it.async = true; + var $es7 = it.opts.async == 'es7'; + it.yieldAwait = $es7 ? 'await' : 'yield'; + }} + {{?}} + + var validate = + {{? $async }} + {{? $es7 }} + (async function + {{??}} + {{? it.opts.async != '*'}}co.wrap{{?}}(function* + {{?}} + {{??}} + (function + {{?}} + (data, dataPath, parentData, parentDataProperty, rootData) { + 'use strict'; + {{? $id && (it.opts.sourceCode || it.opts.processCode) }} + {{= '/\*# sourceURL=' + $id + ' */' }} + {{?}} +{{?}} + +{{? typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref) }} + {{ var $keyword = 'false schema'; }} + {{# def.setupKeyword }} + {{? it.schema === false}} + {{? it.isTop}} + {{ $breakOnError = true; }} + {{??}} + var {{=$valid}} = false; + {{?}} + {{# def.error:'false schema' }} + {{??}} + {{? it.isTop}} + {{? $async }} + return data; + {{??}} + validate.errors = null; + return true; + {{?}} + {{??}} + var {{=$valid}} = true; + {{?}} + {{?}} + + {{? it.isTop}} + }); + return validate; + {{?}} + + {{ return out; }} +{{?}} + + +{{? it.isTop }} + {{ + var $top = it.isTop + , $lvl = it.level = 0 + , $dataLvl = it.dataLevel = 0 + , $data = 'data'; + it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); + it.baseId = it.baseId || it.rootId; + delete it.isTop; + + it.dataPathArr = [undefined]; + }} + + var vErrors = null; {{ /* don't edit, used in replace */ }} + var errors = 0; {{ /* don't edit, used in replace */ }} + if (rootData === undefined) rootData = data; {{ /* don't edit, used in replace */ }} +{{??}} + {{ + var $lvl = it.level + , $dataLvl = it.dataLevel + , $data = 'data' + ($dataLvl || ''); + + if ($id) it.baseId = it.resolve.url(it.baseId, $id); + + if ($async && !it.async) throw new Error('async schema in sync schema'); + }} + + var errs_{{=$lvl}} = errors; +{{?}} + +{{ + var $valid = 'valid' + $lvl + , $breakOnError = !it.opts.allErrors + , $closingBraces1 = '' + , $closingBraces2 = ''; + + var $errorKeyword; + var $typeSchema = it.schema.type + , $typeIsArray = Array.isArray($typeSchema); + + if ($typeIsArray && $typeSchema.length == 1) { + $typeSchema = $typeSchema[0]; + $typeIsArray = false; + } +}} + +{{## def.checkType: + {{ + var $schemaPath = it.schemaPath + '.type' + , $errSchemaPath = it.errSchemaPath + '/type' + , $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; + }} + + if ({{= it.util[$method]($typeSchema, $data, true) }}) { +#}} + +{{? it.schema.$ref && $refKeywords }} + {{? it.opts.extendRefs == 'fail' }} + {{ throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); }} + {{?? it.opts.extendRefs !== true }} + {{ + $refKeywords = false; + it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); + }} + {{?}} +{{?}} + +{{? $typeSchema }} + {{? it.opts.coerceTypes }} + {{ var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); }} + {{?}} + + {{ var $rulesGroup = it.RULES.types[$typeSchema]; }} + {{? $coerceToTypes || $typeIsArray || $rulesGroup === true || + ($rulesGroup && !$shouldUseGroup($rulesGroup)) }} + {{ + var $schemaPath = it.schemaPath + '.type' + , $errSchemaPath = it.errSchemaPath + '/type'; + }} + {{# def.checkType }} + {{? $coerceToTypes }} + {{# def.coerceType }} + {{??}} + {{# def.error:'type' }} + {{?}} + } + {{?}} +{{?}} + + +{{? it.schema.$ref && !$refKeywords }} + {{= it.RULES.all.$ref.code(it, '$ref') }} + {{? $breakOnError }} + } + if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) { + {{ $closingBraces2 += '}'; }} + {{?}} +{{??}} + {{? it.opts.v5 && it.schema.patternGroups }} + {{ it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); }} + {{?}} + {{~ it.RULES:$rulesGroup }} + {{? $shouldUseGroup($rulesGroup) }} + {{? $rulesGroup.type }} + if ({{= it.util.checkDataType($rulesGroup.type, $data) }}) { + {{?}} + {{? it.opts.useDefaults && !it.compositeRule }} + {{? $rulesGroup.type == 'object' && it.schema.properties }} + {{# def.defaultProperties }} + {{?? $rulesGroup.type == 'array' && Array.isArray(it.schema.items) }} + {{# def.defaultItems }} + {{?}} + {{?}} + {{~ $rulesGroup.rules:$rule }} + {{? $shouldUseRule($rule) }} + {{ var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); }} + {{? $code }} + {{= $code }} + {{? $breakOnError }} + {{ $closingBraces1 += '}'; }} + {{?}} + {{?}} + {{?}} + {{~}} + {{? $breakOnError }} + {{= $closingBraces1 }} + {{ $closingBraces1 = ''; }} + {{?}} + {{? $rulesGroup.type }} + } + {{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }} + else { + {{ + var $schemaPath = it.schemaPath + '.type' + , $errSchemaPath = it.errSchemaPath + '/type'; + }} + {{# def.error:'type' }} + } + {{?}} + {{?}} + + {{? $breakOnError }} + if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) { + {{ $closingBraces2 += '}'; }} + {{?}} + {{?}} + {{~}} +{{?}} + +{{? $breakOnError }} {{= $closingBraces2 }} {{?}} + +{{? $top }} + {{? $async }} + if (errors === 0) return data; {{ /* don't edit, used in replace */ }} + else throw new ValidationError(vErrors); {{ /* don't edit, used in replace */ }} + {{??}} + validate.errors = vErrors; {{ /* don't edit, used in replace */ }} + return errors === 0; {{ /* don't edit, used in replace */ }} + {{?}} + }); + + return validate; +{{??}} + var {{=$valid}} = errors === errs_{{=$lvl}}; +{{?}} + +{{# def.cleanUp }} + +{{? $top }} + {{# def.finalCleanUp }} +{{?}} + +{{ + function $shouldUseGroup($rulesGroup) { + var rules = $rulesGroup.rules; + for (var i=0; i < rules.length; i++) + if ($shouldUseRule(rules[i])) + return true; + } + + function $shouldUseRule($rule) { + return it.schema[$rule.keyword] !== undefined || + ($rule.implements && $ruleImplementsSomeKeyword($rule)); + } + + function $ruleImplementsSomeKeyword($rule) { + var impl = $rule.implements; + for (var i=0; i < impl.length; i++) + if (it.schema[impl[i]] !== undefined) + return true; + } +}} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/README.md b/appasar/canary/node_modules/ajv/lib/dotjs/README.md new file mode 100644 index 0000000..4d99484 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/README.md @@ -0,0 +1,3 @@ +These files are compiled dot templates from dot folder. + +Do NOT edit them directly, edit the templates and run `npm run build` from main ajv folder. diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/_limit.js b/appasar/canary/node_modules/ajv/lib/dotjs/_limit.js new file mode 100644 index 0000000..10a187f --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/_limit.js @@ -0,0 +1,149 @@ +'use strict'; +module.exports = function generate__limit(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $isMax = $keyword == 'maximum', + $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum', + $schemaExcl = it.schema[$exclusiveKeyword], + $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, + $op = $isMax ? '<' : '>', + $notOp = $isMax ? '>' : '<', + $errorKeyword = undefined; + if ($isDataExcl) { + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), + $exclusive = 'exclusive' + $lvl, + $exclType = 'exclType' + $lvl, + $exclIsNumber = 'exclIsNumber' + $lvl, + $opExpr = 'op' + $lvl, + $opStr = '\' + ' + $opExpr + ' + \''; + out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; + $schemaValueExcl = 'schemaExcl' + $lvl; + out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; + var $errorKeyword = $exclusiveKeyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';'; + } else { + var $exclIsNumber = typeof $schemaExcl == 'number', + $opStr = $op; + if ($exclIsNumber && $isData) { + var $opExpr = '\'' + $opStr + '\''; + out += ' if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; + } else { + if ($exclIsNumber && $schema === undefined) { + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; + $schemaValue = $schemaExcl; + $notOp += '='; + } else { + if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); + if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; + $notOp += '='; + } else { + $exclusive = false; + $opStr += '='; + } + } + var $opExpr = '\'' + $opStr + '\''; + out += ' if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; + } + } + $errorKeyword = $errorKeyword || $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be ' + ($opStr) + ' '; + if ($isData) { + out += '\' + ' + ($schemaValue); + } else { + out += '' + ($schemaValue) + '\''; + } + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/_limitItems.js b/appasar/canary/node_modules/ajv/lib/dotjs/_limitItems.js new file mode 100644 index 0000000..16e37f2 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/_limitItems.js @@ -0,0 +1,76 @@ +'use strict'; +module.exports = function generate__limitItems(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxItems' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have '; + if ($keyword == 'maxItems') { + out += 'more'; + } else { + out += 'less'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' items\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/_limitLength.js b/appasar/canary/node_modules/ajv/lib/dotjs/_limitLength.js new file mode 100644 index 0000000..e6927f3 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/_limitLength.js @@ -0,0 +1,81 @@ +'use strict'; +module.exports = function generate__limitLength(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxLength' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + if (it.opts.unicode === false) { + out += ' ' + ($data) + '.length '; + } else { + out += ' ucs2length(' + ($data) + ') '; + } + out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be '; + if ($keyword == 'maxLength') { + out += 'longer'; + } else { + out += 'shorter'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' characters\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/_limitProperties.js b/appasar/canary/node_modules/ajv/lib/dotjs/_limitProperties.js new file mode 100644 index 0000000..a48308f --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/_limitProperties.js @@ -0,0 +1,76 @@ +'use strict'; +module.exports = function generate__limitProperties(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxProperties' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have '; + if ($keyword == 'maxProperties') { + out += 'more'; + } else { + out += 'less'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' properties\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/allOf.js b/appasar/canary/node_modules/ajv/lib/dotjs/allOf.js new file mode 100644 index 0000000..5107b18 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/allOf.js @@ -0,0 +1,43 @@ +'use strict'; +module.exports = function generate_allOf(it, $keyword, $ruleType) { + var out = ' '; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $currentBaseId = $it.baseId, + $allSchemasEmpty = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $allSchemasEmpty = false; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if ($breakOnError) { + if ($allSchemasEmpty) { + out += ' if (true) { '; + } else { + out += ' ' + ($closingBraces.slice(0, -1)) + ' '; + } + } + out = it.util.cleanUpCode(out); + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/anyOf.js b/appasar/canary/node_modules/ajv/lib/dotjs/anyOf.js new file mode 100644 index 0000000..994b091 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/anyOf.js @@ -0,0 +1,73 @@ +'use strict'; +module.exports = function generate_anyOf(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $noEmptySchema = $schema.every(function($sch) { + return it.util.schemaHasRules($sch, it.RULES.all); + }); + if ($noEmptySchema) { + var $currentBaseId = $it.baseId; + out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; + $closingBraces += '}'; + } + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should match some schema in anyOf\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; return false; '; + } + } + out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + if (it.opts.allErrors) { + out += ' } '; + } + out = it.util.cleanUpCode(out); + } else { + if ($breakOnError) { + out += ' if (true) { '; + } + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/const.js b/appasar/canary/node_modules/ajv/lib/dotjs/const.js new file mode 100644 index 0000000..d19756e --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/const.js @@ -0,0 +1,55 @@ +'use strict'; +module.exports = function generate_const(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + if (!$isData) { + out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; + } + out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should be equal to constant\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' }'; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/contains.js b/appasar/canary/node_modules/ajv/lib/dotjs/contains.js new file mode 100644 index 0000000..04c6e93 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/contains.js @@ -0,0 +1,81 @@ +'use strict'; +module.exports = function generate_contains(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $idx = 'i' + $lvl, + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt, + $currentBaseId = it.baseId, + $nonEmptySchema = it.util.schemaHasRules($schema, it.RULES.all); + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; + if ($nonEmptySchema) { + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + out += ' if (' + ($nextValid) + ') break; } '; + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; + } else { + out += ' if (' + ($data) + '.length == 0) {'; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should contain a valid item\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + if ($nonEmptySchema) { + out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + } + if (it.opts.allErrors) { + out += ' } '; + } + out = it.util.cleanUpCode(out); + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/custom.js b/appasar/canary/node_modules/ajv/lib/dotjs/custom.js new file mode 100644 index 0000000..bff06d1 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/custom.js @@ -0,0 +1,226 @@ +'use strict'; +module.exports = function generate_custom(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $rule = this, + $definition = 'definition' + $lvl, + $rDef = $rule.definition, + $closingBraces = ''; + var $compile, $inline, $macro, $ruleValidate, $validateCode; + if ($isData && $rDef.$data) { + $validateCode = 'keywordValidate' + $lvl; + var $validateSchema = $rDef.validateSchema; + out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; + } else { + $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); + if (!$ruleValidate) return; + $schemaValue = 'validate.schema' + $schemaPath; + $validateCode = $ruleValidate.code; + $compile = $rDef.compile; + $inline = $rDef.inline; + $macro = $rDef.macro; + } + var $ruleErrs = $validateCode + '.errors', + $i = 'i' + $lvl, + $ruleErr = 'ruleErr' + $lvl, + $asyncKeyword = $rDef.async; + if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); + if (!($inline || $macro)) { + out += '' + ($ruleErrs) + ' = null;'; + } + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; + if ($isData && $rDef.$data) { + $closingBraces += '}'; + out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; + if ($validateSchema) { + $closingBraces += '}'; + out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; + } + } + if ($inline) { + if ($rDef.statements) { + out += ' ' + ($ruleValidate.validate) + ' '; + } else { + out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; + } + } else if ($macro) { + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + $it.schema = $ruleValidate.validate; + $it.schemaPath = ''; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' ' + ($code); + } else { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + out += ' ' + ($validateCode) + '.call( '; + if (it.opts.passContext) { + out += 'this'; + } else { + out += 'self'; + } + if ($compile || $rDef.schema === false) { + out += ' , ' + ($data) + ' '; + } else { + out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; + } + out += ' , (dataPath || \'\')'; + if (it.errorPath != '""') { + out += ' + ' + (it.errorPath); + } + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; + var def_callRuleValidate = out; + out = $$outStack.pop(); + if ($rDef.errors === false) { + out += ' ' + ($valid) + ' = '; + if ($asyncKeyword) { + out += '' + (it.yieldAwait); + } + out += '' + (def_callRuleValidate) + '; '; + } else { + if ($asyncKeyword) { + $ruleErrs = 'customErrors' + $lvl; + out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = ' + (it.yieldAwait) + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; + } else { + out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; + } + } + } + if ($rDef.modifying) { + out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; + } + out += '' + ($closingBraces); + if ($rDef.valid) { + if ($breakOnError) { + out += ' if (true) { '; + } + } else { + out += ' if ( '; + if ($rDef.valid === undefined) { + out += ' !'; + if ($macro) { + out += '' + ($nextValid); + } else { + out += '' + ($valid); + } + } else { + out += ' ' + (!$rDef.valid) + ' '; + } + out += ') { '; + $errorKeyword = $rule.keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + var def_customError = out; + out = $$outStack.pop(); + if ($inline) { + if ($rDef.errors) { + if ($rDef.errors != 'full') { + out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } '; + if (it.opts.verbose) { + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; + } + out += ' } '; + } + } else { + if ($rDef.errors === false) { + out += ' ' + (def_customError) + ' '; + } else { + out += ' if (' + ($errs) + ' == errors) { ' + (def_customError) + ' } else { for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } '; + if (it.opts.verbose) { + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; + } + out += ' } } '; + } + } + } else if ($macro) { + out += ' var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; return false; '; + } + } + } else { + if ($rDef.errors === false) { + out += ' ' + (def_customError) + ' '; + } else { + out += ' if (Array.isArray(' + ($ruleErrs) + ')) { if (vErrors === null) vErrors = ' + ($ruleErrs) + '; else vErrors = vErrors.concat(' + ($ruleErrs) + '); errors = vErrors.length; for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; '; + if (it.opts.verbose) { + out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; '; + } + out += ' } } else { ' + (def_customError) + ' } '; + } + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/dependencies.js b/appasar/canary/node_modules/ajv/lib/dotjs/dependencies.js new file mode 100644 index 0000000..58814c6 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/dependencies.js @@ -0,0 +1,167 @@ +'use strict'; +module.exports = function generate_dependencies(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $schemaDeps = {}, + $propertyDeps = {}, + $ownProperties = it.opts.ownProperties; + for ($property in $schema) { + var $sch = $schema[$property]; + var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; + $deps[$property] = $sch; + } + out += 'var ' + ($errs) + ' = errors;'; + var $currentErrorPath = it.errorPath; + out += 'var missing' + ($lvl) + ';'; + for (var $property in $propertyDeps) { + $deps = $propertyDeps[$property]; + if ($deps.length) { + out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; + if ($ownProperties) { + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; + } + if ($breakOnError) { + out += ' && ( '; + var arr1 = $deps; + if (arr1) { + var $propertyKey, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $propertyKey = arr1[$i += 1]; + if ($i) { + out += ' || '; + } + var $prop = it.util.getProperty($propertyKey), + $useData = $data + $prop; + out += ' ( ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; + } + } + out += ')) { '; + var $propertyPath = 'missing' + $lvl, + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should have '; + if ($deps.length == 1) { + out += 'property ' + (it.util.escapeQuotes($deps[0])); + } else { + out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))); + } + out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } else { + out += ' ) { '; + var arr2 = $deps; + if (arr2) { + var $propertyKey, i2 = -1, + l2 = arr2.length - 1; + while (i2 < l2) { + $propertyKey = arr2[i2 += 1]; + var $prop = it.util.getProperty($propertyKey), + $missingProperty = it.util.escapeQuotes($propertyKey), + $useData = $data + $prop; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + out += ' if ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should have '; + if ($deps.length == 1) { + out += 'property ' + (it.util.escapeQuotes($deps[0])); + } else { + out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))); + } + out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; + } + } + } + out += ' } '; + if ($breakOnError) { + $closingBraces += '}'; + out += ' else { '; + } + } + } + it.errorPath = $currentErrorPath; + var $currentBaseId = $it.baseId; + for (var $property in $schemaDeps) { + var $sch = $schemaDeps[$property]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; + if ($ownProperties) { + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; + } + out += ') { '; + $it.schema = $sch; + $it.schemaPath = $schemaPath + it.util.getProperty($property); + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/enum.js b/appasar/canary/node_modules/ajv/lib/dotjs/enum.js new file mode 100644 index 0000000..03f3a8c --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/enum.js @@ -0,0 +1,65 @@ +'use strict'; +module.exports = function generate_enum(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $i = 'i' + $lvl, + $vSchema = 'schema' + $lvl; + if (!$isData) { + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';'; + } + out += 'var ' + ($valid) + ';'; + if ($isData) { + out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; + } + out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }'; + if ($isData) { + out += ' } '; + } + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be equal to one of the allowed values\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' }'; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/format.js b/appasar/canary/node_modules/ajv/lib/dotjs/format.js new file mode 100644 index 0000000..68697f0 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/format.js @@ -0,0 +1,149 @@ +'use strict'; +module.exports = function generate_format(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + if (it.opts.format === false) { + if ($breakOnError) { + out += ' if (true) { '; + } + return out; + } + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $unknownFormats = it.opts.unknownFormats, + $allowUnknown = Array.isArray($unknownFormats); + if ($isData) { + var $format = 'format' + $lvl, + $isObject = 'isObject' + $lvl, + $formatType = 'formatType' + $lvl; + out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { '; + if (it.async) { + out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; '; + } + out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; + } + out += ' ('; + if ($unknownFormats != 'ignore') { + out += ' (' + ($schemaValue) + ' && !' + ($format) + ' '; + if ($allowUnknown) { + out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 '; + } + out += ') || '; + } + out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? '; + if (it.async) { + out += ' (async' + ($lvl) + ' ? ' + (it.yieldAwait) + ' ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) '; + } else { + out += ' ' + ($format) + '(' + ($data) + ') '; + } + out += ' : ' + ($format) + '.test(' + ($data) + '))))) {'; + } else { + var $format = it.formats[$schema]; + if (!$format) { + if ($unknownFormats == 'ignore') { + it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); + if ($breakOnError) { + out += ' if (true) { '; + } + return out; + } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) { + if ($breakOnError) { + out += ' if (true) { '; + } + return out; + } else { + throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); + } + } + var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; + var $formatType = $isObject && $format.type || 'string'; + if ($isObject) { + var $async = $format.async === true; + $format = $format.validate; + } + if ($formatType != $ruleType) { + if ($breakOnError) { + out += ' if (true) { '; + } + return out; + } + if ($async) { + if (!it.async) throw new Error('async format in sync schema'); + var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; + out += ' if (!(' + (it.yieldAwait) + ' ' + ($formatRef) + '(' + ($data) + '))) { '; + } else { + out += ' if (! '; + var $formatRef = 'formats' + it.util.getProperty($schema); + if ($isObject) $formatRef += '.validate'; + if (typeof $format == 'function') { + out += ' ' + ($formatRef) + '(' + ($data) + ') '; + } else { + out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; + } + out += ') { '; + } + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should match format "'; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + (it.util.escapeQuotes($schema)); + } + out += '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/items.js b/appasar/canary/node_modules/ajv/lib/dotjs/items.js new file mode 100644 index 0000000..77be5e2 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/items.js @@ -0,0 +1,140 @@ +'use strict'; +module.exports = function generate_items(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $idx = 'i' + $lvl, + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt, + $currentBaseId = it.baseId; + out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; + if (Array.isArray($schema)) { + var $additionalItems = it.schema.additionalItems; + if ($additionalItems === false) { + out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; '; + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + '/additionalItems'; + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' '; + } + if (it.opts.verbose) { + out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + $closingBraces += '}'; + out += ' else { '; + } + } + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; + var $passData = $data + '[' + $i + ']'; + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); + $it.dataPathArr[$dataNxt] = $i; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) { + $it.schema = $additionalItems; + $it.schemaPath = it.schemaPath + '.additionalItems'; + $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; + out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } else if (it.util.schemaHasRules($schema, it.RULES.all)) { + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + '[' + $idx + ']'; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' }'; + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/multipleOf.js b/appasar/canary/node_modules/ajv/lib/dotjs/multipleOf.js new file mode 100644 index 0000000..df5a315 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/multipleOf.js @@ -0,0 +1,76 @@ +'use strict'; +module.exports = function generate_multipleOf(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + out += 'var division' + ($lvl) + ';if ('; + if ($isData) { + out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || '; + } + out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', '; + if (it.opts.multipleOfPrecision) { + out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' '; + } else { + out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') '; + } + out += ' ) '; + if ($isData) { + out += ' ) '; + } + out += ' ) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be multiple of '; + if ($isData) { + out += '\' + ' + ($schemaValue); + } else { + out += '' + ($schemaValue) + '\''; + } + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/not.js b/appasar/canary/node_modules/ajv/lib/dotjs/not.js new file mode 100644 index 0000000..67add9f --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/not.js @@ -0,0 +1,83 @@ +'use strict'; +module.exports = function generate_not(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + $it.level++; + var $nextValid = 'valid' + $it.level; + if (it.util.schemaHasRules($schema, it.RULES.all)) { + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += ' var ' + ($errs) + ' = errors; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.createErrors = false; + var $allErrorsOption; + if ($it.opts.allErrors) { + $allErrorsOption = $it.opts.allErrors; + $it.opts.allErrors = false; + } + out += ' ' + (it.validate($it)) + ' '; + $it.createErrors = true; + if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' if (' + ($nextValid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be valid\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + if (it.opts.allErrors) { + out += ' } '; + } + } else { + out += ' var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be valid\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if ($breakOnError) { + out += ' if (false) { '; + } + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/oneOf.js b/appasar/canary/node_modules/ajv/lib/dotjs/oneOf.js new file mode 100644 index 0000000..b4cd460 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/oneOf.js @@ -0,0 +1,70 @@ +'use strict'; +module.exports = function generate_oneOf(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + out += 'var ' + ($errs) + ' = errors;var prevValid' + ($lvl) + ' = false;var ' + ($valid) + ' = false;'; + var $currentBaseId = $it.baseId; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var arr1 = $schema; + if (arr1) { + var $sch, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = $schemaPath + '[' + $i + ']'; + $it.errSchemaPath = $errSchemaPath + '/' + $i; + out += ' ' + (it.validate($it)) + ' '; + $it.baseId = $currentBaseId; + } else { + out += ' var ' + ($nextValid) + ' = true; '; + } + if ($i) { + out += ' if (' + ($nextValid) + ' && prevValid' + ($lvl) + ') ' + ($valid) + ' = false; else { '; + $closingBraces += '}'; + } + out += ' if (' + ($nextValid) + ') ' + ($valid) + ' = prevValid' + ($lvl) + ' = true;'; + } + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'should match exactly one schema in oneOf\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; return false; '; + } + } + out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }'; + if (it.opts.allErrors) { + out += ' } '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/pattern.js b/appasar/canary/node_modules/ajv/lib/dotjs/pattern.js new file mode 100644 index 0000000..76b7794 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/pattern.js @@ -0,0 +1,74 @@ +'use strict'; +module.exports = function generate_pattern(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema); + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; + } + out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; + if ($isData) { + out += '' + ($schemaValue); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should match pattern "'; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + (it.util.escapeQuotes($schema)); + } + out += '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + (it.util.toQuotedString($schema)); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/properties.js b/appasar/canary/node_modules/ajv/lib/dotjs/properties.js new file mode 100644 index 0000000..3c6cecf --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/properties.js @@ -0,0 +1,468 @@ +'use strict'; +module.exports = function generate_properties(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + var $key = 'key' + $lvl, + $idx = 'idx' + $lvl, + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt, + $dataProperties = 'dataProperties' + $lvl; + var $schemaKeys = Object.keys($schema || {}), + $pProperties = it.schema.patternProperties || {}, + $pPropertyKeys = Object.keys($pProperties), + $aProperties = it.schema.additionalProperties, + $someProperties = $schemaKeys.length || $pPropertyKeys.length, + $noAdditional = $aProperties === false, + $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, + $removeAdditional = it.opts.removeAdditional, + $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, + $ownProperties = it.opts.ownProperties, + $currentBaseId = it.baseId; + var $required = it.schema.required; + if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required); + if (it.opts.patternGroups) { + var $pgProperties = it.schema.patternGroups || {}, + $pgPropertyKeys = Object.keys($pgProperties); + } + out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; + if ($ownProperties) { + out += ' var ' + ($dataProperties) + ' = undefined;'; + } + if ($checkAdditional) { + if ($ownProperties) { + out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; + } else { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + } + if ($someProperties) { + out += ' var isAdditional' + ($lvl) + ' = !(false '; + if ($schemaKeys.length) { + if ($schemaKeys.length > 5) { + out += ' || validate.schema' + ($schemaPath) + '[' + ($key) + '] '; + } else { + var arr1 = $schemaKeys; + if (arr1) { + var $propertyKey, i1 = -1, + l1 = arr1.length - 1; + while (i1 < l1) { + $propertyKey = arr1[i1 += 1]; + out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; + } + } + } + } + if ($pPropertyKeys.length) { + var arr2 = $pPropertyKeys; + if (arr2) { + var $pProperty, $i = -1, + l2 = arr2.length - 1; + while ($i < l2) { + $pProperty = arr2[$i += 1]; + out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; + } + } + } + if (it.opts.patternGroups && $pgPropertyKeys.length) { + var arr3 = $pgPropertyKeys; + if (arr3) { + var $pgProperty, $i = -1, + l3 = arr3.length - 1; + while ($i < l3) { + $pgProperty = arr3[$i += 1]; + out += ' || ' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ') '; + } + } + } + out += ' ); if (isAdditional' + ($lvl) + ') { '; + } + if ($removeAdditional == 'all') { + out += ' delete ' + ($data) + '[' + ($key) + ']; '; + } else { + var $currentErrorPath = it.errorPath; + var $additionalProperty = '\' + ' + $key + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + } + if ($noAdditional) { + if ($removeAdditional) { + out += ' delete ' + ($data) + '[' + ($key) + ']; '; + } else { + out += ' ' + ($nextValid) + ' = false; '; + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + '/additionalProperties'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have additional properties\' '; + } + if (it.opts.verbose) { + out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + out += ' break; '; + } + } + } else if ($additionalIsSchema) { + if ($removeAdditional == 'failing') { + out += ' var ' + ($errs) + ' = errors; '; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + '.additionalProperties'; + $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; + $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; + it.compositeRule = $it.compositeRule = $wasComposite; + } else { + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + '.additionalProperties'; + $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; + $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + } + } + it.errorPath = $currentErrorPath; + } + if ($someProperties) { + out += ' } '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + var $useDefaults = it.opts.useDefaults && !it.compositeRule; + if ($schemaKeys.length) { + var arr4 = $schemaKeys; + if (arr4) { + var $propertyKey, i4 = -1, + l4 = arr4.length - 1; + while (i4 < l4) { + $propertyKey = arr4[i4 += 1]; + var $sch = $schema[$propertyKey]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + var $prop = it.util.getProperty($propertyKey), + $passData = $data + $prop, + $hasDefault = $useDefaults && $sch.default !== undefined; + $it.schema = $sch; + $it.schemaPath = $schemaPath + $prop; + $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); + $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); + $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + $code = it.util.varReplace($code, $nextData, $passData); + var $useData = $passData; + } else { + var $useData = $nextData; + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; + } + if ($hasDefault) { + out += ' ' + ($code) + ' '; + } else { + if ($requiredHash && $requiredHash[$propertyKey]) { + out += ' if ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') { ' + ($nextValid) + ' = false; '; + var $currentErrorPath = it.errorPath, + $currErrSchemaPath = $errSchemaPath, + $missingProperty = it.util.escapeQuotes($propertyKey); + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + $errSchemaPath = it.errSchemaPath + '/required'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + $errSchemaPath = $currErrSchemaPath; + it.errorPath = $currentErrorPath; + out += ' } else { '; + } else { + if ($breakOnError) { + out += ' if ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') { ' + ($nextValid) + ' = true; } else { '; + } else { + out += ' if (' + ($useData) + ' !== undefined '; + if ($ownProperties) { + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ' ) { '; + } + } + out += ' ' + ($code) + ' } '; + } + } + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + if ($pPropertyKeys.length) { + var arr5 = $pPropertyKeys; + if (arr5) { + var $pProperty, i5 = -1, + l5 = arr5.length - 1; + while (i5 < l5) { + $pProperty = arr5[i5 += 1]; + var $sch = $pProperties[$pProperty]; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); + $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); + if ($ownProperties) { + out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; + } else { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + } + out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else ' + ($nextValid) + ' = true; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + } + } + } + } + if (it.opts.patternGroups && $pgPropertyKeys.length) { + var arr6 = $pgPropertyKeys; + if (arr6) { + var $pgProperty, i6 = -1, + l6 = arr6.length - 1; + while (i6 < l6) { + $pgProperty = arr6[i6 += 1]; + var $pgSchema = $pgProperties[$pgProperty], + $sch = $pgSchema.schema; + if (it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema'; + $it.errSchemaPath = it.errSchemaPath + '/patternGroups/' + it.util.escapeFragment($pgProperty) + '/schema'; + out += ' var pgPropCount' + ($lvl) + ' = 0; '; + if ($ownProperties) { + out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; + } else { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + } + out += ' if (' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ')) { pgPropCount' + ($lvl) + '++; '; + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + '[' + $key + ']'; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + if ($breakOnError) { + out += ' if (!' + ($nextValid) + ') break; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else ' + ($nextValid) + ' = true; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + $closingBraces += '}'; + } + var $pgMin = $pgSchema.minimum, + $pgMax = $pgSchema.maximum; + if ($pgMin !== undefined || $pgMax !== undefined) { + out += ' var ' + ($valid) + ' = true; '; + var $currErrSchemaPath = $errSchemaPath; + if ($pgMin !== undefined) { + var $limit = $pgMin, + $reason = 'minimum', + $moreOrLess = 'less'; + out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' >= ' + ($pgMin) + '; '; + $errSchemaPath = it.errSchemaPath + '/patternGroups/minimum'; + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($pgMax !== undefined) { + out += ' else '; + } + } + if ($pgMax !== undefined) { + var $limit = $pgMax, + $reason = 'maximum', + $moreOrLess = 'more'; + out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' <= ' + ($pgMax) + '; '; + $errSchemaPath = it.errSchemaPath + '/patternGroups/maximum'; + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + } + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + out += ' if (' + ($valid) + ') { '; + $closingBraces += '}'; + } + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/propertyNames.js b/appasar/canary/node_modules/ajv/lib/dotjs/propertyNames.js new file mode 100644 index 0000000..0cedcda --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/propertyNames.js @@ -0,0 +1,81 @@ +'use strict'; +module.exports = function generate_propertyNames(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $errs = 'errs__' + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ''; + $it.level++; + var $nextValid = 'valid' + $it.level; + if (it.util.schemaHasRules($schema, it.RULES.all)) { + $it.schema = $schema; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + var $key = 'key' + $lvl, + $idx = 'idx' + $lvl, + $i = 'i' + $lvl, + $invalidName = '\' + ' + $key + ' + \'', + $dataNxt = $it.dataLevel = it.dataLevel + 1, + $nextData = 'data' + $dataNxt, + $dataProperties = 'dataProperties' + $lvl, + $ownProperties = it.opts.ownProperties, + $currentBaseId = it.baseId; + out += ' var ' + ($errs) + ' = errors; '; + if ($ownProperties) { + out += ' var ' + ($dataProperties) + ' = undefined; '; + } + if ($ownProperties) { + out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; + } else { + out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; + } + out += ' var startErrs' + ($lvl) + ' = errors; '; + var $passData = $key; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + } else { + out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + '<errors; ' + ($i) + '++) { vErrors[' + ($i) + '].propertyName = ' + ($key) + '; } var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('propertyNames') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { propertyName: \'' + ($invalidName) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'property name \\\'' + ($invalidName) + '\\\' is invalid\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; return false; '; + } + } + if ($breakOnError) { + out += ' break; '; + } + out += ' } }'; + } + if ($breakOnError) { + out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + } + out = it.util.cleanUpCode(out); + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/ref.js b/appasar/canary/node_modules/ajv/lib/dotjs/ref.js new file mode 100644 index 0000000..a9d7bb9 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/ref.js @@ -0,0 +1,123 @@ +'use strict'; +module.exports = function generate_ref(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $async, $refCode; + if ($schema == '#' || $schema == '#/') { + if (it.isRoot) { + $async = it.async; + $refCode = 'validate'; + } else { + $async = it.root.schema.$async === true; + $refCode = 'root.refVal[0]'; + } + } else { + var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); + if ($refVal === undefined) { + var $message = it.MissingRefError.message(it.baseId, $schema); + if (it.opts.missingRefs == 'fail') { + it.logger.error($message); + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' '; + } + if (it.opts.verbose) { + out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + if ($breakOnError) { + out += ' if (false) { '; + } + } else if (it.opts.missingRefs == 'ignore') { + it.logger.warn($message); + if ($breakOnError) { + out += ' if (true) { '; + } + } else { + throw new it.MissingRefError(it.baseId, $schema, $message); + } + } else if ($refVal.inline) { + var $it = it.util.copy(it); + $it.level++; + var $nextValid = 'valid' + $it.level; + $it.schema = $refVal.schema; + $it.schemaPath = ''; + $it.errSchemaPath = $schema; + var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); + out += ' ' + ($code) + ' '; + if ($breakOnError) { + out += ' if (' + ($nextValid) + ') { '; + } + } else { + $async = $refVal.$async === true; + $refCode = $refVal.code; + } + } + if ($refCode) { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; + if (it.opts.passContext) { + out += ' ' + ($refCode) + '.call(this, '; + } else { + out += ' ' + ($refCode) + '( '; + } + out += ' ' + ($data) + ', (dataPath || \'\')'; + if (it.errorPath != '""') { + out += ' + ' + (it.errorPath); + } + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) '; + var __callValidate = out; + out = $$outStack.pop(); + if ($async) { + if (!it.async) throw new Error('async schema referenced by sync schema'); + if ($breakOnError) { + out += ' var ' + ($valid) + '; '; + } + out += ' try { ' + (it.yieldAwait) + ' ' + (__callValidate) + '; '; + if ($breakOnError) { + out += ' ' + ($valid) + ' = true; '; + } + out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; '; + if ($breakOnError) { + out += ' ' + ($valid) + ' = false; '; + } + out += ' } '; + if ($breakOnError) { + out += ' if (' + ($valid) + ') { '; + } + } else { + out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } '; + if ($breakOnError) { + out += ' else { '; + } + } + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/required.js b/appasar/canary/node_modules/ajv/lib/dotjs/required.js new file mode 100644 index 0000000..15b36bb --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/required.js @@ -0,0 +1,268 @@ +'use strict'; +module.exports = function generate_required(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $vSchema = 'schema' + $lvl; + if (!$isData) { + if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) { + var $required = []; + var arr1 = $schema; + if (arr1) { + var $property, i1 = -1, + l1 = arr1.length - 1; + while (i1 < l1) { + $property = arr1[i1 += 1]; + var $propertySch = it.schema.properties[$property]; + if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) { + $required[$required.length] = $property; + } + } + } + } else { + var $required = $schema; + } + } + if ($isData || $required.length) { + var $currentErrorPath = it.errorPath, + $loopRequired = $isData || $required.length >= it.opts.loopRequired, + $ownProperties = it.opts.ownProperties; + if ($breakOnError) { + out += ' var missing' + ($lvl) + '; '; + if ($loopRequired) { + if (!$isData) { + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; + } + var $i = 'i' + $lvl, + $propertyPath = 'schema' + $lvl + '[' + $i + ']', + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + out += ' var ' + ($valid) + ' = true; '; + if ($isData) { + out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; + } + out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined '; + if ($ownProperties) { + out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; + } + out += '; if (!' + ($valid) + ') break; } '; + if ($isData) { + out += ' } '; + } + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + } else { + out += ' if ( '; + var arr2 = $required; + if (arr2) { + var $propertyKey, $i = -1, + l2 = arr2.length - 1; + while ($i < l2) { + $propertyKey = arr2[$i += 1]; + if ($i) { + out += ' || '; + } + var $prop = it.util.getProperty($propertyKey), + $useData = $data + $prop; + out += ' ( ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; + } + } + out += ') { '; + var $propertyPath = 'missing' + $lvl, + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + } + } else { + if ($loopRequired) { + if (!$isData) { + out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; + } + var $i = 'i' + $lvl, + $propertyPath = 'schema' + $lvl + '[' + $i + ']', + $missingProperty = '\' + ' + $propertyPath + ' + \''; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + if ($isData) { + out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; + } + out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; + } + out += ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; + if ($isData) { + out += ' } '; + } + } else { + var arr3 = $required; + if (arr3) { + var $propertyKey, i3 = -1, + l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $prop = it.util.getProperty($propertyKey), + $missingProperty = it.util.escapeQuotes($propertyKey), + $useData = $data + $prop; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + out += ' if ( ' + ($useData) + ' === undefined '; + if ($ownProperties) { + out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; + } + out += ') { var err = '; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \''; + if (it.opts._errorDataPathProperty) { + out += 'is a required property'; + } else { + out += 'should have required property \\\'' + ($missingProperty) + '\\\''; + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; + } + } + } + } + it.errorPath = $currentErrorPath; + } else if ($breakOnError) { + out += ' if (true) {'; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/uniqueItems.js b/appasar/canary/node_modules/ajv/lib/dotjs/uniqueItems.js new file mode 100644 index 0000000..d9b3185 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/uniqueItems.js @@ -0,0 +1,71 @@ +'use strict'; +module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + if (($schema || $isData) && it.opts.uniqueItems !== false) { + if ($isData) { + out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; + } + out += ' var ' + ($valid) + ' = true; if (' + ($data) + '.length > 1) { var i = ' + ($data) + '.length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } } '; + if ($isData) { + out += ' } '; + } + out += ' if (!' + ($valid) + ') { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + } else { + if ($breakOnError) { + out += ' if (true) { '; + } + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/dotjs/validate.js b/appasar/canary/node_modules/ajv/lib/dotjs/validate.js new file mode 100644 index 0000000..5ff9bee --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/dotjs/validate.js @@ -0,0 +1,458 @@ +'use strict'; +module.exports = function generate_validate(it, $keyword, $ruleType) { + var out = ''; + var $async = it.schema.$async === true, + $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'), + $id = it.self._getId(it.schema); + if (it.isTop) { + if ($async) { + it.async = true; + var $es7 = it.opts.async == 'es7'; + it.yieldAwait = $es7 ? 'await' : 'yield'; + } + out += ' var validate = '; + if ($async) { + if ($es7) { + out += ' (async function '; + } else { + if (it.opts.async != '*') { + out += 'co.wrap'; + } + out += '(function* '; + } + } else { + out += ' (function '; + } + out += ' (data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; '; + if ($id && (it.opts.sourceCode || it.opts.processCode)) { + out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' '; + } + } + if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) { + var $keyword = 'false schema'; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + if (it.schema === false) { + if (it.isTop) { + $breakOnError = true; + } else { + out += ' var ' + ($valid) + ' = false; '; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'boolean schema is false\' '; + } + if (it.opts.verbose) { + out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } else { + if (it.isTop) { + if ($async) { + out += ' return data; '; + } else { + out += ' validate.errors = null; return true; '; + } + } else { + out += ' var ' + ($valid) + ' = true; '; + } + } + if (it.isTop) { + out += ' }); return validate; '; + } + return out; + } + if (it.isTop) { + var $top = it.isTop, + $lvl = it.level = 0, + $dataLvl = it.dataLevel = 0, + $data = 'data'; + it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); + it.baseId = it.baseId || it.rootId; + delete it.isTop; + it.dataPathArr = [undefined]; + out += ' var vErrors = null; '; + out += ' var errors = 0; '; + out += ' if (rootData === undefined) rootData = data; '; + } else { + var $lvl = it.level, + $dataLvl = it.dataLevel, + $data = 'data' + ($dataLvl || ''); + if ($id) it.baseId = it.resolve.url(it.baseId, $id); + if ($async && !it.async) throw new Error('async schema in sync schema'); + out += ' var errs_' + ($lvl) + ' = errors;'; + } + var $valid = 'valid' + $lvl, + $breakOnError = !it.opts.allErrors, + $closingBraces1 = '', + $closingBraces2 = ''; + var $errorKeyword; + var $typeSchema = it.schema.type, + $typeIsArray = Array.isArray($typeSchema); + if ($typeIsArray && $typeSchema.length == 1) { + $typeSchema = $typeSchema[0]; + $typeIsArray = false; + } + if (it.schema.$ref && $refKeywords) { + if (it.opts.extendRefs == 'fail') { + throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); + } else if (it.opts.extendRefs !== true) { + $refKeywords = false; + it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); + } + } + if ($typeSchema) { + if (it.opts.coerceTypes) { + var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); + } + var $rulesGroup = it.RULES.types[$typeSchema]; + if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) { + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type'; + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type', + $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; + out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { '; + if ($coerceToTypes) { + var $dataType = 'dataType' + $lvl, + $coerced = 'coerced' + $lvl; + out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; '; + if (it.opts.coerceTypes == 'array') { + out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; '; + } + out += ' var ' + ($coerced) + ' = undefined; '; + var $bracesCoercion = ''; + var arr1 = $coerceToTypes; + if (arr1) { + var $type, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $type = arr1[$i += 1]; + if ($i) { + out += ' if (' + ($coerced) + ' === undefined) { '; + $bracesCoercion += '}'; + } + if (it.opts.coerceTypes == 'array' && $type != 'array') { + out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } '; + } + if ($type == 'string') { + out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; + } else if ($type == 'number' || $type == 'integer') { + out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; + if ($type == 'integer') { + out += ' && !(' + ($data) + ' % 1)'; + } + out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; + } else if ($type == 'boolean') { + out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; + } else if ($type == 'null') { + out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; + } else if (it.opts.coerceTypes == 'array' && $type == 'array') { + out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; + } + } + } + out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' ' + ($data) + ' = ' + ($coerced) + '; '; + if (!$dataLvl) { + out += 'if (' + ($parentData) + ' !== undefined)'; + } + out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } '; + } else { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } + out += ' } '; + } + } + if (it.schema.$ref && !$refKeywords) { + out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; + if ($breakOnError) { + out += ' } if (errors === '; + if ($top) { + out += '0'; + } else { + out += 'errs_' + ($lvl); + } + out += ') { '; + $closingBraces2 += '}'; + } + } else { + if (it.opts.v5 && it.schema.patternGroups) { + it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); + } + var arr2 = it.RULES; + if (arr2) { + var $rulesGroup, i2 = -1, + l2 = arr2.length - 1; + while (i2 < l2) { + $rulesGroup = arr2[i2 += 1]; + if ($shouldUseGroup($rulesGroup)) { + if ($rulesGroup.type) { + out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { '; + } + if (it.opts.useDefaults && !it.compositeRule) { + if ($rulesGroup.type == 'object' && it.schema.properties) { + var $schema = it.schema.properties, + $schemaKeys = Object.keys($schema); + var arr3 = $schemaKeys; + if (arr3) { + var $propertyKey, i3 = -1, + l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $sch = $schema[$propertyKey]; + if ($sch.default !== undefined) { + var $passData = $data + it.util.getProperty($propertyKey); + out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; + if (it.opts.useDefaults == 'shared') { + out += ' ' + (it.useDefault($sch.default)) + ' '; + } else { + out += ' ' + (JSON.stringify($sch.default)) + ' '; + } + out += '; '; + } + } + } + } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { + var arr4 = it.schema.items; + if (arr4) { + var $sch, $i = -1, + l4 = arr4.length - 1; + while ($i < l4) { + $sch = arr4[$i += 1]; + if ($sch.default !== undefined) { + var $passData = $data + '[' + $i + ']'; + out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; + if (it.opts.useDefaults == 'shared') { + out += ' ' + (it.useDefault($sch.default)) + ' '; + } else { + out += ' ' + (JSON.stringify($sch.default)) + ' '; + } + out += '; '; + } + } + } + } + } + var arr5 = $rulesGroup.rules; + if (arr5) { + var $rule, i5 = -1, + l5 = arr5.length - 1; + while (i5 < l5) { + $rule = arr5[i5 += 1]; + if ($shouldUseRule($rule)) { + var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); + if ($code) { + out += ' ' + ($code) + ' '; + if ($breakOnError) { + $closingBraces1 += '}'; + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces1) + ' '; + $closingBraces1 = ''; + } + if ($rulesGroup.type) { + out += ' } '; + if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { + out += ' else { '; + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + } + } + if ($breakOnError) { + out += ' if (errors === '; + if ($top) { + out += '0'; + } else { + out += 'errs_' + ($lvl); + } + out += ') { '; + $closingBraces2 += '}'; + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces2) + ' '; + } + if ($top) { + if ($async) { + out += ' if (errors === 0) return data; '; + out += ' else throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; '; + out += ' return errors === 0; '; + } + out += ' }); return validate;'; + } else { + out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; + } + out = it.util.cleanUpCode(out); + if ($top) { + out = it.util.finalCleanUpCode(out, $async); + } + + function $shouldUseGroup($rulesGroup) { + var rules = $rulesGroup.rules; + for (var i = 0; i < rules.length; i++) + if ($shouldUseRule(rules[i])) return true; + } + + function $shouldUseRule($rule) { + return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); + } + + function $ruleImplementsSomeKeyword($rule) { + var impl = $rule.implements; + for (var i = 0; i < impl.length; i++) + if (it.schema[impl[i]] !== undefined) return true; + } + return out; +} diff --git a/appasar/canary/node_modules/ajv/lib/keyword.js b/appasar/canary/node_modules/ajv/lib/keyword.js new file mode 100644 index 0000000..5fcfb75 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/keyword.js @@ -0,0 +1,135 @@ +'use strict'; + +var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; +var customRuleCode = require('./dotjs/custom'); + +module.exports = { + add: addKeyword, + get: getKeyword, + remove: removeKeyword +}; + +/** + * Define custom keyword + * @this Ajv + * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). + * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. + * @return {Ajv} this for method chaining + */ +function addKeyword(keyword, definition) { + /* jshint validthis: true */ + /* eslint no-shadow: 0 */ + var RULES = this.RULES; + + if (RULES.keywords[keyword]) + throw new Error('Keyword ' + keyword + ' is already defined'); + + if (!IDENTIFIER.test(keyword)) + throw new Error('Keyword ' + keyword + ' is not a valid identifier'); + + if (definition) { + if (definition.macro && definition.valid !== undefined) + throw new Error('"valid" option cannot be used with macro keywords'); + + var dataType = definition.type; + if (Array.isArray(dataType)) { + var i, len = dataType.length; + for (i=0; i<len; i++) checkDataType(dataType[i]); + for (i=0; i<len; i++) _addRule(keyword, dataType[i], definition); + } else { + if (dataType) checkDataType(dataType); + _addRule(keyword, dataType, definition); + } + + var $data = definition.$data === true && this._opts.$data; + if ($data && !definition.validate) + throw new Error('$data support: "validate" function is not defined'); + + var metaSchema = definition.metaSchema; + if (metaSchema) { + if ($data) { + metaSchema = { + anyOf: [ + metaSchema, + { '$ref': 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#' } + ] + }; + } + definition.validateSchema = this.compile(metaSchema, true); + } + } + + RULES.keywords[keyword] = RULES.all[keyword] = true; + + + function _addRule(keyword, dataType, definition) { + var ruleGroup; + for (var i=0; i<RULES.length; i++) { + var rg = RULES[i]; + if (rg.type == dataType) { + ruleGroup = rg; + break; + } + } + + if (!ruleGroup) { + ruleGroup = { type: dataType, rules: [] }; + RULES.push(ruleGroup); + } + + var rule = { + keyword: keyword, + definition: definition, + custom: true, + code: customRuleCode, + implements: definition.implements + }; + ruleGroup.rules.push(rule); + RULES.custom[keyword] = rule; + } + + + function checkDataType(dataType) { + if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType); + } + + return this; +} + + +/** + * Get keyword + * @this Ajv + * @param {String} keyword pre-defined or custom keyword. + * @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise. + */ +function getKeyword(keyword) { + /* jshint validthis: true */ + var rule = this.RULES.custom[keyword]; + return rule ? rule.definition : this.RULES.keywords[keyword] || false; +} + + +/** + * Remove keyword + * @this Ajv + * @param {String} keyword pre-defined or custom keyword. + * @return {Ajv} this for method chaining + */ +function removeKeyword(keyword) { + /* jshint validthis: true */ + var RULES = this.RULES; + delete RULES.keywords[keyword]; + delete RULES.all[keyword]; + delete RULES.custom[keyword]; + for (var i=0; i<RULES.length; i++) { + var rules = RULES[i].rules; + for (var j=0; j<rules.length; j++) { + if (rules[j].keyword == keyword) { + rules.splice(j, 1); + break; + } + } + } + return this; +} diff --git a/appasar/canary/node_modules/ajv/lib/patternGroups.js b/appasar/canary/node_modules/ajv/lib/patternGroups.js new file mode 100644 index 0000000..531a8d0 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/patternGroups.js @@ -0,0 +1,36 @@ +'use strict'; + +var META_SCHEMA_ID = 'http://json-schema.org/draft-06/schema'; + +module.exports = function (ajv) { + var defaultMeta = ajv._opts.defaultMeta; + var metaSchemaRef = typeof defaultMeta == 'string' + ? { $ref: defaultMeta } + : ajv.getSchema(META_SCHEMA_ID) + ? { $ref: META_SCHEMA_ID } + : {}; + + ajv.addKeyword('patternGroups', { + // implemented in properties.jst + metaSchema: { + type: 'object', + additionalProperties: { + type: 'object', + required: [ 'schema' ], + properties: { + maximum: { + type: 'integer', + minimum: 0 + }, + minimum: { + type: 'integer', + minimum: 0 + }, + schema: metaSchemaRef + }, + additionalProperties: false + } + } + }); + ajv.RULES.all.properties.implements.push('patternGroups'); +}; diff --git a/appasar/canary/node_modules/ajv/lib/refs/$data.json b/appasar/canary/node_modules/ajv/lib/refs/$data.json new file mode 100644 index 0000000..4a2edec --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/refs/$data.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#", + "description": "Meta-schema for $data reference (JSON-schema extension proposal)", + "type": "object", + "required": [ "$data" ], + "properties": { + "$data": { + "type": "string", + "anyOf": [ + { "format": "relative-json-pointer" }, + { "format": "json-pointer" } + ] + } + }, + "additionalProperties": false +} diff --git a/appasar/canary/node_modules/ajv/lib/refs/json-schema-draft-04.json b/appasar/canary/node_modules/ajv/lib/refs/json-schema-draft-04.json new file mode 100644 index 0000000..85eb502 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/refs/json-schema-draft-04.json @@ -0,0 +1,150 @@ +{ + "id": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "positiveInteger": { + "type": "integer", + "minimum": 0 + }, + "positiveIntegerDefault0": { + "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + }, + "simpleTypes": { + "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + } + }, + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "multipleOf": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { "$ref": "#/definitions/positiveInteger" }, + "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/positiveInteger" }, + "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { "$ref": "#/definitions/positiveInteger" }, + "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "dependencies": { + "exclusiveMaximum": [ "maximum" ], + "exclusiveMinimum": [ "minimum" ] + }, + "default": {} +} diff --git a/appasar/canary/node_modules/ajv/lib/refs/json-schema-draft-06.json b/appasar/canary/node_modules/ajv/lib/refs/json-schema-draft-06.json new file mode 100644 index 0000000..5656240 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/refs/json-schema-draft-06.json @@ -0,0 +1,154 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "default": 0 } + ] + }, + "simpleTypes": { + "enum": [ + "array", + "boolean", + "integer", + "null", + "number", + "object", + "string" + ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": { "$ref": "#/definitions/nonNegativeInteger" }, + "minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { "$ref": "#" }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/nonNegativeInteger" }, + "minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": { "$ref": "#" }, + "maxProperties": { "$ref": "#/definitions/nonNegativeInteger" }, + "minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { "$ref": "#" }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "propertyNames": { "$ref": "#" }, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": { "type": "string" }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "default": {} +} diff --git a/appasar/canary/node_modules/ajv/lib/refs/json-schema-v5.json b/appasar/canary/node_modules/ajv/lib/refs/json-schema-v5.json new file mode 100644 index 0000000..cc679a4 --- /dev/null +++ b/appasar/canary/node_modules/ajv/lib/refs/json-schema-v5.json @@ -0,0 +1,250 @@ +{ + "id": "https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Core schema meta-schema (v5 proposals - deprecated)", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "positiveInteger": { + "type": "integer", + "minimum": 0 + }, + "positiveIntegerDefault0": { + "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + }, + "simpleTypes": { + "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + }, + "$data": { + "type": "object", + "required": [ "$data" ], + "properties": { + "$data": { + "type": "string", + "anyOf": [ + { "format": "relative-json-pointer" }, + { "format": "json-pointer" } + ] + } + }, + "additionalProperties": false + } + }, + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "multipleOf": { + "anyOf": [ + { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + { "$ref": "#/definitions/$data" } + ] + }, + "maximum": { + "anyOf": [ + { "type": "number" }, + { "$ref": "#/definitions/$data" } + ] + }, + "exclusiveMaximum": { + "anyOf": [ + { + "type": "boolean", + "default": false + }, + { "$ref": "#/definitions/$data" } + ] + }, + "minimum": { + "anyOf": [ + { "type": "number" }, + { "$ref": "#/definitions/$data" } + ] + }, + "exclusiveMinimum": { + "anyOf": [ + { + "type": "boolean", + "default": false + }, + { "$ref": "#/definitions/$data" } + ] + }, + "maxLength": { + "anyOf": [ + { "$ref": "#/definitions/positiveInteger" }, + { "$ref": "#/definitions/$data" } + ] + }, + "minLength": { + "anyOf": [ + { "$ref": "#/definitions/positiveIntegerDefault0" }, + { "$ref": "#/definitions/$data" } + ] + }, + "pattern": { + "anyOf": [ + { + "type": "string", + "format": "regex" + }, + { "$ref": "#/definitions/$data" } + ] + }, + "additionalItems": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" }, + { "$ref": "#/definitions/$data" } + ], + "default": {} + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { + "anyOf": [ + { "$ref": "#/definitions/positiveInteger" }, + { "$ref": "#/definitions/$data" } + ] + }, + "minItems": { + "anyOf": [ + { "$ref": "#/definitions/positiveIntegerDefault0" }, + { "$ref": "#/definitions/$data" } + ] + }, + "uniqueItems": { + "anyOf": [ + { + "type": "boolean", + "default": false + }, + { "$ref": "#/definitions/$data" } + ] + }, + "maxProperties": { + "anyOf": [ + { "$ref": "#/definitions/positiveInteger" }, + { "$ref": "#/definitions/$data" } + ] + }, + "minProperties": { + "anyOf": [ + { "$ref": "#/definitions/positiveIntegerDefault0" }, + { "$ref": "#/definitions/$data" } + ] + }, + "required": { + "anyOf": [ + { "$ref": "#/definitions/stringArray" }, + { "$ref": "#/definitions/$data" } + ] + }, + "additionalProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" }, + { "$ref": "#/definitions/$data" } + ], + "default": {} + }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "enum": { + "anyOf": [ + { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + { "$ref": "#/definitions/$data" } + ] + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" }, + "format": { + "anyOf": [ + { "type": "string" }, + { "$ref": "#/definitions/$data" } + ] + }, + "constant": { + "anyOf": [ + {}, + { "$ref": "#/definitions/$data" } + ] + }, + "contains": { "$ref": "#" } + }, + "dependencies": { + "exclusiveMaximum": [ "maximum" ], + "exclusiveMinimum": [ "minimum" ] + }, + "default": {} +} diff --git a/appasar/canary/node_modules/ajv/package.json b/appasar/canary/node_modules/ajv/package.json new file mode 100644 index 0000000..5b2ba14 --- /dev/null +++ b/appasar/canary/node_modules/ajv/package.json @@ -0,0 +1,103 @@ +{ + "name": "ajv", + "version": "5.5.2", + "description": "Another JSON Schema Validator", + "main": "lib/ajv.js", + "typings": "lib/ajv.d.ts", + "files": [ + "lib/", + "dist/", + "scripts/", + "LICENSE", + ".tonic_example.js" + ], + "scripts": { + "eslint": "if-node-version \">=4\" eslint lib/*.js lib/compile/*.js spec/*.js scripts", + "jshint": "jshint lib/*.js lib/**/*.js --exclude lib/dotjs/**/*", + "test-spec": "mocha spec/*.spec.js -R spec $(if-node-version 7 echo --harmony-async-await)", + "test-fast": "AJV_FAST_TEST=true npm run test-spec", + "test-debug": "mocha spec/*.spec.js --debug-brk -R spec", + "test-cov": "nyc npm run test-spec", + "test-ts": "tsc --target ES5 --noImplicitAny lib/ajv.d.ts", + "bundle": "node ./scripts/bundle.js . Ajv pure_getters", + "bundle-regenerator": "node ./scripts/bundle.js regenerator", + "bundle-nodent": "node ./scripts/bundle.js nodent", + "bundle-all": "del-cli dist && npm run bundle && npm run bundle-regenerator && npm run bundle-nodent", + "bundle-beautify": "node ./scripts/bundle.js js-beautify", + "build": "del-cli lib/dotjs/*.js && node scripts/compile-dots.js", + "test-karma": "karma start --single-run --browsers PhantomJS", + "test-browser": "del-cli .browser && npm run bundle-all && scripts/prepare-tests && npm run test-karma", + "test": "npm run jshint && npm run eslint && npm run test-ts && npm run build && npm run test-cov && if-node-version 4 npm run test-browser", + "prepublish": "npm run build && npm run bundle-all", + "watch": "watch 'npm run build' ./lib/dot" + }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/epoberezkin/ajv.git" + }, + "keywords": [ + "JSON", + "schema", + "validator", + "validation", + "jsonschema", + "json-schema", + "json-schema-validator", + "json-schema-validation" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": { + "url": "https://github.com/epoberezkin/ajv/issues" + }, + "homepage": "https://github.com/epoberezkin/ajv", + "tonicExampleFilename": ".tonic_example.js", + "dependencies": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + }, + "devDependencies": { + "ajv-async": "^0.1.0", + "bluebird": "^3.1.5", + "brfs": "^1.4.3", + "browserify": "^14.1.0", + "chai": "^4.0.1", + "coveralls": "^3.0.0", + "del-cli": "^1.1.0", + "dot": "^1.0.3", + "eslint": "^4.1.0", + "gh-pages-generator": "^0.2.0", + "glob": "^7.0.0", + "if-node-version": "^1.0.0", + "js-beautify": "^1.7.3", + "jshint": "^2.9.4", + "json-schema-test": "^2.0.0", + "karma": "^1.0.0", + "karma-chrome-launcher": "^2.0.0", + "karma-mocha": "^1.1.1", + "karma-phantomjs-launcher": "^1.0.0", + "karma-sauce-launcher": "^1.1.0", + "mocha": "^4.0.0", + "nodent": "^3.0.17", + "nyc": "^11.0.2", + "phantomjs-prebuilt": "^2.1.4", + "pre-commit": "^1.1.1", + "regenerator": "^0.12.2", + "require-globify": "^1.3.0", + "typescript": "^2.6.2", + "uglify-js": "^3.1.5", + "watch": "^1.0.0" + } +} diff --git a/appasar/canary/node_modules/ajv/scripts/.eslintrc.yml b/appasar/canary/node_modules/ajv/scripts/.eslintrc.yml new file mode 100644 index 0000000..493d7d3 --- /dev/null +++ b/appasar/canary/node_modules/ajv/scripts/.eslintrc.yml @@ -0,0 +1,3 @@ +rules: + no-console: 0 + no-empty: [2, allowEmptyCatch: true] diff --git a/appasar/canary/node_modules/ajv/scripts/bundle.js b/appasar/canary/node_modules/ajv/scripts/bundle.js new file mode 100644 index 0000000..e381a76 --- /dev/null +++ b/appasar/canary/node_modules/ajv/scripts/bundle.js @@ -0,0 +1,61 @@ +'use strict'; + +var fs = require('fs') + , path = require('path') + , browserify = require('browserify') + , uglify = require('uglify-js'); + +var pkg = process.argv[2] + , standalone = process.argv[3] + , compress = process.argv[4]; + +var packageDir = path.join(__dirname, '..'); +if (pkg != '.') packageDir = path.join(packageDir, 'node_modules', pkg); + +var json = require(path.join(packageDir, 'package.json')); + +var distDir = path.join(__dirname, '..', 'dist'); +if (!fs.existsSync(distDir)) fs.mkdirSync(distDir); + +var bOpts = {}; +if (standalone) bOpts.standalone = standalone; + +browserify(bOpts) +.require(path.join(packageDir, json.main), {expose: json.name}) +.bundle(function (err, buf) { + if (err) { + console.error('browserify error:', err); + process.exit(1); + } + + var outputFile = path.join(distDir, json.name); + var uglifyOpts = { + warnings: true, + compress: {}, + output: { + preamble: '/* ' + json.name + ' ' + json.version + ': ' + json.description + ' */' + } + }; + if (compress) { + var compressOpts = compress.split(','); + for (var i=0, il = compressOpts.length; i<il; ++i) { + var pair = compressOpts[i].split('='); + uglifyOpts.compress[pair[0]] = pair.length < 1 || pair[1] != 'false'; + } + } + if (standalone) { + uglifyOpts.sourceMap = { + filename: json.name + '.min.js', + url: json.name + '.min.js.map' + }; + } + + var result = uglify.minify(buf.toString(), uglifyOpts); + fs.writeFileSync(outputFile + '.min.js', result.code); + if (result.map) fs.writeFileSync(outputFile + '.min.js.map', result.map); + if (standalone) fs.writeFileSync(outputFile + '.bundle.js', buf); + if (result.warnings) { + for (var j=0, jl = result.warnings.length; j<jl; ++j) + console.warn('UglifyJS warning:', result.warnings[j]); + } +}); diff --git a/appasar/canary/node_modules/ajv/scripts/compile-dots.js b/appasar/canary/node_modules/ajv/scripts/compile-dots.js new file mode 100644 index 0000000..5a21a7d --- /dev/null +++ b/appasar/canary/node_modules/ajv/scripts/compile-dots.js @@ -0,0 +1,73 @@ +//compile doT templates to js functions +'use strict'; + +var glob = require('glob') + , fs = require('fs') + , path = require('path') + , doT = require('dot') + , beautify = require('js-beautify').js_beautify; + +var defsRootPath = process.argv[2] || path.join(__dirname, '../lib'); + +var defs = {}; +var defFiles = glob.sync('./dot/**/*.def', { cwd: defsRootPath }); +defFiles.forEach(function (f) { + var name = path.basename(f, '.def'); + defs[name] = fs.readFileSync(path.join(defsRootPath, f)); +}); + +var filesRootPath = process.argv[3] || path.join(__dirname, '../lib'); +var files = glob.sync('./dot/**/*.jst', { cwd: filesRootPath }); + +var dotjsPath = path.join(filesRootPath, './dotjs'); +try { fs.mkdirSync(dotjsPath); } catch(e) {} + +console.log('\n\nCompiling:'); + +var FUNCTION_NAME = /function\s+anonymous\s*\(it[^)]*\)\s*{/; +var OUT_EMPTY_STRING = /out\s*\+=\s*'\s*';/g; +var ISTANBUL = /'(istanbul[^']+)';/g; +var ERROR_KEYWORD = /\$errorKeyword/g; +var ERROR_KEYWORD_OR = /\$errorKeyword\s+\|\|/g; +var VARS = [ + '$errs', '$valid', '$lvl', '$data', '$dataLvl', + '$errorKeyword', '$closingBraces', '$schemaPath', + '$validate' +]; + +files.forEach(function (f) { + var keyword = path.basename(f, '.jst'); + var targetPath = path.join(dotjsPath, keyword + '.js'); + var template = fs.readFileSync(path.join(filesRootPath, f)); + var code = doT.compile(template, defs); + code = code.toString() + .replace(OUT_EMPTY_STRING, '') + .replace(FUNCTION_NAME, 'function generate_' + keyword + '(it, $keyword, $ruleType) {') + .replace(ISTANBUL, '/* $1 */'); + removeAlwaysFalsyInOr(); + VARS.forEach(removeUnusedVar); + code = "'use strict';\nmodule.exports = " + code; + code = beautify(code, { indent_size: 2 }) + '\n'; + fs.writeFileSync(targetPath, code); + console.log('compiled', keyword); + + function removeUnusedVar(v) { + v = v.replace(/\$/g, '\\$$'); + var regexp = new RegExp(v + '[^A-Za-z0-9_$]', 'g'); + var count = occurrences(regexp); + if (count == 1) { + regexp = new RegExp('var\\s+' + v + '\\s*=[^;]+;|var\\s+' + v + ';'); + code = code.replace(regexp, ''); + } + } + + function removeAlwaysFalsyInOr() { + var countUsed = occurrences(ERROR_KEYWORD); + var countOr = occurrences(ERROR_KEYWORD_OR); + if (countUsed == countOr + 1) code = code.replace(ERROR_KEYWORD_OR, ''); + } + + function occurrences(regexp) { + return (code.match(regexp) || []).length; + } +}); diff --git a/appasar/canary/node_modules/ajv/scripts/info b/appasar/canary/node_modules/ajv/scripts/info new file mode 100644 index 0000000..77269ab --- /dev/null +++ b/appasar/canary/node_modules/ajv/scripts/info @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +'use strict'; + +var fs = require('fs'); +var name = process.argv[2] || '.'; +var property = process.argv[3] || 'version'; +if (name != '.') name = 'node_modules/' + name; +var json = JSON.parse(fs.readFileSync(name + '/package.json', 'utf8')); +console.log(json[property]); diff --git a/appasar/canary/node_modules/ajv/scripts/prepare-tests b/appasar/canary/node_modules/ajv/scripts/prepare-tests new file mode 100644 index 0000000..6f62634 --- /dev/null +++ b/appasar/canary/node_modules/ajv/scripts/prepare-tests @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +set -e + +mkdir -p .browser + +find spec -type f -name '*.spec.js' | \ +xargs -I {} sh -c \ +'export f="{}"; browserify $f -t require-globify -t brfs -x ajv -u buffer -o $(echo $f | sed -e "s/spec/.browser/");' diff --git a/appasar/canary/node_modules/ajv/scripts/travis-gh-pages b/appasar/canary/node_modules/ajv/scripts/travis-gh-pages new file mode 100644 index 0000000..46ded16 --- /dev/null +++ b/appasar/canary/node_modules/ajv/scripts/travis-gh-pages @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then + git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && { + rm -rf ../gh-pages + git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv.git ../gh-pages + mkdir -p ../gh-pages/_source + cp *.md ../gh-pages/_source + cp LICENSE ../gh-pages/_source + currentDir=$(pwd) + cd ../gh-pages + $currentDir/node_modules/.bin/gh-pages-generator + # remove logo from README + sed -i -E "s/<img[^>]+ajv_logo[^>]+>//" index.md + git config user.email "$GIT_USER_EMAIL" + git config user.name "$GIT_USER_NAME" + git add . + git commit -am "updated by travis build #$TRAVIS_BUILD_NUMBER" + git push --quiet origin gh-pages > /dev/null 2>&1 + } +fi diff --git a/appasar/canary/node_modules/asn1/.npmignore b/appasar/canary/node_modules/asn1/.npmignore new file mode 100644 index 0000000..eb03e3e --- /dev/null +++ b/appasar/canary/node_modules/asn1/.npmignore @@ -0,0 +1,2 @@ +node_modules +*.log diff --git a/appasar/canary/node_modules/asn1/.travis.yml b/appasar/canary/node_modules/asn1/.travis.yml new file mode 100644 index 0000000..09d3ef3 --- /dev/null +++ b/appasar/canary/node_modules/asn1/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.8 + - 0.10 diff --git a/appasar/canary/node_modules/asn1/LICENSE b/appasar/canary/node_modules/asn1/LICENSE new file mode 100644 index 0000000..9b5dcdb --- /dev/null +++ b/appasar/canary/node_modules/asn1/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Mark Cavage, All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE diff --git a/appasar/canary/node_modules/asn1/README.md b/appasar/canary/node_modules/asn1/README.md new file mode 100644 index 0000000..7cebf7a --- /dev/null +++ b/appasar/canary/node_modules/asn1/README.md @@ -0,0 +1,50 @@ +node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS. +Currently BER encoding is supported; at some point I'll likely have to do DER. + +## Usage + +Mostly, if you're *actually* needing to read and write ASN.1, you probably don't +need this readme to explain what and why. If you have no idea what ASN.1 is, +see this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc + +The source is pretty much self-explanatory, and has read/write methods for the +common types out there. + +### Decoding + +The following reads an ASN.1 sequence with a boolean. + + var Ber = require('asn1').Ber; + + var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff])); + + reader.readSequence(); + console.log('Sequence len: ' + reader.length); + if (reader.peek() === Ber.Boolean) + console.log(reader.readBoolean()); + +### Encoding + +The following generates the same payload as above. + + var Ber = require('asn1').Ber; + + var writer = new Ber.Writer(); + + writer.startSequence(); + writer.writeBoolean(true); + writer.endSequence(); + + console.log(writer.buffer); + +## Installation + + npm install asn1 + +## License + +MIT. + +## Bugs + +See <https://github.com/mcavage/node-asn1/issues>. diff --git a/appasar/canary/node_modules/asn1/lib/ber/errors.js b/appasar/canary/node_modules/asn1/lib/ber/errors.js new file mode 100644 index 0000000..ff21d4f --- /dev/null +++ b/appasar/canary/node_modules/asn1/lib/ber/errors.js @@ -0,0 +1,13 @@ +// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. + + +module.exports = { + + newInvalidAsn1Error: function(msg) { + var e = new Error(); + e.name = 'InvalidAsn1Error'; + e.message = msg || ''; + return e; + } + +}; diff --git a/appasar/canary/node_modules/asn1/lib/ber/index.js b/appasar/canary/node_modules/asn1/lib/ber/index.js new file mode 100644 index 0000000..4fb90ae --- /dev/null +++ b/appasar/canary/node_modules/asn1/lib/ber/index.js @@ -0,0 +1,27 @@ +// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. + +var errors = require('./errors'); +var types = require('./types'); + +var Reader = require('./reader'); +var Writer = require('./writer'); + + +///--- Exports + +module.exports = { + + Reader: Reader, + + Writer: Writer + +}; + +for (var t in types) { + if (types.hasOwnProperty(t)) + module.exports[t] = types[t]; +} +for (var e in errors) { + if (errors.hasOwnProperty(e)) + module.exports[e] = errors[e]; +} diff --git a/appasar/canary/node_modules/asn1/lib/ber/reader.js b/appasar/canary/node_modules/asn1/lib/ber/reader.js new file mode 100644 index 0000000..0a00e98 --- /dev/null +++ b/appasar/canary/node_modules/asn1/lib/ber/reader.js @@ -0,0 +1,261 @@ +// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. + +var assert = require('assert'); + +var ASN1 = require('./types'); +var errors = require('./errors'); + + +///--- Globals + +var newInvalidAsn1Error = errors.newInvalidAsn1Error; + + + +///--- API + +function Reader(data) { + if (!data || !Buffer.isBuffer(data)) + throw new TypeError('data must be a node Buffer'); + + this._buf = data; + this._size = data.length; + + // These hold the "current" state + this._len = 0; + this._offset = 0; +} + +Object.defineProperty(Reader.prototype, 'length', { + enumerable: true, + get: function () { return (this._len); } +}); + +Object.defineProperty(Reader.prototype, 'offset', { + enumerable: true, + get: function () { return (this._offset); } +}); + +Object.defineProperty(Reader.prototype, 'remain', { + get: function () { return (this._size - this._offset); } +}); + +Object.defineProperty(Reader.prototype, 'buffer', { + get: function () { return (this._buf.slice(this._offset)); } +}); + + +/** + * Reads a single byte and advances offset; you can pass in `true` to make this + * a "peek" operation (i.e., get the byte, but don't advance the offset). + * + * @param {Boolean} peek true means don't move offset. + * @return {Number} the next byte, null if not enough data. + */ +Reader.prototype.readByte = function(peek) { + if (this._size - this._offset < 1) + return null; + + var b = this._buf[this._offset] & 0xff; + + if (!peek) + this._offset += 1; + + return b; +}; + + +Reader.prototype.peek = function() { + return this.readByte(true); +}; + + +/** + * Reads a (potentially) variable length off the BER buffer. This call is + * not really meant to be called directly, as callers have to manipulate + * the internal buffer afterwards. + * + * As a result of this call, you can call `Reader.length`, until the + * next thing called that does a readLength. + * + * @return {Number} the amount of offset to advance the buffer. + * @throws {InvalidAsn1Error} on bad ASN.1 + */ +Reader.prototype.readLength = function(offset) { + if (offset === undefined) + offset = this._offset; + + if (offset >= this._size) + return null; + + var lenB = this._buf[offset++] & 0xff; + if (lenB === null) + return null; + + if ((lenB & 0x80) == 0x80) { + lenB &= 0x7f; + + if (lenB == 0) + throw newInvalidAsn1Error('Indefinite length not supported'); + + if (lenB > 4) + throw newInvalidAsn1Error('encoding too long'); + + if (this._size - offset < lenB) + return null; + + this._len = 0; + for (var i = 0; i < lenB; i++) + this._len = (this._len << 8) + (this._buf[offset++] & 0xff); + + } else { + // Wasn't a variable length + this._len = lenB; + } + + return offset; +}; + + +/** + * Parses the next sequence in this BER buffer. + * + * To get the length of the sequence, call `Reader.length`. + * + * @return {Number} the sequence's tag. + */ +Reader.prototype.readSequence = function(tag) { + var seq = this.peek(); + if (seq === null) + return null; + if (tag !== undefined && tag !== seq) + throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + + ': got 0x' + seq.toString(16)); + + var o = this.readLength(this._offset + 1); // stored in `length` + if (o === null) + return null; + + this._offset = o; + return seq; +}; + + +Reader.prototype.readInt = function() { + return this._readTag(ASN1.Integer); +}; + + +Reader.prototype.readBoolean = function() { + return (this._readTag(ASN1.Boolean) === 0 ? false : true); +}; + + +Reader.prototype.readEnumeration = function() { + return this._readTag(ASN1.Enumeration); +}; + + +Reader.prototype.readString = function(tag, retbuf) { + if (!tag) + tag = ASN1.OctetString; + + var b = this.peek(); + if (b === null) + return null; + + if (b !== tag) + throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + + ': got 0x' + b.toString(16)); + + var o = this.readLength(this._offset + 1); // stored in `length` + + if (o === null) + return null; + + if (this.length > this._size - o) + return null; + + this._offset = o; + + if (this.length === 0) + return retbuf ? new Buffer(0) : ''; + + var str = this._buf.slice(this._offset, this._offset + this.length); + this._offset += this.length; + + return retbuf ? str : str.toString('utf8'); +}; + +Reader.prototype.readOID = function(tag) { + if (!tag) + tag = ASN1.OID; + + var b = this.readString(tag, true); + if (b === null) + return null; + + var values = []; + var value = 0; + + for (var i = 0; i < b.length; i++) { + var byte = b[i] & 0xff; + + value <<= 7; + value += byte & 0x7f; + if ((byte & 0x80) == 0) { + values.push(value); + value = 0; + } + } + + value = values.shift(); + values.unshift(value % 40); + values.unshift((value / 40) >> 0); + + return values.join('.'); +}; + + +Reader.prototype._readTag = function(tag) { + assert.ok(tag !== undefined); + + var b = this.peek(); + + if (b === null) + return null; + + if (b !== tag) + throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + + ': got 0x' + b.toString(16)); + + var o = this.readLength(this._offset + 1); // stored in `length` + if (o === null) + return null; + + if (this.length > 4) + throw newInvalidAsn1Error('Integer too long: ' + this.length); + + if (this.length > this._size - o) + return null; + this._offset = o; + + var fb = this._buf[this._offset]; + var value = 0; + + for (var i = 0; i < this.length; i++) { + value <<= 8; + value |= (this._buf[this._offset++] & 0xff); + } + + if ((fb & 0x80) == 0x80 && i !== 4) + value -= (1 << (i * 8)); + + return value >> 0; +}; + + + +///--- Exported API + +module.exports = Reader; diff --git a/appasar/canary/node_modules/asn1/lib/ber/types.js b/appasar/canary/node_modules/asn1/lib/ber/types.js new file mode 100644 index 0000000..8aea000 --- /dev/null +++ b/appasar/canary/node_modules/asn1/lib/ber/types.js @@ -0,0 +1,36 @@ +// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. + + +module.exports = { + EOC: 0, + Boolean: 1, + Integer: 2, + BitString: 3, + OctetString: 4, + Null: 5, + OID: 6, + ObjectDescriptor: 7, + External: 8, + Real: 9, // float + Enumeration: 10, + PDV: 11, + Utf8String: 12, + RelativeOID: 13, + Sequence: 16, + Set: 17, + NumericString: 18, + PrintableString: 19, + T61String: 20, + VideotexString: 21, + IA5String: 22, + UTCTime: 23, + GeneralizedTime: 24, + GraphicString: 25, + VisibleString: 26, + GeneralString: 28, + UniversalString: 29, + CharacterString: 30, + BMPString: 31, + Constructor: 32, + Context: 128 +}; diff --git a/appasar/canary/node_modules/asn1/lib/ber/writer.js b/appasar/canary/node_modules/asn1/lib/ber/writer.js new file mode 100644 index 0000000..d9d99af --- /dev/null +++ b/appasar/canary/node_modules/asn1/lib/ber/writer.js @@ -0,0 +1,316 @@ +// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. + +var assert = require('assert'); +var ASN1 = require('./types'); +var errors = require('./errors'); + + +///--- Globals + +var newInvalidAsn1Error = errors.newInvalidAsn1Error; + +var DEFAULT_OPTS = { + size: 1024, + growthFactor: 8 +}; + + +///--- Helpers + +function merge(from, to) { + assert.ok(from); + assert.equal(typeof(from), 'object'); + assert.ok(to); + assert.equal(typeof(to), 'object'); + + var keys = Object.getOwnPropertyNames(from); + keys.forEach(function(key) { + if (to[key]) + return; + + var value = Object.getOwnPropertyDescriptor(from, key); + Object.defineProperty(to, key, value); + }); + + return to; +} + + + +///--- API + +function Writer(options) { + options = merge(DEFAULT_OPTS, options || {}); + + this._buf = new Buffer(options.size || 1024); + this._size = this._buf.length; + this._offset = 0; + this._options = options; + + // A list of offsets in the buffer where we need to insert + // sequence tag/len pairs. + this._seq = []; +} + +Object.defineProperty(Writer.prototype, 'buffer', { + get: function () { + if (this._seq.length) + throw new InvalidAsn1Error(this._seq.length + ' unended sequence(s)'); + + return (this._buf.slice(0, this._offset)); + } +}); + +Writer.prototype.writeByte = function(b) { + if (typeof(b) !== 'number') + throw new TypeError('argument must be a Number'); + + this._ensure(1); + this._buf[this._offset++] = b; +}; + + +Writer.prototype.writeInt = function(i, tag) { + if (typeof(i) !== 'number') + throw new TypeError('argument must be a Number'); + if (typeof(tag) !== 'number') + tag = ASN1.Integer; + + var sz = 4; + + while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000 >> 0)) && + (sz > 1)) { + sz--; + i <<= 8; + } + + if (sz > 4) + throw new InvalidAsn1Error('BER ints cannot be > 0xffffffff'); + + this._ensure(2 + sz); + this._buf[this._offset++] = tag; + this._buf[this._offset++] = sz; + + while (sz-- > 0) { + this._buf[this._offset++] = ((i & 0xff000000) >>> 24); + i <<= 8; + } + +}; + + +Writer.prototype.writeNull = function() { + this.writeByte(ASN1.Null); + this.writeByte(0x00); +}; + + +Writer.prototype.writeEnumeration = function(i, tag) { + if (typeof(i) !== 'number') + throw new TypeError('argument must be a Number'); + if (typeof(tag) !== 'number') + tag = ASN1.Enumeration; + + return this.writeInt(i, tag); +}; + + +Writer.prototype.writeBoolean = function(b, tag) { + if (typeof(b) !== 'boolean') + throw new TypeError('argument must be a Boolean'); + if (typeof(tag) !== 'number') + tag = ASN1.Boolean; + + this._ensure(3); + this._buf[this._offset++] = tag; + this._buf[this._offset++] = 0x01; + this._buf[this._offset++] = b ? 0xff : 0x00; +}; + + +Writer.prototype.writeString = function(s, tag) { + if (typeof(s) !== 'string') + throw new TypeError('argument must be a string (was: ' + typeof(s) + ')'); + if (typeof(tag) !== 'number') + tag = ASN1.OctetString; + + var len = Buffer.byteLength(s); + this.writeByte(tag); + this.writeLength(len); + if (len) { + this._ensure(len); + this._buf.write(s, this._offset); + this._offset += len; + } +}; + + +Writer.prototype.writeBuffer = function(buf, tag) { + if (typeof(tag) !== 'number') + throw new TypeError('tag must be a number'); + if (!Buffer.isBuffer(buf)) + throw new TypeError('argument must be a buffer'); + + this.writeByte(tag); + this.writeLength(buf.length); + this._ensure(buf.length); + buf.copy(this._buf, this._offset, 0, buf.length); + this._offset += buf.length; +}; + + +Writer.prototype.writeStringArray = function(strings) { + if ((!strings instanceof Array)) + throw new TypeError('argument must be an Array[String]'); + + var self = this; + strings.forEach(function(s) { + self.writeString(s); + }); +}; + +// This is really to solve DER cases, but whatever for now +Writer.prototype.writeOID = function(s, tag) { + if (typeof(s) !== 'string') + throw new TypeError('argument must be a string'); + if (typeof(tag) !== 'number') + tag = ASN1.OID; + + if (!/^([0-9]+\.){3,}[0-9]+$/.test(s)) + throw new Error('argument is not a valid OID string'); + + function encodeOctet(bytes, octet) { + if (octet < 128) { + bytes.push(octet); + } else if (octet < 16384) { + bytes.push((octet >>> 7) | 0x80); + bytes.push(octet & 0x7F); + } else if (octet < 2097152) { + bytes.push((octet >>> 14) | 0x80); + bytes.push(((octet >>> 7) | 0x80) & 0xFF); + bytes.push(octet & 0x7F); + } else if (octet < 268435456) { + bytes.push((octet >>> 21) | 0x80); + bytes.push(((octet >>> 14) | 0x80) & 0xFF); + bytes.push(((octet >>> 7) | 0x80) & 0xFF); + bytes.push(octet & 0x7F); + } else { + bytes.push(((octet >>> 28) | 0x80) & 0xFF); + bytes.push(((octet >>> 21) | 0x80) & 0xFF); + bytes.push(((octet >>> 14) | 0x80) & 0xFF); + bytes.push(((octet >>> 7) | 0x80) & 0xFF); + bytes.push(octet & 0x7F); + } + } + + var tmp = s.split('.'); + var bytes = []; + bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10)); + tmp.slice(2).forEach(function(b) { + encodeOctet(bytes, parseInt(b, 10)); + }); + + var self = this; + this._ensure(2 + bytes.length); + this.writeByte(tag); + this.writeLength(bytes.length); + bytes.forEach(function(b) { + self.writeByte(b); + }); +}; + + +Writer.prototype.writeLength = function(len) { + if (typeof(len) !== 'number') + throw new TypeError('argument must be a Number'); + + this._ensure(4); + + if (len <= 0x7f) { + this._buf[this._offset++] = len; + } else if (len <= 0xff) { + this._buf[this._offset++] = 0x81; + this._buf[this._offset++] = len; + } else if (len <= 0xffff) { + this._buf[this._offset++] = 0x82; + this._buf[this._offset++] = len >> 8; + this._buf[this._offset++] = len; + } else if (len <= 0xffffff) { + this._buf[this._offset++] = 0x83; + this._buf[this._offset++] = len >> 16; + this._buf[this._offset++] = len >> 8; + this._buf[this._offset++] = len; + } else { + throw new InvalidAsn1ERror('Length too long (> 4 bytes)'); + } +}; + +Writer.prototype.startSequence = function(tag) { + if (typeof(tag) !== 'number') + tag = ASN1.Sequence | ASN1.Constructor; + + this.writeByte(tag); + this._seq.push(this._offset); + this._ensure(3); + this._offset += 3; +}; + + +Writer.prototype.endSequence = function() { + var seq = this._seq.pop(); + var start = seq + 3; + var len = this._offset - start; + + if (len <= 0x7f) { + this._shift(start, len, -2); + this._buf[seq] = len; + } else if (len <= 0xff) { + this._shift(start, len, -1); + this._buf[seq] = 0x81; + this._buf[seq + 1] = len; + } else if (len <= 0xffff) { + this._buf[seq] = 0x82; + this._buf[seq + 1] = len >> 8; + this._buf[seq + 2] = len; + } else if (len <= 0xffffff) { + this._shift(start, len, 1); + this._buf[seq] = 0x83; + this._buf[seq + 1] = len >> 16; + this._buf[seq + 2] = len >> 8; + this._buf[seq + 3] = len; + } else { + throw new InvalidAsn1Error('Sequence too long'); + } +}; + + +Writer.prototype._shift = function(start, len, shift) { + assert.ok(start !== undefined); + assert.ok(len !== undefined); + assert.ok(shift); + + this._buf.copy(this._buf, start + shift, start, start + len); + this._offset += shift; +}; + +Writer.prototype._ensure = function(len) { + assert.ok(len); + + if (this._size - this._offset < len) { + var sz = this._size * this._options.growthFactor; + if (sz - this._offset < len) + sz += len; + + var buf = new Buffer(sz); + + this._buf.copy(buf, 0, 0, this._offset); + this._buf = buf; + this._size = sz; + } +}; + + + +///--- Exported API + +module.exports = Writer; diff --git a/appasar/canary/node_modules/asn1/lib/index.js b/appasar/canary/node_modules/asn1/lib/index.js new file mode 100644 index 0000000..d1766e7 --- /dev/null +++ b/appasar/canary/node_modules/asn1/lib/index.js @@ -0,0 +1,20 @@ +// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. + +// If you have no idea what ASN.1 or BER is, see this: +// ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc + +var Ber = require('./ber/index'); + + + +///--- Exported API + +module.exports = { + + Ber: Ber, + + BerReader: Ber.Reader, + + BerWriter: Ber.Writer + +}; diff --git a/appasar/canary/node_modules/asn1/package.json b/appasar/canary/node_modules/asn1/package.json new file mode 100644 index 0000000..f6dfb06 --- /dev/null +++ b/appasar/canary/node_modules/asn1/package.json @@ -0,0 +1,24 @@ +{ + "author": "Mark Cavage <mcavage@gmail.com>", + "contributors": [ + "David Gwynne <loki@animata.net>", + "Yunong Xiao <yunong@joyent.com>", + "Alex Wilson <alex.wilson@joyent.com>" + ], + "name": "asn1", + "description": "Contains parsers and serializers for ASN.1 (currently BER only)", + "version": "0.2.3", + "repository": { + "type": "git", + "url": "git://github.com/mcavage/node-asn1.git" + }, + "main": "lib/index.js", + "dependencies": {}, + "devDependencies": { + "tap": "0.4.8" + }, + "scripts": { + "test": "./node_modules/.bin/tap ./tst" + }, + "license": "MIT" +} diff --git a/appasar/canary/node_modules/asn1/tst/ber/reader.test.js b/appasar/canary/node_modules/asn1/tst/ber/reader.test.js new file mode 100644 index 0000000..062fd7e --- /dev/null +++ b/appasar/canary/node_modules/asn1/tst/ber/reader.test.js @@ -0,0 +1,208 @@ +// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. + +var test = require('tap').test; + + + +///--- Globals + +var BerReader; + + + +///--- Tests + +test('load library', function(t) { + BerReader = require('../../lib/index').BerReader; + t.ok(BerReader); + try { + new BerReader(); + t.fail('Should have thrown'); + } catch (e) { + t.ok(e instanceof TypeError, 'Should have been a type error'); + } + t.end(); +}); + + +test('read byte', function(t) { + var reader = new BerReader(new Buffer([0xde])); + t.ok(reader); + t.equal(reader.readByte(), 0xde, 'wrong value'); + t.end(); +}); + + +test('read 1 byte int', function(t) { + var reader = new BerReader(new Buffer([0x02, 0x01, 0x03])); + t.ok(reader); + t.equal(reader.readInt(), 0x03, 'wrong value'); + t.equal(reader.length, 0x01, 'wrong length'); + t.end(); +}); + + +test('read 2 byte int', function(t) { + var reader = new BerReader(new Buffer([0x02, 0x02, 0x7e, 0xde])); + t.ok(reader); + t.equal(reader.readInt(), 0x7ede, 'wrong value'); + t.equal(reader.length, 0x02, 'wrong length'); + t.end(); +}); + + +test('read 3 byte int', function(t) { + var reader = new BerReader(new Buffer([0x02, 0x03, 0x7e, 0xde, 0x03])); + t.ok(reader); + t.equal(reader.readInt(), 0x7ede03, 'wrong value'); + t.equal(reader.length, 0x03, 'wrong length'); + t.end(); +}); + + +test('read 4 byte int', function(t) { + var reader = new BerReader(new Buffer([0x02, 0x04, 0x7e, 0xde, 0x03, 0x01])); + t.ok(reader); + t.equal(reader.readInt(), 0x7ede0301, 'wrong value'); + t.equal(reader.length, 0x04, 'wrong length'); + t.end(); +}); + + +test('read 1 byte negative int', function(t) { + var reader = new BerReader(new Buffer([0x02, 0x01, 0xdc])); + t.ok(reader); + t.equal(reader.readInt(), -36, 'wrong value'); + t.equal(reader.length, 0x01, 'wrong length'); + t.end(); +}); + + +test('read 2 byte negative int', function(t) { + var reader = new BerReader(new Buffer([0x02, 0x02, 0xc0, 0x4e])); + t.ok(reader); + t.equal(reader.readInt(), -16306, 'wrong value'); + t.equal(reader.length, 0x02, 'wrong length'); + t.end(); +}); + + +test('read 3 byte negative int', function(t) { + var reader = new BerReader(new Buffer([0x02, 0x03, 0xff, 0x00, 0x19])); + t.ok(reader); + t.equal(reader.readInt(), -65511, 'wrong value'); + t.equal(reader.length, 0x03, 'wrong length'); + t.end(); +}); + + +test('read 4 byte negative int', function(t) { + var reader = new BerReader(new Buffer([0x02, 0x04, 0x91, 0x7c, 0x22, 0x1f])); + t.ok(reader); + t.equal(reader.readInt(), -1854135777, 'wrong value'); + t.equal(reader.length, 0x04, 'wrong length'); + t.end(); +}); + + +test('read boolean true', function(t) { + var reader = new BerReader(new Buffer([0x01, 0x01, 0xff])); + t.ok(reader); + t.equal(reader.readBoolean(), true, 'wrong value'); + t.equal(reader.length, 0x01, 'wrong length'); + t.end(); +}); + + +test('read boolean false', function(t) { + var reader = new BerReader(new Buffer([0x01, 0x01, 0x00])); + t.ok(reader); + t.equal(reader.readBoolean(), false, 'wrong value'); + t.equal(reader.length, 0x01, 'wrong length'); + t.end(); +}); + + +test('read enumeration', function(t) { + var reader = new BerReader(new Buffer([0x0a, 0x01, 0x20])); + t.ok(reader); + t.equal(reader.readEnumeration(), 0x20, 'wrong value'); + t.equal(reader.length, 0x01, 'wrong length'); + t.end(); +}); + + +test('read string', function(t) { + var dn = 'cn=foo,ou=unit,o=test'; + var buf = new Buffer(dn.length + 2); + buf[0] = 0x04; + buf[1] = Buffer.byteLength(dn); + buf.write(dn, 2); + var reader = new BerReader(buf); + t.ok(reader); + t.equal(reader.readString(), dn, 'wrong value'); + t.equal(reader.length, dn.length, 'wrong length'); + t.end(); +}); + + +test('read sequence', function(t) { + var reader = new BerReader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff])); + t.ok(reader); + t.equal(reader.readSequence(), 0x30, 'wrong value'); + t.equal(reader.length, 0x03, 'wrong length'); + t.equal(reader.readBoolean(), true, 'wrong value'); + t.equal(reader.length, 0x01, 'wrong length'); + t.end(); +}); + + +test('anonymous LDAPv3 bind', function(t) { + var BIND = new Buffer(14); + BIND[0] = 0x30; // Sequence + BIND[1] = 12; // len + BIND[2] = 0x02; // ASN.1 Integer + BIND[3] = 1; // len + BIND[4] = 0x04; // msgid (make up 4) + BIND[5] = 0x60; // Bind Request + BIND[6] = 7; // len + BIND[7] = 0x02; // ASN.1 Integer + BIND[8] = 1; // len + BIND[9] = 0x03; // v3 + BIND[10] = 0x04; // String (bind dn) + BIND[11] = 0; // len + BIND[12] = 0x80; // ContextSpecific (choice) + BIND[13] = 0; // simple bind + + // Start testing ^^ + var ber = new BerReader(BIND); + t.equal(ber.readSequence(), 48, 'Not an ASN.1 Sequence'); + t.equal(ber.length, 12, 'Message length should be 12'); + t.equal(ber.readInt(), 4, 'Message id should have been 4'); + t.equal(ber.readSequence(), 96, 'Bind Request should have been 96'); + t.equal(ber.length, 7, 'Bind length should have been 7'); + t.equal(ber.readInt(), 3, 'LDAP version should have been 3'); + t.equal(ber.readString(), '', 'Bind DN should have been empty'); + t.equal(ber.length, 0, 'string length should have been 0'); + t.equal(ber.readByte(), 0x80, 'Should have been ContextSpecific (choice)'); + t.equal(ber.readByte(), 0, 'Should have been simple bind'); + t.equal(null, ber.readByte(), 'Should be out of data'); + t.end(); +}); + + +test('long string', function(t) { + var buf = new Buffer(256); + var o; + var s = + '2;649;CN=Red Hat CS 71GA Demo,O=Red Hat CS 71GA Demo,C=US;' + + 'CN=RHCS Agent - admin01,UID=admin01,O=redhat,C=US [1] This is ' + + 'Teena Vradmin\'s description.'; + buf[0] = 0x04; + buf[1] = 0x81; + buf[2] = 0x94; + buf.write(s, 3); + var ber = new BerReader(buf.slice(0, 3 + s.length)); + t.equal(ber.readString(), s); + t.end(); +}); diff --git a/appasar/canary/node_modules/asn1/tst/ber/writer.test.js b/appasar/canary/node_modules/asn1/tst/ber/writer.test.js new file mode 100644 index 0000000..d87cb7b --- /dev/null +++ b/appasar/canary/node_modules/asn1/tst/ber/writer.test.js @@ -0,0 +1,370 @@ +// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. + +var test = require('tap').test; +var sys = require('sys'); + +///--- Globals + +var BerWriter; + +var BerReader; + + +///--- Tests + +test('load library', function(t) { + BerWriter = require('../../lib/index').BerWriter; + t.ok(BerWriter); + t.ok(new BerWriter()); + t.end(); +}); + + +test('write byte', function(t) { + var writer = new BerWriter(); + + writer.writeByte(0xC2); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 1, 'Wrong length'); + t.equal(ber[0], 0xC2, 'value wrong'); + + t.end(); +}); + + +test('write 1 byte int', function(t) { + var writer = new BerWriter(); + + writer.writeInt(0x7f); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 3, 'Wrong length for an int: ' + ber.length); + t.equal(ber[0], 0x02, 'ASN.1 tag wrong (2) -> ' + ber[0]); + t.equal(ber[1], 0x01, 'length wrong(1) -> ' + ber[1]); + t.equal(ber[2], 0x7f, 'value wrong(3) -> ' + ber[2]); + + t.end(); +}); + + +test('write 2 byte int', function(t) { + var writer = new BerWriter(); + + writer.writeInt(0x7ffe); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 4, 'Wrong length for an int'); + t.equal(ber[0], 0x02, 'ASN.1 tag wrong'); + t.equal(ber[1], 0x02, 'length wrong'); + t.equal(ber[2], 0x7f, 'value wrong (byte 1)'); + t.equal(ber[3], 0xfe, 'value wrong (byte 2)'); + + t.end(); +}); + + +test('write 3 byte int', function(t) { + var writer = new BerWriter(); + + writer.writeInt(0x7ffffe); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 5, 'Wrong length for an int'); + t.equal(ber[0], 0x02, 'ASN.1 tag wrong'); + t.equal(ber[1], 0x03, 'length wrong'); + t.equal(ber[2], 0x7f, 'value wrong (byte 1)'); + t.equal(ber[3], 0xff, 'value wrong (byte 2)'); + t.equal(ber[4], 0xfe, 'value wrong (byte 3)'); + + t.end(); +}); + + +test('write 4 byte int', function(t) { + var writer = new BerWriter(); + + writer.writeInt(0x7ffffffe); + var ber = writer.buffer; + + t.ok(ber); + + t.equal(ber.length, 6, 'Wrong length for an int'); + t.equal(ber[0], 0x02, 'ASN.1 tag wrong'); + t.equal(ber[1], 0x04, 'length wrong'); + t.equal(ber[2], 0x7f, 'value wrong (byte 1)'); + t.equal(ber[3], 0xff, 'value wrong (byte 2)'); + t.equal(ber[4], 0xff, 'value wrong (byte 3)'); + t.equal(ber[5], 0xfe, 'value wrong (byte 4)'); + + t.end(); +}); + + +test('write 1 byte negative int', function(t) { + var writer = new BerWriter(); + + writer.writeInt(-128); + var ber = writer.buffer; + + t.ok(ber); + + t.equal(ber.length, 3, 'Wrong length for an int'); + t.equal(ber[0], 0x02, 'ASN.1 tag wrong'); + t.equal(ber[1], 0x01, 'length wrong'); + t.equal(ber[2], 0x80, 'value wrong (byte 1)'); + + t.end(); +}); + + +test('write 2 byte negative int', function(t) { + var writer = new BerWriter(); + + writer.writeInt(-22400); + var ber = writer.buffer; + + t.ok(ber); + + t.equal(ber.length, 4, 'Wrong length for an int'); + t.equal(ber[0], 0x02, 'ASN.1 tag wrong'); + t.equal(ber[1], 0x02, 'length wrong'); + t.equal(ber[2], 0xa8, 'value wrong (byte 1)'); + t.equal(ber[3], 0x80, 'value wrong (byte 2)'); + + t.end(); +}); + + +test('write 3 byte negative int', function(t) { + var writer = new BerWriter(); + + writer.writeInt(-481653); + var ber = writer.buffer; + + t.ok(ber); + + t.equal(ber.length, 5, 'Wrong length for an int'); + t.equal(ber[0], 0x02, 'ASN.1 tag wrong'); + t.equal(ber[1], 0x03, 'length wrong'); + t.equal(ber[2], 0xf8, 'value wrong (byte 1)'); + t.equal(ber[3], 0xa6, 'value wrong (byte 2)'); + t.equal(ber[4], 0x8b, 'value wrong (byte 3)'); + + t.end(); +}); + + +test('write 4 byte negative int', function(t) { + var writer = new BerWriter(); + + writer.writeInt(-1522904131); + var ber = writer.buffer; + + t.ok(ber); + + t.equal(ber.length, 6, 'Wrong length for an int'); + t.equal(ber[0], 0x02, 'ASN.1 tag wrong'); + t.equal(ber[1], 0x04, 'length wrong'); + t.equal(ber[2], 0xa5, 'value wrong (byte 1)'); + t.equal(ber[3], 0x3a, 'value wrong (byte 2)'); + t.equal(ber[4], 0x53, 'value wrong (byte 3)'); + t.equal(ber[5], 0xbd, 'value wrong (byte 4)'); + + t.end(); +}); + + +test('write boolean', function(t) { + var writer = new BerWriter(); + + writer.writeBoolean(true); + writer.writeBoolean(false); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 6, 'Wrong length'); + t.equal(ber[0], 0x01, 'tag wrong'); + t.equal(ber[1], 0x01, 'length wrong'); + t.equal(ber[2], 0xff, 'value wrong'); + t.equal(ber[3], 0x01, 'tag wrong'); + t.equal(ber[4], 0x01, 'length wrong'); + t.equal(ber[5], 0x00, 'value wrong'); + + t.end(); +}); + + +test('write string', function(t) { + var writer = new BerWriter(); + writer.writeString('hello world'); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 13, 'wrong length'); + t.equal(ber[0], 0x04, 'wrong tag'); + t.equal(ber[1], 11, 'wrong length'); + t.equal(ber.slice(2).toString('utf8'), 'hello world', 'wrong value'); + + t.end(); +}); + +test('write buffer', function(t) { + var writer = new BerWriter(); + // write some stuff to start with + writer.writeString('hello world'); + var ber = writer.buffer; + var buf = new Buffer([0x04, 0x0b, 0x30, 0x09, 0x02, 0x01, 0x0f, 0x01, 0x01, + 0xff, 0x01, 0x01, 0xff]); + writer.writeBuffer(buf.slice(2, buf.length), 0x04); + ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 26, 'wrong length'); + t.equal(ber[0], 0x04, 'wrong tag'); + t.equal(ber[1], 11, 'wrong length'); + t.equal(ber.slice(2, 13).toString('utf8'), 'hello world', 'wrong value'); + t.equal(ber[13], buf[0], 'wrong tag'); + t.equal(ber[14], buf[1], 'wrong length'); + for (var i = 13, j = 0; i < ber.length && j < buf.length; i++, j++) { + t.equal(ber[i], buf[j], 'buffer contents not identical'); + } + t.end(); +}); + +test('write string array', function(t) { + var writer = new BerWriter(); + writer.writeStringArray(['hello world', 'fubar!']); + var ber = writer.buffer; + + t.ok(ber); + + t.equal(ber.length, 21, 'wrong length'); + t.equal(ber[0], 0x04, 'wrong tag'); + t.equal(ber[1], 11, 'wrong length'); + t.equal(ber.slice(2, 13).toString('utf8'), 'hello world', 'wrong value'); + + t.equal(ber[13], 0x04, 'wrong tag'); + t.equal(ber[14], 6, 'wrong length'); + t.equal(ber.slice(15).toString('utf8'), 'fubar!', 'wrong value'); + + t.end(); +}); + + +test('resize internal buffer', function(t) { + var writer = new BerWriter({size: 2}); + writer.writeString('hello world'); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 13, 'wrong length'); + t.equal(ber[0], 0x04, 'wrong tag'); + t.equal(ber[1], 11, 'wrong length'); + t.equal(ber.slice(2).toString('utf8'), 'hello world', 'wrong value'); + + t.end(); +}); + + +test('sequence', function(t) { + var writer = new BerWriter({size: 25}); + writer.startSequence(); + writer.writeString('hello world'); + writer.endSequence(); + var ber = writer.buffer; + + t.ok(ber); + console.log(ber); + t.equal(ber.length, 15, 'wrong length'); + t.equal(ber[0], 0x30, 'wrong tag'); + t.equal(ber[1], 13, 'wrong length'); + t.equal(ber[2], 0x04, 'wrong tag'); + t.equal(ber[3], 11, 'wrong length'); + t.equal(ber.slice(4).toString('utf8'), 'hello world', 'wrong value'); + + t.end(); +}); + + +test('nested sequence', function(t) { + var writer = new BerWriter({size: 25}); + writer.startSequence(); + writer.writeString('hello world'); + writer.startSequence(); + writer.writeString('hello world'); + writer.endSequence(); + writer.endSequence(); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 30, 'wrong length'); + t.equal(ber[0], 0x30, 'wrong tag'); + t.equal(ber[1], 28, 'wrong length'); + t.equal(ber[2], 0x04, 'wrong tag'); + t.equal(ber[3], 11, 'wrong length'); + t.equal(ber.slice(4, 15).toString('utf8'), 'hello world', 'wrong value'); + t.equal(ber[15], 0x30, 'wrong tag'); + t.equal(ber[16], 13, 'wrong length'); + t.equal(ber[17], 0x04, 'wrong tag'); + t.equal(ber[18], 11, 'wrong length'); + t.equal(ber.slice(19, 30).toString('utf8'), 'hello world', 'wrong value'); + + t.end(); +}); + + +test('LDAP bind message', function(t) { + var dn = 'cn=foo,ou=unit,o=test'; + var writer = new BerWriter(); + writer.startSequence(); + writer.writeInt(3); // msgid = 3 + writer.startSequence(0x60); // ldap bind + writer.writeInt(3); // ldap v3 + writer.writeString(dn); + writer.writeByte(0x80); + writer.writeByte(0x00); + writer.endSequence(); + writer.endSequence(); + var ber = writer.buffer; + + t.ok(ber); + t.equal(ber.length, 35, 'wrong length (buffer)'); + t.equal(ber[0], 0x30, 'wrong tag'); + t.equal(ber[1], 33, 'wrong length'); + t.equal(ber[2], 0x02, 'wrong tag'); + t.equal(ber[3], 1, 'wrong length'); + t.equal(ber[4], 0x03, 'wrong value'); + t.equal(ber[5], 0x60, 'wrong tag'); + t.equal(ber[6], 28, 'wrong length'); + t.equal(ber[7], 0x02, 'wrong tag'); + t.equal(ber[8], 1, 'wrong length'); + t.equal(ber[9], 0x03, 'wrong value'); + t.equal(ber[10], 0x04, 'wrong tag'); + t.equal(ber[11], dn.length, 'wrong length'); + t.equal(ber.slice(12, 33).toString('utf8'), dn, 'wrong value'); + t.equal(ber[33], 0x80, 'wrong tag'); + t.equal(ber[34], 0x00, 'wrong len'); + + t.end(); +}); + + +test('Write OID', function(t) { + var oid = '1.2.840.113549.1.1.1'; + var writer = new BerWriter(); + writer.writeOID(oid); + + var ber = writer.buffer; + t.ok(ber); + console.log(require('util').inspect(ber)); + console.log(require('util').inspect(new Buffer([0x06, 0x09, 0x2a, 0x86, + 0x48, 0x86, 0xf7, 0x0d, + 0x01, 0x01, 0x01]))); + + t.end(); +}); diff --git a/appasar/canary/node_modules/assert-plus/AUTHORS b/appasar/canary/node_modules/assert-plus/AUTHORS new file mode 100644 index 0000000..1923524 --- /dev/null +++ b/appasar/canary/node_modules/assert-plus/AUTHORS @@ -0,0 +1,6 @@ +Dave Eddy <dave@daveeddy.com> +Fred Kuo <fred.kuo@joyent.com> +Lars-Magnus Skog <ralphtheninja@riseup.net> +Mark Cavage <mcavage@gmail.com> +Patrick Mooney <pmooney@pfmooney.com> +Rob Gulewich <robert.gulewich@joyent.com> diff --git a/appasar/canary/node_modules/assert-plus/CHANGES.md b/appasar/canary/node_modules/assert-plus/CHANGES.md new file mode 100644 index 0000000..57d92bf --- /dev/null +++ b/appasar/canary/node_modules/assert-plus/CHANGES.md @@ -0,0 +1,14 @@ +# assert-plus Changelog + +## 1.0.0 + +- *BREAKING* assert.number (and derivatives) now accept Infinity as valid input +- Add assert.finite check. Previous assert.number callers should use this if + they expect Infinity inputs to throw. + +## 0.2.0 + +- Fix `assert.object(null)` so it throws +- Fix optional/arrayOf exports for non-type-of asserts +- Add optiona/arrayOf exports for Stream/Date/Regex/uuid +- Add basic unit test coverage diff --git a/appasar/canary/node_modules/assert-plus/README.md b/appasar/canary/node_modules/assert-plus/README.md new file mode 100644 index 0000000..ec200d1 --- /dev/null +++ b/appasar/canary/node_modules/assert-plus/README.md @@ -0,0 +1,162 @@ +# assert-plus + +This library is a super small wrapper over node's assert module that has two +things: (1) the ability to disable assertions with the environment variable +NODE\_NDEBUG, and (2) some API wrappers for argument testing. Like +`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks +like this: + +```javascript + var assert = require('assert-plus'); + + function fooAccount(options, callback) { + assert.object(options, 'options'); + assert.number(options.id, 'options.id'); + assert.bool(options.isManager, 'options.isManager'); + assert.string(options.name, 'options.name'); + assert.arrayOfString(options.email, 'options.email'); + assert.func(callback, 'callback'); + + // Do stuff + callback(null, {}); + } +``` + +# API + +All methods that *aren't* part of node's core assert API are simply assumed to +take an argument, and then a string 'name' that's not a message; `AssertionError` +will be thrown if the assertion fails with a message like: + + AssertionError: foo (string) is required + at test (/home/mark/work/foo/foo.js:3:9) + at Object.<anonymous> (/home/mark/work/foo/foo.js:15:1) + at Module._compile (module.js:446:26) + at Object..js (module.js:464:10) + at Module.load (module.js:353:31) + at Function._load (module.js:311:12) + at Array.0 (module.js:484:10) + at EventEmitter._tickCallback (node.js:190:38) + +from: + +```javascript + function test(foo) { + assert.string(foo, 'foo'); + } +``` + +There you go. You can check that arrays are of a homogeneous type with `Arrayof$Type`: + +```javascript + function test(foo) { + assert.arrayOfString(foo, 'foo'); + } +``` + +You can assert IFF an argument is not `undefined` (i.e., an optional arg): + +```javascript + assert.optionalString(foo, 'foo'); +``` + +Lastly, you can opt-out of assertion checking altogether by setting the +environment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have +lots of assertions, and don't want to pay `typeof ()` taxes to v8 in +production. Be advised: The standard functions re-exported from `assert` are +also disabled in assert-plus if NDEBUG is specified. Using them directly from +the `assert` module avoids this behavior. + +The complete list of APIs is: + +* assert.array +* assert.bool +* assert.buffer +* assert.func +* assert.number +* assert.finite +* assert.object +* assert.string +* assert.stream +* assert.date +* assert.regexp +* assert.uuid +* assert.arrayOfArray +* assert.arrayOfBool +* assert.arrayOfBuffer +* assert.arrayOfFunc +* assert.arrayOfNumber +* assert.arrayOfFinite +* assert.arrayOfObject +* assert.arrayOfString +* assert.arrayOfStream +* assert.arrayOfDate +* assert.arrayOfRegexp +* assert.arrayOfUuid +* assert.optionalArray +* assert.optionalBool +* assert.optionalBuffer +* assert.optionalFunc +* assert.optionalNumber +* assert.optionalFinite +* assert.optionalObject +* assert.optionalString +* assert.optionalStream +* assert.optionalDate +* assert.optionalRegexp +* assert.optionalUuid +* assert.optionalArrayOfArray +* assert.optionalArrayOfBool +* assert.optionalArrayOfBuffer +* assert.optionalArrayOfFunc +* assert.optionalArrayOfNumber +* assert.optionalArrayOfFinite +* assert.optionalArrayOfObject +* assert.optionalArrayOfString +* assert.optionalArrayOfStream +* assert.optionalArrayOfDate +* assert.optionalArrayOfRegexp +* assert.optionalArrayOfUuid +* assert.AssertionError +* assert.fail +* assert.ok +* assert.equal +* assert.notEqual +* assert.deepEqual +* assert.notDeepEqual +* assert.strictEqual +* assert.notStrictEqual +* assert.throws +* assert.doesNotThrow +* assert.ifError + +# Installation + + npm install assert-plus + +## License + +The MIT License (MIT) +Copyright (c) 2012 Mark Cavage + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +## Bugs + +See <https://github.com/mcavage/node-assert-plus/issues>. diff --git a/appasar/canary/node_modules/assert-plus/assert.js b/appasar/canary/node_modules/assert-plus/assert.js new file mode 100644 index 0000000..26f944e --- /dev/null +++ b/appasar/canary/node_modules/assert-plus/assert.js @@ -0,0 +1,211 @@ +// Copyright (c) 2012, Mark Cavage. All rights reserved. +// Copyright 2015 Joyent, Inc. + +var assert = require('assert'); +var Stream = require('stream').Stream; +var util = require('util'); + + +///--- Globals + +/* JSSTYLED */ +var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/; + + +///--- Internal + +function _capitalize(str) { + return (str.charAt(0).toUpperCase() + str.slice(1)); +} + +function _toss(name, expected, oper, arg, actual) { + throw new assert.AssertionError({ + message: util.format('%s (%s) is required', name, expected), + actual: (actual === undefined) ? typeof (arg) : actual(arg), + expected: expected, + operator: oper || '===', + stackStartFunction: _toss.caller + }); +} + +function _getClass(arg) { + return (Object.prototype.toString.call(arg).slice(8, -1)); +} + +function noop() { + // Why even bother with asserts? +} + + +///--- Exports + +var types = { + bool: { + check: function (arg) { return typeof (arg) === 'boolean'; } + }, + func: { + check: function (arg) { return typeof (arg) === 'function'; } + }, + string: { + check: function (arg) { return typeof (arg) === 'string'; } + }, + object: { + check: function (arg) { + return typeof (arg) === 'object' && arg !== null; + } + }, + number: { + check: function (arg) { + return typeof (arg) === 'number' && !isNaN(arg); + } + }, + finite: { + check: function (arg) { + return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg); + } + }, + buffer: { + check: function (arg) { return Buffer.isBuffer(arg); }, + operator: 'Buffer.isBuffer' + }, + array: { + check: function (arg) { return Array.isArray(arg); }, + operator: 'Array.isArray' + }, + stream: { + check: function (arg) { return arg instanceof Stream; }, + operator: 'instanceof', + actual: _getClass + }, + date: { + check: function (arg) { return arg instanceof Date; }, + operator: 'instanceof', + actual: _getClass + }, + regexp: { + check: function (arg) { return arg instanceof RegExp; }, + operator: 'instanceof', + actual: _getClass + }, + uuid: { + check: function (arg) { + return typeof (arg) === 'string' && UUID_REGEXP.test(arg); + }, + operator: 'isUUID' + } +}; + +function _setExports(ndebug) { + var keys = Object.keys(types); + var out; + + /* re-export standard assert */ + if (process.env.NODE_NDEBUG) { + out = noop; + } else { + out = function (arg, msg) { + if (!arg) { + _toss(msg, 'true', arg); + } + }; + } + + /* standard checks */ + keys.forEach(function (k) { + if (ndebug) { + out[k] = noop; + return; + } + var type = types[k]; + out[k] = function (arg, msg) { + if (!type.check(arg)) { + _toss(msg, k, type.operator, arg, type.actual); + } + }; + }); + + /* optional checks */ + keys.forEach(function (k) { + var name = 'optional' + _capitalize(k); + if (ndebug) { + out[name] = noop; + return; + } + var type = types[k]; + out[name] = function (arg, msg) { + if (arg === undefined || arg === null) { + return; + } + if (!type.check(arg)) { + _toss(msg, k, type.operator, arg, type.actual); + } + }; + }); + + /* arrayOf checks */ + keys.forEach(function (k) { + var name = 'arrayOf' + _capitalize(k); + if (ndebug) { + out[name] = noop; + return; + } + var type = types[k]; + var expected = '[' + k + ']'; + out[name] = function (arg, msg) { + if (!Array.isArray(arg)) { + _toss(msg, expected, type.operator, arg, type.actual); + } + var i; + for (i = 0; i < arg.length; i++) { + if (!type.check(arg[i])) { + _toss(msg, expected, type.operator, arg, type.actual); + } + } + }; + }); + + /* optionalArrayOf checks */ + keys.forEach(function (k) { + var name = 'optionalArrayOf' + _capitalize(k); + if (ndebug) { + out[name] = noop; + return; + } + var type = types[k]; + var expected = '[' + k + ']'; + out[name] = function (arg, msg) { + if (arg === undefined || arg === null) { + return; + } + if (!Array.isArray(arg)) { + _toss(msg, expected, type.operator, arg, type.actual); + } + var i; + for (i = 0; i < arg.length; i++) { + if (!type.check(arg[i])) { + _toss(msg, expected, type.operator, arg, type.actual); + } + } + }; + }); + + /* re-export built-in assertions */ + Object.keys(assert).forEach(function (k) { + if (k === 'AssertionError') { + out[k] = assert[k]; + return; + } + if (ndebug) { + out[k] = noop; + return; + } + out[k] = assert[k]; + }); + + /* export ourselves (for unit tests _only_) */ + out._setExports = _setExports; + + return out; +} + +module.exports = _setExports(process.env.NODE_NDEBUG); diff --git a/appasar/canary/node_modules/assert-plus/package.json b/appasar/canary/node_modules/assert-plus/package.json new file mode 100644 index 0000000..40d6a5c --- /dev/null +++ b/appasar/canary/node_modules/assert-plus/package.json @@ -0,0 +1,23 @@ +{ + "author": "Mark Cavage <mcavage@gmail.com>", + "name": "assert-plus", + "description": "Extra assertions on top of node's assert module", + "version": "1.0.0", + "license": "MIT", + "main": "./assert.js", + "devDependencies": { + "tape": "4.2.2", + "faucet": "0.0.1" + }, + "optionalDependencies": {}, + "scripts": { + "test": "./node_modules/.bin/tape tests/*.js | ./node_modules/.bin/faucet" + }, + "repository": { + "type": "git", + "url": "https://github.com/mcavage/node-assert-plus.git" + }, + "engines": { + "node": ">=0.8" + } +} diff --git a/appasar/canary/node_modules/asynckit/LICENSE b/appasar/canary/node_modules/asynckit/LICENSE new file mode 100644 index 0000000..c9eca5d --- /dev/null +++ b/appasar/canary/node_modules/asynckit/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Alex Indigo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/asynckit/README.md b/appasar/canary/node_modules/asynckit/README.md new file mode 100644 index 0000000..ddcc7e6 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/README.md @@ -0,0 +1,233 @@ +# asynckit [![NPM Module](https://img.shields.io/npm/v/asynckit.svg?style=flat)](https://www.npmjs.com/package/asynckit) + +Minimal async jobs utility library, with streams support. + +[![PhantomJS Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=browser&style=flat)](https://travis-ci.org/alexindigo/asynckit) +[![Linux Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=linux:0.12-6.x&style=flat)](https://travis-ci.org/alexindigo/asynckit) +[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/asynckit/v0.4.0.svg?label=windows:0.12-6.x&style=flat)](https://ci.appveyor.com/project/alexindigo/asynckit) + +[![Coverage Status](https://img.shields.io/coveralls/alexindigo/asynckit/v0.4.0.svg?label=code+coverage&style=flat)](https://coveralls.io/github/alexindigo/asynckit?branch=master) +[![Dependency Status](https://img.shields.io/david/alexindigo/asynckit/v0.4.0.svg?style=flat)](https://david-dm.org/alexindigo/asynckit) +[![bitHound Overall Score](https://www.bithound.io/github/alexindigo/asynckit/badges/score.svg)](https://www.bithound.io/github/alexindigo/asynckit) + +<!-- [![Readme](https://img.shields.io/badge/readme-tested-brightgreen.svg?style=flat)](https://www.npmjs.com/package/reamde) --> + +AsyncKit provides harness for `parallel` and `serial` iterators over list of items represented by arrays or objects. +Optionally it accepts abort function (should be synchronously return by iterator for each item), and terminates left over jobs upon an error event. For specific iteration order built-in (`ascending` and `descending`) and custom sort helpers also supported, via `asynckit.serialOrdered` method. + +It ensures async operations to keep behavior more stable and prevent `Maximum call stack size exceeded` errors, from sync iterators. + +| compression | size | +| :----------------- | -------: | +| asynckit.js | 12.34 kB | +| asynckit.min.js | 4.11 kB | +| asynckit.min.js.gz | 1.47 kB | + + +## Install + +```sh +$ npm install --save asynckit +``` + +## Examples + +### Parallel Jobs + +Runs iterator over provided array in parallel. Stores output in the `result` array, +on the matching positions. In unlikely event of an error from one of the jobs, +will terminate rest of the active jobs (if abort function is provided) +and return error along with salvaged data to the main callback function. + +#### Input Array + +```javascript +var parallel = require('asynckit').parallel + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ] + , target = [] + ; + +parallel(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// async job accepts one element from the array +// and a callback function +function asyncJob(item, cb) +{ + // different delays (in ms) per item + var delay = item * 25; + + // pretend different jobs take different time to finish + // and not in consequential order + var timeoutId = setTimeout(function() { + target.push(item); + cb(null, item * 2); + }, delay); + + // allow to cancel "leftover" jobs upon error + // return function, invoking of which will abort this job + return clearTimeout.bind(null, timeoutId); +} +``` + +More examples could be found in [test/test-parallel-array.js](test/test-parallel-array.js). + +#### Input Object + +Also it supports named jobs, listed via object. + +```javascript +var parallel = require('asynckit/parallel') + , assert = require('assert') + ; + +var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 } + , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 } + , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ] + , expectedKeys = [ 'first', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtyTwo', 'sixtyFour' ] + , target = [] + , keys = [] + ; + +parallel(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); + assert.deepEqual(keys, expectedKeys); +}); + +// supports full value, key, callback (shortcut) interface +function asyncJob(item, key, cb) +{ + // different delays (in ms) per item + var delay = item * 25; + + // pretend different jobs take different time to finish + // and not in consequential order + var timeoutId = setTimeout(function() { + keys.push(key); + target.push(item); + cb(null, item * 2); + }, delay); + + // allow to cancel "leftover" jobs upon error + // return function, invoking of which will abort this job + return clearTimeout.bind(null, timeoutId); +} +``` + +More examples could be found in [test/test-parallel-object.js](test/test-parallel-object.js). + +### Serial Jobs + +Runs iterator over provided array sequentially. Stores output in the `result` array, +on the matching positions. In unlikely event of an error from one of the jobs, +will not proceed to the rest of the items in the list +and return error along with salvaged data to the main callback function. + +#### Input Array + +```javascript +var serial = require('asynckit/serial') + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ] + , target = [] + ; + +serial(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// extended interface (item, key, callback) +// also supported for arrays +function asyncJob(item, key, cb) +{ + target.push(key); + + // it will be automatically made async + // even it iterator "returns" in the same event loop + cb(null, item * 2); +} +``` + +More examples could be found in [test/test-serial-array.js](test/test-serial-array.js). + +#### Input Object + +Also it supports named jobs, listed via object. + +```javascript +var serial = require('asynckit').serial + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ] + , target = [] + ; + +var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 } + , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 } + , expectedTarget = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , target = [] + ; + + +serial(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// shortcut interface (item, callback) +// works for object as well as for the arrays +function asyncJob(item, cb) +{ + target.push(item); + + // it will be automatically made async + // even it iterator "returns" in the same event loop + cb(null, item * 2); +} +``` + +More examples could be found in [test/test-serial-object.js](test/test-serial-object.js). + +_Note: Since _object_ is an _unordered_ collection of properties, +it may produce unexpected results with sequential iterations. +Whenever order of the jobs' execution is important please use `serialOrdered` method._ + +### Ordered Serial Iterations + +TBD + +For example [compare-property](compare-property) package. + +### Streaming interface + +TBD + +## Want to Know More? + +More examples can be found in [test folder](test/). + +Or open an [issue](https://github.com/alexindigo/asynckit/issues) with questions and/or suggestions. + +## License + +AsyncKit is licensed under the MIT license. diff --git a/appasar/canary/node_modules/asynckit/bench.js b/appasar/canary/node_modules/asynckit/bench.js new file mode 100644 index 0000000..c612f1a --- /dev/null +++ b/appasar/canary/node_modules/asynckit/bench.js @@ -0,0 +1,76 @@ +/* eslint no-console: "off" */ + +var asynckit = require('./') + , async = require('async') + , assert = require('assert') + , expected = 0 + ; + +var Benchmark = require('benchmark'); +var suite = new Benchmark.Suite; + +var source = []; +for (var z = 1; z < 100; z++) +{ + source.push(z); + expected += z; +} + +suite +// add tests + +.add('async.map', function(deferred) +{ + var total = 0; + + async.map(source, + function(i, cb) + { + setImmediate(function() + { + total += i; + cb(null, total); + }); + }, + function(err, result) + { + assert.ifError(err); + assert.equal(result[result.length - 1], expected); + deferred.resolve(); + }); +}, {'defer': true}) + + +.add('asynckit.parallel', function(deferred) +{ + var total = 0; + + asynckit.parallel(source, + function(i, cb) + { + setImmediate(function() + { + total += i; + cb(null, total); + }); + }, + function(err, result) + { + assert.ifError(err); + assert.equal(result[result.length - 1], expected); + deferred.resolve(); + }); +}, {'defer': true}) + + +// add listeners +.on('cycle', function(ev) +{ + console.log(String(ev.target)); +}) +.on('complete', function() +{ + console.log('Fastest is ' + this.filter('fastest').map('name')); +}) +// run async +.run({ 'async': true }); diff --git a/appasar/canary/node_modules/asynckit/index.js b/appasar/canary/node_modules/asynckit/index.js new file mode 100644 index 0000000..455f945 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/index.js @@ -0,0 +1,6 @@ +module.exports = +{ + parallel : require('./parallel.js'), + serial : require('./serial.js'), + serialOrdered : require('./serialOrdered.js') +}; diff --git a/appasar/canary/node_modules/asynckit/lib/abort.js b/appasar/canary/node_modules/asynckit/lib/abort.js new file mode 100644 index 0000000..114367e --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/abort.js @@ -0,0 +1,29 @@ +// API +module.exports = abort; + +/** + * Aborts leftover active jobs + * + * @param {object} state - current state object + */ +function abort(state) +{ + Object.keys(state.jobs).forEach(clean.bind(state)); + + // reset leftover jobs + state.jobs = {}; +} + +/** + * Cleans up leftover job by invoking abort function for the provided job id + * + * @this state + * @param {string|number} key - job id to abort + */ +function clean(key) +{ + if (typeof this.jobs[key] == 'function') + { + this.jobs[key](); + } +} diff --git a/appasar/canary/node_modules/asynckit/lib/async.js b/appasar/canary/node_modules/asynckit/lib/async.js new file mode 100644 index 0000000..7f1288a --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/async.js @@ -0,0 +1,34 @@ +var defer = require('./defer.js'); + +// API +module.exports = async; + +/** + * Runs provided callback asynchronously + * even if callback itself is not + * + * @param {function} callback - callback to invoke + * @returns {function} - augmented callback + */ +function async(callback) +{ + var isAsync = false; + + // check if async happened + defer(function() { isAsync = true; }); + + return function async_callback(err, result) + { + if (isAsync) + { + callback(err, result); + } + else + { + defer(function nextTick_callback() + { + callback(err, result); + }); + } + }; +} diff --git a/appasar/canary/node_modules/asynckit/lib/defer.js b/appasar/canary/node_modules/asynckit/lib/defer.js new file mode 100644 index 0000000..b67110c --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/defer.js @@ -0,0 +1,26 @@ +module.exports = defer; + +/** + * Runs provided function on next iteration of the event loop + * + * @param {function} fn - function to run + */ +function defer(fn) +{ + var nextTick = typeof setImmediate == 'function' + ? setImmediate + : ( + typeof process == 'object' && typeof process.nextTick == 'function' + ? process.nextTick + : null + ); + + if (nextTick) + { + nextTick(fn); + } + else + { + setTimeout(fn, 0); + } +} diff --git a/appasar/canary/node_modules/asynckit/lib/iterate.js b/appasar/canary/node_modules/asynckit/lib/iterate.js new file mode 100644 index 0000000..5d2839a --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/iterate.js @@ -0,0 +1,75 @@ +var async = require('./async.js') + , abort = require('./abort.js') + ; + +// API +module.exports = iterate; + +/** + * Iterates over each job object + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {object} state - current job status + * @param {function} callback - invoked when all elements processed + */ +function iterate(list, iterator, state, callback) +{ + // store current index + var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; + + state.jobs[key] = runJob(iterator, key, list[key], function(error, output) + { + // don't repeat yourself + // skip secondary callbacks + if (!(key in state.jobs)) + { + return; + } + + // clean up jobs + delete state.jobs[key]; + + if (error) + { + // don't process rest of the results + // stop still active jobs + // and reset the list + abort(state); + } + else + { + state.results[key] = output; + } + + // return salvaged results + callback(error, state.results); + }); +} + +/** + * Runs iterator over provided job element + * + * @param {function} iterator - iterator to invoke + * @param {string|number} key - key/index of the element in the list of jobs + * @param {mixed} item - job description + * @param {function} callback - invoked after iterator is done with the job + * @returns {function|mixed} - job abort function or something else + */ +function runJob(iterator, key, item, callback) +{ + var aborter; + + // allow shortcut if iterator expects only two arguments + if (iterator.length == 2) + { + aborter = iterator(item, async(callback)); + } + // otherwise go with full three arguments + else + { + aborter = iterator(item, key, async(callback)); + } + + return aborter; +} diff --git a/appasar/canary/node_modules/asynckit/lib/readable_asynckit.js b/appasar/canary/node_modules/asynckit/lib/readable_asynckit.js new file mode 100644 index 0000000..78ad240 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/readable_asynckit.js @@ -0,0 +1,91 @@ +var streamify = require('./streamify.js') + , defer = require('./defer.js') + ; + +// API +module.exports = ReadableAsyncKit; + +/** + * Base constructor for all streams + * used to hold properties/methods + */ +function ReadableAsyncKit() +{ + ReadableAsyncKit.super_.apply(this, arguments); + + // list of active jobs + this.jobs = {}; + + // add stream methods + this.destroy = destroy; + this._start = _start; + this._read = _read; +} + +/** + * Destroys readable stream, + * by aborting outstanding jobs + * + * @returns {void} + */ +function destroy() +{ + if (this.destroyed) + { + return; + } + + this.destroyed = true; + + if (typeof this.terminator == 'function') + { + this.terminator(); + } +} + +/** + * Starts provided jobs in async manner + * + * @private + */ +function _start() +{ + // first argument – runner function + var runner = arguments[0] + // take away first argument + , args = Array.prototype.slice.call(arguments, 1) + // second argument - input data + , input = args[0] + // last argument - result callback + , endCb = streamify.callback.call(this, args[args.length - 1]) + ; + + args[args.length - 1] = endCb; + // third argument - iterator + args[1] = streamify.iterator.call(this, args[1]); + + // allow time for proper setup + defer(function() + { + if (!this.destroyed) + { + this.terminator = runner.apply(null, args); + } + else + { + endCb(null, Array.isArray(input) ? [] : {}); + } + }.bind(this)); +} + + +/** + * Implement _read to comply with Readable streams + * Doesn't really make sense for flowing object mode + * + * @private + */ +function _read() +{ + +} diff --git a/appasar/canary/node_modules/asynckit/lib/readable_parallel.js b/appasar/canary/node_modules/asynckit/lib/readable_parallel.js new file mode 100644 index 0000000..5d2929f --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/readable_parallel.js @@ -0,0 +1,25 @@ +var parallel = require('../parallel.js'); + +// API +module.exports = ReadableParallel; + +/** + * Streaming wrapper to `asynckit.parallel` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableParallel(list, iterator, callback) +{ + if (!(this instanceof ReadableParallel)) + { + return new ReadableParallel(list, iterator, callback); + } + + // turn on object mode + ReadableParallel.super_.call(this, {objectMode: true}); + + this._start(parallel, list, iterator, callback); +} diff --git a/appasar/canary/node_modules/asynckit/lib/readable_serial.js b/appasar/canary/node_modules/asynckit/lib/readable_serial.js new file mode 100644 index 0000000..7822698 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/readable_serial.js @@ -0,0 +1,25 @@ +var serial = require('../serial.js'); + +// API +module.exports = ReadableSerial; + +/** + * Streaming wrapper to `asynckit.serial` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableSerial(list, iterator, callback) +{ + if (!(this instanceof ReadableSerial)) + { + return new ReadableSerial(list, iterator, callback); + } + + // turn on object mode + ReadableSerial.super_.call(this, {objectMode: true}); + + this._start(serial, list, iterator, callback); +} diff --git a/appasar/canary/node_modules/asynckit/lib/readable_serial_ordered.js b/appasar/canary/node_modules/asynckit/lib/readable_serial_ordered.js new file mode 100644 index 0000000..3de89c4 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/readable_serial_ordered.js @@ -0,0 +1,29 @@ +var serialOrdered = require('../serialOrdered.js'); + +// API +module.exports = ReadableSerialOrdered; +// expose sort helpers +module.exports.ascending = serialOrdered.ascending; +module.exports.descending = serialOrdered.descending; + +/** + * Streaming wrapper to `asynckit.serialOrdered` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableSerialOrdered(list, iterator, sortMethod, callback) +{ + if (!(this instanceof ReadableSerialOrdered)) + { + return new ReadableSerialOrdered(list, iterator, sortMethod, callback); + } + + // turn on object mode + ReadableSerialOrdered.super_.call(this, {objectMode: true}); + + this._start(serialOrdered, list, iterator, sortMethod, callback); +} diff --git a/appasar/canary/node_modules/asynckit/lib/state.js b/appasar/canary/node_modules/asynckit/lib/state.js new file mode 100644 index 0000000..cbea7ad --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/state.js @@ -0,0 +1,37 @@ +// API +module.exports = state; + +/** + * Creates initial state object + * for iteration over list + * + * @param {array|object} list - list to iterate over + * @param {function|null} sortMethod - function to use for keys sort, + * or `null` to keep them as is + * @returns {object} - initial state object + */ +function state(list, sortMethod) +{ + var isNamedList = !Array.isArray(list) + , initState = + { + index : 0, + keyedList: isNamedList || sortMethod ? Object.keys(list) : null, + jobs : {}, + results : isNamedList ? {} : [], + size : isNamedList ? Object.keys(list).length : list.length + } + ; + + if (sortMethod) + { + // sort array keys based on it's values + // sort object's keys just on own merit + initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) + { + return sortMethod(list[a], list[b]); + }); + } + + return initState; +} diff --git a/appasar/canary/node_modules/asynckit/lib/streamify.js b/appasar/canary/node_modules/asynckit/lib/streamify.js new file mode 100644 index 0000000..f56a1c9 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/streamify.js @@ -0,0 +1,141 @@ +var async = require('./async.js'); + +// API +module.exports = { + iterator: wrapIterator, + callback: wrapCallback +}; + +/** + * Wraps iterators with long signature + * + * @this ReadableAsyncKit# + * @param {function} iterator - function to wrap + * @returns {function} - wrapped function + */ +function wrapIterator(iterator) +{ + var stream = this; + + return function(item, key, cb) + { + var aborter + , wrappedCb = async(wrapIteratorCallback.call(stream, cb, key)) + ; + + stream.jobs[key] = wrappedCb; + + // it's either shortcut (item, cb) + if (iterator.length == 2) + { + aborter = iterator(item, wrappedCb); + } + // or long format (item, key, cb) + else + { + aborter = iterator(item, key, wrappedCb); + } + + return aborter; + }; +} + +/** + * Wraps provided callback function + * allowing to execute snitch function before + * real callback + * + * @this ReadableAsyncKit# + * @param {function} callback - function to wrap + * @returns {function} - wrapped function + */ +function wrapCallback(callback) +{ + var stream = this; + + var wrapped = function(error, result) + { + return finisher.call(stream, error, result, callback); + }; + + return wrapped; +} + +/** + * Wraps provided iterator callback function + * makes sure snitch only called once, + * but passes secondary calls to the original callback + * + * @this ReadableAsyncKit# + * @param {function} callback - callback to wrap + * @param {number|string} key - iteration key + * @returns {function} wrapped callback + */ +function wrapIteratorCallback(callback, key) +{ + var stream = this; + + return function(error, output) + { + // don't repeat yourself + if (!(key in stream.jobs)) + { + callback(error, output); + return; + } + + // clean up jobs + delete stream.jobs[key]; + + return streamer.call(stream, error, {key: key, value: output}, callback); + }; +} + +/** + * Stream wrapper for iterator callback + * + * @this ReadableAsyncKit# + * @param {mixed} error - error response + * @param {mixed} output - iterator output + * @param {function} callback - callback that expects iterator results + */ +function streamer(error, output, callback) +{ + if (error && !this.error) + { + this.error = error; + this.pause(); + this.emit('error', error); + // send back value only, as expected + callback(error, output && output.value); + return; + } + + // stream stuff + this.push(output); + + // back to original track + // send back value only, as expected + callback(error, output && output.value); +} + +/** + * Stream wrapper for finishing callback + * + * @this ReadableAsyncKit# + * @param {mixed} error - error response + * @param {mixed} output - iterator output + * @param {function} callback - callback that expects final results + */ +function finisher(error, output, callback) +{ + // signal end of the stream + // only for successfully finished streams + if (!error) + { + this.push(null); + } + + // back to original track + callback(error, output); +} diff --git a/appasar/canary/node_modules/asynckit/lib/terminator.js b/appasar/canary/node_modules/asynckit/lib/terminator.js new file mode 100644 index 0000000..d6eb992 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/lib/terminator.js @@ -0,0 +1,29 @@ +var abort = require('./abort.js') + , async = require('./async.js') + ; + +// API +module.exports = terminator; + +/** + * Terminates jobs in the attached state context + * + * @this AsyncKitState# + * @param {function} callback - final callback to invoke after termination + */ +function terminator(callback) +{ + if (!Object.keys(this.jobs).length) + { + return; + } + + // fast forward iteration index + this.index = this.size; + + // abort jobs + abort(this); + + // send back results we have so far + async(callback)(null, this.results); +} diff --git a/appasar/canary/node_modules/asynckit/package.json b/appasar/canary/node_modules/asynckit/package.json new file mode 100644 index 0000000..51147d6 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/package.json @@ -0,0 +1,63 @@ +{ + "name": "asynckit", + "version": "0.4.0", + "description": "Minimal async jobs utility library, with streams support", + "main": "index.js", + "scripts": { + "clean": "rimraf coverage", + "lint": "eslint *.js lib/*.js test/*.js", + "test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec", + "win-test": "tape test/test-*.js", + "browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec", + "report": "istanbul report", + "size": "browserify index.js | size-table asynckit", + "debug": "tape test/test-*.js" + }, + "pre-commit": [ + "clean", + "lint", + "test", + "browser", + "report", + "size" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/alexindigo/asynckit.git" + }, + "keywords": [ + "async", + "jobs", + "parallel", + "serial", + "iterator", + "array", + "object", + "stream", + "destroy", + "terminate", + "abort" + ], + "author": "Alex Indigo <iam@alexindigo.com>", + "license": "MIT", + "bugs": { + "url": "https://github.com/alexindigo/asynckit/issues" + }, + "homepage": "https://github.com/alexindigo/asynckit#readme", + "devDependencies": { + "browserify": "^13.0.0", + "browserify-istanbul": "^2.0.0", + "coveralls": "^2.11.9", + "eslint": "^2.9.0", + "istanbul": "^0.4.3", + "obake": "^0.1.2", + "phantomjs-prebuilt": "^2.1.7", + "pre-commit": "^1.1.3", + "reamde": "^1.1.0", + "rimraf": "^2.5.2", + "size-table": "^0.2.0", + "tap-spec": "^4.1.1", + "tape": "^4.5.1" + }, + "dependencies": {} +} diff --git a/appasar/canary/node_modules/asynckit/parallel.js b/appasar/canary/node_modules/asynckit/parallel.js new file mode 100644 index 0000000..3c50344 --- /dev/null +++ b/appasar/canary/node_modules/asynckit/parallel.js @@ -0,0 +1,43 @@ +var iterate = require('./lib/iterate.js') + , initState = require('./lib/state.js') + , terminator = require('./lib/terminator.js') + ; + +// Public API +module.exports = parallel; + +/** + * Runs iterator over provided array elements in parallel + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function parallel(list, iterator, callback) +{ + var state = initState(list); + + while (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, function(error, result) + { + if (error) + { + callback(error, result); + return; + } + + // looks like it's the last one + if (Object.keys(state.jobs).length === 0) + { + callback(null, state.results); + return; + } + }); + + state.index++; + } + + return terminator.bind(state, callback); +} diff --git a/appasar/canary/node_modules/asynckit/serial.js b/appasar/canary/node_modules/asynckit/serial.js new file mode 100644 index 0000000..6cd949a --- /dev/null +++ b/appasar/canary/node_modules/asynckit/serial.js @@ -0,0 +1,17 @@ +var serialOrdered = require('./serialOrdered.js'); + +// Public API +module.exports = serial; + +/** + * Runs iterator over provided array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serial(list, iterator, callback) +{ + return serialOrdered(list, iterator, null, callback); +} diff --git a/appasar/canary/node_modules/asynckit/serialOrdered.js b/appasar/canary/node_modules/asynckit/serialOrdered.js new file mode 100644 index 0000000..607eafe --- /dev/null +++ b/appasar/canary/node_modules/asynckit/serialOrdered.js @@ -0,0 +1,75 @@ +var iterate = require('./lib/iterate.js') + , initState = require('./lib/state.js') + , terminator = require('./lib/terminator.js') + ; + +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; + +/** + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); + + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; + } + + state.index++; + + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; + } + + // done here + callback(null, state.results); + }); + + return terminator.bind(state, callback); +} + +/* + * -- Sort methods + */ + +/** + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} + +/** + * sort helper to sort array elements in descending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function descending(a, b) +{ + return -1 * ascending(a, b); +} diff --git a/appasar/canary/node_modules/asynckit/stream.js b/appasar/canary/node_modules/asynckit/stream.js new file mode 100644 index 0000000..d43465f --- /dev/null +++ b/appasar/canary/node_modules/asynckit/stream.js @@ -0,0 +1,21 @@ +var inherits = require('util').inherits + , Readable = require('stream').Readable + , ReadableAsyncKit = require('./lib/readable_asynckit.js') + , ReadableParallel = require('./lib/readable_parallel.js') + , ReadableSerial = require('./lib/readable_serial.js') + , ReadableSerialOrdered = require('./lib/readable_serial_ordered.js') + ; + +// API +module.exports = +{ + parallel : ReadableParallel, + serial : ReadableSerial, + serialOrdered : ReadableSerialOrdered, +}; + +inherits(ReadableAsyncKit, Readable); + +inherits(ReadableParallel, ReadableAsyncKit); +inherits(ReadableSerial, ReadableAsyncKit); +inherits(ReadableSerialOrdered, ReadableAsyncKit); diff --git a/appasar/canary/node_modules/aws-sign2/LICENSE b/appasar/canary/node_modules/aws-sign2/LICENSE new file mode 100644 index 0000000..a4a9aee --- /dev/null +++ b/appasar/canary/node_modules/aws-sign2/LICENSE @@ -0,0 +1,55 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/appasar/canary/node_modules/aws-sign2/README.md b/appasar/canary/node_modules/aws-sign2/README.md new file mode 100644 index 0000000..763564e --- /dev/null +++ b/appasar/canary/node_modules/aws-sign2/README.md @@ -0,0 +1,4 @@ +aws-sign +======== + +AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module. diff --git a/appasar/canary/node_modules/aws-sign2/index.js b/appasar/canary/node_modules/aws-sign2/index.js new file mode 100644 index 0000000..fb35f6d --- /dev/null +++ b/appasar/canary/node_modules/aws-sign2/index.js @@ -0,0 +1,212 @@ + +/*! + * Copyright 2010 LearnBoost <dev@learnboost.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Module dependencies. + */ + +var crypto = require('crypto') + , parse = require('url').parse + ; + +/** + * Valid keys. + */ + +var keys = + [ 'acl' + , 'location' + , 'logging' + , 'notification' + , 'partNumber' + , 'policy' + , 'requestPayment' + , 'torrent' + , 'uploadId' + , 'uploads' + , 'versionId' + , 'versioning' + , 'versions' + , 'website' + ] + +/** + * Return an "Authorization" header value with the given `options` + * in the form of "AWS <key>:<signature>" + * + * @param {Object} options + * @return {String} + * @api private + */ + +function authorization (options) { + return 'AWS ' + options.key + ':' + sign(options) +} + +module.exports = authorization +module.exports.authorization = authorization + +/** + * Simple HMAC-SHA1 Wrapper + * + * @param {Object} options + * @return {String} + * @api private + */ + +function hmacSha1 (options) { + return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64') +} + +module.exports.hmacSha1 = hmacSha1 + +/** + * Create a base64 sha1 HMAC for `options`. + * + * @param {Object} options + * @return {String} + * @api private + */ + +function sign (options) { + options.message = stringToSign(options) + return hmacSha1(options) +} +module.exports.sign = sign + +/** + * Create a base64 sha1 HMAC for `options`. + * + * Specifically to be used with S3 presigned URLs + * + * @param {Object} options + * @return {String} + * @api private + */ + +function signQuery (options) { + options.message = queryStringToSign(options) + return hmacSha1(options) +} +module.exports.signQuery= signQuery + +/** + * Return a string for sign() with the given `options`. + * + * Spec: + * + * <verb>\n + * <md5>\n + * <content-type>\n + * <date>\n + * [headers\n] + * <resource> + * + * @param {Object} options + * @return {String} + * @api private + */ + +function stringToSign (options) { + var headers = options.amazonHeaders || '' + if (headers) headers += '\n' + var r = + [ options.verb + , options.md5 + , options.contentType + , options.date ? options.date.toUTCString() : '' + , headers + options.resource + ] + return r.join('\n') +} +module.exports.stringToSign = stringToSign + +/** + * Return a string for sign() with the given `options`, but is meant exclusively + * for S3 presigned URLs + * + * Spec: + * + * <date>\n + * <resource> + * + * @param {Object} options + * @return {String} + * @api private + */ + +function queryStringToSign (options){ + return 'GET\n\n\n' + options.date + '\n' + options.resource +} +module.exports.queryStringToSign = queryStringToSign + +/** + * Perform the following: + * + * - ignore non-amazon headers + * - lowercase fields + * - sort lexicographically + * - trim whitespace between ":" + * - join with newline + * + * @param {Object} headers + * @return {String} + * @api private + */ + +function canonicalizeHeaders (headers) { + var buf = [] + , fields = Object.keys(headers) + ; + for (var i = 0, len = fields.length; i < len; ++i) { + var field = fields[i] + , val = headers[field] + , field = field.toLowerCase() + ; + if (0 !== field.indexOf('x-amz')) continue + buf.push(field + ':' + val) + } + return buf.sort().join('\n') +} +module.exports.canonicalizeHeaders = canonicalizeHeaders + +/** + * Perform the following: + * + * - ignore non sub-resources + * - sort lexicographically + * + * @param {String} resource + * @return {String} + * @api private + */ + +function canonicalizeResource (resource) { + var url = parse(resource, true) + , path = url.pathname + , buf = [] + ; + + Object.keys(url.query).forEach(function(key){ + if (!~keys.indexOf(key)) return + var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key]) + buf.push(key + val) + }) + + return path + (buf.length ? '?' + buf.sort().join('&') : '') +} +module.exports.canonicalizeResource = canonicalizeResource diff --git a/appasar/canary/node_modules/aws-sign2/package.json b/appasar/canary/node_modules/aws-sign2/package.json new file mode 100644 index 0000000..4c3d57e --- /dev/null +++ b/appasar/canary/node_modules/aws-sign2/package.json @@ -0,0 +1,17 @@ +{ + "author": "Mikeal Rogers <mikeal.rogers@gmail.com> (http://www.futurealoof.com)", + "name": "aws-sign2", + "description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.", + "version": "0.7.0", + "repository": { + "url": "https://github.com/mikeal/aws-sign" + }, + "license": "Apache-2.0", + "main": "index.js", + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + } +} diff --git a/appasar/canary/node_modules/aws4/.npmignore b/appasar/canary/node_modules/aws4/.npmignore new file mode 100644 index 0000000..6c6ade6 --- /dev/null +++ b/appasar/canary/node_modules/aws4/.npmignore @@ -0,0 +1,4 @@ +test +examples +example.js +browser diff --git a/appasar/canary/node_modules/aws4/.tern-port b/appasar/canary/node_modules/aws4/.tern-port new file mode 100644 index 0000000..7fd1b52 --- /dev/null +++ b/appasar/canary/node_modules/aws4/.tern-port @@ -0,0 +1 @@ +62638 \ No newline at end of file diff --git a/appasar/canary/node_modules/aws4/.travis.yml b/appasar/canary/node_modules/aws4/.travis.yml new file mode 100644 index 0000000..61d0634 --- /dev/null +++ b/appasar/canary/node_modules/aws4/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "0.10" + - "0.12" + - "4.2" diff --git a/appasar/canary/node_modules/aws4/LICENSE b/appasar/canary/node_modules/aws4/LICENSE new file mode 100644 index 0000000..4f321e5 --- /dev/null +++ b/appasar/canary/node_modules/aws4/LICENSE @@ -0,0 +1,19 @@ +Copyright 2013 Michael Hart (michael.hart.au@gmail.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/aws4/README.md b/appasar/canary/node_modules/aws4/README.md new file mode 100644 index 0000000..6b002d0 --- /dev/null +++ b/appasar/canary/node_modules/aws4/README.md @@ -0,0 +1,523 @@ +aws4 +---- + +[![Build Status](https://secure.travis-ci.org/mhart/aws4.png?branch=master)](http://travis-ci.org/mhart/aws4) + +A small utility to sign vanilla node.js http(s) request options using Amazon's +[AWS Signature Version 4](http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html). + +Can also be used [in the browser](./browser). + +This signature is supported by nearly all Amazon services, including +[S3](http://docs.aws.amazon.com/AmazonS3/latest/API/), +[EC2](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/), +[DynamoDB](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/API.html), +[Kinesis](http://docs.aws.amazon.com/kinesis/latest/APIReference/), +[Lambda](http://docs.aws.amazon.com/lambda/latest/dg/API_Reference.html), +[SQS](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/), +[SNS](http://docs.aws.amazon.com/sns/latest/api/), +[IAM](http://docs.aws.amazon.com/IAM/latest/APIReference/), +[STS](http://docs.aws.amazon.com/STS/latest/APIReference/), +[RDS](http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/), +[CloudWatch](http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/), +[CloudWatch Logs](http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/), +[CodeDeploy](http://docs.aws.amazon.com/codedeploy/latest/APIReference/), +[CloudFront](http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/), +[CloudTrail](http://docs.aws.amazon.com/awscloudtrail/latest/APIReference/), +[ElastiCache](http://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/), +[EMR](http://docs.aws.amazon.com/ElasticMapReduce/latest/API/), +[Glacier](http://docs.aws.amazon.com/amazonglacier/latest/dev/amazon-glacier-api.html), +[CloudSearch](http://docs.aws.amazon.com/cloudsearch/latest/developerguide/APIReq.html), +[Elastic Load Balancing](http://docs.aws.amazon.com/ElasticLoadBalancing/latest/APIReference/), +[Elastic Transcoder](http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/api-reference.html), +[CloudFormation](http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/), +[Elastic Beanstalk](http://docs.aws.amazon.com/elasticbeanstalk/latest/api/), +[Storage Gateway](http://docs.aws.amazon.com/storagegateway/latest/userguide/AWSStorageGatewayAPI.html), +[Data Pipeline](http://docs.aws.amazon.com/datapipeline/latest/APIReference/), +[Direct Connect](http://docs.aws.amazon.com/directconnect/latest/APIReference/), +[Redshift](http://docs.aws.amazon.com/redshift/latest/APIReference/), +[OpsWorks](http://docs.aws.amazon.com/opsworks/latest/APIReference/), +[SES](http://docs.aws.amazon.com/ses/latest/APIReference/), +[SWF](http://docs.aws.amazon.com/amazonswf/latest/apireference/), +[AutoScaling](http://docs.aws.amazon.com/AutoScaling/latest/APIReference/), +[Mobile Analytics](http://docs.aws.amazon.com/mobileanalytics/latest/ug/server-reference.html), +[Cognito Identity](http://docs.aws.amazon.com/cognitoidentity/latest/APIReference/), +[Cognito Sync](http://docs.aws.amazon.com/cognitosync/latest/APIReference/), +[Container Service](http://docs.aws.amazon.com/AmazonECS/latest/APIReference/), +[AppStream](http://docs.aws.amazon.com/appstream/latest/developerguide/appstream-api-rest.html), +[Key Management Service](http://docs.aws.amazon.com/kms/latest/APIReference/), +[Config](http://docs.aws.amazon.com/config/latest/APIReference/), +[CloudHSM](http://docs.aws.amazon.com/cloudhsm/latest/dg/api-ref.html), +[Route53](http://docs.aws.amazon.com/Route53/latest/APIReference/requests-rest.html) and +[Route53 Domains](http://docs.aws.amazon.com/Route53/latest/APIReference/requests-rpc.html). + +Indeed, the only AWS services that *don't* support v4 as of 2014-12-30 are +[Import/Export](http://docs.aws.amazon.com/AWSImportExport/latest/DG/api-reference.html) and +[SimpleDB](http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/SDB_API.html) +(they only support [AWS Signature Version 2](https://github.com/mhart/aws2)). + +It also provides defaults for a number of core AWS headers and +request parameters, making it very easy to query AWS services, or +build out a fully-featured AWS library. + +Example +------- + +```javascript +var http = require('http'), + https = require('https'), + aws4 = require('aws4') + +// given an options object you could pass to http.request +var opts = {host: 'sqs.us-east-1.amazonaws.com', path: '/?Action=ListQueues'} + +// alternatively (as aws4 can infer the host): +opts = {service: 'sqs', region: 'us-east-1', path: '/?Action=ListQueues'} + +// alternatively (as us-east-1 is default): +opts = {service: 'sqs', path: '/?Action=ListQueues'} + +aws4.sign(opts) // assumes AWS credentials are available in process.env + +console.log(opts) +/* +{ + host: 'sqs.us-east-1.amazonaws.com', + path: '/?Action=ListQueues', + headers: { + Host: 'sqs.us-east-1.amazonaws.com', + 'X-Amz-Date': '20121226T061030Z', + Authorization: 'AWS4-HMAC-SHA256 Credential=ABCDEF/20121226/us-east-1/sqs/aws4_request, ...' + } +} +*/ + +// we can now use this to query AWS using the standard node.js http API +http.request(opts, function(res) { res.pipe(process.stdout) }).end() +/* +<?xml version="1.0"?> +<ListQueuesResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"> +... +*/ +``` + +More options +------------ + +```javascript +// you can also pass AWS credentials in explicitly (otherwise taken from process.env) +aws4.sign(opts, {accessKeyId: '', secretAccessKey: ''}) + +// can also add the signature to query strings +aws4.sign({service: 's3', path: '/my-bucket?X-Amz-Expires=12345', signQuery: true}) + +// create a utility function to pipe to stdout (with https this time) +function request(o) { https.request(o, function(res) { res.pipe(process.stdout) }).end(o.body || '') } + +// aws4 can infer the HTTP method if a body is passed in +// method will be POST and Content-Type: 'application/x-www-form-urlencoded; charset=utf-8' +request(aws4.sign({service: 'iam', body: 'Action=ListGroups&Version=2010-05-08'})) +/* +<ListGroupsResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/"> +... +*/ + +// can specify any custom option or header as per usual +request(aws4.sign({ + service: 'dynamodb', + region: 'ap-southeast-2', + method: 'POST', + path: '/', + headers: { + 'Content-Type': 'application/x-amz-json-1.0', + 'X-Amz-Target': 'DynamoDB_20120810.ListTables' + }, + body: '{}' +})) +/* +{"TableNames":[]} +... +*/ + +// works with all other services that support Signature Version 4 + +request(aws4.sign({service: 's3', path: '/', signQuery: true})) +/* +<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> +... +*/ + +request(aws4.sign({service: 'ec2', path: '/?Action=DescribeRegions&Version=2014-06-15'})) +/* +<DescribeRegionsResponse xmlns="http://ec2.amazonaws.com/doc/2014-06-15/"> +... +*/ + +request(aws4.sign({service: 'sns', path: '/?Action=ListTopics&Version=2010-03-31'})) +/* +<ListTopicsResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> +... +*/ + +request(aws4.sign({service: 'sts', path: '/?Action=GetSessionToken&Version=2011-06-15'})) +/* +<GetSessionTokenResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/"> +... +*/ + +request(aws4.sign({service: 'cloudsearch', path: '/?Action=ListDomainNames&Version=2013-01-01'})) +/* +<ListDomainNamesResponse xmlns="http://cloudsearch.amazonaws.com/doc/2013-01-01/"> +... +*/ + +request(aws4.sign({service: 'ses', path: '/?Action=ListIdentities&Version=2010-12-01'})) +/* +<ListIdentitiesResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> +... +*/ + +request(aws4.sign({service: 'autoscaling', path: '/?Action=DescribeAutoScalingInstances&Version=2011-01-01'})) +/* +<DescribeAutoScalingInstancesResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/"> +... +*/ + +request(aws4.sign({service: 'elasticloadbalancing', path: '/?Action=DescribeLoadBalancers&Version=2012-06-01'})) +/* +<DescribeLoadBalancersResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/"> +... +*/ + +request(aws4.sign({service: 'cloudformation', path: '/?Action=ListStacks&Version=2010-05-15'})) +/* +<ListStacksResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/"> +... +*/ + +request(aws4.sign({service: 'elasticbeanstalk', path: '/?Action=ListAvailableSolutionStacks&Version=2010-12-01'})) +/* +<ListAvailableSolutionStacksResponse xmlns="http://elasticbeanstalk.amazonaws.com/docs/2010-12-01/"> +... +*/ + +request(aws4.sign({service: 'rds', path: '/?Action=DescribeDBInstances&Version=2012-09-17'})) +/* +<DescribeDBInstancesResponse xmlns="http://rds.amazonaws.com/doc/2012-09-17/"> +... +*/ + +request(aws4.sign({service: 'monitoring', path: '/?Action=ListMetrics&Version=2010-08-01'})) +/* +<ListMetricsResponse xmlns="http://monitoring.amazonaws.com/doc/2010-08-01/"> +... +*/ + +request(aws4.sign({service: 'redshift', path: '/?Action=DescribeClusters&Version=2012-12-01'})) +/* +<DescribeClustersResponse xmlns="http://redshift.amazonaws.com/doc/2012-12-01/"> +... +*/ + +request(aws4.sign({service: 'cloudfront', path: '/2014-05-31/distribution'})) +/* +<DistributionList xmlns="http://cloudfront.amazonaws.com/doc/2014-05-31/"> +... +*/ + +request(aws4.sign({service: 'elasticache', path: '/?Action=DescribeCacheClusters&Version=2014-07-15'})) +/* +<DescribeCacheClustersResponse xmlns="http://elasticache.amazonaws.com/doc/2014-07-15/"> +... +*/ + +request(aws4.sign({service: 'elasticmapreduce', path: '/?Action=DescribeJobFlows&Version=2009-03-31'})) +/* +<DescribeJobFlowsResponse xmlns="http://elasticmapreduce.amazonaws.com/doc/2009-03-31"> +... +*/ + +request(aws4.sign({service: 'route53', path: '/2013-04-01/hostedzone'})) +/* +<ListHostedZonesResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> +... +*/ + +request(aws4.sign({service: 'appstream', path: '/applications'})) +/* +{"_links":{"curie":[{"href":"http://docs.aws.amazon.com/appstream/latest/... +... +*/ + +request(aws4.sign({service: 'cognito-sync', path: '/identitypools'})) +/* +{"Count":0,"IdentityPoolUsages":[],"MaxResults":16,"NextToken":null} +... +*/ + +request(aws4.sign({service: 'elastictranscoder', path: '/2012-09-25/pipelines'})) +/* +{"NextPageToken":null,"Pipelines":[]} +... +*/ + +request(aws4.sign({service: 'lambda', path: '/2014-11-13/functions/'})) +/* +{"Functions":[],"NextMarker":null} +... +*/ + +request(aws4.sign({service: 'ecs', path: '/?Action=ListClusters&Version=2014-11-13'})) +/* +<ListClustersResponse xmlns="http://ecs.amazonaws.com/doc/2014-11-13/"> +... +*/ + +request(aws4.sign({service: 'glacier', path: '/-/vaults', headers: {'X-Amz-Glacier-Version': '2012-06-01'}})) +/* +{"Marker":null,"VaultList":[]} +... +*/ + +request(aws4.sign({service: 'storagegateway', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'StorageGateway_20120630.ListGateways' +}})) +/* +{"Gateways":[]} +... +*/ + +request(aws4.sign({service: 'datapipeline', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'DataPipeline.ListPipelines' +}})) +/* +{"hasMoreResults":false,"pipelineIdList":[]} +... +*/ + +request(aws4.sign({service: 'opsworks', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'OpsWorks_20130218.DescribeStacks' +}})) +/* +{"Stacks":[]} +... +*/ + +request(aws4.sign({service: 'route53domains', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'Route53Domains_v20140515.ListDomains' +}})) +/* +{"Domains":[]} +... +*/ + +request(aws4.sign({service: 'kinesis', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'Kinesis_20131202.ListStreams' +}})) +/* +{"HasMoreStreams":false,"StreamNames":[]} +... +*/ + +request(aws4.sign({service: 'cloudtrail', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'CloudTrail_20131101.DescribeTrails' +}})) +/* +{"trailList":[]} +... +*/ + +request(aws4.sign({service: 'logs', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'Logs_20140328.DescribeLogGroups' +}})) +/* +{"logGroups":[]} +... +*/ + +request(aws4.sign({service: 'codedeploy', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'CodeDeploy_20141006.ListApplications' +}})) +/* +{"applications":[]} +... +*/ + +request(aws4.sign({service: 'directconnect', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'OvertureService.DescribeConnections' +}})) +/* +{"connections":[]} +... +*/ + +request(aws4.sign({service: 'kms', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'TrentService.ListKeys' +}})) +/* +{"Keys":[],"Truncated":false} +... +*/ + +request(aws4.sign({service: 'config', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'StarlingDoveService.DescribeDeliveryChannels' +}})) +/* +{"DeliveryChannels":[]} +... +*/ + +request(aws4.sign({service: 'cloudhsm', body: '{}', headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'CloudHsmFrontendService.ListAvailableZones' +}})) +/* +{"AZList":["us-east-1a","us-east-1b","us-east-1c"]} +... +*/ + +request(aws4.sign({ + service: 'swf', + body: '{"registrationStatus":"REGISTERED"}', + headers: { + 'Content-Type': 'application/x-amz-json-1.0', + 'X-Amz-Target': 'SimpleWorkflowService.ListDomains' + } +})) +/* +{"domainInfos":[]} +... +*/ + +request(aws4.sign({ + service: 'cognito-identity', + body: '{"MaxResults": 1}', + headers: { + 'Content-Type': 'application/x-amz-json-1.1', + 'X-Amz-Target': 'AWSCognitoIdentityService.ListIdentityPools' + } +})) +/* +{"IdentityPools":[]} +... +*/ + +request(aws4.sign({ + service: 'mobileanalytics', + path: '/2014-06-05/events', + body: JSON.stringify({events:[{ + eventType: 'a', + timestamp: new Date().toISOString(), + session: {}, + }]}), + headers: { + 'Content-Type': 'application/json', + 'X-Amz-Client-Context': JSON.stringify({ + client: {client_id: 'a', app_title: 'a'}, + custom: {}, + env: {platform: 'a'}, + services: {}, + }), + } +})) +/* +(HTTP 202, empty response) +*/ + +// Generate CodeCommit Git access password +var signer = new aws4.RequestSigner({ + service: 'codecommit', + host: 'git-codecommit.us-east-1.amazonaws.com', + method: 'GIT', + path: '/v1/repos/MyAwesomeRepo', +}) +var password = signer.getDateTime() + 'Z' + signer.signature() +``` + +API +--- + +### aws4.sign(requestOptions, [credentials]) + +This calculates and populates the `Authorization` header of +`requestOptions`, and any other necessary AWS headers and/or request +options. Returns `requestOptions` as a convenience for chaining. + +`requestOptions` is an object holding the same options that the node.js +[http.request](http://nodejs.org/docs/latest/api/http.html#http_http_request_options_callback) +function takes. + +The following properties of `requestOptions` are used in the signing or +populated if they don't already exist: + +- `hostname` or `host` (will be determined from `service` and `region` if not given) +- `method` (will use `'GET'` if not given or `'POST'` if there is a `body`) +- `path` (will use `'/'` if not given) +- `body` (will use `''` if not given) +- `service` (will be calculated from `hostname` or `host` if not given) +- `region` (will be calculated from `hostname` or `host` or use `'us-east-1'` if not given) +- `headers['Host']` (will use `hostname` or `host` or be calculated if not given) +- `headers['Content-Type']` (will use `'application/x-www-form-urlencoded; charset=utf-8'` + if not given and there is a `body`) +- `headers['Date']` (used to calculate the signature date if given, otherwise `new Date` is used) + +Your AWS credentials (which can be found in your +[AWS console](https://portal.aws.amazon.com/gp/aws/securityCredentials)) +can be specified in one of two ways: + +- As the second argument, like this: + +```javascript +aws4.sign(requestOptions, { + secretAccessKey: "<your-secret-access-key>", + accessKeyId: "<your-access-key-id>", + sessionToken: "<your-session-token>" +}) +``` + +- From `process.env`, such as this: + +``` +export AWS_SECRET_ACCESS_KEY="<your-secret-access-key>" +export AWS_ACCESS_KEY_ID="<your-access-key-id>" +export AWS_SESSION_TOKEN="<your-session-token>" +``` + +(will also use `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` if available) + +The `sessionToken` property and `AWS_SESSION_TOKEN` environment variable are optional for signing +with [IAM STS temporary credentials](http://docs.aws.amazon.com/STS/latest/UsingSTS/using-temp-creds.html). + +Installation +------------ + +With [npm](http://npmjs.org/) do: + +``` +npm install aws4 +``` + +Can also be used [in the browser](./browser). + +Thanks +------ + +Thanks to [@jed](https://github.com/jed) for his +[dynamo-client](https://github.com/jed/dynamo-client) lib where I first +committed and subsequently extracted this code. + +Also thanks to the +[official node.js AWS SDK](https://github.com/aws/aws-sdk-js) for giving +me a start on implementing the v4 signature. + diff --git a/appasar/canary/node_modules/aws4/aws4.js b/appasar/canary/node_modules/aws4/aws4.js new file mode 100644 index 0000000..0cff0f0 --- /dev/null +++ b/appasar/canary/node_modules/aws4/aws4.js @@ -0,0 +1,332 @@ +var aws4 = exports, + url = require('url'), + querystring = require('querystring'), + crypto = require('crypto'), + lru = require('./lru'), + credentialsCache = lru(1000) + +// http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html + +function hmac(key, string, encoding) { + return crypto.createHmac('sha256', key).update(string, 'utf8').digest(encoding) +} + +function hash(string, encoding) { + return crypto.createHash('sha256').update(string, 'utf8').digest(encoding) +} + +// This function assumes the string has already been percent encoded +function encodeRfc3986(urlEncodedString) { + return urlEncodedString.replace(/[!'()*]/g, function(c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} + +// request: { path | body, [host], [method], [headers], [service], [region] } +// credentials: { accessKeyId, secretAccessKey, [sessionToken] } +function RequestSigner(request, credentials) { + + if (typeof request === 'string') request = url.parse(request) + + var headers = request.headers = (request.headers || {}), + hostParts = this.matchHost(request.hostname || request.host || headers.Host || headers.host) + + this.request = request + this.credentials = credentials || this.defaultCredentials() + + this.service = request.service || hostParts[0] || '' + this.region = request.region || hostParts[1] || 'us-east-1' + + // SES uses a different domain from the service name + if (this.service === 'email') this.service = 'ses' + + if (!request.method && request.body) + request.method = 'POST' + + if (!headers.Host && !headers.host) { + headers.Host = request.hostname || request.host || this.createHost() + + // If a port is specified explicitly, use it as is + if (request.port) + headers.Host += ':' + request.port + } + if (!request.hostname && !request.host) + request.hostname = headers.Host || headers.host + + this.isCodeCommitGit = this.service === 'codecommit' && request.method === 'GIT' +} + +RequestSigner.prototype.matchHost = function(host) { + var match = (host || '').match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/) + var hostParts = (match || []).slice(1, 3) + + // ES's hostParts are sometimes the other way round, if the value that is expected + // to be region equals ‘es’ switch them back + // e.g. search-cluster-name-aaaa00aaaa0aaa0aaaaaaa0aaa.us-east-1.es.amazonaws.com + if (hostParts[1] === 'es') + hostParts = hostParts.reverse() + + return hostParts +} + +// http://docs.aws.amazon.com/general/latest/gr/rande.html +RequestSigner.prototype.isSingleRegion = function() { + // Special case for S3 and SimpleDB in us-east-1 + if (['s3', 'sdb'].indexOf(this.service) >= 0 && this.region === 'us-east-1') return true + + return ['cloudfront', 'ls', 'route53', 'iam', 'importexport', 'sts'] + .indexOf(this.service) >= 0 +} + +RequestSigner.prototype.createHost = function() { + var region = this.isSingleRegion() ? '' : + (this.service === 's3' && this.region !== 'us-east-1' ? '-' : '.') + this.region, + service = this.service === 'ses' ? 'email' : this.service + return service + region + '.amazonaws.com' +} + +RequestSigner.prototype.prepareRequest = function() { + this.parsePath() + + var request = this.request, headers = request.headers, query + + if (request.signQuery) { + + this.parsedPath.query = query = this.parsedPath.query || {} + + if (this.credentials.sessionToken) + query['X-Amz-Security-Token'] = this.credentials.sessionToken + + if (this.service === 's3' && !query['X-Amz-Expires']) + query['X-Amz-Expires'] = 86400 + + if (query['X-Amz-Date']) + this.datetime = query['X-Amz-Date'] + else + query['X-Amz-Date'] = this.getDateTime() + + query['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256' + query['X-Amz-Credential'] = this.credentials.accessKeyId + '/' + this.credentialString() + query['X-Amz-SignedHeaders'] = this.signedHeaders() + + } else { + + if (!request.doNotModifyHeaders && !this.isCodeCommitGit) { + if (request.body && !headers['Content-Type'] && !headers['content-type']) + headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8' + + if (request.body && !headers['Content-Length'] && !headers['content-length']) + headers['Content-Length'] = Buffer.byteLength(request.body) + + if (this.credentials.sessionToken && !headers['X-Amz-Security-Token'] && !headers['x-amz-security-token']) + headers['X-Amz-Security-Token'] = this.credentials.sessionToken + + if (this.service === 's3' && !headers['X-Amz-Content-Sha256'] && !headers['x-amz-content-sha256']) + headers['X-Amz-Content-Sha256'] = hash(this.request.body || '', 'hex') + + if (headers['X-Amz-Date'] || headers['x-amz-date']) + this.datetime = headers['X-Amz-Date'] || headers['x-amz-date'] + else + headers['X-Amz-Date'] = this.getDateTime() + } + + delete headers.Authorization + delete headers.authorization + } +} + +RequestSigner.prototype.sign = function() { + if (!this.parsedPath) this.prepareRequest() + + if (this.request.signQuery) { + this.parsedPath.query['X-Amz-Signature'] = this.signature() + } else { + this.request.headers.Authorization = this.authHeader() + } + + this.request.path = this.formatPath() + + return this.request +} + +RequestSigner.prototype.getDateTime = function() { + if (!this.datetime) { + var headers = this.request.headers, + date = new Date(headers.Date || headers.date || new Date) + + this.datetime = date.toISOString().replace(/[:\-]|\.\d{3}/g, '') + + // Remove the trailing 'Z' on the timestamp string for CodeCommit git access + if (this.isCodeCommitGit) this.datetime = this.datetime.slice(0, -1) + } + return this.datetime +} + +RequestSigner.prototype.getDate = function() { + return this.getDateTime().substr(0, 8) +} + +RequestSigner.prototype.authHeader = function() { + return [ + 'AWS4-HMAC-SHA256 Credential=' + this.credentials.accessKeyId + '/' + this.credentialString(), + 'SignedHeaders=' + this.signedHeaders(), + 'Signature=' + this.signature(), + ].join(', ') +} + +RequestSigner.prototype.signature = function() { + var date = this.getDate(), + cacheKey = [this.credentials.secretAccessKey, date, this.region, this.service].join(), + kDate, kRegion, kService, kCredentials = credentialsCache.get(cacheKey) + if (!kCredentials) { + kDate = hmac('AWS4' + this.credentials.secretAccessKey, date) + kRegion = hmac(kDate, this.region) + kService = hmac(kRegion, this.service) + kCredentials = hmac(kService, 'aws4_request') + credentialsCache.set(cacheKey, kCredentials) + } + return hmac(kCredentials, this.stringToSign(), 'hex') +} + +RequestSigner.prototype.stringToSign = function() { + return [ + 'AWS4-HMAC-SHA256', + this.getDateTime(), + this.credentialString(), + hash(this.canonicalString(), 'hex'), + ].join('\n') +} + +RequestSigner.prototype.canonicalString = function() { + if (!this.parsedPath) this.prepareRequest() + + var pathStr = this.parsedPath.path, + query = this.parsedPath.query, + headers = this.request.headers, + queryStr = '', + normalizePath = this.service !== 's3', + decodePath = this.service === 's3' || this.request.doNotEncodePath, + decodeSlashesInPath = this.service === 's3', + firstValOnly = this.service === 's3', + bodyHash + + if (this.service === 's3' && this.request.signQuery) { + bodyHash = 'UNSIGNED-PAYLOAD' + } else if (this.isCodeCommitGit) { + bodyHash = '' + } else { + bodyHash = headers['X-Amz-Content-Sha256'] || headers['x-amz-content-sha256'] || + hash(this.request.body || '', 'hex') + } + + if (query) { + queryStr = encodeRfc3986(querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) { + if (!key) return obj + obj[key] = !Array.isArray(query[key]) ? query[key] : + (firstValOnly ? query[key][0] : query[key].slice().sort()) + return obj + }, {}))) + } + if (pathStr !== '/') { + if (normalizePath) pathStr = pathStr.replace(/\/{2,}/g, '/') + pathStr = pathStr.split('/').reduce(function(path, piece) { + if (normalizePath && piece === '..') { + path.pop() + } else if (!normalizePath || piece !== '.') { + if (decodePath) piece = querystring.unescape(piece) + path.push(encodeRfc3986(querystring.escape(piece))) + } + return path + }, []).join('/') + if (pathStr[0] !== '/') pathStr = '/' + pathStr + if (decodeSlashesInPath) pathStr = pathStr.replace(/%2F/g, '/') + } + + return [ + this.request.method || 'GET', + pathStr, + queryStr, + this.canonicalHeaders() + '\n', + this.signedHeaders(), + bodyHash, + ].join('\n') +} + +RequestSigner.prototype.canonicalHeaders = function() { + var headers = this.request.headers + function trimAll(header) { + return header.toString().trim().replace(/\s+/g, ' ') + } + return Object.keys(headers) + .sort(function(a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 }) + .map(function(key) { return key.toLowerCase() + ':' + trimAll(headers[key]) }) + .join('\n') +} + +RequestSigner.prototype.signedHeaders = function() { + return Object.keys(this.request.headers) + .map(function(key) { return key.toLowerCase() }) + .sort() + .join(';') +} + +RequestSigner.prototype.credentialString = function() { + return [ + this.getDate(), + this.region, + this.service, + 'aws4_request', + ].join('/') +} + +RequestSigner.prototype.defaultCredentials = function() { + var env = process.env + return { + accessKeyId: env.AWS_ACCESS_KEY_ID || env.AWS_ACCESS_KEY, + secretAccessKey: env.AWS_SECRET_ACCESS_KEY || env.AWS_SECRET_KEY, + sessionToken: env.AWS_SESSION_TOKEN, + } +} + +RequestSigner.prototype.parsePath = function() { + var path = this.request.path || '/', + queryIx = path.indexOf('?'), + query = null + + if (queryIx >= 0) { + query = querystring.parse(path.slice(queryIx + 1)) + path = path.slice(0, queryIx) + } + + // S3 doesn't always encode characters > 127 correctly and + // all services don't encode characters > 255 correctly + // So if there are non-reserved chars (and it's not already all % encoded), just encode them all + if (/[^0-9A-Za-z!'()*\-._~%/]/.test(path)) { + path = path.split('/').map(function(piece) { + return querystring.escape(querystring.unescape(piece)) + }).join('/') + } + + this.parsedPath = { + path: path, + query: query, + } +} + +RequestSigner.prototype.formatPath = function() { + var path = this.parsedPath.path, + query = this.parsedPath.query + + if (!query) return path + + // Services don't support empty query string keys + if (query[''] != null) delete query[''] + + return path + '?' + encodeRfc3986(querystring.stringify(query)) +} + +aws4.RequestSigner = RequestSigner + +aws4.sign = function(request, credentials) { + return new RequestSigner(request, credentials).sign() +} diff --git a/appasar/canary/node_modules/aws4/lru.js b/appasar/canary/node_modules/aws4/lru.js new file mode 100644 index 0000000..333f66a --- /dev/null +++ b/appasar/canary/node_modules/aws4/lru.js @@ -0,0 +1,96 @@ +module.exports = function(size) { + return new LruCache(size) +} + +function LruCache(size) { + this.capacity = size | 0 + this.map = Object.create(null) + this.list = new DoublyLinkedList() +} + +LruCache.prototype.get = function(key) { + var node = this.map[key] + if (node == null) return undefined + this.used(node) + return node.val +} + +LruCache.prototype.set = function(key, val) { + var node = this.map[key] + if (node != null) { + node.val = val + } else { + if (!this.capacity) this.prune() + if (!this.capacity) return false + node = new DoublyLinkedNode(key, val) + this.map[key] = node + this.capacity-- + } + this.used(node) + return true +} + +LruCache.prototype.used = function(node) { + this.list.moveToFront(node) +} + +LruCache.prototype.prune = function() { + var node = this.list.pop() + if (node != null) { + delete this.map[node.key] + this.capacity++ + } +} + + +function DoublyLinkedList() { + this.firstNode = null + this.lastNode = null +} + +DoublyLinkedList.prototype.moveToFront = function(node) { + if (this.firstNode == node) return + + this.remove(node) + + if (this.firstNode == null) { + this.firstNode = node + this.lastNode = node + node.prev = null + node.next = null + } else { + node.prev = null + node.next = this.firstNode + node.next.prev = node + this.firstNode = node + } +} + +DoublyLinkedList.prototype.pop = function() { + var lastNode = this.lastNode + if (lastNode != null) { + this.remove(lastNode) + } + return lastNode +} + +DoublyLinkedList.prototype.remove = function(node) { + if (this.firstNode == node) { + this.firstNode = node.next + } else if (node.prev != null) { + node.prev.next = node.next + } + if (this.lastNode == node) { + this.lastNode = node.prev + } else if (node.next != null) { + node.next.prev = node.prev + } +} + + +function DoublyLinkedNode(key, val) { + this.key = key + this.val = val + this.prev = null + this.next = null +} diff --git a/appasar/canary/node_modules/aws4/package.json b/appasar/canary/node_modules/aws4/package.json new file mode 100644 index 0000000..33b9bb0 --- /dev/null +++ b/appasar/canary/node_modules/aws4/package.json @@ -0,0 +1,71 @@ +{ + "name": "aws4", + "version": "1.6.0", + "description": "Signs and prepares requests using AWS Signature Version 4", + "author": "Michael Hart <michael.hart.au@gmail.com> (http://github.com/mhart)", + "main": "aws4.js", + "keywords": [ + "amazon", + "aws", + "signature", + "s3", + "ec2", + "autoscaling", + "cloudformation", + "elasticloadbalancing", + "elb", + "elasticbeanstalk", + "cloudsearch", + "dynamodb", + "kinesis", + "lambda", + "glacier", + "sqs", + "sns", + "iam", + "sts", + "ses", + "swf", + "storagegateway", + "datapipeline", + "directconnect", + "redshift", + "opsworks", + "rds", + "monitoring", + "cloudtrail", + "cloudfront", + "codedeploy", + "elasticache", + "elasticmapreduce", + "elastictranscoder", + "emr", + "cloudwatch", + "mobileanalytics", + "cognitoidentity", + "cognitosync", + "cognito", + "containerservice", + "ecs", + "appstream", + "keymanagementservice", + "kms", + "config", + "cloudhsm", + "route53", + "route53domains", + "logs" + ], + "repository": { + "type": "git", + "url": "https://github.com/mhart/aws4.git" + }, + "license": "MIT", + "devDependencies": { + "mocha": "^2.4.5", + "should": "^8.2.2" + }, + "scripts": { + "test": "mocha ./test/fast.js ./test/slow.js -b -t 100s -R list" + } +} diff --git a/appasar/canary/node_modules/balanced-match/.npmignore b/appasar/canary/node_modules/balanced-match/.npmignore new file mode 100644 index 0000000..ae5d8c3 --- /dev/null +++ b/appasar/canary/node_modules/balanced-match/.npmignore @@ -0,0 +1,5 @@ +test +.gitignore +.travis.yml +Makefile +example.js diff --git a/appasar/canary/node_modules/balanced-match/LICENSE.md b/appasar/canary/node_modules/balanced-match/LICENSE.md new file mode 100644 index 0000000..2cdc8e4 --- /dev/null +++ b/appasar/canary/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/balanced-match/README.md b/appasar/canary/node_modules/balanced-match/README.md new file mode 100644 index 0000000..08e918c --- /dev/null +++ b/appasar/canary/node_modules/balanced-match/README.md @@ -0,0 +1,91 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ <a index>, <b index> ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/balanced-match/index.js b/appasar/canary/node_modules/balanced-match/index.js new file mode 100644 index 0000000..1685a76 --- /dev/null +++ b/appasar/canary/node_modules/balanced-match/index.js @@ -0,0 +1,59 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/appasar/canary/node_modules/balanced-match/package.json b/appasar/canary/node_modules/balanced-match/package.json new file mode 100644 index 0000000..61349c6 --- /dev/null +++ b/appasar/canary/node_modules/balanced-match/package.json @@ -0,0 +1,49 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "1.0.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "make test", + "bench": "make bench" + }, + "dependencies": {}, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/appasar/canary/node_modules/bcrypt-pbkdf/README.md b/appasar/canary/node_modules/bcrypt-pbkdf/README.md new file mode 100644 index 0000000..1201809 --- /dev/null +++ b/appasar/canary/node_modules/bcrypt-pbkdf/README.md @@ -0,0 +1,39 @@ +Port of the OpenBSD `bcrypt_pbkdf` function to pure Javascript. `npm`-ified +version of [Devi Mandiri's port] +(https://github.com/devi/tmp/blob/master/js/bcrypt_pbkdf.js), +with some minor performance improvements. The code is copied verbatim (and +un-styled) from Devi's work. + +This product includes software developed by Niels Provos. + +## API + +### `bcrypt_pbkdf.pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds)` + +Derive a cryptographic key of arbitrary length from a given password and salt, +using the OpenBSD `bcrypt_pbkdf` function. This is a combination of Blowfish and +SHA-512. + +See [this article](http://www.tedunangst.com/flak/post/bcrypt-pbkdf) for +further information. + +Parameters: + + * `pass`, a Uint8Array of length `passlen` + * `passlen`, an integer Number + * `salt`, a Uint8Array of length `saltlen` + * `saltlen`, an integer Number + * `key`, a Uint8Array of length `keylen`, will be filled with output + * `keylen`, an integer Number + * `rounds`, an integer Number, number of rounds of the PBKDF to run + +### `bcrypt_pbkdf.hash(sha2pass, sha2salt, out)` + +Calculate a Blowfish hash, given SHA2-512 output of a password and salt. Used as +part of the inner round function in the PBKDF. + +Parameters: + + * `sha2pass`, a Uint8Array of length 64 + * `sha2salt`, a Uint8Array of length 64 + * `out`, a Uint8Array of length 32, will be filled with output diff --git a/appasar/canary/node_modules/bcrypt-pbkdf/index.js b/appasar/canary/node_modules/bcrypt-pbkdf/index.js new file mode 100644 index 0000000..b1b5ad4 --- /dev/null +++ b/appasar/canary/node_modules/bcrypt-pbkdf/index.js @@ -0,0 +1,556 @@ +'use strict'; + +var crypto_hash_sha512 = require('tweetnacl').lowlevel.crypto_hash; + +/* + * This file is a 1:1 port from the OpenBSD blowfish.c and bcrypt_pbkdf.c. As a + * result, it retains the original copyright and license. The two files are + * under slightly different (but compatible) licenses, and are here combined in + * one file. + * + * Credit for the actual porting work goes to: + * Devi Mandiri <me@devi.web.id> + */ + +/* + * The Blowfish portions are under the following license: + * + * Blowfish block cipher for OpenBSD + * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> + * All rights reserved. + * + * Implementation advice by David Mazieres <dm@lcs.mit.edu>. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * The bcrypt_pbkdf portions are under the following license: + * + * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Performance improvements (Javascript-specific): + * + * Copyright 2016, Joyent Inc + * Author: Alex Wilson <alex.wilson@joyent.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +// Ported from OpenBSD bcrypt_pbkdf.c v1.9 + +var BLF_J = 0; + +var Blowfish = function() { + this.S = [ + new Uint32Array([ + 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, + 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, + 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, + 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, + 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, + 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, + 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, + 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, + 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, + 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, + 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, + 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, + 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, + 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, + 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, + 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, + 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, + 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, + 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, + 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, + 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, + 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, + 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, + 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, + 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, + 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, + 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, + 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, + 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, + 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, + 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, + 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, + 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, + 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, + 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, + 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, + 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, + 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, + 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, + 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, + 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, + 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, + 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, + 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, + 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, + 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, + 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, + 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, + 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, + 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, + 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, + 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, + 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, + 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, + 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, + 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, + 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, + 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, + 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, + 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, + 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, + 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, + 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, + 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a]), + new Uint32Array([ + 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, + 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, + 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, + 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, + 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, + 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, + 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, + 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, + 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, + 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, + 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, + 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, + 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, + 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, + 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, + 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, + 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, + 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, + 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, + 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, + 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, + 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, + 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, + 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, + 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, + 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, + 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, + 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, + 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, + 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, + 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, + 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, + 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, + 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, + 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, + 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, + 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, + 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, + 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, + 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, + 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, + 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, + 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, + 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, + 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, + 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, + 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, + 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, + 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, + 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, + 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, + 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, + 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, + 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, + 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, + 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, + 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, + 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, + 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, + 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, + 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, + 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, + 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, + 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7]), + new Uint32Array([ + 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, + 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, + 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, + 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, + 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, + 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, + 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, + 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, + 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, + 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, + 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, + 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, + 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, + 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, + 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, + 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, + 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, + 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, + 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, + 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, + 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, + 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, + 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, + 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, + 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, + 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, + 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, + 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, + 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, + 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, + 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, + 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, + 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, + 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, + 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, + 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, + 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, + 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, + 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, + 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, + 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, + 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, + 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, + 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, + 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, + 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, + 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, + 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, + 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, + 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, + 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, + 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, + 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, + 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, + 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, + 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, + 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, + 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, + 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, + 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, + 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, + 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, + 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, + 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0]), + new Uint32Array([ + 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, + 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, + 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, + 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, + 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, + 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, + 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, + 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, + 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, + 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, + 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, + 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, + 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, + 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, + 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, + 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, + 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, + 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, + 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, + 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, + 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, + 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, + 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, + 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, + 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, + 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, + 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, + 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, + 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, + 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, + 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, + 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, + 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, + 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, + 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, + 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, + 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, + 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, + 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, + 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, + 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, + 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, + 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, + 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, + 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, + 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, + 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, + 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, + 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, + 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, + 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, + 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, + 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, + 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, + 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, + 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, + 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, + 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, + 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, + 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, + 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, + 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, + 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, + 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6]) + ]; + this.P = new Uint32Array([ + 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, + 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, + 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, + 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, + 0x9216d5d9, 0x8979fb1b]); +}; + +function F(S, x8, i) { + return (((S[0][x8[i+3]] + + S[1][x8[i+2]]) ^ + S[2][x8[i+1]]) + + S[3][x8[i]]); +}; + +Blowfish.prototype.encipher = function(x, x8) { + if (x8 === undefined) { + x8 = new Uint8Array(x.buffer); + if (x.byteOffset !== 0) + x8 = x8.subarray(x.byteOffset); + } + x[0] ^= this.P[0]; + for (var i = 1; i < 16; i += 2) { + x[1] ^= F(this.S, x8, 0) ^ this.P[i]; + x[0] ^= F(this.S, x8, 4) ^ this.P[i+1]; + } + var t = x[0]; + x[0] = x[1] ^ this.P[17]; + x[1] = t; +}; + +Blowfish.prototype.decipher = function(x) { + var x8 = new Uint8Array(x.buffer); + if (x.byteOffset !== 0) + x8 = x8.subarray(x.byteOffset); + x[0] ^= this.P[17]; + for (var i = 16; i > 0; i -= 2) { + x[1] ^= F(this.S, x8, 0) ^ this.P[i]; + x[0] ^= F(this.S, x8, 4) ^ this.P[i-1]; + } + var t = x[0]; + x[0] = x[1] ^ this.P[0]; + x[1] = t; +}; + +function stream2word(data, databytes){ + var i, temp = 0; + for (i = 0; i < 4; i++, BLF_J++) { + if (BLF_J >= databytes) BLF_J = 0; + temp = (temp << 8) | data[BLF_J]; + } + return temp; +}; + +Blowfish.prototype.expand0state = function(key, keybytes) { + var d = new Uint32Array(2), i, k; + var d8 = new Uint8Array(d.buffer); + + for (i = 0, BLF_J = 0; i < 18; i++) { + this.P[i] ^= stream2word(key, keybytes); + } + BLF_J = 0; + + for (i = 0; i < 18; i += 2) { + this.encipher(d, d8); + this.P[i] = d[0]; + this.P[i+1] = d[1]; + } + + for (i = 0; i < 4; i++) { + for (k = 0; k < 256; k += 2) { + this.encipher(d, d8); + this.S[i][k] = d[0]; + this.S[i][k+1] = d[1]; + } + } +}; + +Blowfish.prototype.expandstate = function(data, databytes, key, keybytes) { + var d = new Uint32Array(2), i, k; + + for (i = 0, BLF_J = 0; i < 18; i++) { + this.P[i] ^= stream2word(key, keybytes); + } + + for (i = 0, BLF_J = 0; i < 18; i += 2) { + d[0] ^= stream2word(data, databytes); + d[1] ^= stream2word(data, databytes); + this.encipher(d); + this.P[i] = d[0]; + this.P[i+1] = d[1]; + } + + for (i = 0; i < 4; i++) { + for (k = 0; k < 256; k += 2) { + d[0] ^= stream2word(data, databytes); + d[1] ^= stream2word(data, databytes); + this.encipher(d); + this.S[i][k] = d[0]; + this.S[i][k+1] = d[1]; + } + } + BLF_J = 0; +}; + +Blowfish.prototype.enc = function(data, blocks) { + for (var i = 0; i < blocks; i++) { + this.encipher(data.subarray(i*2)); + } +}; + +Blowfish.prototype.dec = function(data, blocks) { + for (var i = 0; i < blocks; i++) { + this.decipher(data.subarray(i*2)); + } +}; + +var BCRYPT_BLOCKS = 8, + BCRYPT_HASHSIZE = 32; + +function bcrypt_hash(sha2pass, sha2salt, out) { + var state = new Blowfish(), + cdata = new Uint32Array(BCRYPT_BLOCKS), i, + ciphertext = new Uint8Array([79,120,121,99,104,114,111,109,97,116,105, + 99,66,108,111,119,102,105,115,104,83,119,97,116,68,121,110,97,109, + 105,116,101]); //"OxychromaticBlowfishSwatDynamite" + + state.expandstate(sha2salt, 64, sha2pass, 64); + for (i = 0; i < 64; i++) { + state.expand0state(sha2salt, 64); + state.expand0state(sha2pass, 64); + } + + for (i = 0; i < BCRYPT_BLOCKS; i++) + cdata[i] = stream2word(ciphertext, ciphertext.byteLength); + for (i = 0; i < 64; i++) + state.enc(cdata, cdata.byteLength / 8); + + for (i = 0; i < BCRYPT_BLOCKS; i++) { + out[4*i+3] = cdata[i] >>> 24; + out[4*i+2] = cdata[i] >>> 16; + out[4*i+1] = cdata[i] >>> 8; + out[4*i+0] = cdata[i]; + } +}; + +function bcrypt_pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds) { + var sha2pass = new Uint8Array(64), + sha2salt = new Uint8Array(64), + out = new Uint8Array(BCRYPT_HASHSIZE), + tmpout = new Uint8Array(BCRYPT_HASHSIZE), + countsalt = new Uint8Array(saltlen+4), + i, j, amt, stride, dest, count, + origkeylen = keylen; + + if (rounds < 1) + return -1; + if (passlen === 0 || saltlen === 0 || keylen === 0 || + keylen > (out.byteLength * out.byteLength) || saltlen > (1<<20)) + return -1; + + stride = Math.floor((keylen + out.byteLength - 1) / out.byteLength); + amt = Math.floor((keylen + stride - 1) / stride); + + for (i = 0; i < saltlen; i++) + countsalt[i] = salt[i]; + + crypto_hash_sha512(sha2pass, pass, passlen); + + for (count = 1; keylen > 0; count++) { + countsalt[saltlen+0] = count >>> 24; + countsalt[saltlen+1] = count >>> 16; + countsalt[saltlen+2] = count >>> 8; + countsalt[saltlen+3] = count; + + crypto_hash_sha512(sha2salt, countsalt, saltlen + 4); + bcrypt_hash(sha2pass, sha2salt, tmpout); + for (i = out.byteLength; i--;) + out[i] = tmpout[i]; + + for (i = 1; i < rounds; i++) { + crypto_hash_sha512(sha2salt, tmpout, tmpout.byteLength); + bcrypt_hash(sha2pass, sha2salt, tmpout); + for (j = 0; j < out.byteLength; j++) + out[j] ^= tmpout[j]; + } + + amt = Math.min(amt, keylen); + for (i = 0; i < amt; i++) { + dest = i * stride + (count - 1); + if (dest >= origkeylen) + break; + key[dest] = out[i]; + } + keylen -= i; + } + + return 0; +}; + +module.exports = { + BLOCKS: BCRYPT_BLOCKS, + HASHSIZE: BCRYPT_HASHSIZE, + hash: bcrypt_hash, + pbkdf: bcrypt_pbkdf +}; diff --git a/appasar/canary/node_modules/bcrypt-pbkdf/package.json b/appasar/canary/node_modules/bcrypt-pbkdf/package.json new file mode 100644 index 0000000..51e8141 --- /dev/null +++ b/appasar/canary/node_modules/bcrypt-pbkdf/package.json @@ -0,0 +1,11 @@ +{ + "name": "bcrypt-pbkdf", + "version": "1.0.1", + "description": "Port of the OpenBSD bcrypt_pbkdf function to pure JS", + "main": "index.js", + "dependencies": { + "tweetnacl": "^0.14.3" + }, + "devDependencies": {}, + "license": "BSD-3-Clause" +} diff --git a/appasar/canary/node_modules/boom/LICENSE b/appasar/canary/node_modules/boom/LICENSE new file mode 100644 index 0000000..94b91cb --- /dev/null +++ b/appasar/canary/node_modules/boom/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2012-2017, Project contributors. +Copyright (c) 2012-2014, Walmart. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * The names of any contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * * * + +The complete list of contributors can be found at: https://github.com/hapijs/boom/graphs/contributors diff --git a/appasar/canary/node_modules/boom/README.md b/appasar/canary/node_modules/boom/README.md new file mode 100644 index 0000000..6452491 --- /dev/null +++ b/appasar/canary/node_modules/boom/README.md @@ -0,0 +1,760 @@ +![boom Logo](https://raw.github.com/hapijs/boom/master/images/boom.png) + +HTTP-friendly error objects + +[![Build Status](https://secure.travis-ci.org/hapijs/boom.svg)](http://travis-ci.org/hapijs/boom) +[![Current Version](https://img.shields.io/npm/v/boom.svg)](https://www.npmjs.com/package/boom) + +Lead Maintainer: [Adam Bretz](https://github.com/arb) + +<!-- toc --> + +- [Boom](#boom) + - [Helper Methods](#helper-methods) + - [`wrap(error, [statusCode], [message])`](#wraperror-statuscode-message) + - [`create(statusCode, [message], [data])`](#createstatuscode-message-data) + - [HTTP 4xx Errors](#http-4xx-errors) + - [`Boom.badRequest([message], [data])`](#boombadrequestmessage-data) + - [`Boom.unauthorized([message], [scheme], [attributes])`](#boomunauthorizedmessage-scheme-attributes) + - [`Boom.paymentRequired([message], [data])`](#boompaymentrequiredmessage-data) + - [`Boom.forbidden([message], [data])`](#boomforbiddenmessage-data) + - [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data) + - [`Boom.methodNotAllowed([message], [data], [allow])`](#boommethodnotallowedmessage-data-allow) + - [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data) + - [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data) + - [`Boom.clientTimeout([message], [data])`](#boomclienttimeoutmessage-data) + - [`Boom.conflict([message], [data])`](#boomconflictmessage-data) + - [`Boom.resourceGone([message], [data])`](#boomresourcegonemessage-data) + - [`Boom.lengthRequired([message], [data])`](#boomlengthrequiredmessage-data) + - [`Boom.preconditionFailed([message], [data])`](#boompreconditionfailedmessage-data) + - [`Boom.entityTooLarge([message], [data])`](#boomentitytoolargemessage-data) + - [`Boom.uriTooLong([message], [data])`](#boomuritoolongmessage-data) + - [`Boom.unsupportedMediaType([message], [data])`](#boomunsupportedmediatypemessage-data) + - [`Boom.rangeNotSatisfiable([message], [data])`](#boomrangenotsatisfiablemessage-data) + - [`Boom.expectationFailed([message], [data])`](#boomexpectationfailedmessage-data) + - [`Boom.teapot([message], [data])`](#boomteapotmessage-data) + - [`Boom.badData([message], [data])`](#boombaddatamessage-data) + - [`Boom.locked([message], [data])`](#boomlockedmessage-data) + - [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data) + - [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data) + - [`Boom.illegal([message], [data])`](#boomillegalmessage-data) + - [HTTP 5xx Errors](#http-5xx-errors) + - [`Boom.badImplementation([message], [data])` - (*alias: `internal`*)](#boombadimplementationmessage-data---alias-internal) + - [`Boom.notImplemented([message], [data])`](#boomnotimplementedmessage-data) + - [`Boom.badGateway([message], [data])`](#boombadgatewaymessage-data) + - [`Boom.serverUnavailable([message], [data])`](#boomserverunavailablemessage-data) + - [`Boom.gatewayTimeout([message], [data])`](#boomgatewaytimeoutmessage-data) + - [F.A.Q.](#faq) + +<!-- tocstop --> + +# Boom + +**boom** provides a set of utilities for returning HTTP errors. Each utility returns a `Boom` error response +object (instance of `Error`) which includes the following properties: +- `isBoom` - if `true`, indicates this is a `Boom` object instance. +- `isServer` - convenience bool indicating status code >= 500. +- `message` - the error message. +- `output` - the formatted response. Can be directly manipulated after object construction to return a custom + error response. Allowed root keys: + - `statusCode` - the HTTP status code (typically 4xx or 5xx). + - `headers` - an object containing any HTTP headers where each key is a header name and value is the header content. + - `payload` - the formatted object used as the response payload (stringified). Can be directly manipulated but any + changes will be lost + if `reformat()` is called. Any content allowed and by default includes the following content: + - `statusCode` - the HTTP status code, derived from `error.output.statusCode`. + - `error` - the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from `statusCode`. + - `message` - the error message derived from `error.message`. +- inherited `Error` properties. + +The `Boom` object also supports the following method: +- `reformat()` - rebuilds `error.output` using the other object properties. + +## Helper Methods + +### `wrap(error, [statusCode], [message])` + +Decorates an error with the **boom** properties where: +- `error` - the error object to wrap. If `error` is already a **boom** object, returns back the same object. +- `statusCode` - optional HTTP status code. Defaults to `500`. +- `message` - optional message string. If the error already has a message, it adds the message as a prefix. + Defaults to no message. + +```js +var error = new Error('Unexpected input'); +Boom.wrap(error, 400); +``` + +### `create(statusCode, [message], [data])` + +Generates an `Error` object with the **boom** decorations where: +- `statusCode` - an HTTP error code number. Must be greater or equal 400. +- `message` - optional message string. +- `data` - additional error data set to `error.data` property. + +```js +var error = Boom.create(400, 'Bad request', { timestamp: Date.now() }); +``` + +## HTTP 4xx Errors + +### `Boom.badRequest([message], [data])` + +Returns a 400 Bad Request error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.badRequest('invalid query'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 400, + "error": "Bad Request", + "message": "invalid query" +} +``` + +### `Boom.unauthorized([message], [scheme], [attributes])` + +Returns a 401 Unauthorized error where: +- `message` - optional message. +- `scheme` can be one of the following: + - an authentication scheme name + - an array of string values. These values will be separated by ', ' and set to the 'WWW-Authenticate' header. +- `attributes` - an object of values to use while setting the 'WWW-Authenticate' header. This value is only used + when `scheme` is a string, otherwise it is ignored. Every key/value pair will be included in the + 'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the `attributes` key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null. + `null` and `undefined` will be replaced with an empty string. If `attributes` is set, `message` will be used as + the 'error' segment of the 'WWW-Authenticate' header. If `message` is unset, the 'error' segment of the header + will not be present and `isMissing` will be true on the error object. + +If either `scheme` or `attributes` are set, the resultant `Boom` object will have the 'WWW-Authenticate' header set for the response. + +```js +Boom.unauthorized('invalid password'); +``` + +Generates the following response: + +```json +"payload": { + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password" +}, +"headers" {} +``` + +```js +Boom.unauthorized('invalid password', 'sample'); +``` + +Generates the following response: + +```json +"payload": { + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password", + "attributes": { + "error": "invalid password" + } +}, +"headers" { + "WWW-Authenticate": "sample error=\"invalid password\"" +} +``` + +```js +Boom.unauthorized(null, 'Negotiate', 'VGhpcyBpcyBhIHRlc3QgdG9rZW4='); +``` + +Generates the following response: + +```json +"payload": { + "statusCode": 401, + "error": "Unauthorized", + "attributes": "VGhpcyBpcyBhIHRlc3QgdG9rZW4=" +}, +"headers" { + "WWW-Authenticate": "Negotiate VGhpcyBpcyBhIHRlc3QgdG9rZW4=" +} +``` + +```js +Boom.unauthorized('invalid password', 'sample', { ttl: 0, cache: null, foo: 'bar' }); +``` + +Generates the following response: + +```json +"payload": { + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password", + "attributes": { + "error": "invalid password", + "ttl": 0, + "cache": "", + "foo": "bar" + } +}, +"headers" { + "WWW-Authenticate": "sample ttl=\"0\", cache=\"\", foo=\"bar\", error=\"invalid password\"" +} +``` + +### `Boom.paymentRequired([message], [data])` + +Returns a 402 Payment Required error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.paymentRequired('bandwidth used'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 402, + "error": "Payment Required", + "message": "bandwidth used" +} +``` + +### `Boom.forbidden([message], [data])` + +Returns a 403 Forbidden error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.forbidden('try again some time'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 403, + "error": "Forbidden", + "message": "try again some time" +} +``` + +### `Boom.notFound([message], [data])` + +Returns a 404 Not Found error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.notFound('missing'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 404, + "error": "Not Found", + "message": "missing" +} +``` + +### `Boom.methodNotAllowed([message], [data], [allow])` + +Returns a 405 Method Not Allowed error where: +- `message` - optional message. +- `data` - optional additional error data. +- `allow` - optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header. + +```js +Boom.methodNotAllowed('that method is not allowed'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 405, + "error": "Method Not Allowed", + "message": "that method is not allowed" +} +``` + +### `Boom.notAcceptable([message], [data])` + +Returns a 406 Not Acceptable error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.notAcceptable('unacceptable'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 406, + "error": "Not Acceptable", + "message": "unacceptable" +} +``` + +### `Boom.proxyAuthRequired([message], [data])` + +Returns a 407 Proxy Authentication Required error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.proxyAuthRequired('auth missing'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 407, + "error": "Proxy Authentication Required", + "message": "auth missing" +} +``` + +### `Boom.clientTimeout([message], [data])` + +Returns a 408 Request Time-out error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.clientTimeout('timed out'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 408, + "error": "Request Time-out", + "message": "timed out" +} +``` + +### `Boom.conflict([message], [data])` + +Returns a 409 Conflict error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.conflict('there was a conflict'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 409, + "error": "Conflict", + "message": "there was a conflict" +} +``` + +### `Boom.resourceGone([message], [data])` + +Returns a 410 Gone error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.resourceGone('it is gone'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 410, + "error": "Gone", + "message": "it is gone" +} +``` + +### `Boom.lengthRequired([message], [data])` + +Returns a 411 Length Required error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.lengthRequired('length needed'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 411, + "error": "Length Required", + "message": "length needed" +} +``` + +### `Boom.preconditionFailed([message], [data])` + +Returns a 412 Precondition Failed error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.preconditionFailed(); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 412, + "error": "Precondition Failed" +} +``` + +### `Boom.entityTooLarge([message], [data])` + +Returns a 413 Request Entity Too Large error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.entityTooLarge('too big'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 413, + "error": "Request Entity Too Large", + "message": "too big" +} +``` + +### `Boom.uriTooLong([message], [data])` + +Returns a 414 Request-URI Too Large error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.uriTooLong('uri is too long'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 414, + "error": "Request-URI Too Large", + "message": "uri is too long" +} +``` + +### `Boom.unsupportedMediaType([message], [data])` + +Returns a 415 Unsupported Media Type error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.unsupportedMediaType('that media is not supported'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 415, + "error": "Unsupported Media Type", + "message": "that media is not supported" +} +``` + +### `Boom.rangeNotSatisfiable([message], [data])` + +Returns a 416 Requested Range Not Satisfiable error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.rangeNotSatisfiable(); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 416, + "error": "Requested Range Not Satisfiable" +} +``` + +### `Boom.expectationFailed([message], [data])` + +Returns a 417 Expectation Failed error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.expectationFailed('expected this to work'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 417, + "error": "Expectation Failed", + "message": "expected this to work" +} +``` + +### `Boom.teapot([message], [data])` + +Returns a 418 I'm a Teapot error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.teapot('sorry, no coffee...'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 418, + "error": "I'm a Teapot", + "message": "Sorry, no coffee..." +} +``` + +### `Boom.badData([message], [data])` + +Returns a 422 Unprocessable Entity error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.badData('your data is bad and you should feel bad'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 422, + "error": "Unprocessable Entity", + "message": "your data is bad and you should feel bad" +} +``` + +### `Boom.locked([message], [data])` + +Returns a 423 Locked error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.locked('this resource has been locked'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 423, + "error": "Locked", + "message": "this resource has been locked" +} +``` + +### `Boom.preconditionRequired([message], [data])` + +Returns a 428 Precondition Required error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.preconditionRequired('you must supply an If-Match header'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 428, + "error": "Precondition Required", + "message": "you must supply an If-Match header" +} +``` + +### `Boom.tooManyRequests([message], [data])` + +Returns a 429 Too Many Requests error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.tooManyRequests('you have exceeded your request limit'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 429, + "error": "Too Many Requests", + "message": "you have exceeded your request limit" +} +``` + +### `Boom.illegal([message], [data])` + +Returns a 451 Unavailable For Legal Reasons error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.illegal('you are not permitted to view this resource for legal reasons'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 451, + "error": "Unavailable For Legal Reasons", + "message": "you are not permitted to view this resource for legal reasons" +} +``` + +## HTTP 5xx Errors + +All 500 errors hide your message from the end user. Your message is recorded in the server log. + +### `Boom.badImplementation([message], [data])` - (*alias: `internal`*) + +Returns a 500 Internal Server Error error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.badImplementation('terrible implementation'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 500, + "error": "Internal Server Error", + "message": "An internal server error occurred" +} +``` + +### `Boom.notImplemented([message], [data])` + +Returns a 501 Not Implemented error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.notImplemented('method not implemented'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 501, + "error": "Not Implemented", + "message": "method not implemented" +} +``` + +### `Boom.badGateway([message], [data])` + +Returns a 502 Bad Gateway error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.badGateway('that is a bad gateway'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 502, + "error": "Bad Gateway", + "message": "that is a bad gateway" +} +``` + +### `Boom.serverUnavailable([message], [data])` + +Returns a 503 Service Unavailable error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.serverUnavailable('unavailable'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 503, + "error": "Service Unavailable", + "message": "unavailable" +} +``` + +### `Boom.gatewayTimeout([message], [data])` + +Returns a 504 Gateway Time-out error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.gatewayTimeout(); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 504, + "error": "Gateway Time-out" +} +``` + +## F.A.Q. + +**Q** How do I include extra information in my responses? `output.payload` is missing `data`, what gives? + +**A** There is a reason the values passed back in the response payloads are pretty locked down. It's mostly for security and to not leak any important information back to the client. This means you will need to put in a little more effort to include extra information about your custom error. Check out the ["Error transformation"](https://github.com/hapijs/hapi/blob/master/API.md#error-transformation) section in the hapi documentation. + +--- diff --git a/appasar/canary/node_modules/boom/lib/index.js b/appasar/canary/node_modules/boom/lib/index.js new file mode 100644 index 0000000..17ed027 --- /dev/null +++ b/appasar/canary/node_modules/boom/lib/index.js @@ -0,0 +1,433 @@ +'use strict'; + +// Load modules + +const Hoek = require('hoek'); + + +// Declare internals + +const internals = { + STATUS_CODES: Object.setPrototypeOf({ + '100': 'Continue', + '101': 'Switching Protocols', + '102': 'Processing', + '200': 'OK', + '201': 'Created', + '202': 'Accepted', + '203': 'Non-Authoritative Information', + '204': 'No Content', + '205': 'Reset Content', + '206': 'Partial Content', + '207': 'Multi-Status', + '300': 'Multiple Choices', + '301': 'Moved Permanently', + '302': 'Moved Temporarily', + '303': 'See Other', + '304': 'Not Modified', + '305': 'Use Proxy', + '307': 'Temporary Redirect', + '400': 'Bad Request', + '401': 'Unauthorized', + '402': 'Payment Required', + '403': 'Forbidden', + '404': 'Not Found', + '405': 'Method Not Allowed', + '406': 'Not Acceptable', + '407': 'Proxy Authentication Required', + '408': 'Request Time-out', + '409': 'Conflict', + '410': 'Gone', + '411': 'Length Required', + '412': 'Precondition Failed', + '413': 'Request Entity Too Large', + '414': 'Request-URI Too Large', + '415': 'Unsupported Media Type', + '416': 'Requested Range Not Satisfiable', + '417': 'Expectation Failed', + '418': 'I\'m a teapot', + '422': 'Unprocessable Entity', + '423': 'Locked', + '424': 'Failed Dependency', + '425': 'Unordered Collection', + '426': 'Upgrade Required', + '428': 'Precondition Required', + '429': 'Too Many Requests', + '431': 'Request Header Fields Too Large', + '451': 'Unavailable For Legal Reasons', + '500': 'Internal Server Error', + '501': 'Not Implemented', + '502': 'Bad Gateway', + '503': 'Service Unavailable', + '504': 'Gateway Time-out', + '505': 'HTTP Version Not Supported', + '506': 'Variant Also Negotiates', + '507': 'Insufficient Storage', + '509': 'Bandwidth Limit Exceeded', + '510': 'Not Extended', + '511': 'Network Authentication Required' + }, null) +}; + + +exports.wrap = function (error, statusCode, message) { + + Hoek.assert(error instanceof Error, 'Cannot wrap non-Error object'); + Hoek.assert(!error.isBoom || (!statusCode && !message), 'Cannot provide statusCode or message with boom error'); + + return (error.isBoom ? error : internals.initialize(error, statusCode || 500, message)); +}; + + +exports.create = function (statusCode, message, data) { + + return internals.create(statusCode, message, data, exports.create); +}; + + +internals.create = function (statusCode, message, data, ctor) { + + if (message instanceof Error) { + if (data) { + message.data = data; + } + return exports.wrap(message, statusCode); + } + + const error = new Error(message ? message : undefined); // Avoids settings null message + Error.captureStackTrace(error, ctor); // Filter the stack to our external API + error.data = data || null; + internals.initialize(error, statusCode); + return error; +}; + + +internals.initialize = function (error, statusCode, message) { + + const numberCode = parseInt(statusCode, 10); + Hoek.assert(!isNaN(numberCode) && numberCode >= 400, 'First argument must be a number (400+):', statusCode); + + error.isBoom = true; + error.isServer = numberCode >= 500; + + if (!error.hasOwnProperty('data')) { + error.data = null; + } + + error.output = { + statusCode: numberCode, + payload: {}, + headers: {} + }; + + error.reformat = internals.reformat; + error.reformat(); + + if (!message && + !error.message) { + + message = error.output.payload.error; + } + + if (message) { + error.message = (message + (error.message ? ': ' + error.message : '')); + } + + return error; +}; + + +internals.reformat = function () { + + this.output.payload.statusCode = this.output.statusCode; + this.output.payload.error = internals.STATUS_CODES[this.output.statusCode] || 'Unknown'; + + if (this.output.statusCode === 500) { + this.output.payload.message = 'An internal server error occurred'; // Hide actual error from user + } + else if (this.message) { + this.output.payload.message = this.message; + } +}; + + +// 4xx Client Errors + +exports.badRequest = function (message, data) { + + return internals.create(400, message, data, exports.badRequest); +}; + + +exports.unauthorized = function (message, scheme, attributes) { // Or function (message, wwwAuthenticate[]) + + const err = internals.create(401, message, undefined, exports.unauthorized); + + if (!scheme) { + return err; + } + + let wwwAuthenticate = ''; + + if (typeof scheme === 'string') { + + // function (message, scheme, attributes) + + wwwAuthenticate = scheme; + + if (attributes || message) { + err.output.payload.attributes = {}; + } + + if (attributes) { + if (typeof attributes === 'string') { + wwwAuthenticate = wwwAuthenticate + ' ' + Hoek.escapeHeaderAttribute(attributes); + err.output.payload.attributes = attributes; + } + else { + const names = Object.keys(attributes); + for (let i = 0; i < names.length; ++i) { + const name = names[i]; + if (i) { + wwwAuthenticate = wwwAuthenticate + ','; + } + + let value = attributes[name]; + if (value === null || + value === undefined) { // Value can be zero + + value = ''; + } + wwwAuthenticate = wwwAuthenticate + ' ' + name + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"'; + err.output.payload.attributes[name] = value; + } + } + } + + + if (message) { + if (attributes) { + wwwAuthenticate = wwwAuthenticate + ','; + } + wwwAuthenticate = wwwAuthenticate + ' error="' + Hoek.escapeHeaderAttribute(message) + '"'; + err.output.payload.attributes.error = message; + } + else { + err.isMissing = true; + } + } + else { + + // function (message, wwwAuthenticate[]) + + const wwwArray = scheme; + for (let i = 0; i < wwwArray.length; ++i) { + if (i) { + wwwAuthenticate = wwwAuthenticate + ', '; + } + + wwwAuthenticate = wwwAuthenticate + wwwArray[i]; + } + } + + err.output.headers['WWW-Authenticate'] = wwwAuthenticate; + + return err; +}; + + +exports.paymentRequired = function (message, data) { + + return internals.create(402, message, data, exports.paymentRequired); +}; + + +exports.forbidden = function (message, data) { + + return internals.create(403, message, data, exports.forbidden); +}; + + +exports.notFound = function (message, data) { + + return internals.create(404, message, data, exports.notFound); +}; + + +exports.methodNotAllowed = function (message, data, allow) { + + const err = internals.create(405, message, data, exports.methodNotAllowed); + + if (typeof allow === 'string') { + allow = [allow]; + } + + if (Array.isArray(allow)) { + err.output.headers.Allow = allow.join(', '); + } + + return err; +}; + + +exports.notAcceptable = function (message, data) { + + return internals.create(406, message, data, exports.notAcceptable); +}; + + +exports.proxyAuthRequired = function (message, data) { + + return internals.create(407, message, data, exports.proxyAuthRequired); +}; + + +exports.clientTimeout = function (message, data) { + + return internals.create(408, message, data, exports.clientTimeout); +}; + + +exports.conflict = function (message, data) { + + return internals.create(409, message, data, exports.conflict); +}; + + +exports.resourceGone = function (message, data) { + + return internals.create(410, message, data, exports.resourceGone); +}; + + +exports.lengthRequired = function (message, data) { + + return internals.create(411, message, data, exports.lengthRequired); +}; + + +exports.preconditionFailed = function (message, data) { + + return internals.create(412, message, data, exports.preconditionFailed); +}; + + +exports.entityTooLarge = function (message, data) { + + return internals.create(413, message, data, exports.entityTooLarge); +}; + + +exports.uriTooLong = function (message, data) { + + return internals.create(414, message, data, exports.uriTooLong); +}; + + +exports.unsupportedMediaType = function (message, data) { + + return internals.create(415, message, data, exports.unsupportedMediaType); +}; + + +exports.rangeNotSatisfiable = function (message, data) { + + return internals.create(416, message, data, exports.rangeNotSatisfiable); +}; + + +exports.expectationFailed = function (message, data) { + + return internals.create(417, message, data, exports.expectationFailed); +}; + + +exports.teapot = function (message, data) { + + return internals.create(418, message, data, exports.teapot); +}; + + +exports.badData = function (message, data) { + + return internals.create(422, message, data, exports.badData); +}; + + +exports.locked = function (message, data) { + + return internals.create(423, message, data, exports.locked); +}; + + +exports.preconditionRequired = function (message, data) { + + return internals.create(428, message, data, exports.preconditionRequired); +}; + + +exports.tooManyRequests = function (message, data) { + + return internals.create(429, message, data, exports.tooManyRequests); +}; + + +exports.illegal = function (message, data) { + + return internals.create(451, message, data, exports.illegal); +}; + + +// 5xx Server Errors + +exports.internal = function (message, data, statusCode) { + + return internals.serverError(message, data, statusCode, exports.internal); +}; + + +internals.serverError = function (message, data, statusCode, ctor) { + + let error; + if (data instanceof Error) { + error = exports.wrap(data, statusCode, message); + } + else { + error = internals.create(statusCode || 500, message, undefined, ctor); + error.data = data; + } + + return error; +}; + + +exports.notImplemented = function (message, data) { + + return internals.serverError(message, data, 501, exports.notImplemented); +}; + + +exports.badGateway = function (message, data) { + + return internals.serverError(message, data, 502, exports.badGateway); +}; + + +exports.serverUnavailable = function (message, data) { + + return internals.serverError(message, data, 503, exports.serverUnavailable); +}; + + +exports.gatewayTimeout = function (message, data) { + + return internals.serverError(message, data, 504, exports.gatewayTimeout); +}; + + +exports.badImplementation = function (message, data) { + + const err = internals.serverError(message, data, 500, exports.badImplementation); + err.isDeveloperError = true; + return err; +}; diff --git a/appasar/canary/node_modules/boom/package.json b/appasar/canary/node_modules/boom/package.json new file mode 100644 index 0000000..e41e162 --- /dev/null +++ b/appasar/canary/node_modules/boom/package.json @@ -0,0 +1,29 @@ +{ + "name": "boom", + "description": "HTTP-friendly error objects", + "version": "4.3.1", + "repository": "git://github.com/hapijs/boom", + "main": "lib/index.js", + "keywords": [ + "error", + "http" + ], + "engines": { + "node": ">=4.0.0" + }, + "dependencies": { + "hoek": "4.x.x" + }, + "devDependencies": { + "code": "4.x.x", + "lab": "13.x.x", + "markdown-toc": "0.12.x" + }, + "scripts": { + "test": "lab -a code -t 100 -L -v", + "test-cov-html": "lab -a code -r html -o coverage.html -L", + "toc": "node generate-toc.js", + "version": "npm run toc && git add README.md" + }, + "license": "BSD-3-Clause" +} diff --git a/appasar/canary/node_modules/brace-expansion/README.md b/appasar/canary/node_modules/brace-expansion/README.md new file mode 100644 index 0000000..ed2ec1f --- /dev/null +++ b/appasar/canary/node_modules/brace-expansion/README.md @@ -0,0 +1,123 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/brace-expansion/index.js b/appasar/canary/node_modules/brace-expansion/index.js new file mode 100644 index 0000000..0478be8 --- /dev/null +++ b/appasar/canary/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/appasar/canary/node_modules/brace-expansion/package.json b/appasar/canary/node_modules/brace-expansion/package.json new file mode 100644 index 0000000..66f952a --- /dev/null +++ b/appasar/canary/node_modules/brace-expansion/package.json @@ -0,0 +1,47 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.8", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh", + "bench": "matcha test/perf/bench.js" + }, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/appasar/canary/node_modules/buffer-crc32/LICENSE b/appasar/canary/node_modules/buffer-crc32/LICENSE new file mode 100644 index 0000000..4cef10e --- /dev/null +++ b/appasar/canary/node_modules/buffer-crc32/LICENSE @@ -0,0 +1,19 @@ +The MIT License + +Copyright (c) 2013 Brian J. Brennan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/buffer-crc32/README.md b/appasar/canary/node_modules/buffer-crc32/README.md new file mode 100644 index 0000000..0d9d8b8 --- /dev/null +++ b/appasar/canary/node_modules/buffer-crc32/README.md @@ -0,0 +1,47 @@ +# buffer-crc32 + +[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32) + +crc32 that works with binary data and fancy character sets, outputs +buffer, signed or unsigned data and has tests. + +Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix + +# install +``` +npm install buffer-crc32 +``` + +# example +```js +var crc32 = require('buffer-crc32'); +// works with buffers +var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]) +crc32(buf) // -> <Buffer 94 5a ab 4a> + +// has convenience methods for getting signed or unsigned ints +crc32.signed(buf) // -> -1805997238 +crc32.unsigned(buf) // -> 2488970058 + +// will cast to buffer if given a string, so you can +// directly use foreign characters safely +crc32('自動販売機') // -> <Buffer cb 03 1a c5> + +// and works in append mode too +var partialCrc = crc32('hey'); +var partialCrc = crc32(' ', partialCrc); +var partialCrc = crc32('sup', partialCrc); +var partialCrc = crc32(' ', partialCrc); +var finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70> +``` + +# tests +This was tested against the output of zlib's crc32 method. You can run +the tests with`npm test` (requires tap) + +# see also +https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also +supports buffer inputs and return unsigned ints (thanks @tjholowaychuk). + +# license +MIT/X11 diff --git a/appasar/canary/node_modules/buffer-crc32/index.js b/appasar/canary/node_modules/buffer-crc32/index.js new file mode 100644 index 0000000..6727dd3 --- /dev/null +++ b/appasar/canary/node_modules/buffer-crc32/index.js @@ -0,0 +1,111 @@ +var Buffer = require('buffer').Buffer; + +var CRC_TABLE = [ + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d +]; + +if (typeof Int32Array !== 'undefined') { + CRC_TABLE = new Int32Array(CRC_TABLE); +} + +function ensureBuffer(input) { + if (Buffer.isBuffer(input)) { + return input; + } + + var hasNewBufferAPI = + typeof Buffer.alloc === "function" && + typeof Buffer.from === "function"; + + if (typeof input === "number") { + return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input); + } + else if (typeof input === "string") { + return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input); + } + else { + throw new Error("input must be buffer, number, or string, received " + + typeof input); + } +} + +function bufferizeInt(num) { + var tmp = ensureBuffer(4); + tmp.writeInt32BE(num, 0); + return tmp; +} + +function _crc32(buf, previous) { + buf = ensureBuffer(buf); + if (Buffer.isBuffer(previous)) { + previous = previous.readUInt32BE(0); + } + var crc = ~~previous ^ -1; + for (var n = 0; n < buf.length; n++) { + crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8); + } + return (crc ^ -1); +} + +function crc32() { + return bufferizeInt(_crc32.apply(null, arguments)); +} +crc32.signed = function () { + return _crc32.apply(null, arguments); +}; +crc32.unsigned = function () { + return _crc32.apply(null, arguments) >>> 0; +}; + +module.exports = crc32; diff --git a/appasar/canary/node_modules/buffer-crc32/package.json b/appasar/canary/node_modules/buffer-crc32/package.json new file mode 100644 index 0000000..e896bec --- /dev/null +++ b/appasar/canary/node_modules/buffer-crc32/package.json @@ -0,0 +1,39 @@ +{ + "author": "Brian J. Brennan <brianloveswords@gmail.com>", + "name": "buffer-crc32", + "description": "A pure javascript CRC32 algorithm that plays nice with binary data", + "version": "0.2.13", + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/brianloveswords/buffer-crc32/raw/master/LICENSE" + } + ], + "contributors": [ + { + "name": "Vladimir Kuznetsov", + "github": "mistakster" + } + ], + "homepage": "https://github.com/brianloveswords/buffer-crc32", + "repository": { + "type": "git", + "url": "git://github.com/brianloveswords/buffer-crc32.git" + }, + "main": "index.js", + "scripts": { + "test": "./node_modules/.bin/tap tests/*.test.js" + }, + "dependencies": {}, + "devDependencies": { + "tap": "~0.2.5" + }, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "license": "MIT", + "files": [ + "index.js" + ] +} diff --git a/appasar/canary/node_modules/caseless/LICENSE b/appasar/canary/node_modules/caseless/LICENSE new file mode 100644 index 0000000..61789f4 --- /dev/null +++ b/appasar/canary/node_modules/caseless/LICENSE @@ -0,0 +1,28 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +1. Definitions. +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +You must give any other recipients of the Work or Derivative Works a copy of this License; and +You must cause any modified files to carry prominent notices stating that You changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/appasar/canary/node_modules/caseless/README.md b/appasar/canary/node_modules/caseless/README.md new file mode 100644 index 0000000..e5077a2 --- /dev/null +++ b/appasar/canary/node_modules/caseless/README.md @@ -0,0 +1,45 @@ +## Caseless -- wrap an object to set and get property with caseless semantics but also preserve caseing. + +This library is incredibly useful when working with HTTP headers. It allows you to get/set/check for headers in a caseless manner while also preserving the caseing of headers the first time they are set. + +## Usage + +```javascript +var headers = {} + , c = caseless(headers) + ; +c.set('a-Header', 'asdf') +c.get('a-header') === 'asdf' +``` + +## has(key) + +Has takes a name and if it finds a matching header will return that header name with the preserved caseing it was set with. + +```javascript +c.has('a-header') === 'a-Header' +``` + +## set(key, value[, clobber=true]) + +Set is fairly straight forward except that if the header exists and clobber is disabled it will add `','+value` to the existing header. + +```javascript +c.set('a-Header', 'fdas') +c.set('a-HEADER', 'more', false) +c.get('a-header') === 'fdsa,more' +``` + +## swap(key) + +Swaps the casing of a header with the new one that is passed in. + +```javascript +var headers = {} + , c = caseless(headers) + ; +c.set('a-Header', 'fdas') +c.swap('a-HEADER') +c.has('a-header') === 'a-HEADER' +headers === {'a-HEADER': 'fdas'} +``` diff --git a/appasar/canary/node_modules/caseless/index.js b/appasar/canary/node_modules/caseless/index.js new file mode 100644 index 0000000..b194734 --- /dev/null +++ b/appasar/canary/node_modules/caseless/index.js @@ -0,0 +1,67 @@ +function Caseless (dict) { + this.dict = dict || {} +} +Caseless.prototype.set = function (name, value, clobber) { + if (typeof name === 'object') { + for (var i in name) { + this.set(i, name[i], value) + } + } else { + if (typeof clobber === 'undefined') clobber = true + var has = this.has(name) + + if (!clobber && has) this.dict[has] = this.dict[has] + ',' + value + else this.dict[has || name] = value + return has + } +} +Caseless.prototype.has = function (name) { + var keys = Object.keys(this.dict) + , name = name.toLowerCase() + ; + for (var i=0;i<keys.length;i++) { + if (keys[i].toLowerCase() === name) return keys[i] + } + return false +} +Caseless.prototype.get = function (name) { + name = name.toLowerCase() + var result, _key + var headers = this.dict + Object.keys(headers).forEach(function (key) { + _key = key.toLowerCase() + if (name === _key) result = headers[key] + }) + return result +} +Caseless.prototype.swap = function (name) { + var has = this.has(name) + if (has === name) return + if (!has) throw new Error('There is no header than matches "'+name+'"') + this.dict[name] = this.dict[has] + delete this.dict[has] +} +Caseless.prototype.del = function (name) { + var has = this.has(name) + return delete this.dict[has || name] +} + +module.exports = function (dict) {return new Caseless(dict)} +module.exports.httpify = function (resp, headers) { + var c = new Caseless(headers) + resp.setHeader = function (key, value, clobber) { + if (typeof value === 'undefined') return + return c.set(key, value, clobber) + } + resp.hasHeader = function (key) { + return c.has(key) + } + resp.getHeader = function (key) { + return c.get(key) + } + resp.removeHeader = function (key) { + return c.del(key) + } + resp.headers = c.dict + return c +} diff --git a/appasar/canary/node_modules/caseless/package.json b/appasar/canary/node_modules/caseless/package.json new file mode 100644 index 0000000..408a6e1 --- /dev/null +++ b/appasar/canary/node_modules/caseless/package.json @@ -0,0 +1,27 @@ +{ + "name": "caseless", + "version": "0.12.0", + "description": "Caseless object set/get/has, very useful when working with HTTP headers.", + "main": "index.js", + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/mikeal/caseless" + }, + "keywords": [ + "headers", + "http", + "caseless" + ], + "test": "node test.js", + "author": "Mikeal Rogers <mikeal.rogers@gmail.com>", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/mikeal/caseless/issues" + }, + "devDependencies": { + "tape": "^2.10.2" + } +} diff --git a/appasar/canary/node_modules/caseless/test.js b/appasar/canary/node_modules/caseless/test.js new file mode 100644 index 0000000..f55196c --- /dev/null +++ b/appasar/canary/node_modules/caseless/test.js @@ -0,0 +1,67 @@ +var tape = require('tape') + , caseless = require('./') + ; + +tape('set get has', function (t) { + var headers = {} + , c = caseless(headers) + ; + t.plan(17) + c.set('a-Header', 'asdf') + t.equal(c.get('a-header'), 'asdf') + t.equal(c.has('a-header'), 'a-Header') + t.ok(!c.has('nothing')) + // old bug where we used the wrong regex + t.ok(!c.has('a-hea')) + c.set('a-header', 'fdsa') + t.equal(c.get('a-header'), 'fdsa') + t.equal(c.get('a-Header'), 'fdsa') + c.set('a-HEADER', 'more', false) + t.equal(c.get('a-header'), 'fdsa,more') + + t.deepEqual(headers, {'a-Header': 'fdsa,more'}) + c.swap('a-HEADER') + t.deepEqual(headers, {'a-HEADER': 'fdsa,more'}) + + c.set('deleteme', 'foobar') + t.ok(c.has('deleteme')) + t.ok(c.del('deleteme')) + t.notOk(c.has('deleteme')) + t.notOk(c.has('idonotexist')) + t.ok(c.del('idonotexist')) + + c.set('tva', 'test1') + c.set('tva-header', 'test2') + t.equal(c.has('tva'), 'tva') + t.notOk(c.has('header')) + + t.equal(c.get('tva'), 'test1') + +}) + +tape('swap', function (t) { + var headers = {} + , c = caseless(headers) + ; + t.plan(4) + // No Header to Swap. + t.throws(function () { + c.swap('content-type') + }) + // Set Header. + c.set('content-type', 'application/json') + // Swap Header With Itself. + c.swap('content-type') + // Does Not Delete Itself. + t.ok(c.has('content-type')) + // Swap Header With a Different Header. + c.swap('Content-Type') + // Still Has Header. + t.ok(c.has('Content-Type')) + // Delete Header. + c.del('Content-Type') + // No Header to Swap. + t.throws(function () { + c.swap('content-type') + }) +}) diff --git a/appasar/canary/node_modules/co/History.md b/appasar/canary/node_modules/co/History.md new file mode 100644 index 0000000..68fbb15 --- /dev/null +++ b/appasar/canary/node_modules/co/History.md @@ -0,0 +1,172 @@ +4.6.0 / 2015-07-09 +================== + + * support passing the rest of the arguments to co into the generator + + ```js + function *gen(...args) { } + co(gen, ...args); + ``` + +4.5.0 / 2015-03-17 +================== + + * support regular functions (that return promises) + +4.4.0 / 2015-02-14 +================== + + * refactor `isGeneratorFunction` + * expose generator function from `co.wrap()` + * drop support for node < 0.12 + +4.3.0 / 2015-02-05 +================== + + * check for generator functions in a ES5-transpiler-friendly way + +4.2.0 / 2015-01-20 +================== + + * support comparing generator functions with ES6 transpilers + +4.1.0 / 2014-12-26 +================== + + * fix memory leak #180 + +4.0.2 / 2014-12-18 +================== + + * always return a global promise implementation + +4.0.1 / 2014-11-30 +================== + + * friendlier ES6 module exports + +4.0.0 / 2014-11-15 +================== + + * co now returns a promise and uses promises underneath + * `co.wrap()` for wrapping generator functions + +3.1.0 / 2014-06-30 +================== + + * remove `setImmediate()` shim for node 0.8. semi-backwards breaking. + Users are expected to shim themselves. Also returns CommonJS browser support. + * added key order preservation for objects. thanks @greim + * replace `q` with `bluebird` in benchmarks and tests + +3.0.6 / 2014-05-03 +================== + + * add `setImmediate()` fallback to `process.nextTick` + * remove duplicate code in toThunk + * update thunkify + +3.0.5 / 2014-03-17 +================== + + * fix object/array test failure which tries to enumerate dates. Closes #98 + * fix final callback error propagation. Closes #92 + +3.0.4 / 2014-02-17 +================== + + * fix toThunk object check regression. Closes #89 + +3.0.3 / 2014-02-08 +================== + + * refactor: arrayToThunk @AutoSponge #88 + +3.0.2 / 2014-01-01 +================== + + * fixed: nil arguments replaced with error fn + +3.0.1 / 2013-12-19 +================== + + * fixed: callback passed as an argument to generators + +3.0.0 / 2013-12-19 +================== + + * fixed: callback passed as an argument to generators + * change: `co(function *(){})` now returns a reusable thunk + * change: `this` must now be passed through the returned thunk, ex. `co(function *(){}).call(this)` + * fix "generator already finished" errors + +2.3.0 / 2013-11-12 +================== + + * add `yield object` support + +2.2.0 / 2013-11-05 +================== + + * change: make the `isGenerator()` function more generic + +2.1.0 / 2013-10-21 +================== + + * add passing of arguments into the generator. closes #33. + +2.0.0 / 2013-10-14 +================== + + * remove callback in favour of thunk-only co(). Closes #30 [breaking change] + * remove `co.wrap()` [breaking change] + +1.5.2 / 2013-09-02 +================== + + * fix: preserve receiver with co.wrap() + +1.5.1 / 2013-08-11 +================== + + * remove setImmediate() usage - ~110% perf increase. Closes #14 + +0.5.0 / 2013-08-10 +================== + + * add receiver propagation support + * examples: update streams.js example to use `http.get()` and streams2 API + +1.4.1 / 2013-07-01 +================== + + * fix gen.next(val) for latest v8. Closes #8 + +1.4.0 / 2013-06-21 +================== + + * add promise support to joins + * add `yield generatorFunction` support + * add `yield generator` support + * add nested join support + +1.3.0 / 2013-06-10 +================== + + * add passing of arguments + +1.2.1 / 2013-06-08 +================== + + * fix join() of zero thunks + +1.2.0 / 2013-06-08 +================== + + * add array yielding support. great suggestion by @domenic + +1.1.0 / 2013-06-06 +================== + + * add promise support + * change nextTick to setImmediate diff --git a/appasar/canary/node_modules/co/LICENSE b/appasar/canary/node_modules/co/LICENSE new file mode 100644 index 0000000..92faba5 --- /dev/null +++ b/appasar/canary/node_modules/co/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/co/Readme.md b/appasar/canary/node_modules/co/Readme.md new file mode 100644 index 0000000..c1d4882 --- /dev/null +++ b/appasar/canary/node_modules/co/Readme.md @@ -0,0 +1,212 @@ +# co + +[![Gitter][gitter-image]][gitter-url] +[![NPM version][npm-image]][npm-url] +[![Build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![Downloads][downloads-image]][downloads-url] + + Generator based control flow goodness for nodejs and the browser, + using promises, letting you write non-blocking code in a nice-ish way. + +## Co v4 + + `co@4.0.0` has been released, which now relies on promises. + It is a stepping stone towards [ES7 async/await](https://github.com/lukehoban/ecmascript-asyncawait). + The primary API change is how `co()` is invoked. + Before, `co` returned a "thunk", which you then called with a callback and optional arguments. + Now, `co()` returns a promise. + +```js +co(function* () { + var result = yield Promise.resolve(true); + return result; +}).then(function (value) { + console.log(value); +}, function (err) { + console.error(err.stack); +}); +``` + + If you want to convert a `co`-generator-function into a regular function that returns a promise, + you now use `co.wrap(fn*)`. + +```js +var fn = co.wrap(function* (val) { + return yield Promise.resolve(val); +}); + +fn(true).then(function (val) { + +}); +``` + +## Platform Compatibility + + `co@4+` requires a `Promise` implementation. + For versions of node `< 0.11` and for many older browsers, + you should/must include your own `Promise` polyfill. + + When using node 0.11.x or greater, you must use the `--harmony-generators` + flag or just `--harmony` to get access to generators. + + When using node 0.10.x and lower or browsers without generator support, + you must use [gnode](https://github.com/TooTallNate/gnode) and/or [regenerator](http://facebook.github.io/regenerator/). + + io.js is supported out of the box, you can use `co` without flags or polyfills. + +## Installation + +``` +$ npm install co +``` + +## Associated libraries + +Any library that returns promises work well with `co`. + +- [mz](https://github.com/normalize/mz) - wrap all of node's code libraries as promises. + +View the [wiki](https://github.com/visionmedia/co/wiki) for more libraries. + +## Examples + +```js +var co = require('co'); + +co(function *(){ + // yield any promise + var result = yield Promise.resolve(true); +}).catch(onerror); + +co(function *(){ + // resolve multiple promises in parallel + var a = Promise.resolve(1); + var b = Promise.resolve(2); + var c = Promise.resolve(3); + var res = yield [a, b, c]; + console.log(res); + // => [1, 2, 3] +}).catch(onerror); + +// errors can be try/catched +co(function *(){ + try { + yield Promise.reject(new Error('boom')); + } catch (err) { + console.error(err.message); // "boom" + } +}).catch(onerror); + +function onerror(err) { + // log any uncaught errors + // co will not throw any errors you do not handle!!! + // HANDLE ALL YOUR ERRORS!!! + console.error(err.stack); +} +``` + +## Yieldables + + The `yieldable` objects currently supported are: + + - promises + - thunks (functions) + - array (parallel execution) + - objects (parallel execution) + - generators (delegation) + - generator functions (delegation) + +Nested `yieldable` objects are supported, meaning you can nest +promises within objects within arrays, and so on! + +### Promises + +[Read more on promises!](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) + +### Thunks + +Thunks are functions that only have a single argument, a callback. +Thunk support only remains for backwards compatibility and may +be removed in future versions of `co`. + +### Arrays + +`yield`ing an array will resolve all the `yieldables` in parallel. + +```js +co(function* () { + var res = yield [ + Promise.resolve(1), + Promise.resolve(2), + Promise.resolve(3), + ]; + console.log(res); // => [1, 2, 3] +}).catch(onerror); +``` + +### Objects + +Just like arrays, objects resolve all `yieldable`s in parallel. + +```js +co(function* () { + var res = yield { + 1: Promise.resolve(1), + 2: Promise.resolve(2), + }; + console.log(res); // => { 1: 1, 2: 2 } +}).catch(onerror); +``` + +### Generators and Generator Functions + +Any generator or generator function you can pass into `co` +can be yielded as well. This should generally be avoided +as we should be moving towards spec-compliant `Promise`s instead. + +## API + +### co(fn*).then( val => ) + +Returns a promise that resolves a generator, generator function, +or any function that returns a generator. + +```js +co(function* () { + return yield Promise.resolve(true); +}).then(function (val) { + console.log(val); +}, function (err) { + console.error(err.stack); +}); +``` + +### var fn = co.wrap(fn*) + +Convert a generator into a regular function that returns a `Promise`. + +```js +var fn = co.wrap(function* (val) { + return yield Promise.resolve(val); +}); + +fn(true).then(function (val) { + +}); +``` + +## License + + MIT + +[npm-image]: https://img.shields.io/npm/v/co.svg?style=flat-square +[npm-url]: https://npmjs.org/package/co +[travis-image]: https://img.shields.io/travis/tj/co.svg?style=flat-square +[travis-url]: https://travis-ci.org/tj/co +[coveralls-image]: https://img.shields.io/coveralls/tj/co.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/tj/co +[downloads-image]: http://img.shields.io/npm/dm/co.svg?style=flat-square +[downloads-url]: https://npmjs.org/package/co +[gitter-image]: https://badges.gitter.im/Join%20Chat.svg +[gitter-url]: https://gitter.im/tj/co?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge diff --git a/appasar/canary/node_modules/co/index.js b/appasar/canary/node_modules/co/index.js new file mode 100644 index 0000000..87ba8ba --- /dev/null +++ b/appasar/canary/node_modules/co/index.js @@ -0,0 +1,237 @@ + +/** + * slice() reference. + */ + +var slice = Array.prototype.slice; + +/** + * Expose `co`. + */ + +module.exports = co['default'] = co.co = co; + +/** + * Wrap the given generator `fn` into a + * function that returns a promise. + * This is a separate function so that + * every `co()` call doesn't create a new, + * unnecessary closure. + * + * @param {GeneratorFunction} fn + * @return {Function} + * @api public + */ + +co.wrap = function (fn) { + createPromise.__generatorFunction__ = fn; + return createPromise; + function createPromise() { + return co.call(this, fn.apply(this, arguments)); + } +}; + +/** + * Execute the generator function or a generator + * and return a promise. + * + * @param {Function} fn + * @return {Promise} + * @api public + */ + +function co(gen) { + var ctx = this; + var args = slice.call(arguments, 1) + + // we wrap everything in a promise to avoid promise chaining, + // which leads to memory leak errors. + // see https://github.com/tj/co/issues/180 + return new Promise(function(resolve, reject) { + if (typeof gen === 'function') gen = gen.apply(ctx, args); + if (!gen || typeof gen.next !== 'function') return resolve(gen); + + onFulfilled(); + + /** + * @param {Mixed} res + * @return {Promise} + * @api private + */ + + function onFulfilled(res) { + var ret; + try { + ret = gen.next(res); + } catch (e) { + return reject(e); + } + next(ret); + } + + /** + * @param {Error} err + * @return {Promise} + * @api private + */ + + function onRejected(err) { + var ret; + try { + ret = gen.throw(err); + } catch (e) { + return reject(e); + } + next(ret); + } + + /** + * Get the next value in the generator, + * return a promise. + * + * @param {Object} ret + * @return {Promise} + * @api private + */ + + function next(ret) { + if (ret.done) return resolve(ret.value); + var value = toPromise.call(ctx, ret.value); + if (value && isPromise(value)) return value.then(onFulfilled, onRejected); + return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, ' + + 'but the following object was passed: "' + String(ret.value) + '"')); + } + }); +} + +/** + * Convert a `yield`ed value into a promise. + * + * @param {Mixed} obj + * @return {Promise} + * @api private + */ + +function toPromise(obj) { + if (!obj) return obj; + if (isPromise(obj)) return obj; + if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj); + if ('function' == typeof obj) return thunkToPromise.call(this, obj); + if (Array.isArray(obj)) return arrayToPromise.call(this, obj); + if (isObject(obj)) return objectToPromise.call(this, obj); + return obj; +} + +/** + * Convert a thunk to a promise. + * + * @param {Function} + * @return {Promise} + * @api private + */ + +function thunkToPromise(fn) { + var ctx = this; + return new Promise(function (resolve, reject) { + fn.call(ctx, function (err, res) { + if (err) return reject(err); + if (arguments.length > 2) res = slice.call(arguments, 1); + resolve(res); + }); + }); +} + +/** + * Convert an array of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Array} obj + * @return {Promise} + * @api private + */ + +function arrayToPromise(obj) { + return Promise.all(obj.map(toPromise, this)); +} + +/** + * Convert an object of "yieldables" to a promise. + * Uses `Promise.all()` internally. + * + * @param {Object} obj + * @return {Promise} + * @api private + */ + +function objectToPromise(obj){ + var results = new obj.constructor(); + var keys = Object.keys(obj); + var promises = []; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var promise = toPromise.call(this, obj[key]); + if (promise && isPromise(promise)) defer(promise, key); + else results[key] = obj[key]; + } + return Promise.all(promises).then(function () { + return results; + }); + + function defer(promise, key) { + // predefine the key in the result + results[key] = undefined; + promises.push(promise.then(function (res) { + results[key] = res; + })); + } +} + +/** + * Check if `obj` is a promise. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + +function isPromise(obj) { + return 'function' == typeof obj.then; +} + +/** + * Check if `obj` is a generator. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ + +function isGenerator(obj) { + return 'function' == typeof obj.next && 'function' == typeof obj.throw; +} + +/** + * Check if `obj` is a generator function. + * + * @param {Mixed} obj + * @return {Boolean} + * @api private + */ +function isGeneratorFunction(obj) { + var constructor = obj.constructor; + if (!constructor) return false; + if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true; + return isGenerator(constructor.prototype); +} + +/** + * Check for plain object. + * + * @param {Mixed} val + * @return {Boolean} + * @api private + */ + +function isObject(val) { + return Object == val.constructor; +} diff --git a/appasar/canary/node_modules/co/package.json b/appasar/canary/node_modules/co/package.json new file mode 100644 index 0000000..083d594 --- /dev/null +++ b/appasar/canary/node_modules/co/package.json @@ -0,0 +1,34 @@ +{ + "name": "co", + "version": "4.6.0", + "description": "generator async control flow goodness", + "keywords": [ + "async", + "flow", + "generator", + "coro", + "coroutine" + ], + "devDependencies": { + "browserify": "^10.0.0", + "istanbul-harmony": "0", + "mocha": "^2.0.0", + "mz": "^1.0.2" + }, + "scripts": { + "test": "mocha --harmony", + "test-cov": "node --harmony node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter dot", + "test-travis": "node --harmony node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- --reporter dot", + "prepublish": "npm run browserify", + "browserify": "browserify index.js -o ./co-browser.js -s co" + }, + "files": [ + "index.js" + ], + "license": "MIT", + "repository": "tj/co", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } +} diff --git a/appasar/canary/node_modules/combined-stream/License b/appasar/canary/node_modules/combined-stream/License new file mode 100644 index 0000000..4804b7a --- /dev/null +++ b/appasar/canary/node_modules/combined-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited <felix@debuggable.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/appasar/canary/node_modules/combined-stream/Readme.md b/appasar/canary/node_modules/combined-stream/Readme.md new file mode 100644 index 0000000..3a9e025 --- /dev/null +++ b/appasar/canary/node_modules/combined-stream/Readme.md @@ -0,0 +1,138 @@ +# combined-stream + +A stream that emits multiple other streams one after another. + +**NB** Currently `combined-stream` works with streams vesrion 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatability with `combined-stream`. + +- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module. + +- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another. + +## Installation + +``` bash +npm install combined-stream +``` + +## Usage + +Here is a simple example that shows how you can use combined-stream to combine +two files into one: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +While the example above works great, it will pause all source streams until +they are needed. If you don't want that to happen, you can set `pauseStreams` +to `false`: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create({pauseStreams: false}); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +However, what if you don't have all the source streams yet, or you don't want +to allocate the resources (file descriptors, memory, etc.) for them right away? +Well, in that case you can simply provide a callback that supplies the stream +by calling a `next()` function: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(function(next) { + next(fs.createReadStream('file1.txt')); +}); +combinedStream.append(function(next) { + next(fs.createReadStream('file2.txt')); +}); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +## API + +### CombinedStream.create([options]) + +Returns a new combined stream object. Available options are: + +* `maxDataSize` +* `pauseStreams` + +The effect of those options is described below. + +### combinedStream.pauseStreams = `true` + +Whether to apply back pressure to the underlaying streams. If set to `false`, +the underlaying streams will never be paused. If set to `true`, the +underlaying streams will be paused right after being appended, as well as when +`delayedStream.pipe()` wants to throttle. + +### combinedStream.maxDataSize = `2 * 1024 * 1024` + +The maximum amount of bytes (or characters) to buffer for all source streams. +If this value is exceeded, `combinedStream` emits an `'error'` event. + +### combinedStream.dataSize = `0` + +The amount of bytes (or characters) currently buffered by `combinedStream`. + +### combinedStream.append(stream) + +Appends the given `stream` to the combinedStream object. If `pauseStreams` is +set to `true, this stream will also be paused right away. + +`streams` can also be a function that takes one parameter called `next`. `next` +is a function that must be invoked in order to provide the `next` stream, see +example above. + +Regardless of how the `stream` is appended, combined-stream always attaches an +`'error'` listener to it, so you don't have to do that manually. + +Special case: `stream` can also be a String or Buffer. + +### combinedStream.write(data) + +You should not call this, `combinedStream` takes care of piping the appended +streams into itself for you. + +### combinedStream.resume() + +Causes `combinedStream` to start drain the streams it manages. The function is +idempotent, and also emits a `'resume'` event each time which usually goes to +the stream that is currently being drained. + +### combinedStream.pause(); + +If `combinedStream.pauseStreams` is set to `false`, this does nothing. +Otherwise a `'pause'` event is emitted, this goes to the stream that is +currently being drained, so you can use it to apply back pressure. + +### combinedStream.end(); + +Sets `combinedStream.writable` to false, emits an `'end'` event, and removes +all streams from the queue. + +### combinedStream.destroy(); + +Same as `combinedStream.end()`, except it emits a `'close'` event instead of +`'end'`. + +## License + +combined-stream is licensed under the MIT license. diff --git a/appasar/canary/node_modules/combined-stream/lib/combined_stream.js b/appasar/canary/node_modules/combined-stream/lib/combined_stream.js new file mode 100644 index 0000000..6b5c21b --- /dev/null +++ b/appasar/canary/node_modules/combined-stream/lib/combined_stream.js @@ -0,0 +1,188 @@ +var util = require('util'); +var Stream = require('stream').Stream; +var DelayedStream = require('delayed-stream'); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + this._pipeNext(stream); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; diff --git a/appasar/canary/node_modules/combined-stream/package.json b/appasar/canary/node_modules/combined-stream/package.json new file mode 100644 index 0000000..620ae82 --- /dev/null +++ b/appasar/canary/node_modules/combined-stream/package.json @@ -0,0 +1,25 @@ +{ + "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", + "name": "combined-stream", + "description": "A stream that emits multiple other streams one after another.", + "version": "1.0.5", + "homepage": "https://github.com/felixge/node-combined-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-combined-stream.git" + }, + "main": "./lib/combined_stream", + "scripts": { + "test": "node test/run.js" + }, + "engines": { + "node": ">= 0.8" + }, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "devDependencies": { + "far": "~0.0.7" + }, + "license": "MIT" +} diff --git a/appasar/canary/node_modules/concat-map/.travis.yml b/appasar/canary/node_modules/concat-map/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/appasar/canary/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/appasar/canary/node_modules/concat-map/LICENSE b/appasar/canary/node_modules/concat-map/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/appasar/canary/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/concat-map/README.markdown b/appasar/canary/node_modules/concat-map/README.markdown new file mode 100644 index 0000000..408f70a --- /dev/null +++ b/appasar/canary/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/appasar/canary/node_modules/concat-map/example/map.js b/appasar/canary/node_modules/concat-map/example/map.js new file mode 100644 index 0000000..3365621 --- /dev/null +++ b/appasar/canary/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/appasar/canary/node_modules/concat-map/index.js b/appasar/canary/node_modules/concat-map/index.js new file mode 100644 index 0000000..b29a781 --- /dev/null +++ b/appasar/canary/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/appasar/canary/node_modules/concat-map/package.json b/appasar/canary/node_modules/concat-map/package.json new file mode 100644 index 0000000..d3640e6 --- /dev/null +++ b/appasar/canary/node_modules/concat-map/package.json @@ -0,0 +1,43 @@ +{ + "name" : "concat-map", + "description" : "concatenative mapdashery", + "version" : "0.0.1", + "repository" : { + "type" : "git", + "url" : "git://github.com/substack/node-concat-map.git" + }, + "main" : "index.js", + "keywords" : [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories" : { + "example" : "example", + "test" : "test" + }, + "scripts" : { + "test" : "tape test/*.js" + }, + "devDependencies" : { + "tape" : "~2.4.0" + }, + "license" : "MIT", + "author" : { + "name" : "James Halliday", + "email" : "mail@substack.net", + "url" : "http://substack.net" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : { + "ie" : [ 6, 7, 8, 9 ], + "ff" : [ 3.5, 10, 15.0 ], + "chrome" : [ 10, 22 ], + "safari" : [ 5.1 ], + "opera" : [ 12 ] + } + } +} diff --git a/appasar/canary/node_modules/concat-map/test/map.js b/appasar/canary/node_modules/concat-map/test/map.js new file mode 100644 index 0000000..fdbd702 --- /dev/null +++ b/appasar/canary/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/appasar/canary/node_modules/core-util-is/LICENSE b/appasar/canary/node_modules/core-util-is/LICENSE new file mode 100644 index 0000000..d8d7f94 --- /dev/null +++ b/appasar/canary/node_modules/core-util-is/LICENSE @@ -0,0 +1,19 @@ +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/core-util-is/README.md b/appasar/canary/node_modules/core-util-is/README.md new file mode 100644 index 0000000..5a76b41 --- /dev/null +++ b/appasar/canary/node_modules/core-util-is/README.md @@ -0,0 +1,3 @@ +# core-util-is + +The `util.is*` functions introduced in Node v0.12. diff --git a/appasar/canary/node_modules/core-util-is/float.patch b/appasar/canary/node_modules/core-util-is/float.patch new file mode 100644 index 0000000..a06d5c0 --- /dev/null +++ b/appasar/canary/node_modules/core-util-is/float.patch @@ -0,0 +1,604 @@ +diff --git a/lib/util.js b/lib/util.js +index a03e874..9074e8e 100644 +--- a/lib/util.js ++++ b/lib/util.js +@@ -19,430 +19,6 @@ + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + +-var formatRegExp = /%[sdj%]/g; +-exports.format = function(f) { +- if (!isString(f)) { +- var objects = []; +- for (var i = 0; i < arguments.length; i++) { +- objects.push(inspect(arguments[i])); +- } +- return objects.join(' '); +- } +- +- var i = 1; +- var args = arguments; +- var len = args.length; +- var str = String(f).replace(formatRegExp, function(x) { +- if (x === '%%') return '%'; +- if (i >= len) return x; +- switch (x) { +- case '%s': return String(args[i++]); +- case '%d': return Number(args[i++]); +- case '%j': +- try { +- return JSON.stringify(args[i++]); +- } catch (_) { +- return '[Circular]'; +- } +- default: +- return x; +- } +- }); +- for (var x = args[i]; i < len; x = args[++i]) { +- if (isNull(x) || !isObject(x)) { +- str += ' ' + x; +- } else { +- str += ' ' + inspect(x); +- } +- } +- return str; +-}; +- +- +-// Mark that a method should not be used. +-// Returns a modified function which warns once by default. +-// If --no-deprecation is set, then it is a no-op. +-exports.deprecate = function(fn, msg) { +- // Allow for deprecating things in the process of starting up. +- if (isUndefined(global.process)) { +- return function() { +- return exports.deprecate(fn, msg).apply(this, arguments); +- }; +- } +- +- if (process.noDeprecation === true) { +- return fn; +- } +- +- var warned = false; +- function deprecated() { +- if (!warned) { +- if (process.throwDeprecation) { +- throw new Error(msg); +- } else if (process.traceDeprecation) { +- console.trace(msg); +- } else { +- console.error(msg); +- } +- warned = true; +- } +- return fn.apply(this, arguments); +- } +- +- return deprecated; +-}; +- +- +-var debugs = {}; +-var debugEnviron; +-exports.debuglog = function(set) { +- if (isUndefined(debugEnviron)) +- debugEnviron = process.env.NODE_DEBUG || ''; +- set = set.toUpperCase(); +- if (!debugs[set]) { +- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { +- var pid = process.pid; +- debugs[set] = function() { +- var msg = exports.format.apply(exports, arguments); +- console.error('%s %d: %s', set, pid, msg); +- }; +- } else { +- debugs[set] = function() {}; +- } +- } +- return debugs[set]; +-}; +- +- +-/** +- * Echos the value of a value. Trys to print the value out +- * in the best way possible given the different types. +- * +- * @param {Object} obj The object to print out. +- * @param {Object} opts Optional options object that alters the output. +- */ +-/* legacy: obj, showHidden, depth, colors*/ +-function inspect(obj, opts) { +- // default options +- var ctx = { +- seen: [], +- stylize: stylizeNoColor +- }; +- // legacy... +- if (arguments.length >= 3) ctx.depth = arguments[2]; +- if (arguments.length >= 4) ctx.colors = arguments[3]; +- if (isBoolean(opts)) { +- // legacy... +- ctx.showHidden = opts; +- } else if (opts) { +- // got an "options" object +- exports._extend(ctx, opts); +- } +- // set default options +- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; +- if (isUndefined(ctx.depth)) ctx.depth = 2; +- if (isUndefined(ctx.colors)) ctx.colors = false; +- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; +- if (ctx.colors) ctx.stylize = stylizeWithColor; +- return formatValue(ctx, obj, ctx.depth); +-} +-exports.inspect = inspect; +- +- +-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +-inspect.colors = { +- 'bold' : [1, 22], +- 'italic' : [3, 23], +- 'underline' : [4, 24], +- 'inverse' : [7, 27], +- 'white' : [37, 39], +- 'grey' : [90, 39], +- 'black' : [30, 39], +- 'blue' : [34, 39], +- 'cyan' : [36, 39], +- 'green' : [32, 39], +- 'magenta' : [35, 39], +- 'red' : [31, 39], +- 'yellow' : [33, 39] +-}; +- +-// Don't use 'blue' not visible on cmd.exe +-inspect.styles = { +- 'special': 'cyan', +- 'number': 'yellow', +- 'boolean': 'yellow', +- 'undefined': 'grey', +- 'null': 'bold', +- 'string': 'green', +- 'date': 'magenta', +- // "name": intentionally not styling +- 'regexp': 'red' +-}; +- +- +-function stylizeWithColor(str, styleType) { +- var style = inspect.styles[styleType]; +- +- if (style) { +- return '\u001b[' + inspect.colors[style][0] + 'm' + str + +- '\u001b[' + inspect.colors[style][1] + 'm'; +- } else { +- return str; +- } +-} +- +- +-function stylizeNoColor(str, styleType) { +- return str; +-} +- +- +-function arrayToHash(array) { +- var hash = {}; +- +- array.forEach(function(val, idx) { +- hash[val] = true; +- }); +- +- return hash; +-} +- +- +-function formatValue(ctx, value, recurseTimes) { +- // Provide a hook for user-specified inspect functions. +- // Check that value is an object with an inspect function on it +- if (ctx.customInspect && +- value && +- isFunction(value.inspect) && +- // Filter out the util module, it's inspect function is special +- value.inspect !== exports.inspect && +- // Also filter out any prototype objects using the circular check. +- !(value.constructor && value.constructor.prototype === value)) { +- var ret = value.inspect(recurseTimes, ctx); +- if (!isString(ret)) { +- ret = formatValue(ctx, ret, recurseTimes); +- } +- return ret; +- } +- +- // Primitive types cannot have properties +- var primitive = formatPrimitive(ctx, value); +- if (primitive) { +- return primitive; +- } +- +- // Look up the keys of the object. +- var keys = Object.keys(value); +- var visibleKeys = arrayToHash(keys); +- +- if (ctx.showHidden) { +- keys = Object.getOwnPropertyNames(value); +- } +- +- // Some type of object without properties can be shortcutted. +- if (keys.length === 0) { +- if (isFunction(value)) { +- var name = value.name ? ': ' + value.name : ''; +- return ctx.stylize('[Function' + name + ']', 'special'); +- } +- if (isRegExp(value)) { +- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); +- } +- if (isDate(value)) { +- return ctx.stylize(Date.prototype.toString.call(value), 'date'); +- } +- if (isError(value)) { +- return formatError(value); +- } +- } +- +- var base = '', array = false, braces = ['{', '}']; +- +- // Make Array say that they are Array +- if (isArray(value)) { +- array = true; +- braces = ['[', ']']; +- } +- +- // Make functions say that they are functions +- if (isFunction(value)) { +- var n = value.name ? ': ' + value.name : ''; +- base = ' [Function' + n + ']'; +- } +- +- // Make RegExps say that they are RegExps +- if (isRegExp(value)) { +- base = ' ' + RegExp.prototype.toString.call(value); +- } +- +- // Make dates with properties first say the date +- if (isDate(value)) { +- base = ' ' + Date.prototype.toUTCString.call(value); +- } +- +- // Make error with message first say the error +- if (isError(value)) { +- base = ' ' + formatError(value); +- } +- +- if (keys.length === 0 && (!array || value.length == 0)) { +- return braces[0] + base + braces[1]; +- } +- +- if (recurseTimes < 0) { +- if (isRegExp(value)) { +- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); +- } else { +- return ctx.stylize('[Object]', 'special'); +- } +- } +- +- ctx.seen.push(value); +- +- var output; +- if (array) { +- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); +- } else { +- output = keys.map(function(key) { +- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); +- }); +- } +- +- ctx.seen.pop(); +- +- return reduceToSingleString(output, base, braces); +-} +- +- +-function formatPrimitive(ctx, value) { +- if (isUndefined(value)) +- return ctx.stylize('undefined', 'undefined'); +- if (isString(value)) { +- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') +- .replace(/'/g, "\\'") +- .replace(/\\"/g, '"') + '\''; +- return ctx.stylize(simple, 'string'); +- } +- if (isNumber(value)) { +- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, +- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . +- if (value === 0 && 1 / value < 0) +- return ctx.stylize('-0', 'number'); +- return ctx.stylize('' + value, 'number'); +- } +- if (isBoolean(value)) +- return ctx.stylize('' + value, 'boolean'); +- // For some reason typeof null is "object", so special case here. +- if (isNull(value)) +- return ctx.stylize('null', 'null'); +-} +- +- +-function formatError(value) { +- return '[' + Error.prototype.toString.call(value) + ']'; +-} +- +- +-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { +- var output = []; +- for (var i = 0, l = value.length; i < l; ++i) { +- if (hasOwnProperty(value, String(i))) { +- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, +- String(i), true)); +- } else { +- output.push(''); +- } +- } +- keys.forEach(function(key) { +- if (!key.match(/^\d+$/)) { +- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, +- key, true)); +- } +- }); +- return output; +-} +- +- +-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { +- var name, str, desc; +- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; +- if (desc.get) { +- if (desc.set) { +- str = ctx.stylize('[Getter/Setter]', 'special'); +- } else { +- str = ctx.stylize('[Getter]', 'special'); +- } +- } else { +- if (desc.set) { +- str = ctx.stylize('[Setter]', 'special'); +- } +- } +- if (!hasOwnProperty(visibleKeys, key)) { +- name = '[' + key + ']'; +- } +- if (!str) { +- if (ctx.seen.indexOf(desc.value) < 0) { +- if (isNull(recurseTimes)) { +- str = formatValue(ctx, desc.value, null); +- } else { +- str = formatValue(ctx, desc.value, recurseTimes - 1); +- } +- if (str.indexOf('\n') > -1) { +- if (array) { +- str = str.split('\n').map(function(line) { +- return ' ' + line; +- }).join('\n').substr(2); +- } else { +- str = '\n' + str.split('\n').map(function(line) { +- return ' ' + line; +- }).join('\n'); +- } +- } +- } else { +- str = ctx.stylize('[Circular]', 'special'); +- } +- } +- if (isUndefined(name)) { +- if (array && key.match(/^\d+$/)) { +- return str; +- } +- name = JSON.stringify('' + key); +- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { +- name = name.substr(1, name.length - 2); +- name = ctx.stylize(name, 'name'); +- } else { +- name = name.replace(/'/g, "\\'") +- .replace(/\\"/g, '"') +- .replace(/(^"|"$)/g, "'"); +- name = ctx.stylize(name, 'string'); +- } +- } +- +- return name + ': ' + str; +-} +- +- +-function reduceToSingleString(output, base, braces) { +- var numLinesEst = 0; +- var length = output.reduce(function(prev, cur) { +- numLinesEst++; +- if (cur.indexOf('\n') >= 0) numLinesEst++; +- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; +- }, 0); +- +- if (length > 60) { +- return braces[0] + +- (base === '' ? '' : base + '\n ') + +- ' ' + +- output.join(',\n ') + +- ' ' + +- braces[1]; +- } +- +- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +-} +- +- + // NOTE: These type checking functions intentionally don't use `instanceof` + // because it is fragile and can be easily faked with `Object.create()`. + function isArray(ar) { +@@ -522,166 +98,10 @@ function isPrimitive(arg) { + exports.isPrimitive = isPrimitive; + + function isBuffer(arg) { +- return arg instanceof Buffer; ++ return Buffer.isBuffer(arg); + } + exports.isBuffer = isBuffer; + + function objectToString(o) { + return Object.prototype.toString.call(o); +-} +- +- +-function pad(n) { +- return n < 10 ? '0' + n.toString(10) : n.toString(10); +-} +- +- +-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', +- 'Oct', 'Nov', 'Dec']; +- +-// 26 Feb 16:19:34 +-function timestamp() { +- var d = new Date(); +- var time = [pad(d.getHours()), +- pad(d.getMinutes()), +- pad(d.getSeconds())].join(':'); +- return [d.getDate(), months[d.getMonth()], time].join(' '); +-} +- +- +-// log is just a thin wrapper to console.log that prepends a timestamp +-exports.log = function() { +- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +-}; +- +- +-/** +- * Inherit the prototype methods from one constructor into another. +- * +- * The Function.prototype.inherits from lang.js rewritten as a standalone +- * function (not on Function.prototype). NOTE: If this file is to be loaded +- * during bootstrapping this function needs to be rewritten using some native +- * functions as prototype setup using normal JavaScript does not work as +- * expected during bootstrapping (see mirror.js in r114903). +- * +- * @param {function} ctor Constructor function which needs to inherit the +- * prototype. +- * @param {function} superCtor Constructor function to inherit prototype from. +- */ +-exports.inherits = function(ctor, superCtor) { +- ctor.super_ = superCtor; +- ctor.prototype = Object.create(superCtor.prototype, { +- constructor: { +- value: ctor, +- enumerable: false, +- writable: true, +- configurable: true +- } +- }); +-}; +- +-exports._extend = function(origin, add) { +- // Don't do anything if add isn't an object +- if (!add || !isObject(add)) return origin; +- +- var keys = Object.keys(add); +- var i = keys.length; +- while (i--) { +- origin[keys[i]] = add[keys[i]]; +- } +- return origin; +-}; +- +-function hasOwnProperty(obj, prop) { +- return Object.prototype.hasOwnProperty.call(obj, prop); +-} +- +- +-// Deprecated old stuff. +- +-exports.p = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- console.error(exports.inspect(arguments[i])); +- } +-}, 'util.p: Use console.error() instead'); +- +- +-exports.exec = exports.deprecate(function() { +- return require('child_process').exec.apply(this, arguments); +-}, 'util.exec is now called `child_process.exec`.'); +- +- +-exports.print = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stdout.write(String(arguments[i])); +- } +-}, 'util.print: Use console.log instead'); +- +- +-exports.puts = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stdout.write(arguments[i] + '\n'); +- } +-}, 'util.puts: Use console.log instead'); +- +- +-exports.debug = exports.deprecate(function(x) { +- process.stderr.write('DEBUG: ' + x + '\n'); +-}, 'util.debug: Use console.error instead'); +- +- +-exports.error = exports.deprecate(function(x) { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stderr.write(arguments[i] + '\n'); +- } +-}, 'util.error: Use console.error instead'); +- +- +-exports.pump = exports.deprecate(function(readStream, writeStream, callback) { +- var callbackCalled = false; +- +- function call(a, b, c) { +- if (callback && !callbackCalled) { +- callback(a, b, c); +- callbackCalled = true; +- } +- } +- +- readStream.addListener('data', function(chunk) { +- if (writeStream.write(chunk) === false) readStream.pause(); +- }); +- +- writeStream.addListener('drain', function() { +- readStream.resume(); +- }); +- +- readStream.addListener('end', function() { +- writeStream.end(); +- }); +- +- readStream.addListener('close', function() { +- call(); +- }); +- +- readStream.addListener('error', function(err) { +- writeStream.end(); +- call(err); +- }); +- +- writeStream.addListener('error', function(err) { +- readStream.destroy(); +- call(err); +- }); +-}, 'util.pump(): Use readableStream.pipe() instead'); +- +- +-var uv; +-exports._errnoException = function(err, syscall) { +- if (isUndefined(uv)) uv = process.binding('uv'); +- var errname = uv.errname(err); +- var e = new Error(syscall + ' ' + errname); +- e.code = errname; +- e.errno = errname; +- e.syscall = syscall; +- return e; +-}; ++} \ No newline at end of file diff --git a/appasar/canary/node_modules/core-util-is/lib/util.js b/appasar/canary/node_modules/core-util-is/lib/util.js new file mode 100644 index 0000000..ff4c851 --- /dev/null +++ b/appasar/canary/node_modules/core-util-is/lib/util.js @@ -0,0 +1,107 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} diff --git a/appasar/canary/node_modules/core-util-is/package.json b/appasar/canary/node_modules/core-util-is/package.json new file mode 100644 index 0000000..3368e95 --- /dev/null +++ b/appasar/canary/node_modules/core-util-is/package.json @@ -0,0 +1,32 @@ +{ + "name": "core-util-is", + "version": "1.0.2", + "description": "The `util.is*` functions introduced in Node v0.12.", + "main": "lib/util.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/core-util-is" + }, + "keywords": [ + "util", + "isBuffer", + "isArray", + "isNumber", + "isString", + "isRegExp", + "isThis", + "isThat", + "polyfill" + ], + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/isaacs/core-util-is/issues" + }, + "scripts": { + "test": "tap test.js" + }, + "devDependencies": { + "tap": "^2.3.0" + } +} diff --git a/appasar/canary/node_modules/core-util-is/test.js b/appasar/canary/node_modules/core-util-is/test.js new file mode 100644 index 0000000..1a490c6 --- /dev/null +++ b/appasar/canary/node_modules/core-util-is/test.js @@ -0,0 +1,68 @@ +var assert = require('tap'); + +var t = require('./lib/util'); + +assert.equal(t.isArray([]), true); +assert.equal(t.isArray({}), false); + +assert.equal(t.isBoolean(null), false); +assert.equal(t.isBoolean(true), true); +assert.equal(t.isBoolean(false), true); + +assert.equal(t.isNull(null), true); +assert.equal(t.isNull(undefined), false); +assert.equal(t.isNull(false), false); +assert.equal(t.isNull(), false); + +assert.equal(t.isNullOrUndefined(null), true); +assert.equal(t.isNullOrUndefined(undefined), true); +assert.equal(t.isNullOrUndefined(false), false); +assert.equal(t.isNullOrUndefined(), true); + +assert.equal(t.isNumber(null), false); +assert.equal(t.isNumber('1'), false); +assert.equal(t.isNumber(1), true); + +assert.equal(t.isString(null), false); +assert.equal(t.isString('1'), true); +assert.equal(t.isString(1), false); + +assert.equal(t.isSymbol(null), false); +assert.equal(t.isSymbol('1'), false); +assert.equal(t.isSymbol(1), false); +assert.equal(t.isSymbol(Symbol()), true); + +assert.equal(t.isUndefined(null), false); +assert.equal(t.isUndefined(undefined), true); +assert.equal(t.isUndefined(false), false); +assert.equal(t.isUndefined(), true); + +assert.equal(t.isRegExp(null), false); +assert.equal(t.isRegExp('1'), false); +assert.equal(t.isRegExp(new RegExp()), true); + +assert.equal(t.isObject({}), true); +assert.equal(t.isObject([]), true); +assert.equal(t.isObject(new RegExp()), true); +assert.equal(t.isObject(new Date()), true); + +assert.equal(t.isDate(null), false); +assert.equal(t.isDate('1'), false); +assert.equal(t.isDate(new Date()), true); + +assert.equal(t.isError(null), false); +assert.equal(t.isError({ err: true }), false); +assert.equal(t.isError(new Error()), true); + +assert.equal(t.isFunction(null), false); +assert.equal(t.isFunction({ }), false); +assert.equal(t.isFunction(function() {}), true); + +assert.equal(t.isPrimitive(null), true); +assert.equal(t.isPrimitive(''), true); +assert.equal(t.isPrimitive(0), true); +assert.equal(t.isPrimitive(new Date()), false); + +assert.equal(t.isBuffer(null), false); +assert.equal(t.isBuffer({}), false); +assert.equal(t.isBuffer(new Buffer(0)), true); diff --git a/appasar/canary/node_modules/cryptiles/.npmignore b/appasar/canary/node_modules/cryptiles/.npmignore new file mode 100644 index 0000000..10c1307 --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/.npmignore @@ -0,0 +1,3 @@ +* +!lib/** +!.npmignore diff --git a/appasar/canary/node_modules/cryptiles/LICENSE b/appasar/canary/node_modules/cryptiles/LICENSE new file mode 100644 index 0000000..4028ccd --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2014-2017, Eran Hammer and Project contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * The names of any contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * * * + +The complete list of contributors can be found at: https://github.com/hueniverse/cryptiles/graphs/contributors diff --git a/appasar/canary/node_modules/cryptiles/README.md b/appasar/canary/node_modules/cryptiles/README.md new file mode 100644 index 0000000..b3df9e6 --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/README.md @@ -0,0 +1,19 @@ +cryptiles +========= + +General purpose crypto utilities + +[![Build Status](https://secure.travis-ci.org/hapijs/cryptiles.png)](http://travis-ci.org/hapijs/cryptiles) + +Lead Maintainer - [C J Silverio](https://github.com/ceejbot) + +## Methods + +### `randomString(<Number> size)` +Returns a cryptographically strong pseudo-random data string. Takes a size argument for the length of the string. + +### `randomDigits(<Number> size)` +Returns a cryptographically strong pseudo-random data string consisting of only numerical digits (0-9). Takes a size argument for the length of the string. + +### `fixedTimeComparison(<String> a, <String> b)` +Compare two strings using fixed time algorithm (to prevent time-based analysis of MAC digest match). Returns `true` if the strings match, `false` if they differ. diff --git a/appasar/canary/node_modules/cryptiles/lib/index.js b/appasar/canary/node_modules/cryptiles/lib/index.js new file mode 100644 index 0000000..511eab6 --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/lib/index.js @@ -0,0 +1,88 @@ +'use strict'; + +// Load modules + +const Crypto = require('crypto'); +const Boom = require('boom'); + + +// Declare internals + +const internals = {}; + + +// Generate a cryptographically strong pseudo-random data + +exports.randomString = function (size) { + + const buffer = exports.randomBits((size + 1) * 6); + if (buffer instanceof Error) { + return buffer; + } + + const string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); + return string.slice(0, size); +}; + + +// Return a random string of digits + +exports.randomDigits = function (size) { + + const buffer = exports.randomBits(size * 8); + if (buffer instanceof Error) { + return buffer; + } + + const digits = []; + for (let i = 0; i < buffer.length; ++i) { + digits.push(Math.floor(buffer[i] / 25.6)); + } + + return digits.join(''); +}; + + +// Generate a buffer of random bits + +exports.randomBits = function (bits) { + + if (!bits || + bits < 0) { + + return Boom.internal('Invalid random bits count'); + } + + const bytes = Math.ceil(bits / 8); + try { + return Crypto.randomBytes(bytes); + } + catch (err) { + return Boom.internal('Failed generating random bits: ' + err.message); + } +}; + + +// Compare two strings using fixed time algorithm (to prevent time-based analysis of MAC digest match) + +exports.fixedTimeComparison = function (a, b) { + + if (typeof a !== 'string' || + typeof b !== 'string') { + + return false; + } + + let mismatch = (a.length === b.length ? 0 : 1); + if (mismatch) { + b = a; + } + + for (let i = 0; i < a.length; ++i) { + const ac = a.charCodeAt(i); + const bc = b.charCodeAt(i); + mismatch |= (ac ^ bc); + } + + return (mismatch === 0); +}; diff --git a/appasar/canary/node_modules/cryptiles/node_modules/boom/LICENSE b/appasar/canary/node_modules/cryptiles/node_modules/boom/LICENSE new file mode 100644 index 0000000..94b91cb --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/node_modules/boom/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2012-2017, Project contributors. +Copyright (c) 2012-2014, Walmart. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * The names of any contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * * * + +The complete list of contributors can be found at: https://github.com/hapijs/boom/graphs/contributors diff --git a/appasar/canary/node_modules/cryptiles/node_modules/boom/README.md b/appasar/canary/node_modules/cryptiles/node_modules/boom/README.md new file mode 100644 index 0000000..50d5b0d --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/node_modules/boom/README.md @@ -0,0 +1,784 @@ +![boom Logo](https://raw.github.com/hapijs/boom/master/images/boom.png) + +HTTP-friendly error objects + +[![Build Status](https://secure.travis-ci.org/hapijs/boom.svg)](http://travis-ci.org/hapijs/boom) +[![Current Version](https://img.shields.io/npm/v/boom.svg)](https://www.npmjs.com/package/boom) + +Lead Maintainer: [Adam Bretz](https://github.com/arb) + +<!-- toc --> + +- [Boom](#boom) + - [Helper Methods](#helper-methods) + - [`boomify(error, [options])`](#boomifyerror-options) + - [`wrap(error, [statusCode], [message])`](#wraperror-statuscode-message) + - [`create(statusCode, [message], [data])`](#createstatuscode-message-data) + - [HTTP 4xx Errors](#http-4xx-errors) + - [`Boom.badRequest([message], [data])`](#boombadrequestmessage-data) + - [`Boom.unauthorized([message], [scheme], [attributes])`](#boomunauthorizedmessage-scheme-attributes) + - [`Boom.paymentRequired([message], [data])`](#boompaymentrequiredmessage-data) + - [`Boom.forbidden([message], [data])`](#boomforbiddenmessage-data) + - [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data) + - [`Boom.methodNotAllowed([message], [data], [allow])`](#boommethodnotallowedmessage-data-allow) + - [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data) + - [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data) + - [`Boom.clientTimeout([message], [data])`](#boomclienttimeoutmessage-data) + - [`Boom.conflict([message], [data])`](#boomconflictmessage-data) + - [`Boom.resourceGone([message], [data])`](#boomresourcegonemessage-data) + - [`Boom.lengthRequired([message], [data])`](#boomlengthrequiredmessage-data) + - [`Boom.preconditionFailed([message], [data])`](#boompreconditionfailedmessage-data) + - [`Boom.entityTooLarge([message], [data])`](#boomentitytoolargemessage-data) + - [`Boom.uriTooLong([message], [data])`](#boomuritoolongmessage-data) + - [`Boom.unsupportedMediaType([message], [data])`](#boomunsupportedmediatypemessage-data) + - [`Boom.rangeNotSatisfiable([message], [data])`](#boomrangenotsatisfiablemessage-data) + - [`Boom.expectationFailed([message], [data])`](#boomexpectationfailedmessage-data) + - [`Boom.teapot([message], [data])`](#boomteapotmessage-data) + - [`Boom.badData([message], [data])`](#boombaddatamessage-data) + - [`Boom.locked([message], [data])`](#boomlockedmessage-data) + - [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data) + - [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data) + - [`Boom.illegal([message], [data])`](#boomillegalmessage-data) + - [HTTP 5xx Errors](#http-5xx-errors) + - [`Boom.badImplementation([message], [data])` - (*alias: `internal`*)](#boombadimplementationmessage-data---alias-internal) + - [`Boom.notImplemented([message], [data])`](#boomnotimplementedmessage-data) + - [`Boom.badGateway([message], [data])`](#boombadgatewaymessage-data) + - [`Boom.serverUnavailable([message], [data])`](#boomserverunavailablemessage-data) + - [`Boom.gatewayTimeout([message], [data])`](#boomgatewaytimeoutmessage-data) + - [F.A.Q.](#faq) + +<!-- tocstop --> + +# Boom + +**boom** provides a set of utilities for returning HTTP errors. Each utility returns a `Boom` error response +object (instance of `Error`) which includes the following properties: +- `isBoom` - if `true`, indicates this is a `Boom` object instance. +- `isServer` - convenience bool indicating status code >= 500. +- `message` - the error message. +- `typeof` - the contructor used to create the error (e.g. `Boom.badRequest`). +- `output` - the formatted response. Can be directly manipulated after object construction to return a custom + error response. Allowed root keys: + - `statusCode` - the HTTP status code (typically 4xx or 5xx). + - `headers` - an object containing any HTTP headers where each key is a header name and value is the header content. + - `payload` - the formatted object used as the response payload (stringified). Can be directly manipulated but any + changes will be lost + if `reformat()` is called. Any content allowed and by default includes the following content: + - `statusCode` - the HTTP status code, derived from `error.output.statusCode`. + - `error` - the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from `statusCode`. + - `message` - the error message derived from `error.message`. +- inherited `Error` properties. + +The `Boom` object also supports the following method: +- `reformat()` - rebuilds `error.output` using the other object properties. + +## Helper Methods + +### `boomify(error, [options])` + +Decorates an error with the **boom** properties where: +- `error` - the `Error` object to decorate. +- `options` - optional object with the following optional settings: + - `statusCode` - the HTTP status code. Defaults to `500` if no status code is already set. + - `message` - error message string. If the error already has a message, the provided `message` is added as a prefix. + Defaults to no message. + - `override` - if `false`, the `error` provided is a **boom** object, and a `statusCode` or `message` are provided, + the values are ignored. Defaults to `true` (apply the provided `statusCode` and `message` options to the error + regardless of its type, `Error` or **boom** object). + +Note: This method replaces the [`wrap()`](#wraperror-statuscode-message) and changes the default behavior to override +existing **boom** objects with the provided status code and message. + +```js +var error = new Error('Unexpected input'); +Boom.boomify(error, { statusCode: 400 }); +``` + +### `wrap(error, [statusCode], [message])` + +Note: This method is deprecated. + +Decorates an error with the **boom** properties where: +- `error` - the error object to wrap. If `error` is already a **boom** object, returns back the same object. +- `statusCode` - optional HTTP status code. Defaults to `500`. +- `message` - optional message string. If the error already has a message, it adds the message as a prefix. + Defaults to no message. + +```js +var error = new Error('Unexpected input'); +Boom.wrap(error, 400); +``` + +### `create(statusCode, [message], [data])` + +Generates an `Error` object with the **boom** decorations where: +- `statusCode` - an HTTP error code number. Must be greater or equal 400. +- `message` - optional message string. +- `data` - additional error data set to `error.data` property. + +```js +var error = Boom.create(400, 'Bad request', { timestamp: Date.now() }); +``` + +## HTTP 4xx Errors + +### `Boom.badRequest([message], [data])` + +Returns a 400 Bad Request error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.badRequest('invalid query'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 400, + "error": "Bad Request", + "message": "invalid query" +} +``` + +### `Boom.unauthorized([message], [scheme], [attributes])` + +Returns a 401 Unauthorized error where: +- `message` - optional message. +- `scheme` can be one of the following: + - an authentication scheme name + - an array of string values. These values will be separated by ', ' and set to the 'WWW-Authenticate' header. +- `attributes` - an object of values to use while setting the 'WWW-Authenticate' header. This value is only used + when `scheme` is a string, otherwise it is ignored. Every key/value pair will be included in the + 'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the `attributes` key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null. + `null` and `undefined` will be replaced with an empty string. If `attributes` is set, `message` will be used as + the 'error' segment of the 'WWW-Authenticate' header. If `message` is unset, the 'error' segment of the header + will not be present and `isMissing` will be true on the error object. + +If either `scheme` or `attributes` are set, the resultant `Boom` object will have the 'WWW-Authenticate' header set for the response. + +```js +Boom.unauthorized('invalid password'); +``` + +Generates the following response: + +```json +"payload": { + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password" +}, +"headers" {} +``` + +```js +Boom.unauthorized('invalid password', 'sample'); +``` + +Generates the following response: + +```json +"payload": { + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password", + "attributes": { + "error": "invalid password" + } +}, +"headers" { + "WWW-Authenticate": "sample error=\"invalid password\"" +} +``` + +```js +Boom.unauthorized(null, 'Negotiate', 'VGhpcyBpcyBhIHRlc3QgdG9rZW4='); +``` + +Generates the following response: + +```json +"payload": { + "statusCode": 401, + "error": "Unauthorized", + "attributes": "VGhpcyBpcyBhIHRlc3QgdG9rZW4=" +}, +"headers" { + "WWW-Authenticate": "Negotiate VGhpcyBpcyBhIHRlc3QgdG9rZW4=" +} +``` + +```js +Boom.unauthorized('invalid password', 'sample', { ttl: 0, cache: null, foo: 'bar' }); +``` + +Generates the following response: + +```json +"payload": { + "statusCode": 401, + "error": "Unauthorized", + "message": "invalid password", + "attributes": { + "error": "invalid password", + "ttl": 0, + "cache": "", + "foo": "bar" + } +}, +"headers" { + "WWW-Authenticate": "sample ttl=\"0\", cache=\"\", foo=\"bar\", error=\"invalid password\"" +} +``` + +### `Boom.paymentRequired([message], [data])` + +Returns a 402 Payment Required error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.paymentRequired('bandwidth used'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 402, + "error": "Payment Required", + "message": "bandwidth used" +} +``` + +### `Boom.forbidden([message], [data])` + +Returns a 403 Forbidden error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.forbidden('try again some time'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 403, + "error": "Forbidden", + "message": "try again some time" +} +``` + +### `Boom.notFound([message], [data])` + +Returns a 404 Not Found error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.notFound('missing'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 404, + "error": "Not Found", + "message": "missing" +} +``` + +### `Boom.methodNotAllowed([message], [data], [allow])` + +Returns a 405 Method Not Allowed error where: +- `message` - optional message. +- `data` - optional additional error data. +- `allow` - optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header. + +```js +Boom.methodNotAllowed('that method is not allowed'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 405, + "error": "Method Not Allowed", + "message": "that method is not allowed" +} +``` + +### `Boom.notAcceptable([message], [data])` + +Returns a 406 Not Acceptable error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.notAcceptable('unacceptable'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 406, + "error": "Not Acceptable", + "message": "unacceptable" +} +``` + +### `Boom.proxyAuthRequired([message], [data])` + +Returns a 407 Proxy Authentication Required error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.proxyAuthRequired('auth missing'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 407, + "error": "Proxy Authentication Required", + "message": "auth missing" +} +``` + +### `Boom.clientTimeout([message], [data])` + +Returns a 408 Request Time-out error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.clientTimeout('timed out'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 408, + "error": "Request Time-out", + "message": "timed out" +} +``` + +### `Boom.conflict([message], [data])` + +Returns a 409 Conflict error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.conflict('there was a conflict'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 409, + "error": "Conflict", + "message": "there was a conflict" +} +``` + +### `Boom.resourceGone([message], [data])` + +Returns a 410 Gone error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.resourceGone('it is gone'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 410, + "error": "Gone", + "message": "it is gone" +} +``` + +### `Boom.lengthRequired([message], [data])` + +Returns a 411 Length Required error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.lengthRequired('length needed'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 411, + "error": "Length Required", + "message": "length needed" +} +``` + +### `Boom.preconditionFailed([message], [data])` + +Returns a 412 Precondition Failed error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.preconditionFailed(); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 412, + "error": "Precondition Failed" +} +``` + +### `Boom.entityTooLarge([message], [data])` + +Returns a 413 Request Entity Too Large error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.entityTooLarge('too big'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 413, + "error": "Request Entity Too Large", + "message": "too big" +} +``` + +### `Boom.uriTooLong([message], [data])` + +Returns a 414 Request-URI Too Large error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.uriTooLong('uri is too long'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 414, + "error": "Request-URI Too Large", + "message": "uri is too long" +} +``` + +### `Boom.unsupportedMediaType([message], [data])` + +Returns a 415 Unsupported Media Type error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.unsupportedMediaType('that media is not supported'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 415, + "error": "Unsupported Media Type", + "message": "that media is not supported" +} +``` + +### `Boom.rangeNotSatisfiable([message], [data])` + +Returns a 416 Requested Range Not Satisfiable error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.rangeNotSatisfiable(); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 416, + "error": "Requested Range Not Satisfiable" +} +``` + +### `Boom.expectationFailed([message], [data])` + +Returns a 417 Expectation Failed error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.expectationFailed('expected this to work'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 417, + "error": "Expectation Failed", + "message": "expected this to work" +} +``` + +### `Boom.teapot([message], [data])` + +Returns a 418 I'm a Teapot error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.teapot('sorry, no coffee...'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 418, + "error": "I'm a Teapot", + "message": "Sorry, no coffee..." +} +``` + +### `Boom.badData([message], [data])` + +Returns a 422 Unprocessable Entity error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.badData('your data is bad and you should feel bad'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 422, + "error": "Unprocessable Entity", + "message": "your data is bad and you should feel bad" +} +``` + +### `Boom.locked([message], [data])` + +Returns a 423 Locked error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.locked('this resource has been locked'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 423, + "error": "Locked", + "message": "this resource has been locked" +} +``` + +### `Boom.preconditionRequired([message], [data])` + +Returns a 428 Precondition Required error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.preconditionRequired('you must supply an If-Match header'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 428, + "error": "Precondition Required", + "message": "you must supply an If-Match header" +} +``` + +### `Boom.tooManyRequests([message], [data])` + +Returns a 429 Too Many Requests error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.tooManyRequests('you have exceeded your request limit'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 429, + "error": "Too Many Requests", + "message": "you have exceeded your request limit" +} +``` + +### `Boom.illegal([message], [data])` + +Returns a 451 Unavailable For Legal Reasons error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.illegal('you are not permitted to view this resource for legal reasons'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 451, + "error": "Unavailable For Legal Reasons", + "message": "you are not permitted to view this resource for legal reasons" +} +``` + +## HTTP 5xx Errors + +All 500 errors hide your message from the end user. Your message is recorded in the server log. + +### `Boom.badImplementation([message], [data])` - (*alias: `internal`*) + +Returns a 500 Internal Server Error error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.badImplementation('terrible implementation'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 500, + "error": "Internal Server Error", + "message": "An internal server error occurred" +} +``` + +### `Boom.notImplemented([message], [data])` + +Returns a 501 Not Implemented error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.notImplemented('method not implemented'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 501, + "error": "Not Implemented", + "message": "method not implemented" +} +``` + +### `Boom.badGateway([message], [data])` + +Returns a 502 Bad Gateway error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.badGateway('that is a bad gateway'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 502, + "error": "Bad Gateway", + "message": "that is a bad gateway" +} +``` + +### `Boom.serverUnavailable([message], [data])` + +Returns a 503 Service Unavailable error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.serverUnavailable('unavailable'); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 503, + "error": "Service Unavailable", + "message": "unavailable" +} +``` + +### `Boom.gatewayTimeout([message], [data])` + +Returns a 504 Gateway Time-out error where: +- `message` - optional message. +- `data` - optional additional error data. + +```js +Boom.gatewayTimeout(); +``` + +Generates the following response payload: + +```json +{ + "statusCode": 504, + "error": "Gateway Time-out" +} +``` + +## F.A.Q. + +**Q** How do I include extra information in my responses? `output.payload` is missing `data`, what gives? + +**A** There is a reason the values passed back in the response payloads are pretty locked down. It's mostly for security and to not leak any important information back to the client. This means you will need to put in a little more effort to include extra information about your custom error. Check out the ["Error transformation"](https://github.com/hapijs/hapi/blob/master/API.md#error-transformation) section in the hapi documentation. + +--- diff --git a/appasar/canary/node_modules/cryptiles/node_modules/boom/lib/index.js b/appasar/canary/node_modules/cryptiles/node_modules/boom/lib/index.js new file mode 100644 index 0000000..c57c79d --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/node_modules/boom/lib/index.js @@ -0,0 +1,457 @@ +'use strict'; + +// Load modules + +const Hoek = require('hoek'); + + +// Declare internals + +const internals = { + STATUS_CODES: Object.setPrototypeOf({ + '100': 'Continue', + '101': 'Switching Protocols', + '102': 'Processing', + '200': 'OK', + '201': 'Created', + '202': 'Accepted', + '203': 'Non-Authoritative Information', + '204': 'No Content', + '205': 'Reset Content', + '206': 'Partial Content', + '207': 'Multi-Status', + '300': 'Multiple Choices', + '301': 'Moved Permanently', + '302': 'Moved Temporarily', + '303': 'See Other', + '304': 'Not Modified', + '305': 'Use Proxy', + '307': 'Temporary Redirect', + '400': 'Bad Request', + '401': 'Unauthorized', + '402': 'Payment Required', + '403': 'Forbidden', + '404': 'Not Found', + '405': 'Method Not Allowed', + '406': 'Not Acceptable', + '407': 'Proxy Authentication Required', + '408': 'Request Time-out', + '409': 'Conflict', + '410': 'Gone', + '411': 'Length Required', + '412': 'Precondition Failed', + '413': 'Request Entity Too Large', + '414': 'Request-URI Too Large', + '415': 'Unsupported Media Type', + '416': 'Requested Range Not Satisfiable', + '417': 'Expectation Failed', + '418': 'I\'m a teapot', + '422': 'Unprocessable Entity', + '423': 'Locked', + '424': 'Failed Dependency', + '425': 'Unordered Collection', + '426': 'Upgrade Required', + '428': 'Precondition Required', + '429': 'Too Many Requests', + '431': 'Request Header Fields Too Large', + '451': 'Unavailable For Legal Reasons', + '500': 'Internal Server Error', + '501': 'Not Implemented', + '502': 'Bad Gateway', + '503': 'Service Unavailable', + '504': 'Gateway Time-out', + '505': 'HTTP Version Not Supported', + '506': 'Variant Also Negotiates', + '507': 'Insufficient Storage', + '509': 'Bandwidth Limit Exceeded', + '510': 'Not Extended', + '511': 'Network Authentication Required' + }, null) +}; + + +exports.boomify = function (error, options) { + + Hoek.assert(error instanceof Error, 'Cannot wrap non-Error object'); + + options = options || {}; + + if (!error.isBoom) { + return internals.initialize(error, options.statusCode || 500, options.message); + } + + if (options.override === false || // Defaults to true + (!options.statusCode && !options.message)) { + + return error; + } + + return internals.initialize(error, options.statusCode || error.output.statusCode, options.message); +}; + + +exports.wrap = function (error, statusCode, message) { + + Hoek.assert(error instanceof Error, 'Cannot wrap non-Error object'); + Hoek.assert(!error.isBoom || (!statusCode && !message), 'Cannot provide statusCode or message with boom error'); + + return (error.isBoom ? error : internals.initialize(error, statusCode || 500, message)); +}; + + +exports.create = function (statusCode, message, data) { + + return internals.create(statusCode, message, data, exports.create); +}; + + +internals.create = function (statusCode, message, data, ctor) { + + if (message instanceof Error) { + if (data) { + message.data = data; + } + + return exports.wrap(message, statusCode); + } + + const error = new Error(message ? message : undefined); // Avoids settings null message + Error.captureStackTrace(error, ctor); // Filter the stack to our external API + error.data = data || null; + internals.initialize(error, statusCode); + error.typeof = ctor; + + return error; +}; + + +internals.initialize = function (error, statusCode, message) { + + const numberCode = parseInt(statusCode, 10); + Hoek.assert(!isNaN(numberCode) && numberCode >= 400, 'First argument must be a number (400+):', statusCode); + + error.isBoom = true; + error.isServer = numberCode >= 500; + + if (!error.hasOwnProperty('data')) { + error.data = null; + } + + error.output = { + statusCode: numberCode, + payload: {}, + headers: {} + }; + + error.reformat = internals.reformat; + + if (!message && + !error.message) { + + error.reformat(); + message = error.output.payload.error; + } + + if (message) { + error.message = (message + (error.message ? ': ' + error.message : '')); + error.output.payload.message = error.message; + } + + error.reformat(); + return error; +}; + + +internals.reformat = function () { + + this.output.payload.statusCode = this.output.statusCode; + this.output.payload.error = internals.STATUS_CODES[this.output.statusCode] || 'Unknown'; + + if (this.output.statusCode === 500) { + this.output.payload.message = 'An internal server error occurred'; // Hide actual error from user + } + else if (this.message) { + this.output.payload.message = this.message; + } +}; + + +// 4xx Client Errors + +exports.badRequest = function (message, data) { + + return internals.create(400, message, data, exports.badRequest); +}; + + +exports.unauthorized = function (message, scheme, attributes) { // Or function (message, wwwAuthenticate[]) + + const err = internals.create(401, message, undefined, exports.unauthorized); + + if (!scheme) { + return err; + } + + let wwwAuthenticate = ''; + + if (typeof scheme === 'string') { + + // function (message, scheme, attributes) + + wwwAuthenticate = scheme; + + if (attributes || message) { + err.output.payload.attributes = {}; + } + + if (attributes) { + if (typeof attributes === 'string') { + wwwAuthenticate = wwwAuthenticate + ' ' + Hoek.escapeHeaderAttribute(attributes); + err.output.payload.attributes = attributes; + } + else { + const names = Object.keys(attributes); + for (let i = 0; i < names.length; ++i) { + const name = names[i]; + if (i) { + wwwAuthenticate = wwwAuthenticate + ','; + } + + let value = attributes[name]; + if (value === null || + value === undefined) { // Value can be zero + + value = ''; + } + wwwAuthenticate = wwwAuthenticate + ' ' + name + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"'; + err.output.payload.attributes[name] = value; + } + } + } + + + if (message) { + if (attributes) { + wwwAuthenticate = wwwAuthenticate + ','; + } + wwwAuthenticate = wwwAuthenticate + ' error="' + Hoek.escapeHeaderAttribute(message) + '"'; + err.output.payload.attributes.error = message; + } + else { + err.isMissing = true; + } + } + else { + + // function (message, wwwAuthenticate[]) + + const wwwArray = scheme; + for (let i = 0; i < wwwArray.length; ++i) { + if (i) { + wwwAuthenticate = wwwAuthenticate + ', '; + } + + wwwAuthenticate = wwwAuthenticate + wwwArray[i]; + } + } + + err.output.headers['WWW-Authenticate'] = wwwAuthenticate; + + return err; +}; + + +exports.paymentRequired = function (message, data) { + + return internals.create(402, message, data, exports.paymentRequired); +}; + + +exports.forbidden = function (message, data) { + + return internals.create(403, message, data, exports.forbidden); +}; + + +exports.notFound = function (message, data) { + + return internals.create(404, message, data, exports.notFound); +}; + + +exports.methodNotAllowed = function (message, data, allow) { + + const err = internals.create(405, message, data, exports.methodNotAllowed); + + if (typeof allow === 'string') { + allow = [allow]; + } + + if (Array.isArray(allow)) { + err.output.headers.Allow = allow.join(', '); + } + + return err; +}; + + +exports.notAcceptable = function (message, data) { + + return internals.create(406, message, data, exports.notAcceptable); +}; + + +exports.proxyAuthRequired = function (message, data) { + + return internals.create(407, message, data, exports.proxyAuthRequired); +}; + + +exports.clientTimeout = function (message, data) { + + return internals.create(408, message, data, exports.clientTimeout); +}; + + +exports.conflict = function (message, data) { + + return internals.create(409, message, data, exports.conflict); +}; + + +exports.resourceGone = function (message, data) { + + return internals.create(410, message, data, exports.resourceGone); +}; + + +exports.lengthRequired = function (message, data) { + + return internals.create(411, message, data, exports.lengthRequired); +}; + + +exports.preconditionFailed = function (message, data) { + + return internals.create(412, message, data, exports.preconditionFailed); +}; + + +exports.entityTooLarge = function (message, data) { + + return internals.create(413, message, data, exports.entityTooLarge); +}; + + +exports.uriTooLong = function (message, data) { + + return internals.create(414, message, data, exports.uriTooLong); +}; + + +exports.unsupportedMediaType = function (message, data) { + + return internals.create(415, message, data, exports.unsupportedMediaType); +}; + + +exports.rangeNotSatisfiable = function (message, data) { + + return internals.create(416, message, data, exports.rangeNotSatisfiable); +}; + + +exports.expectationFailed = function (message, data) { + + return internals.create(417, message, data, exports.expectationFailed); +}; + + +exports.teapot = function (message, data) { + + return internals.create(418, message, data, exports.teapot); +}; + + +exports.badData = function (message, data) { + + return internals.create(422, message, data, exports.badData); +}; + + +exports.locked = function (message, data) { + + return internals.create(423, message, data, exports.locked); +}; + + +exports.preconditionRequired = function (message, data) { + + return internals.create(428, message, data, exports.preconditionRequired); +}; + + +exports.tooManyRequests = function (message, data) { + + return internals.create(429, message, data, exports.tooManyRequests); +}; + + +exports.illegal = function (message, data) { + + return internals.create(451, message, data, exports.illegal); +}; + + +// 5xx Server Errors + +exports.internal = function (message, data, statusCode) { + + return internals.serverError(message, data, statusCode, exports.internal); +}; + + +internals.serverError = function (message, data, statusCode, ctor) { + + if (data instanceof Error && + !data.isBoom) { + + return exports.wrap(data, statusCode, message); + } + + const error = internals.create(statusCode || 500, message, undefined, ctor); + error.data = data; + return error; +}; + + +exports.notImplemented = function (message, data) { + + return internals.serverError(message, data, 501, exports.notImplemented); +}; + + +exports.badGateway = function (message, data) { + + return internals.serverError(message, data, 502, exports.badGateway); +}; + + +exports.serverUnavailable = function (message, data) { + + return internals.serverError(message, data, 503, exports.serverUnavailable); +}; + + +exports.gatewayTimeout = function (message, data) { + + return internals.serverError(message, data, 504, exports.gatewayTimeout); +}; + + +exports.badImplementation = function (message, data) { + + const err = internals.serverError(message, data, 500, exports.badImplementation); + err.isDeveloperError = true; + return err; +}; diff --git a/appasar/canary/node_modules/cryptiles/node_modules/boom/package.json b/appasar/canary/node_modules/cryptiles/node_modules/boom/package.json new file mode 100644 index 0000000..51a2c79 --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/node_modules/boom/package.json @@ -0,0 +1,29 @@ +{ + "name": "boom", + "description": "HTTP-friendly error objects", + "version": "5.2.0", + "repository": "git://github.com/hapijs/boom", + "main": "lib/index.js", + "keywords": [ + "error", + "http" + ], + "engines": { + "node": ">=4.0.0" + }, + "dependencies": { + "hoek": "4.x.x" + }, + "devDependencies": { + "code": "4.x.x", + "lab": "14.x.x", + "markdown-toc": "0.12.x" + }, + "scripts": { + "test": "lab -a code -t 100 -L -v", + "test-cov-html": "lab -a code -r html -o coverage.html -L", + "toc": "node generate-toc.js", + "version": "npm run toc && git add README.md" + }, + "license": "BSD-3-Clause" +} diff --git a/appasar/canary/node_modules/cryptiles/package.json b/appasar/canary/node_modules/cryptiles/package.json new file mode 100644 index 0000000..1295181 --- /dev/null +++ b/appasar/canary/node_modules/cryptiles/package.json @@ -0,0 +1,27 @@ +{ + "name": "cryptiles", + "description": "General purpose crypto utilities", + "version": "3.1.2", + "repository": "git://github.com/hapijs/cryptiles", + "main": "lib/index.js", + "keywords": [ + "cryptography", + "security", + "utilites" + ], + "engines": { + "node": ">=4.0.0" + }, + "dependencies": { + "boom": "5.x.x" + }, + "devDependencies": { + "code": "4.x.x", + "lab": "13.x.x" + }, + "scripts": { + "test": "lab -a code -t 100 -L", + "test-cov-html": "lab -a code -r html -o coverage.html" + }, + "license": "BSD-3-Clause" +} diff --git a/appasar/canary/node_modules/dashdash/CHANGES.md b/appasar/canary/node_modules/dashdash/CHANGES.md new file mode 100644 index 0000000..d7c8f4e --- /dev/null +++ b/appasar/canary/node_modules/dashdash/CHANGES.md @@ -0,0 +1,364 @@ +# node-dashdash changelog + +## not yet released + +(nothing yet) + +## 1.14.1 + +- [issue #30] Change the output used by dashdash's Bash completion support to + indicate "there are no completions for this argument" to cope with different + sorting rules on different Bash/platforms. For example: + + $ triton -v -p test2 package get <TAB> # before + ##-no -tritonpackage- completions-## + + $ triton -v -p test2 package get <TAB> # after + ##-no-completion- -results-## + +## 1.14.0 + +- New `synopsisFromOpt(<option spec>)` function. This will be used by + [node-cmdln](https://github.com/trentm/node-cmdln) to put together a synopsis + of options for a command. Some examples: + + > synopsisFromOpt({names: ['help', 'h'], type: 'bool'}); + '[ --help | -h ]' + > synopsisFromOpt({name: 'file', type: 'string', helpArg: 'FILE'}); + '[ --file=FILE ]' + + +## 1.13.1 + +- [issue #20] `bashCompletionSpecFromOptions` breaks on an options array with + an empty-string group. + + +## 1.13.0 + +- Update assert-plus dep to 1.x to get recent fixes (particularly for + `assert.optional*`). + +- Drop testing (and official support in packages.json#engines) for node 0.8.x. + Add testing against node 5.x and 4.x with `make testall`. + +- [pull #16] Change the `positiveInteger` type to NOT accept zero (0). + For those who might need the old behaviour, see + "examples/custom-option-intGteZero.js". (By Dave Pacheco.) + + +## 1.12.2 + +- Bash completion: Add `argtypes` to specify the types of positional args. + E.g. this would allow you to have an `ssh` command with `argtypes = ['host', + 'cmd']` for bash completion. You then have to provide Bash functions to + handle completing those types via the `specExtra` arg. See + "[examples/ddcompletion.js](examples/ddcompletion.js)" for an example. + +- Bash completion: Tweak so that options or only offered as completions when + there is a leading '-'. E.g. `mytool <TAB>` does NOT offer options, `mytool + -<TAB>` *does*. Without this, a tool with options would never be able to + fallback to Bash's "default" completion. For example `ls <TAB>` wouldn't + result in filename completion. Now it will. + +- Bash completion: A workaround for not being able to explicitly have *no* + completion results. Because dashdash's completion uses `complete -o default`, + we fallback to Bash's "default" completion (typically for filename + completion). Before this change, an attempt to explicitly say "there are + no completions that match" would unintentionally trigger filename completion. + Instead as a workaround we return: + + $ ddcompletion --none <TAB> # the 'none' argtype + ##-no completions-## + + $ ddcompletion # a custom 'fruit' argtype + apple banana orange + $ ddcompletion z + ##-no -fruit- completions-## + + This is a bit of a hack, but IMO a better experience than the surprise + of matching a local filename beginning with 'z', which isn't, in this + case, a "fruit". + +## 1.12.1 + +- Bash completion: Document `<option spec>.completionType`. Add `includeHidden` + option to `bashCompletionSpecFromOptions()`. Add support for dealing with + hidden subcmds. + + +## 1.12.0 + +- Support for generating Bash completion files. See the "Bash completion" + section of the README.md and "examples/ddcompletion.js" for an example. + + +## 1.11.0 + +- Add the `arrayFlatten` boolean option to `dashdash.addOptionType` used for + custom option types. This allows one to create an `arrayOf...` option type + where each usage of the option can return multiple results. For example: + + node mytool.js --foo a,b --foo c + + We could define an option type for `--foo` such that + `opts.foo = ['a', 'b', 'c']`. See + "[examples/custom-option-arrayOfCommaSepString.js](examples/custom-option-arrayOfCommaSepString.js)" + for an example. + + +## 1.10.1 + +- Trim the published package to the minimal bits. Before: 24K tarball, 144K unpacked. + After: 12K tarball, 48K unpacked. `npm` won't let me drop the README.md. :) + + +## 1.10.0 + +- [issue #9] Support `includeDefault` in help config (similar to `includeEnv`) to have a + note of an option's default value, if any, in help output. +- [issue #11] Fix option group breakage introduced in v1.9.0. + + +## 1.9.0 + +- [issue #10] Custom option types added with `addOptionType` can specify a + "default" value. See "examples/custom-option-fruit.js". + + +## 1.8.0 + +- Support `hidden: true` in an option spec to have help output exclude this + option. + + +## 1.7.3 + +- [issue #8] Fix parsing of a short option group when one of the + option takes an argument. For example, consider `tail` with + a `-f` boolean option and a `-n` option that takes a number + argument. This should parse: + + tail -fn5 + + Before this change, that would not parse correctly. + It is suspected that this was introduced in version 1.4.0 + (with commit 656fa8bc71c372ebddad0a7026bd71611e2ec99a). + + +## 1.7.2 + +- Known issues: #8 + +- Exclude 'tools/' dir in packages published to npm. + + +## 1.7.1 + +- Known issues: #8 + +- Support an option group *empty string* value: + + ... + { group: '' }, + ... + + to render as a blank line in option help. This can help separate loosely + related sets of options without resorting to a title for option groups. + + +## 1.7.0 + +- Known issues: #8 + +- [pull #7] Support for `<parser>.help({helpWrap: false, ...})` option to be able + to fully control the formatting for option help (by Patrick Mooney) `helpWrap: + false` can also be set on individual options in the option objects, e.g.: + + var options = [ + { + names: ['foo'], + type: 'string', + helpWrap: false, + help: 'long help with\n newlines' + + '\n spaces\n and such\nwill render correctly' + }, + ... + ]; + + +## 1.6.0 + +- Known issues: #8 + +- [pull #6] Support headings between groups of options (by Joshua M. Clulow) + so that this code: + + var options = [ + { group: 'Armament Options' }, + { names: [ 'weapon', 'w' ], type: 'string' }, + { group: 'General Options' }, + { names: [ 'help', 'h' ], type: 'bool' } + ]; + ... + + will give you this help output: + + ... + Armament Options: + -w, --weapon + + General Options: + -h, --help + ... + + +## 1.5.0 + +- Known issues: #8 + +- Add support for adding custom option types. "examples/custom-option-duration.js" + shows an example adding a "duration" option type. + + $ node custom-option-duration.js -t 1h + duration: 3600000 ms + $ node custom-option-duration.js -t 1s + duration: 1000 ms + $ node custom-option-duration.js -t 5d + duration: 432000000 ms + $ node custom-option-duration.js -t bogus + custom-option-duration.js: error: arg for "-t" is not a valid duration: "bogus" + + A custom option type is added via: + + var dashdash = require('dashdash'); + dashdash.addOptionType({ + name: '...', + takesArg: true, + helpArg: '...', + parseArg: function (option, optstr, arg) { + ... + } + }); + +- [issue #4] Add `date` and `arrayOfDate` option types. They accept these date + formats: epoch second times (e.g. 1396031701) and ISO 8601 format: + `YYYY-MM-DD[THH:MM:SS[.sss][Z]]` (e.g. "2014-03-28", + "2014-03-28T18:35:01.489Z"). See "examples/date.js" for an example usage. + + $ node examples/date.js -s 2014-01-01 -e $(date +%s) + start at 2014-01-01T00:00:00.000Z + end at 2014-03-29T04:26:18.000Z + + +## 1.4.0 + +- Known issues: #8 + +- [pull #2, pull #3] Add a `allowUnknown: true` option on `createParser` to + allow unknown options to be passed through as `opts._args` instead of parsing + throwing an exception (by https://github.com/isaacs). + + See 'allowUnknown' in the README for a subtle caveat. + + +## 1.3.2 + +- Fix a subtlety where a *bool* option using both `env` and `default` didn't + work exactly correctly. If `default: false` then all was fine (by luck). + However, if you had an option like this: + + options: [ { + names: ['verbose', 'v'], + env: 'FOO_VERBOSE', + 'default': true, // <--- this + type: 'bool' + } ], + + wanted `FOO_VERBOSE=0` to make the option false, then you need the fix + in this version of dashdash. + + +## 1.3.1 + +- [issue #1] Fix an envvar not winning over an option 'default'. Previously + an option with both `default` and `env` would never take a value from the + environment variable. E.g. `FOO_FILE` would never work here: + + options: [ { + names: ['file', 'f'], + env: 'FOO_FILE', + 'default': 'default.file', + type: 'string' + } ], + + +## 1.3.0 + +- [Backward incompatible change for boolean envvars] Change the + interpretation of environment variables for boolean options to consider '0' + to be false. Previous to this *any* value to the envvar was considered + true -- which was quite misleading. Example: + + $ FOO_VERBOSE=0 node examples/foo.js + # opts: { verbose: [ false ], + _order: [ { key: 'verbose', value: false, from: 'env' } ], + _args: [] } + # args: [] + + +## 1.2.1 + +- Fix for `parse.help({includeEnv: true, ...})` handling to ensure that an + option with an `env` **but no `help`** still has the "Environment: ..." + output. E.g.: + + { names: ['foo'], type: 'string', env: 'FOO' } + + ... + + --foo=ARG Environment: FOO=ARG + + +## 1.2.0 + +- Transform the option key on the `opts` object returned from + `<parser>.parse()` for convenience. Currently this is just + `s/-/_/g`, e.g. '--dry-run' -> `opts.dry_run`. This allow one to use hyphen + in option names (common) but not have to do silly things like + `opt["dry-run"]` to access the parsed results. + + +## 1.1.0 + +- Environment variable integration. Envvars can be associated with an option, + then option processing will fallback to using that envvar if defined and + if the option isn't specified in argv. See the "Environment variable + integration" section in the README. + +- Change the `<parser>.parse()` signature to take a single object with keys + for arguments. The old signature is still supported. + +- `dashdash.createParser(CONFIG)` alternative to `new dashdash.Parser(CONFIG)` + a la many node-land APIs. + + +## 1.0.2 + +- Add "positiveInteger" and "arrayOfPositiveInteger" option types that only + accept positive integers. + +- Add "integer" and "arrayOfInteger" option types that accepts only integers. + Note that, for better or worse, these do NOT accept: "0x42" (hex), "1e2" + (with exponent) or "1.", "3.0" (floats). + + +## 1.0.1 + +- Fix not modifying the given option spec objects (which breaks creating + a Parser with them more than once). + + +## 1.0.0 + +First release. diff --git a/appasar/canary/node_modules/dashdash/LICENSE.txt b/appasar/canary/node_modules/dashdash/LICENSE.txt new file mode 100644 index 0000000..54706c6 --- /dev/null +++ b/appasar/canary/node_modules/dashdash/LICENSE.txt @@ -0,0 +1,24 @@ +# This is the MIT license + +Copyright (c) 2013 Trent Mick. All rights reserved. +Copyright (c) 2013 Joyent Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/appasar/canary/node_modules/dashdash/README.md b/appasar/canary/node_modules/dashdash/README.md new file mode 100644 index 0000000..e47b106 --- /dev/null +++ b/appasar/canary/node_modules/dashdash/README.md @@ -0,0 +1,574 @@ +A light, featureful and explicit option parsing library for node.js. + +[Why another one? See below](#why). tl;dr: The others I've tried are one of +too loosey goosey (not explicit), too big/too many deps, or ill specified. +YMMV. + +Follow <a href="https://twitter.com/intent/user?screen_name=trentmick" target="_blank">@trentmick</a> +for updates to node-dashdash. + +# Install + + npm install dashdash + + +# Usage + +```javascript +var dashdash = require('dashdash'); + +// Specify the options. Minimally `name` (or `names`) and `type` +// must be given for each. +var options = [ + { + // `names` or a single `name`. First element is the `opts.KEY`. + names: ['help', 'h'], + // See "Option specs" below for types. + type: 'bool', + help: 'Print this help and exit.' + } +]; + +// Shortcut form. As called it infers `process.argv`. See below for +// the longer form to use methods like `.help()` on the Parser object. +var opts = dashdash.parse({options: options}); + +console.log("opts:", opts); +console.log("args:", opts._args); +``` + + +# Longer Example + +A more realistic [starter script "foo.js"](./examples/foo.js) is as follows. +This also shows using `parser.help()` for formatted option help. + +```javascript +var dashdash = require('./lib/dashdash'); + +var options = [ + { + name: 'version', + type: 'bool', + help: 'Print tool version and exit.' + }, + { + names: ['help', 'h'], + type: 'bool', + help: 'Print this help and exit.' + }, + { + names: ['verbose', 'v'], + type: 'arrayOfBool', + help: 'Verbose output. Use multiple times for more verbose.' + }, + { + names: ['file', 'f'], + type: 'string', + help: 'File to process', + helpArg: 'FILE' + } +]; + +var parser = dashdash.createParser({options: options}); +try { + var opts = parser.parse(process.argv); +} catch (e) { + console.error('foo: error: %s', e.message); + process.exit(1); +} + +console.log("# opts:", opts); +console.log("# args:", opts._args); + +// Use `parser.help()` for formatted options help. +if (opts.help) { + var help = parser.help({includeEnv: true}).trimRight(); + console.log('usage: node foo.js [OPTIONS]\n' + + 'options:\n' + + help); + process.exit(0); +} + +// ... +``` + + +Some example output from this script (foo.js): + +``` +$ node foo.js -h +# opts: { help: true, + _order: [ { name: 'help', value: true, from: 'argv' } ], + _args: [] } +# args: [] +usage: node foo.js [OPTIONS] +options: + --version Print tool version and exit. + -h, --help Print this help and exit. + -v, --verbose Verbose output. Use multiple times for more verbose. + -f FILE, --file=FILE File to process + +$ node foo.js -v +# opts: { verbose: [ true ], + _order: [ { name: 'verbose', value: true, from: 'argv' } ], + _args: [] } +# args: [] + +$ node foo.js --version arg1 +# opts: { version: true, + _order: [ { name: 'version', value: true, from: 'argv' } ], + _args: [ 'arg1' ] } +# args: [ 'arg1' ] + +$ node foo.js -f bar.txt +# opts: { file: 'bar.txt', + _order: [ { name: 'file', value: 'bar.txt', from: 'argv' } ], + _args: [] } +# args: [] + +$ node foo.js -vvv --file=blah +# opts: { verbose: [ true, true, true ], + file: 'blah', + _order: + [ { name: 'verbose', value: true, from: 'argv' }, + { name: 'verbose', value: true, from: 'argv' }, + { name: 'verbose', value: true, from: 'argv' }, + { name: 'file', value: 'blah', from: 'argv' } ], + _args: [] } +# args: [] +``` + + +See the ["examples"](examples/) dir for a number of starter examples using +some of dashdash's features. + + +# Environment variable integration + +If you want to allow environment variables to specify options to your tool, +dashdash makes this easy. We can change the 'verbose' option in the example +above to include an 'env' field: + +```javascript + { + names: ['verbose', 'v'], + type: 'arrayOfBool', + env: 'FOO_VERBOSE', // <--- add this line + help: 'Verbose output. Use multiple times for more verbose.' + }, +``` + +then the **"FOO_VERBOSE" environment variable** can be used to set this +option: + +```shell +$ FOO_VERBOSE=1 node foo.js +# opts: { verbose: [ true ], + _order: [ { name: 'verbose', value: true, from: 'env' } ], + _args: [] } +# args: [] +``` + +Boolean options will interpret the empty string as unset, '0' as false +and anything else as true. + +```shell +$ FOO_VERBOSE= node examples/foo.js # not set +# opts: { _order: [], _args: [] } +# args: [] + +$ FOO_VERBOSE=0 node examples/foo.js # '0' is false +# opts: { verbose: [ false ], + _order: [ { key: 'verbose', value: false, from: 'env' } ], + _args: [] } +# args: [] + +$ FOO_VERBOSE=1 node examples/foo.js # true +# opts: { verbose: [ true ], + _order: [ { key: 'verbose', value: true, from: 'env' } ], + _args: [] } +# args: [] + +$ FOO_VERBOSE=boogabooga node examples/foo.js # true +# opts: { verbose: [ true ], + _order: [ { key: 'verbose', value: true, from: 'env' } ], + _args: [] } +# args: [] +``` + +Non-booleans can be used as well. Strings: + +```shell +$ FOO_FILE=data.txt node examples/foo.js +# opts: { file: 'data.txt', + _order: [ { key: 'file', value: 'data.txt', from: 'env' } ], + _args: [] } +# args: [] +``` + +Numbers: + +```shell +$ FOO_TIMEOUT=5000 node examples/foo.js +# opts: { timeout: 5000, + _order: [ { key: 'timeout', value: 5000, from: 'env' } ], + _args: [] } +# args: [] + +$ FOO_TIMEOUT=blarg node examples/foo.js +foo: error: arg for "FOO_TIMEOUT" is not a positive integer: "blarg" +``` + +With the `includeEnv: true` config to `parser.help()` the environment +variable can also be included in **help output**: + + usage: node foo.js [OPTIONS] + options: + --version Print tool version and exit. + -h, --help Print this help and exit. + -v, --verbose Verbose output. Use multiple times for more verbose. + Environment: FOO_VERBOSE=1 + -f FILE, --file=FILE File to process + + +# Bash completion + +Dashdash provides a simple way to create a Bash completion file that you +can place in your "bash_completion.d" directory -- sometimes that is +"/usr/local/etc/bash_completion.d/"). Features: + +- Support for short and long opts +- Support for knowing which options take arguments +- Support for subcommands (e.g. 'git log <TAB>' to show just options for the + log subcommand). See + [node-cmdln](https://github.com/trentm/node-cmdln#bash-completion) for + how to integrate that. +- Does the right thing with "--" to stop options. +- Custom optarg and arg types for custom completions. + +Dashdash will return bash completion file content given a parser instance: + + var parser = dashdash.createParser({options: options}); + console.log( parser.bashCompletion({name: 'mycli'}) ); + +or directly from a `options` array of options specs: + + var code = dashdash.bashCompletionFromOptions({ + name: 'mycli', + options: OPTIONS + }); + +Write that content to "/usr/local/etc/bash_completion.d/mycli" and you will +have Bash completions for `mycli`. Alternatively you can write it to +any file (e.g. "~/.bashrc") and source it. + +You could add a `--completion` hidden option to your tool that emits the +completion content and document for your users to call that to install +Bash completions. + +See [examples/ddcompletion.js](examples/ddcompletion.js) for a complete +example, including how one can define bash functions for completion of custom +option types. Also see [node-cmdln](https://github.com/trentm/node-cmdln) for +how it uses this for Bash completion for full multi-subcommand tools. + +- TODO: document specExtra +- TODO: document includeHidden +- TODO: document custom types, `function complete\_FOO` guide, completionType +- TODO: document argtypes + + +# Parser config + +Parser construction (i.e. `dashdash.createParser(CONFIG)`) takes the +following fields: + +- `options` (Array of option specs). Required. See the + [Option specs](#option-specs) section below. + +- `interspersed` (Boolean). Optional. Default is true. If true this allows + interspersed arguments and options. I.e.: + + node ./tool.js -v arg1 arg2 -h # '-h' is after interspersed args + + Set it to false to have '-h' **not** get parsed as an option in the above + example. + +- `allowUnknown` (Boolean). Optional. Default is false. If false, this causes + unknown arguments to throw an error. I.e.: + + node ./tool.js -v arg1 --afe8asefksjefhas + + Set it to true to treat the unknown option as a positional + argument. + + **Caveat**: When a shortopt group, such as `-xaz` contains a mix of + known and unknown options, the *entire* group is passed through + unmolested as a positional argument. + + Consider if you have a known short option `-a`, and parse the + following command line: + + node ./tool.js -xaz + + where `-x` and `-z` are unknown. There are multiple ways to + interpret this: + + 1. `-x` takes a value: `{x: 'az'}` + 2. `-x` and `-z` are both booleans: `{x:true,a:true,z:true}` + + Since dashdash does not know what `-x` and `-z` are, it can't know + if you'd prefer to receive `{a:true,_args:['-x','-z']}` or + `{x:'az'}`, or `{_args:['-xaz']}`. Leaving the positional arg unprocessed + is the easiest mistake for the user to recover from. + + +# Option specs + +Example using all fields (required fields are noted): + +```javascript +{ + names: ['file', 'f'], // Required (one of `names` or `name`). + type: 'string', // Required. + completionType: 'filename', + env: 'MYTOOL_FILE', + help: 'Config file to load before running "mytool"', + helpArg: 'PATH', + helpWrap: false, + default: path.resolve(process.env.HOME, '.mytoolrc') +} +``` + +Each option spec in the `options` array must/can have the following fields: + +- `name` (String) or `names` (Array). Required. These give the option name + and aliases. The first name (if more than one given) is the key for the + parsed `opts` object. + +- `type` (String). Required. One of: + + - bool + - string + - number + - integer + - positiveInteger + - date (epoch seconds, e.g. 1396031701, or ISO 8601 format + `YYYY-MM-DD[THH:MM:SS[.sss][Z]]`, e.g. "2014-03-28T18:35:01.489Z") + - arrayOfBool + - arrayOfString + - arrayOfNumber + - arrayOfInteger + - arrayOfPositiveInteger + - arrayOfDate + + FWIW, these names attempt to match with asserts on + [assert-plus](https://github.com/mcavage/node-assert-plus). + You can add your own custom option types with `dashdash.addOptionType`. + See below. + +- `completionType` (String). Optional. This is used for [Bash + completion](#bash-completion) for an option argument. If not specified, + then the value of `type` is used. Any string may be specified, but only the + following values have meaning: + + - `none`: Provide no completions. + - `file`: Bash's default completion (i.e. `complete -o default`), which + includes filenames. + - *Any string FOO for which a `function complete_FOO` Bash function is + defined.* This is for custom completions for a given tool. Typically + these custom functions are provided in the `specExtra` argument to + `dashdash.bashCompletionFromOptions()`. See + ["examples/ddcompletion.js"](examples/ddcompletion.js) for an example. + +- `env` (String or Array of String). Optional. An environment variable name + (or names) that can be used as a fallback for this option. For example, + given a "foo.js" like this: + + var options = [{names: ['dry-run', 'n'], env: 'FOO_DRY_RUN'}]; + var opts = dashdash.parse({options: options}); + + Both `node foo.js --dry-run` and `FOO_DRY_RUN=1 node foo.js` would result + in `opts.dry_run = true`. + + An environment variable is only used as a fallback, i.e. it is ignored if + the associated option is given in `argv`. + +- `help` (String). Optional. Used for `parser.help()` output. + +- `helpArg` (String). Optional. Used in help output as the placeholder for + the option argument, e.g. the "PATH" in: + + ... + -f PATH, --file=PATH File to process + ... + +- `helpWrap` (Boolean). Optional, default true. Set this to `false` to have + that option's `help` *not* be text wrapped in `<parser>.help()` output. + +- `default`. Optional. A default value used for this option, if the + option isn't specified in argv. + +- `hidden` (Boolean). Optional, default false. If true, help output will not + include this option. See also the `includeHidden` option to + `bashCompletionFromOptions()` for [Bash completion](#bash-completion). + + +# Option group headings + +You can add headings between option specs in the `options` array. To do so, +simply add an object with only a `group` property -- the string to print as +the heading for the subsequent options in the array. For example: + +```javascript +var options = [ + { + group: 'Armament Options' + }, + { + names: [ 'weapon', 'w' ], + type: 'string' + }, + { + group: 'General Options' + }, + { + names: [ 'help', 'h' ], + type: 'bool' + } +]; +... +``` + +Note: You can use an empty string, `{group: ''}`, to get a blank line in help +output between groups of options. + + +# Help config + +The `parser.help(...)` function is configurable as follows: + + Options: + Armament Options: + ^^ -w WEAPON, --weapon=WEAPON Weapon with which to crush. One of: | + / sword, spear, maul | + / General Options: | + / -h, --help Print this help and exit. | + / ^^^^ ^ | + \ `-- indent `-- helpCol maxCol ---' + `-- headingIndent + +- `indent` (Number or String). Default 4. Set to a number (for that many + spaces) or a string for the literal indent. +- `headingIndent` (Number or String). Default half length of `indent`. Set to + a number (for that many spaces) or a string for the literal indent. This + indent applies to group heading lines, between normal option lines. +- `nameSort` (String). Default is 'length'. By default the names are + sorted to put the short opts first (i.e. '-h, --help' preferred + to '--help, -h'). Set to 'none' to not do this sorting. +- `maxCol` (Number). Default 80. Note that reflow is just done on whitespace + so a long token in the option help can overflow maxCol. +- `helpCol` (Number). If not set a reasonable value will be determined + between `minHelpCol` and `maxHelpCol`. +- `minHelpCol` (Number). Default 20. +- `maxHelpCol` (Number). Default 40. +- `helpWrap` (Boolean). Default true. Set to `false` to have option `help` + strings *not* be textwrapped to the helpCol..maxCol range. +- `includeEnv` (Boolean). Default false. If the option has associated + environment variables (via the `env` option spec attribute), then + append mentioned of those envvars to the help string. +- `includeDefault` (Boolean). Default false. If the option has a default value + (via the `default` option spec attribute, or a default on the option's type), + then a "Default: VALUE" string will be appended to the help string. + + +# Custom option types + +Dashdash includes a good starter set of option types that it will parse for +you. However, you can add your own via: + + var dashdash = require('dashdash'); + dashdash.addOptionType({ + name: '...', + takesArg: true, + helpArg: '...', + parseArg: function (option, optstr, arg) { + ... + }, + array: false, // optional + arrayFlatten: false, // optional + default: ..., // optional + completionType: ... // optional + }); + +For example, a simple option type that accepts 'yes', 'y', 'no' or 'n' as +a boolean argument would look like: + + var dashdash = require('dashdash'); + + function parseYesNo(option, optstr, arg) { + var argLower = arg.toLowerCase() + if (~['yes', 'y'].indexOf(argLower)) { + return true; + } else if (~['no', 'n'].indexOf(argLower)) { + return false; + } else { + throw new Error(format( + 'arg for "%s" is not "yes" or "no": "%s"', + optstr, arg)); + } + } + + dashdash.addOptionType({ + name: 'yesno' + takesArg: true, + helpArg: '<yes|no>', + parseArg: parseYesNo + }); + + var options = { + {names: ['answer', 'a'], type: 'yesno'} + }; + var opts = dashdash.parse({options: options}); + +See "examples/custom-option-\*.js" for other examples. +See the `addOptionType` block comment in "lib/dashdash.js" for more details. +Please let me know [with an +issue](https://github.com/trentm/node-dashdash/issues/new) if you write a +generally useful one. + + + +# Why + +Why another node.js option parsing lib? + +- `nopt` really is just for "tools like npm". Implicit opts (e.g. '--no-foo' + works for every '--foo'). Can't disable abbreviated opts. Can't do multiple + usages of same opt, e.g. '-vvv' (I think). Can't do grouped short opts. + +- `optimist` has surprise interpretation of options (at least to me). + Implicit opts mean ambiguities and poor error handling for fat-fingering. + `process.exit` calls makes it hard to use as a libary. + +- `optparse` Incomplete docs. Is this an attempted clone of Python's `optparse`. + Not clear. Some divergence. `parser.on("name", ...)` API is weird. + +- `argparse` Dep on underscore. No thanks just for option processing. + `find lib | wc -l` -> `26`. Overkill. + Argparse is a bit different anyway. Not sure I want that. + +- `posix-getopt` No type validation. Though that isn't a killer. AFAIK can't + have a long opt without a short alias. I.e. no `getopt_long` semantics. + Also, no whizbang features like generated help output. + +- ["commander.js"](https://github.com/visionmedia/commander.js): I wrote + [a critique](http://trentm.com/2014/01/a-critique-of-commander-for-nodejs.html) + a while back. It seems fine, but last I checked had + [an outstanding bug](https://github.com/visionmedia/commander.js/pull/121) + that would prevent me from using it. + + +# License + +MIT. See LICENSE.txt. diff --git a/appasar/canary/node_modules/dashdash/etc/dashdash.bash_completion.in b/appasar/canary/node_modules/dashdash/etc/dashdash.bash_completion.in new file mode 100644 index 0000000..dc33309 --- /dev/null +++ b/appasar/canary/node_modules/dashdash/etc/dashdash.bash_completion.in @@ -0,0 +1,389 @@ +#!/bin/bash +# +# Bash completion generated for '{{name}}' at {{date}}. +# +# The original template lives here: +# https://github.com/trentm/node-dashdash/blob/master/etc/dashdash.bash_completion.in +# + +# +# Copyright 2016 Trent Mick +# Copyright 2016 Joyent, Inc. +# +# +# A generic Bash completion driver script. +# +# This is meant to provide a re-usable chunk of Bash to use for +# "etc/bash_completion.d/" files for individual tools. Only the "Configuration" +# section with tool-specific info need differ. Features: +# +# - support for short and long opts +# - support for knowing which options take arguments +# - support for subcommands (e.g. 'git log <TAB>' to show just options for the +# log subcommand) +# - does the right thing with "--" to stop options +# - custom optarg and arg types for custom completions +# - (TODO) support for shells other than Bash (tcsh, zsh, fish?, etc.) +# +# +# Examples/design: +# +# 1. Bash "default" completion. By default Bash's 'complete -o default' is +# enabled. That means when there are no completions (e.g. if no opts match +# the current word), then you'll get Bash's default completion. Most notably +# that means you get filename completion. E.g.: +# $ tool ./<TAB> +# $ tool READ<TAB> +# +# 2. all opts and subcmds: +# $ tool <TAB> +# $ tool -v <TAB> # assuming '-v' doesn't take an arg +# $ tool -<TAB> # matching opts +# $ git lo<TAB> # matching subcmds +# +# Long opt completions are given *without* the '=', i.e. we prefer space +# separated because that's easier for good completions. +# +# 3. long opt arg with '=' +# $ tool --file=<TAB> +# $ tool --file=./d<TAB> +# We maintain the "--file=" prefix. Limitation: With the attached prefix +# the 'complete -o filenames' doesn't know to do dirname '/' suffixing. Meh. +# +# 4. envvars: +# $ tool $<TAB> +# $ tool $P<TAB> +# Limitation: Currently only getting exported vars, so we miss "PS1" and +# others. +# +# 5. Defer to other completion in a subshell: +# $ tool --file $(cat ./<TAB> +# We get this from 'complete -o default ...'. +# +# 6. Custom completion types from a provided bash function. +# $ tool --profile <TAB> # complete available "profiles" +# +# +# Dev Notes: +# - compgen notes, from http://unix.stackexchange.com/questions/151118/understand-compgen-builtin-command +# - https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion-Builtins.html +# + + +# Debugging this completion: +# 1. Uncomment the "_{{name}}_log_file=..." line. +# 2. 'tail -f /var/tmp/dashdash-completion.log' in one terminal. +# 3. Re-source this bash completion file. +#_{{name}}_log=/var/tmp/dashdash-completion.log + +function _{{name}}_completer { + + # ---- cmd definition + + {{spec}} + + + # ---- locals + + declare -a argv + + + # ---- support functions + + function trace { + [[ -n "$_{{name}}_log" ]] && echo "$*" >&2 + } + + function _dashdash_complete { + local idx context + idx=$1 + context=$2 + + local shortopts longopts optargs subcmds allsubcmds argtypes + shortopts="$(eval "echo \${cmd${context}_shortopts}")" + longopts="$(eval "echo \${cmd${context}_longopts}")" + optargs="$(eval "echo \${cmd${context}_optargs}")" + subcmds="$(eval "echo \${cmd${context}_subcmds}")" + allsubcmds="$(eval "echo \${cmd${context}_allsubcmds}")" + IFS=', ' read -r -a argtypes <<< "$(eval "echo \${cmd${context}_argtypes}")" + + trace "" + trace "_dashdash_complete(idx=$idx, context=$context)" + trace " shortopts: $shortopts" + trace " longopts: $longopts" + trace " optargs: $optargs" + trace " subcmds: $subcmds" + trace " allsubcmds: $allsubcmds" + + # Get 'state' of option parsing at this COMP_POINT. + # Copying "dashdash.js#parse()" behaviour here. + local state= + local nargs=0 + local i=$idx + local argtype + local optname + local prefix + local word + local dashdashseen= + while [[ $i -lt $len && $i -le $COMP_CWORD ]]; do + argtype= + optname= + prefix= + word= + + arg=${argv[$i]} + trace " consider argv[$i]: '$arg'" + + if [[ "$arg" == "--" && $i -lt $COMP_CWORD ]]; then + trace " dashdash seen" + dashdashseen=yes + state=arg + word=$arg + elif [[ -z "$dashdashseen" && "${arg:0:2}" == "--" ]]; then + arg=${arg:2} + if [[ "$arg" == *"="* ]]; then + optname=${arg%%=*} + val=${arg##*=} + trace " long opt: optname='$optname' val='$val'" + state=arg + argtype=$(echo "$optargs" | awk -F "-$optname=" '{print $2}' | cut -d' ' -f1) + word=$val + prefix="--$optname=" + else + optname=$arg + val= + trace " long opt: optname='$optname'" + state=longopt + word=--$optname + + if [[ "$optargs" == *"-$optname="* && $i -lt $COMP_CWORD ]]; then + i=$(( $i + 1 )) + state=arg + argtype=$(echo "$optargs" | awk -F "-$optname=" '{print $2}' | cut -d' ' -f1) + word=${argv[$i]} + trace " takes arg (consume argv[$i], word='$word')" + fi + fi + elif [[ -z "$dashdashseen" && "${arg:0:1}" == "-" ]]; then + trace " short opt group" + state=shortopt + word=$arg + + local j=1 + while [[ $j -lt ${#arg} ]]; do + optname=${arg:$j:1} + trace " consider index $j: optname '$optname'" + + if [[ "$optargs" == *"-$optname="* ]]; then + argtype=$(echo "$optargs" | awk -F "-$optname=" '{print $2}' | cut -d' ' -f1) + if [[ $(( $j + 1 )) -lt ${#arg} ]]; then + state=arg + word=${arg:$(( $j + 1 ))} + trace " takes arg (rest of this arg, word='$word', argtype='$argtype')" + elif [[ $i -lt $COMP_CWORD ]]; then + state=arg + i=$(( $i + 1 )) + word=${argv[$i]} + trace " takes arg (word='$word', argtype='$argtype')" + fi + break + fi + + j=$(( $j + 1 )) + done + elif [[ $i -lt $COMP_CWORD && -n "$arg" ]] && $(echo "$allsubcmds" | grep -w "$arg" >/dev/null); then + trace " complete subcmd: recurse _dashdash_complete" + _dashdash_complete $(( $i + 1 )) "${context}__${arg/-/_}" + return + else + trace " not an opt or a complete subcmd" + state=arg + word=$arg + nargs=$(( $nargs + 1 )) + if [[ ${#argtypes[@]} -gt 0 ]]; then + argtype="${argtypes[$(( $nargs - 1 ))]}" + if [[ -z "$argtype" ]]; then + # If we have more args than argtypes, we use the + # last type. + argtype="${argtypes[@]: -1:1}" + fi + fi + fi + + trace " state=$state prefix='$prefix' word='$word'" + i=$(( $i + 1 )) + done + + trace " parsed: state=$state optname='$optname' argtype='$argtype' prefix='$prefix' word='$word' dashdashseen=$dashdashseen" + local compgen_opts= + if [[ -n "$prefix" ]]; then + compgen_opts="$compgen_opts -P $prefix" + fi + + case $state in + shortopt) + compgen $compgen_opts -W "$shortopts $longopts" -- "$word" + ;; + longopt) + compgen $compgen_opts -W "$longopts" -- "$word" + ;; + arg) + # If we don't know what completion to do, then emit nothing. We + # expect that we are running with: + # complete -o default ... + # where "default" means: "Use Readline's default completion if + # the compspec generates no matches." This gives us the good filename + # completion, completion in subshells/backticks. + # + # We cannot support an argtype="directory" because + # compgen -S '/' -A directory -- "$word" + # doesn't give a satisfying result. It doesn't stop at the trailing '/' + # so you cannot descend into dirs. + if [[ "${word:0:1}" == '$' ]]; then + # By default, Bash will complete '$<TAB>' to all envvars. Apparently + # 'complete -o default' does *not* give us that. The following + # gets *close* to the same completions: '-A export' misses envvars + # like "PS1". + trace " completing envvars" + compgen $compgen_opts -P '$' -A export -- "${word:1}" + elif [[ -z "$argtype" ]]; then + # Only include opts in completions if $word is not empty. + # This is to avoid completing the leading '-', which foils + # using 'default' completion. + if [[ -n "$dashdashseen" ]]; then + trace " completing subcmds, if any (no argtype, dashdash seen)" + compgen $compgen_opts -W "$subcmds" -- "$word" + elif [[ -z "$word" ]]; then + trace " completing subcmds, if any (no argtype, empty word)" + compgen $compgen_opts -W "$subcmds" -- "$word" + else + trace " completing opts & subcmds (no argtype)" + compgen $compgen_opts -W "$shortopts $longopts $subcmds" -- "$word" + fi + elif [[ $argtype == "none" ]]; then + # We want *no* completions, i.e. some way to get the active + # 'complete -o default' to not do filename completion. + trace " completing 'none' (hack to imply no completions)" + echo "##-no-completion- -results-##" + elif [[ $argtype == "file" ]]; then + # 'complete -o default' gives the best filename completion, at least + # on Mac. + trace " completing 'file' (let 'complete -o default' handle it)" + echo "" + elif ! type complete_$argtype 2>/dev/null >/dev/null; then + trace " completing '$argtype' (fallback to default b/c complete_$argtype is unknown)" + echo "" + else + trace " completing custom '$argtype'" + completions=$(complete_$argtype "$word") + if [[ -z "$completions" ]]; then + trace " no custom '$argtype' completions" + # These are in ascii and "dictionary" order so they sort + # correctly. + echo "##-no-completion- -results-##" + else + echo $completions + fi + fi + ;; + *) + trace " unknown state: $state" + ;; + esac + } + + + trace "" + trace "-- $(date)" + #trace "\$IFS: '$IFS'" + #trace "\$@: '$@'" + #trace "COMP_WORDBREAKS: '$COMP_WORDBREAKS'" + trace "COMP_CWORD: '$COMP_CWORD'" + trace "COMP_LINE: '$COMP_LINE'" + trace "COMP_POINT: $COMP_POINT" + + # Guard against negative COMP_CWORD. This is a Bash bug at least on + # Mac 10.10.4's bash. See + # <https://lists.gnu.org/archive/html/bug-bash/2009-07/msg00125.html>. + if [[ $COMP_CWORD -lt 0 ]]; then + trace "abort on negative COMP_CWORD" + exit 1; + fi + + # I don't know how to do array manip on argv vars, + # so copy over to argv array to work on them. + shift # the leading '--' + i=0 + len=$# + while [[ $# -gt 0 ]]; do + argv[$i]=$1 + shift; + i=$(( $i + 1 )) + done + trace "argv: '${argv[@]}'" + trace "argv[COMP_CWORD-1]: '${argv[$(( $COMP_CWORD - 1 ))]}'" + trace "argv[COMP_CWORD]: '${argv[$COMP_CWORD]}'" + trace "argv len: '$len'" + + _dashdash_complete 1 "" +} + + +# ---- mainline + +# Note: This if-block to help work with 'compdef' and 'compctl' is +# adapted from 'npm completion'. +if type complete &>/dev/null; then + function _{{name}}_completion { + local _log_file=/dev/null + [[ -z "$_{{name}}_log" ]] || _log_file="$_{{name}}_log" + COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + _{{name}}_completer -- "${COMP_WORDS[@]}" \ + 2>$_log_file)) || return $? + } + complete -o default -F _{{name}}_completion {{name}} +elif type compdef &>/dev/null; then + function _{{name}}_completion { + local _log_file=/dev/null + [[ -z "$_{{name}}_log" ]] || _log_file="$_{{name}}_log" + compadd -- $(COMP_CWORD=$((CURRENT-1)) \ + COMP_LINE=$BUFFER \ + COMP_POINT=0 \ + _{{name}}_completer -- "${words[@]}" \ + 2>$_log_file) + } + compdef _{{name}}_completion {{name}} +elif type compctl &>/dev/null; then + function _{{name}}_completion { + local cword line point words si + read -Ac words + read -cn cword + let cword-=1 + read -l line + read -ln point + local _log_file=/dev/null + [[ -z "$_{{name}}_log" ]] || _log_file="$_{{name}}_log" + reply=($(COMP_CWORD="$cword" \ + COMP_LINE="$line" \ + COMP_POINT="$point" \ + _{{name}}_completer -- "${words[@]}" \ + 2>$_log_file)) || return $? + } + compctl -K _{{name}}_completion {{name}} +fi + + +## +## This is a Bash completion file for the '{{name}}' command. You can install +## with either: +## +## cp FILE /usr/local/etc/bash_completion.d/{{name}} # Mac +## cp FILE /etc/bash_completion.d/{{name}} # Linux +## +## or: +## +## cp FILE > ~/.{{name}}.completion +## echo "source ~/.{{name}}.completion" >> ~/.bashrc +## \ No newline at end of file diff --git a/appasar/canary/node_modules/dashdash/lib/dashdash.js b/appasar/canary/node_modules/dashdash/lib/dashdash.js new file mode 100644 index 0000000..adb6f13 --- /dev/null +++ b/appasar/canary/node_modules/dashdash/lib/dashdash.js @@ -0,0 +1,1055 @@ +/** + * dashdash - A light, featureful and explicit option parsing library for + * node.js. + */ +// vim: set ts=4 sts=4 sw=4 et: + +var assert = require('assert-plus'); +var format = require('util').format; +var fs = require('fs'); +var path = require('path'); + + +var DEBUG = true; +if (DEBUG) { + var debug = console.warn; +} else { + var debug = function () {}; +} + + + +// ---- internal support stuff + +// Replace {{variable}} in `s` with the template data in `d`. +function renderTemplate(s, d) { + return s.replace(/{{([a-zA-Z]+)}}/g, function (match, key) { + return d.hasOwnProperty(key) ? d[key] : match; + }); +} + +/** + * Return a shallow copy of the given object; + */ +function shallowCopy(obj) { + if (!obj) { + return (obj); + } + var copy = {}; + Object.keys(obj).forEach(function (k) { + copy[k] = obj[k]; + }); + return (copy); +} + + +function space(n) { + var s = ''; + for (var i = 0; i < n; i++) { + s += ' '; + } + return s; +} + + +function makeIndent(arg, deflen, name) { + if (arg === null || arg === undefined) + return space(deflen); + else if (typeof (arg) === 'number') + return space(arg); + else if (typeof (arg) === 'string') + return arg; + else + assert.fail('invalid "' + name + '": not a string or number: ' + arg); +} + + +/** + * Return an array of lines wrapping the given text to the given width. + * This splits on whitespace. Single tokens longer than `width` are not + * broken up. + */ +function textwrap(s, width) { + var words = s.trim().split(/\s+/); + var lines = []; + var line = ''; + words.forEach(function (w) { + var newLength = line.length + w.length; + if (line.length > 0) + newLength += 1; + if (newLength > width) { + lines.push(line); + line = ''; + } + if (line.length > 0) + line += ' '; + line += w; + }); + lines.push(line); + return lines; +} + + +/** + * Transform an option name to a "key" that is used as the field + * on the `opts` object returned from `<parser>.parse()`. + * + * Transformations: + * - '-' -> '_': This allow one to use hyphen in option names (common) + * but not have to do silly things like `opt["dry-run"]` to access the + * parsed results. + */ +function optionKeyFromName(name) { + return name.replace(/-/g, '_'); +} + + + +// ---- Option types + +function parseBool(option, optstr, arg) { + return Boolean(arg); +} + +function parseString(option, optstr, arg) { + assert.string(arg, 'arg'); + return arg; +} + +function parseNumber(option, optstr, arg) { + assert.string(arg, 'arg'); + var num = Number(arg); + if (isNaN(num)) { + throw new Error(format('arg for "%s" is not a number: "%s"', + optstr, arg)); + } + return num; +} + +function parseInteger(option, optstr, arg) { + assert.string(arg, 'arg'); + var num = Number(arg); + if (!/^[0-9-]+$/.test(arg) || isNaN(num)) { + throw new Error(format('arg for "%s" is not an integer: "%s"', + optstr, arg)); + } + return num; +} + +function parsePositiveInteger(option, optstr, arg) { + assert.string(arg, 'arg'); + var num = Number(arg); + if (!/^[0-9]+$/.test(arg) || isNaN(num) || num === 0) { + throw new Error(format('arg for "%s" is not a positive integer: "%s"', + optstr, arg)); + } + return num; +} + +/** + * Supported date args: + * - epoch second times (e.g. 1396031701) + * - ISO 8601 format: YYYY-MM-DD[THH:MM:SS[.sss][Z]] + * 2014-03-28T18:35:01.489Z + * 2014-03-28T18:35:01.489 + * 2014-03-28T18:35:01Z + * 2014-03-28T18:35:01 + * 2014-03-28 + */ +function parseDate(option, optstr, arg) { + assert.string(arg, 'arg'); + var date; + if (/^\d+$/.test(arg)) { + // epoch seconds + date = new Date(Number(arg) * 1000); + /* JSSTYLED */ + } else if (/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?Z?)?$/i.test(arg)) { + // ISO 8601 format + date = new Date(arg); + } else { + throw new Error(format('arg for "%s" is not a valid date format: "%s"', + optstr, arg)); + } + if (date.toString() === 'Invalid Date') { + throw new Error(format('arg for "%s" is an invalid date: "%s"', + optstr, arg)); + } + return date; +} + +var optionTypes = { + bool: { + takesArg: false, + parseArg: parseBool + }, + string: { + takesArg: true, + helpArg: 'ARG', + parseArg: parseString + }, + number: { + takesArg: true, + helpArg: 'NUM', + parseArg: parseNumber + }, + integer: { + takesArg: true, + helpArg: 'INT', + parseArg: parseInteger + }, + positiveInteger: { + takesArg: true, + helpArg: 'INT', + parseArg: parsePositiveInteger + }, + date: { + takesArg: true, + helpArg: 'DATE', + parseArg: parseDate + }, + arrayOfBool: { + takesArg: false, + array: true, + parseArg: parseBool + }, + arrayOfString: { + takesArg: true, + helpArg: 'ARG', + array: true, + parseArg: parseString + }, + arrayOfNumber: { + takesArg: true, + helpArg: 'NUM', + array: true, + parseArg: parseNumber + }, + arrayOfInteger: { + takesArg: true, + helpArg: 'INT', + array: true, + parseArg: parseInteger + }, + arrayOfPositiveInteger: { + takesArg: true, + helpArg: 'INT', + array: true, + parseArg: parsePositiveInteger + }, + arrayOfDate: { + takesArg: true, + helpArg: 'INT', + array: true, + parseArg: parseDate + }, +}; + + + +// ---- Parser + +/** + * Parser constructor. + * + * @param config {Object} The parser configuration + * - options {Array} Array of option specs. See the README for how to + * specify each option spec. + * - allowUnknown {Boolean} Default false. Whether to throw on unknown + * options. If false, then unknown args are included in the _args array. + * - interspersed {Boolean} Default true. Whether to allow interspersed + * arguments (non-options) and options. E.g.: + * node tool.js arg1 arg2 -v + * '-v' is after some args here. If `interspersed: false` then '-v' + * would not be parsed out. Note that regardless of `interspersed` + * the presence of '--' will stop option parsing, as all good + * option parsers should. + */ +function Parser(config) { + assert.object(config, 'config'); + assert.arrayOfObject(config.options, 'config.options'); + assert.optionalBool(config.interspersed, 'config.interspersed'); + var self = this; + + // Allow interspersed arguments (true by default). + this.interspersed = (config.interspersed !== undefined + ? config.interspersed : true); + + // Don't allow unknown flags (true by default). + this.allowUnknown = (config.allowUnknown !== undefined + ? config.allowUnknown : false); + + this.options = config.options.map(function (o) { return shallowCopy(o); }); + this.optionFromName = {}; + this.optionFromEnv = {}; + for (var i = 0; i < this.options.length; i++) { + var o = this.options[i]; + if (o.group !== undefined && o.group !== null) { + assert.optionalString(o.group, + format('config.options.%d.group', i)); + continue; + } + assert.ok(optionTypes[o.type], + format('invalid config.options.%d.type: "%s" in %j', + i, o.type, o)); + assert.optionalString(o.name, format('config.options.%d.name', i)); + assert.optionalArrayOfString(o.names, + format('config.options.%d.names', i)); + assert.ok((o.name || o.names) && !(o.name && o.names), + format('exactly one of "name" or "names" required: %j', o)); + assert.optionalString(o.help, format('config.options.%d.help', i)); + var env = o.env || []; + if (typeof (env) === 'string') { + env = [env]; + } + assert.optionalArrayOfString(env, format('config.options.%d.env', i)); + assert.optionalString(o.helpGroup, + format('config.options.%d.helpGroup', i)); + assert.optionalBool(o.helpWrap, + format('config.options.%d.helpWrap', i)); + assert.optionalBool(o.hidden, format('config.options.%d.hidden', i)); + + if (o.name) { + o.names = [o.name]; + } else { + assert.string(o.names[0], + format('config.options.%d.names is empty', i)); + } + o.key = optionKeyFromName(o.names[0]); + o.names.forEach(function (n) { + if (self.optionFromName[n]) { + throw new Error(format( + 'option name collision: "%s" used in %j and %j', + n, self.optionFromName[n], o)); + } + self.optionFromName[n] = o; + }); + env.forEach(function (n) { + if (self.optionFromEnv[n]) { + throw new Error(format( + 'option env collision: "%s" used in %j and %j', + n, self.optionFromEnv[n], o)); + } + self.optionFromEnv[n] = o; + }); + } +} + +Parser.prototype.optionTakesArg = function optionTakesArg(option) { + return optionTypes[option.type].takesArg; +}; + +/** + * Parse options from the given argv. + * + * @param inputs {Object} Optional. + * - argv {Array} Optional. The argv to parse. Defaults to + * `process.argv`. + * - slice {Number} The index into argv at which options/args begin. + * Default is 2, as appropriate for `process.argv`. + * - env {Object} Optional. The env to use for 'env' entries in the + * option specs. Defaults to `process.env`. + * @returns {Object} Parsed `opts`. It has special keys `_args` (the + * remaining args from `argv`) and `_order` (gives the order that + * options were specified). + */ +Parser.prototype.parse = function parse(inputs) { + var self = this; + + // Old API was `parse([argv, [slice]])` + if (Array.isArray(arguments[0])) { + inputs = {argv: arguments[0], slice: arguments[1]}; + } + + assert.optionalObject(inputs, 'inputs'); + if (!inputs) { + inputs = {}; + } + assert.optionalArrayOfString(inputs.argv, 'inputs.argv'); + //assert.optionalNumber(slice, 'slice'); + var argv = inputs.argv || process.argv; + var slice = inputs.slice !== undefined ? inputs.slice : 2; + var args = argv.slice(slice); + var env = inputs.env || process.env; + var opts = {}; + var _order = []; + + function addOpt(option, optstr, key, val, from) { + var type = optionTypes[option.type]; + var parsedVal = type.parseArg(option, optstr, val); + if (type.array) { + if (!opts[key]) { + opts[key] = []; + } + if (type.arrayFlatten && Array.isArray(parsedVal)) { + for (var i = 0; i < parsedVal.length; i++) { + opts[key].push(parsedVal[i]); + } + } else { + opts[key].push(parsedVal); + } + } else { + opts[key] = parsedVal; + } + var item = { key: key, value: parsedVal, from: from }; + _order.push(item); + } + + // Parse args. + var _args = []; + var i = 0; + outer: while (i < args.length) { + var arg = args[i]; + + // End of options marker. + if (arg === '--') { + i++; + break; + + // Long option + } else if (arg.slice(0, 2) === '--') { + var name = arg.slice(2); + var val = null; + var idx = name.indexOf('='); + if (idx !== -1) { + val = name.slice(idx + 1); + name = name.slice(0, idx); + } + var option = this.optionFromName[name]; + if (!option) { + if (!this.allowUnknown) + throw new Error(format('unknown option: "--%s"', name)); + else if (this.interspersed) + _args.push(arg); + else + break outer; + } else { + var takesArg = this.optionTakesArg(option); + if (val !== null && !takesArg) { + throw new Error(format('argument given to "--%s" option ' + + 'that does not take one: "%s"', name, arg)); + } + if (!takesArg) { + addOpt(option, '--'+name, option.key, true, 'argv'); + } else if (val !== null) { + addOpt(option, '--'+name, option.key, val, 'argv'); + } else if (i + 1 >= args.length) { + throw new Error(format('do not have enough args for "--%s" ' + + 'option', name)); + } else { + addOpt(option, '--'+name, option.key, args[i + 1], 'argv'); + i++; + } + } + + // Short option + } else if (arg[0] === '-' && arg.length > 1) { + var j = 1; + var allFound = true; + while (j < arg.length) { + var name = arg[j]; + var option = this.optionFromName[name]; + if (!option) { + allFound = false; + if (this.allowUnknown) { + if (this.interspersed) { + _args.push(arg); + break; + } else + break outer; + } else if (arg.length > 2) { + throw new Error(format( + 'unknown option: "-%s" in "%s" group', + name, arg)); + } else { + throw new Error(format('unknown option: "-%s"', name)); + } + } else if (this.optionTakesArg(option)) { + break; + } + j++; + } + + j = 1; + while (allFound && j < arg.length) { + var name = arg[j]; + var val = arg.slice(j + 1); // option val if it takes an arg + var option = this.optionFromName[name]; + var takesArg = this.optionTakesArg(option); + if (!takesArg) { + addOpt(option, '-'+name, option.key, true, 'argv'); + } else if (val) { + addOpt(option, '-'+name, option.key, val, 'argv'); + break; + } else { + if (i + 1 >= args.length) { + throw new Error(format('do not have enough args ' + + 'for "-%s" option', name)); + } + addOpt(option, '-'+name, option.key, args[i + 1], 'argv'); + i++; + break; + } + j++; + } + + // An interspersed arg + } else if (this.interspersed) { + _args.push(arg); + + // An arg and interspersed args are not allowed, so done options. + } else { + break outer; + } + i++; + } + _args = _args.concat(args.slice(i)); + + // Parse environment. + Object.keys(this.optionFromEnv).forEach(function (envname) { + var val = env[envname]; + if (val === undefined) + return; + var option = self.optionFromEnv[envname]; + if (opts[option.key] !== undefined) + return; + var takesArg = self.optionTakesArg(option); + if (takesArg) { + addOpt(option, envname, option.key, val, 'env'); + } else if (val !== '') { + // Boolean envvar handling: + // - VAR=<empty-string> not set (as if the VAR was not set) + // - VAR=0 false + // - anything else true + addOpt(option, envname, option.key, (val !== '0'), 'env'); + } + }); + + // Apply default values. + this.options.forEach(function (o) { + if (opts[o.key] === undefined) { + if (o.default !== undefined) { + opts[o.key] = o.default; + } else if (o.type && optionTypes[o.type].default !== undefined) { + opts[o.key] = optionTypes[o.type].default; + } + } + }); + + opts._order = _order; + opts._args = _args; + return opts; +}; + + +/** + * Return help output for the current options. + * + * E.g.: if the current options are: + * [{names: ['help', 'h'], type: 'bool', help: 'Show help and exit.'}] + * then this would return: + * ' -h, --help Show help and exit.\n' + * + * @param config {Object} Config for controlling the option help output. + * - indent {Number|String} Default 4. An indent/prefix to use for + * each option line. + * - nameSort {String} Default is 'length'. By default the names are + * sorted to put the short opts first (i.e. '-h, --help' preferred + * to '--help, -h'). Set to 'none' to not do this sorting. + * - maxCol {Number} Default 80. Note that long tokens in a help string + * can go past this. + * - helpCol {Number} Set to specify a specific column at which + * option help will be aligned. By default this is determined + * automatically. + * - minHelpCol {Number} Default 20. + * - maxHelpCol {Number} Default 40. + * - includeEnv {Boolean} Default false. If true, a note stating the `env` + * envvar (if specified for this option) will be appended to the help + * output. + * - includeDefault {Boolean} Default false. If true, a note stating + * the `default` for this option, if any, will be appended to the help + * output. + * - helpWrap {Boolean} Default true. Wrap help text in helpCol..maxCol + * bounds. + * @returns {String} + */ +Parser.prototype.help = function help(config) { + config = config || {}; + assert.object(config, 'config'); + + var indent = makeIndent(config.indent, 4, 'config.indent'); + var headingIndent = makeIndent(config.headingIndent, + Math.round(indent.length / 2), 'config.headingIndent'); + + assert.optionalString(config.nameSort, 'config.nameSort'); + var nameSort = config.nameSort || 'length'; + assert.ok(~['length', 'none'].indexOf(nameSort), + 'invalid "config.nameSort"'); + assert.optionalNumber(config.maxCol, 'config.maxCol'); + assert.optionalNumber(config.maxHelpCol, 'config.maxHelpCol'); + assert.optionalNumber(config.minHelpCol, 'config.minHelpCol'); + assert.optionalNumber(config.helpCol, 'config.helpCol'); + assert.optionalBool(config.includeEnv, 'config.includeEnv'); + assert.optionalBool(config.includeDefault, 'config.includeDefault'); + assert.optionalBool(config.helpWrap, 'config.helpWrap'); + var maxCol = config.maxCol || 80; + var minHelpCol = config.minHelpCol || 20; + var maxHelpCol = config.maxHelpCol || 40; + + var lines = []; + var maxWidth = 0; + this.options.forEach(function (o) { + if (o.hidden) { + return; + } + if (o.group !== undefined && o.group !== null) { + // We deal with groups in the next pass + lines.push(null); + return; + } + var type = optionTypes[o.type]; + var arg = o.helpArg || type.helpArg || 'ARG'; + var line = ''; + var names = o.names.slice(); + if (nameSort === 'length') { + names.sort(function (a, b) { + if (a.length < b.length) + return -1; + else if (b.length < a.length) + return 1; + else + return 0; + }) + } + names.forEach(function (name, i) { + if (i > 0) + line += ', '; + if (name.length === 1) { + line += '-' + name + if (type.takesArg) + line += ' ' + arg; + } else { + line += '--' + name + if (type.takesArg) + line += '=' + arg; + } + }); + maxWidth = Math.max(maxWidth, line.length); + lines.push(line); + }); + + // Add help strings. + var helpCol = config.helpCol; + if (!helpCol) { + helpCol = maxWidth + indent.length + 2; + helpCol = Math.min(Math.max(helpCol, minHelpCol), maxHelpCol); + } + var i = -1; + this.options.forEach(function (o) { + if (o.hidden) { + return; + } + i++; + + if (o.group !== undefined && o.group !== null) { + if (o.group === '') { + // Support a empty string "group" to have a blank line between + // sets of options. + lines[i] = ''; + } else { + // Render the group heading with the heading-specific indent. + lines[i] = (i === 0 ? '' : '\n') + headingIndent + + o.group + ':'; + } + return; + } + + var helpDefault; + if (config.includeDefault) { + if (o.default !== undefined) { + helpDefault = format('Default: %j', o.default); + } else if (o.type && optionTypes[o.type].default !== undefined) { + helpDefault = format('Default: %j', + optionTypes[o.type].default); + } + } + + var line = lines[i] = indent + lines[i]; + if (!o.help && !(config.includeEnv && o.env) && !helpDefault) { + return; + } + var n = helpCol - line.length; + if (n >= 0) { + line += space(n); + } else { + line += '\n' + space(helpCol); + } + + var helpEnv = ''; + if (o.env && o.env.length && config.includeEnv) { + helpEnv += 'Environment: '; + var type = optionTypes[o.type]; + var arg = o.helpArg || type.helpArg || 'ARG'; + var envs = (Array.isArray(o.env) ? o.env : [o.env]).map( + function (e) { + if (type.takesArg) { + return e + '=' + arg; + } else { + return e + '=1'; + } + } + ); + helpEnv += envs.join(', '); + } + var help = (o.help || '').trim(); + if (o.helpWrap !== false && config.helpWrap !== false) { + // Wrap help description normally. + if (help.length && !~'.!?"\''.indexOf(help.slice(-1))) { + help += '.'; + } + if (help.length) { + help += ' '; + } + help += helpEnv; + if (helpDefault) { + if (helpEnv) { + help += '. '; + } + help += helpDefault; + } + line += textwrap(help, maxCol - helpCol).join( + '\n' + space(helpCol)); + } else { + // Do not wrap help description, but indent newlines appropriately. + var helpLines = help.split('\n').filter( + function (ln) { return ln.length }); + if (helpEnv !== '') { + helpLines.push(helpEnv); + } + if (helpDefault) { + helpLines.push(helpDefault); + } + line += helpLines.join('\n' + space(helpCol)); + } + + lines[i] = line; + }); + + var rv = ''; + if (lines.length > 0) { + rv = lines.join('\n') + '\n'; + } + return rv; +}; + + +/** + * Return a string suitable for a Bash completion file for this tool. + * + * @param args.name {String} The tool name. + * @param args.specExtra {String} Optional. Extra Bash code content to add + * to the end of the "spec". Typically this is used to append Bash + * "complete_TYPE" functions for custom option types. See + * "examples/ddcompletion.js" for an example. + * @param args.argtypes {Array} Optional. Array of completion types for + * positional args (i.e. non-options). E.g. + * argtypes = ['fruit', 'veggie', 'file'] + * will result in completion of fruits for the first arg, veggies for the + * second, and filenames for the third and subsequent positional args. + * If not given, positional args will use Bash's 'default' completion. + * See `specExtra` for providing Bash `complete_TYPE` functions, e.g. + * `complete_fruit` and `complete_veggie` in this example. + */ +Parser.prototype.bashCompletion = function bashCompletion(args) { + assert.object(args, 'args'); + assert.string(args.name, 'args.name'); + assert.optionalString(args.specExtra, 'args.specExtra'); + assert.optionalArrayOfString(args.argtypes, 'args.argtypes'); + + return bashCompletionFromOptions({ + name: args.name, + specExtra: args.specExtra, + argtypes: args.argtypes, + options: this.options + }); +}; + + +// ---- Bash completion + +const BASH_COMPLETION_TEMPLATE_PATH = path.join( + __dirname, '../etc/dashdash.bash_completion.in'); + +/** + * Return the Bash completion "spec" (the string value for the "{{spec}}" + * var in the "dashdash.bash_completion.in" template) for this tool. + * + * The "spec" is Bash code that defines the CLI options and subcmds for + * the template's completion code. It looks something like this: + * + * local cmd_shortopts="-J ..." + * local cmd_longopts="--help ..." + * local cmd_optargs="-p=tritonprofile ..." + * + * @param args.options {Array} The array of dashdash option specs. + * @param args.context {String} Optional. A context string for the "local cmd*" + * vars in the spec. By default it is the empty string. When used to + * scope for completion on a *sub-command* (e.g. for "git log" on a "git" + * tool), then it would have a value (e.g. "__log"). See + * <http://github.com/trentm/node-cmdln> Bash completion for details. + * @param opts.includeHidden {Boolean} Optional. Default false. By default + * hidden options and subcmds are "excluded". Here excluded means they + * won't be offered as a completion, but if used, their argument type + * will be completed. "Hidden" options and subcmds are ones with the + * `hidden: true` attribute to exclude them from default help output. + * @param args.argtypes {Array} Optional. Array of completion types for + * positional args (i.e. non-options). E.g. + * argtypes = ['fruit', 'veggie', 'file'] + * will result in completion of fruits for the first arg, veggies for the + * second, and filenames for the third and subsequent positional args. + * If not given, positional args will use Bash's 'default' completion. + * See `specExtra` for providing Bash `complete_TYPE` functions, e.g. + * `complete_fruit` and `complete_veggie` in this example. + */ +function bashCompletionSpecFromOptions(args) { + assert.object(args, 'args'); + assert.object(args.options, 'args.options'); + assert.optionalString(args.context, 'args.context'); + assert.optionalBool(args.includeHidden, 'args.includeHidden'); + assert.optionalArrayOfString(args.argtypes, 'args.argtypes'); + + var context = args.context || ''; + var includeHidden = (args.includeHidden === undefined + ? false : args.includeHidden); + + var spec = []; + var shortopts = []; + var longopts = []; + var optargs = []; + (args.options || []).forEach(function (o) { + if (o.group !== undefined && o.group !== null) { + // Skip group headers. + return; + } + + var optNames = o.names || [o.name]; + var optType = getOptionType(o.type); + if (optType.takesArg) { + var completionType = o.completionType || + optType.completionType || o.type; + optNames.forEach(function (optName) { + if (optName.length === 1) { + if (includeHidden || !o.hidden) { + shortopts.push('-' + optName); + } + // Include even hidden options in `optargs` so that bash + // completion of its arg still works. + optargs.push('-' + optName + '=' + completionType); + } else { + if (includeHidden || !o.hidden) { + longopts.push('--' + optName); + } + optargs.push('--' + optName + '=' + completionType); + } + }); + } else { + optNames.forEach(function (optName) { + if (includeHidden || !o.hidden) { + if (optName.length === 1) { + shortopts.push('-' + optName); + } else { + longopts.push('--' + optName); + } + } + }); + } + }); + + spec.push(format('local cmd%s_shortopts="%s"', + context, shortopts.sort().join(' '))); + spec.push(format('local cmd%s_longopts="%s"', + context, longopts.sort().join(' '))); + spec.push(format('local cmd%s_optargs="%s"', + context, optargs.sort().join(' '))); + if (args.argtypes) { + spec.push(format('local cmd%s_argtypes="%s"', + context, args.argtypes.join(' '))); + } + return spec.join('\n'); +} + + +/** + * Return a string suitable for a Bash completion file for this tool. + * + * @param args.name {String} The tool name. + * @param args.options {Array} The array of dashdash option specs. + * @param args.specExtra {String} Optional. Extra Bash code content to add + * to the end of the "spec". Typically this is used to append Bash + * "complete_TYPE" functions for custom option types. See + * "examples/ddcompletion.js" for an example. + * @param args.argtypes {Array} Optional. Array of completion types for + * positional args (i.e. non-options). E.g. + * argtypes = ['fruit', 'veggie', 'file'] + * will result in completion of fruits for the first arg, veggies for the + * second, and filenames for the third and subsequent positional args. + * If not given, positional args will use Bash's 'default' completion. + * See `specExtra` for providing Bash `complete_TYPE` functions, e.g. + * `complete_fruit` and `complete_veggie` in this example. + */ +function bashCompletionFromOptions(args) { + assert.object(args, 'args'); + assert.object(args.options, 'args.options'); + assert.string(args.name, 'args.name'); + assert.optionalString(args.specExtra, 'args.specExtra'); + assert.optionalArrayOfString(args.argtypes, 'args.argtypes'); + + // Gather template data. + var data = { + name: args.name, + date: new Date(), + spec: bashCompletionSpecFromOptions({ + options: args.options, + argtypes: args.argtypes + }), + }; + if (args.specExtra) { + data.spec += '\n\n' + args.specExtra; + } + + // Render template. + var template = fs.readFileSync(BASH_COMPLETION_TEMPLATE_PATH, 'utf8'); + return renderTemplate(template, data); +} + + + +// ---- exports + +function createParser(config) { + return new Parser(config); +} + +/** + * Parse argv with the given options. + * + * @param config {Object} A merge of all the available fields from + * `dashdash.Parser` and `dashdash.Parser.parse`: options, interspersed, + * argv, env, slice. + */ +function parse(config) { + assert.object(config, 'config'); + assert.optionalArrayOfString(config.argv, 'config.argv'); + assert.optionalObject(config.env, 'config.env'); + var config = shallowCopy(config); + var argv = config.argv; + delete config.argv; + var env = config.env; + delete config.env; + + var parser = new Parser(config); + return parser.parse({argv: argv, env: env}); +} + + +/** + * Add a new option type. + * + * @params optionType {Object}: + * - name {String} Required. + * - takesArg {Boolean} Required. Whether this type of option takes an + * argument on process.argv. Typically this is true for all but the + * "bool" type. + * - helpArg {String} Required iff `takesArg === true`. The string to + * show in generated help for options of this type. + * - parseArg {Function} Require. `function (option, optstr, arg)` parser + * that takes a string argument and returns an instance of the + * appropriate type, or throws an error if the arg is invalid. + * - array {Boolean} Optional. Set to true if this is an 'arrayOf' type + * that collects multiple usages of the option in process.argv and + * puts results in an array. + * - arrayFlatten {Boolean} Optional. XXX + * - default Optional. Default value for options of this type, if no + * default is specified in the option type usage. + */ +function addOptionType(optionType) { + assert.object(optionType, 'optionType'); + assert.string(optionType.name, 'optionType.name'); + assert.bool(optionType.takesArg, 'optionType.takesArg'); + if (optionType.takesArg) { + assert.string(optionType.helpArg, 'optionType.helpArg'); + } + assert.func(optionType.parseArg, 'optionType.parseArg'); + assert.optionalBool(optionType.array, 'optionType.array'); + assert.optionalBool(optionType.arrayFlatten, 'optionType.arrayFlatten'); + + optionTypes[optionType.name] = { + takesArg: optionType.takesArg, + helpArg: optionType.helpArg, + parseArg: optionType.parseArg, + array: optionType.array, + arrayFlatten: optionType.arrayFlatten, + default: optionType.default + } +} + + +function getOptionType(name) { + assert.string(name, 'name'); + return optionTypes[name]; +} + + +/** + * Return a synopsis string for the given option spec. + * + * Examples: + * > synopsisFromOpt({names: ['help', 'h'], type: 'bool'}); + * '[ --help | -h ]' + * > synopsisFromOpt({name: 'file', type: 'string', helpArg: 'FILE'}); + * '[ --file=FILE ]' + */ +function synopsisFromOpt(o) { + assert.object(o, 'o'); + + if (o.hasOwnProperty('group')) { + return null; + } + var names = o.names || [o.name]; + // `type` here could be undefined if, for example, the command has a + // dashdash option spec with a bogus 'type'. + var type = getOptionType(o.type); + var helpArg = o.helpArg || (type && type.helpArg) || 'ARG'; + var parts = []; + names.forEach(function (name) { + var part = (name.length === 1 ? '-' : '--') + name; + if (type && type.takesArg) { + part += (name.length === 1 ? ' ' + helpArg : '=' + helpArg); + } + parts.push(part); + }); + return ('[ ' + parts.join(' | ') + ' ]'); +}; + + +module.exports = { + createParser: createParser, + Parser: Parser, + parse: parse, + addOptionType: addOptionType, + getOptionType: getOptionType, + synopsisFromOpt: synopsisFromOpt, + + // Bash completion-related exports + BASH_COMPLETION_TEMPLATE_PATH: BASH_COMPLETION_TEMPLATE_PATH, + bashCompletionFromOptions: bashCompletionFromOptions, + bashCompletionSpecFromOptions: bashCompletionSpecFromOptions, + + // Export the parseFoo parsers because they might be useful as primitives + // for custom option types. + parseBool: parseBool, + parseString: parseString, + parseNumber: parseNumber, + parseInteger: parseInteger, + parsePositiveInteger: parsePositiveInteger, + parseDate: parseDate +}; diff --git a/appasar/canary/node_modules/dashdash/package.json b/appasar/canary/node_modules/dashdash/package.json new file mode 100644 index 0000000..a11e1f5 --- /dev/null +++ b/appasar/canary/node_modules/dashdash/package.json @@ -0,0 +1,26 @@ +{ + "name": "dashdash", + "description": "A light, featureful and explicit option parsing library.", + "version": "1.14.1", + "author": "Trent Mick <trentm@gmail.com> (http://trentm.com)", + "keywords": ["option", "parser", "parsing", "cli", "command", "args", + "bash", "completion"], + "repository": { + "type": "git", + "url": "git://github.com/trentm/node-dashdash.git" + }, + "main": "./lib/dashdash.js", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "devDependencies": { + "nodeunit": "0.9.x" + }, + "engines": { + "node": ">=0.10" + }, + "scripts": { + "test": "nodeunit test/*.test.js" + }, + "license": "MIT" +} diff --git a/appasar/canary/node_modules/delayed-stream/.npmignore b/appasar/canary/node_modules/delayed-stream/.npmignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/appasar/canary/node_modules/delayed-stream/.npmignore @@ -0,0 +1 @@ +test diff --git a/appasar/canary/node_modules/delayed-stream/License b/appasar/canary/node_modules/delayed-stream/License new file mode 100644 index 0000000..4804b7a --- /dev/null +++ b/appasar/canary/node_modules/delayed-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited <felix@debuggable.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/appasar/canary/node_modules/delayed-stream/Makefile b/appasar/canary/node_modules/delayed-stream/Makefile new file mode 100644 index 0000000..b4ff85a --- /dev/null +++ b/appasar/canary/node_modules/delayed-stream/Makefile @@ -0,0 +1,7 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +.PHONY: test + diff --git a/appasar/canary/node_modules/delayed-stream/Readme.md b/appasar/canary/node_modules/delayed-stream/Readme.md new file mode 100644 index 0000000..aca36f9 --- /dev/null +++ b/appasar/canary/node_modules/delayed-stream/Readme.md @@ -0,0 +1,141 @@ +# delayed-stream + +Buffers events from a stream until you are ready to handle them. + +## Installation + +``` bash +npm install delayed-stream +``` + +## Usage + +The following example shows how to write a http echo server that delays its +response by 1000 ms. + +``` javascript +var DelayedStream = require('delayed-stream'); +var http = require('http'); + +http.createServer(function(req, res) { + var delayed = DelayedStream.create(req); + + setTimeout(function() { + res.writeHead(200); + delayed.pipe(res); + }, 1000); +}); +``` + +If you are not using `Stream#pipe`, you can also manually release the buffered +events by calling `delayedStream.resume()`: + +``` javascript +var delayed = DelayedStream.create(req); + +setTimeout(function() { + // Emit all buffered events and resume underlaying source + delayed.resume(); +}, 1000); +``` + +## Implementation + +In order to use this meta stream properly, here are a few things you should +know about the implementation. + +### Event Buffering / Proxying + +All events of the `source` stream are hijacked by overwriting the `source.emit` +method. Until node implements a catch-all event listener, this is the only way. + +However, delayed-stream still continues to emit all events it captures on the +`source`, regardless of whether you have released the delayed stream yet or +not. + +Upon creation, delayed-stream captures all `source` events and stores them in +an internal event buffer. Once `delayedStream.release()` is called, all +buffered events are emitted on the `delayedStream`, and the event buffer is +cleared. After that, delayed-stream merely acts as a proxy for the underlaying +source. + +### Error handling + +Error events on `source` are buffered / proxied just like any other events. +However, `delayedStream.create` attaches a no-op `'error'` listener to the +`source`. This way you only have to handle errors on the `delayedStream` +object, rather than in two places. + +### Buffer limits + +delayed-stream provides a `maxDataSize` property that can be used to limit +the amount of data being buffered. In order to protect you from bad `source` +streams that don't react to `source.pause()`, this feature is enabled by +default. + +## API + +### DelayedStream.create(source, [options]) + +Returns a new `delayedStream`. Available options are: + +* `pauseStream` +* `maxDataSize` + +The description for those properties can be found below. + +### delayedStream.source + +The `source` stream managed by this object. This is useful if you are +passing your `delayedStream` around, and you still want to access properties +on the `source` object. + +### delayedStream.pauseStream = true + +Whether to pause the underlaying `source` when calling +`DelayedStream.create()`. Modifying this property afterwards has no effect. + +### delayedStream.maxDataSize = 1024 * 1024 + +The amount of data to buffer before emitting an `error`. + +If the underlaying source is emitting `Buffer` objects, the `maxDataSize` +refers to bytes. + +If the underlaying source is emitting JavaScript strings, the size refers to +characters. + +If you know what you are doing, you can set this property to `Infinity` to +disable this feature. You can also modify this property during runtime. + +### delayedStream.dataSize = 0 + +The amount of data buffered so far. + +### delayedStream.readable + +An ECMA5 getter that returns the value of `source.readable`. + +### delayedStream.resume() + +If the `delayedStream` has not been released so far, `delayedStream.release()` +is called. + +In either case, `source.resume()` is called. + +### delayedStream.pause() + +Calls `source.pause()`. + +### delayedStream.pipe(dest) + +Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. + +### delayedStream.release() + +Emits and clears all events that have been buffered up so far. This does not +resume the underlaying source, use `delayedStream.resume()` instead. + +## License + +delayed-stream is licensed under the MIT license. diff --git a/appasar/canary/node_modules/delayed-stream/lib/delayed_stream.js b/appasar/canary/node_modules/delayed-stream/lib/delayed_stream.js new file mode 100644 index 0000000..b38fc85 --- /dev/null +++ b/appasar/canary/node_modules/delayed-stream/lib/delayed_stream.js @@ -0,0 +1,107 @@ +var Stream = require('stream').Stream; +var util = require('util'); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; diff --git a/appasar/canary/node_modules/delayed-stream/package.json b/appasar/canary/node_modules/delayed-stream/package.json new file mode 100644 index 0000000..eea3291 --- /dev/null +++ b/appasar/canary/node_modules/delayed-stream/package.json @@ -0,0 +1,27 @@ +{ + "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", + "contributors": [ + "Mike Atkins <apeherder@gmail.com>" + ], + "name": "delayed-stream", + "description": "Buffers events from a stream until you are ready to handle them.", + "license": "MIT", + "version": "1.0.0", + "homepage": "https://github.com/felixge/node-delayed-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-delayed-stream.git" + }, + "main": "./lib/delayed_stream", + "engines": { + "node": ">=0.4.0" + }, + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "fake": "0.2.0", + "far": "0.0.1" + } +} diff --git a/appasar/canary/node_modules/ecc-jsbn/.npmignore b/appasar/canary/node_modules/ecc-jsbn/.npmignore new file mode 100644 index 0000000..a72b52e --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules diff --git a/appasar/canary/node_modules/ecc-jsbn/LICENSE b/appasar/canary/node_modules/ecc-jsbn/LICENSE new file mode 100644 index 0000000..f668fef --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jeremie Miller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/appasar/canary/node_modules/ecc-jsbn/README.md b/appasar/canary/node_modules/ecc-jsbn/README.md new file mode 100644 index 0000000..b5d0b9d --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/README.md @@ -0,0 +1,8 @@ +ecc-jsbn +======== + +ECC package based on [jsbn](https://github.com/andyperlitch/jsbn) from [Tom Wu](http://www-cs-students.stanford.edu/~tjw/). + +This is a subset of the same interface as the [node compiled module](https://github.com/quartzjer/ecc), but works in the browser too. + +Also uses point compression now from [https://github.com/kaielvin](https://github.com/kaielvin/jsbn-ec-point-compression). diff --git a/appasar/canary/node_modules/ecc-jsbn/index.js b/appasar/canary/node_modules/ecc-jsbn/index.js new file mode 100644 index 0000000..2437281 --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/index.js @@ -0,0 +1,57 @@ +var crypto = require("crypto"); +var BigInteger = require("jsbn").BigInteger; +var ECPointFp = require("./lib/ec.js").ECPointFp; +exports.ECCurves = require("./lib/sec.js"); + +// zero prepad +function unstupid(hex,len) +{ + return (hex.length >= len) ? hex : unstupid("0"+hex,len); +} + +exports.ECKey = function(curve, key, isPublic) +{ + var priv; + var c = curve(); + var n = c.getN(); + var bytes = Math.floor(n.bitLength()/8); + + if(key) + { + if(isPublic) + { + var curve = c.getCurve(); +// var x = key.slice(1,bytes+1); // skip the 04 for uncompressed format +// var y = key.slice(bytes+1); +// this.P = new ECPointFp(curve, +// curve.fromBigInteger(new BigInteger(x.toString("hex"), 16)), +// curve.fromBigInteger(new BigInteger(y.toString("hex"), 16))); + this.P = curve.decodePointHex(key.toString("hex")); + }else{ + if(key.length != bytes) return false; + priv = new BigInteger(key.toString("hex"), 16); + } + }else{ + var n1 = n.subtract(BigInteger.ONE); + var r = new BigInteger(crypto.randomBytes(n.bitLength())); + priv = r.mod(n1).add(BigInteger.ONE); + this.P = c.getG().multiply(priv); + } + if(this.P) + { +// var pubhex = unstupid(this.P.getX().toBigInteger().toString(16),bytes*2)+unstupid(this.P.getY().toBigInteger().toString(16),bytes*2); +// this.PublicKey = new Buffer("04"+pubhex,"hex"); + this.PublicKey = new Buffer(c.getCurve().encodeCompressedPointHex(this.P),"hex"); + } + if(priv) + { + this.PrivateKey = new Buffer(unstupid(priv.toString(16),bytes*2),"hex"); + this.deriveSharedSecret = function(key) + { + if(!key || !key.P) return false; + var S = key.P.multiply(priv); + return new Buffer(unstupid(S.getX().toBigInteger().toString(16),bytes*2),"hex"); + } + } +} + diff --git a/appasar/canary/node_modules/ecc-jsbn/lib/LICENSE-jsbn b/appasar/canary/node_modules/ecc-jsbn/lib/LICENSE-jsbn new file mode 100644 index 0000000..24502a9 --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/lib/LICENSE-jsbn @@ -0,0 +1,40 @@ +Licensing +--------- + +This software is covered under the following copyright: + +/* + * Copyright (c) 2003-2005 Tom Wu + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following condition applies: + * + * All redistributions must retain an intact copy of this copyright notice + * and disclaimer. + */ + +Address all questions regarding this license to: + + Tom Wu + tjw@cs.Stanford.EDU diff --git a/appasar/canary/node_modules/ecc-jsbn/lib/ec.js b/appasar/canary/node_modules/ecc-jsbn/lib/ec.js new file mode 100644 index 0000000..3852671 --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/lib/ec.js @@ -0,0 +1,561 @@ +// Basic Javascript Elliptic Curve implementation +// Ported loosely from BouncyCastle's Java EC code +// Only Fp curves implemented for now + +// Requires jsbn.js and jsbn2.js +var BigInteger = require('jsbn').BigInteger +var Barrett = BigInteger.prototype.Barrett + +// ---------------- +// ECFieldElementFp + +// constructor +function ECFieldElementFp(q,x) { + this.x = x; + // TODO if(x.compareTo(q) >= 0) error + this.q = q; +} + +function feFpEquals(other) { + if(other == this) return true; + return (this.q.equals(other.q) && this.x.equals(other.x)); +} + +function feFpToBigInteger() { + return this.x; +} + +function feFpNegate() { + return new ECFieldElementFp(this.q, this.x.negate().mod(this.q)); +} + +function feFpAdd(b) { + return new ECFieldElementFp(this.q, this.x.add(b.toBigInteger()).mod(this.q)); +} + +function feFpSubtract(b) { + return new ECFieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q)); +} + +function feFpMultiply(b) { + return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger()).mod(this.q)); +} + +function feFpSquare() { + return new ECFieldElementFp(this.q, this.x.square().mod(this.q)); +} + +function feFpDivide(b) { + return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q)); +} + +ECFieldElementFp.prototype.equals = feFpEquals; +ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger; +ECFieldElementFp.prototype.negate = feFpNegate; +ECFieldElementFp.prototype.add = feFpAdd; +ECFieldElementFp.prototype.subtract = feFpSubtract; +ECFieldElementFp.prototype.multiply = feFpMultiply; +ECFieldElementFp.prototype.square = feFpSquare; +ECFieldElementFp.prototype.divide = feFpDivide; + +// ---------------- +// ECPointFp + +// constructor +function ECPointFp(curve,x,y,z) { + this.curve = curve; + this.x = x; + this.y = y; + // Projective coordinates: either zinv == null or z * zinv == 1 + // z and zinv are just BigIntegers, not fieldElements + if(z == null) { + this.z = BigInteger.ONE; + } + else { + this.z = z; + } + this.zinv = null; + //TODO: compression flag +} + +function pointFpGetX() { + if(this.zinv == null) { + this.zinv = this.z.modInverse(this.curve.q); + } + var r = this.x.toBigInteger().multiply(this.zinv); + this.curve.reduce(r); + return this.curve.fromBigInteger(r); +} + +function pointFpGetY() { + if(this.zinv == null) { + this.zinv = this.z.modInverse(this.curve.q); + } + var r = this.y.toBigInteger().multiply(this.zinv); + this.curve.reduce(r); + return this.curve.fromBigInteger(r); +} + +function pointFpEquals(other) { + if(other == this) return true; + if(this.isInfinity()) return other.isInfinity(); + if(other.isInfinity()) return this.isInfinity(); + var u, v; + // u = Y2 * Z1 - Y1 * Z2 + u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q); + if(!u.equals(BigInteger.ZERO)) return false; + // v = X2 * Z1 - X1 * Z2 + v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q); + return v.equals(BigInteger.ZERO); +} + +function pointFpIsInfinity() { + if((this.x == null) && (this.y == null)) return true; + return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO); +} + +function pointFpNegate() { + return new ECPointFp(this.curve, this.x, this.y.negate(), this.z); +} + +function pointFpAdd(b) { + if(this.isInfinity()) return b; + if(b.isInfinity()) return this; + + // u = Y2 * Z1 - Y1 * Z2 + var u = b.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(b.z)).mod(this.curve.q); + // v = X2 * Z1 - X1 * Z2 + var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q); + + if(BigInteger.ZERO.equals(v)) { + if(BigInteger.ZERO.equals(u)) { + return this.twice(); // this == b, so double + } + return this.curve.getInfinity(); // this = -b, so infinity + } + + var THREE = new BigInteger("3"); + var x1 = this.x.toBigInteger(); + var y1 = this.y.toBigInteger(); + var x2 = b.x.toBigInteger(); + var y2 = b.y.toBigInteger(); + + var v2 = v.square(); + var v3 = v2.multiply(v); + var x1v2 = x1.multiply(v2); + var zu2 = u.square().multiply(this.z); + + // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3) + var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q); + // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3 + var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.q); + // z3 = v^3 * z1 * z2 + var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q); + + return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3); +} + +function pointFpTwice() { + if(this.isInfinity()) return this; + if(this.y.toBigInteger().signum() == 0) return this.curve.getInfinity(); + + // TODO: optimized handling of constants + var THREE = new BigInteger("3"); + var x1 = this.x.toBigInteger(); + var y1 = this.y.toBigInteger(); + + var y1z1 = y1.multiply(this.z); + var y1sqz1 = y1z1.multiply(y1).mod(this.curve.q); + var a = this.curve.a.toBigInteger(); + + // w = 3 * x1^2 + a * z1^2 + var w = x1.square().multiply(THREE); + if(!BigInteger.ZERO.equals(a)) { + w = w.add(this.z.square().multiply(a)); + } + w = w.mod(this.curve.q); + //this.curve.reduce(w); + // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1) + var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.q); + // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3 + var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.square().multiply(w)).mod(this.curve.q); + // z3 = 8 * (y1 * z1)^3 + var z3 = y1z1.square().multiply(y1z1).shiftLeft(3).mod(this.curve.q); + + return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3); +} + +// Simple NAF (Non-Adjacent Form) multiplication algorithm +// TODO: modularize the multiplication algorithm +function pointFpMultiply(k) { + if(this.isInfinity()) return this; + if(k.signum() == 0) return this.curve.getInfinity(); + + var e = k; + var h = e.multiply(new BigInteger("3")); + + var neg = this.negate(); + var R = this; + + var i; + for(i = h.bitLength() - 2; i > 0; --i) { + R = R.twice(); + + var hBit = h.testBit(i); + var eBit = e.testBit(i); + + if (hBit != eBit) { + R = R.add(hBit ? this : neg); + } + } + + return R; +} + +// Compute this*j + x*k (simultaneous multiplication) +function pointFpMultiplyTwo(j,x,k) { + var i; + if(j.bitLength() > k.bitLength()) + i = j.bitLength() - 1; + else + i = k.bitLength() - 1; + + var R = this.curve.getInfinity(); + var both = this.add(x); + while(i >= 0) { + R = R.twice(); + if(j.testBit(i)) { + if(k.testBit(i)) { + R = R.add(both); + } + else { + R = R.add(this); + } + } + else { + if(k.testBit(i)) { + R = R.add(x); + } + } + --i; + } + + return R; +} + +ECPointFp.prototype.getX = pointFpGetX; +ECPointFp.prototype.getY = pointFpGetY; +ECPointFp.prototype.equals = pointFpEquals; +ECPointFp.prototype.isInfinity = pointFpIsInfinity; +ECPointFp.prototype.negate = pointFpNegate; +ECPointFp.prototype.add = pointFpAdd; +ECPointFp.prototype.twice = pointFpTwice; +ECPointFp.prototype.multiply = pointFpMultiply; +ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo; + +// ---------------- +// ECCurveFp + +// constructor +function ECCurveFp(q,a,b) { + this.q = q; + this.a = this.fromBigInteger(a); + this.b = this.fromBigInteger(b); + this.infinity = new ECPointFp(this, null, null); + this.reducer = new Barrett(this.q); +} + +function curveFpGetQ() { + return this.q; +} + +function curveFpGetA() { + return this.a; +} + +function curveFpGetB() { + return this.b; +} + +function curveFpEquals(other) { + if(other == this) return true; + return(this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b)); +} + +function curveFpGetInfinity() { + return this.infinity; +} + +function curveFpFromBigInteger(x) { + return new ECFieldElementFp(this.q, x); +} + +function curveReduce(x) { + this.reducer.reduce(x); +} + +// for now, work with hex strings because they're easier in JS +function curveFpDecodePointHex(s) { + switch(parseInt(s.substr(0,2), 16)) { // first byte + case 0: + return this.infinity; + case 2: + case 3: + // point compression not supported yet + return null; + case 4: + case 6: + case 7: + var len = (s.length - 2) / 2; + var xHex = s.substr(2, len); + var yHex = s.substr(len+2, len); + + return new ECPointFp(this, + this.fromBigInteger(new BigInteger(xHex, 16)), + this.fromBigInteger(new BigInteger(yHex, 16))); + + default: // unsupported + return null; + } +} + +function curveFpEncodePointHex(p) { + if (p.isInfinity()) return "00"; + var xHex = p.getX().toBigInteger().toString(16); + var yHex = p.getY().toBigInteger().toString(16); + var oLen = this.getQ().toString(16).length; + if ((oLen % 2) != 0) oLen++; + while (xHex.length < oLen) { + xHex = "0" + xHex; + } + while (yHex.length < oLen) { + yHex = "0" + yHex; + } + return "04" + xHex + yHex; +} + +ECCurveFp.prototype.getQ = curveFpGetQ; +ECCurveFp.prototype.getA = curveFpGetA; +ECCurveFp.prototype.getB = curveFpGetB; +ECCurveFp.prototype.equals = curveFpEquals; +ECCurveFp.prototype.getInfinity = curveFpGetInfinity; +ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger; +ECCurveFp.prototype.reduce = curveReduce; +//ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex; +ECCurveFp.prototype.encodePointHex = curveFpEncodePointHex; + +// from: https://github.com/kaielvin/jsbn-ec-point-compression +ECCurveFp.prototype.decodePointHex = function(s) +{ + var yIsEven; + switch(parseInt(s.substr(0,2), 16)) { // first byte + case 0: + return this.infinity; + case 2: + yIsEven = false; + case 3: + if(yIsEven == undefined) yIsEven = true; + var len = s.length - 2; + var xHex = s.substr(2, len); + var x = this.fromBigInteger(new BigInteger(xHex,16)); + var alpha = x.multiply(x.square().add(this.getA())).add(this.getB()); + var beta = alpha.sqrt(); + + if (beta == null) throw "Invalid point compression"; + + var betaValue = beta.toBigInteger(); + if (betaValue.testBit(0) != yIsEven) + { + // Use the other root + beta = this.fromBigInteger(this.getQ().subtract(betaValue)); + } + return new ECPointFp(this,x,beta); + case 4: + case 6: + case 7: + var len = (s.length - 2) / 2; + var xHex = s.substr(2, len); + var yHex = s.substr(len+2, len); + + return new ECPointFp(this, + this.fromBigInteger(new BigInteger(xHex, 16)), + this.fromBigInteger(new BigInteger(yHex, 16))); + + default: // unsupported + return null; + } +} +ECCurveFp.prototype.encodeCompressedPointHex = function(p) +{ + if (p.isInfinity()) return "00"; + var xHex = p.getX().toBigInteger().toString(16); + var oLen = this.getQ().toString(16).length; + if ((oLen % 2) != 0) oLen++; + while (xHex.length < oLen) + xHex = "0" + xHex; + var yPrefix; + if(p.getY().toBigInteger().isEven()) yPrefix = "02"; + else yPrefix = "03"; + + return yPrefix + xHex; +} + + +ECFieldElementFp.prototype.getR = function() +{ + if(this.r != undefined) return this.r; + + this.r = null; + var bitLength = this.q.bitLength(); + if (bitLength > 128) + { + var firstWord = this.q.shiftRight(bitLength - 64); + if (firstWord.intValue() == -1) + { + this.r = BigInteger.ONE.shiftLeft(bitLength).subtract(this.q); + } + } + return this.r; +} +ECFieldElementFp.prototype.modMult = function(x1,x2) +{ + return this.modReduce(x1.multiply(x2)); +} +ECFieldElementFp.prototype.modReduce = function(x) +{ + if (this.getR() != null) + { + var qLen = q.bitLength(); + while (x.bitLength() > (qLen + 1)) + { + var u = x.shiftRight(qLen); + var v = x.subtract(u.shiftLeft(qLen)); + if (!this.getR().equals(BigInteger.ONE)) + { + u = u.multiply(this.getR()); + } + x = u.add(v); + } + while (x.compareTo(q) >= 0) + { + x = x.subtract(q); + } + } + else + { + x = x.mod(q); + } + return x; +} +ECFieldElementFp.prototype.sqrt = function() +{ + if (!this.q.testBit(0)) throw "unsupported"; + + // p mod 4 == 3 + if (this.q.testBit(1)) + { + var z = new ECFieldElementFp(this.q,this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE),this.q)); + return z.square().equals(this) ? z : null; + } + + // p mod 4 == 1 + var qMinusOne = this.q.subtract(BigInteger.ONE); + + var legendreExponent = qMinusOne.shiftRight(1); + if (!(this.x.modPow(legendreExponent, this.q).equals(BigInteger.ONE))) + { + return null; + } + + var u = qMinusOne.shiftRight(2); + var k = u.shiftLeft(1).add(BigInteger.ONE); + + var Q = this.x; + var fourQ = modDouble(modDouble(Q)); + + var U, V; + do + { + var P; + do + { + P = new BigInteger(this.q.bitLength(), new SecureRandom()); + } + while (P.compareTo(this.q) >= 0 + || !(P.multiply(P).subtract(fourQ).modPow(legendreExponent, this.q).equals(qMinusOne))); + + var result = this.lucasSequence(P, Q, k); + U = result[0]; + V = result[1]; + + if (this.modMult(V, V).equals(fourQ)) + { + // Integer division by 2, mod q + if (V.testBit(0)) + { + V = V.add(q); + } + + V = V.shiftRight(1); + + return new ECFieldElementFp(q,V); + } + } + while (U.equals(BigInteger.ONE) || U.equals(qMinusOne)); + + return null; +} +ECFieldElementFp.prototype.lucasSequence = function(P,Q,k) +{ + var n = k.bitLength(); + var s = k.getLowestSetBit(); + + var Uh = BigInteger.ONE; + var Vl = BigInteger.TWO; + var Vh = P; + var Ql = BigInteger.ONE; + var Qh = BigInteger.ONE; + + for (var j = n - 1; j >= s + 1; --j) + { + Ql = this.modMult(Ql, Qh); + + if (k.testBit(j)) + { + Qh = this.modMult(Ql, Q); + Uh = this.modMult(Uh, Vh); + Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); + Vh = this.modReduce(Vh.multiply(Vh).subtract(Qh.shiftLeft(1))); + } + else + { + Qh = Ql; + Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql)); + Vh = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); + Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1))); + } + } + + Ql = this.modMult(Ql, Qh); + Qh = this.modMult(Ql, Q); + Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql)); + Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); + Ql = this.modMult(Ql, Qh); + + for (var j = 1; j <= s; ++j) + { + Uh = this.modMult(Uh, Vl); + Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1))); + Ql = this.modMult(Ql, Ql); + } + + return [ Uh, Vl ]; +} + +var exports = { + ECCurveFp: ECCurveFp, + ECPointFp: ECPointFp, + ECFieldElementFp: ECFieldElementFp +} + +module.exports = exports diff --git a/appasar/canary/node_modules/ecc-jsbn/lib/sec.js b/appasar/canary/node_modules/ecc-jsbn/lib/sec.js new file mode 100644 index 0000000..5eec817 --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/lib/sec.js @@ -0,0 +1,170 @@ +// Named EC curves + +// Requires ec.js, jsbn.js, and jsbn2.js +var BigInteger = require('jsbn').BigInteger +var ECCurveFp = require('./ec.js').ECCurveFp + + +// ---------------- +// X9ECParameters + +// constructor +function X9ECParameters(curve,g,n,h) { + this.curve = curve; + this.g = g; + this.n = n; + this.h = h; +} + +function x9getCurve() { + return this.curve; +} + +function x9getG() { + return this.g; +} + +function x9getN() { + return this.n; +} + +function x9getH() { + return this.h; +} + +X9ECParameters.prototype.getCurve = x9getCurve; +X9ECParameters.prototype.getG = x9getG; +X9ECParameters.prototype.getN = x9getN; +X9ECParameters.prototype.getH = x9getH; + +// ---------------- +// SECNamedCurves + +function fromHex(s) { return new BigInteger(s, 16); } + +function secp128r1() { + // p = 2^128 - 2^97 - 1 + var p = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF"); + var a = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC"); + var b = fromHex("E87579C11079F43DD824993C2CEE5ED3"); + //byte[] S = Hex.decode("000E0D4D696E6768756151750CC03A4473D03679"); + var n = fromHex("FFFFFFFE0000000075A30D1B9038A115"); + var h = BigInteger.ONE; + var curve = new ECCurveFp(p, a, b); + var G = curve.decodePointHex("04" + + "161FF7528B899B2D0C28607CA52C5B86" + + "CF5AC8395BAFEB13C02DA292DDED7A83"); + return new X9ECParameters(curve, G, n, h); +} + +function secp160k1() { + // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1 + var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73"); + var a = BigInteger.ZERO; + var b = fromHex("7"); + //byte[] S = null; + var n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3"); + var h = BigInteger.ONE; + var curve = new ECCurveFp(p, a, b); + var G = curve.decodePointHex("04" + + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB" + + "938CF935318FDCED6BC28286531733C3F03C4FEE"); + return new X9ECParameters(curve, G, n, h); +} + +function secp160r1() { + // p = 2^160 - 2^31 - 1 + var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF"); + var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC"); + var b = fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45"); + //byte[] S = Hex.decode("1053CDE42C14D696E67687561517533BF3F83345"); + var n = fromHex("0100000000000000000001F4C8F927AED3CA752257"); + var h = BigInteger.ONE; + var curve = new ECCurveFp(p, a, b); + var G = curve.decodePointHex("04" + + "4A96B5688EF573284664698968C38BB913CBFC82" + + "23A628553168947D59DCC912042351377AC5FB32"); + return new X9ECParameters(curve, G, n, h); +} + +function secp192k1() { + // p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1 + var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37"); + var a = BigInteger.ZERO; + var b = fromHex("3"); + //byte[] S = null; + var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D"); + var h = BigInteger.ONE; + var curve = new ECCurveFp(p, a, b); + var G = curve.decodePointHex("04" + + "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D" + + "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D"); + return new X9ECParameters(curve, G, n, h); +} + +function secp192r1() { + // p = 2^192 - 2^64 - 1 + var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"); + var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC"); + var b = fromHex("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1"); + //byte[] S = Hex.decode("3045AE6FC8422F64ED579528D38120EAE12196D5"); + var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"); + var h = BigInteger.ONE; + var curve = new ECCurveFp(p, a, b); + var G = curve.decodePointHex("04" + + "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012" + + "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"); + return new X9ECParameters(curve, G, n, h); +} + +function secp224r1() { + // p = 2^224 - 2^96 + 1 + var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001"); + var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE"); + var b = fromHex("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4"); + //byte[] S = Hex.decode("BD71344799D5C7FCDC45B59FA3B9AB8F6A948BC5"); + var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"); + var h = BigInteger.ONE; + var curve = new ECCurveFp(p, a, b); + var G = curve.decodePointHex("04" + + "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21" + + "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34"); + return new X9ECParameters(curve, G, n, h); +} + +function secp256r1() { + // p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1 + var p = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"); + var a = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"); + var b = fromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"); + //byte[] S = Hex.decode("C49D360886E704936A6678E1139D26B7819F7E90"); + var n = fromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551"); + var h = BigInteger.ONE; + var curve = new ECCurveFp(p, a, b); + var G = curve.decodePointHex("04" + + "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296" + + "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5"); + return new X9ECParameters(curve, G, n, h); +} + +// TODO: make this into a proper hashtable +function getSECCurveByName(name) { + if(name == "secp128r1") return secp128r1(); + if(name == "secp160k1") return secp160k1(); + if(name == "secp160r1") return secp160r1(); + if(name == "secp192k1") return secp192k1(); + if(name == "secp192r1") return secp192r1(); + if(name == "secp224r1") return secp224r1(); + if(name == "secp256r1") return secp256r1(); + return null; +} + +module.exports = { + "secp128r1":secp128r1, + "secp160k1":secp160k1, + "secp160r1":secp160r1, + "secp192k1":secp192k1, + "secp192r1":secp192r1, + "secp224r1":secp224r1, + "secp256r1":secp256r1 +} diff --git a/appasar/canary/node_modules/ecc-jsbn/package.json b/appasar/canary/node_modules/ecc-jsbn/package.json new file mode 100644 index 0000000..7101a87 --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/package.json @@ -0,0 +1,39 @@ +{ + "name": "ecc-jsbn", + "version": "0.1.1", + "description": "ECC JS code based on JSBN", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/quartzjer/ecc-jsbn.git" + }, + "keywords": [ + "jsbn", + "ecc", + "browserify" + ], + "author": { + "name": "Jeremie Miller", + "email": "jeremie@jabber.org", + "url": "http://jeremie.com/" + }, + "maintainers": [ + { + "name": "Jeremie Miller", + "email": "jeremie@jabber.org", + "url": "http://jeremie.com/" + }, + { + "name": "Ryan Bennett", + "url": "https://github.com/rynomad" + } + ], + "dependencies": { + "jsbn": "~0.1.0" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/quartzjer/ecc-jsbn/issues" + }, + "homepage": "https://github.com/quartzjer/ecc-jsbn" +} diff --git a/appasar/canary/node_modules/ecc-jsbn/test.js b/appasar/canary/node_modules/ecc-jsbn/test.js new file mode 100644 index 0000000..bd52abf --- /dev/null +++ b/appasar/canary/node_modules/ecc-jsbn/test.js @@ -0,0 +1,14 @@ +var ecc = require("./index.js"); +var key1 = new ecc.ECKey(ecc.ECCurves.secp160r1); +var key2 = new ecc.ECKey(ecc.ECCurves.secp160r1); +console.log(key1.deriveSharedSecret(key2)); +var key3 = new ecc.ECKey(ecc.ECCurves.secp160r1,key1.PrivateKey); +var key4 = new ecc.ECKey(ecc.ECCurves.secp160r1,key2.PublicKey,true); +console.log(key3.deriveSharedSecret(key4)); + +var key1 = new ecc.ECKey(ecc.ECCurves.secp256r1); +var key2 = new ecc.ECKey(ecc.ECCurves.secp256r1); +console.log(key1.deriveSharedSecret(key2)); +var key3 = new ecc.ECKey(ecc.ECCurves.secp256r1,key1.PrivateKey); +var key4 = new ecc.ECKey(ecc.ECCurves.secp256r1,key2.PublicKey,true); +console.log(key3.deriveSharedSecret(key4)); diff --git a/appasar/canary/node_modules/extend/.eslintrc b/appasar/canary/node_modules/extend/.eslintrc new file mode 100644 index 0000000..90b3193 --- /dev/null +++ b/appasar/canary/node_modules/extend/.eslintrc @@ -0,0 +1,17 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": [2, 15], + "eqeqeq": [2, "allow-null"], + "func-name-matching": [1], + "max-depth": [1, 4], + "max-statements": [2, 26], + "no-extra-parens": [1], + "no-magic-numbers": [0], + "no-restricted-syntax": [2, "BreakStatement", "ContinueStatement", "DebuggerStatement", "LabeledStatement", "WithStatement"], + "sort-keys": [0], + } +} diff --git a/appasar/canary/node_modules/extend/.jscs.json b/appasar/canary/node_modules/extend/.jscs.json new file mode 100644 index 0000000..0284c86 --- /dev/null +++ b/appasar/canary/node_modules/extend/.jscs.json @@ -0,0 +1,175 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 6 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": false, + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/appasar/canary/node_modules/extend/.npmignore b/appasar/canary/node_modules/extend/.npmignore new file mode 100644 index 0000000..30d74d2 --- /dev/null +++ b/appasar/canary/node_modules/extend/.npmignore @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/appasar/canary/node_modules/extend/.travis.yml b/appasar/canary/node_modules/extend/.travis.yml new file mode 100644 index 0000000..6bf696c --- /dev/null +++ b/appasar/canary/node_modules/extend/.travis.yml @@ -0,0 +1,179 @@ +language: node_js +os: + - linux +node_js: + - "7.9" + - "6.10" + - "5.12" + - "4.8" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "node" + env: PRETEST=true + - node_js: "node" + env: COVERAGE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + ##- node_js: "7" + #env: TEST=true + #os: osx + #- node_js: "6" + #env: TEST=true + #os: osx + #- node_js: "5" + #env: TEST=true + #os: osx + #- node_js: "4" + #env: TEST=true + #os: osx + #- node_js: "iojs" + #env: TEST=true + #os: osx + #- node_js: "0.12" + #env: TEST=true + #os: osx + #- node_js: "0.10" + #env: TEST=true + #os: osx + #- node_js: "0.8" + #env: TEST=true + #os: osx + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true diff --git a/appasar/canary/node_modules/extend/CHANGELOG.md b/appasar/canary/node_modules/extend/CHANGELOG.md new file mode 100644 index 0000000..0fe5287 --- /dev/null +++ b/appasar/canary/node_modules/extend/CHANGELOG.md @@ -0,0 +1,77 @@ +3.0.1 / 2017-04-27 +================== + * [Fix] deep extending should work with a non-object (#46) + * [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config` + * [Tests] up to `node` `v7.9`, `v6.10`, `v4.8`; improve matrix + * [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. + * [Docs] Add example to readme (#34) + +3.0.0 / 2015-07-01 +================== + * [Possible breaking change] Use global "strict" directive (#32) + * [Tests] `int` is an ES3 reserved word + * [Tests] Test up to `io.js` `v2.3` + * [Tests] Add `npm run eslint` + * [Dev Deps] Update `covert`, `jscs` + +2.0.1 / 2015-04-25 +================== + * Use an inline `isArray` check, for ES3 browsers. (#27) + * Some old browsers fail when an identifier is `toString` + * Test latest `node` and `io.js` versions on `travis-ci`; speed up builds + * Add license info to package.json (#25) + * Update `tape`, `jscs` + * Adding a CHANGELOG + +2.0.0 / 2014-10-01 +================== + * Increase code coverage to 100%; run code coverage as part of tests + * Add `npm run lint`; Run linter as part of tests + * Remove nodeType and setInterval checks in isPlainObject + * Updating `tape`, `jscs`, `covert` + * General style and README cleanup + +1.3.0 / 2014-06-20 +================== + * Add component.json for browser support (#18) + * Use SVG for badges in README (#16) + * Updating `tape`, `covert` + * Updating travis-ci to work with multiple node versions + * Fix `deep === false` bug (returning target as {}) (#14) + * Fixing constructor checks in isPlainObject + * Adding additional test coverage + * Adding `npm run coverage` + * Add LICENSE (#13) + * Adding a warning about `false`, per #11 + * General style and whitespace cleanup + +1.2.1 / 2013-09-14 +================== + * Fixing hasOwnProperty bugs that would only have shown up in specific browsers. Fixes #8 + * Updating `tape` + +1.2.0 / 2013-09-02 +================== + * Updating the README: add badges + * Adding a missing variable reference. + * Using `tape` instead of `buster` for tests; add more tests (#7) + * Adding node 0.10 to Travis CI (#6) + * Enabling "npm test" and cleaning up package.json (#5) + * Add Travis CI. + +1.1.3 / 2012-12-06 +================== + * Added unit tests. + * Ensure extend function is named. (Looks nicer in a stack trace.) + * README cleanup. + +1.1.1 / 2012-11-07 +================== + * README cleanup. + * Added installation instructions. + * Added a missing semicolon + +1.0.0 / 2012-04-08 +================== + * Initial commit + diff --git a/appasar/canary/node_modules/extend/LICENSE b/appasar/canary/node_modules/extend/LICENSE new file mode 100644 index 0000000..e16d6a5 --- /dev/null +++ b/appasar/canary/node_modules/extend/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) 2014 Stefan Thomas + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/appasar/canary/node_modules/extend/README.md b/appasar/canary/node_modules/extend/README.md new file mode 100644 index 0000000..5b8249a --- /dev/null +++ b/appasar/canary/node_modules/extend/README.md @@ -0,0 +1,81 @@ +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] + +# extend() for Node.js <sup>[![Version Badge][npm-version-png]][npm-url]</sup> + +`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. + +Notes: + +* Since Node.js >= 4, + [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) + now offers the same functionality natively (but without the "deep copy" option). + See [ECMAScript 2015 (ES6) in Node.js](https://nodejs.org/en/docs/es6). +* Some native implementations of `Object.assign` in both Node.js and many + browsers (since NPM modules are for the browser too) may not be fully + spec-compliant. + Check [`object.assign`](https://www.npmjs.com/package/object.assign) module for + a compliant candidate. + +## Installation + +This package is available on [npm][npm-url] as: `extend` + +``` sh +npm install extend +``` + +## Usage + +**Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)** + +*Extend one object with one or more others, returning the modified object.* + +**Example:** + +``` js +var extend = require('extend'); +extend(targetObject, object1, object2); +``` + +Keep in mind that the target object will be modified, and will be returned from extend(). + +If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). +Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. +Warning: passing `false` as the first argument is not supported. + +### Arguments + +* `deep` *Boolean* (optional) +If set, the merge becomes recursive (i.e. deep copy). +* `target` *Object* +The object to extend. +* `object1` *Object* +The object that will be merged into the first. +* `objectN` *Object* (Optional) +More objects to merge into the first. + +## License + +`node-extend` is licensed under the [MIT License][mit-license-url]. + +## Acknowledgements + +All credit to the jQuery authors for perfecting this amazing utility. + +Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb]. + +[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg +[travis-url]: https://travis-ci.org/justmoon/node-extend +[npm-url]: https://npmjs.org/package/extend +[mit-license-url]: http://opensource.org/licenses/MIT +[github-justmoon]: https://github.com/justmoon +[github-insin]: https://github.com/insin +[github-ljharb]: https://github.com/ljharb +[npm-version-png]: http://versionbadg.es/justmoon/node-extend.svg +[deps-svg]: https://david-dm.org/justmoon/node-extend.svg +[deps-url]: https://david-dm.org/justmoon/node-extend +[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg +[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies + diff --git a/appasar/canary/node_modules/extend/component.json b/appasar/canary/node_modules/extend/component.json new file mode 100644 index 0000000..1500a2f --- /dev/null +++ b/appasar/canary/node_modules/extend/component.json @@ -0,0 +1,32 @@ +{ + "name": "extend", + "author": "Stefan Thomas <justmoon@members.fsf.org> (http://www.justmoon.net)", + "version": "3.0.0", + "description": "Port of jQuery.extend for node.js and the browser.", + "scripts": [ + "index.js" + ], + "contributors": [ + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "keywords": [ + "extend", + "clone", + "merge" + ], + "repository" : { + "type": "git", + "url": "https://github.com/justmoon/node-extend.git" + }, + "dependencies": { + }, + "devDependencies": { + "tape" : "~3.0.0", + "covert": "~0.4.0", + "jscs": "~1.6.2" + } +} + diff --git a/appasar/canary/node_modules/extend/index.js b/appasar/canary/node_modules/extend/index.js new file mode 100644 index 0000000..bbe53f6 --- /dev/null +++ b/appasar/canary/node_modules/extend/index.js @@ -0,0 +1,86 @@ +'use strict'; + +var hasOwn = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; + +var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } + + return toStr.call(arr) === '[object Array]'; +}; + +var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } + + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) { /**/ } + + return typeof key === 'undefined' || hasOwn.call(obj, key); +}; + +module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone; + var target = arguments[0]; + var i = 1; + var length = arguments.length; + var deep = false; + + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { + target = {}; + } + + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = target[name]; + copy = options[name]; + + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[name] = extend(deep, clone, copy); + + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + target[name] = copy; + } + } + } + } + } + + // Return the modified object + return target; +}; diff --git a/appasar/canary/node_modules/extend/package.json b/appasar/canary/node_modules/extend/package.json new file mode 100644 index 0000000..f68aa0d --- /dev/null +++ b/appasar/canary/node_modules/extend/package.json @@ -0,0 +1,43 @@ +{ + "name": "extend", + "author": "Stefan Thomas <justmoon@members.fsf.org> (http://www.justmoon.net)", + "version": "3.0.1", + "description": "Port of jQuery.extend for node.js and the browser", + "main": "index", + "scripts": { + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npm run coverage-quiet", + "tests-only": "node test", + "coverage": "covert test/index.js", + "coverage-quiet": "covert test/index.js --quiet", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs *.js */*.js", + "eslint": "eslint *.js */*.js" + }, + "contributors": [ + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "keywords": [ + "extend", + "clone", + "merge" + ], + "repository": { + "type": "git", + "url": "https://github.com/justmoon/node-extend.git" + }, + "dependencies": {}, + "devDependencies": { + "tape": "^4.6.3", + "covert": "^1.1.0", + "jscs": "^3.0.7", + "eslint": "^3.19.0", + "@ljharb/eslint-config": "^11.0.0" + }, + "license": "MIT" +} + diff --git a/appasar/canary/node_modules/extsprintf/.gitmodules b/appasar/canary/node_modules/extsprintf/.gitmodules new file mode 100644 index 0000000..e69de29 diff --git a/appasar/canary/node_modules/extsprintf/.npmignore b/appasar/canary/node_modules/extsprintf/.npmignore new file mode 100644 index 0000000..6ed1ae9 --- /dev/null +++ b/appasar/canary/node_modules/extsprintf/.npmignore @@ -0,0 +1,2 @@ +/deps +/examples diff --git a/appasar/canary/node_modules/extsprintf/LICENSE b/appasar/canary/node_modules/extsprintf/LICENSE new file mode 100644 index 0000000..cbc0bb3 --- /dev/null +++ b/appasar/canary/node_modules/extsprintf/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012, Joyent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE diff --git a/appasar/canary/node_modules/extsprintf/Makefile b/appasar/canary/node_modules/extsprintf/Makefile new file mode 100644 index 0000000..db84518 --- /dev/null +++ b/appasar/canary/node_modules/extsprintf/Makefile @@ -0,0 +1,24 @@ +# +# Copyright (c) 2012, Joyent, Inc. All rights reserved. +# +# Makefile: top-level Makefile +# +# This Makefile contains only repo-specific logic and uses included makefiles +# to supply common targets (javascriptlint, jsstyle, restdown, etc.), which are +# used by other repos as well. +# + +# +# Files +# +JSL = jsl +JSSTYLE = jsstyle +JS_FILES := $(shell find examples lib -name '*.js') +JSL_FILES_NODE = $(JS_FILES) +JSSTYLE_FILES = $(JS_FILES) +JSL_CONF_NODE = jsl.node.conf + +# Default target is "check" +check: + +include ./Makefile.targ diff --git a/appasar/canary/node_modules/extsprintf/Makefile.targ b/appasar/canary/node_modules/extsprintf/Makefile.targ new file mode 100644 index 0000000..2a64fe7 --- /dev/null +++ b/appasar/canary/node_modules/extsprintf/Makefile.targ @@ -0,0 +1,285 @@ +# -*- mode: makefile -*- +# +# Copyright (c) 2012, Joyent, Inc. All rights reserved. +# +# Makefile.targ: common targets. +# +# NOTE: This makefile comes from the "eng" repo. It's designed to be dropped +# into other repos as-is without requiring any modifications. If you find +# yourself changing this file, you should instead update the original copy in +# eng.git and then update your repo to use the new version. +# +# This Makefile defines several useful targets and rules. You can use it by +# including it from a Makefile that specifies some of the variables below. +# +# Targets defined in this Makefile: +# +# check Checks JavaScript files for lint and style +# Checks bash scripts for syntax +# Checks SMF manifests for validity against the SMF DTD +# +# clean Removes built files +# +# docs Builds restdown documentation in docs/ +# +# prepush Depends on "check" and "test" +# +# test Does nothing (you should override this) +# +# xref Generates cscope (source cross-reference index) +# +# For details on what these targets are supposed to do, see the Joyent +# Engineering Guide. +# +# To make use of these targets, you'll need to set some of these variables. Any +# variables left unset will simply not be used. +# +# BASH_FILES Bash scripts to check for syntax +# (paths relative to top-level Makefile) +# +# CLEAN_FILES Files to remove as part of the "clean" target. Note +# that files generated by targets in this Makefile are +# automatically included in CLEAN_FILES. These include +# restdown-generated HTML and JSON files. +# +# DOC_FILES Restdown (documentation source) files. These are +# assumed to be contained in "docs/", and must NOT +# contain the "docs/" prefix. +# +# JSL_CONF_NODE Specify JavaScriptLint configuration files +# JSL_CONF_WEB (paths relative to top-level Makefile) +# +# Node.js and Web configuration files are separate +# because you'll usually want different global variable +# configurations. If no file is specified, none is given +# to jsl, which causes it to use a default configuration, +# which probably isn't what you want. +# +# JSL_FILES_NODE JavaScript files to check with Node config file. +# JSL_FILES_WEB JavaScript files to check with Web config file. +# +# You can also override these variables: +# +# BASH Path to bash (default: bash) +# +# CSCOPE_DIRS Directories to search for source files for the cscope +# index. (default: ".") +# +# JSL Path to JavaScriptLint (default: "jsl") +# +# JSL_FLAGS_NODE Additional flags to pass through to JSL +# JSL_FLAGS_WEB +# JSL_FLAGS +# +# JSSTYLE Path to jsstyle (default: jsstyle) +# +# JSSTYLE_FLAGS Additional flags to pass through to jsstyle +# + +# +# Defaults for the various tools we use. +# +BASH ?= bash +BASHSTYLE ?= tools/bashstyle +CP ?= cp +CSCOPE ?= cscope +CSCOPE_DIRS ?= . +JSL ?= jsl +JSSTYLE ?= jsstyle +MKDIR ?= mkdir -p +MV ?= mv +RESTDOWN_FLAGS ?= +RMTREE ?= rm -rf +JSL_FLAGS ?= --nologo --nosummary + +ifeq ($(shell uname -s),SunOS) + TAR ?= gtar +else + TAR ?= tar +endif + + +# +# Defaults for other fixed values. +# +BUILD = build +DISTCLEAN_FILES += $(BUILD) +DOC_BUILD = $(BUILD)/docs/public + +# +# Configure JSL_FLAGS_{NODE,WEB} based on JSL_CONF_{NODE,WEB}. +# +ifneq ($(origin JSL_CONF_NODE), undefined) + JSL_FLAGS_NODE += --conf=$(JSL_CONF_NODE) +endif + +ifneq ($(origin JSL_CONF_WEB), undefined) + JSL_FLAGS_WEB += --conf=$(JSL_CONF_WEB) +endif + +# +# Targets. For descriptions on what these are supposed to do, see the +# Joyent Engineering Guide. +# + +# +# Instruct make to keep around temporary files. We have rules below that +# automatically update git submodules as needed, but they employ a deps/*/.git +# temporary file. Without this directive, make tries to remove these .git +# directories after the build has completed. +# +.SECONDARY: $($(wildcard deps/*):%=%/.git) + +# +# This rule enables other rules that use files from a git submodule to have +# those files depend on deps/module/.git and have "make" automatically check +# out the submodule as needed. +# +deps/%/.git: + git submodule update --init deps/$* + +# +# These recipes make heavy use of dynamically-created phony targets. The parent +# Makefile defines a list of input files like BASH_FILES. We then say that each +# of these files depends on a fake target called filename.bashchk, and then we +# define a pattern rule for those targets that runs bash in check-syntax-only +# mode. This mechanism has the nice properties that if you specify zero files, +# the rule becomes a noop (unlike a single rule to check all bash files, which +# would invoke bash with zero files), and you can check individual files from +# the command line with "make filename.bashchk". +# +.PHONY: check-bash +check-bash: $(BASH_FILES:%=%.bashchk) $(BASH_FILES:%=%.bashstyle) + +%.bashchk: % + $(BASH) -n $^ + +%.bashstyle: % + $(BASHSTYLE) $^ + +.PHONY: check-jsl check-jsl-node check-jsl-web +check-jsl: check-jsl-node check-jsl-web + +check-jsl-node: $(JSL_FILES_NODE:%=%.jslnodechk) + +check-jsl-web: $(JSL_FILES_WEB:%=%.jslwebchk) + +%.jslnodechk: % $(JSL_EXEC) + $(JSL) $(JSL_FLAGS) $(JSL_FLAGS_NODE) $< + +%.jslwebchk: % $(JSL_EXEC) + $(JSL) $(JSL_FLAGS) $(JSL_FLAGS_WEB) $< + +.PHONY: check-jsstyle +check-jsstyle: $(JSSTYLE_FILES:%=%.jsstylechk) + +%.jsstylechk: % $(JSSTYLE_EXEC) + $(JSSTYLE) $(JSSTYLE_FLAGS) $< + +.PHONY: check +check: check-jsl check-jsstyle check-bash + @echo check ok + +.PHONY: clean +clean:: + -$(RMTREE) $(CLEAN_FILES) + +.PHONY: distclean +distclean:: clean + -$(RMTREE) $(DISTCLEAN_FILES) + +CSCOPE_FILES = cscope.in.out cscope.out cscope.po.out +CLEAN_FILES += $(CSCOPE_FILES) + +.PHONY: xref +xref: cscope.files + $(CSCOPE) -bqR + +.PHONY: cscope.files +cscope.files: + find $(CSCOPE_DIRS) -name '*.c' -o -name '*.h' -o -name '*.cc' \ + -o -name '*.js' -o -name '*.s' -o -name '*.cpp' > $@ + +# +# The "docs" target is complicated because we do several things here: +# +# (1) Use restdown to build HTML and JSON files from each of DOC_FILES. +# +# (2) Copy these files into $(DOC_BUILD) (build/docs/public), which +# functions as a complete copy of the documentation that could be +# mirrored or served over HTTP. +# +# (3) Then copy any directories and media from docs/media into +# $(DOC_BUILD)/media. This allows projects to include their own media, +# including files that will override same-named files provided by +# restdown. +# +# Step (3) is the surprisingly complex part: in order to do this, we need to +# identify the subdirectories in docs/media, recreate them in +# $(DOC_BUILD)/media, then do the same with the files. +# +DOC_MEDIA_DIRS := $(shell find docs/media -type d 2>/dev/null | grep -v "^docs/media$$") +DOC_MEDIA_DIRS := $(DOC_MEDIA_DIRS:docs/media/%=%) +DOC_MEDIA_DIRS_BUILD := $(DOC_MEDIA_DIRS:%=$(DOC_BUILD)/media/%) + +DOC_MEDIA_FILES := $(shell find docs/media -type f 2>/dev/null) +DOC_MEDIA_FILES := $(DOC_MEDIA_FILES:docs/media/%=%) +DOC_MEDIA_FILES_BUILD := $(DOC_MEDIA_FILES:%=$(DOC_BUILD)/media/%) + +# +# Like the other targets, "docs" just depends on the final files we want to +# create in $(DOC_BUILD), leveraging other targets and recipes to define how +# to get there. +# +.PHONY: docs +docs: \ + $(DOC_FILES:%.restdown=$(DOC_BUILD)/%.html) \ + $(DOC_FILES:%.restdown=$(DOC_BUILD)/%.json) \ + $(DOC_MEDIA_FILES_BUILD) + +# +# We keep the intermediate files so that the next build can see whether the +# files in DOC_BUILD are up to date. +# +.PRECIOUS: \ + $(DOC_FILES:%.restdown=docs/%.html) \ + $(DOC_FILES:%.restdown=docs/%json) + +# +# We do clean those intermediate files, as well as all of DOC_BUILD. +# +CLEAN_FILES += \ + $(DOC_BUILD) \ + $(DOC_FILES:%.restdown=docs/%.html) \ + $(DOC_FILES:%.restdown=docs/%.json) + +# +# Before installing the files, we must make sure the directories exist. The | +# syntax tells make that the dependency need only exist, not be up to date. +# Otherwise, it might try to rebuild spuriously because the directory itself +# appears out of date. +# +$(DOC_MEDIA_FILES_BUILD): | $(DOC_MEDIA_DIRS_BUILD) + +$(DOC_BUILD)/%: docs/% | $(DOC_BUILD) + $(CP) $< $@ + +docs/%.json docs/%.html: docs/%.restdown | $(DOC_BUILD) $(RESTDOWN_EXEC) + $(RESTDOWN) $(RESTDOWN_FLAGS) -m $(DOC_BUILD) $< + +$(DOC_BUILD): + $(MKDIR) $@ + +$(DOC_MEDIA_DIRS_BUILD): + $(MKDIR) $@ + +# +# The default "test" target does nothing. This should usually be overridden by +# the parent Makefile. It's included here so we can define "prepush" without +# requiring the repo to define "test". +# +.PHONY: test +test: + +.PHONY: prepush +prepush: check test diff --git a/appasar/canary/node_modules/extsprintf/README.md b/appasar/canary/node_modules/extsprintf/README.md new file mode 100644 index 0000000..b22998d --- /dev/null +++ b/appasar/canary/node_modules/extsprintf/README.md @@ -0,0 +1,46 @@ +# extsprintf: extended POSIX-style sprintf + +Stripped down version of s[n]printf(3c). We make a best effort to throw an +exception when given a format string we don't understand, rather than ignoring +it, so that we won't break existing programs if/when we go implement the rest +of this. + +This implementation currently supports specifying + +* field alignment ('-' flag), +* zero-pad ('0' flag) +* always show numeric sign ('+' flag), +* field width +* conversions for strings, decimal integers, and floats (numbers). +* argument size specifiers. These are all accepted but ignored, since + Javascript has no notion of the physical size of an argument. + +Everything else is currently unsupported, most notably: precision, unsigned +numbers, non-decimal numbers, and characters. + +Besides the usual POSIX conversions, this implementation supports: + +* `%j`: pretty-print a JSON object (using node's "inspect") +* `%r`: pretty-print an Error object + +# Example + +First, install it: + + # npm install extsprintf + +Now, use it: + + var mod_extsprintf = require('extsprintf'); + console.log(mod_extsprintf.sprintf('hello %25s', 'world')); + +outputs: + + hello world + +# Also supported + +**printf**: same args as sprintf, but prints the result to stdout + +**fprintf**: same args as sprintf, preceded by a Node stream. Prints the result +to the given stream. diff --git a/appasar/canary/node_modules/extsprintf/jsl.node.conf b/appasar/canary/node_modules/extsprintf/jsl.node.conf new file mode 100644 index 0000000..03f787f --- /dev/null +++ b/appasar/canary/node_modules/extsprintf/jsl.node.conf @@ -0,0 +1,137 @@ +# +# Configuration File for JavaScript Lint +# +# This configuration file can be used to lint a collection of scripts, or to enable +# or disable warnings for scripts that are linted via the command line. +# + +### Warnings +# Enable or disable warnings based on requirements. +# Use "+WarningName" to display or "-WarningName" to suppress. +# ++ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent ++ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity ++ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement ++anon_no_return_value # anonymous function does not always return value ++assign_to_function_call # assignment to a function call +-block_without_braces # block statement without curly braces ++comma_separated_stmts # multiple statements separated by commas (use semicolons?) ++comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==) ++default_not_at_end # the default case is not at the end of the switch statement ++dup_option_explicit # duplicate "option explicit" control comment ++duplicate_case_in_switch # duplicate case in switch statement ++duplicate_formal # duplicate formal argument {name} ++empty_statement # empty statement or extra semicolon ++identifier_hides_another # identifer {name} hides an identifier in a parent scope +-inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement ++incorrect_version # Expected /*jsl:content-type*/ control comment. The script was parsed with the wrong version. ++invalid_fallthru # unexpected "fallthru" control comment ++invalid_pass # unexpected "pass" control comment ++jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax ++leading_decimal_point # leading decimal point may indicate a number or an object member ++legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax ++meaningless_block # meaningless block; curly braces have no impact ++mismatch_ctrl_comments # mismatched control comment; "ignore" and "end" control comments must have a one-to-one correspondence ++misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma ++missing_break # missing break statement ++missing_break_for_last_case # missing break statement for last case in switch ++missing_default_case # missing default case in switch statement ++missing_option_explicit # the "option explicit" control comment is missing ++missing_semicolon # missing semicolon ++missing_semicolon_for_lambda # missing semicolon for lambda assignment ++multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs ++nested_comment # nested comment ++no_return_value # function {name} does not always return a value ++octal_number # leading zeros make an octal number ++parseint_missing_radix # parseInt missing radix parameter ++partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag ++redeclared_var # redeclaration of {name} ++trailing_comma_in_array # extra comma is not recommended in array initializers ++trailing_decimal_point # trailing decimal point may indicate a number or an object member ++undeclared_identifier # undeclared identifier: {name} ++unreachable_code # unreachable code +-unreferenced_argument # argument declared but never referenced: {name} +-unreferenced_function # function is declared but never referenced: {name} ++unreferenced_variable # variable is declared but never referenced: {name} ++unsupported_version # JavaScript {version} is not supported ++use_of_label # use of label ++useless_assign # useless assignment ++useless_comparison # useless comparison; comparing identical expressions +-useless_quotes # the quotation marks are unnecessary ++useless_void # use of the void type may be unnecessary (void is always undefined) ++var_hides_arg # variable {name} hides argument ++want_assign_or_call # expected an assignment or function call ++with_statement # with statement hides undeclared variables; use temporary variable instead + + +### Output format +# Customize the format of the error message. +# __FILE__ indicates current file path +# __FILENAME__ indicates current file name +# __LINE__ indicates current line +# __COL__ indicates current column +# __ERROR__ indicates error message (__ERROR_PREFIX__: __ERROR_MSG__) +# __ERROR_NAME__ indicates error name (used in configuration file) +# __ERROR_PREFIX__ indicates error prefix +# __ERROR_MSG__ indicates error message +# +# For machine-friendly output, the output format can be prefixed with +# "encode:". If specified, all items will be encoded with C-slashes. +# +# Visual Studio syntax (default): ++output-format __FILE__(__LINE__): __ERROR__ +# Alternative syntax: +#+output-format __FILE__:__LINE__: __ERROR__ + + +### Context +# Show the in-line position of the error. +# Use "+context" to display or "-context" to suppress. +# ++context + + +### Control Comments +# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for +# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is +# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason, +# although legacy control comments are enabled by default for backward compatibility. +# +-legacy_control_comments + + +### Defining identifiers +# By default, "option explicit" is enabled on a per-file basis. +# To enable this for all files, use "+always_use_option_explicit" +-always_use_option_explicit + +# Define certain identifiers of which the lint is not aware. +# (Use this in conjunction with the "undeclared identifier" warning.) +# +# Common uses for webpages might be: ++define __dirname ++define clearInterval ++define clearTimeout ++define console ++define exports ++define global ++define process ++define require ++define setInterval ++define setTimeout ++define Buffer ++define JSON ++define Math + +### JavaScript Version +# To change the default JavaScript version: +#+default-type text/javascript;version=1.5 +#+default-type text/javascript;e4x=1 + +### Files +# Specify which files to lint +# Use "+recurse" to enable recursion (disabled by default). +# To add a set of files, use "+process FileName", "+process Folder\Path\*.js", +# or "+process Folder\Path\*.htm". +# + diff --git a/appasar/canary/node_modules/extsprintf/lib/extsprintf.js b/appasar/canary/node_modules/extsprintf/lib/extsprintf.js new file mode 100644 index 0000000..ed883d3 --- /dev/null +++ b/appasar/canary/node_modules/extsprintf/lib/extsprintf.js @@ -0,0 +1,183 @@ +/* + * extsprintf.js: extended POSIX-style sprintf + */ + +var mod_assert = require('assert'); +var mod_util = require('util'); + +/* + * Public interface + */ +exports.sprintf = jsSprintf; +exports.printf = jsPrintf; +exports.fprintf = jsFprintf; + +/* + * Stripped down version of s[n]printf(3c). We make a best effort to throw an + * exception when given a format string we don't understand, rather than + * ignoring it, so that we won't break existing programs if/when we go implement + * the rest of this. + * + * This implementation currently supports specifying + * - field alignment ('-' flag), + * - zero-pad ('0' flag) + * - always show numeric sign ('+' flag), + * - field width + * - conversions for strings, decimal integers, and floats (numbers). + * - argument size specifiers. These are all accepted but ignored, since + * Javascript has no notion of the physical size of an argument. + * + * Everything else is currently unsupported, most notably precision, unsigned + * numbers, non-decimal numbers, and characters. + */ +function jsSprintf(fmt) +{ + var regex = [ + '([^%]*)', /* normal text */ + '%', /* start of format */ + '([\'\\-+ #0]*?)', /* flags (optional) */ + '([1-9]\\d*)?', /* width (optional) */ + '(\\.([1-9]\\d*))?', /* precision (optional) */ + '[lhjztL]*?', /* length mods (ignored) */ + '([diouxXfFeEgGaAcCsSp%jr])' /* conversion */ + ].join(''); + + var re = new RegExp(regex); + var args = Array.prototype.slice.call(arguments, 1); + var flags, width, precision, conversion; + var left, pad, sign, arg, match; + var ret = ''; + var argn = 1; + + mod_assert.equal('string', typeof (fmt)); + + while ((match = re.exec(fmt)) !== null) { + ret += match[1]; + fmt = fmt.substring(match[0].length); + + flags = match[2] || ''; + width = match[3] || 0; + precision = match[4] || ''; + conversion = match[6]; + left = false; + sign = false; + pad = ' '; + + if (conversion == '%') { + ret += '%'; + continue; + } + + if (args.length === 0) + throw (new Error('too few args to sprintf')); + + arg = args.shift(); + argn++; + + if (flags.match(/[\' #]/)) + throw (new Error( + 'unsupported flags: ' + flags)); + + if (precision.length > 0) + throw (new Error( + 'non-zero precision not supported')); + + if (flags.match(/-/)) + left = true; + + if (flags.match(/0/)) + pad = '0'; + + if (flags.match(/\+/)) + sign = true; + + switch (conversion) { + case 's': + if (arg === undefined || arg === null) + throw (new Error('argument ' + argn + + ': attempted to print undefined or null ' + + 'as a string')); + ret += doPad(pad, width, left, arg.toString()); + break; + + case 'd': + arg = Math.floor(arg); + /*jsl:fallthru*/ + case 'f': + sign = sign && arg > 0 ? '+' : ''; + ret += sign + doPad(pad, width, left, + arg.toString()); + break; + + case 'x': + ret += doPad(pad, width, left, arg.toString(16)); + break; + + case 'j': /* non-standard */ + if (width === 0) + width = 10; + ret += mod_util.inspect(arg, false, width); + break; + + case 'r': /* non-standard */ + ret += dumpException(arg); + break; + + default: + throw (new Error('unsupported conversion: ' + + conversion)); + } + } + + ret += fmt; + return (ret); +} + +function jsPrintf() { + var args = Array.prototype.slice.call(arguments); + args.unshift(process.stdout); + jsFprintf.apply(null, args); +} + +function jsFprintf(stream) { + var args = Array.prototype.slice.call(arguments, 1); + return (stream.write(jsSprintf.apply(this, args))); +} + +function doPad(chr, width, left, str) +{ + var ret = str; + + while (ret.length < width) { + if (left) + ret += chr; + else + ret = chr + ret; + } + + return (ret); +} + +/* + * This function dumps long stack traces for exceptions having a cause() method. + * See node-verror for an example. + */ +function dumpException(ex) +{ + var ret; + + if (!(ex instanceof Error)) + throw (new Error(jsSprintf('invalid type for %%r: %j', ex))); + + /* Note that V8 prepends "ex.stack" with ex.toString(). */ + ret = 'EXCEPTION: ' + ex.constructor.name + ': ' + ex.stack; + + if (ex.cause && typeof (ex.cause) === 'function') { + var cex = ex.cause(); + if (cex) { + ret += '\nCaused by: ' + dumpException(cex); + } + } + + return (ret); +} diff --git a/appasar/canary/node_modules/extsprintf/package.json b/appasar/canary/node_modules/extsprintf/package.json new file mode 100644 index 0000000..b788895 --- /dev/null +++ b/appasar/canary/node_modules/extsprintf/package.json @@ -0,0 +1,14 @@ +{ + "name": "extsprintf", + "version": "1.3.0", + "description": "extended POSIX-style sprintf", + "main": "./lib/extsprintf.js", + "repository": { + "type": "git", + "url": "git://github.com/davepacheco/node-extsprintf.git" + }, + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" +} diff --git a/appasar/canary/node_modules/fast-deep-equal/LICENSE b/appasar/canary/node_modules/fast-deep-equal/LICENSE new file mode 100644 index 0000000..7f15435 --- /dev/null +++ b/appasar/canary/node_modules/fast-deep-equal/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/fast-deep-equal/README.md b/appasar/canary/node_modules/fast-deep-equal/README.md new file mode 100644 index 0000000..ee83edd --- /dev/null +++ b/appasar/canary/node_modules/fast-deep-equal/README.md @@ -0,0 +1,55 @@ +# fast-deep-equal +The fastest deep equal + +[![Build Status](https://travis-ci.org/epoberezkin/fast-deep-equal.svg?branch=master)](https://travis-ci.org/epoberezkin/fast-deep-equal) +[![npm version](https://badge.fury.io/js/fast-deep-equal.svg)](http://badge.fury.io/js/fast-deep-equal) +[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/fast-deep-equal/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/fast-deep-equal?branch=master) + + +## Install + +```bash +npm install fast-deep-equal +``` + + +## Features + +- ES5 compatible +- works in node.js (0.10+) and browsers (IE9+) +- checks equality of Date and RegExp objects by value. + + +## Usage + +```javascript +var equal = require('fast-deep-equal'); +console.log(equal({foo: 'bar'}, {foo: 'bar'})); // true +``` + + +## Performance benchmark + +``` +fast-deep-equal x 82,915 ops/sec ±0.63% (89 runs sampled) +nano-equal x 50,506 ops/sec ±2.23% (86 runs sampled) +shallow-equal-fuzzy x 14,873 ops/sec ±3.19% (83 runs sampled) +underscore.isEqual x 16,055 ops/sec ±2.29% (85 runs sampled) +lodash.isEqual x 10,740 ops/sec ±1.04% (89 runs sampled) +deep-equal x 12,276 ops/sec ±2.44% (84 runs sampled) +deep-eql x 10,565 ops/sec ±0.89% (90 runs sampled) +assert.deepStrictEqual x 965 ops/sec ±2.99% (81 runs sampled) +The fastest is fast-deep-equal +``` + +To run benchmark (requires node.js 6+): + +```bash +npm install +node benchmark +``` + + +## License + +[MIT](https://github.com/epoberezkin/fast-deep-equal/blob/master/LICENSE) diff --git a/appasar/canary/node_modules/fast-deep-equal/index.d.ts b/appasar/canary/node_modules/fast-deep-equal/index.d.ts new file mode 100644 index 0000000..3c042ca --- /dev/null +++ b/appasar/canary/node_modules/fast-deep-equal/index.d.ts @@ -0,0 +1,4 @@ +declare module 'fast-deep-equal' { + const equal: (a: any, b: any) => boolean; + export = equal; +} diff --git a/appasar/canary/node_modules/fast-deep-equal/index.js b/appasar/canary/node_modules/fast-deep-equal/index.js new file mode 100644 index 0000000..7aaaba3 --- /dev/null +++ b/appasar/canary/node_modules/fast-deep-equal/index.js @@ -0,0 +1,55 @@ +'use strict'; + +var isArray = Array.isArray; +var keyList = Object.keys; +var hasProp = Object.prototype.hasOwnProperty; + +module.exports = function equal(a, b) { + if (a === b) return true; + + var arrA = isArray(a) + , arrB = isArray(b) + , i + , length + , key; + + if (arrA && arrB) { + length = a.length; + if (length != b.length) return false; + for (i = 0; i < length; i++) + if (!equal(a[i], b[i])) return false; + return true; + } + + if (arrA != arrB) return false; + + var dateA = a instanceof Date + , dateB = b instanceof Date; + if (dateA != dateB) return false; + if (dateA && dateB) return a.getTime() == b.getTime(); + + var regexpA = a instanceof RegExp + , regexpB = b instanceof RegExp; + if (regexpA != regexpB) return false; + if (regexpA && regexpB) return a.toString() == b.toString(); + + if (a instanceof Object && b instanceof Object) { + var keys = keyList(a); + length = keys.length; + + if (length !== keyList(b).length) + return false; + + for (i = 0; i < length; i++) + if (!hasProp.call(b, keys[i])) return false; + + for (i = 0; i < length; i++) { + key = keys[i]; + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + return false; +}; diff --git a/appasar/canary/node_modules/fast-deep-equal/package.json b/appasar/canary/node_modules/fast-deep-equal/package.json new file mode 100644 index 0000000..1e7b6b4 --- /dev/null +++ b/appasar/canary/node_modules/fast-deep-equal/package.json @@ -0,0 +1,58 @@ +{ + "name": "fast-deep-equal", + "version": "1.1.0", + "description": "Fast deep equal", + "main": "index.js", + "scripts": { + "eslint": "eslint *.js benchmark spec", + "test-spec": "mocha spec/*.spec.js -R spec", + "test-cov": "nyc npm run test-spec", + "test-ts": "tsc --target ES5 --noImplicitAny index.d.ts", + "test": "npm run eslint && npm run test-ts && npm run test-cov" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/epoberezkin/fast-deep-equal.git" + }, + "keywords": [ + "fast", + "equal", + "deep-equal" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": { + "url": "https://github.com/epoberezkin/fast-deep-equal/issues" + }, + "homepage": "https://github.com/epoberezkin/fast-deep-equal#readme", + "devDependencies": { + "benchmark": "^2.1.4", + "coveralls": "^2.13.1", + "deep-eql": "^2.0.2", + "deep-equal": "^1.0.1", + "eslint": "^4.0.0", + "lodash": "^4.17.4", + "mocha": "^3.4.2", + "nano-equal": "^1.0.1", + "nyc": "^11.0.2", + "pre-commit": "^1.2.2", + "shallow-equal-fuzzy": "0.0.2", + "typescript": "^2.6.1", + "underscore": "^1.8.3" + }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "files": [ + "index.js", + "index.d.ts" + ], + "types": "index.d.ts" +} diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/.eslintrc.yml b/appasar/canary/node_modules/fast-json-stable-stringify/.eslintrc.yml new file mode 100644 index 0000000..1c77b0d --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/.eslintrc.yml @@ -0,0 +1,26 @@ +extends: eslint:recommended +env: + node: true + browser: true +rules: + block-scoped-var: 2 + callback-return: 2 + dot-notation: 2 + indent: 2 + linebreak-style: [2, unix] + new-cap: 2 + no-console: [2, allow: [warn, error]] + no-else-return: 2 + no-eq-null: 2 + no-fallthrough: 2 + no-invalid-this: 2 + no-return-assign: 2 + no-shadow: 1 + no-trailing-spaces: 2 + no-use-before-define: [2, nofunc] + quotes: [2, single, avoid-escape] + semi: [2, always] + strict: [2, global] + valid-jsdoc: [2, requireReturn: false] + no-control-regex: 0 + no-useless-escape: 2 diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/.npmignore b/appasar/canary/node_modules/fast-json-stable-stringify/.npmignore new file mode 100644 index 0000000..899d736 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/.npmignore @@ -0,0 +1,4 @@ +node_modules +.nyc_output/ +coverage/ +.DS_Store diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/.travis.yml b/appasar/canary/node_modules/fast-json-stable-stringify/.travis.yml new file mode 100644 index 0000000..7ddce74 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "4" + - "6" + - "7" + - "8" +after_script: + - coveralls < coverage/lcov.info diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/LICENSE b/appasar/canary/node_modules/fast-json-stable-stringify/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/README.md b/appasar/canary/node_modules/fast-json-stable-stringify/README.md new file mode 100644 index 0000000..0f43b4a --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/README.md @@ -0,0 +1,119 @@ +# fast-json-stable-stringify + +Deterministic `JSON.stringify()` - a faster version of [@substack](https://github.com/substack)'s json-stable-strigify without [jsonify](https://github.com/substack/jsonify). + +You can also pass in a custom comparison function. + +[![Build Status](https://travis-ci.org/epoberezkin/fast-json-stable-stringify.svg?branch=master)](https://travis-ci.org/epoberezkin/fast-json-stable-stringify) +[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/fast-json-stable-stringify/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/fast-json-stable-stringify?branch=master) + +# example + +``` js +var stringify = require('fast-json-stable-stringify'); +var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; +console.log(stringify(obj)); +``` + +output: + +``` +{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8} +``` + + +# methods + +``` js +var stringify = require('fast-json-stable-stringify') +``` + +## var str = stringify(obj, opts) + +Return a deterministic stringified string `str` from the object `obj`. + + +## options + +### cmp + +If `opts` is given, you can supply an `opts.cmp` to have a custom comparison +function for object keys. Your function `opts.cmp` is called with these +parameters: + +``` js +opts.cmp({ key: akey, value: avalue }, { key: bkey, value: bvalue }) +``` + +For example, to sort on the object key names in reverse order you could write: + +``` js +var stringify = require('fast-json-stable-stringify'); + +var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; +var s = stringify(obj, function (a, b) { + return a.key < b.key ? 1 : -1; +}); +console.log(s); +``` + +which results in the output string: + +``` +{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3} +``` + +Or if you wanted to sort on the object values in reverse order, you could write: + +``` +var stringify = require('fast-json-stable-stringify'); + +var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; +var s = stringify(obj, function (a, b) { + return a.value < b.value ? 1 : -1; +}); +console.log(s); +``` + +which outputs: + +``` +{"d":6,"c":5,"b":[{"z":3,"y":2,"x":1},9],"a":10} +``` + +### cycles + +Pass `true` in `opts.cycles` to stringify circular property as `__cycle__` - the result will not be a valid JSON string in this case. + +TypeError will be thrown in case of circular object without this option. + + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install fast-json-stable-stringify +``` + + +# benchmark + +To run benchmark (requires Node.js 6+): +``` +node benchmark +``` + +Results: +``` +fast-json-stable-stringify x 17,189 ops/sec ±1.43% (83 runs sampled) +json-stable-stringify x 13,634 ops/sec ±1.39% (85 runs sampled) +fast-stable-stringify x 20,212 ops/sec ±1.20% (84 runs sampled) +faster-stable-stringify x 15,549 ops/sec ±1.12% (84 runs sampled) +The fastest is fast-stable-stringify +``` + + +# license + +[MIT](https://github.com/epoberezkin/fast-json-stable-stringify/blob/master/LICENSE) diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/benchmark/index.js b/appasar/canary/node_modules/fast-json-stable-stringify/benchmark/index.js new file mode 100644 index 0000000..e725f9f --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/benchmark/index.js @@ -0,0 +1,31 @@ +'use strict'; + +const Benchmark = require('benchmark'); +const suite = new Benchmark.Suite; +const testData = require('./test.json'); + + +const stringifyPackages = { + // 'JSON.stringify': JSON.stringify, + 'fast-json-stable-stringify': require('../index'), + 'json-stable-stringify': true, + 'fast-stable-stringify': true, + 'faster-stable-stringify': true +}; + + +for (const name in stringifyPackages) { + let func = stringifyPackages[name]; + if (func === true) func = require(name); + + suite.add(name, function() { + func(testData); + }); +} + +suite + .on('cycle', (event) => console.log(String(event.target))) + .on('complete', function () { + console.log('The fastest is ' + this.filter('fastest').map('name')); + }) + .run({async: true}); diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/benchmark/test.json b/appasar/canary/node_modules/fast-json-stable-stringify/benchmark/test.json new file mode 100644 index 0000000..c9118c1 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/benchmark/test.json @@ -0,0 +1,137 @@ +[ + { + "_id": "59ef4a83ee8364808d761beb", + "index": 0, + "guid": "e50ffae9-7128-4148-9ee5-40c3fc523c5d", + "isActive": false, + "balance": "$2,341.81", + "picture": "http://placehold.it/32x32", + "age": 28, + "eyeColor": "brown", + "name": "Carey Savage", + "gender": "female", + "company": "VERAQ", + "email": "careysavage@veraq.com", + "phone": "+1 (897) 574-3014", + "address": "458 Willow Street, Henrietta, California, 7234", + "about": "Nisi reprehenderit nulla ad officia pariatur non dolore laboris irure cupidatat laborum. Minim eu ex Lorem adipisicing exercitation irure minim sunt est enim mollit incididunt voluptate nulla. Ut mollit anim reprehenderit et aliqua ex esse aliquip. Aute sit duis deserunt do incididunt consequat minim qui dolor commodo deserunt et voluptate.\r\n", + "registered": "2014-05-21T01:56:51 -01:00", + "latitude": 63.89502, + "longitude": 62.369807, + "tags": [ + "nostrud", + "nisi", + "consectetur", + "ullamco", + "cupidatat", + "culpa", + "commodo" + ], + "friends": [ + { + "id": 0, + "name": "Henry Walls" + }, + { + "id": 1, + "name": "Janice Baker" + }, + { + "id": 2, + "name": "Russell Bush" + } + ], + "greeting": "Hello, Carey Savage! You have 4 unread messages.", + "favoriteFruit": "banana" + }, + { + "_id": "59ef4a83ff5774a691454e89", + "index": 1, + "guid": "2bee9efc-4095-4c2e-87ef-d08c8054c89d", + "isActive": true, + "balance": "$1,618.15", + "picture": "http://placehold.it/32x32", + "age": 35, + "eyeColor": "blue", + "name": "Elinor Pearson", + "gender": "female", + "company": "FLEXIGEN", + "email": "elinorpearson@flexigen.com", + "phone": "+1 (923) 548-3751", + "address": "600 Bayview Avenue, Draper, Montana, 3088", + "about": "Mollit commodo ea sit Lorem velit. Irure anim esse Lorem sint quis officia ut. Aliqua nisi dolore in aute deserunt mollit ex ea in mollit.\r\n", + "registered": "2017-04-22T07:58:41 -01:00", + "latitude": -87.824919, + "longitude": 69.538927, + "tags": [ + "fugiat", + "labore", + "proident", + "quis", + "eiusmod", + "qui", + "est" + ], + "friends": [ + { + "id": 0, + "name": "Massey Wagner" + }, + { + "id": 1, + "name": "Marcella Ferrell" + }, + { + "id": 2, + "name": "Evans Mckee" + } + ], + "greeting": "Hello, Elinor Pearson! You have 3 unread messages.", + "favoriteFruit": "strawberry" + }, + { + "_id": "59ef4a839ec8a4be4430b36b", + "index": 2, + "guid": "ddd6e8c0-95bd-416d-8b46-a768d6363809", + "isActive": false, + "balance": "$2,046.95", + "picture": "http://placehold.it/32x32", + "age": 40, + "eyeColor": "green", + "name": "Irwin Davidson", + "gender": "male", + "company": "DANJA", + "email": "irwindavidson@danja.com", + "phone": "+1 (883) 537-2041", + "address": "439 Cook Street, Chapin, Kentucky, 7398", + "about": "Irure velit non commodo aliqua exercitation ut nostrud minim magna. Dolor ad ad ut irure eu. Non pariatur dolor eiusmod ipsum do et exercitation cillum. Et amet laboris minim eiusmod ullamco magna ea reprehenderit proident sunt.\r\n", + "registered": "2016-09-01T07:49:08 -01:00", + "latitude": -49.803812, + "longitude": 104.93279, + "tags": [ + "consequat", + "enim", + "quis", + "magna", + "est", + "culpa", + "tempor" + ], + "friends": [ + { + "id": 0, + "name": "Ruth Hansen" + }, + { + "id": 1, + "name": "Kathrine Austin" + }, + { + "id": 2, + "name": "Rivera Munoz" + } + ], + "greeting": "Hello, Irwin Davidson! You have 2 unread messages.", + "favoriteFruit": "banana" + } +] diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/example/key_cmp.js b/appasar/canary/node_modules/fast-json-stable-stringify/example/key_cmp.js new file mode 100644 index 0000000..d5f6675 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/example/key_cmp.js @@ -0,0 +1,7 @@ +var stringify = require('../'); + +var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; +var s = stringify(obj, function (a, b) { + return a.key < b.key ? 1 : -1; +}); +console.log(s); diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/example/nested.js b/appasar/canary/node_modules/fast-json-stable-stringify/example/nested.js new file mode 100644 index 0000000..9a672fc --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/example/nested.js @@ -0,0 +1,3 @@ +var stringify = require('../'); +var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; +console.log(stringify(obj)); diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/example/str.js b/appasar/canary/node_modules/fast-json-stable-stringify/example/str.js new file mode 100644 index 0000000..9b4b3cd --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/example/str.js @@ -0,0 +1,3 @@ +var stringify = require('../'); +var obj = { c: 6, b: [4,5], a: 3 }; +console.log(stringify(obj)); diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/example/value_cmp.js b/appasar/canary/node_modules/fast-json-stable-stringify/example/value_cmp.js new file mode 100644 index 0000000..09f1c5f --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/example/value_cmp.js @@ -0,0 +1,7 @@ +var stringify = require('../'); + +var obj = { d: 6, c: 5, b: [{z:3,y:2,x:1},9], a: 10 }; +var s = stringify(obj, function (a, b) { + return a.value < b.value ? 1 : -1; +}); +console.log(s); diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/index.js b/appasar/canary/node_modules/fast-json-stable-stringify/index.js new file mode 100644 index 0000000..c44e6a4 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/index.js @@ -0,0 +1,59 @@ +'use strict'; + +module.exports = function (data, opts) { + if (!opts) opts = {}; + if (typeof opts === 'function') opts = { cmp: opts }; + var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; + + var cmp = opts.cmp && (function (f) { + return function (node) { + return function (a, b) { + var aobj = { key: a, value: node[a] }; + var bobj = { key: b, value: node[b] }; + return f(aobj, bobj); + }; + }; + })(opts.cmp); + + var seen = []; + return (function stringify (node) { + if (node && node.toJSON && typeof node.toJSON === 'function') { + node = node.toJSON(); + } + + if (node === undefined) return; + if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; + if (typeof node !== 'object') return JSON.stringify(node); + + var i, out; + if (Array.isArray(node)) { + out = '['; + for (i = 0; i < node.length; i++) { + if (i) out += ','; + out += stringify(node[i]) || 'null'; + } + return out + ']'; + } + + if (node === null) return 'null'; + + if (seen.indexOf(node) !== -1) { + if (cycles) return JSON.stringify('__cycle__'); + throw new TypeError('Converting circular structure to JSON'); + } + + var seenIndex = seen.push(node) - 1; + var keys = Object.keys(node).sort(cmp && cmp(node)); + out = ''; + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = stringify(node[key]); + + if (!value) continue; + if (out) out += ','; + out += JSON.stringify(key) + ':' + value; + } + seen.splice(seenIndex, 1); + return '{' + out + '}'; + })(data); +}; diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/package.json b/appasar/canary/node_modules/fast-json-stable-stringify/package.json new file mode 100644 index 0000000..21380a9 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/package.json @@ -0,0 +1,50 @@ +{ + "name": "fast-json-stable-stringify", + "version": "2.0.0", + "description": "deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify", + "main": "index.js", + "devDependencies": { + "benchmark": "^2.1.4", + "coveralls": "^3.0.0", + "eslint": "^4.9.0", + "fast-stable-stringify": "latest", + "faster-stable-stringify": "latest", + "json-stable-stringify": "latest", + "nyc": "^11.2.1", + "pre-commit": "^1.2.2", + "tape": "~1.0.4" + }, + "scripts": { + "eslint": "eslint index.js test", + "test-spec": "tape test/*.js", + "test": "npm run eslint && nyc npm run test-spec" + }, + "repository": { + "type": "git", + "url": "git://github.com/epoberezkin/fast-json-stable-stringify.git" + }, + "homepage": "https://github.com/epoberezkin/fast-json-stable-stringify", + "keywords": [ + "json", + "stringify", + "deterministic", + "hash", + "stable" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "nyc": { + "exclude": [ + "test", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + } +} diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/test/cmp.js b/appasar/canary/node_modules/fast-json-stable-stringify/test/cmp.js new file mode 100644 index 0000000..4efd6b5 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/test/cmp.js @@ -0,0 +1,13 @@ +'use strict'; + +var test = require('tape'); +var stringify = require('../'); + +test('custom comparison function', function (t) { + t.plan(1); + var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; + var s = stringify(obj, function (a, b) { + return a.key < b.key ? 1 : -1; + }); + t.equal(s, '{"c":8,"b":[{"z":6,"y":5,"x":4},7],"a":3}'); +}); diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/test/nested.js b/appasar/canary/node_modules/fast-json-stable-stringify/test/nested.js new file mode 100644 index 0000000..167a358 --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/test/nested.js @@ -0,0 +1,44 @@ +'use strict'; + +var test = require('tape'); +var stringify = require('../'); + +test('nested', function (t) { + t.plan(1); + var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 }; + t.equal(stringify(obj), '{"a":3,"b":[{"x":4,"y":5,"z":6},7],"c":8}'); +}); + +test('cyclic (default)', function (t) { + t.plan(1); + var one = { a: 1 }; + var two = { a: 2, one: one }; + one.two = two; + try { + stringify(one); + } catch (ex) { + t.equal(ex.toString(), 'TypeError: Converting circular structure to JSON'); + } +}); + +test('cyclic (specifically allowed)', function (t) { + t.plan(1); + var one = { a: 1 }; + var two = { a: 2, one: one }; + one.two = two; + t.equal(stringify(one, {cycles:true}), '{"a":1,"two":{"a":2,"one":"__cycle__"}}'); +}); + +test('repeated non-cyclic value', function(t) { + t.plan(1); + var one = { x: 1 }; + var two = { a: one, b: one }; + t.equal(stringify(two), '{"a":{"x":1},"b":{"x":1}}'); +}); + +test('acyclic but with reused obj-property pointers', function (t) { + t.plan(1); + var x = { a: 1 }; + var y = { b: x, c: x }; + t.equal(stringify(y), '{"b":{"a":1},"c":{"a":1}}'); +}); diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/test/str.js b/appasar/canary/node_modules/fast-json-stable-stringify/test/str.js new file mode 100644 index 0000000..99a9ade --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/test/str.js @@ -0,0 +1,46 @@ +'use strict'; + +var test = require('tape'); +var stringify = require('../'); + +test('simple object', function (t) { + t.plan(1); + var obj = { c: 6, b: [4,5], a: 3, z: null }; + t.equal(stringify(obj), '{"a":3,"b":[4,5],"c":6,"z":null}'); +}); + +test('object with undefined', function (t) { + t.plan(1); + var obj = { a: 3, z: undefined }; + t.equal(stringify(obj), '{"a":3}'); +}); + +test('object with null', function (t) { + t.plan(1); + var obj = { a: 3, z: null }; + t.equal(stringify(obj), '{"a":3,"z":null}'); +}); + +test('object with NaN and Infinity', function (t) { + t.plan(1); + var obj = { a: 3, b: NaN, c: Infinity }; + t.equal(stringify(obj), '{"a":3,"b":null,"c":null}'); +}); + +test('array with undefined', function (t) { + t.plan(1); + var obj = [4, undefined, 6]; + t.equal(stringify(obj), '[4,null,6]'); +}); + +test('object with empty string', function (t) { + t.plan(1); + var obj = { a: 3, z: '' }; + t.equal(stringify(obj), '{"a":3,"z":""}'); +}); + +test('array with empty string', function (t) { + t.plan(1); + var obj = [4, '', 6]; + t.equal(stringify(obj), '[4,"",6]'); +}); diff --git a/appasar/canary/node_modules/fast-json-stable-stringify/test/to-json.js b/appasar/canary/node_modules/fast-json-stable-stringify/test/to-json.js new file mode 100644 index 0000000..2fb2cfa --- /dev/null +++ b/appasar/canary/node_modules/fast-json-stable-stringify/test/to-json.js @@ -0,0 +1,22 @@ +'use strict'; + +var test = require('tape'); +var stringify = require('../'); + +test('toJSON function', function (t) { + t.plan(1); + var obj = { one: 1, two: 2, toJSON: function() { return { one: 1 }; } }; + t.equal(stringify(obj), '{"one":1}' ); +}); + +test('toJSON returns string', function (t) { + t.plan(1); + var obj = { one: 1, two: 2, toJSON: function() { return 'one'; } }; + t.equal(stringify(obj), '"one"'); +}); + +test('toJSON returns array', function (t) { + t.plan(1); + var obj = { one: 1, two: 2, toJSON: function() { return ['one']; } }; + t.equal(stringify(obj), '["one"]'); +}); diff --git a/appasar/canary/node_modules/fd-slicer/.npmignore b/appasar/canary/node_modules/fd-slicer/.npmignore new file mode 100644 index 0000000..ccc2930 --- /dev/null +++ b/appasar/canary/node_modules/fd-slicer/.npmignore @@ -0,0 +1,2 @@ +/coverage +/node_modules diff --git a/appasar/canary/node_modules/fd-slicer/.travis.yml b/appasar/canary/node_modules/fd-slicer/.travis.yml new file mode 100644 index 0000000..77b7202 --- /dev/null +++ b/appasar/canary/node_modules/fd-slicer/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.10" +script: + - "npm run test-travis" +after_script: + - "npm install coveralls@2 && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls" diff --git a/appasar/canary/node_modules/fd-slicer/CHANGELOG.md b/appasar/canary/node_modules/fd-slicer/CHANGELOG.md new file mode 100644 index 0000000..783042f --- /dev/null +++ b/appasar/canary/node_modules/fd-slicer/CHANGELOG.md @@ -0,0 +1,49 @@ +### 1.0.1 + + * use `setImmediate` instead of `nextTick` + +### 1.0.0 + + * `new FdSlicer(fd, options)` must now be `fdSlicer.createFromFd(fd, options)` + * fix behavior when `end` is 0. + * fix `createWriteStream` when using `createFromBuffer` + +### 0.4.0 + + * add ability to create an FdSlicer instance from a Buffer + +### 0.3.2 + + * fix write stream and read stream destroy behavior + +### 0.3.1 + + * write stream: fix end option behavior + +### 0.3.0 + + * write stream emits 'progress' events + * write stream supports 'end' option which causes the stream to emit an error + if a maximum size is exceeded + * improve documentation + +### 0.2.1 + + * Update pend dependency to latest bugfix version. + +### 0.2.0 + + * Add read and write functions + +### 0.1.0 + + * Add `autoClose` option and `ref()` and `unref()`. + +### 0.0.2 + + * Add API documentation + * read stream: create buffer at last possible moment + +### 0.0.1 + + * Initial release diff --git a/appasar/canary/node_modules/fd-slicer/LICENSE b/appasar/canary/node_modules/fd-slicer/LICENSE new file mode 100644 index 0000000..e57596d --- /dev/null +++ b/appasar/canary/node_modules/fd-slicer/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2014 Andrew Kelley + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/fd-slicer/README.md b/appasar/canary/node_modules/fd-slicer/README.md new file mode 100644 index 0000000..5787c1a --- /dev/null +++ b/appasar/canary/node_modules/fd-slicer/README.md @@ -0,0 +1,189 @@ +# fd-slicer + +[![Build Status](https://travis-ci.org/andrewrk/node-fd-slicer.svg?branch=master)](https://travis-ci.org/andrewrk/node-fd-slicer) +[![Coverage Status](https://img.shields.io/coveralls/andrewrk/node-fd-slicer.svg)](https://coveralls.io/r/andrewrk/node-fd-slicer) + +Safe `fs.ReadStream` and `fs.WriteStream` using the same fd. + +Let's say that you want to perform a parallel upload of a file to a remote +server. To do this, we want to create multiple read streams. The first thing +you might think of is to use the `{start: 0, end: 0}` API of +`fs.createReadStream`. This gives you two choices: + + 0. Use the same file descriptor for all `fs.ReadStream` objects. + 0. Open the file multiple times, resulting in a separate file descriptor + for each read stream. + +Neither of these are acceptable options. The first one is a severe bug, +because the API docs for `fs.write` state: + +> Note that it is unsafe to use `fs.write` multiple times on the same file +> without waiting for the callback. For this scenario, `fs.createWriteStream` +> is strongly recommended. + +`fs.createWriteStream` will solve the problem if you only create one of them +for the file descriptor, but it will exhibit this unsafety if you create +multiple write streams per file descriptor. + +The second option suffers from a race condition. For each additional time the +file is opened after the first, it is possible that the file is modified. So +in our parallel uploading example, we might upload a corrupt file that never +existed on the client's computer. + +This module solves this problem by providing `createReadStream` and +`createWriteStream` that operate on a shared file descriptor and provides +the convenient stream API while still allowing slicing and dicing. + +This module also gives you some additional power that the builtin +`fs.createWriteStream` do not give you. These features are: + + * Emitting a 'progress' event on write. + * Ability to set a maximum size and emit an error if this size is exceeded. + * Ability to create an `FdSlicer` instance from a `Buffer`. This enables you + to provide API for handling files as well as buffers using the same API. + +## Usage + +```js +var fdSlicer = require('fd-slicer'); +var fs = require('fs'); + +fs.open("file.txt", 'r', function(err, fd) { + if (err) throw err; + var slicer = fdSlicer.createFromFd(fd); + var firstPart = slicer.createReadStream({start: 0, end: 100}); + var secondPart = slicer.createReadStream({start: 100}); + var firstOut = fs.createWriteStream("first.txt"); + var secondOut = fs.createWriteStream("second.txt"); + firstPart.pipe(firstOut); + secondPart.pipe(secondOut); +}); +``` + +You can also create from a buffer: + +```js +var fdSlicer = require('fd-slicer'); +var slicer = FdSlicer.createFromBuffer(someBuffer); +var firstPart = slicer.createReadStream({start: 0, end: 100}); +var secondPart = slicer.createReadStream({start: 100}); +var firstOut = fs.createWriteStream("first.txt"); +var secondOut = fs.createWriteStream("second.txt"); +firstPart.pipe(firstOut); +secondPart.pipe(secondOut); +``` + +## API Documentation + +### fdSlicer.createFromFd(fd, [options]) + +```js +var fdSlicer = require('fd-slicer'); +fs.open("file.txt", 'r', function(err, fd) { + if (err) throw err; + var slicer = fdSlicer.createFromFd(fd); + // ... +}); +``` + +Make sure `fd` is a properly initialized file descriptor. If you want to +use `createReadStream` make sure you open it for reading and if you want +to use `createWriteStream` make sure you open it for writing. + +`options` is an optional object which can contain: + + * `autoClose` - if set to `true`, the file descriptor will be automatically + closed once the last stream that references it is closed. Defaults to + `false`. `ref()` and `unref()` can be used to increase or decrease the + reference count, respectively. + +### fdSlicer.createFromBuffer(buffer) + +```js +var fdSlicer = require('fd-slicer'); +var slicer = fdSlicer.createFromBuffer(someBuffer); +// ... +``` + +#### Properties + +##### fd + +The file descriptor passed in. `undefined` if created from a buffer. + +#### Methods + +##### createReadStream(options) + +Available `options`: + + * `start` - Number. The offset into the file to start reading from. Defaults + to 0. + * `end` - Number. Exclusive upper bound offset into the file to stop reading + from. + * `highWaterMark` - Number. The maximum number of bytes to store in the + internal buffer before ceasing to read from the underlying resource. + Defaults to 16 KB. + * `encoding` - String. If specified, then buffers will be decoded to strings + using the specified encoding. Defaults to `null`. + +The ReadableStream that this returns has these additional methods: + + * `destroy(err)` - stop streaming. `err` is optional and is the error that + will be emitted in order to cause the streaming to stop. Defaults to + `new Error("stream destroyed")`. + +##### createWriteStream(options) + +Available `options`: + + * `start` - Number. The offset into the file to start writing to. Defaults to + 0. + * `end` - Number. Exclusive upper bound offset into the file. If this offset + is reached, the write stream will emit an 'error' event and stop functioning. + In this situation, `err.code === 'ETOOBIG'`. Defaults to `Infinity`. + * `highWaterMark` - Number. Buffer level when `write()` starts returning + false. Defaults to 16KB. + * `decodeStrings` - Boolean. Whether or not to decode strings into Buffers + before passing them to` _write()`. Defaults to `true`. + +The WritableStream that this returns has these additional methods: + + * `destroy()` - stop streaming + +And these additional properties: + + * `bytesWritten` - number of bytes written to the stream + +And these additional events: + + * 'progress' - emitted when `bytesWritten` changes. + +##### read(buffer, offset, length, position, callback) + +Equivalent to `fs.read`, but with concurrency protection. +`callback` must be defined. + +##### write(buffer, offset, length, position, callback) + +Equivalent to `fs.write`, but with concurrency protection. +`callback` must be defined. + +##### ref() + +Increase the `autoClose` reference count by 1. + +##### unref() + +Decrease the `autoClose` reference count by 1. + +#### Events + +##### 'error' + +Emitted if `fs.close` returns an error when auto closing. + +##### 'close' + +Emitted when fd-slicer closes the file descriptor due to `autoClose`. Never +emitted if created from a buffer. diff --git a/appasar/canary/node_modules/fd-slicer/index.js b/appasar/canary/node_modules/fd-slicer/index.js new file mode 100644 index 0000000..140e003 --- /dev/null +++ b/appasar/canary/node_modules/fd-slicer/index.js @@ -0,0 +1,277 @@ +var fs = require('fs'); +var util = require('util'); +var stream = require('stream'); +var Readable = stream.Readable; +var Writable = stream.Writable; +var PassThrough = stream.PassThrough; +var Pend = require('pend'); +var EventEmitter = require('events').EventEmitter; + +exports.createFromBuffer = createFromBuffer; +exports.createFromFd = createFromFd; +exports.BufferSlicer = BufferSlicer; +exports.FdSlicer = FdSlicer; + +util.inherits(FdSlicer, EventEmitter); +function FdSlicer(fd, options) { + options = options || {}; + EventEmitter.call(this); + + this.fd = fd; + this.pend = new Pend(); + this.pend.max = 1; + this.refCount = 0; + this.autoClose = !!options.autoClose; +} + +FdSlicer.prototype.read = function(buffer, offset, length, position, callback) { + var self = this; + self.pend.go(function(cb) { + fs.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) { + cb(); + callback(err, bytesRead, buffer); + }); + }); +}; + +FdSlicer.prototype.write = function(buffer, offset, length, position, callback) { + var self = this; + self.pend.go(function(cb) { + fs.write(self.fd, buffer, offset, length, position, function(err, written, buffer) { + cb(); + callback(err, written, buffer); + }); + }); +}; + +FdSlicer.prototype.createReadStream = function(options) { + return new ReadStream(this, options); +}; + +FdSlicer.prototype.createWriteStream = function(options) { + return new WriteStream(this, options); +}; + +FdSlicer.prototype.ref = function() { + this.refCount += 1; +}; + +FdSlicer.prototype.unref = function() { + var self = this; + self.refCount -= 1; + + if (self.refCount > 0) return; + if (self.refCount < 0) throw new Error("invalid unref"); + + if (self.autoClose) { + fs.close(self.fd, onCloseDone); + } + + function onCloseDone(err) { + if (err) { + self.emit('error', err); + } else { + self.emit('close'); + } + } +}; + +util.inherits(ReadStream, Readable); +function ReadStream(context, options) { + options = options || {}; + Readable.call(this, options); + + this.context = context; + this.context.ref(); + + this.start = options.start || 0; + this.endOffset = options.end; + this.pos = this.start; + this.destroyed = false; +} + +ReadStream.prototype._read = function(n) { + var self = this; + if (self.destroyed) return; + + var toRead = Math.min(self._readableState.highWaterMark, n); + if (self.endOffset != null) { + toRead = Math.min(toRead, self.endOffset - self.pos); + } + if (toRead <= 0) { + self.destroyed = true; + self.push(null); + self.context.unref(); + return; + } + self.context.pend.go(function(cb) { + if (self.destroyed) return cb(); + var buffer = new Buffer(toRead); + fs.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) { + if (err) { + self.destroy(err); + } else if (bytesRead === 0) { + self.destroyed = true; + self.push(null); + self.context.unref(); + } else { + self.pos += bytesRead; + self.push(buffer.slice(0, bytesRead)); + } + cb(); + }); + }); +}; + +ReadStream.prototype.destroy = function(err) { + if (this.destroyed) return; + err = err || new Error("stream destroyed"); + this.destroyed = true; + this.emit('error', err); + this.context.unref(); +}; + +util.inherits(WriteStream, Writable); +function WriteStream(context, options) { + options = options || {}; + Writable.call(this, options); + + this.context = context; + this.context.ref(); + + this.start = options.start || 0; + this.endOffset = (options.end == null) ? Infinity : +options.end; + this.bytesWritten = 0; + this.pos = this.start; + this.destroyed = false; + + this.on('finish', this.destroy.bind(this)); +} + +WriteStream.prototype._write = function(buffer, encoding, callback) { + var self = this; + if (self.destroyed) return; + + if (self.pos + buffer.length > self.endOffset) { + var err = new Error("maximum file length exceeded"); + err.code = 'ETOOBIG'; + self.destroy(); + callback(err); + return; + } + self.context.pend.go(function(cb) { + if (self.destroyed) return cb(); + fs.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) { + if (err) { + self.destroy(); + cb(); + callback(err); + } else { + self.bytesWritten += bytes; + self.pos += bytes; + self.emit('progress'); + cb(); + callback(); + } + }); + }); +}; + +WriteStream.prototype.destroy = function() { + if (this.destroyed) return; + this.destroyed = true; + this.context.unref(); +}; + +util.inherits(BufferSlicer, EventEmitter); +function BufferSlicer(buffer) { + EventEmitter.call(this); + + this.refCount = 0; + this.buffer = buffer; +} + +BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) { + var end = position + length; + var delta = end - this.buffer.length; + var written = (delta > 0) ? delta : length; + this.buffer.copy(buffer, offset, position, end); + setImmediate(function() { + callback(null, written); + }); +}; + +BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) { + buffer.copy(this.buffer, position, offset, offset + length); + setImmediate(function() { + callback(null, length, buffer); + }); +}; + +BufferSlicer.prototype.createReadStream = function(options) { + options = options || {}; + var readStream = new PassThrough(options); + readStream.start = options.start || 0; + readStream.endOffset = options.end; + readStream.pos = readStream.endOffset || this.buffer.length; // yep, we're already done + readStream.destroyed = false; + readStream.write(this.buffer.slice(readStream.start, readStream.pos)); + readStream.end(); + readStream.destroy = function() { + readStream.destroyed = true; + }; + return readStream; +}; + +BufferSlicer.prototype.createWriteStream = function(options) { + var bufferSlicer = this; + options = options || {}; + var writeStream = new Writable(options); + writeStream.start = options.start || 0; + writeStream.endOffset = (options.end == null) ? this.buffer.length : +options.end; + writeStream.bytesWritten = 0; + writeStream.pos = writeStream.start; + writeStream.destroyed = false; + writeStream._write = function(buffer, encoding, callback) { + if (writeStream.destroyed) return; + + var end = writeStream.pos + buffer.length; + if (end > writeStream.endOffset) { + var err = new Error("maximum file length exceeded"); + err.code = 'ETOOBIG'; + writeStream.destroyed = true; + callback(err); + return; + } + buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length); + + writeStream.bytesWritten += buffer.length; + writeStream.pos = end; + writeStream.emit('progress'); + callback(); + }; + writeStream.destroy = function() { + writeStream.destroyed = true; + }; + return writeStream; +}; + +BufferSlicer.prototype.ref = function() { + this.refCount += 1; +}; + +BufferSlicer.prototype.unref = function() { + this.refCount -= 1; + + if (this.refCount < 0) { + throw new Error("invalid unref"); + } +}; + +function createFromBuffer(buffer) { + return new BufferSlicer(buffer); +} + +function createFromFd(fd, options) { + return new FdSlicer(fd, options); +} diff --git a/appasar/canary/node_modules/fd-slicer/package.json b/appasar/canary/node_modules/fd-slicer/package.json new file mode 100644 index 0000000..ca5c9c0 --- /dev/null +++ b/appasar/canary/node_modules/fd-slicer/package.json @@ -0,0 +1,36 @@ +{ + "name": "fd-slicer", + "version": "1.0.1", + "description": "safely create multiple ReadStream or WriteStream objects from the same file descriptor", + "main": "index.js", + "scripts": { + "test": "mocha --reporter spec --check-leaks", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/test.js", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --timeout 10000 --reporter spec --check-leaks test/test.js" + }, + "author": "Andrew Kelley <superjoe30@gmail.com>", + "license": "MIT", + "devDependencies": { + "istanbul": "~0.3.3", + "mocha": "~2.0.1", + "stream-equal": "~0.1.5", + "streamsink": "~1.2.0" + }, + "dependencies": { + "pend": "~1.2.0" + }, + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "git://github.com/andrewrk/node-fd-slicer.git" + }, + "bugs": { + "url": "https://github.com/andrewrk/node-fd-slicer/issues" + }, + "keywords": [ + "createReadStream", + "createWriteStream" + ] +} diff --git a/appasar/canary/node_modules/fd-slicer/test/test.js b/appasar/canary/node_modules/fd-slicer/test/test.js new file mode 100644 index 0000000..d05ab00 --- /dev/null +++ b/appasar/canary/node_modules/fd-slicer/test/test.js @@ -0,0 +1,350 @@ +var fdSlicer = require('../'); +var fs = require('fs'); +var crypto = require('crypto'); +var path = require('path'); +var streamEqual = require('stream-equal'); +var assert = require('assert'); +var Pend = require('pend'); +var StreamSink = require('streamsink'); + +var describe = global.describe; +var it = global.it; +var before = global.before; +var beforeEach = global.beforeEach; +var after = global.after; + +var testBlobFile = path.join(__dirname, "test-blob.bin"); +var testBlobFileSize = 20 * 1024 * 1024; +var testOutBlobFile = path.join(__dirname, "test-blob-out.bin"); + +describe("FdSlicer", function() { + before(function(done) { + var out = fs.createWriteStream(testBlobFile); + for (var i = 0; i < testBlobFileSize / 1024; i += 1) { + out.write(crypto.pseudoRandomBytes(1024)); + } + out.end(); + out.on('close', done); + }); + beforeEach(function() { + try { + fs.unlinkSync(testOutBlobFile); + } catch (err) { + } + }); + after(function() { + try { + fs.unlinkSync(testBlobFile); + fs.unlinkSync(testOutBlobFile); + } catch (err) { + } + }); + it("reads a 20MB file (autoClose on)", function(done) { + fs.open(testBlobFile, 'r', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + var actualStream = slicer.createReadStream(); + var expectedStream = fs.createReadStream(testBlobFile); + + var pend = new Pend(); + pend.go(function(cb) { + slicer.on('close', cb); + }); + pend.go(function(cb) { + streamEqual(expectedStream, actualStream, function(err, equal) { + if (err) return done(err); + assert.ok(equal); + cb(); + }); + }); + pend.wait(done); + }); + }); + it("reads 4 chunks simultaneously", function(done) { + fs.open(testBlobFile, 'r', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd); + var actualPart1 = slicer.createReadStream({start: testBlobFileSize * 0/4, end: testBlobFileSize * 1/4}); + var actualPart2 = slicer.createReadStream({start: testBlobFileSize * 1/4, end: testBlobFileSize * 2/4}); + var actualPart3 = slicer.createReadStream({start: testBlobFileSize * 2/4, end: testBlobFileSize * 3/4}); + var actualPart4 = slicer.createReadStream({start: testBlobFileSize * 3/4, end: testBlobFileSize * 4/4}); + var expectedPart1 = slicer.createReadStream({start: testBlobFileSize * 0/4, end: testBlobFileSize * 1/4}); + var expectedPart2 = slicer.createReadStream({start: testBlobFileSize * 1/4, end: testBlobFileSize * 2/4}); + var expectedPart3 = slicer.createReadStream({start: testBlobFileSize * 2/4, end: testBlobFileSize * 3/4}); + var expectedPart4 = slicer.createReadStream({start: testBlobFileSize * 3/4, end: testBlobFileSize * 4/4}); + var pend = new Pend(); + pend.go(function(cb) { + streamEqual(expectedPart1, actualPart1, function(err, equal) { + assert.ok(equal); + cb(err); + }); + }); + pend.go(function(cb) { + streamEqual(expectedPart2, actualPart2, function(err, equal) { + assert.ok(equal); + cb(err); + }); + }); + pend.go(function(cb) { + streamEqual(expectedPart3, actualPart3, function(err, equal) { + assert.ok(equal); + cb(err); + }); + }); + pend.go(function(cb) { + streamEqual(expectedPart4, actualPart4, function(err, equal) { + assert.ok(equal); + cb(err); + }); + }); + pend.wait(function(err) { + if (err) return done(err); + fs.close(fd, done); + }); + }); + }); + + it("writes a 20MB file (autoClose on)", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + var actualStream = slicer.createWriteStream(); + var inStream = fs.createReadStream(testBlobFile); + + slicer.on('close', function() { + var expected = fs.createReadStream(testBlobFile); + var actual = fs.createReadStream(testOutBlobFile); + + streamEqual(expected, actual, function(err, equal) { + if (err) return done(err); + assert.ok(equal); + done(); + }); + }); + inStream.pipe(actualStream); + }); + }); + + it("writes 4 chunks simultaneously", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd); + var actualPart1 = slicer.createWriteStream({start: testBlobFileSize * 0/4}); + var actualPart2 = slicer.createWriteStream({start: testBlobFileSize * 1/4}); + var actualPart3 = slicer.createWriteStream({start: testBlobFileSize * 2/4}); + var actualPart4 = slicer.createWriteStream({start: testBlobFileSize * 3/4}); + var in1 = fs.createReadStream(testBlobFile, {start: testBlobFileSize * 0/4, end: testBlobFileSize * 1/4}); + var in2 = fs.createReadStream(testBlobFile, {start: testBlobFileSize * 1/4, end: testBlobFileSize * 2/4}); + var in3 = fs.createReadStream(testBlobFile, {start: testBlobFileSize * 2/4, end: testBlobFileSize * 3/4}); + var in4 = fs.createReadStream(testBlobFile, {start: testBlobFileSize * 3/4, end: testBlobFileSize * 4/4}); + var pend = new Pend(); + pend.go(function(cb) { + actualPart1.on('finish', cb); + }); + pend.go(function(cb) { + actualPart2.on('finish', cb); + }); + pend.go(function(cb) { + actualPart3.on('finish', cb); + }); + pend.go(function(cb) { + actualPart4.on('finish', cb); + }); + in1.pipe(actualPart1); + in2.pipe(actualPart2); + in3.pipe(actualPart3); + in4.pipe(actualPart4); + pend.wait(function() { + fs.close(fd, function(err) { + if (err) return done(err); + var expected = fs.createReadStream(testBlobFile); + var actual = fs.createReadStream(testOutBlobFile); + streamEqual(expected, actual, function(err, equal) { + if (err) return done(err); + assert.ok(equal); + done(); + }); + }); + }); + }); + }); + + it("throws on invalid ref", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + assert.throws(function() { + slicer.unref(); + }, /invalid unref/); + fs.close(fd, done); + }); + }); + + it("write stream emits error when max size exceeded", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + var ws = slicer.createWriteStream({start: 0, end: 1000}); + ws.on('error', function(err) { + assert.strictEqual(err.code, 'ETOOBIG'); + slicer.on('close', done); + }); + ws.end(new Buffer(1001)); + }); + }); + + it("write stream does not emit error when max size not exceeded", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + var ws = slicer.createWriteStream({end: 1000}); + slicer.on('close', done); + ws.end(new Buffer(1000)); + }); + }); + + it("write stream start and end work together", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + var ws = slicer.createWriteStream({start: 1, end: 1000}); + ws.on('error', function(err) { + assert.strictEqual(err.code, 'ETOOBIG'); + slicer.on('close', done); + }); + ws.end(new Buffer(1000)); + }); + }); + + it("write stream emits progress events", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + var ws = slicer.createWriteStream(); + var progressEventCount = 0; + var prevBytesWritten = 0; + ws.on('progress', function() { + progressEventCount += 1; + assert.ok(ws.bytesWritten > prevBytesWritten); + prevBytesWritten = ws.bytesWritten; + }); + slicer.on('close', function() { + assert.ok(progressEventCount > 5); + done(); + }); + for (var i = 0; i < 10; i += 1) { + ws.write(new Buffer(16 * 1024 * 2)); + } + ws.end(); + }); + }); + + it("write stream unrefs when destroyed", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + var ws = slicer.createWriteStream(); + slicer.on('close', done); + ws.write(new Buffer(1000)); + ws.destroy(); + }); + }); + + it("read stream unrefs when destroyed", function(done) { + fs.open(testBlobFile, 'r', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd, {autoClose: true}); + var rs = slicer.createReadStream(); + rs.on('error', function(err) { + assert.strictEqual(err.message, "stream destroyed"); + slicer.on('close', done); + }); + rs.destroy(); + }); + }); + + it("fdSlicer.read", function(done) { + fs.open(testBlobFile, 'r', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd); + var outBuf = new Buffer(1024); + slicer.read(outBuf, 0, 10, 0, function(err, bytesRead, buf) { + assert.strictEqual(bytesRead, 10); + fs.close(fd, done); + }); + }); + }); + + it("fdSlicer.write", function(done) { + fs.open(testOutBlobFile, 'w', function(err, fd) { + if (err) return done(err); + var slicer = fdSlicer.createFromFd(fd); + slicer.write(new Buffer("blah\n"), 0, 5, 0, function() { + if (err) return done(err); + fs.close(fd, done); + }); + }); + }); +}); + +describe("BufferSlicer", function() { + it("invalid ref", function() { + var slicer = fdSlicer.createFromBuffer(new Buffer(16)); + slicer.ref(); + slicer.unref(); + assert.throws(function() { + slicer.unref(); + }, /invalid unref/); + }); + it("read and write", function(done) { + var buf = new Buffer("through the tangled thread the needle finds its way"); + var slicer = fdSlicer.createFromBuffer(buf); + var outBuf = new Buffer(1024); + slicer.read(outBuf, 10, 11, 8, function(err) { + if (err) return done(err); + assert.strictEqual(outBuf.toString('utf8', 10, 21), "the tangled"); + slicer.write(new Buffer("derp"), 0, 4, 7, function(err) { + if (err) return done(err); + assert.strictEqual(buf.toString('utf8', 7, 19), "derp tangled"); + done(); + }); + }); + }); + it("createReadStream", function(done) { + var str = "I never conquered rarely came, 16 just held such better days"; + var buf = new Buffer(str); + var slicer = fdSlicer.createFromBuffer(buf); + var inStream = slicer.createReadStream(); + var sink = new StreamSink(); + inStream.pipe(sink); + sink.on('finish', function() { + assert.strictEqual(sink.toString(), str); + inStream.destroy(); + done(); + }); + }); + it("createWriteStream exceed buffer size", function(done) { + var slicer = fdSlicer.createFromBuffer(new Buffer(4)); + var outStream = slicer.createWriteStream(); + outStream.on('error', function(err) { + assert.strictEqual(err.code, 'ETOOBIG'); + done(); + }); + outStream.write("hi!\n"); + outStream.write("it warked\n"); + outStream.end(); + }); + it("createWriteStream ok", function(done) { + var buf = new Buffer(1024); + var slicer = fdSlicer.createFromBuffer(buf); + var outStream = slicer.createWriteStream(); + outStream.on('finish', function() { + assert.strictEqual(buf.toString('utf8', 0, "hi!\nit warked\n".length), "hi!\nit warked\n"); + outStream.destroy(); + done(); + }); + outStream.write("hi!\n"); + outStream.write("it warked\n"); + outStream.end(); + }); +}); diff --git a/appasar/canary/node_modules/forever-agent/LICENSE b/appasar/canary/node_modules/forever-agent/LICENSE new file mode 100644 index 0000000..a4a9aee --- /dev/null +++ b/appasar/canary/node_modules/forever-agent/LICENSE @@ -0,0 +1,55 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/appasar/canary/node_modules/forever-agent/README.md b/appasar/canary/node_modules/forever-agent/README.md new file mode 100644 index 0000000..9d5b663 --- /dev/null +++ b/appasar/canary/node_modules/forever-agent/README.md @@ -0,0 +1,4 @@ +forever-agent +============= + +HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module. diff --git a/appasar/canary/node_modules/forever-agent/index.js b/appasar/canary/node_modules/forever-agent/index.js new file mode 100644 index 0000000..416c7ab --- /dev/null +++ b/appasar/canary/node_modules/forever-agent/index.js @@ -0,0 +1,138 @@ +module.exports = ForeverAgent +ForeverAgent.SSL = ForeverAgentSSL + +var util = require('util') + , Agent = require('http').Agent + , net = require('net') + , tls = require('tls') + , AgentSSL = require('https').Agent + +function getConnectionName(host, port) { + var name = '' + if (typeof host === 'string') { + name = host + ':' + port + } else { + // For node.js v012.0 and iojs-v1.5.1, host is an object. And any existing localAddress is part of the connection name. + name = host.host + ':' + host.port + ':' + (host.localAddress ? (host.localAddress + ':') : ':') + } + return name +} + +function ForeverAgent(options) { + var self = this + self.options = options || {} + self.requests = {} + self.sockets = {} + self.freeSockets = {} + self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets + self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets + self.on('free', function(socket, host, port) { + var name = getConnectionName(host, port) + + if (self.requests[name] && self.requests[name].length) { + self.requests[name].shift().onSocket(socket) + } else if (self.sockets[name].length < self.minSockets) { + if (!self.freeSockets[name]) self.freeSockets[name] = [] + self.freeSockets[name].push(socket) + + // if an error happens while we don't use the socket anyway, meh, throw the socket away + var onIdleError = function() { + socket.destroy() + } + socket._onIdleError = onIdleError + socket.on('error', onIdleError) + } else { + // If there are no pending requests just destroy the + // socket and it will get removed from the pool. This + // gets us out of timeout issues and allows us to + // default to Connection:keep-alive. + socket.destroy() + } + }) + +} +util.inherits(ForeverAgent, Agent) + +ForeverAgent.defaultMinSockets = 5 + + +ForeverAgent.prototype.createConnection = net.createConnection +ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest +ForeverAgent.prototype.addRequest = function(req, host, port) { + var name = getConnectionName(host, port) + + if (typeof host !== 'string') { + var options = host + port = options.port + host = options.host + } + + if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { + var idleSocket = this.freeSockets[name].pop() + idleSocket.removeListener('error', idleSocket._onIdleError) + delete idleSocket._onIdleError + req._reusedSocket = true + req.onSocket(idleSocket) + } else { + this.addRequestNoreuse(req, host, port) + } +} + +ForeverAgent.prototype.removeSocket = function(s, name, host, port) { + if (this.sockets[name]) { + var index = this.sockets[name].indexOf(s) + if (index !== -1) { + this.sockets[name].splice(index, 1) + } + } else if (this.sockets[name] && this.sockets[name].length === 0) { + // don't leak + delete this.sockets[name] + delete this.requests[name] + } + + if (this.freeSockets[name]) { + var index = this.freeSockets[name].indexOf(s) + if (index !== -1) { + this.freeSockets[name].splice(index, 1) + if (this.freeSockets[name].length === 0) { + delete this.freeSockets[name] + } + } + } + + if (this.requests[name] && this.requests[name].length) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(name, host, port).emit('free') + } +} + +function ForeverAgentSSL (options) { + ForeverAgent.call(this, options) +} +util.inherits(ForeverAgentSSL, ForeverAgent) + +ForeverAgentSSL.prototype.createConnection = createConnectionSSL +ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest + +function createConnectionSSL (port, host, options) { + if (typeof port === 'object') { + options = port; + } else if (typeof host === 'object') { + options = host; + } else if (typeof options === 'object') { + options = options; + } else { + options = {}; + } + + if (typeof port === 'number') { + options.port = port; + } + + if (typeof host === 'string') { + options.host = host; + } + + return tls.connect(options); +} diff --git a/appasar/canary/node_modules/forever-agent/package.json b/appasar/canary/node_modules/forever-agent/package.json new file mode 100644 index 0000000..f760629 --- /dev/null +++ b/appasar/canary/node_modules/forever-agent/package.json @@ -0,0 +1,17 @@ +{ + "author": "Mikeal Rogers <mikeal.rogers@gmail.com> (http://www.futurealoof.com)", + "name": "forever-agent", + "description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.", + "version": "0.6.1", + "license": "Apache-2.0", + "repository": { + "url": "https://github.com/mikeal/forever-agent" + }, + "main": "index.js", + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + } +} diff --git a/appasar/canary/node_modules/form-data/License b/appasar/canary/node_modules/form-data/License new file mode 100644 index 0000000..c7ff12a --- /dev/null +++ b/appasar/canary/node_modules/form-data/License @@ -0,0 +1,19 @@ +Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/appasar/canary/node_modules/form-data/README.md b/appasar/canary/node_modules/form-data/README.md new file mode 100644 index 0000000..cb421fb --- /dev/null +++ b/appasar/canary/node_modules/form-data/README.md @@ -0,0 +1,234 @@ +# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) + +A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. + +The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. + +[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface + +[![Linux Build](https://img.shields.io/travis/form-data/form-data/v2.3.2.svg?label=linux:4.x-9.x)](https://travis-ci.org/form-data/form-data) +[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v2.3.2.svg?label=macos:4.x-9.x)](https://travis-ci.org/form-data/form-data) +[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/v2.3.2.svg?label=windows:4.x-9.x)](https://ci.appveyor.com/project/alexindigo/form-data) + +[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v2.3.2.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) +[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) +[![bitHound Overall Score](https://www.bithound.io/github/form-data/form-data/badges/score.svg)](https://www.bithound.io/github/form-data/form-data) + +## Install + +``` +npm install --save form-data +``` + +## Usage + +In this example we are constructing a form with 3 fields that contain a string, +a buffer and a file stream. + +``` javascript +var FormData = require('form-data'); +var fs = require('fs'); + +var form = new FormData(); +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_file', fs.createReadStream('/foo/bar.jpg')); +``` + +Also you can use http-response stream: + +``` javascript +var FormData = require('form-data'); +var http = require('http'); + +var form = new FormData(); + +http.request('http://nodejs.org/images/logo.png', function(response) { + form.append('my_field', 'my value'); + form.append('my_buffer', new Buffer(10)); + form.append('my_logo', response); +}); +``` + +Or @mikeal's [request](https://github.com/request/request) stream: + +``` javascript +var FormData = require('form-data'); +var request = require('request'); + +var form = new FormData(); + +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_logo', request('http://nodejs.org/images/logo.png')); +``` + +In order to submit this form to a web application, call ```submit(url, [callback])``` method: + +``` javascript +form.submit('http://example.org/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +}); + +``` + +For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. + +### Custom options + +You can provide custom options, such as `maxDataSize`: + +``` javascript +var FormData = require('form-data'); + +var form = new FormData({ maxDataSize: 20971520 }); +form.append('my_field', 'my value'); +form.append('my_buffer', /* something big */); +``` + +List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15) + +### Alternative submission methods + +You can use node's http client interface: + +``` javascript +var http = require('http'); + +var request = http.request({ + method: 'post', + host: 'example.org', + path: '/upload', + headers: form.getHeaders() +}); + +form.pipe(request); + +request.on('response', function(res) { + console.log(res.statusCode); +}); +``` + +Or if you would prefer the `'Content-Length'` header to be set for you: + +``` javascript +form.submit('example.org/upload', function(err, res) { + console.log(res.statusCode); +}); +``` + +To use custom headers and pre-known length in parts: + +``` javascript +var CRLF = '\r\n'; +var form = new FormData(); + +var options = { + header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, + knownLength: 1 +}; + +form.append('my_buffer', buffer, options); + +form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); +}); +``` + +Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: + +``` javascript +someModule.stream(function(err, stdout, stderr) { + if (err) throw err; + + var form = new FormData(); + + form.append('file', stdout, { + filename: 'unicycle.jpg', // ... or: + filepath: 'photos/toys/unicycle.jpg', + contentType: 'image/jpeg', + knownLength: 19806 + }); + + form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); + }); +}); +``` + +The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory). + +For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: + +``` javascript +form.submit({ + host: 'example.com', + path: '/probably.php?extra=params', + auth: 'username:password' +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: + +``` javascript +form.submit({ + host: 'example.com', + path: '/surelynot.php', + headers: {'x-test-header': 'test-header-value'} +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +### Integration with other libraries + +#### Request + +Form submission using [request](https://github.com/request/request): + +```javascript +var formData = { + my_field: 'my_value', + my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), +}; + +request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { + if (err) { + return console.error('upload failed:', err); + } + console.log('Upload successful! Server responded with:', body); +}); +``` + +For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). + +#### node-fetch + +You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): + +```javascript +var form = new FormData(); + +form.append('a', 1); + +fetch('http://example.com', { method: 'POST', body: form }) + .then(function(res) { + return res.json(); + }).then(function(json) { + console.log(json); + }); +``` + +## Notes + +- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. +- Starting version `2.x` FormData has dropped support for `node@0.10.x`. + +## License + +Form-Data is released under the [MIT](License) license. diff --git a/appasar/canary/node_modules/form-data/README.md.bak b/appasar/canary/node_modules/form-data/README.md.bak new file mode 100644 index 0000000..0524d60 --- /dev/null +++ b/appasar/canary/node_modules/form-data/README.md.bak @@ -0,0 +1,234 @@ +# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) + +A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. + +The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. + +[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface + +[![Linux Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=linux:4.x-9.x)](https://travis-ci.org/form-data/form-data) +[![MacOS Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=macos:4.x-9.x)](https://travis-ci.org/form-data/form-data) +[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/master.svg?label=windows:4.x-9.x)](https://ci.appveyor.com/project/alexindigo/form-data) + +[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/master.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) +[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) +[![bitHound Overall Score](https://www.bithound.io/github/form-data/form-data/badges/score.svg)](https://www.bithound.io/github/form-data/form-data) + +## Install + +``` +npm install --save form-data +``` + +## Usage + +In this example we are constructing a form with 3 fields that contain a string, +a buffer and a file stream. + +``` javascript +var FormData = require('form-data'); +var fs = require('fs'); + +var form = new FormData(); +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_file', fs.createReadStream('/foo/bar.jpg')); +``` + +Also you can use http-response stream: + +``` javascript +var FormData = require('form-data'); +var http = require('http'); + +var form = new FormData(); + +http.request('http://nodejs.org/images/logo.png', function(response) { + form.append('my_field', 'my value'); + form.append('my_buffer', new Buffer(10)); + form.append('my_logo', response); +}); +``` + +Or @mikeal's [request](https://github.com/request/request) stream: + +``` javascript +var FormData = require('form-data'); +var request = require('request'); + +var form = new FormData(); + +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_logo', request('http://nodejs.org/images/logo.png')); +``` + +In order to submit this form to a web application, call ```submit(url, [callback])``` method: + +``` javascript +form.submit('http://example.org/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +}); + +``` + +For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. + +### Custom options + +You can provide custom options, such as `maxDataSize`: + +``` javascript +var FormData = require('form-data'); + +var form = new FormData({ maxDataSize: 20971520 }); +form.append('my_field', 'my value'); +form.append('my_buffer', /* something big */); +``` + +List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15) + +### Alternative submission methods + +You can use node's http client interface: + +``` javascript +var http = require('http'); + +var request = http.request({ + method: 'post', + host: 'example.org', + path: '/upload', + headers: form.getHeaders() +}); + +form.pipe(request); + +request.on('response', function(res) { + console.log(res.statusCode); +}); +``` + +Or if you would prefer the `'Content-Length'` header to be set for you: + +``` javascript +form.submit('example.org/upload', function(err, res) { + console.log(res.statusCode); +}); +``` + +To use custom headers and pre-known length in parts: + +``` javascript +var CRLF = '\r\n'; +var form = new FormData(); + +var options = { + header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, + knownLength: 1 +}; + +form.append('my_buffer', buffer, options); + +form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); +}); +``` + +Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: + +``` javascript +someModule.stream(function(err, stdout, stderr) { + if (err) throw err; + + var form = new FormData(); + + form.append('file', stdout, { + filename: 'unicycle.jpg', // ... or: + filepath: 'photos/toys/unicycle.jpg', + contentType: 'image/jpeg', + knownLength: 19806 + }); + + form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); + }); +}); +``` + +The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory). + +For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: + +``` javascript +form.submit({ + host: 'example.com', + path: '/probably.php?extra=params', + auth: 'username:password' +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: + +``` javascript +form.submit({ + host: 'example.com', + path: '/surelynot.php', + headers: {'x-test-header': 'test-header-value'} +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +### Integration with other libraries + +#### Request + +Form submission using [request](https://github.com/request/request): + +```javascript +var formData = { + my_field: 'my_value', + my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), +}; + +request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { + if (err) { + return console.error('upload failed:', err); + } + console.log('Upload successful! Server responded with:', body); +}); +``` + +For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). + +#### node-fetch + +You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): + +```javascript +var form = new FormData(); + +form.append('a', 1); + +fetch('http://example.com', { method: 'POST', body: form }) + .then(function(res) { + return res.json(); + }).then(function(json) { + console.log(json); + }); +``` + +## Notes + +- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. +- Starting version `2.x` FormData has dropped support for `node@0.10.x`. + +## License + +Form-Data is released under the [MIT](License) license. diff --git a/appasar/canary/node_modules/form-data/lib/browser.js b/appasar/canary/node_modules/form-data/lib/browser.js new file mode 100644 index 0000000..09e7c70 --- /dev/null +++ b/appasar/canary/node_modules/form-data/lib/browser.js @@ -0,0 +1,2 @@ +/* eslint-env browser */ +module.exports = typeof self == 'object' ? self.FormData : window.FormData; diff --git a/appasar/canary/node_modules/form-data/lib/form_data.js b/appasar/canary/node_modules/form-data/lib/form_data.js new file mode 100644 index 0000000..3a1bb82 --- /dev/null +++ b/appasar/canary/node_modules/form-data/lib/form_data.js @@ -0,0 +1,457 @@ +var CombinedStream = require('combined-stream'); +var util = require('util'); +var path = require('path'); +var http = require('http'); +var https = require('https'); +var parseUrl = require('url').parse; +var fs = require('fs'); +var mime = require('mime-types'); +var asynckit = require('asynckit'); +var populate = require('./populate.js'); + +// Public API +module.exports = FormData; + +// make it a Stream +util.inherits(FormData, CombinedStream); + +/** + * Create readable "multipart/form-data" streams. + * Can be used to submit forms + * and file uploads to other web applications. + * + * @constructor + * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream + */ +function FormData(options) { + if (!(this instanceof FormData)) { + return new FormData(); + } + + this._overheadLength = 0; + this._valueLength = 0; + this._valuesToMeasure = []; + + CombinedStream.call(this); + + options = options || {}; + for (var option in options) { + this[option] = options[option]; + } +} + +FormData.LINE_BREAK = '\r\n'; +FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream'; + +FormData.prototype.append = function(field, value, options) { + + options = options || {}; + + // allow filename as single option + if (typeof options == 'string') { + options = {filename: options}; + } + + var append = CombinedStream.prototype.append.bind(this); + + // all that streamy business can't handle numbers + if (typeof value == 'number') { + value = '' + value; + } + + // https://github.com/felixge/node-form-data/issues/38 + if (util.isArray(value)) { + // Please convert your array into string + // the way web server expects it + this._error(new Error('Arrays are not supported.')); + return; + } + + var header = this._multiPartHeader(field, value, options); + var footer = this._multiPartFooter(); + + append(header); + append(value); + append(footer); + + // pass along options.knownLength + this._trackLength(header, value, options); +}; + +FormData.prototype._trackLength = function(header, value, options) { + var valueLength = 0; + + // used w/ getLengthSync(), when length is known. + // e.g. for streaming directly from a remote server, + // w/ a known file a size, and not wanting to wait for + // incoming file to finish to get its size. + if (options.knownLength != null) { + valueLength += +options.knownLength; + } else if (Buffer.isBuffer(value)) { + valueLength = value.length; + } else if (typeof value === 'string') { + valueLength = Buffer.byteLength(value); + } + + this._valueLength += valueLength; + + // @check why add CRLF? does this account for custom/multiple CRLFs? + this._overheadLength += + Buffer.byteLength(header) + + FormData.LINE_BREAK.length; + + // empty or either doesn't have path or not an http response + if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) { + return; + } + + // no need to bother with the length + if (!options.knownLength) { + this._valuesToMeasure.push(value); + } +}; + +FormData.prototype._lengthRetriever = function(value, callback) { + + if (value.hasOwnProperty('fd')) { + + // take read range into a account + // `end` = Infinity –> read file till the end + // + // TODO: Looks like there is bug in Node fs.createReadStream + // it doesn't respect `end` options without `start` options + // Fix it when node fixes it. + // https://github.com/joyent/node/issues/7819 + if (value.end != undefined && value.end != Infinity && value.start != undefined) { + + // when end specified + // no need to calculate range + // inclusive, starts with 0 + callback(null, value.end + 1 - (value.start ? value.start : 0)); + + // not that fast snoopy + } else { + // still need to fetch file size from fs + fs.stat(value.path, function(err, stat) { + + var fileSize; + + if (err) { + callback(err); + return; + } + + // update final size based on the range options + fileSize = stat.size - (value.start ? value.start : 0); + callback(null, fileSize); + }); + } + + // or http response + } else if (value.hasOwnProperty('httpVersion')) { + callback(null, +value.headers['content-length']); + + // or request stream http://github.com/mikeal/request + } else if (value.hasOwnProperty('httpModule')) { + // wait till response come back + value.on('response', function(response) { + value.pause(); + callback(null, +response.headers['content-length']); + }); + value.resume(); + + // something else + } else { + callback('Unknown stream'); + } +}; + +FormData.prototype._multiPartHeader = function(field, value, options) { + // custom header specified (as string)? + // it becomes responsible for boundary + // (e.g. to handle extra CRLFs on .NET servers) + if (typeof options.header == 'string') { + return options.header; + } + + var contentDisposition = this._getContentDisposition(value, options); + var contentType = this._getContentType(value, options); + + var contents = ''; + var headers = { + // add custom disposition as third element or keep it two elements if not + 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []), + // if no content type. allow it to be empty array + 'Content-Type': [].concat(contentType || []) + }; + + // allow custom headers. + if (typeof options.header == 'object') { + populate(headers, options.header); + } + + var header; + for (var prop in headers) { + if (!headers.hasOwnProperty(prop)) continue; + header = headers[prop]; + + // skip nullish headers. + if (header == null) { + continue; + } + + // convert all headers to arrays. + if (!Array.isArray(header)) { + header = [header]; + } + + // add non-empty headers. + if (header.length) { + contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK; + } + } + + return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; +}; + +FormData.prototype._getContentDisposition = function(value, options) { + + var filename + , contentDisposition + ; + + if (typeof options.filepath === 'string') { + // custom filepath for relative paths + filename = path.normalize(options.filepath).replace(/\\/g, '/'); + } else if (options.filename || value.name || value.path) { + // custom filename take precedence + // formidable and the browser add a name property + // fs- and request- streams have path property + filename = path.basename(options.filename || value.name || value.path); + } else if (value.readable && value.hasOwnProperty('httpVersion')) { + // or try http response + filename = path.basename(value.client._httpMessage.path); + } + + if (filename) { + contentDisposition = 'filename="' + filename + '"'; + } + + return contentDisposition; +}; + +FormData.prototype._getContentType = function(value, options) { + + // use custom content-type above all + var contentType = options.contentType; + + // or try `name` from formidable, browser + if (!contentType && value.name) { + contentType = mime.lookup(value.name); + } + + // or try `path` from fs-, request- streams + if (!contentType && value.path) { + contentType = mime.lookup(value.path); + } + + // or if it's http-reponse + if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) { + contentType = value.headers['content-type']; + } + + // or guess it from the filepath or filename + if (!contentType && (options.filepath || options.filename)) { + contentType = mime.lookup(options.filepath || options.filename); + } + + // fallback to the default content type if `value` is not simple value + if (!contentType && typeof value == 'object') { + contentType = FormData.DEFAULT_CONTENT_TYPE; + } + + return contentType; +}; + +FormData.prototype._multiPartFooter = function() { + return function(next) { + var footer = FormData.LINE_BREAK; + + var lastPart = (this._streams.length === 0); + if (lastPart) { + footer += this._lastBoundary(); + } + + next(footer); + }.bind(this); +}; + +FormData.prototype._lastBoundary = function() { + return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK; +}; + +FormData.prototype.getHeaders = function(userHeaders) { + var header; + var formHeaders = { + 'content-type': 'multipart/form-data; boundary=' + this.getBoundary() + }; + + for (header in userHeaders) { + if (userHeaders.hasOwnProperty(header)) { + formHeaders[header.toLowerCase()] = userHeaders[header]; + } + } + + return formHeaders; +}; + +FormData.prototype.getBoundary = function() { + if (!this._boundary) { + this._generateBoundary(); + } + + return this._boundary; +}; + +FormData.prototype._generateBoundary = function() { + // This generates a 50 character boundary similar to those used by Firefox. + // They are optimized for boyer-moore parsing. + var boundary = '--------------------------'; + for (var i = 0; i < 24; i++) { + boundary += Math.floor(Math.random() * 10).toString(16); + } + + this._boundary = boundary; +}; + +// Note: getLengthSync DOESN'T calculate streams length +// As workaround one can calculate file size manually +// and add it as knownLength option +FormData.prototype.getLengthSync = function() { + var knownLength = this._overheadLength + this._valueLength; + + // Don't get confused, there are 3 "internal" streams for each keyval pair + // so it basically checks if there is any value added to the form + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + + // https://github.com/form-data/form-data/issues/40 + if (!this.hasKnownLength()) { + // Some async length retrievers are present + // therefore synchronous length calculation is false. + // Please use getLength(callback) to get proper length + this._error(new Error('Cannot calculate proper length in synchronous way.')); + } + + return knownLength; +}; + +// Public API to check if length of added values is known +// https://github.com/form-data/form-data/issues/196 +// https://github.com/form-data/form-data/issues/262 +FormData.prototype.hasKnownLength = function() { + var hasKnownLength = true; + + if (this._valuesToMeasure.length) { + hasKnownLength = false; + } + + return hasKnownLength; +}; + +FormData.prototype.getLength = function(cb) { + var knownLength = this._overheadLength + this._valueLength; + + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + + if (!this._valuesToMeasure.length) { + process.nextTick(cb.bind(this, null, knownLength)); + return; + } + + asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { + if (err) { + cb(err); + return; + } + + values.forEach(function(length) { + knownLength += length; + }); + + cb(null, knownLength); + }); +}; + +FormData.prototype.submit = function(params, cb) { + var request + , options + , defaults = {method: 'post'} + ; + + // parse provided url if it's string + // or treat it as options object + if (typeof params == 'string') { + + params = parseUrl(params); + options = populate({ + port: params.port, + path: params.pathname, + host: params.hostname, + protocol: params.protocol + }, defaults); + + // use custom params + } else { + + options = populate(params, defaults); + // if no port provided use default one + if (!options.port) { + options.port = options.protocol == 'https:' ? 443 : 80; + } + } + + // put that good code in getHeaders to some use + options.headers = this.getHeaders(params.headers); + + // https if specified, fallback to http in any other case + if (options.protocol == 'https:') { + request = https.request(options); + } else { + request = http.request(options); + } + + // get content length and fire away + this.getLength(function(err, length) { + if (err) { + this._error(err); + return; + } + + // add content length + request.setHeader('Content-Length', length); + + this.pipe(request); + if (cb) { + request.on('error', cb); + request.on('response', cb.bind(this, null)); + } + }.bind(this)); + + return request; +}; + +FormData.prototype._error = function(err) { + if (!this.error) { + this.error = err; + this.pause(); + this.emit('error', err); + } +}; + +FormData.prototype.toString = function () { + return '[object FormData]'; +}; diff --git a/appasar/canary/node_modules/form-data/lib/populate.js b/appasar/canary/node_modules/form-data/lib/populate.js new file mode 100644 index 0000000..4d35738 --- /dev/null +++ b/appasar/canary/node_modules/form-data/lib/populate.js @@ -0,0 +1,10 @@ +// populates missing values +module.exports = function(dst, src) { + + Object.keys(src).forEach(function(prop) + { + dst[prop] = dst[prop] || src[prop]; + }); + + return dst; +}; diff --git a/appasar/canary/node_modules/form-data/node_modules/combined-stream/License b/appasar/canary/node_modules/form-data/node_modules/combined-stream/License new file mode 100644 index 0000000..4804b7a --- /dev/null +++ b/appasar/canary/node_modules/form-data/node_modules/combined-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited <felix@debuggable.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/appasar/canary/node_modules/form-data/node_modules/combined-stream/Readme.md b/appasar/canary/node_modules/form-data/node_modules/combined-stream/Readme.md new file mode 100644 index 0000000..9e367b5 --- /dev/null +++ b/appasar/canary/node_modules/form-data/node_modules/combined-stream/Readme.md @@ -0,0 +1,138 @@ +# combined-stream + +A stream that emits multiple other streams one after another. + +**NB** Currently `combined-stream` works with streams version 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatibility with `combined-stream`. + +- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module. + +- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another. + +## Installation + +``` bash +npm install combined-stream +``` + +## Usage + +Here is a simple example that shows how you can use combined-stream to combine +two files into one: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +While the example above works great, it will pause all source streams until +they are needed. If you don't want that to happen, you can set `pauseStreams` +to `false`: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create({pauseStreams: false}); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +However, what if you don't have all the source streams yet, or you don't want +to allocate the resources (file descriptors, memory, etc.) for them right away? +Well, in that case you can simply provide a callback that supplies the stream +by calling a `next()` function: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(function(next) { + next(fs.createReadStream('file1.txt')); +}); +combinedStream.append(function(next) { + next(fs.createReadStream('file2.txt')); +}); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +## API + +### CombinedStream.create([options]) + +Returns a new combined stream object. Available options are: + +* `maxDataSize` +* `pauseStreams` + +The effect of those options is described below. + +### combinedStream.pauseStreams = `true` + +Whether to apply back pressure to the underlaying streams. If set to `false`, +the underlaying streams will never be paused. If set to `true`, the +underlaying streams will be paused right after being appended, as well as when +`delayedStream.pipe()` wants to throttle. + +### combinedStream.maxDataSize = `2 * 1024 * 1024` + +The maximum amount of bytes (or characters) to buffer for all source streams. +If this value is exceeded, `combinedStream` emits an `'error'` event. + +### combinedStream.dataSize = `0` + +The amount of bytes (or characters) currently buffered by `combinedStream`. + +### combinedStream.append(stream) + +Appends the given `stream` to the combinedStream object. If `pauseStreams` is +set to `true, this stream will also be paused right away. + +`streams` can also be a function that takes one parameter called `next`. `next` +is a function that must be invoked in order to provide the `next` stream, see +example above. + +Regardless of how the `stream` is appended, combined-stream always attaches an +`'error'` listener to it, so you don't have to do that manually. + +Special case: `stream` can also be a String or Buffer. + +### combinedStream.write(data) + +You should not call this, `combinedStream` takes care of piping the appended +streams into itself for you. + +### combinedStream.resume() + +Causes `combinedStream` to start drain the streams it manages. The function is +idempotent, and also emits a `'resume'` event each time which usually goes to +the stream that is currently being drained. + +### combinedStream.pause(); + +If `combinedStream.pauseStreams` is set to `false`, this does nothing. +Otherwise a `'pause'` event is emitted, this goes to the stream that is +currently being drained, so you can use it to apply back pressure. + +### combinedStream.end(); + +Sets `combinedStream.writable` to false, emits an `'end'` event, and removes +all streams from the queue. + +### combinedStream.destroy(); + +Same as `combinedStream.end()`, except it emits a `'close'` event instead of +`'end'`. + +## License + +combined-stream is licensed under the MIT license. diff --git a/appasar/canary/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js b/appasar/canary/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js new file mode 100644 index 0000000..809b3c2 --- /dev/null +++ b/appasar/canary/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js @@ -0,0 +1,189 @@ +var util = require('util'); +var Stream = require('stream').Stream; +var DelayedStream = require('delayed-stream'); +var defer = require('./defer.js'); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + defer(this._pipeNext.bind(this, stream)); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; diff --git a/appasar/canary/node_modules/form-data/node_modules/combined-stream/lib/defer.js b/appasar/canary/node_modules/form-data/node_modules/combined-stream/lib/defer.js new file mode 100644 index 0000000..b67110c --- /dev/null +++ b/appasar/canary/node_modules/form-data/node_modules/combined-stream/lib/defer.js @@ -0,0 +1,26 @@ +module.exports = defer; + +/** + * Runs provided function on next iteration of the event loop + * + * @param {function} fn - function to run + */ +function defer(fn) +{ + var nextTick = typeof setImmediate == 'function' + ? setImmediate + : ( + typeof process == 'object' && typeof process.nextTick == 'function' + ? process.nextTick + : null + ); + + if (nextTick) + { + nextTick(fn); + } + else + { + setTimeout(fn, 0); + } +} diff --git a/appasar/canary/node_modules/form-data/node_modules/combined-stream/package.json b/appasar/canary/node_modules/form-data/node_modules/combined-stream/package.json new file mode 100644 index 0000000..7551047 --- /dev/null +++ b/appasar/canary/node_modules/form-data/node_modules/combined-stream/package.json @@ -0,0 +1,25 @@ +{ + "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", + "name": "combined-stream", + "description": "A stream that emits multiple other streams one after another.", + "version": "1.0.6", + "homepage": "https://github.com/felixge/node-combined-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-combined-stream.git" + }, + "main": "./lib/combined_stream", + "scripts": { + "test": "node test/run.js" + }, + "engines": { + "node": ">= 0.8" + }, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "devDependencies": { + "far": "~0.0.7" + }, + "license": "MIT" +} diff --git a/appasar/canary/node_modules/form-data/package.json b/appasar/canary/node_modules/form-data/package.json new file mode 100644 index 0000000..a21f4b3 --- /dev/null +++ b/appasar/canary/node_modules/form-data/package.json @@ -0,0 +1,65 @@ +{ + "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", + "name": "form-data", + "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.", + "version": "2.3.2", + "repository": { + "type": "git", + "url": "git://github.com/form-data/form-data.git" + }, + "main": "./lib/form_data", + "browser": "./lib/browser", + "scripts": { + "pretest": "rimraf coverage test/tmp", + "test": "istanbul cover test/run.js", + "posttest": "istanbul report lcov text", + "lint": "eslint lib/*.js test/*.js test/integration/*.js", + "report": "istanbul report lcov text", + "ci-lint": "is-node-modern 6 && npm run lint || is-node-not-modern 6", + "ci-test": "npm run test && npm run browser && npm run report", + "predebug": "rimraf coverage test/tmp", + "debug": "verbose=1 ./test/run.js", + "browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage", + "check": "istanbul check-coverage coverage/coverage*.json", + "files": "pkgfiles --sort=name", + "get-version": "node -e \"console.log(require('./package.json').version)\"", + "update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md", + "restore-readme": "mv README.md.bak README.md", + "prepublish": "in-publish && npm run update-readme || not-in-publish", + "postpublish": "npm run restore-readme" + }, + "pre-commit": [ + "lint", + "ci-test", + "check" + ], + "engines": { + "node": ">= 0.12" + }, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "devDependencies": { + "browserify": "^13.1.1", + "browserify-istanbul": "^2.0.0", + "coveralls": "^2.11.14", + "cross-spawn": "^4.0.2", + "eslint": "^3.9.1", + "fake": "^0.2.2", + "far": "^0.0.7", + "formidable": "^1.0.17", + "in-publish": "^2.0.0", + "is-node-modern": "^1.0.0", + "istanbul": "^0.4.5", + "obake": "^0.1.2", + "phantomjs-prebuilt": "^2.1.13", + "pkgfiles": "^2.3.0", + "pre-commit": "^1.1.3", + "request": "2.76.0", + "rimraf": "^2.5.4", + "tape": "^4.6.2" + }, + "license": "MIT" +} diff --git a/appasar/canary/node_modules/fs.realpath/LICENSE b/appasar/canary/node_modules/fs.realpath/LICENSE new file mode 100644 index 0000000..5bd884c --- /dev/null +++ b/appasar/canary/node_modules/fs.realpath/LICENSE @@ -0,0 +1,43 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +---- + +This library bundles a version of the `fs.realpath` and `fs.realpathSync` +methods from Node.js v0.10 under the terms of the Node.js MIT license. + +Node's license follows, also included at the header of `old.js` which contains +the licensed code: + + Copyright Joyent, Inc. and other Node contributors. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/fs.realpath/README.md b/appasar/canary/node_modules/fs.realpath/README.md new file mode 100644 index 0000000..a42ceac --- /dev/null +++ b/appasar/canary/node_modules/fs.realpath/README.md @@ -0,0 +1,33 @@ +# fs.realpath + +A backwards-compatible fs.realpath for Node v6 and above + +In Node v6, the JavaScript implementation of fs.realpath was replaced +with a faster (but less resilient) native implementation. That raises +new and platform-specific errors and cannot handle long or excessively +symlink-looping paths. + +This module handles those cases by detecting the new errors and +falling back to the JavaScript implementation. On versions of Node +prior to v6, it has no effect. + +## USAGE + +```js +var rp = require('fs.realpath') + +// async version +rp.realpath(someLongAndLoopingPath, function (er, real) { + // the ELOOP was handled, but it was a bit slower +}) + +// sync version +var real = rp.realpathSync(someLongAndLoopingPath) + +// monkeypatch at your own risk! +// This replaces the fs.realpath/fs.realpathSync builtins +rp.monkeypatch() + +// un-do the monkeypatching +rp.unmonkeypatch() +``` diff --git a/appasar/canary/node_modules/fs.realpath/index.js b/appasar/canary/node_modules/fs.realpath/index.js new file mode 100644 index 0000000..b09c7c7 --- /dev/null +++ b/appasar/canary/node_modules/fs.realpath/index.js @@ -0,0 +1,66 @@ +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch + +var fs = require('fs') +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync + +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = require('./old.js') + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} + +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} + +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } + + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } + } +} + +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} + +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync +} diff --git a/appasar/canary/node_modules/fs.realpath/old.js b/appasar/canary/node_modules/fs.realpath/old.js new file mode 100644 index 0000000..b40305e --- /dev/null +++ b/appasar/canary/node_modules/fs.realpath/old.js @@ -0,0 +1,303 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var pathModule = require('path'); +var isWindows = process.platform === 'win32'; +var fs = require('fs'); + +// JavaScript implementation of realpath, ported from node pre-v6 + +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; + + return callback; + + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } +} + +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} + +var normalize = pathModule.normalize; + +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; +} + +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} + +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } + + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } + + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } + + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + + if (cache) cache[original] = p; + + return p; +}; + + +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } + + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } + + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } + + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } + + return fs.lstat(base, gotStat); + } + + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } + + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); + + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } + + function gotTarget(err, target, base) { + if (err) return cb(err); + + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } + + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; diff --git a/appasar/canary/node_modules/fs.realpath/package.json b/appasar/canary/node_modules/fs.realpath/package.json new file mode 100644 index 0000000..3edc57d --- /dev/null +++ b/appasar/canary/node_modules/fs.realpath/package.json @@ -0,0 +1,26 @@ +{ + "name": "fs.realpath", + "version": "1.0.0", + "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", + "main": "index.js", + "dependencies": {}, + "devDependencies": {}, + "scripts": { + "test": "tap test/*.js --cov" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/fs.realpath.git" + }, + "keywords": [ + "realpath", + "fs", + "polyfill" + ], + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "license": "ISC", + "files": [ + "old.js", + "index.js" + ] +} diff --git a/appasar/canary/node_modules/getpass/.npmignore b/appasar/canary/node_modules/getpass/.npmignore new file mode 100644 index 0000000..a4261fc --- /dev/null +++ b/appasar/canary/node_modules/getpass/.npmignore @@ -0,0 +1,8 @@ +.gitmodules +deps +docs +Makefile +node_modules +test +tools +coverage diff --git a/appasar/canary/node_modules/getpass/.travis.yml b/appasar/canary/node_modules/getpass/.travis.yml new file mode 100644 index 0000000..d8b5833 --- /dev/null +++ b/appasar/canary/node_modules/getpass/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +node_js: + - "5.10" + - "4.4" + - "4.1" + - "0.12" + - "0.10" +before_install: + - "make check" diff --git a/appasar/canary/node_modules/getpass/LICENSE b/appasar/canary/node_modules/getpass/LICENSE new file mode 100644 index 0000000..f6d947d --- /dev/null +++ b/appasar/canary/node_modules/getpass/LICENSE @@ -0,0 +1,18 @@ +Copyright Joyent, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/getpass/README.md b/appasar/canary/node_modules/getpass/README.md new file mode 100644 index 0000000..6e4a50f --- /dev/null +++ b/appasar/canary/node_modules/getpass/README.md @@ -0,0 +1,32 @@ +## getpass + +Get a password from the terminal. Sounds simple? Sounds like the `readline` +module should be able to do it? NOPE. + +## Install and use it + +```bash +npm install --save getpass +``` + +```javascript +const mod_getpass = require('getpass'); +``` + +## API + +### `mod_getpass.getPass([options, ]callback)` + +Gets a password from the terminal. If available, this uses `/dev/tty` to avoid +interfering with any data being piped in or out of stdio. + +This function prints a prompt (by default `Password:`) and then accepts input +without echoing. + +Parameters: + + * `options`, an Object, with properties: + * `prompt`, an optional String + * `callback`, a `Func(error, password)`, with arguments: + * `error`, either `null` (no error) or an `Error` instance + * `password`, a String diff --git a/appasar/canary/node_modules/getpass/lib/index.js b/appasar/canary/node_modules/getpass/lib/index.js new file mode 100644 index 0000000..55a7718 --- /dev/null +++ b/appasar/canary/node_modules/getpass/lib/index.js @@ -0,0 +1,123 @@ +/* + * Copyright 2016, Joyent, Inc. All rights reserved. + * Author: Alex Wilson <alex.wilson@joyent.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. +*/ + +module.exports = { + getPass: getPass +}; + +const mod_tty = require('tty'); +const mod_fs = require('fs'); +const mod_assert = require('assert-plus'); + +var BACKSPACE = String.fromCharCode(127); +var CTRLC = '\u0003'; +var CTRLD = '\u0004'; + +function getPass(opts, cb) { + if (typeof (opts) === 'function' && cb === undefined) { + cb = opts; + opts = {}; + } + mod_assert.object(opts, 'options'); + mod_assert.func(cb, 'callback'); + + mod_assert.optionalString(opts.prompt, 'options.prompt'); + if (opts.prompt === undefined) + opts.prompt = 'Password'; + + openTTY(function (err, rfd, wfd, rtty, wtty) { + if (err) { + cb(err); + return; + } + + wtty.write(opts.prompt + ':'); + rtty.resume(); + rtty.setRawMode(true); + rtty.resume(); + rtty.setEncoding('utf8'); + + var pw = ''; + rtty.on('data', onData); + + function onData(data) { + var str = data.toString('utf8'); + for (var i = 0; i < str.length; ++i) { + var ch = str[i]; + switch (ch) { + case '\r': + case '\n': + case CTRLD: + cleanup(); + cb(null, pw); + return; + case CTRLC: + cleanup(); + cb(new Error('Aborted')); + return; + case BACKSPACE: + pw = pw.slice(0, pw.length - 1); + break; + default: + pw += ch; + break; + } + } + } + + function cleanup() { + wtty.write('\r\n'); + rtty.setRawMode(false); + rtty.pause(); + rtty.removeListener('data', onData); + if (wfd !== undefined && wfd !== rfd) { + wtty.end(); + mod_fs.closeSync(wfd); + } + if (rfd !== undefined) { + rtty.end(); + mod_fs.closeSync(rfd); + } + } + }); +} + +function openTTY(cb) { + mod_fs.open('/dev/tty', 'r+', function (err, rttyfd) { + if ((err && (err.code === 'ENOENT' || err.code === 'EACCES')) || + (process.version.match(/^v0[.][0-8][.]/))) { + cb(null, undefined, undefined, process.stdin, + process.stdout); + return; + } + var rtty = new mod_tty.ReadStream(rttyfd); + mod_fs.open('/dev/tty', 'w+', function (err3, wttyfd) { + var wtty = new mod_tty.WriteStream(wttyfd); + if (err3) { + cb(err3); + return; + } + cb(null, rttyfd, wttyfd, rtty, wtty); + }); + }); +} diff --git a/appasar/canary/node_modules/getpass/package.json b/appasar/canary/node_modules/getpass/package.json new file mode 100644 index 0000000..f1638eb --- /dev/null +++ b/appasar/canary/node_modules/getpass/package.json @@ -0,0 +1,18 @@ +{ + "name": "getpass", + "version": "0.1.7", + "description": "getpass for node.js", + "main": "lib/index.js", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/arekinath/node-getpass.git" + }, + "scripts": { + "test": "tape test/*.test.js" + }, + "author": "Alex Wilson <alex.wilson@joyent.com>", + "license": "MIT" +} diff --git a/appasar/canary/node_modules/glob/LICENSE b/appasar/canary/node_modules/glob/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/appasar/canary/node_modules/glob/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/glob/README.md b/appasar/canary/node_modules/glob/README.md new file mode 100644 index 0000000..baa1d1b --- /dev/null +++ b/appasar/canary/node_modules/glob/README.md @@ -0,0 +1,368 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![](oh-my-glob.gif) + +## Usage + +Install with npm + +``` +npm i glob +``` + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array<String>}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array<String>}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array<String>}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` diff --git a/appasar/canary/node_modules/glob/changelog.md b/appasar/canary/node_modules/glob/changelog.md new file mode 100644 index 0000000..4163677 --- /dev/null +++ b/appasar/canary/node_modules/glob/changelog.md @@ -0,0 +1,67 @@ +## 7.0 + +- Raise error if `options.cwd` is specified, and not a directory + +## 6.0 + +- Remove comment and negation pattern support +- Ignore patterns are always in `dot:true` mode + +## 5.0 + +- Deprecate comment and negation patterns +- Fix regression in `mark` and `nodir` options from making all cache + keys absolute path. +- Abort if `fs.readdir` returns an error that's unexpected +- Don't emit `match` events for ignored items +- Treat ENOTSUP like ENOTDIR in readdir + +## 4.5 + +- Add `options.follow` to always follow directory symlinks in globstar +- Add `options.realpath` to call `fs.realpath` on all results +- Always cache based on absolute path + +## 4.4 + +- Add `options.ignore` +- Fix handling of broken symlinks + +## 4.3 + +- Bump minimatch to 2.x +- Pass all tests on Windows + +## 4.2 + +- Add `glob.hasMagic` function +- Add `options.nodir` flag + +## 4.1 + +- Refactor sync and async implementations for performance +- Throw if callback provided to sync glob function +- Treat symbolic links in globstar results the same as Bash 4.3 + +## 4.0 + +- Use `^` for dependency versions (bumped major because this breaks + older npm versions) +- Ensure callbacks are only ever called once +- switch to ISC license + +## 3.x + +- Rewrite in JavaScript +- Add support for setting root, cwd, and windows support +- Cache many fs calls +- Add globstar support +- emit match events + +## 2.x + +- Use `glob.h` and `fnmatch.h` from NetBSD + +## 1.x + +- `glob.h` static binding. diff --git a/appasar/canary/node_modules/glob/common.js b/appasar/canary/node_modules/glob/common.js new file mode 100644 index 0000000..66651bb --- /dev/null +++ b/appasar/canary/node_modules/glob/common.js @@ -0,0 +1,240 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') + + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/appasar/canary/node_modules/glob/glob.js b/appasar/canary/node_modules/glob/glob.js new file mode 100644 index 0000000..58dec0f --- /dev/null +++ b/appasar/canary/node_modules/glob/glob.js @@ -0,0 +1,790 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = require('fs') +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {<filename>: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = isAbsolute(e) ? e : this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} diff --git a/appasar/canary/node_modules/glob/package.json b/appasar/canary/node_modules/glob/package.json new file mode 100644 index 0000000..8d934ab --- /dev/null +++ b/appasar/canary/node_modules/glob/package.json @@ -0,0 +1,43 @@ +{ + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "name": "glob", + "description": "a little globber", + "version": "7.1.2", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": "*" + }, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "devDependencies": { + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^7.1.2", + "tick": "0.0.6" + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "tap test/*.js --cov", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "node benchclean.js" + }, + "license": "ISC" +} diff --git a/appasar/canary/node_modules/glob/sync.js b/appasar/canary/node_modules/glob/sync.js new file mode 100644 index 0000000..c952134 --- /dev/null +++ b/appasar/canary/node_modules/glob/sync.js @@ -0,0 +1,486 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + + var abs = this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) { + e = abs + } + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } + + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/appasar/canary/node_modules/har-schema/LICENSE b/appasar/canary/node_modules/har-schema/LICENSE new file mode 100644 index 0000000..ca55c91 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Ahmad Nassri <ahmad@ahmadnassri.com> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/har-schema/README.md b/appasar/canary/node_modules/har-schema/README.md new file mode 100644 index 0000000..cd0a28e --- /dev/null +++ b/appasar/canary/node_modules/har-schema/README.md @@ -0,0 +1,49 @@ +# HAR Schema [![version][npm-version]][npm-url] [![License][npm-license]][license-url] + +> JSON Schema for HTTP Archive ([HAR][spec]). + +[![Build Status][travis-image]][travis-url] +[![Downloads][npm-downloads]][npm-url] +[![Code Climate][codeclimate-quality]][codeclimate-url] +[![Coverage Status][codeclimate-coverage]][codeclimate-url] +[![Dependency Status][dependencyci-image]][dependencyci-url] +[![Dependencies][david-image]][david-url] + +## Install + +```bash +npm install --only=production --save har-schema +``` + +## Usage + +Compatible with any [JSON Schema validation tool][validator]. + +---- +> :copyright: [ahmadnassri.com](https://www.ahmadnassri.com/)  ·  +> License: [ISC][license-url]  ·  +> Github: [@ahmadnassri](https://github.com/ahmadnassri)  ·  +> Twitter: [@ahmadnassri](https://twitter.com/ahmadnassri) + +[license-url]: http://choosealicense.com/licenses/isc/ + +[travis-url]: https://travis-ci.org/ahmadnassri/har-schema +[travis-image]: https://img.shields.io/travis/ahmadnassri/har-schema.svg?style=flat-square + +[npm-url]: https://www.npmjs.com/package/har-schema +[npm-license]: https://img.shields.io/npm/l/har-schema.svg?style=flat-square +[npm-version]: https://img.shields.io/npm/v/har-schema.svg?style=flat-square +[npm-downloads]: https://img.shields.io/npm/dm/har-schema.svg?style=flat-square + +[codeclimate-url]: https://codeclimate.com/github/ahmadnassri/har-schema +[codeclimate-quality]: https://img.shields.io/codeclimate/github/ahmadnassri/har-schema.svg?style=flat-square +[codeclimate-coverage]: https://img.shields.io/codeclimate/coverage/github/ahmadnassri/har-schema.svg?style=flat-square + +[david-url]: https://david-dm.org/ahmadnassri/har-schema +[david-image]: https://img.shields.io/david/ahmadnassri/har-schema.svg?style=flat-square + +[dependencyci-url]: https://dependencyci.com/github/ahmadnassri/har-schema +[dependencyci-image]: https://dependencyci.com/github/ahmadnassri/har-schema/badge?style=flat-square + +[spec]: https://github.com/ahmadnassri/har-spec/blob/master/versions/1.2.md +[validator]: https://github.com/ahmadnassri/har-validator diff --git a/appasar/canary/node_modules/har-schema/lib/afterRequest.json b/appasar/canary/node_modules/har-schema/lib/afterRequest.json new file mode 100644 index 0000000..5f52581 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/afterRequest.json @@ -0,0 +1,30 @@ +{ + "$id": "afterRequest.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "optional": true, + "required": [ + "lastAccess", + "eTag", + "hitCount" + ], + "properties": { + "expires": { + "type": "string", + "pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))?" + }, + "lastAccess": { + "type": "string", + "pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))?" + }, + "eTag": { + "type": "string" + }, + "hitCount": { + "type": "integer" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/beforeRequest.json b/appasar/canary/node_modules/har-schema/lib/beforeRequest.json new file mode 100644 index 0000000..c7b5c10 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/beforeRequest.json @@ -0,0 +1,30 @@ +{ + "$id": "beforeRequest.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "optional": true, + "required": [ + "lastAccess", + "eTag", + "hitCount" + ], + "properties": { + "expires": { + "type": "string", + "pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))?" + }, + "lastAccess": { + "type": "string", + "pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))?" + }, + "eTag": { + "type": "string" + }, + "hitCount": { + "type": "integer" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/browser.json b/appasar/canary/node_modules/har-schema/lib/browser.json new file mode 100644 index 0000000..d6869f7 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/browser.json @@ -0,0 +1,20 @@ +{ + "$id": "browser.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/cache.json b/appasar/canary/node_modules/har-schema/lib/cache.json new file mode 100644 index 0000000..30a7182 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/cache.json @@ -0,0 +1,21 @@ +{ + "$id": "cache.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "properties": { + "beforeRequest": { + "oneOf": [ + { "type": "null" }, + { "$ref": "beforeRequest.json#" } + ] + }, + "afterRequest": { + "oneOf": [ + { "type": "null" }, + { "$ref": "afterRequest.json#" } + ] + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/content.json b/appasar/canary/node_modules/har-schema/lib/content.json new file mode 100644 index 0000000..43944bf --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/content.json @@ -0,0 +1,29 @@ +{ + "$id": "content.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "size", + "mimeType" + ], + "properties": { + "size": { + "type": "integer" + }, + "compression": { + "type": "integer" + }, + "mimeType": { + "type": "string" + }, + "text": { + "type": "string" + }, + "encoding": { + "type": "string" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/cookie.json b/appasar/canary/node_modules/har-schema/lib/cookie.json new file mode 100644 index 0000000..661f7f3 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/cookie.json @@ -0,0 +1,36 @@ +{ + "$id": "cookie.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "path": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "expires": { + "type": ["string", "null"], + "format": "date-time" + }, + "httpOnly": { + "type": "boolean" + }, + "secure": { + "type": "boolean" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/creator.json b/appasar/canary/node_modules/har-schema/lib/creator.json new file mode 100644 index 0000000..71a75cd --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/creator.json @@ -0,0 +1,20 @@ +{ + "$id": "creator.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/entry.json b/appasar/canary/node_modules/har-schema/lib/entry.json new file mode 100644 index 0000000..18025f4 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/entry.json @@ -0,0 +1,53 @@ +{ + "$id": "entry.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "optional": true, + "required": [ + "startedDateTime", + "time", + "request", + "response", + "cache", + "timings" + ], + "properties": { + "pageref": { + "type": "string" + }, + "startedDateTime": { + "type": "string", + "format": "date-time", + "pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))" + }, + "time": { + "type": "number", + "min": 0 + }, + "request": { + "$ref": "request.json#" + }, + "response": { + "$ref": "response.json#" + }, + "cache": { + "$ref": "cache.json#" + }, + "timings": { + "$ref": "timings.json#" + }, + "serverIPAddress": { + "type": "string", + "oneOf": [ + { "format": "ipv4" }, + { "format": "ipv6" } + ] + }, + "connection": { + "type": "string" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/har.json b/appasar/canary/node_modules/har-schema/lib/har.json new file mode 100644 index 0000000..d1a1de5 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/har.json @@ -0,0 +1,13 @@ +{ + "$id": "har.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "log" + ], + "properties": { + "log": { + "$ref": "log.json#" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/header.json b/appasar/canary/node_modules/har-schema/lib/header.json new file mode 100644 index 0000000..103d949 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/header.json @@ -0,0 +1,20 @@ +{ + "$id": "header.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/index.js b/appasar/canary/node_modules/har-schema/lib/index.js new file mode 100644 index 0000000..244c08e --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/index.js @@ -0,0 +1,22 @@ +'use strict' + +module.exports = { + afterRequest: require('./afterRequest.json'), + beforeRequest: require('./beforeRequest.json'), + browser: require('./browser.json'), + cache: require('./cache.json'), + content: require('./content.json'), + cookie: require('./cookie.json'), + creator: require('./creator.json'), + entry: require('./entry.json'), + har: require('./har.json'), + header: require('./header.json'), + log: require('./log.json'), + page: require('./page.json'), + pageTimings: require('./pageTimings.json'), + postData: require('./postData.json'), + query: require('./query.json'), + request: require('./request.json'), + response: require('./response.json'), + timings: require('./timings.json') +} diff --git a/appasar/canary/node_modules/har-schema/lib/log.json b/appasar/canary/node_modules/har-schema/lib/log.json new file mode 100644 index 0000000..c353b40 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/log.json @@ -0,0 +1,36 @@ +{ + "$id": "log.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "version", + "creator", + "entries" + ], + "properties": { + "version": { + "type": "string" + }, + "creator": { + "$ref": "creator.json#" + }, + "browser": { + "$ref": "browser.json#" + }, + "pages": { + "type": "array", + "items": { + "$ref": "page.json#" + } + }, + "entries": { + "type": "array", + "items": { + "$ref": "entry.json#" + } + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/page.json b/appasar/canary/node_modules/har-schema/lib/page.json new file mode 100644 index 0000000..e24a3ce --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/page.json @@ -0,0 +1,32 @@ +{ + "$id": "page.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "optional": true, + "required": [ + "startedDateTime", + "id", + "title", + "pageTimings" + ], + "properties": { + "startedDateTime": { + "type": "string", + "format": "date-time", + "pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))" + }, + "id": { + "type": "string", + "unique": true + }, + "title": { + "type": "string" + }, + "pageTimings": { + "$ref": "pageTimings.json#" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/pageTimings.json b/appasar/canary/node_modules/har-schema/lib/pageTimings.json new file mode 100644 index 0000000..130411f --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/pageTimings.json @@ -0,0 +1,18 @@ +{ + "$id": "pageTimings.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "properties": { + "onContentLoad": { + "type": "number", + "min": -1 + }, + "onLoad": { + "type": "number", + "min": -1 + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/postData.json b/appasar/canary/node_modules/har-schema/lib/postData.json new file mode 100644 index 0000000..3aa6294 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/postData.json @@ -0,0 +1,43 @@ +{ + "$id": "postData.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "optional": true, + "required": [ + "mimeType" + ], + "properties": { + "mimeType": { + "type": "string" + }, + "text": { + "type": "string" + }, + "params": { + "type": "array", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "fileName": { + "type": "string" + }, + "contentType": { + "type": "string" + }, + "comment": { + "type": "string" + } + } + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/query.json b/appasar/canary/node_modules/har-schema/lib/query.json new file mode 100644 index 0000000..f82d8d8 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/query.json @@ -0,0 +1,20 @@ +{ + "$id": "query.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/request.json b/appasar/canary/node_modules/har-schema/lib/request.json new file mode 100644 index 0000000..0e2566d --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/request.json @@ -0,0 +1,57 @@ +{ + "$id": "request.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "method", + "url", + "httpVersion", + "cookies", + "headers", + "queryString", + "headersSize", + "bodySize" + ], + "properties": { + "method": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri" + }, + "httpVersion": { + "type": "string" + }, + "cookies": { + "type": "array", + "items": { + "$ref": "cookie.json#" + } + }, + "headers": { + "type": "array", + "items": { + "$ref": "header.json#" + } + }, + "queryString": { + "type": "array", + "items": { + "$ref": "query.json#" + } + }, + "postData": { + "$ref": "postData.json#" + }, + "headersSize": { + "type": "integer" + }, + "bodySize": { + "type": "integer" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/response.json b/appasar/canary/node_modules/har-schema/lib/response.json new file mode 100644 index 0000000..ec30f80 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/response.json @@ -0,0 +1,54 @@ +{ + "$id": "response.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "type": "object", + "required": [ + "status", + "statusText", + "httpVersion", + "cookies", + "headers", + "content", + "redirectURL", + "headersSize", + "bodySize" + ], + "properties": { + "status": { + "type": "integer" + }, + "statusText": { + "type": "string" + }, + "httpVersion": { + "type": "string" + }, + "cookies": { + "type": "array", + "items": { + "$ref": "cookie.json#" + } + }, + "headers": { + "type": "array", + "items": { + "$ref": "header.json#" + } + }, + "content": { + "$ref": "content.json#" + }, + "redirectURL": { + "type": "string" + }, + "headersSize": { + "type": "integer" + }, + "bodySize": { + "type": "integer" + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/lib/timings.json b/appasar/canary/node_modules/har-schema/lib/timings.json new file mode 100644 index 0000000..5fe7dc7 --- /dev/null +++ b/appasar/canary/node_modules/har-schema/lib/timings.json @@ -0,0 +1,42 @@ +{ + "$id": "timings.json#", + "$schema": "http://json-schema.org/draft-06/schema#", + "required": [ + "send", + "wait", + "receive" + ], + "properties": { + "dns": { + "type": "number", + "min": -1 + }, + "connect": { + "type": "number", + "min": -1 + }, + "blocked": { + "type": "number", + "min": -1 + }, + "send": { + "type": "number", + "min": -1 + }, + "wait": { + "type": "number", + "min": -1 + }, + "receive": { + "type": "number", + "min": -1 + }, + "ssl": { + "type": "number", + "min": -1 + }, + "comment": { + "type": "string" + } + } +} diff --git a/appasar/canary/node_modules/har-schema/package.json b/appasar/canary/node_modules/har-schema/package.json new file mode 100644 index 0000000..d14650b --- /dev/null +++ b/appasar/canary/node_modules/har-schema/package.json @@ -0,0 +1,54 @@ +{ + "version": "2.0.0", + "name": "har-schema", + "description": "JSON Schema for HTTP Archive (HAR)", + "author": "Ahmad Nassri <ahmad@ahmadnassri.com> (https://www.ahmadnassri.com/)", + "contributors": [ + "Evgeny Poberezkin <e.poberezkin@me.com>" + ], + "homepage": "https://github.com/ahmadnassri/har-schema", + "repository": { + "type": "git", + "url": "https://github.com/ahmadnassri/har-schema.git" + }, + "license": "ISC", + "main": "lib/index.js", + "keywords": [ + "har", + "http", + "archive", + "JSON", + "schema", + "JSON-schema" + ], + "engines": { + "node": ">=4" + }, + "files": [ + "lib" + ], + "bugs": { + "url": "https://github.com/ahmadnassri/har-schema/issues" + }, + "scripts": { + "test": "tap test --reporter spec", + "pretest": "snazzy && echint", + "coverage": "tap test --reporter silent --coverage", + "codeclimate": "tap --coverage-report=text-lcov | codeclimate-test-reporter", + "semantic-release": "semantic-release pre && npm publish && semantic-release post" + }, + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + } + }, + "devDependencies": { + "ajv": "^5.0.0", + "codeclimate-test-reporter": "^0.4.0", + "cz-conventional-changelog": "^1.2.0", + "echint": "^2.1.0", + "semantic-release": "^6.3.2", + "snazzy": "^5.0.0", + "tap": "^8.0.1" + } +} \ No newline at end of file diff --git a/appasar/canary/node_modules/har-validator/LICENSE b/appasar/canary/node_modules/har-validator/LICENSE new file mode 100644 index 0000000..ca55c91 --- /dev/null +++ b/appasar/canary/node_modules/har-validator/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Ahmad Nassri <ahmad@ahmadnassri.com> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/har-validator/README.md b/appasar/canary/node_modules/har-validator/README.md new file mode 100644 index 0000000..fc69634 --- /dev/null +++ b/appasar/canary/node_modules/har-validator/README.md @@ -0,0 +1,54 @@ +# HAR Validator [![version][npm-version]][npm-url] [![License][license-image]][license-url] + +> Extremely fast HTTP Archive ([HAR](https://github.com/ahmadnassri/har-spec/blob/master/versions/1.2.md)) validator using JSON Schema. + +[![Build Status][travis-image]][travis-url] +[![Downloads][npm-downloads]][npm-url] +[![Code Climate][codeclimate-quality]][codeclimate-url] +[![Coverage Status][codeclimate-coverage]][codeclimate-url] +[![Dependency Status][dependencyci-image]][dependencyci-url] +[![Dependencies][david-image]][david-url] + +## Install + +```bash +npm install --only=production --save har-validator +``` + +## CLI Usage + +Please refer to [`har-cli`](https://github.com/ahmadnassri/har-cli) for more info. + +## API + +**Note**: as of [`v2.0.0`](https://github.com/ahmadnassri/har-validator/releases/tag/v2.0.0) this module defaults to Promise based API. *For backward compatibility with `v1.x` an [async/callback API](docs/async.md) is also provided* + +- [async API](docs/async.md) +- [callback API](docs/async.md) +- [Promise API](docs/promise.md) *(default)* + +---- +> :copyright: [ahmadnassri.com](https://www.ahmadnassri.com/)  ·  +> License: [ISC][license-url]  ·  +> Github: [@ahmadnassri](https://github.com/ahmadnassri)  ·  +> Twitter: [@ahmadnassri](https://twitter.com/ahmadnassri) + +[license-url]: http://choosealicense.com/licenses/isc/ +[license-image]: https://img.shields.io/github/license/ahmadnassri/har-validator.svg?style=flat-square + +[travis-url]: https://travis-ci.org/ahmadnassri/har-validator +[travis-image]: https://img.shields.io/travis/ahmadnassri/har-validator.svg?style=flat-square + +[npm-url]: https://www.npmjs.com/package/har-validator +[npm-version]: https://img.shields.io/npm/v/har-validator.svg?style=flat-square +[npm-downloads]: https://img.shields.io/npm/dm/har-validator.svg?style=flat-square + +[codeclimate-url]: https://codeclimate.com/github/ahmadnassri/har-validator +[codeclimate-quality]: https://img.shields.io/codeclimate/github/ahmadnassri/har-validator.svg?style=flat-square +[codeclimate-coverage]: https://img.shields.io/codeclimate/coverage/github/ahmadnassri/har-validator.svg?style=flat-square + +[david-url]: https://david-dm.org/ahmadnassri/har-validator +[david-image]: https://img.shields.io/david/ahmadnassri/har-validator.svg?style=flat-square + +[dependencyci-url]: https://dependencyci.com/github/ahmadnassri/har-validator +[dependencyci-image]: https://dependencyci.com/github/ahmadnassri/har-validator/badge?style=flat-square diff --git a/appasar/canary/node_modules/har-validator/lib/async.js b/appasar/canary/node_modules/har-validator/lib/async.js new file mode 100644 index 0000000..fc41667 --- /dev/null +++ b/appasar/canary/node_modules/har-validator/lib/async.js @@ -0,0 +1,98 @@ +var Ajv = require('ajv') +var HARError = require('./error') +var schemas = require('har-schema') + +var ajv + +function validate (name, data, next) { + data = data || {} + + // validator config + ajv = ajv || new Ajv({ + allErrors: true, + schemas: schemas + }) + + var validate = ajv.getSchema(name + '.json') + + var valid = validate(data) + + // callback? + if (typeof next === 'function') { + return next(!valid ? new HARError(validate.errors) : null, valid) + } + + return valid +} + +exports.afterRequest = function (data, next) { + return validate('afterRequest', data, next) +} + +exports.beforeRequest = function (data, next) { + return validate('beforeRequest', data, next) +} + +exports.browser = function (data, next) { + return validate('browser', data, next) +} + +exports.cache = function (data, next) { + return validate('cache', data, next) +} + +exports.content = function (data, next) { + return validate('content', data, next) +} + +exports.cookie = function (data, next) { + return validate('cookie', data, next) +} + +exports.creator = function (data, next) { + return validate('creator', data, next) +} + +exports.entry = function (data, next) { + return validate('entry', data, next) +} + +exports.har = function (data, next) { + return validate('har', data, next) +} + +exports.header = function (data, next) { + return validate('header', data, next) +} + +exports.log = function (data, next) { + return validate('log', data, next) +} + +exports.page = function (data, next) { + return validate('page', data, next) +} + +exports.pageTimings = function (data, next) { + return validate('pageTimings', data, next) +} + +exports.postData = function (data, next) { + return validate('postData', data, next) +} + +exports.query = function (data, next) { + return validate('query', data, next) +} + +exports.request = function (data, next) { + return validate('request', data, next) +} + +exports.response = function (data, next) { + return validate('response', data, next) +} + +exports.timings = function (data, next) { + return validate('timings', data, next) +} diff --git a/appasar/canary/node_modules/har-validator/lib/error.js b/appasar/canary/node_modules/har-validator/lib/error.js new file mode 100644 index 0000000..f2618dc --- /dev/null +++ b/appasar/canary/node_modules/har-validator/lib/error.js @@ -0,0 +1,17 @@ +function HARError (errors) { + var message = 'validation failed' + + this.name = 'HARError' + this.message = message + this.errors = errors + + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, this.constructor) + } else { + this.stack = (new Error(message)).stack + } +} + +HARError.prototype = Error.prototype + +module.exports = HARError diff --git a/appasar/canary/node_modules/har-validator/lib/promise.js b/appasar/canary/node_modules/har-validator/lib/promise.js new file mode 100644 index 0000000..1ab308c --- /dev/null +++ b/appasar/canary/node_modules/har-validator/lib/promise.js @@ -0,0 +1,95 @@ +var Ajv = require('ajv') +var HARError = require('./error') +var schemas = require('har-schema') + +var ajv + +function validate (name, data) { + data = data || {} + + // validator config + ajv = ajv || new Ajv({ + allErrors: true, + schemas: schemas + }) + + var validate = ajv.getSchema(name + '.json') + + return new Promise(function (resolve, reject) { + var valid = validate(data) + + !valid ? reject(new HARError(validate.errors)) : resolve(data) + }) +} + +exports.afterRequest = function (data) { + return validate('afterRequest', data) +} + +exports.beforeRequest = function (data) { + return validate('beforeRequest', data) +} + +exports.browser = function (data) { + return validate('browser', data) +} + +exports.cache = function (data) { + return validate('cache', data) +} + +exports.content = function (data) { + return validate('content', data) +} + +exports.cookie = function (data) { + return validate('cookie', data) +} + +exports.creator = function (data) { + return validate('creator', data) +} + +exports.entry = function (data) { + return validate('entry', data) +} + +exports.har = function (data) { + return validate('har', data) +} + +exports.header = function (data) { + return validate('header', data) +} + +exports.log = function (data) { + return validate('log', data) +} + +exports.page = function (data) { + return validate('page', data) +} + +exports.pageTimings = function (data) { + return validate('pageTimings', data) +} + +exports.postData = function (data) { + return validate('postData', data) +} + +exports.query = function (data) { + return validate('query', data) +} + +exports.request = function (data) { + return validate('request', data) +} + +exports.response = function (data) { + return validate('response', data) +} + +exports.timings = function (data) { + return validate('timings', data) +} diff --git a/appasar/canary/node_modules/har-validator/package.json b/appasar/canary/node_modules/har-validator/package.json new file mode 100644 index 0000000..8e29827 --- /dev/null +++ b/appasar/canary/node_modules/har-validator/package.json @@ -0,0 +1,46 @@ +{ + "version": "5.0.3", + "name": "har-validator", + "description": "Extremely fast HTTP Archive (HAR) validator using JSON Schema", + "author": "Ahmad Nassri <ahmad@ahmadnassri.com> (https://www.ahmadnassri.com/)", + "homepage": "https://github.com/ahmadnassri/har-validator", + "repository": { + "type": "git", + "url": "https://github.com/ahmadnassri/har-validator.git" + }, + "license": "ISC", + "main": "lib/promise.js", + "keywords": [ + "har", + "cli", + "ajv", + "http", + "archive", + "validate", + "validator" + ], + "engines": { + "node": ">=4" + }, + "files": [ + "lib" + ], + "bugs": { + "url": "https://github.com/ahmadnassri/har-validator/issues" + }, + "scripts": { + "lint": "standard && echint", + "pretest": "npm run lint", + "test": "tap test", + "coverage": "tap test --reporter silent --coverage" + }, + "devDependencies": { + "echint": "^4.0.1", + "standard": "^10.0.2", + "tap": "^10.3.2" + }, + "dependencies": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + } +} \ No newline at end of file diff --git a/appasar/canary/node_modules/hawk/.npmignore b/appasar/canary/node_modules/hawk/.npmignore new file mode 100644 index 0000000..7144676 --- /dev/null +++ b/appasar/canary/node_modules/hawk/.npmignore @@ -0,0 +1,5 @@ +* +!lib/** +!dist/** +!client.js +!.npmignore diff --git a/appasar/canary/node_modules/hawk/LICENSE b/appasar/canary/node_modules/hawk/LICENSE new file mode 100644 index 0000000..b43dce1 --- /dev/null +++ b/appasar/canary/node_modules/hawk/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2012-2017, Eran Hammer and Project contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * The names of any contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * * * + +The complete list of contributors can be found at: https://github.com/hueniverse/hawk/graphs/contributors diff --git a/appasar/canary/node_modules/hawk/README.md b/appasar/canary/node_modules/hawk/README.md new file mode 100644 index 0000000..fc5dd6d --- /dev/null +++ b/appasar/canary/node_modules/hawk/README.md @@ -0,0 +1,637 @@ +![hawk Logo](https://raw.github.com/hueniverse/hawk/master/images/hawk.png) + +<img align="right" src="https://raw.github.com/hueniverse/hawk/master/images/logo.png" /> **Hawk** is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial +HTTP request cryptographic verification. For more complex use cases such as access delegation, see [Oz](https://github.com/hueniverse/oz). + +Current version: **6.x** + +Note: 6.x, 5.x, 4.x, 3.x, and 2.x are the same exact protocol as 1.1. The version increments reflect changes in the node API. + +[![Build Status](https://travis-ci.org/hueniverse/hawk.svg?branch=master)](https://travis-ci.org/hueniverse/hawk) + +# Table of Content + +- [**Introduction**](#introduction) + - [Replay Protection](#replay-protection) + - [Usage Example](#usage-example) + - [Protocol Example](#protocol-example) + - [Payload Validation](#payload-validation) + - [Response Payload Validation](#response-payload-validation) + - [Browser Support and Considerations](#browser-support-and-considerations) +- [**Single URI Authorization**](#single-uri-authorization) + - [Usage Example](#bewit-usage-example) +- [**Security Considerations**](#security-considerations) + - [MAC Keys Transmission](#mac-keys-transmission) + - [Confidentiality of Requests](#confidentiality-of-requests) + - [Spoofing by Counterfeit Servers](#spoofing-by-counterfeit-servers) + - [Plaintext Storage of Credentials](#plaintext-storage-of-credentials) + - [Entropy of Keys](#entropy-of-keys) + - [Coverage Limitations](#coverage-limitations) + - [Future Time Manipulation](#future-time-manipulation) + - [Client Clock Poisoning](#client-clock-poisoning) + - [Bewit Limitations](#bewit-limitations) + - [Host Header Forgery](#host-header-forgery) +- [**Frequently Asked Questions**](#frequently-asked-questions) +- [**Implementations**](#implementations) +- [**Acknowledgements**](#acknowledgements) + +# Introduction + +**Hawk** is an HTTP authentication scheme providing mechanisms for making authenticated HTTP requests with +partial cryptographic verification of the request and response, covering the HTTP method, request URI, host, +and optionally the request payload. + +Similar to the HTTP [Digest access authentication schemes](http://www.ietf.org/rfc/rfc2617.txt), **Hawk** uses a set of +client credentials which include an identifier (e.g. username) and key (e.g. password). Likewise, just as with the Digest scheme, +the key is never included in authenticated requests. Instead, it is used to calculate a request MAC value which is +included in its place. + +However, **Hawk** has several differences from Digest. In particular, while both use a nonce to limit the possibility of +replay attacks, in **Hawk** the client generates the nonce and uses it in combination with a timestamp, leading to less +"chattiness" (interaction with the server). + +Also unlike Digest, this scheme is not intended to protect the key itself (the password in Digest) because +the client and server must both have access to the key material in the clear. + +The primary design goals of this scheme are to: +* simplify and improve HTTP authentication for services that are unwilling or unable to deploy TLS for all resources, +* secure credentials against leakage (e.g., when the client uses some form of dynamic configuration to determine where + to send an authenticated request), and +* avoid the exposure of credentials sent to a malicious server over an unauthenticated secure channel due to client + failure to validate the server's identity as part of its TLS handshake. + +In addition, **Hawk** supports a method for granting third-parties temporary access to individual resources using +a query parameter called _bewit_ (in falconry, a leather strap used to attach a tracking device to the leg of a hawk). + +The **Hawk** scheme requires the establishment of a shared symmetric key between the client and the server, +which is beyond the scope of this module. Typically, the shared credentials are established via an initial +TLS-protected phase or derived from some other shared confidential information available to both the client +and the server. + + +## Replay Protection + +Without replay protection, an attacker can use a compromised (but otherwise valid and authenticated) request more +than once, gaining access to a protected resource. To mitigate this, clients include both a nonce and a timestamp when +making requests. This gives the server enough information to prevent replay attacks. + +The nonce is generated by the client, and is a string unique across all requests with the same timestamp and +key identifier combination. + +The timestamp enables the server to restrict the validity period of the credentials where requests occurring afterwards +are rejected. It also removes the need for the server to retain an unbounded number of nonce values for future checks. +By default, **Hawk** uses a time window of 1 minute to allow for time skew between the client and server (which in +practice translates to a maximum of 2 minutes as the skew can be positive or negative). + +Using a timestamp requires the client's clock to be in sync with the server's clock. **Hawk** requires both the client +clock and the server clock to use NTP to ensure synchronization. However, given the limitations of some client types +(e.g. browsers) to deploy NTP, the server provides the client with its current time (in seconds precision) in response +to a bad timestamp. + +There is no expectation that the client will adjust its system clock to match the server (in fact, this would be a +potential attack vector). Instead, the client only uses the server's time to calculate an offset used only +for communications with that particular server. The protocol rewards clients with synchronized clocks by reducing +the number of round trips required to authenticate the first request. + + +## Usage Example + +Server code: + +```javascript +const Http = require('http'); +const Hawk = require('hawk'); + + +// Credentials lookup function + +const credentialsFunc = function (id, callback) { + + const credentials = { + key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn', + algorithm: 'sha256', + user: 'Steve' + }; + + return callback(null, credentials); +}; + +// Create HTTP server + +const handler = function (req, res) { + + // Authenticate incoming request + + Hawk.server.authenticate(req, credentialsFunc, {}, (err, credentials, artifacts) => { + + // Prepare response + + const payload = (!err ? `Hello ${credentials.user} ${artifacts.ext}` : 'Shoosh!'); + const headers = { 'Content-Type': 'text/plain' }; + + // Generate Server-Authorization response header + + const header = Hawk.server.header(credentials, artifacts, { payload, contentType: headers['Content-Type'] }); + headers['Server-Authorization'] = header; + + // Send the response back + + res.writeHead(!err ? 200 : 401, headers); + res.end(payload); + }); +}; + +// Start server + +Http.createServer(handler).listen(8000, 'example.com'); +``` + +Client code: + +```javascript +const Request = require('request'); +const Hawk = require('hawk'); + + +// Client credentials + +const credentials = { + id: 'dh37fgj492je', + key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn', + algorithm: 'sha256' +} + +// Request options + +const requestOptions = { + uri: 'http://example.com:8000/resource/1?b=1&a=2', + method: 'GET', + headers: {} +}; + +// Generate Authorization request header + +const header = Hawk.client.header('http://example.com:8000/resource/1?b=1&a=2', 'GET', { credentials: credentials, ext: 'some-app-data' }); +requestOptions.headers.Authorization = header.field; + +// Send authenticated request + +Request(requestOptions, function (error, response, body) { + + // Authenticate the server's response + + const isValid = Hawk.client.authenticate(response, credentials, header.artifacts, { payload: body }); + + // Output results + + console.log(`${response.statusCode}: ${body}` + (isValid ? ' (valid)' : ' (invalid)')); +}); +``` + +**Hawk** utilized the [**SNTP**](https://github.com/hueniverse/sntp) module for time sync management. By default, the local +machine time is used. To automatically retrieve and synchronize the clock within the application, use the SNTP 'start()' method. + +```javascript +Hawk.sntp.start(); +``` + + +## Protocol Example + +The client attempts to access a protected resource without authentication, sending the following HTTP request to +the resource server: + +``` +GET /resource/1?b=1&a=2 HTTP/1.1 +Host: example.com:8000 +``` + +The resource server returns an authentication challenge. + +``` +HTTP/1.1 401 Unauthorized +WWW-Authenticate: Hawk +``` + +The client has previously obtained a set of **Hawk** credentials for accessing resources on the "`http://example.com/`" +server. The **Hawk** credentials issued to the client include the following attributes: + +* Key identifier: `dh37fgj492je` +* Key: `werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn` +* Algorithm: `hmac sha256` +* Hash: `6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=` + +The client generates the authentication header by calculating a timestamp (e.g. the number of seconds since January 1, +1970 00:00:00 GMT), generating a nonce, and constructing the normalized request string (each value followed by a newline +character): + +``` +hawk.1.header +1353832234 +j4h3g2 +GET +/resource/1?b=1&a=2 +example.com +8000 + +some-app-ext-data + +``` + +The request MAC is calculated using HMAC with the specified hash algorithm "`sha256`" and the key over the normalized request string. +The result is base64-encoded to produce the request MAC: + +``` +6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE= +``` + +The client includes the **Hawk** key identifier, timestamp, nonce, application specific data, and request MAC with the request using +the HTTP `Authorization` request header field: + +``` +GET /resource/1?b=1&a=2 HTTP/1.1 +Host: example.com:8000 +Authorization: Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=" +``` + +The server validates the request by calculating the request MAC again based on the request received and verifies the validity +and scope of the **Hawk** credentials. If valid, the server responds with the requested resource. + + +### Payload Validation + +**Hawk** provides optional payload validation. When generating the authentication header, the client calculates a payload hash +using the specified hash algorithm. The hash is calculated over the concatenated value of (each followed by a newline character): +* `hawk.1.payload` +* the content-type in lowercase, without any parameters (e.g. `application/json`) +* the request payload prior to any content encoding (the exact representation requirements should be specified by the server for payloads other than simple single-part ascii to ensure interoperability) + +For example: + +* Payload: `Thank you for flying Hawk` +* Content Type: `text/plain` +* Algorithm: `sha256` +* Hash: `Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=` + +Results in the following input to the payload hash function (newline terminated values): + +``` +hawk.1.payload +text/plain +Thank you for flying Hawk + +``` + +Which produces the following hash value: + +``` +Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY= +``` + +The client constructs the normalized request string (newline terminated values): + +``` +hawk.1.header +1353832234 +j4h3g2 +POST +/resource/1?a=1&b=2 +example.com +8000 +Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY= +some-app-ext-data + +``` + +Then calculates the request MAC and includes the **Hawk** key identifier, timestamp, nonce, payload hash, application specific data, +and request MAC, with the request using the HTTP `Authorization` request header field: + +``` +POST /resource/1?a=1&b=2 HTTP/1.1 +Host: example.com:8000 +Authorization: Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", hash="Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=", ext="some-app-ext-data", mac="aSe1DERmZuRl3pI36/9BdZmnErTw3sNzOOAUlfeKjVw=" +``` + +It is up to the server if and when it validates the payload for any given request, based solely on its security policy +and the nature of the data included. + +If the payload is available at the time of authentication, the server uses the hash value provided by the client to construct +the normalized string and validates the MAC. If the MAC is valid, the server calculates the payload hash and compares the value +with the provided payload hash in the header. In many cases, checking the MAC first is faster than calculating the payload hash. + +However, if the payload is not available at authentication time (e.g. too large to fit in memory, streamed elsewhere, or processed +at a different stage in the application), the server may choose to defer payload validation for later by retaining the hash value +provided by the client after validating the MAC. + +It is important to note that MAC validation does not mean the hash value provided by the client is valid, only that the value +included in the header was not modified. Without calculating the payload hash on the server and comparing it to the value provided +by the client, the payload may be modified by an attacker. + + +## Response Payload Validation + +**Hawk** provides partial response payload validation. The server includes the `Server-Authorization` response header which enables the +client to authenticate the response and ensure it is talking to the right server. **Hawk** defines the HTTP `Server-Authorization` header +as a response header using the exact same syntax as the `Authorization` request header field. + +The header is constructed using the same process as the client's request header. The server uses the same credentials and other +artifacts provided by the client to constructs the normalized request string. The `ext` and `hash` values are replaced with +new values based on the server response. The rest as identical to those used by the client. + +The result MAC digest is included with the optional `hash` and `ext` values: + +``` +Server-Authorization: Hawk mac="XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific" +``` + + +## Browser Support and Considerations + +A browser script is provided for including using a `<script>` tag in [lib/browser.js](/lib/browser.js). It's also a [component](http://component.io/hueniverse/hawk). + +**Hawk** relies on the _Server-Authorization_ and _WWW-Authenticate_ headers in its response to communicate with the client. +Therefore, in case of CORS requests, it is important to consider sending _Access-Control-Expose-Headers_ with the value +_"WWW-Authenticate, Server-Authorization"_ on each response from your server. As explained in the +[specifications](http://www.w3.org/TR/cors/#access-control-expose-headers-response-header), it will indicate that these headers +can safely be accessed by the client (using getResponseHeader() on the XmlHttpRequest object). Otherwise you will be met with a +["simple response header"](http://www.w3.org/TR/cors/#simple-response-header) which excludes these fields and would prevent the +Hawk client from authenticating the requests.You can read more about the why and how in this +[article](http://www.html5rocks.com/en/tutorials/cors/#toc-adding-cors-support-to-the-server) + + +# Single URI Authorization + +There are cases in which limited and short-term access to a protected resource is granted to a third party which does not +have access to the shared credentials. For example, displaying a protected image on a web page accessed by anyone. **Hawk** +provides limited support for such URIs in the form of a _bewit_ - a URI query parameter appended to the request URI which contains +the necessary credentials to authenticate the request. + +Because of the significant security risks involved in issuing such access, bewit usage is purposely limited only to GET requests +and for a finite period of time. Both the client and server can issue bewit credentials, however, the server should not use the same +credentials as the client to maintain clear traceability as to who issued which credentials. + +In order to simplify implementation, bewit credentials do not support single-use policy and can be replayed multiple times within +the granted access timeframe. + + +## Bewit Usage Example + +Server code: + +```javascript +const Http = require('http'); +const Hawk = require('hawk'); + + +// Credentials lookup function + +const credentialsFunc = function (id, callback) { + + const credentials = { + key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn', + algorithm: 'sha256' + }; + + return callback(null, credentials); +}; + +// Create HTTP server + +const handler = function (req, res) { + + Hawk.uri.authenticate(req, credentialsFunc, {}, (err, credentials, attributes) => { + + res.writeHead(!err ? 200 : 401, { 'Content-Type': 'text/plain' }); + res.end(!err ? 'Access granted' : 'Shoosh!'); + }); +}; + +Http.createServer(handler).listen(8000, 'example.com'); +``` + +Bewit code generation: + +```javascript +const Request = require('request'); +const Hawk = require('hawk'); + + +// Client credentials + +const credentials = { + id: 'dh37fgj492je', + key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn', + algorithm: 'sha256' +} + +// Generate bewit + +const duration = 60 * 5; // 5 Minutes +const bewit = Hawk.uri.getBewit('http://example.com:8000/resource/1?b=1&a=2', { credentials: credentials, ttlSec: duration, ext: 'some-app-data' }); +const uri = 'http://example.com:8000/resource/1?b=1&a=2' + '&bewit=' + bewit; + +// Output URI + +console.log('URI: ' + uri); +``` + + +# Security Considerations + +The greatest sources of security risks are usually found not in **Hawk** but in the policies and procedures surrounding its use. +Implementers are strongly encouraged to assess how this module addresses their security requirements. This section includes +an incomplete list of security considerations that must be reviewed and understood before deploying **Hawk** on the server. +Many of the protections provided in **Hawk** depends on whether and how they are used. + +### MAC Keys Transmission + +**Hawk** does not provide any mechanism for obtaining or transmitting the set of shared credentials required. Any mechanism used +to obtain **Hawk** credentials must ensure that these transmissions are protected using transport-layer mechanisms such as TLS. + +### Confidentiality of Requests + +While **Hawk** provides a mechanism for verifying the integrity of HTTP requests, it provides no guarantee of request +confidentiality. Unless other precautions are taken, eavesdroppers will have full access to the request content. Servers should +carefully consider the types of data likely to be sent as part of such requests, and employ transport-layer security mechanisms +to protect sensitive resources. + +### Spoofing by Counterfeit Servers + +**Hawk** provides limited verification of the server authenticity. When receiving a response back from the server, the server +may choose to include a response `Server-Authorization` header which the client can use to verify the response. However, it is up to +the server to determine when such measure is included, to up to the client to enforce that policy. + +A hostile party could take advantage of this by intercepting the client's requests and returning misleading or otherwise +incorrect responses. Service providers should consider such attacks when developing services using this protocol, and should +require transport-layer security for any requests where the authenticity of the resource server or of server responses is an issue. + +### Plaintext Storage of Credentials + +The **Hawk** key functions the same way passwords do in traditional authentication systems. In order to compute the request MAC, +the server must have access to the key in plaintext form. This is in contrast, for example, to modern operating systems, which +store only a one-way hash of user credentials. + +If an attacker were to gain access to these keys - or worse, to the server's database of all such keys - he or she would be able +to perform any action on behalf of any resource owner. Accordingly, it is critical that servers protect these keys from unauthorized +access. + +### Entropy of Keys + +Unless a transport-layer security protocol is used, eavesdroppers will have full access to authenticated requests and request +MAC values, and will thus be able to mount offline brute-force attacks to recover the key used. Servers should be careful to +assign keys which are long enough, and random enough, to resist such attacks for at least the length of time that the **Hawk** +credentials are valid. + +For example, if the credentials are valid for two weeks, servers should ensure that it is not possible to mount a brute force +attack that recovers the key in less than two weeks. Of course, servers are urged to err on the side of caution, and use the +longest key reasonable. + +It is equally important that the pseudo-random number generator (PRNG) used to generate these keys be of sufficiently high +quality. Many PRNG implementations generate number sequences that may appear to be random, but which nevertheless exhibit +patterns or other weaknesses which make cryptanalysis or brute force attacks easier. Implementers should be careful to use +cryptographically secure PRNGs to avoid these problems. + +### Coverage Limitations + +The request MAC only covers the HTTP `Host` header and optionally the `Content-Type` header. It does not cover any other headers +which can often affect how the request body is interpreted by the server. If the server behavior is influenced by the presence +or value of such headers, an attacker can manipulate the request headers without being detected. Implementers should use the +`ext` feature to pass application-specific information via the `Authorization` header which is protected by the request MAC. + +The response authentication, when performed, only covers the response payload, content-type, and the request information +provided by the client in its request (method, resource, timestamp, nonce, etc.). It does not cover the HTTP status code or +any other response header field (e.g. `Location`) which can affect the client's behaviour. + +### Future Time Manipulation + +The protocol relies on a clock sync between the client and server. To accomplish this, the server informs the client of its +current time when an invalid timestamp is received. + +If an attacker is able to manipulate this information and cause the client to use an incorrect time, it would be able to cause +the client to generate authenticated requests using time in the future. Such requests will fail when sent by the client, and will +not likely leave a trace on the server (given the common implementation of nonce, if at all enforced). The attacker will then +be able to replay the request at the correct time without detection. + +The client must only use the time information provided by the server if: +* it was delivered over a TLS connection and the server identity has been verified, or +* the `tsm` MAC digest calculated using the same client credentials over the timestamp has been verified. + +### Client Clock Poisoning + +When receiving a request with a bad timestamp, the server provides the client with its current time. The client must never use +the time received from the server to adjust its own clock, and must only use it to calculate an offset for communicating with +that particular server. + +### Bewit Limitations + +Special care must be taken when issuing bewit credentials to third parties. Bewit credentials are valid until expiration and cannot +be revoked or limited without using other means. Whatever resource they grant access to will be completely exposed to anyone with +access to the bewit credentials which act as bearer credentials for that particular resource. While bewit usage is limited to GET +requests only and therefore cannot be used to perform transactions or change server state, it can still be used to expose private +and sensitive information. + +### Host Header Forgery + +Hawk validates the incoming request MAC against the incoming HTTP Host header. However, unless the optional `host` and `port` +options are used with `server.authenticate()`, a malicious client can mint new host names pointing to the server's IP address and +use that to craft an attack by sending a valid request that's meant for another hostname than the one used by the server. Server +implementors must manually verify that the host header received matches their expectation (or use the options mentioned above). + +# Frequently Asked Questions + +### Where is the protocol specification? + +If you are looking for some prose explaining how all this works, **this is it**. **Hawk** is being developed as an open source +project instead of a standard. In other words, the [code](/hueniverse/hawk/tree/master/lib) is the specification. Not sure about +something? Open an issue! + +### Is it done? + +As of version 0.10.0, **Hawk** is feature-complete. However, until this module reaches version 1.0.0 it is considered experimental +and is likely to change. This also means your feedback and contribution are very welcome. Feel free to open issues with questions +and suggestions. + +### Where can I find **Hawk** implementations in other languages? + +**Hawk**'s only reference implementation is provided in JavaScript as a node.js module. However, it has been ported to other languages. +The full list is maintained [here](https://github.com/hueniverse/hawk/issues?labels=port&state=closed). Please add an issue if you are +working on another port. A cross-platform test-suite is in the works. + +### Why isn't the algorithm part of the challenge or dynamically negotiated? + +The algorithm used is closely related to the key issued as different algorithms require different key sizes (and other +requirements). While some keys can be used for multiple algorithm, the protocol is designed to closely bind the key and algorithm +together as part of the issued credentials. + +### Why is Host and Content-Type the only headers covered by the request MAC? + +It is really hard to include other headers. Headers can be changed by proxies and other intermediaries and there is no +well-established way to normalize them. Many platforms change the case of header field names and values. The only +straight-forward solution is to include the headers in some blob (say, base64 encoded JSON) and include that with the request, +an approach taken by JWT and other such formats. However, that design violates the HTTP header boundaries, repeats information, +and introduces other security issues because firewalls will not be aware of these "hidden" headers. In addition, any information +repeated must be compared to the duplicated information in the header and therefore only moves the problem elsewhere. + +### Why not just use HTTP Digest? + +Digest requires pre-negotiation to establish a nonce. This means you can't just make a request - you must first send +a protocol handshake to the server. This pattern has become unacceptable for most web services, especially mobile +where extra round-trip are costly. + +### Why bother with all this nonce and timestamp business? + +**Hawk** is an attempt to find a reasonable, practical compromise between security and usability. OAuth 1.0 got timestamp +and nonces halfway right but failed when it came to scalability and consistent developer experience. **Hawk** addresses +it by requiring the client to sync its clock, but provides it with tools to accomplish it. + +In general, replay protection is a matter of application-specific threat model. It is less of an issue on a TLS-protected +system where the clients are implemented using best practices and are under the control of the server. Instead of dropping +replay protection, **Hawk** offers a required time window and an optional nonce verification. Together, it provides developers +with the ability to decide how to enforce their security policy without impacting the client's implementation. + +### What are `app` and `dlg` in the authorization header and normalized mac string? + +The original motivation for **Hawk** was to replace the OAuth 1.0 use cases. This included both a simple client-server mode which +this module is specifically designed for, and a delegated access mode which is being developed separately in +[Oz](https://github.com/hueniverse/oz). In addition to the **Hawk** use cases, Oz requires another attribute: the application id `app`. +This provides binding between the credentials and the application in a way that prevents an attacker from tricking an application +to use credentials issued to someone else. It also has an optional 'delegated-by' attribute `dlg` which is the application id of the +application the credentials were directly issued to. The goal of these two additions is to allow Oz to utilize **Hawk** directly, +but with the additional security of delegated credentials. + +### What is the purpose of the static strings used in each normalized MAC input? + +When calculating a hash or MAC, a static prefix (tag) is added. The prefix is used to prevent MAC values from being +used or reused for a purpose other than what they were created for (i.e. prevents switching MAC values between a request, +response, and a bewit use cases). It also protects against exploits created after a potential change in how the protocol +creates the normalized string. For example, if a future version would switch the order of nonce and timestamp, it +can create an exploit opportunity for cases where the nonce is similar in format to a timestamp. + +### Does **Hawk** have anything to do with OAuth? + +Short answer: no. + +**Hawk** was originally proposed as the OAuth MAC Token specification. However, the OAuth working group in its consistent +incompetence failed to produce a final, usable solution to address one of the most popular use cases of OAuth 1.0 - using it +to authenticate simple client-server transactions (i.e. two-legged). As you can guess, the OAuth working group is still hard +at work to produce more garbage. + +**Hawk** provides a simple HTTP authentication scheme for making client-server requests. It does not address the OAuth use case +of delegating access to a third party. If you are looking for an OAuth alternative, check out [Oz](https://github.com/hueniverse/oz). + +# Implementations + +- [Logibit Hawk in F#/.Net](https://github.com/logibit/logibit.hawk/) +- [Tent Hawk in Ruby](https://github.com/tent/hawk-ruby) +- [Wealdtech in Java](https://github.com/wealdtech/hawk) +- [Kumar's Mohawk in Python](https://github.com/kumar303/mohawk/) +- [Hiyosi in Go](https://github.com/hiyosi/hawk) + +# Acknowledgements + +**Hawk** is a derivative work of the [HTTP MAC Authentication Scheme](http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05) proposal +co-authored by Ben Adida, Adam Barth, and Eran Hammer, which in turn was based on the OAuth 1.0 community specification. + +Special thanks to Ben Laurie for his always insightful feedback and advice. + +The **Hawk** logo was created by [Chris Carrasco](http://chriscarrasco.com). diff --git a/appasar/canary/node_modules/hawk/client.js b/appasar/canary/node_modules/hawk/client.js new file mode 100644 index 0000000..c7ff470 --- /dev/null +++ b/appasar/canary/node_modules/hawk/client.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./dist/browser'); diff --git a/appasar/canary/node_modules/hawk/dist/browser.js b/appasar/canary/node_modules/hawk/dist/browser.js new file mode 100644 index 0000000..4bb9b95 --- /dev/null +++ b/appasar/canary/node_modules/hawk/dist/browser.js @@ -0,0 +1,793 @@ +'use strict'; + +/* + HTTP Hawk Authentication Scheme + Copyright (c) 2012-2016, Eran Hammer <eran@hammer.io> + BSD Licensed +*/ + +// Declare namespace + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var hawk = { + internals: {} +}; + +hawk.client = { + + // Generate an Authorization header for a given request + + /* + uri: 'http://example.com/resource?a=b' or object generated by hawk.utils.parseUri() + method: HTTP verb (e.g. 'GET', 'POST') + options: { + // Required + credentials: { + id: 'dh37fgj492je', + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + // Optional + ext: 'application-specific', // Application specific data sent via the ext attribute + timestamp: Date.now() / 1000, // A pre-calculated timestamp in seconds + nonce: '2334f34f', // A pre-generated nonce + localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided) + payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided) + contentType: 'application/json', // Payload content-type (ignored if hash provided) + hash: 'U4MKKSmiVxk37JCCrAVIjV=', // Pre-calculated payload hash + app: '24s23423f34dx', // Oz application id + dlg: '234sz34tww3sd' // Oz delegated-by application id + } + */ + + header: function header(uri, method, options) { + + var result = { + field: '', + artifacts: {} + }; + + // Validate inputs + + if (!uri || typeof uri !== 'string' && (typeof uri === 'undefined' ? 'undefined' : _typeof(uri)) !== 'object' || !method || typeof method !== 'string' || !options || (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object') { + + result.err = 'Invalid argument type'; + return result; + } + + // Application time + + var timestamp = options.timestamp || hawk.utils.nowSec(options.localtimeOffsetMsec); + + // Validate credentials + + var credentials = options.credentials; + if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) { + + result.err = 'Invalid credentials object'; + return result; + } + + if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) { + result.err = 'Unknown algorithm'; + return result; + } + + // Parse URI + + if (typeof uri === 'string') { + uri = hawk.utils.parseUri(uri); + } + + // Calculate signature + + var artifacts = { + ts: timestamp, + nonce: options.nonce || hawk.utils.randomString(6), + method: method, + resource: uri.resource, + host: uri.host, + port: uri.port, + hash: options.hash, + ext: options.ext, + app: options.app, + dlg: options.dlg + }; + + result.artifacts = artifacts; + + // Calculate payload hash + + if (!artifacts.hash && (options.payload || options.payload === '')) { + + artifacts.hash = hawk.crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType); + } + + var mac = hawk.crypto.calculateMac('header', credentials, artifacts); + + // Construct header + + var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''; // Other falsey values allowed + var header = 'Hawk id="' + credentials.id + '", ts="' + artifacts.ts + '", nonce="' + artifacts.nonce + (artifacts.hash ? '", hash="' + artifacts.hash : '') + (hasExt ? '", ext="' + hawk.utils.escapeHeaderAttribute(artifacts.ext) : '') + '", mac="' + mac + '"'; + + if (artifacts.app) { + header += ', app="' + artifacts.app + (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"'; + } + + result.field = header; + + return result; + }, + + // Generate a bewit value for a given URI + + /* + uri: 'http://example.com/resource?a=b' + options: { + // Required + credentials: { + id: 'dh37fgj492je', + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + ttlSec: 60 * 60, // TTL in seconds + // Optional + ext: 'application-specific', // Application specific data sent via the ext attribute + localtimeOffsetMsec: 400 // Time offset to sync with server time + }; + */ + + bewit: function bewit(uri, options) { + + // Validate inputs + + if (!uri || typeof uri !== 'string' || !options || (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' || !options.ttlSec) { + + return ''; + } + + options.ext = options.ext === null || options.ext === undefined ? '' : options.ext; // Zero is valid value + + // Application time + + var now = hawk.utils.nowSec(options.localtimeOffsetMsec); + + // Validate credentials + + var credentials = options.credentials; + if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) { + + return ''; + } + + if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return ''; + } + + // Parse URI + + uri = hawk.utils.parseUri(uri); + + // Calculate signature + + var exp = now + options.ttlSec; + var mac = hawk.crypto.calculateMac('bewit', credentials, { + ts: exp, + nonce: '', + method: 'GET', + resource: uri.resource, // Maintain trailing '?' and query params + host: uri.host, + port: uri.port, + ext: options.ext + }); + + // Construct bewit: id\exp\mac\ext + + var bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + options.ext; + return hawk.utils.base64urlEncode(bewit); + }, + + // Validate server response + + /* + request: object created via 'new XMLHttpRequest()' after response received or fetch API 'Response' + artifacts: object received from header().artifacts + options: { + payload: optional payload received + required: specifies if a Server-Authorization header is required. Defaults to 'false' + } + */ + + authenticate: function authenticate(request, credentials, artifacts, options) { + + options = options || {}; + + var getHeader = function getHeader(name) { + + // Fetch API or plain headers + + if (request.headers) { + return typeof request.headers.get === 'function' ? request.headers.get(name) : request.headers[name]; + } + + // XMLHttpRequest + + return request.getResponseHeader ? request.getResponseHeader(name) : request.getHeader(name); + }; + + var wwwAuthenticate = getHeader('www-authenticate'); + if (wwwAuthenticate) { + + // Parse HTTP WWW-Authenticate header + + var wwwAttributes = hawk.utils.parseAuthorizationHeader(wwwAuthenticate, ['ts', 'tsm', 'error']); + if (!wwwAttributes) { + return false; + } + + if (wwwAttributes.ts) { + var tsm = hawk.crypto.calculateTsMac(wwwAttributes.ts, credentials); + if (tsm !== wwwAttributes.tsm) { + return false; + } + + hawk.utils.setNtpSecOffset(wwwAttributes.ts - Math.floor(Date.now() / 1000)); // Keep offset at 1 second precision + } + } + + // Parse HTTP Server-Authorization header + + var serverAuthorization = getHeader('server-authorization'); + if (!serverAuthorization && !options.required) { + + return true; + } + + var attributes = hawk.utils.parseAuthorizationHeader(serverAuthorization, ['mac', 'ext', 'hash']); + if (!attributes) { + return false; + } + + var modArtifacts = { + ts: artifacts.ts, + nonce: artifacts.nonce, + method: artifacts.method, + resource: artifacts.resource, + host: artifacts.host, + port: artifacts.port, + hash: attributes.hash, + ext: attributes.ext, + app: artifacts.app, + dlg: artifacts.dlg + }; + + var mac = hawk.crypto.calculateMac('response', credentials, modArtifacts); + if (mac !== attributes.mac) { + return false; + } + + if (!options.payload && options.payload !== '') { + + return true; + } + + if (!attributes.hash) { + return false; + } + + var calculatedHash = hawk.crypto.calculatePayloadHash(options.payload, credentials.algorithm, getHeader('content-type')); + return calculatedHash === attributes.hash; + }, + + message: function message(host, port, _message, options) { + + // Validate inputs + + if (!host || typeof host !== 'string' || !port || typeof port !== 'number' || _message === null || _message === undefined || typeof _message !== 'string' || !options || (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object') { + + return null; + } + + // Application time + + var timestamp = options.timestamp || hawk.utils.nowSec(options.localtimeOffsetMsec); + + // Validate credentials + + var credentials = options.credentials; + if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) { + + // Invalid credential object + return null; + } + + if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return null; + } + + // Calculate signature + + var artifacts = { + ts: timestamp, + nonce: options.nonce || hawk.utils.randomString(6), + host: host, + port: port, + hash: hawk.crypto.calculatePayloadHash(_message, credentials.algorithm) + }; + + // Construct authorization + + var result = { + id: credentials.id, + ts: artifacts.ts, + nonce: artifacts.nonce, + hash: artifacts.hash, + mac: hawk.crypto.calculateMac('message', credentials, artifacts) + }; + + return result; + }, + + authenticateTimestamp: function authenticateTimestamp(message, credentials, updateClock) { + // updateClock defaults to true + + var tsm = hawk.crypto.calculateTsMac(message.ts, credentials); + if (tsm !== message.tsm) { + return false; + } + + if (updateClock !== false) { + hawk.utils.setNtpSecOffset(message.ts - Math.floor(Date.now() / 1000)); // Keep offset at 1 second precision + } + + return true; + } +}; + +hawk.crypto = { + + headerVersion: '1', + + algorithms: ['sha1', 'sha256'], + + calculateMac: function calculateMac(type, credentials, options) { + + var normalized = hawk.crypto.generateNormalizedString(type, options); + + var hmac = CryptoJS['Hmac' + credentials.algorithm.toUpperCase()](normalized, credentials.key); + return hmac.toString(CryptoJS.enc.Base64); + }, + + generateNormalizedString: function generateNormalizedString(type, options) { + + var normalized = 'hawk.' + hawk.crypto.headerVersion + '.' + type + '\n' + options.ts + '\n' + options.nonce + '\n' + (options.method || '').toUpperCase() + '\n' + (options.resource || '') + '\n' + options.host.toLowerCase() + '\n' + options.port + '\n' + (options.hash || '') + '\n'; + + if (options.ext) { + normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n'); + } + + normalized += '\n'; + + if (options.app) { + normalized += options.app + '\n' + (options.dlg || '') + '\n'; + } + + return normalized; + }, + + calculatePayloadHash: function calculatePayloadHash(payload, algorithm, contentType) { + + var hash = CryptoJS.algo[algorithm.toUpperCase()].create(); + hash.update('hawk.' + hawk.crypto.headerVersion + '.payload\n'); + hash.update(hawk.utils.parseContentType(contentType) + '\n'); + hash.update(payload); + hash.update('\n'); + return hash.finalize().toString(CryptoJS.enc.Base64); + }, + + calculateTsMac: function calculateTsMac(ts, credentials) { + + var hash = CryptoJS['Hmac' + credentials.algorithm.toUpperCase()]('hawk.' + hawk.crypto.headerVersion + '.ts\n' + ts + '\n', credentials.key); + return hash.toString(CryptoJS.enc.Base64); + } +}; + +// localStorage compatible interface + +hawk.internals.LocalStorage = function () { + + this._cache = {}; + this.length = 0; + + this.getItem = function (key) { + + return this._cache.hasOwnProperty(key) ? String(this._cache[key]) : null; + }; + + this.setItem = function (key, value) { + + this._cache[key] = String(value); + this.length = Object.keys(this._cache).length; + }; + + this.removeItem = function (key) { + + delete this._cache[key]; + this.length = Object.keys(this._cache).length; + }; + + this.clear = function () { + + this._cache = {}; + this.length = 0; + }; + + this.key = function (i) { + + return Object.keys(this._cache)[i || 0]; + }; +}; + +hawk.utils = { + + storage: new hawk.internals.LocalStorage(), + + setStorage: function setStorage(storage) { + + var ntpOffset = hawk.utils.storage.getItem('hawk_ntp_offset'); + hawk.utils.storage = storage; + if (ntpOffset) { + hawk.utils.setNtpSecOffset(ntpOffset); + } + }, + + setNtpSecOffset: function setNtpSecOffset(offset) { + + try { + hawk.utils.storage.setItem('hawk_ntp_offset', offset); + } catch (err) { + console.error('[hawk] could not write to storage.'); + console.error(err); + } + }, + + getNtpSecOffset: function getNtpSecOffset() { + + var offset = hawk.utils.storage.getItem('hawk_ntp_offset'); + if (!offset) { + return 0; + } + + return parseInt(offset, 10); + }, + + now: function now(localtimeOffsetMsec) { + + return Date.now() + (localtimeOffsetMsec || 0) + hawk.utils.getNtpSecOffset() * 1000; + }, + + nowSec: function nowSec(localtimeOffsetMsec) { + + return Math.floor(hawk.utils.now(localtimeOffsetMsec) / 1000); + }, + + escapeHeaderAttribute: function escapeHeaderAttribute(attribute) { + + return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); + }, + + parseContentType: function parseContentType(header) { + + if (!header) { + return ''; + } + + return header.split(';')[0].replace(/^\s+|\s+$/g, '').toLowerCase(); + }, + + parseAuthorizationHeader: function parseAuthorizationHeader(header, keys) { + + if (!header) { + return null; + } + + var headerParts = header.match(/^(\w+)(?:\s+(.*))?$/); // Header: scheme[ something] + if (!headerParts) { + return null; + } + + var scheme = headerParts[1]; + if (scheme.toLowerCase() !== 'hawk') { + return null; + } + + var attributesString = headerParts[2]; + if (!attributesString) { + return null; + } + + var attributes = {}; + var verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, function ($0, $1, $2) { + + // Check valid attribute names + + if (keys.indexOf($1) === -1) { + return; + } + + // Allowed attribute value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9 + + if ($2.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/) === null) { + return; + } + + // Check for duplicates + + if (attributes.hasOwnProperty($1)) { + return; + } + + attributes[$1] = $2; + return ''; + }); + + if (verify !== '') { + return null; + } + + return attributes; + }, + + randomString: function randomString(size) { + + var randomSource = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + var len = randomSource.length; + + var result = []; + for (var i = 0; i < size; ++i) { + result[i] = randomSource[Math.floor(Math.random() * len)]; + } + + return result.join(''); + }, + + // 1 2 3 4 + uriRegex: /^([^:]+)\:\/\/(?:[^@/]*@)?([^\/:]+)(?:\:(\d+))?([^#]*)(?:#.*)?$/, // scheme://credentials@host:port/resource#fragment + parseUri: function parseUri(input) { + + var parts = input.match(hawk.utils.uriRegex); + if (!parts) { + return { host: '', port: '', resource: '' }; + } + + var scheme = parts[1].toLowerCase(); + var uri = { + host: parts[2], + port: parts[3] || (scheme === 'http' ? '80' : scheme === 'https' ? '443' : ''), + resource: parts[4] + }; + + return uri; + }, + + base64urlEncode: function base64urlEncode(value) { + + var wordArray = CryptoJS.enc.Utf8.parse(value); + var encoded = CryptoJS.enc.Base64.stringify(wordArray); + return encoded.replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); + } +}; + +// $lab:coverage:off$ +/* eslint-disable */ + +// Based on: Crypto-JS v3.1.2 +// Copyright (c) 2009-2013, Jeff Mott. All rights reserved. +// http://code.google.com/p/crypto-js/ +// http://code.google.com/p/crypto-js/wiki/License + +var CryptoJS = CryptoJS || function (h, r) { + var k = {}, + l = k.lib = {}, + n = function n() {}, + f = l.Base = { extend: function extend(a) { + n.prototype = this;var b = new n();a && b.mixIn(a);b.hasOwnProperty("init") || (b.init = function () { + b.$super.init.apply(this, arguments); + });b.init.prototype = b;b.$super = this;return b; + }, create: function create() { + var a = this.extend();a.init.apply(a, arguments);return a; + }, init: function init() {}, mixIn: function mixIn(a) { + for (var _b in a) { + a.hasOwnProperty(_b) && (this[_b] = a[_b]); + }a.hasOwnProperty("toString") && (this.toString = a.toString); + }, clone: function clone() { + return this.init.prototype.extend(this); + } }, + j = l.WordArray = f.extend({ init: function init(a, b) { + a = this.words = a || [];this.sigBytes = b != r ? b : 4 * a.length; + }, toString: function toString(a) { + return (a || s).stringify(this); + }, concat: function concat(a) { + var b = this.words, + d = a.words, + c = this.sigBytes;a = a.sigBytes;this.clamp();if (c % 4) for (var e = 0; e < a; e++) { + b[c + e >>> 2] |= (d[e >>> 2] >>> 24 - 8 * (e % 4) & 255) << 24 - 8 * ((c + e) % 4); + } else if (65535 < d.length) for (var _e = 0; _e < a; _e += 4) { + b[c + _e >>> 2] = d[_e >>> 2]; + } else b.push.apply(b, d);this.sigBytes += a;return this; + }, clamp: function clamp() { + var a = this.words, + b = this.sigBytes;a[b >>> 2] &= 4294967295 << 32 - 8 * (b % 4);a.length = h.ceil(b / 4); + }, clone: function clone() { + var a = f.clone.call(this);a.words = this.words.slice(0);return a; + }, random: function random(a) { + for (var _b2 = [], d = 0; d < a; d += 4) { + _b2.push(4294967296 * h.random() | 0); + }return new j.init(b, a); + } }), + m = k.enc = {}, + s = m.Hex = { stringify: function stringify(a) { + var b = a.words;a = a.sigBytes;for (var d = [], c = 0; c < a; c++) { + var e = b[c >>> 2] >>> 24 - 8 * (c % 4) & 255;d.push((e >>> 4).toString(16));d.push((e & 15).toString(16)); + }return d.join(""); + }, parse: function parse(a) { + for (var b = a.length, d = [], c = 0; c < b; c += 2) { + d[c >>> 3] |= parseInt(a.substr(c, 2), 16) << 24 - 4 * (c % 8); + }return new j.init(d, b / 2); + } }, + p = m.Latin1 = { stringify: function stringify(a) { + var b = a.words;a = a.sigBytes;for (var d = [], c = 0; c < a; c++) { + d.push(String.fromCharCode(b[c >>> 2] >>> 24 - 8 * (c % 4) & 255)); + }return d.join(""); + }, parse: function parse(a) { + for (var b = a.length, d = [], c = 0; c < b; c++) { + d[c >>> 2] |= (a.charCodeAt(c) & 255) << 24 - 8 * (c % 4); + }return new j.init(d, b); + } }, + t = m.Utf8 = { stringify: function stringify(a) { + try { + return decodeURIComponent(escape(p.stringify(a))); + } catch (b) { + throw Error("Malformed UTF-8 data"); + } + }, parse: function parse(a) { + return p.parse(unescape(encodeURIComponent(a))); + } }, + q = l.BufferedBlockAlgorithm = f.extend({ reset: function reset() { + this._data = new j.init();this._nDataBytes = 0; + }, _append: function _append(a) { + "string" == typeof a && (a = t.parse(a));this._data.concat(a);this._nDataBytes += a.sigBytes; + }, _process: function _process(a) { + var b = this._data, + d = b.words, + c = b.sigBytes, + e = this.blockSize, + f = c / (4 * e), + f = a ? h.ceil(f) : h.max((f | 0) - this._minBufferSize, 0);a = f * e;c = h.min(4 * a, c);if (a) { + for (var g = 0; g < a; g += e) { + this._doProcessBlock(d, g); + }g = d.splice(0, a);b.sigBytes -= c; + }return new j.init(g, c); + }, clone: function clone() { + var a = f.clone.call(this);a._data = this._data.clone();return a; + }, _minBufferSize: 0 });l.Hasher = q.extend({ cfg: f.extend(), init: function init(a) { + this.cfg = this.cfg.extend(a);this.reset(); + }, reset: function reset() { + q.reset.call(this);this._doReset(); + }, update: function update(a) { + this._append(a);this._process();return this; + }, finalize: function finalize(a) { + a && this._append(a);return this._doFinalize(); + }, blockSize: 16, _createHelper: function _createHelper(a) { + return function (b, d) { + return new a.init(d).finalize(b); + }; + }, _createHmacHelper: function _createHmacHelper(a) { + return function (b, d) { + return new u.HMAC.init(a, d).finalize(b); + }; + } });var u = k.algo = {};return k; +}(Math); +(function () { + var k = CryptoJS, + b = k.lib, + m = b.WordArray, + l = b.Hasher, + d = [], + b = k.algo.SHA1 = l.extend({ _doReset: function _doReset() { + this._hash = new m.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]); + }, _doProcessBlock: function _doProcessBlock(n, p) { + for (var a = this._hash.words, e = a[0], f = a[1], h = a[2], j = a[3], b = a[4], c = 0; 80 > c; c++) { + if (16 > c) d[c] = n[p + c] | 0;else { + var g = d[c - 3] ^ d[c - 8] ^ d[c - 14] ^ d[c - 16];d[c] = g << 1 | g >>> 31; + }g = (e << 5 | e >>> 27) + b + d[c];g = 20 > c ? g + ((f & h | ~f & j) + 1518500249) : 40 > c ? g + ((f ^ h ^ j) + 1859775393) : 60 > c ? g + ((f & h | f & j | h & j) - 1894007588) : g + ((f ^ h ^ j) - 899497514);b = j;j = h;h = f << 30 | f >>> 2;f = e;e = g; + }a[0] = a[0] + e | 0;a[1] = a[1] + f | 0;a[2] = a[2] + h | 0;a[3] = a[3] + j | 0;a[4] = a[4] + b | 0; + }, _doFinalize: function _doFinalize() { + var b = this._data, + d = b.words, + a = 8 * this._nDataBytes, + e = 8 * b.sigBytes;d[e >>> 5] |= 128 << 24 - e % 32;d[(e + 64 >>> 9 << 4) + 14] = Math.floor(a / 4294967296);d[(e + 64 >>> 9 << 4) + 15] = a;b.sigBytes = 4 * d.length;this._process();return this._hash; + }, clone: function clone() { + var b = l.clone.call(this);b._hash = this._hash.clone();return b; + } });k.SHA1 = l._createHelper(b);k.HmacSHA1 = l._createHmacHelper(b); +})(); +(function (k) { + for (var g = CryptoJS, h = g.lib, v = h.WordArray, j = h.Hasher, h = g.algo, s = [], t = [], u = function u(q) { + return 4294967296 * (q - (q | 0)) | 0; + }, l = 2, b = 0; 64 > b;) { + var d;a: { + d = l;for (var w = k.sqrt(d), r = 2; r <= w; r++) { + if (!(d % r)) { + d = !1;break a; + } + }d = !0; + }d && (8 > b && (s[b] = u(k.pow(l, 0.5))), t[b] = u(k.pow(l, 1 / 3)), b++);l++; + }var n = [], + h = h.SHA256 = j.extend({ _doReset: function _doReset() { + this._hash = new v.init(s.slice(0)); + }, _doProcessBlock: function _doProcessBlock(q, h) { + for (var a = this._hash.words, c = a[0], d = a[1], b = a[2], k = a[3], f = a[4], g = a[5], j = a[6], l = a[7], e = 0; 64 > e; e++) { + if (16 > e) n[e] = q[h + e] | 0;else { + var m = n[e - 15], + p = n[e - 2];n[e] = ((m << 25 | m >>> 7) ^ (m << 14 | m >>> 18) ^ m >>> 3) + n[e - 7] + ((p << 15 | p >>> 17) ^ (p << 13 | p >>> 19) ^ p >>> 10) + n[e - 16]; + }m = l + ((f << 26 | f >>> 6) ^ (f << 21 | f >>> 11) ^ (f << 7 | f >>> 25)) + (f & g ^ ~f & j) + t[e] + n[e];p = ((c << 30 | c >>> 2) ^ (c << 19 | c >>> 13) ^ (c << 10 | c >>> 22)) + (c & d ^ c & b ^ d & b);l = j;j = g;g = f;f = k + m | 0;k = b;b = d;d = c;c = m + p | 0; + }a[0] = a[0] + c | 0;a[1] = a[1] + d | 0;a[2] = a[2] + b | 0;a[3] = a[3] + k | 0;a[4] = a[4] + f | 0;a[5] = a[5] + g | 0;a[6] = a[6] + j | 0;a[7] = a[7] + l | 0; + }, _doFinalize: function _doFinalize() { + var d = this._data, + b = d.words, + a = 8 * this._nDataBytes, + c = 8 * d.sigBytes;b[c >>> 5] |= 128 << 24 - c % 32;b[(c + 64 >>> 9 << 4) + 14] = k.floor(a / 4294967296);b[(c + 64 >>> 9 << 4) + 15] = a;d.sigBytes = 4 * b.length;this._process();return this._hash; + }, clone: function clone() { + var b = j.clone.call(this);b._hash = this._hash.clone();return b; + } });g.SHA256 = j._createHelper(h);g.HmacSHA256 = j._createHmacHelper(h); +})(Math); +(function () { + var c = CryptoJS, + k = c.enc.Utf8;c.algo.HMAC = c.lib.Base.extend({ init: function init(a, b) { + a = this._hasher = new a.init();"string" == typeof b && (b = k.parse(b));var c = a.blockSize, + e = 4 * c;b.sigBytes > e && (b = a.finalize(b));b.clamp();for (var f = this._oKey = b.clone(), g = this._iKey = b.clone(), h = f.words, j = g.words, d = 0; d < c; d++) { + h[d] ^= 1549556828, j[d] ^= 909522486; + }f.sigBytes = g.sigBytes = e;this.reset(); + }, reset: function reset() { + var a = this._hasher;a.reset();a.update(this._iKey); + }, update: function update(a) { + this._hasher.update(a);return this; + }, finalize: function finalize(a) { + var b = this._hasher;a = b.finalize(a);b.reset();return b.finalize(this._oKey.clone().concat(a)); + } }); +})(); +(function () { + var h = CryptoJS, + j = h.lib.WordArray;h.enc.Base64 = { stringify: function stringify(b) { + var e = b.words, + f = b.sigBytes, + c = this._map;b.clamp();b = [];for (var a = 0; a < f; a += 3) { + for (var d = (e[a >>> 2] >>> 24 - 8 * (a % 4) & 255) << 16 | (e[a + 1 >>> 2] >>> 24 - 8 * ((a + 1) % 4) & 255) << 8 | e[a + 2 >>> 2] >>> 24 - 8 * ((a + 2) % 4) & 255, g = 0; 4 > g && a + 0.75 * g < f; g++) { + b.push(c.charAt(d >>> 6 * (3 - g) & 63)); + } + }if (e = c.charAt(64)) for (; b.length % 4;) { + b.push(e); + }return b.join(""); + }, parse: function parse(b) { + var e = b.length, + f = this._map, + c = f.charAt(64);c && (c = b.indexOf(c), -1 != c && (e = c));for (var c = [], a = 0, d = 0; d < e; d++) { + if (d % 4) { + var g = f.indexOf(b.charAt(d - 1)) << 2 * (d % 4), + h = f.indexOf(b.charAt(d)) >>> 6 - 2 * (d % 4);c[a >>> 2] |= (g | h) << 24 - 8 * (a % 4);a++; + } + }return j.create(c, a); + }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" }; +})(); + +hawk.crypto.utils = CryptoJS; + +// Export if used as a module + +if (typeof module !== 'undefined' && module.exports) { + module.exports = hawk; +} + +/* eslint-enable */ +// $lab:coverage:on$ diff --git a/appasar/canary/node_modules/hawk/lib/browser.js b/appasar/canary/node_modules/hawk/lib/browser.js new file mode 100644 index 0000000..6635ce5 --- /dev/null +++ b/appasar/canary/node_modules/hawk/lib/browser.js @@ -0,0 +1,653 @@ +'use strict'; + +/* + HTTP Hawk Authentication Scheme + Copyright (c) 2012-2016, Eran Hammer <eran@hammer.io> + BSD Licensed +*/ + + +// Declare namespace + +const hawk = { + internals: {} +}; + + +hawk.client = { + + // Generate an Authorization header for a given request + + /* + uri: 'http://example.com/resource?a=b' or object generated by hawk.utils.parseUri() + method: HTTP verb (e.g. 'GET', 'POST') + options: { + + // Required + + credentials: { + id: 'dh37fgj492je', + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + + // Optional + + ext: 'application-specific', // Application specific data sent via the ext attribute + timestamp: Date.now() / 1000, // A pre-calculated timestamp in seconds + nonce: '2334f34f', // A pre-generated nonce + localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided) + payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided) + contentType: 'application/json', // Payload content-type (ignored if hash provided) + hash: 'U4MKKSmiVxk37JCCrAVIjV=', // Pre-calculated payload hash + app: '24s23423f34dx', // Oz application id + dlg: '234sz34tww3sd' // Oz delegated-by application id + } + */ + + header: function (uri, method, options) { + + const result = { + field: '', + artifacts: {} + }; + + // Validate inputs + + if (!uri || (typeof uri !== 'string' && typeof uri !== 'object') || + !method || typeof method !== 'string' || + !options || typeof options !== 'object') { + + result.err = 'Invalid argument type'; + return result; + } + + // Application time + + const timestamp = options.timestamp || hawk.utils.nowSec(options.localtimeOffsetMsec); + + // Validate credentials + + const credentials = options.credentials; + if (!credentials || + !credentials.id || + !credentials.key || + !credentials.algorithm) { + + result.err = 'Invalid credentials object'; + return result; + } + + if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) { + result.err = 'Unknown algorithm'; + return result; + } + + // Parse URI + + if (typeof uri === 'string') { + uri = hawk.utils.parseUri(uri); + } + + // Calculate signature + + const artifacts = { + ts: timestamp, + nonce: options.nonce || hawk.utils.randomString(6), + method, + resource: uri.resource, + host: uri.host, + port: uri.port, + hash: options.hash, + ext: options.ext, + app: options.app, + dlg: options.dlg + }; + + result.artifacts = artifacts; + + // Calculate payload hash + + if (!artifacts.hash && + (options.payload || options.payload === '')) { + + artifacts.hash = hawk.crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType); + } + + const mac = hawk.crypto.calculateMac('header', credentials, artifacts); + + // Construct header + + const hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''; // Other falsey values allowed + let header = 'Hawk id="' + credentials.id + + '", ts="' + artifacts.ts + + '", nonce="' + artifacts.nonce + + (artifacts.hash ? '", hash="' + artifacts.hash : '') + + (hasExt ? '", ext="' + hawk.utils.escapeHeaderAttribute(artifacts.ext) : '') + + '", mac="' + mac + '"'; + + if (artifacts.app) { + header += ', app="' + artifacts.app + + (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"'; + } + + result.field = header; + + return result; + }, + + // Generate a bewit value for a given URI + + /* + uri: 'http://example.com/resource?a=b' + options: { + + // Required + + credentials: { + id: 'dh37fgj492je', + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + ttlSec: 60 * 60, // TTL in seconds + + // Optional + + ext: 'application-specific', // Application specific data sent via the ext attribute + localtimeOffsetMsec: 400 // Time offset to sync with server time + }; + */ + + bewit: function (uri, options) { + + // Validate inputs + + if (!uri || + (typeof uri !== 'string') || + !options || + typeof options !== 'object' || + !options.ttlSec) { + + return ''; + } + + options.ext = (options.ext === null || options.ext === undefined ? '' : options.ext); // Zero is valid value + + // Application time + + const now = hawk.utils.nowSec(options.localtimeOffsetMsec); + + // Validate credentials + + const credentials = options.credentials; + if (!credentials || + !credentials.id || + !credentials.key || + !credentials.algorithm) { + + return ''; + } + + if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return ''; + } + + // Parse URI + + uri = hawk.utils.parseUri(uri); + + // Calculate signature + + const exp = now + options.ttlSec; + const mac = hawk.crypto.calculateMac('bewit', credentials, { + ts: exp, + nonce: '', + method: 'GET', + resource: uri.resource, // Maintain trailing '?' and query params + host: uri.host, + port: uri.port, + ext: options.ext + }); + + // Construct bewit: id\exp\mac\ext + + const bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + options.ext; + return hawk.utils.base64urlEncode(bewit); + }, + + // Validate server response + + /* + request: object created via 'new XMLHttpRequest()' after response received or fetch API 'Response' + artifacts: object received from header().artifacts + options: { + payload: optional payload received + required: specifies if a Server-Authorization header is required. Defaults to 'false' + } + */ + + authenticate: function (request, credentials, artifacts, options) { + + options = options || {}; + + const getHeader = function (name) { + + // Fetch API or plain headers + + if (request.headers) { + return (typeof request.headers.get === 'function' ? request.headers.get(name) : request.headers[name]); + } + + // XMLHttpRequest + + return (request.getResponseHeader ? request.getResponseHeader(name) : request.getHeader(name)); + }; + + const wwwAuthenticate = getHeader('www-authenticate'); + if (wwwAuthenticate) { + + // Parse HTTP WWW-Authenticate header + + const wwwAttributes = hawk.utils.parseAuthorizationHeader(wwwAuthenticate, ['ts', 'tsm', 'error']); + if (!wwwAttributes) { + return false; + } + + if (wwwAttributes.ts) { + const tsm = hawk.crypto.calculateTsMac(wwwAttributes.ts, credentials); + if (tsm !== wwwAttributes.tsm) { + return false; + } + + hawk.utils.setNtpSecOffset(wwwAttributes.ts - Math.floor(Date.now() / 1000)); // Keep offset at 1 second precision + } + } + + // Parse HTTP Server-Authorization header + + const serverAuthorization = getHeader('server-authorization'); + if (!serverAuthorization && + !options.required) { + + return true; + } + + const attributes = hawk.utils.parseAuthorizationHeader(serverAuthorization, ['mac', 'ext', 'hash']); + if (!attributes) { + return false; + } + + const modArtifacts = { + ts: artifacts.ts, + nonce: artifacts.nonce, + method: artifacts.method, + resource: artifacts.resource, + host: artifacts.host, + port: artifacts.port, + hash: attributes.hash, + ext: attributes.ext, + app: artifacts.app, + dlg: artifacts.dlg + }; + + const mac = hawk.crypto.calculateMac('response', credentials, modArtifacts); + if (mac !== attributes.mac) { + return false; + } + + if (!options.payload && + options.payload !== '') { + + return true; + } + + if (!attributes.hash) { + return false; + } + + const calculatedHash = hawk.crypto.calculatePayloadHash(options.payload, credentials.algorithm, getHeader('content-type')); + return (calculatedHash === attributes.hash); + }, + + message: function (host, port, message, options) { + + // Validate inputs + + if (!host || typeof host !== 'string' || + !port || typeof port !== 'number' || + message === null || message === undefined || typeof message !== 'string' || + !options || typeof options !== 'object') { + + return null; + } + + // Application time + + const timestamp = options.timestamp || hawk.utils.nowSec(options.localtimeOffsetMsec); + + // Validate credentials + + const credentials = options.credentials; + if (!credentials || + !credentials.id || + !credentials.key || + !credentials.algorithm) { + + // Invalid credential object + return null; + } + + if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return null; + } + + // Calculate signature + + const artifacts = { + ts: timestamp, + nonce: options.nonce || hawk.utils.randomString(6), + host, + port, + hash: hawk.crypto.calculatePayloadHash(message, credentials.algorithm) + }; + + // Construct authorization + + const result = { + id: credentials.id, + ts: artifacts.ts, + nonce: artifacts.nonce, + hash: artifacts.hash, + mac: hawk.crypto.calculateMac('message', credentials, artifacts) + }; + + return result; + }, + + authenticateTimestamp: function (message, credentials, updateClock) { // updateClock defaults to true + + const tsm = hawk.crypto.calculateTsMac(message.ts, credentials); + if (tsm !== message.tsm) { + return false; + } + + if (updateClock !== false) { + hawk.utils.setNtpSecOffset(message.ts - Math.floor(Date.now() / 1000)); // Keep offset at 1 second precision + } + + return true; + } +}; + + +hawk.crypto = { + + headerVersion: '1', + + algorithms: ['sha1', 'sha256'], + + calculateMac: function (type, credentials, options) { + + const normalized = hawk.crypto.generateNormalizedString(type, options); + + const hmac = CryptoJS['Hmac' + credentials.algorithm.toUpperCase()](normalized, credentials.key); + return hmac.toString(CryptoJS.enc.Base64); + }, + + generateNormalizedString: function (type, options) { + + let normalized = 'hawk.' + hawk.crypto.headerVersion + '.' + type + '\n' + + options.ts + '\n' + + options.nonce + '\n' + + (options.method || '').toUpperCase() + '\n' + + (options.resource || '') + '\n' + + options.host.toLowerCase() + '\n' + + options.port + '\n' + + (options.hash || '') + '\n'; + + if (options.ext) { + normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n'); + } + + normalized += '\n'; + + if (options.app) { + normalized += options.app + '\n' + + (options.dlg || '') + '\n'; + } + + return normalized; + }, + + calculatePayloadHash: function (payload, algorithm, contentType) { + + const hash = CryptoJS.algo[algorithm.toUpperCase()].create(); + hash.update('hawk.' + hawk.crypto.headerVersion + '.payload\n'); + hash.update(hawk.utils.parseContentType(contentType) + '\n'); + hash.update(payload); + hash.update('\n'); + return hash.finalize().toString(CryptoJS.enc.Base64); + }, + + calculateTsMac: function (ts, credentials) { + + const hash = CryptoJS['Hmac' + credentials.algorithm.toUpperCase()]('hawk.' + hawk.crypto.headerVersion + '.ts\n' + ts + '\n', credentials.key); + return hash.toString(CryptoJS.enc.Base64); + } +}; + + +// localStorage compatible interface + +hawk.internals.LocalStorage = function () { + + this._cache = {}; + this.length = 0; + + this.getItem = function (key) { + + return this._cache.hasOwnProperty(key) ? String(this._cache[key]) : null; + }; + + this.setItem = function (key, value) { + + this._cache[key] = String(value); + this.length = Object.keys(this._cache).length; + }; + + this.removeItem = function (key) { + + delete this._cache[key]; + this.length = Object.keys(this._cache).length; + }; + + this.clear = function () { + + this._cache = {}; + this.length = 0; + }; + + this.key = function (i) { + + return Object.keys(this._cache)[i || 0]; + }; +}; + + +hawk.utils = { + + storage: new hawk.internals.LocalStorage(), + + setStorage: function (storage) { + + const ntpOffset = hawk.utils.storage.getItem('hawk_ntp_offset'); + hawk.utils.storage = storage; + if (ntpOffset) { + hawk.utils.setNtpSecOffset(ntpOffset); + } + }, + + setNtpSecOffset: function (offset) { + + try { + hawk.utils.storage.setItem('hawk_ntp_offset', offset); + } + catch (err) { + console.error('[hawk] could not write to storage.'); + console.error(err); + } + }, + + getNtpSecOffset: function () { + + const offset = hawk.utils.storage.getItem('hawk_ntp_offset'); + if (!offset) { + return 0; + } + + return parseInt(offset, 10); + }, + + now: function (localtimeOffsetMsec) { + + return Date.now() + (localtimeOffsetMsec || 0) + (hawk.utils.getNtpSecOffset() * 1000); + }, + + nowSec: function (localtimeOffsetMsec) { + + return Math.floor(hawk.utils.now(localtimeOffsetMsec) / 1000); + }, + + escapeHeaderAttribute: function (attribute) { + + return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); + }, + + parseContentType: function (header) { + + if (!header) { + return ''; + } + + return header.split(';')[0].replace(/^\s+|\s+$/g, '').toLowerCase(); + }, + + parseAuthorizationHeader: function (header, keys) { + + if (!header) { + return null; + } + + const headerParts = header.match(/^(\w+)(?:\s+(.*))?$/); // Header: scheme[ something] + if (!headerParts) { + return null; + } + + const scheme = headerParts[1]; + if (scheme.toLowerCase() !== 'hawk') { + return null; + } + + const attributesString = headerParts[2]; + if (!attributesString) { + return null; + } + + const attributes = {}; + const verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, ($0, $1, $2) => { + + // Check valid attribute names + + if (keys.indexOf($1) === -1) { + return; + } + + // Allowed attribute value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9 + + if ($2.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/) === null) { + return; + } + + // Check for duplicates + + if (attributes.hasOwnProperty($1)) { + return; + } + + attributes[$1] = $2; + return ''; + }); + + if (verify !== '') { + return null; + } + + return attributes; + }, + + randomString: function (size) { + + const randomSource = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + const len = randomSource.length; + + const result = []; + for (let i = 0; i < size; ++i) { + result[i] = randomSource[Math.floor(Math.random() * len)]; + } + + return result.join(''); + }, + + // 1 2 3 4 + uriRegex: /^([^:]+)\:\/\/(?:[^@/]*@)?([^\/:]+)(?:\:(\d+))?([^#]*)(?:#.*)?$/, // scheme://credentials@host:port/resource#fragment + parseUri: function (input) { + + const parts = input.match(hawk.utils.uriRegex); + if (!parts) { + return { host: '', port: '', resource: '' }; + } + + const scheme = parts[1].toLowerCase(); + const uri = { + host: parts[2], + port: parts[3] || (scheme === 'http' ? '80' : (scheme === 'https' ? '443' : '')), + resource: parts[4] + }; + + return uri; + }, + + base64urlEncode: function (value) { + + const wordArray = CryptoJS.enc.Utf8.parse(value); + const encoded = CryptoJS.enc.Base64.stringify(wordArray); + return encoded.replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); + } +}; + + +// $lab:coverage:off$ +/* eslint-disable */ + +// Based on: Crypto-JS v3.1.2 +// Copyright (c) 2009-2013, Jeff Mott. All rights reserved. +// http://code.google.com/p/crypto-js/ +// http://code.google.com/p/crypto-js/wiki/License + +var CryptoJS = CryptoJS || function (h, r) { var k = {}, l = k.lib = {}, n = function () { }, f = l.Base = { extend: function (a) { n.prototype = this; var b = new n; a && b.mixIn(a); b.hasOwnProperty("init") || (b.init = function () { b.$super.init.apply(this, arguments) }); b.init.prototype = b; b.$super = this; return b }, create: function () { var a = this.extend(); a.init.apply(a, arguments); return a }, init: function () { }, mixIn: function (a) { for (let b in a) a.hasOwnProperty(b) && (this[b] = a[b]); a.hasOwnProperty("toString") && (this.toString = a.toString) }, clone: function () { return this.init.prototype.extend(this) } }, j = l.WordArray = f.extend({ init: function (a, b) { a = this.words = a || []; this.sigBytes = b != r ? b : 4 * a.length }, toString: function (a) { return (a || s).stringify(this) }, concat: function (a) { var b = this.words, d = a.words, c = this.sigBytes; a = a.sigBytes; this.clamp(); if (c % 4) for (let e = 0; e < a; e++) b[c + e >>> 2] |= (d[e >>> 2] >>> 24 - 8 * (e % 4) & 255) << 24 - 8 * ((c + e) % 4); else if (65535 < d.length) for (let e = 0; e < a; e += 4) b[c + e >>> 2] = d[e >>> 2]; else b.push.apply(b, d); this.sigBytes += a; return this }, clamp: function () { var a = this.words, b = this.sigBytes; a[b >>> 2] &= 4294967295 << 32 - 8 * (b % 4); a.length = h.ceil(b / 4) }, clone: function () { var a = f.clone.call(this); a.words = this.words.slice(0); return a }, random: function (a) { for (let b = [], d = 0; d < a; d += 4) b.push(4294967296 * h.random() | 0); return new j.init(b, a) } }), m = k.enc = {}, s = m.Hex = { stringify: function (a) { var b = a.words; a = a.sigBytes; for (var d = [], c = 0; c < a; c++) { var e = b[c >>> 2] >>> 24 - 8 * (c % 4) & 255; d.push((e >>> 4).toString(16)); d.push((e & 15).toString(16)) } return d.join("") }, parse: function (a) { for (var b = a.length, d = [], c = 0; c < b; c += 2) d[c >>> 3] |= parseInt(a.substr(c, 2), 16) << 24 - 4 * (c % 8); return new j.init(d, b / 2) } }, p = m.Latin1 = { stringify: function (a) { var b = a.words; a = a.sigBytes; for (var d = [], c = 0; c < a; c++) d.push(String.fromCharCode(b[c >>> 2] >>> 24 - 8 * (c % 4) & 255)); return d.join("") }, parse: function (a) { for (var b = a.length, d = [], c = 0; c < b; c++) d[c >>> 2] |= (a.charCodeAt(c) & 255) << 24 - 8 * (c % 4); return new j.init(d, b) } }, t = m.Utf8 = { stringify: function (a) { try { return decodeURIComponent(escape(p.stringify(a))) } catch (b) { throw Error("Malformed UTF-8 data"); } }, parse: function (a) { return p.parse(unescape(encodeURIComponent(a))) } }, q = l.BufferedBlockAlgorithm = f.extend({ reset: function () { this._data = new j.init; this._nDataBytes = 0 }, _append: function (a) { "string" == typeof a && (a = t.parse(a)); this._data.concat(a); this._nDataBytes += a.sigBytes }, _process: function (a) { var b = this._data, d = b.words, c = b.sigBytes, e = this.blockSize, f = c / (4 * e), f = a ? h.ceil(f) : h.max((f | 0) - this._minBufferSize, 0); a = f * e; c = h.min(4 * a, c); if (a) { for (var g = 0; g < a; g += e) this._doProcessBlock(d, g); g = d.splice(0, a); b.sigBytes -= c } return new j.init(g, c) }, clone: function () { var a = f.clone.call(this); a._data = this._data.clone(); return a }, _minBufferSize: 0 }); l.Hasher = q.extend({ cfg: f.extend(), init: function (a) { this.cfg = this.cfg.extend(a); this.reset() }, reset: function () { q.reset.call(this); this._doReset() }, update: function (a) { this._append(a); this._process(); return this }, finalize: function (a) { a && this._append(a); return this._doFinalize() }, blockSize: 16, _createHelper: function (a) { return function (b, d) { return (new a.init(d)).finalize(b) } }, _createHmacHelper: function (a) { return function (b, d) { return (new u.HMAC.init(a, d)).finalize(b) } } }); var u = k.algo = {}; return k }(Math); +(() => { var k = CryptoJS, b = k.lib, m = b.WordArray, l = b.Hasher, d = [], b = k.algo.SHA1 = l.extend({ _doReset: function () { this._hash = new m.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (n, p) { for (var a = this._hash.words, e = a[0], f = a[1], h = a[2], j = a[3], b = a[4], c = 0; 80 > c; c++) { if (16 > c) d[c] = n[p + c] | 0; else { var g = d[c - 3] ^ d[c - 8] ^ d[c - 14] ^ d[c - 16]; d[c] = g << 1 | g >>> 31 } g = (e << 5 | e >>> 27) + b + d[c]; g = 20 > c ? g + ((f & h | ~f & j) + 1518500249) : 40 > c ? g + ((f ^ h ^ j) + 1859775393) : 60 > c ? g + ((f & h | f & j | h & j) - 1894007588) : g + ((f ^ h ^ j) - 899497514); b = j; j = h; h = f << 30 | f >>> 2; f = e; e = g } a[0] = a[0] + e | 0; a[1] = a[1] + f | 0; a[2] = a[2] + h | 0; a[3] = a[3] + j | 0; a[4] = a[4] + b | 0 }, _doFinalize: function () { var b = this._data, d = b.words, a = 8 * this._nDataBytes, e = 8 * b.sigBytes; d[e >>> 5] |= 128 << 24 - e % 32; d[(e + 64 >>> 9 << 4) + 14] = Math.floor(a / 4294967296); d[(e + 64 >>> 9 << 4) + 15] = a; b.sigBytes = 4 * d.length; this._process(); return this._hash }, clone: function () { var b = l.clone.call(this); b._hash = this._hash.clone(); return b } }); k.SHA1 = l._createHelper(b); k.HmacSHA1 = l._createHmacHelper(b) })(); +(function (k) { for (var g = CryptoJS, h = g.lib, v = h.WordArray, j = h.Hasher, h = g.algo, s = [], t = [], u = function (q) { return 4294967296 * (q - (q | 0)) | 0 }, l = 2, b = 0; 64 > b;) { var d; a: { d = l; for (var w = k.sqrt(d), r = 2; r <= w; r++) if (!(d % r)) { d = !1; break a } d = !0 } d && (8 > b && (s[b] = u(k.pow(l, 0.5))), t[b] = u(k.pow(l, 1 / 3)), b++); l++ } var n = [], h = h.SHA256 = j.extend({ _doReset: function () { this._hash = new v.init(s.slice(0)) }, _doProcessBlock: function (q, h) { for (var a = this._hash.words, c = a[0], d = a[1], b = a[2], k = a[3], f = a[4], g = a[5], j = a[6], l = a[7], e = 0; 64 > e; e++) { if (16 > e) n[e] = q[h + e] | 0; else { var m = n[e - 15], p = n[e - 2]; n[e] = ((m << 25 | m >>> 7) ^ (m << 14 | m >>> 18) ^ m >>> 3) + n[e - 7] + ((p << 15 | p >>> 17) ^ (p << 13 | p >>> 19) ^ p >>> 10) + n[e - 16] } m = l + ((f << 26 | f >>> 6) ^ (f << 21 | f >>> 11) ^ (f << 7 | f >>> 25)) + (f & g ^ ~f & j) + t[e] + n[e]; p = ((c << 30 | c >>> 2) ^ (c << 19 | c >>> 13) ^ (c << 10 | c >>> 22)) + (c & d ^ c & b ^ d & b); l = j; j = g; g = f; f = k + m | 0; k = b; b = d; d = c; c = m + p | 0 } a[0] = a[0] + c | 0; a[1] = a[1] + d | 0; a[2] = a[2] + b | 0; a[3] = a[3] + k | 0; a[4] = a[4] + f | 0; a[5] = a[5] + g | 0; a[6] = a[6] + j | 0; a[7] = a[7] + l | 0 }, _doFinalize: function () { var d = this._data, b = d.words, a = 8 * this._nDataBytes, c = 8 * d.sigBytes; b[c >>> 5] |= 128 << 24 - c % 32; b[(c + 64 >>> 9 << 4) + 14] = k.floor(a / 4294967296); b[(c + 64 >>> 9 << 4) + 15] = a; d.sigBytes = 4 * b.length; this._process(); return this._hash }, clone: function () { var b = j.clone.call(this); b._hash = this._hash.clone(); return b } }); g.SHA256 = j._createHelper(h); g.HmacSHA256 = j._createHmacHelper(h) })(Math); +(() => { var c = CryptoJS, k = c.enc.Utf8; c.algo.HMAC = c.lib.Base.extend({ init: function (a, b) { a = this._hasher = new a.init; "string" == typeof b && (b = k.parse(b)); var c = a.blockSize, e = 4 * c; b.sigBytes > e && (b = a.finalize(b)); b.clamp(); for (var f = this._oKey = b.clone(), g = this._iKey = b.clone(), h = f.words, j = g.words, d = 0; d < c; d++) h[d] ^= 1549556828, j[d] ^= 909522486; f.sigBytes = g.sigBytes = e; this.reset() }, reset: function () { var a = this._hasher; a.reset(); a.update(this._iKey) }, update: function (a) { this._hasher.update(a); return this }, finalize: function (a) { var b = this._hasher; a = b.finalize(a); b.reset(); return b.finalize(this._oKey.clone().concat(a)) } }) })(); +(() => { var h = CryptoJS, j = h.lib.WordArray; h.enc.Base64 = { stringify: function (b) { var e = b.words, f = b.sigBytes, c = this._map; b.clamp(); b = []; for (var a = 0; a < f; a += 3) for (var d = (e[a >>> 2] >>> 24 - 8 * (a % 4) & 255) << 16 | (e[a + 1 >>> 2] >>> 24 - 8 * ((a + 1) % 4) & 255) << 8 | e[a + 2 >>> 2] >>> 24 - 8 * ((a + 2) % 4) & 255, g = 0; 4 > g && a + 0.75 * g < f; g++) b.push(c.charAt(d >>> 6 * (3 - g) & 63)); if (e = c.charAt(64)) for (; b.length % 4;) b.push(e); return b.join("") }, parse: function (b) { var e = b.length, f = this._map, c = f.charAt(64); c && (c = b.indexOf(c), -1 != c && (e = c)); for (var c = [], a = 0, d = 0; d < e; d++) if (d % 4) { var g = f.indexOf(b.charAt(d - 1)) << 2 * (d % 4), h = f.indexOf(b.charAt(d)) >>> 6 - 2 * (d % 4); c[a >>> 2] |= (g | h) << 24 - 8 * (a % 4); a++ } return j.create(c, a) }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" } })(); + + +hawk.crypto.utils = CryptoJS; + +// Export if used as a module + +if (typeof module !== 'undefined' && module.exports) { + module.exports = hawk; +} + +/* eslint-enable */ +// $lab:coverage:on$ diff --git a/appasar/canary/node_modules/hawk/lib/client.js b/appasar/canary/node_modules/hawk/lib/client.js new file mode 100644 index 0000000..eecc2e3 --- /dev/null +++ b/appasar/canary/node_modules/hawk/lib/client.js @@ -0,0 +1,394 @@ +'use strict'; + +// Load modules + +const Url = require('url'); +const Hoek = require('hoek'); +const Cryptiles = require('cryptiles'); +const Crypto = require('./crypto'); +const Utils = require('./utils'); + + +// Declare internals + +const internals = {}; + + +// Generate an Authorization header for a given request + +/* + uri: 'http://example.com/resource?a=b' or object from Url.parse() + method: HTTP verb (e.g. 'GET', 'POST') + options: { + + // Required + + credentials: { + id: 'dh37fgj492je', + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + + // Optional + + ext: 'application-specific', // Application specific data sent via the ext attribute + timestamp: Date.now() / 1000, // A pre-calculated timestamp in seconds + nonce: '2334f34f', // A pre-generated nonce + localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided) + payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided) + contentType: 'application/json', // Payload content-type (ignored if hash provided) + hash: 'U4MKKSmiVxk37JCCrAVIjV=', // Pre-calculated payload hash + app: '24s23423f34dx', // Oz application id + dlg: '234sz34tww3sd' // Oz delegated-by application id + } +*/ + +exports.header = function (uri, method, options) { + + const result = { + field: '', + artifacts: {} + }; + + // Validate inputs + + if (!uri || (typeof uri !== 'string' && typeof uri !== 'object') || + !method || typeof method !== 'string' || + !options || typeof options !== 'object') { + + result.err = 'Invalid argument type'; + return result; + } + + // Application time + + const timestamp = options.timestamp || Utils.nowSecs(options.localtimeOffsetMsec); + + // Validate credentials + + const credentials = options.credentials; + if (!credentials || + !credentials.id || + !credentials.key || + !credentials.algorithm) { + + result.err = 'Invalid credential object'; + return result; + } + + if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) { + result.err = 'Unknown algorithm'; + return result; + } + + // Parse URI + + if (typeof uri === 'string') { + uri = Url.parse(uri); + } + + // Calculate signature + + const artifacts = { + ts: timestamp, + nonce: options.nonce || Cryptiles.randomString(6), + method, + resource: uri.pathname + (uri.search || ''), // Maintain trailing '?' + host: uri.hostname, + port: uri.port || (uri.protocol === 'http:' ? 80 : 443), + hash: options.hash, + ext: options.ext, + app: options.app, + dlg: options.dlg + }; + + result.artifacts = artifacts; + + // Calculate payload hash + + if (!artifacts.hash && + (options.payload || options.payload === '')) { + + artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType); + } + + const mac = Crypto.calculateMac('header', credentials, artifacts); + + // Construct header + + const hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''; // Other falsey values allowed + let header = 'Hawk id="' + credentials.id + + '", ts="' + artifacts.ts + + '", nonce="' + artifacts.nonce + + (artifacts.hash ? '", hash="' + artifacts.hash : '') + + (hasExt ? '", ext="' + Hoek.escapeHeaderAttribute(artifacts.ext) : '') + + '", mac="' + mac + '"'; + + if (artifacts.app) { + header = header + ', app="' + artifacts.app + + (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"'; + } + + result.field = header; + + return result; +}; + + +// Validate server response + +/* + res: node's response object + artifacts: object received from header().artifacts + options: { + payload: optional payload received + required: specifies if a Server-Authorization header is required. Defaults to 'false' + } +*/ + +exports.authenticate = function (res, credentials, artifacts, options, callback) { + + artifacts = Hoek.clone(artifacts); + options = options || {}; + + let wwwAttributes = null; + let serverAuthAttributes = null; + + const finalize = function (err) { + + if (callback) { + const headers = { + 'www-authenticate': wwwAttributes, + 'server-authorization': serverAuthAttributes + }; + + return callback(err, headers); + } + + return !err; + }; + + if (res.headers['www-authenticate']) { + + // Parse HTTP WWW-Authenticate header + + wwwAttributes = Utils.parseAuthorizationHeader(res.headers['www-authenticate'], ['ts', 'tsm', 'error']); + if (wwwAttributes instanceof Error) { + wwwAttributes = null; + return finalize(new Error('Invalid WWW-Authenticate header')); + } + + // Validate server timestamp (not used to update clock since it is done via the SNPT client) + + if (wwwAttributes.ts) { + const tsm = Crypto.calculateTsMac(wwwAttributes.ts, credentials); + if (tsm !== wwwAttributes.tsm) { + return finalize(new Error('Invalid server timestamp hash')); + } + } + } + + // Parse HTTP Server-Authorization header + + if (!res.headers['server-authorization'] && + !options.required) { + + return finalize(); + } + + serverAuthAttributes = Utils.parseAuthorizationHeader(res.headers['server-authorization'], ['mac', 'ext', 'hash']); + if (serverAuthAttributes instanceof Error) { + serverAuthAttributes = null; + return finalize(new Error('Invalid Server-Authorization header')); + } + + artifacts.ext = serverAuthAttributes.ext; + artifacts.hash = serverAuthAttributes.hash; + + const mac = Crypto.calculateMac('response', credentials, artifacts); + if (mac !== serverAuthAttributes.mac) { + return finalize(new Error('Bad response mac')); + } + + if (!options.payload && + options.payload !== '') { + + return finalize(); + } + + if (!serverAuthAttributes.hash) { + return finalize(new Error('Missing response hash attribute')); + } + + const calculatedHash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, res.headers['content-type']); + if (calculatedHash !== serverAuthAttributes.hash) { + return finalize(new Error('Bad response payload mac')); + } + + return finalize(); +}; + + +// Generate a bewit value for a given URI + +/* + uri: 'http://example.com/resource?a=b' or object from Url.parse() + options: { + + // Required + + credentials: { + id: 'dh37fgj492je', + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + ttlSec: 60 * 60, // TTL in seconds + + // Optional + + ext: 'application-specific', // Application specific data sent via the ext attribute + localtimeOffsetMsec: 400 // Time offset to sync with server time + }; +*/ + +exports.getBewit = function (uri, options) { + + // Validate inputs + + if (!uri || + (typeof uri !== 'string' && typeof uri !== 'object') || + !options || + typeof options !== 'object' || + !options.ttlSec) { + + return ''; + } + + options.ext = (options.ext === null || options.ext === undefined ? '' : options.ext); // Zero is valid value + + // Application time + + const now = Utils.now(options.localtimeOffsetMsec); + + // Validate credentials + + const credentials = options.credentials; + if (!credentials || + !credentials.id || + !credentials.key || + !credentials.algorithm) { + + return ''; + } + + if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return ''; + } + + // Parse URI + + if (typeof uri === 'string') { + uri = Url.parse(uri); + } + + // Calculate signature + + const exp = Math.floor(now / 1000) + options.ttlSec; + const mac = Crypto.calculateMac('bewit', credentials, { + ts: exp, + nonce: '', + method: 'GET', + resource: uri.pathname + (uri.search || ''), // Maintain trailing '?' + host: uri.hostname, + port: uri.port || (uri.protocol === 'http:' ? 80 : 443), + ext: options.ext + }); + + // Construct bewit: id\exp\mac\ext + + const bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + options.ext; + return Hoek.base64urlEncode(bewit); +}; + + +// Generate an authorization string for a message + +/* + host: 'example.com', + port: 8000, + message: '{"some":"payload"}', // UTF-8 encoded string for body hash generation + options: { + + // Required + + credentials: { + id: 'dh37fgj492je', + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + + // Optional + + timestamp: Date.now() / 1000, // A pre-calculated timestamp in seconds + nonce: '2334f34f', // A pre-generated nonce + localtimeOffsetMsec: 400, // Time offset to sync with server time (ignored if timestamp provided) + } +*/ + +exports.message = function (host, port, message, options) { + + // Validate inputs + + if (!host || typeof host !== 'string' || + !port || typeof port !== 'number' || + message === null || message === undefined || typeof message !== 'string' || + !options || typeof options !== 'object') { + + return null; + } + + // Application time + + const timestamp = options.timestamp || Utils.nowSecs(options.localtimeOffsetMsec); + + // Validate credentials + + const credentials = options.credentials; + if (!credentials || + !credentials.id || + !credentials.key || + !credentials.algorithm) { + + // Invalid credential object + return null; + } + + if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return null; + } + + // Calculate signature + + const artifacts = { + ts: timestamp, + nonce: options.nonce || Cryptiles.randomString(6), + host, + port, + hash: Crypto.calculatePayloadHash(message, credentials.algorithm) + }; + + // Construct authorization + + const result = { + id: credentials.id, + ts: artifacts.ts, + nonce: artifacts.nonce, + hash: artifacts.hash, + mac: Crypto.calculateMac('message', credentials, artifacts) + }; + + return result; +}; + + + diff --git a/appasar/canary/node_modules/hawk/lib/crypto.js b/appasar/canary/node_modules/hawk/lib/crypto.js new file mode 100644 index 0000000..bfa4586 --- /dev/null +++ b/appasar/canary/node_modules/hawk/lib/crypto.js @@ -0,0 +1,128 @@ +'use strict'; + +// Load modules + +const Crypto = require('crypto'); +const Url = require('url'); +const Utils = require('./utils'); + + +// Declare internals + +const internals = {}; + + +// MAC normalization format version + +exports.headerVersion = '1'; // Prevent comparison of mac values generated with different normalized string formats + + +// Supported HMAC algorithms + +exports.algorithms = ['sha1', 'sha256']; + + +// Calculate the request MAC + +/* + type: 'header', // 'header', 'bewit', 'response' + credentials: { + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + options: { + method: 'GET', + resource: '/resource?a=1&b=2', + host: 'example.com', + port: 8080, + ts: 1357718381034, + nonce: 'd3d345f', + hash: 'U4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=', + ext: 'app-specific-data', + app: 'hf48hd83qwkj', // Application id (Oz) + dlg: 'd8djwekds9cj' // Delegated by application id (Oz), requires options.app + } +*/ + +exports.calculateMac = function (type, credentials, options) { + + const normalized = exports.generateNormalizedString(type, options); + + const hmac = Crypto.createHmac(credentials.algorithm, credentials.key).update(normalized); + const digest = hmac.digest('base64'); + return digest; +}; + + +exports.generateNormalizedString = function (type, options) { + + let resource = options.resource || ''; + if (resource && + resource[0] !== '/') { + + const url = Url.parse(resource, false); + resource = url.path; // Includes query + } + + let normalized = 'hawk.' + exports.headerVersion + '.' + type + '\n' + + options.ts + '\n' + + options.nonce + '\n' + + (options.method || '').toUpperCase() + '\n' + + resource + '\n' + + options.host.toLowerCase() + '\n' + + options.port + '\n' + + (options.hash || '') + '\n'; + + if (options.ext) { + normalized = normalized + options.ext.replace('\\', '\\\\').replace('\n', '\\n'); + } + + normalized = normalized + '\n'; + + if (options.app) { + normalized = normalized + options.app + '\n' + + (options.dlg || '') + '\n'; + } + + return normalized; +}; + + +exports.calculatePayloadHash = function (payload, algorithm, contentType) { + + const hash = exports.initializePayloadHash(algorithm, contentType); + hash.update(payload || ''); + return exports.finalizePayloadHash(hash); +}; + + +exports.initializePayloadHash = function (algorithm, contentType) { + + const hash = Crypto.createHash(algorithm); + hash.update('hawk.' + exports.headerVersion + '.payload\n'); + hash.update(Utils.parseContentType(contentType) + '\n'); + return hash; +}; + + +exports.finalizePayloadHash = function (hash) { + + hash.update('\n'); + return hash.digest('base64'); +}; + + +exports.calculateTsMac = function (ts, credentials) { + + const hmac = Crypto.createHmac(credentials.algorithm, credentials.key); + hmac.update('hawk.' + exports.headerVersion + '.ts\n' + ts + '\n'); + return hmac.digest('base64'); +}; + + +exports.timestampMessage = function (credentials, localtimeOffsetMsec) { + + const now = Utils.nowSecs(localtimeOffsetMsec); + const tsm = exports.calculateTsMac(now, credentials); + return { ts: now, tsm }; +}; diff --git a/appasar/canary/node_modules/hawk/lib/index.js b/appasar/canary/node_modules/hawk/lib/index.js new file mode 100644 index 0000000..324d3f9 --- /dev/null +++ b/appasar/canary/node_modules/hawk/lib/index.js @@ -0,0 +1,17 @@ +'use strict'; + +// Export sub-modules + +exports.error = exports.Error = require('boom'); +exports.sntp = require('sntp'); + +exports.server = require('./server'); +exports.client = require('./client'); +exports.crypto = require('./crypto'); +exports.utils = require('./utils'); + +exports.uri = { + authenticate: exports.server.authenticateBewit, + getBewit: exports.client.getBewit +}; + diff --git a/appasar/canary/node_modules/hawk/lib/server.js b/appasar/canary/node_modules/hawk/lib/server.js new file mode 100644 index 0000000..c5b02ae --- /dev/null +++ b/appasar/canary/node_modules/hawk/lib/server.js @@ -0,0 +1,550 @@ +'use strict'; + +// Load modules + +const Boom = require('boom'); +const Hoek = require('hoek'); +const Cryptiles = require('cryptiles'); +const Crypto = require('./crypto'); +const Utils = require('./utils'); + + +// Declare internals + +const internals = {}; + + +// Hawk authentication + +/* + req: node's HTTP request object or an object as follows: + + const request = { + method: 'GET', + url: '/resource/4?a=1&b=2', + host: 'example.com', + port: 8080, + authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE="' + }; + + credentialsFunc: required function to lookup the set of Hawk credentials based on the provided credentials id. + The credentials include the MAC key, MAC algorithm, and other attributes (such as username) + needed by the application. This function is the equivalent of verifying the username and + password in Basic authentication. + + const credentialsFunc = function (id, callback) { + + // Lookup credentials in database + db.lookup(id, function (err, item) { + + if (err || !item) { + return callback(err); + } + + const credentials = { + // Required + key: item.key, + algorithm: item.algorithm, + // Application specific + user: item.user + }; + + return callback(null, credentials); + }); + }; + + options: { + + hostHeaderName: optional header field name, used to override the default 'Host' header when used + behind a cache of a proxy. Apache2 changes the value of the 'Host' header while preserving + the original (which is what the module must verify) in the 'x-forwarded-host' header field. + Only used when passed a node Http.ServerRequest object. + + nonceFunc: optional nonce validation function. The function signature is function(key, nonce, ts, callback) + where 'callback' must be called using the signature function(err). + + timestampSkewSec: optional number of seconds of permitted clock skew for incoming timestamps. Defaults to 60 seconds. + Provides a +/- skew which means actual allowed window is double the number of seconds. + + localtimeOffsetMsec: optional local clock time offset express in a number of milliseconds (positive or negative). + Defaults to 0. + + payload: optional payload for validation. The client calculates the hash value and includes it via the 'hash' + header attribute. The server always ensures the value provided has been included in the request + MAC. When this option is provided, it validates the hash value itself. Validation is done by calculating + a hash value over the entire payload (assuming it has already be normalized to the same format and + encoding used by the client to calculate the hash on request). If the payload is not available at the time + of authentication, the authenticatePayload() method can be used by passing it the credentials and + attributes.hash returned in the authenticate callback. + + host: optional host name override. Only used when passed a node request object. + port: optional port override. Only used when passed a node request object. + } + + callback: function (err, credentials, artifacts) { } + */ + +exports.authenticate = function (req, credentialsFunc, options, callback) { + + callback = Hoek.nextTick(callback); + + // Default options + + options.nonceFunc = options.nonceFunc || internals.nonceFunc; + options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds + + // Application time + + const now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing + + // Convert node Http request object to a request configuration object + + const request = Utils.parseRequest(req, options); + if (request instanceof Error) { + return callback(Boom.badRequest(request.message)); + } + + // Parse HTTP Authorization header + + const attributes = Utils.parseAuthorizationHeader(request.authorization); + if (attributes instanceof Error) { + return callback(attributes); + } + + // Construct artifacts container + + const artifacts = { + method: request.method, + host: request.host, + port: request.port, + resource: request.url, + ts: attributes.ts, + nonce: attributes.nonce, + hash: attributes.hash, + ext: attributes.ext, + app: attributes.app, + dlg: attributes.dlg, + mac: attributes.mac, + id: attributes.id + }; + + // Verify required header attributes + + if (!attributes.id || + !attributes.ts || + !attributes.nonce || + !attributes.mac) { + + return callback(Boom.badRequest('Missing attributes'), null, artifacts); + } + + // Fetch Hawk credentials + + credentialsFunc(attributes.id, (err, credentials) => { + + if (err) { + return callback(err, credentials || null, artifacts); + } + + if (!credentials) { + return callback(Utils.unauthorized('Unknown credentials'), null, artifacts); + } + + if (!credentials.key || + !credentials.algorithm) { + + return callback(Boom.internal('Invalid credentials'), credentials, artifacts); + } + + if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return callback(Boom.internal('Unknown algorithm'), credentials, artifacts); + } + + // Calculate MAC + + const mac = Crypto.calculateMac('header', credentials, artifacts); + if (!Cryptiles.fixedTimeComparison(mac, attributes.mac)) { + return callback(Utils.unauthorized('Bad mac'), credentials, artifacts); + } + + // Check payload hash + + if (options.payload || + options.payload === '') { + + if (!attributes.hash) { + return callback(Utils.unauthorized('Missing required payload hash'), credentials, artifacts); + } + + const hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, request.contentType); + if (!Cryptiles.fixedTimeComparison(hash, attributes.hash)) { + return callback(Utils.unauthorized('Bad payload hash'), credentials, artifacts); + } + } + + // Check nonce + + options.nonceFunc(credentials.key, attributes.nonce, attributes.ts, (err) => { + + if (err) { + return callback(Utils.unauthorized('Invalid nonce'), credentials, artifacts); + } + + // Check timestamp staleness + + if (Math.abs((attributes.ts * 1000) - now) > (options.timestampSkewSec * 1000)) { + const tsm = Crypto.timestampMessage(credentials, options.localtimeOffsetMsec); + return callback(Utils.unauthorized('Stale timestamp', tsm), credentials, artifacts); + } + + // Successful authentication + + return callback(null, credentials, artifacts); + }); + }); +}; + + +// Authenticate payload hash - used when payload cannot be provided during authenticate() + +/* + payload: raw request payload + credentials: from authenticate callback + artifacts: from authenticate callback + contentType: req.headers['content-type'] +*/ + +exports.authenticatePayload = function (payload, credentials, artifacts, contentType) { + + const calculatedHash = Crypto.calculatePayloadHash(payload, credentials.algorithm, contentType); + return Cryptiles.fixedTimeComparison(calculatedHash, artifacts.hash); +}; + + +// Authenticate payload hash - used when payload cannot be provided during authenticate() + +/* + calculatedHash: the payload hash calculated using Crypto.calculatePayloadHash() + artifacts: from authenticate callback +*/ + +exports.authenticatePayloadHash = function (calculatedHash, artifacts) { + + return Cryptiles.fixedTimeComparison(calculatedHash, artifacts.hash); +}; + + +// Generate a Server-Authorization header for a given response + +/* + credentials: {}, // Object received from authenticate() + artifacts: {} // Object received from authenticate(); 'mac', 'hash', and 'ext' - ignored + options: { + ext: 'application-specific', // Application specific data sent via the ext attribute + payload: '{"some":"payload"}', // UTF-8 encoded string for body hash generation (ignored if hash provided) + contentType: 'application/json', // Payload content-type (ignored if hash provided) + hash: 'U4MKKSmiVxk37JCCrAVIjV=' // Pre-calculated payload hash + } +*/ + +exports.header = function (credentials, artifacts, options) { + + // Prepare inputs + + options = options || {}; + + if (!artifacts || + typeof artifacts !== 'object' || + typeof options !== 'object') { + + return ''; + } + + artifacts = Hoek.clone(artifacts); + delete artifacts.mac; + artifacts.hash = options.hash; + artifacts.ext = options.ext; + + // Validate credentials + + if (!credentials || + !credentials.key || + !credentials.algorithm) { + + // Invalid credential object + return ''; + } + + if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return ''; + } + + // Calculate payload hash + + if (!artifacts.hash && + (options.payload || options.payload === '')) { + + artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType); + } + + const mac = Crypto.calculateMac('response', credentials, artifacts); + + // Construct header + + let header = 'Hawk mac="' + mac + '"' + + (artifacts.hash ? ', hash="' + artifacts.hash + '"' : ''); + + if (artifacts.ext !== null && + artifacts.ext !== undefined && + artifacts.ext !== '') { // Other falsey values allowed + + header = header + ', ext="' + Hoek.escapeHeaderAttribute(artifacts.ext) + '"'; + } + + return header; +}; + + +/* + * Arguments and options are the same as authenticate() with the exception that the only supported options are: + * 'hostHeaderName', 'localtimeOffsetMsec', 'host', 'port' + */ + + +// 1 2 3 4 +internals.bewitRegex = /^(\/.*)([\?&])bewit\=([^&$]*)(?:&(.+))?$/; + + +exports.authenticateBewit = function (req, credentialsFunc, options, callback) { + + callback = Hoek.nextTick(callback); + + // Application time + + const now = Utils.now(options.localtimeOffsetMsec); + + // Convert node Http request object to a request configuration object + + const request = Utils.parseRequest(req, options); + if (request instanceof Error) { + return callback(Boom.badRequest(request.message)); + } + + // Extract bewit + + if (request.url.length > Utils.limits.maxMatchLength) { + return callback(Boom.badRequest('Resource path exceeds max length')); + } + + const resource = request.url.match(internals.bewitRegex); + if (!resource) { + return callback(Utils.unauthorized()); + } + + // Bewit not empty + + if (!resource[3]) { + return callback(Utils.unauthorized('Empty bewit')); + } + + // Verify method is GET + + if (request.method !== 'GET' && + request.method !== 'HEAD') { + + return callback(Utils.unauthorized('Invalid method')); + } + + // No other authentication + + if (request.authorization) { + return callback(Boom.badRequest('Multiple authentications')); + } + + // Parse bewit + + const bewitString = Hoek.base64urlDecode(resource[3]); + if (bewitString instanceof Error) { + return callback(Boom.badRequest('Invalid bewit encoding')); + } + + // Bewit format: id\exp\mac\ext ('\' is used because it is a reserved header attribute character) + + const bewitParts = bewitString.split('\\'); + if (bewitParts.length !== 4) { + return callback(Boom.badRequest('Invalid bewit structure')); + } + + const bewit = { + id: bewitParts[0], + exp: parseInt(bewitParts[1], 10), + mac: bewitParts[2], + ext: bewitParts[3] || '' + }; + + if (!bewit.id || + !bewit.exp || + !bewit.mac) { + + return callback(Boom.badRequest('Missing bewit attributes')); + } + + // Construct URL without bewit + + let url = resource[1]; + if (resource[4]) { + url = url + resource[2] + resource[4]; + } + + // Check expiration + + if (bewit.exp * 1000 <= now) { + return callback(Utils.unauthorized('Access expired'), null, bewit); + } + + // Fetch Hawk credentials + + credentialsFunc(bewit.id, (err, credentials) => { + + if (err) { + return callback(err, credentials || null, bewit.ext); + } + + if (!credentials) { + return callback(Utils.unauthorized('Unknown credentials'), null, bewit); + } + + if (!credentials.key || + !credentials.algorithm) { + + return callback(Boom.internal('Invalid credentials'), credentials, bewit); + } + + if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return callback(Boom.internal('Unknown algorithm'), credentials, bewit); + } + + // Calculate MAC + + const mac = Crypto.calculateMac('bewit', credentials, { + ts: bewit.exp, + nonce: '', + method: 'GET', + resource: url, + host: request.host, + port: request.port, + ext: bewit.ext + }); + + if (!Cryptiles.fixedTimeComparison(mac, bewit.mac)) { + return callback(Utils.unauthorized('Bad mac'), credentials, bewit); + } + + // Successful authentication + + return callback(null, credentials, bewit); + }); +}; + + +/* + * options are the same as authenticate() with the exception that the only supported options are: + * 'nonceFunc', 'timestampSkewSec', 'localtimeOffsetMsec' + */ + +exports.authenticateMessage = function (host, port, message, authorization, credentialsFunc, options, callback) { + + callback = Hoek.nextTick(callback); + + // Default options + + options.nonceFunc = options.nonceFunc || internals.nonceFunc; + options.timestampSkewSec = options.timestampSkewSec || 60; // 60 seconds + + // Application time + + const now = Utils.now(options.localtimeOffsetMsec); // Measure now before any other processing + + // Validate authorization + + if (!authorization.id || + !authorization.ts || + !authorization.nonce || + !authorization.hash || + !authorization.mac) { + + return callback(Boom.badRequest('Invalid authorization')); + } + + // Fetch Hawk credentials + + credentialsFunc(authorization.id, (err, credentials) => { + + if (err) { + return callback(err, credentials || null); + } + + if (!credentials) { + return callback(Utils.unauthorized('Unknown credentials')); + } + + if (!credentials.key || + !credentials.algorithm) { + + return callback(Boom.internal('Invalid credentials'), credentials); + } + + if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) { + return callback(Boom.internal('Unknown algorithm'), credentials); + } + + // Construct artifacts container + + const artifacts = { + ts: authorization.ts, + nonce: authorization.nonce, + host, + port, + hash: authorization.hash + }; + + // Calculate MAC + + const mac = Crypto.calculateMac('message', credentials, artifacts); + if (!Cryptiles.fixedTimeComparison(mac, authorization.mac)) { + return callback(Utils.unauthorized('Bad mac'), credentials); + } + + // Check payload hash + + const hash = Crypto.calculatePayloadHash(message, credentials.algorithm); + if (!Cryptiles.fixedTimeComparison(hash, authorization.hash)) { + return callback(Utils.unauthorized('Bad message hash'), credentials); + } + + // Check nonce + + options.nonceFunc(credentials.key, authorization.nonce, authorization.ts, (err) => { + + if (err) { + return callback(Utils.unauthorized('Invalid nonce'), credentials); + } + + // Check timestamp staleness + + if (Math.abs((authorization.ts * 1000) - now) > (options.timestampSkewSec * 1000)) { + return callback(Utils.unauthorized('Stale timestamp'), credentials); + } + + // Successful authentication + + return callback(null, credentials); + }); + }); +}; + + +internals.nonceFunc = function (key, nonce, ts, nonceCallback) { + + return nonceCallback(); // No validation +}; diff --git a/appasar/canary/node_modules/hawk/lib/utils.js b/appasar/canary/node_modules/hawk/lib/utils.js new file mode 100644 index 0000000..ecb64d3 --- /dev/null +++ b/appasar/canary/node_modules/hawk/lib/utils.js @@ -0,0 +1,186 @@ +'use strict'; + +// Load modules + +const Sntp = require('sntp'); +const Boom = require('boom'); + + +// Declare internals + +const internals = {}; + + +exports.version = function () { + + return require('../package.json').version; +}; + + +exports.limits = { + maxMatchLength: 4096 // Limit the length of uris and headers to avoid a DoS attack on string matching +}; + + +// Extract host and port from request + +// $1 $2 +internals.hostHeaderRegex = /^(?:(?:\r\n)?\s)*((?:[^:]+)|(?:\[[^\]]+\]))(?::(\d+))?(?:(?:\r\n)?\s)*$/; // (IPv4, hostname)|(IPv6) + + +exports.parseHost = function (req, hostHeaderName) { + + hostHeaderName = (hostHeaderName ? hostHeaderName.toLowerCase() : 'host'); + const hostHeader = req.headers[hostHeaderName]; + if (!hostHeader) { + return null; + } + + if (hostHeader.length > exports.limits.maxMatchLength) { + return null; + } + + const hostParts = hostHeader.match(internals.hostHeaderRegex); + if (!hostParts) { + return null; + } + + return { + name: hostParts[1], + port: (hostParts[2] ? hostParts[2] : (req.connection && req.connection.encrypted ? 443 : 80)) + }; +}; + + +// Parse Content-Type header content + +exports.parseContentType = function (header) { + + if (!header) { + return ''; + } + + return header.split(';')[0].trim().toLowerCase(); +}; + + +// Convert node's to request configuration object + +exports.parseRequest = function (req, options) { + + if (!req.headers) { + return req; + } + + // Obtain host and port information + + let host; + if (!options.host || + !options.port) { + + host = exports.parseHost(req, options.hostHeaderName); + if (!host) { + return new Error('Invalid Host header'); + } + } + + const request = { + method: req.method, + url: req.url, + host: options.host || host.name, + port: options.port || host.port, + authorization: req.headers.authorization, + contentType: req.headers['content-type'] || '' + }; + + return request; +}; + + +exports.now = function (localtimeOffsetMsec) { + + return Sntp.now() + (localtimeOffsetMsec || 0); +}; + + +exports.nowSecs = function (localtimeOffsetMsec) { + + return Math.floor(exports.now(localtimeOffsetMsec) / 1000); +}; + + +internals.authHeaderRegex = /^(\w+)(?:\s+(.*))?$/; // Header: scheme[ something] +internals.attributeRegex = /^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/; // !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9 + + +// Parse Hawk HTTP Authorization header + +exports.parseAuthorizationHeader = function (header, keys) { + + keys = keys || ['id', 'ts', 'nonce', 'hash', 'ext', 'mac', 'app', 'dlg']; + + if (!header) { + return Boom.unauthorized(null, 'Hawk'); + } + + if (header.length > exports.limits.maxMatchLength) { + return Boom.badRequest('Header length too long'); + } + + const headerParts = header.match(internals.authHeaderRegex); + if (!headerParts) { + return Boom.badRequest('Invalid header syntax'); + } + + const scheme = headerParts[1]; + if (scheme.toLowerCase() !== 'hawk') { + return Boom.unauthorized(null, 'Hawk'); + } + + const attributesString = headerParts[2]; + if (!attributesString) { + return Boom.badRequest('Invalid header syntax'); + } + + const attributes = {}; + let errorMessage = ''; + const verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, ($0, $1, $2) => { + + // Check valid attribute names + + if (keys.indexOf($1) === -1) { + errorMessage = 'Unknown attribute: ' + $1; + return; + } + + // Allowed attribute value characters + + if ($2.match(internals.attributeRegex) === null) { + errorMessage = 'Bad attribute value: ' + $1; + return; + } + + // Check for duplicates + + if (attributes.hasOwnProperty($1)) { + errorMessage = 'Duplicate attribute: ' + $1; + return; + } + + attributes[$1] = $2; + return ''; + }); + + if (verify !== '') { + return Boom.badRequest(errorMessage || 'Bad header format'); + } + + return attributes; +}; + + +exports.unauthorized = function (message, attributes) { + + return Boom.unauthorized(message || null, 'Hawk', attributes); +}; + diff --git a/appasar/canary/node_modules/hawk/package.json b/appasar/canary/node_modules/hawk/package.json new file mode 100644 index 0000000..1d9320c --- /dev/null +++ b/appasar/canary/node_modules/hawk/package.json @@ -0,0 +1,42 @@ +{ + "name": "hawk", + "description": "HTTP Hawk Authentication Scheme", + "version": "6.0.2", + "author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", + "repository": "git://github.com/hueniverse/hawk", + "main": "lib/index.js", + "browser": "dist/browser.js", + "keywords": [ + "http", + "authentication", + "scheme", + "hawk" + ], + "engines": { + "node": ">=4.5.0" + }, + "dependencies": { + "hoek": "4.x.x", + "boom": "4.x.x", + "cryptiles": "3.x.x", + "sntp": "2.x.x" + }, + "devDependencies": { + "babel-cli": "^6.1.2", + "babel-preset-es2015": "^6.1.2", + "code": "4.x.x", + "lab": "14.x.x" + }, + "babel": { + "presets": [ + "es2015" + ] + }, + "scripts": { + "build-client": "mkdir -p dist; babel lib/browser.js --out-file dist/browser.js", + "prepublish": "npm run-script build-client", + "test": "lab -a code -t 100 -L", + "test-cov-html": "lab -a code -r html -o coverage.html" + }, + "license": "BSD-3-Clause" +} diff --git a/appasar/canary/node_modules/hoek/.npmignore b/appasar/canary/node_modules/hoek/.npmignore new file mode 100644 index 0000000..adac8ad --- /dev/null +++ b/appasar/canary/node_modules/hoek/.npmignore @@ -0,0 +1,3 @@ +* +!lib/** +!.npmignore diff --git a/appasar/canary/node_modules/hoek/LICENSE b/appasar/canary/node_modules/hoek/LICENSE new file mode 100644 index 0000000..133cbdd --- /dev/null +++ b/appasar/canary/node_modules/hoek/LICENSE @@ -0,0 +1,32 @@ +Copyright (c) 2011-2016, Project contributors +Copyright (c) 2011-2014, Walmart +Copyright (c) 2011, Yahoo Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * The names of any contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * * * + +The complete list of contributors can be found at: https://github.com/hapijs/hapi/graphs/contributors +Portions of this project were initially based on the Yahoo! Inc. Postmile project, +published at https://github.com/yahoo/postmile. diff --git a/appasar/canary/node_modules/hoek/README.md b/appasar/canary/node_modules/hoek/README.md new file mode 100644 index 0000000..ec7bc25 --- /dev/null +++ b/appasar/canary/node_modules/hoek/README.md @@ -0,0 +1,30 @@ +![hoek Logo](https://raw.github.com/hapijs/hoek/master/images/hoek.png) + +Utility methods for the hapi ecosystem. This module is not intended to solve every problem for everyone, but rather as a central place to store hapi-specific methods. If you're looking for a general purpose utility module, check out [lodash](https://github.com/lodash/lodash) or [underscore](https://github.com/jashkenas/underscore). + +[![Build Status](https://secure.travis-ci.org/hapijs/hoek.svg)](http://travis-ci.org/hapijs/hoek) + +<a href="https://andyet.com"><img src="https://s3.amazonaws.com/static.andyet.com/images/%26yet-logo.svg" align="right" /></a> + +Lead Maintainer: [Nathan LaFreniere](https://github.com/nlf) + +**hoek** is sponsored by [&yet](https://andyet.com) + +## Usage + +The *Hoek* library contains some common functions used within the hapi ecosystem. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more. + +For example, to use Hoek to set configuration with default options: +```javascript +const Hoek = require('hoek'); + +const default = {url : "www.github.com", port : "8000", debug : true}; + +const config = Hoek.applyToDefaults(default, {port : "3000", admin : true}); + +// In this case, config would be { url: 'www.github.com', port: '3000', debug: true, admin: true } +``` + +## Documentation + +[**API Reference**](API.md) diff --git a/appasar/canary/node_modules/hoek/lib/escape.js b/appasar/canary/node_modules/hoek/lib/escape.js new file mode 100644 index 0000000..28d90ba --- /dev/null +++ b/appasar/canary/node_modules/hoek/lib/escape.js @@ -0,0 +1,168 @@ +'use strict'; + +// Declare internals + +const internals = {}; + + +exports.escapeJavaScript = function (input) { + + if (!input) { + return ''; + } + + let escaped = ''; + + for (let i = 0; i < input.length; ++i) { + + const charCode = input.charCodeAt(i); + + if (internals.isSafe(charCode)) { + escaped += input[i]; + } + else { + escaped += internals.escapeJavaScriptChar(charCode); + } + } + + return escaped; +}; + + +exports.escapeHtml = function (input) { + + if (!input) { + return ''; + } + + let escaped = ''; + + for (let i = 0; i < input.length; ++i) { + + const charCode = input.charCodeAt(i); + + if (internals.isSafe(charCode)) { + escaped += input[i]; + } + else { + escaped += internals.escapeHtmlChar(charCode); + } + } + + return escaped; +}; + + +exports.escapeJson = function (input) { + + if (!input) { + return ''; + } + + const lessThan = 0x3C; + const greaterThan = 0x3E; + const andSymbol = 0x26; + const lineSeperator = 0x2028; + + // replace method + let charCode; + return input.replace(/[<>&\u2028\u2029]/g, (match) => { + + charCode = match.charCodeAt(0); + + if (charCode === lessThan) { + return '\\u003c'; + } + else if (charCode === greaterThan) { + return '\\u003e'; + } + else if (charCode === andSymbol) { + return '\\u0026'; + } + else if (charCode === lineSeperator) { + return '\\u2028'; + } + return '\\u2029'; + }); +}; + + +internals.escapeJavaScriptChar = function (charCode) { + + if (charCode >= 256) { + return '\\u' + internals.padLeft('' + charCode, 4); + } + + const hexValue = new Buffer(String.fromCharCode(charCode), 'ascii').toString('hex'); + return '\\x' + internals.padLeft(hexValue, 2); +}; + + +internals.escapeHtmlChar = function (charCode) { + + const namedEscape = internals.namedHtml[charCode]; + if (typeof namedEscape !== 'undefined') { + return namedEscape; + } + + if (charCode >= 256) { + return '&#' + charCode + ';'; + } + + const hexValue = new Buffer(String.fromCharCode(charCode), 'ascii').toString('hex'); + return '&#x' + internals.padLeft(hexValue, 2) + ';'; +}; + + +internals.padLeft = function (str, len) { + + while (str.length < len) { + str = '0' + str; + } + + return str; +}; + + +internals.isSafe = function (charCode) { + + return (typeof internals.safeCharCodes[charCode] !== 'undefined'); +}; + + +internals.namedHtml = { + '38': '&', + '60': '<', + '62': '>', + '34': '"', + '160': ' ', + '162': '¢', + '163': '£', + '164': '¤', + '169': '©', + '174': '®' +}; + + +internals.safeCharCodes = (function () { + + const safe = {}; + + for (let i = 32; i < 123; ++i) { + + if ((i >= 97) || // a-z + (i >= 65 && i <= 90) || // A-Z + (i >= 48 && i <= 57) || // 0-9 + i === 32 || // space + i === 46 || // . + i === 44 || // , + i === 45 || // - + i === 58 || // : + i === 95) { // _ + + safe[i] = null; + } + } + + return safe; +}()); diff --git a/appasar/canary/node_modules/hoek/lib/index.js b/appasar/canary/node_modules/hoek/lib/index.js new file mode 100644 index 0000000..75bbeb7 --- /dev/null +++ b/appasar/canary/node_modules/hoek/lib/index.js @@ -0,0 +1,978 @@ +'use strict'; + +// Load modules + +const Crypto = require('crypto'); +const Path = require('path'); +const Util = require('util'); +const Escape = require('./escape'); + + +// Declare internals + +const internals = {}; + + +// Clone object or array + +exports.clone = function (obj, seen) { + + if (typeof obj !== 'object' || + obj === null) { + + return obj; + } + + seen = seen || new Map(); + + const lookup = seen.get(obj); + if (lookup) { + return lookup; + } + + let newObj; + let cloneDeep = false; + + if (!Array.isArray(obj)) { + if (Buffer.isBuffer(obj)) { + newObj = new Buffer(obj); + } + else if (obj instanceof Date) { + newObj = new Date(obj.getTime()); + } + else if (obj instanceof RegExp) { + newObj = new RegExp(obj); + } + else { + const proto = Object.getPrototypeOf(obj); + if (proto && + proto.isImmutable) { + + newObj = obj; + } + else { + newObj = Object.create(proto); + cloneDeep = true; + } + } + } + else { + newObj = []; + cloneDeep = true; + } + + seen.set(obj, newObj); + + if (cloneDeep) { + const keys = Object.getOwnPropertyNames(obj); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + const descriptor = Object.getOwnPropertyDescriptor(obj, key); + if (descriptor && + (descriptor.get || + descriptor.set)) { + + Object.defineProperty(newObj, key, descriptor); + } + else { + newObj[key] = exports.clone(obj[key], seen); + } + } + } + + return newObj; +}; + + +// Merge all the properties of source into target, source wins in conflict, and by default null and undefined from source are applied + +/*eslint-disable */ +exports.merge = function (target, source, isNullOverride /* = true */, isMergeArrays /* = true */) { +/*eslint-enable */ + + exports.assert(target && typeof target === 'object', 'Invalid target value: must be an object'); + exports.assert(source === null || source === undefined || typeof source === 'object', 'Invalid source value: must be null, undefined, or an object'); + + if (!source) { + return target; + } + + if (Array.isArray(source)) { + exports.assert(Array.isArray(target), 'Cannot merge array onto an object'); + if (isMergeArrays === false) { // isMergeArrays defaults to true + target.length = 0; // Must not change target assignment + } + + for (let i = 0; i < source.length; ++i) { + target.push(exports.clone(source[i])); + } + + return target; + } + + const keys = Object.keys(source); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (key === '__proto__') { + continue; + } + + const value = source[key]; + if (value && + typeof value === 'object') { + + if (!target[key] || + typeof target[key] !== 'object' || + (Array.isArray(target[key]) !== Array.isArray(value)) || + value instanceof Date || + Buffer.isBuffer(value) || + value instanceof RegExp) { + + target[key] = exports.clone(value); + } + else { + exports.merge(target[key], value, isNullOverride, isMergeArrays); + } + } + else { + if (value !== null && + value !== undefined) { // Explicit to preserve empty strings + + target[key] = value; + } + else if (isNullOverride !== false) { // Defaults to true + target[key] = value; + } + } + } + + return target; +}; + + +// Apply options to a copy of the defaults + +exports.applyToDefaults = function (defaults, options, isNullOverride) { + + exports.assert(defaults && typeof defaults === 'object', 'Invalid defaults value: must be an object'); + exports.assert(!options || options === true || typeof options === 'object', 'Invalid options value: must be true, falsy or an object'); + + if (!options) { // If no options, return null + return null; + } + + const copy = exports.clone(defaults); + + if (options === true) { // If options is set to true, use defaults + return copy; + } + + return exports.merge(copy, options, isNullOverride === true, false); +}; + + +// Clone an object except for the listed keys which are shallow copied + +exports.cloneWithShallow = function (source, keys) { + + if (!source || + typeof source !== 'object') { + + return source; + } + + const storage = internals.store(source, keys); // Move shallow copy items to storage + const copy = exports.clone(source); // Deep copy the rest + internals.restore(copy, source, storage); // Shallow copy the stored items and restore + return copy; +}; + + +internals.store = function (source, keys) { + + const storage = {}; + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + const value = exports.reach(source, key); + if (value !== undefined) { + storage[key] = value; + internals.reachSet(source, key, undefined); + } + } + + return storage; +}; + + +internals.restore = function (copy, source, storage) { + + const keys = Object.keys(storage); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + internals.reachSet(copy, key, storage[key]); + internals.reachSet(source, key, storage[key]); + } +}; + + +internals.reachSet = function (obj, key, value) { + + const path = key.split('.'); + let ref = obj; + for (let i = 0; i < path.length; ++i) { + const segment = path[i]; + if (i + 1 === path.length) { + ref[segment] = value; + } + + ref = ref[segment]; + } +}; + + +// Apply options to defaults except for the listed keys which are shallow copied from option without merging + +exports.applyToDefaultsWithShallow = function (defaults, options, keys) { + + exports.assert(defaults && typeof defaults === 'object', 'Invalid defaults value: must be an object'); + exports.assert(!options || options === true || typeof options === 'object', 'Invalid options value: must be true, falsy or an object'); + exports.assert(keys && Array.isArray(keys), 'Invalid keys'); + + if (!options) { // If no options, return null + return null; + } + + const copy = exports.cloneWithShallow(defaults, keys); + + if (options === true) { // If options is set to true, use defaults + return copy; + } + + const storage = internals.store(options, keys); // Move shallow copy items to storage + exports.merge(copy, options, false, false); // Deep copy the rest + internals.restore(copy, options, storage); // Shallow copy the stored items and restore + return copy; +}; + + +// Deep object or array comparison + +exports.deepEqual = function (obj, ref, options, seen) { + + options = options || { prototype: true }; + + const type = typeof obj; + + if (type !== typeof ref) { + return false; + } + + if (type !== 'object' || + obj === null || + ref === null) { + + if (obj === ref) { // Copied from Deep-eql, copyright(c) 2013 Jake Luer, jake@alogicalparadox.com, MIT Licensed, https://github.com/chaijs/deep-eql + return obj !== 0 || 1 / obj === 1 / ref; // -0 / +0 + } + + return obj !== obj && ref !== ref; // NaN + } + + seen = seen || []; + if (seen.indexOf(obj) !== -1) { + return true; // If previous comparison failed, it would have stopped execution + } + + seen.push(obj); + + if (Array.isArray(obj)) { + if (!Array.isArray(ref)) { + return false; + } + + if (!options.part && obj.length !== ref.length) { + return false; + } + + for (let i = 0; i < obj.length; ++i) { + if (options.part) { + let found = false; + for (let j = 0; j < ref.length; ++j) { + if (exports.deepEqual(obj[i], ref[j], options)) { + found = true; + break; + } + } + + return found; + } + + if (!exports.deepEqual(obj[i], ref[i], options)) { + return false; + } + } + + return true; + } + + if (Buffer.isBuffer(obj)) { + if (!Buffer.isBuffer(ref)) { + return false; + } + + if (obj.length !== ref.length) { + return false; + } + + for (let i = 0; i < obj.length; ++i) { + if (obj[i] !== ref[i]) { + return false; + } + } + + return true; + } + + if (obj instanceof Date) { + return (ref instanceof Date && obj.getTime() === ref.getTime()); + } + + if (obj instanceof RegExp) { + return (ref instanceof RegExp && obj.toString() === ref.toString()); + } + + if (options.prototype) { + if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf(ref)) { + return false; + } + } + + const keys = Object.getOwnPropertyNames(obj); + + if (!options.part && keys.length !== Object.getOwnPropertyNames(ref).length) { + return false; + } + + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + const descriptor = Object.getOwnPropertyDescriptor(obj, key); + if (descriptor.get) { + if (!exports.deepEqual(descriptor, Object.getOwnPropertyDescriptor(ref, key), options, seen)) { + return false; + } + } + else if (!exports.deepEqual(obj[key], ref[key], options, seen)) { + return false; + } + } + + return true; +}; + + +// Remove duplicate items from array + +exports.unique = (array, key) => { + + let result; + if (key) { + result = []; + const index = new Set(); + array.forEach((item) => { + + const identifier = item[key]; + if (!index.has(identifier)) { + index.add(identifier); + result.push(item); + } + }); + } + else { + result = Array.from(new Set(array)); + } + + return result; +}; + + +// Convert array into object + +exports.mapToObject = function (array, key) { + + if (!array) { + return null; + } + + const obj = {}; + for (let i = 0; i < array.length; ++i) { + if (key) { + if (array[i][key]) { + obj[array[i][key]] = true; + } + } + else { + obj[array[i]] = true; + } + } + + return obj; +}; + + +// Find the common unique items in two arrays + +exports.intersect = function (array1, array2, justFirst) { + + if (!array1 || !array2) { + return []; + } + + const common = []; + const hash = (Array.isArray(array1) ? exports.mapToObject(array1) : array1); + const found = {}; + for (let i = 0; i < array2.length; ++i) { + if (hash[array2[i]] && !found[array2[i]]) { + if (justFirst) { + return array2[i]; + } + + common.push(array2[i]); + found[array2[i]] = true; + } + } + + return (justFirst ? null : common); +}; + + +// Test if the reference contains the values + +exports.contain = function (ref, values, options) { + + /* + string -> string(s) + array -> item(s) + object -> key(s) + object -> object (key:value) + */ + + let valuePairs = null; + if (typeof ref === 'object' && + typeof values === 'object' && + !Array.isArray(ref) && + !Array.isArray(values)) { + + valuePairs = values; + values = Object.keys(values); + } + else { + values = [].concat(values); + } + + options = options || {}; // deep, once, only, part + + exports.assert(arguments.length >= 2, 'Insufficient arguments'); + exports.assert(typeof ref === 'string' || typeof ref === 'object', 'Reference must be string or an object'); + exports.assert(values.length, 'Values array cannot be empty'); + + let compare; + let compareFlags; + if (options.deep) { + compare = exports.deepEqual; + + const hasOnly = options.hasOwnProperty('only'); + const hasPart = options.hasOwnProperty('part'); + + compareFlags = { + prototype: hasOnly ? options.only : hasPart ? !options.part : false, + part: hasOnly ? !options.only : hasPart ? options.part : true + }; + } + else { + compare = (a, b) => a === b; + } + + let misses = false; + const matches = new Array(values.length); + for (let i = 0; i < matches.length; ++i) { + matches[i] = 0; + } + + if (typeof ref === 'string') { + let pattern = '('; + for (let i = 0; i < values.length; ++i) { + const value = values[i]; + exports.assert(typeof value === 'string', 'Cannot compare string reference to non-string value'); + pattern += (i ? '|' : '') + exports.escapeRegex(value); + } + + const regex = new RegExp(pattern + ')', 'g'); + const leftovers = ref.replace(regex, ($0, $1) => { + + const index = values.indexOf($1); + ++matches[index]; + return ''; // Remove from string + }); + + misses = !!leftovers; + } + else if (Array.isArray(ref)) { + for (let i = 0; i < ref.length; ++i) { + let matched = false; + for (let j = 0; j < values.length && matched === false; ++j) { + matched = compare(values[j], ref[i], compareFlags) && j; + } + + if (matched !== false) { + ++matches[matched]; + } + else { + misses = true; + } + } + } + else { + const keys = Object.getOwnPropertyNames(ref); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + const pos = values.indexOf(key); + if (pos !== -1) { + if (valuePairs && + !compare(valuePairs[key], ref[key], compareFlags)) { + + return false; + } + + ++matches[pos]; + } + else { + misses = true; + } + } + } + + let result = false; + for (let i = 0; i < matches.length; ++i) { + result = result || !!matches[i]; + if ((options.once && matches[i] > 1) || + (!options.part && !matches[i])) { + + return false; + } + } + + if (options.only && + misses) { + + return false; + } + + return result; +}; + + +// Flatten array + +exports.flatten = function (array, target) { + + const result = target || []; + + for (let i = 0; i < array.length; ++i) { + if (Array.isArray(array[i])) { + exports.flatten(array[i], result); + } + else { + result.push(array[i]); + } + } + + return result; +}; + + +// Convert an object key chain string ('a.b.c') to reference (object[a][b][c]) + +exports.reach = function (obj, chain, options) { + + if (chain === false || + chain === null || + typeof chain === 'undefined') { + + return obj; + } + + options = options || {}; + if (typeof options === 'string') { + options = { separator: options }; + } + + const path = chain.split(options.separator || '.'); + let ref = obj; + for (let i = 0; i < path.length; ++i) { + let key = path[i]; + if (key[0] === '-' && Array.isArray(ref)) { + key = key.slice(1, key.length); + key = ref.length - key; + } + + if (!ref || + !((typeof ref === 'object' || typeof ref === 'function') && key in ref) || + (typeof ref !== 'object' && options.functions === false)) { // Only object and function can have properties + + exports.assert(!options.strict || i + 1 === path.length, 'Missing segment', key, 'in reach path ', chain); + exports.assert(typeof ref === 'object' || options.functions === true || typeof ref !== 'function', 'Invalid segment', key, 'in reach path ', chain); + ref = options.default; + break; + } + + ref = ref[key]; + } + + return ref; +}; + + +exports.reachTemplate = function (obj, template, options) { + + return template.replace(/{([^}]+)}/g, ($0, chain) => { + + const value = exports.reach(obj, chain, options); + return (value === undefined || value === null ? '' : value); + }); +}; + + +exports.formatStack = function (stack) { + + const trace = []; + for (let i = 0; i < stack.length; ++i) { + const item = stack[i]; + trace.push([item.getFileName(), item.getLineNumber(), item.getColumnNumber(), item.getFunctionName(), item.isConstructor()]); + } + + return trace; +}; + + +exports.formatTrace = function (trace) { + + const display = []; + + for (let i = 0; i < trace.length; ++i) { + const row = trace[i]; + display.push((row[4] ? 'new ' : '') + row[3] + ' (' + row[0] + ':' + row[1] + ':' + row[2] + ')'); + } + + return display; +}; + + +exports.callStack = function (slice) { + + // http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + + const v8 = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { + + return stack; + }; + + const capture = {}; + Error.captureStackTrace(capture, this); // arguments.callee is not supported in strict mode so we use this and slice the trace of this off the result + const stack = capture.stack; + + Error.prepareStackTrace = v8; + + const trace = exports.formatStack(stack); + + return trace.slice(1 + slice); +}; + + +exports.displayStack = function (slice) { + + const trace = exports.callStack(slice === undefined ? 1 : slice + 1); + + return exports.formatTrace(trace); +}; + + +exports.abortThrow = false; + + +exports.abort = function (message, hideStack) { + + if (process.env.NODE_ENV === 'test' || exports.abortThrow === true) { + throw new Error(message || 'Unknown error'); + } + + let stack = ''; + if (!hideStack) { + stack = exports.displayStack(1).join('\n\t'); + } + console.log('ABORT: ' + message + '\n\t' + stack); + process.exit(1); +}; + + +exports.assert = function (condition /*, msg1, msg2, msg3 */) { + + if (condition) { + return; + } + + if (arguments.length === 2 && arguments[1] instanceof Error) { + throw arguments[1]; + } + + let msgs = []; + for (let i = 1; i < arguments.length; ++i) { + if (arguments[i] !== '') { + msgs.push(arguments[i]); // Avoids Array.slice arguments leak, allowing for V8 optimizations + } + } + + msgs = msgs.map((msg) => { + + return typeof msg === 'string' ? msg : msg instanceof Error ? msg.message : exports.stringify(msg); + }); + + throw new Error(msgs.join(' ') || 'Unknown error'); +}; + + +exports.Timer = function () { + + this.ts = 0; + this.reset(); +}; + + +exports.Timer.prototype.reset = function () { + + this.ts = Date.now(); +}; + + +exports.Timer.prototype.elapsed = function () { + + return Date.now() - this.ts; +}; + + +exports.Bench = function () { + + this.ts = 0; + this.reset(); +}; + + +exports.Bench.prototype.reset = function () { + + this.ts = exports.Bench.now(); +}; + + +exports.Bench.prototype.elapsed = function () { + + return exports.Bench.now() - this.ts; +}; + + +exports.Bench.now = function () { + + const ts = process.hrtime(); + return (ts[0] * 1e3) + (ts[1] / 1e6); +}; + + +// Escape string for Regex construction + +exports.escapeRegex = function (string) { + + // Escape ^$.*+-?=!:|\/()[]{}, + return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&'); +}; + + +// Base64url (RFC 4648) encode + +exports.base64urlEncode = function (value, encoding) { + + exports.assert(typeof value === 'string' || Buffer.isBuffer(value), 'value must be string or buffer'); + const buf = (Buffer.isBuffer(value) ? value : new Buffer(value, encoding || 'binary')); + return buf.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); +}; + + +// Base64url (RFC 4648) decode + +exports.base64urlDecode = function (value, encoding) { + + if (typeof value !== 'string') { + + return new Error('Value not a string'); + } + + if (!/^[\w\-]*$/.test(value)) { + + return new Error('Invalid character'); + } + + const buf = new Buffer(value, 'base64'); + return (encoding === 'buffer' ? buf : buf.toString(encoding || 'binary')); +}; + + +// Escape attribute value for use in HTTP header + +exports.escapeHeaderAttribute = function (attribute) { + + // Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, " + + exports.assert(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(attribute), 'Bad attribute value (' + attribute + ')'); + + return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); // Escape quotes and slash +}; + + +exports.escapeHtml = function (string) { + + return Escape.escapeHtml(string); +}; + + +exports.escapeJavaScript = function (string) { + + return Escape.escapeJavaScript(string); +}; + +exports.escapeJson = function (string) { + + return Escape.escapeJson(string); +}; + +exports.nextTick = function (callback) { + + return function () { + + const args = arguments; + process.nextTick(() => { + + callback.apply(null, args); + }); + }; +}; + + +exports.once = function (method) { + + if (method._hoekOnce) { + return method; + } + + let once = false; + const wrapped = function () { + + if (!once) { + once = true; + method.apply(null, arguments); + } + }; + + wrapped._hoekOnce = true; + + return wrapped; +}; + + +exports.isInteger = Number.isSafeInteger; + + +exports.ignore = function () { }; + + +exports.inherits = Util.inherits; + + +exports.format = Util.format; + + +exports.transform = function (source, transform, options) { + + exports.assert(source === null || source === undefined || typeof source === 'object' || Array.isArray(source), 'Invalid source object: must be null, undefined, an object, or an array'); + const separator = (typeof options === 'object' && options !== null) ? (options.separator || '.') : '.'; + + if (Array.isArray(source)) { + const results = []; + for (let i = 0; i < source.length; ++i) { + results.push(exports.transform(source[i], transform, options)); + } + return results; + } + + const result = {}; + const keys = Object.keys(transform); + + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + const path = key.split(separator); + const sourcePath = transform[key]; + + exports.assert(typeof sourcePath === 'string', 'All mappings must be "." delineated strings'); + + let segment; + let res = result; + + while (path.length > 1) { + segment = path.shift(); + if (!res[segment]) { + res[segment] = {}; + } + res = res[segment]; + } + segment = path.shift(); + res[segment] = exports.reach(source, sourcePath, options); + } + + return result; +}; + + +exports.uniqueFilename = function (path, extension) { + + if (extension) { + extension = extension[0] !== '.' ? '.' + extension : extension; + } + else { + extension = ''; + } + + path = Path.resolve(path); + const name = [Date.now(), process.pid, Crypto.randomBytes(8).toString('hex')].join('-') + extension; + return Path.join(path, name); +}; + + +exports.stringify = function () { + + try { + return JSON.stringify.apply(null, arguments); + } + catch (err) { + return '[Cannot display object: ' + err.message + ']'; + } +}; + + +exports.shallow = function (source) { + + const target = {}; + const keys = Object.keys(source); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + target[key] = source[key]; + } + + return target; +}; diff --git a/appasar/canary/node_modules/hoek/package.json b/appasar/canary/node_modules/hoek/package.json new file mode 100644 index 0000000..9e605de --- /dev/null +++ b/appasar/canary/node_modules/hoek/package.json @@ -0,0 +1,23 @@ +{ + "name": "hoek", + "description": "General purpose node utilities", + "version": "4.2.1", + "repository": "git://github.com/hapijs/hoek", + "main": "lib/index.js", + "keywords": [ + "utilities" + ], + "engines": { + "node": ">=4.0.0" + }, + "dependencies": {}, + "devDependencies": { + "code": "4.x.x", + "lab": "13.x.x" + }, + "scripts": { + "test": "lab -a code -t 100 -L", + "test-cov-html": "lab -a code -t 100 -L -r html -o coverage.html" + }, + "license": "BSD-3-Clause" +} diff --git a/appasar/canary/node_modules/http-signature/.dir-locals.el b/appasar/canary/node_modules/http-signature/.dir-locals.el new file mode 100644 index 0000000..3bc9235 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/.dir-locals.el @@ -0,0 +1,6 @@ +((nil . ((indent-tabs-mode . nil) + (tab-width . 8) + (fill-column . 80))) + (js-mode . ((js-indent-level . 2) + (indent-tabs-mode . nil) + ))) \ No newline at end of file diff --git a/appasar/canary/node_modules/http-signature/.npmignore b/appasar/canary/node_modules/http-signature/.npmignore new file mode 100644 index 0000000..c143fb3 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/.npmignore @@ -0,0 +1,7 @@ +.gitmodules +deps +docs +Makefile +node_modules +test +tools \ No newline at end of file diff --git a/appasar/canary/node_modules/http-signature/CHANGES.md b/appasar/canary/node_modules/http-signature/CHANGES.md new file mode 100644 index 0000000..6f69444 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/CHANGES.md @@ -0,0 +1,46 @@ +# node-http-signature changelog + +## 1.1.1 + +- Version of dependency `assert-plus` updated: old version was missing + some license information +- Corrected examples in `http_signing.md`, added auto-tests to + automatically validate these examples + +## 1.1.0 + +- Bump version of `sshpk` dependency, remove peerDependency on it since + it now supports exchanging objects between multiple versions of itself + where possible + +## 1.0.2 + +- Bump min version of `jsprim` dependency, to include fixes for using + http-signature with `browserify` + +## 1.0.1 + +- Bump minimum version of `sshpk` dependency, to include fixes for + whitespace tolerance in key parsing. + +## 1.0.0 + +- First semver release. +- #36: Ensure verifySignature does not leak useful timing information +- #42: Bring the library up to the latest version of the spec (including the + request-target changes) +- Support for ECDSA keys and signatures. +- Now uses `sshpk` for key parsing, validation and conversion. +- Fixes for #21, #47, #39 and compatibility with node 0.8 + +## 0.11.0 + +- Split up HMAC and Signature verification to avoid vulnerabilities where a + key intended for use with one can be validated against the other method + instead. + +## 0.10.2 + +- Updated versions of most dependencies. +- Utility functions exported for PEM => SSH-RSA conversion. +- Improvements to tests and examples. diff --git a/appasar/canary/node_modules/http-signature/LICENSE b/appasar/canary/node_modules/http-signature/LICENSE new file mode 100644 index 0000000..f6d947d --- /dev/null +++ b/appasar/canary/node_modules/http-signature/LICENSE @@ -0,0 +1,18 @@ +Copyright Joyent, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/http-signature/README.md b/appasar/canary/node_modules/http-signature/README.md new file mode 100644 index 0000000..de487d3 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/README.md @@ -0,0 +1,79 @@ +# node-http-signature + +node-http-signature is a node.js library that has client and server components +for Joyent's [HTTP Signature Scheme](http_signing.md). + +## Usage + +Note the example below signs a request with the same key/cert used to start an +HTTP server. This is almost certainly not what you actually want, but is just +used to illustrate the API calls; you will need to provide your own key +management in addition to this library. + +### Client + +```js +var fs = require('fs'); +var https = require('https'); +var httpSignature = require('http-signature'); + +var key = fs.readFileSync('./key.pem', 'ascii'); + +var options = { + host: 'localhost', + port: 8443, + path: '/', + method: 'GET', + headers: {} +}; + +// Adds a 'Date' header in, signs it, and adds the +// 'Authorization' header in. +var req = https.request(options, function(res) { + console.log(res.statusCode); +}); + + +httpSignature.sign(req, { + key: key, + keyId: './cert.pem' +}); + +req.end(); +``` + +### Server + +```js +var fs = require('fs'); +var https = require('https'); +var httpSignature = require('http-signature'); + +var options = { + key: fs.readFileSync('./key.pem'), + cert: fs.readFileSync('./cert.pem') +}; + +https.createServer(options, function (req, res) { + var rc = 200; + var parsed = httpSignature.parseRequest(req); + var pub = fs.readFileSync(parsed.keyId, 'ascii'); + if (!httpSignature.verifySignature(parsed, pub)) + rc = 401; + + res.writeHead(rc); + res.end(); +}).listen(8443); +``` + +## Installation + + npm install http-signature + +## License + +MIT. + +## Bugs + +See <https://github.com/joyent/node-http-signature/issues>. diff --git a/appasar/canary/node_modules/http-signature/http_signing.md b/appasar/canary/node_modules/http-signature/http_signing.md new file mode 100644 index 0000000..4f24d28 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/http_signing.md @@ -0,0 +1,363 @@ +# Abstract + +This document describes a way to add origin authentication, message integrity, +and replay resistance to HTTP REST requests. It is intended to be used over +the HTTPS protocol. + +# Copyright Notice + +Copyright (c) 2011 Joyent, Inc. and the persons identified as document authors. +All rights reserved. + +Code Components extracted from this document must include MIT License text. + +# Introduction + +This protocol is intended to provide a standard way for clients to sign HTTP +requests. RFC2617 (HTTP Authentication) defines Basic and Digest authentication +mechanisms, and RFC5246 (TLS 1.2) defines client-auth, both of which are widely +employed on the Internet today. However, it is common place that the burdens of +PKI prevent web service operators from deploying that methodology, and so many +fall back to Basic authentication, which has poor security characteristics. + +Additionally, OAuth provides a fully-specified alternative for authorization +of web service requests, but is not (always) ideal for machine to machine +communication, as the key acquisition steps (generally) imply a fixed +infrastructure that may not make sense to a service provider (e.g., symmetric +keys). + +Several web service providers have invented their own schemes for signing +HTTP requests, but to date, none have been placed in the public domain as a +standard. This document serves that purpose. There are no techniques in this +proposal that are novel beyond previous art, however, this aims to be a simple +mechanism for signing these requests. + +# Signature Authentication Scheme + +The "signature" authentication scheme is based on the model that the client must +authenticate itself with a digital signature produced by either a private +asymmetric key (e.g., RSA) or a shared symmetric key (e.g., HMAC). The scheme +is parameterized enough such that it is not bound to any particular key type or +signing algorithm. However, it does explicitly assume that clients can send an +HTTP `Date` header. + +## Authorization Header + +The client is expected to send an Authorization header (as defined in RFC 2617) +with the following parameterization: + + credentials := "Signature" params + params := 1#(keyId | algorithm | [headers] | [ext] | signature) + digitalSignature := plain-string + + keyId := "keyId" "=" <"> plain-string <"> + algorithm := "algorithm" "=" <"> plain-string <"> + headers := "headers" "=" <"> 1#headers-value <"> + ext := "ext" "=" <"> plain-string <"> + signature := "signature" "=" <"> plain-string <"> + + headers-value := plain-string + plain-string = 1*( %x20-21 / %x23-5B / %x5D-7E ) + +### Signature Parameters + +#### keyId + +REQUIRED. The `keyId` field is an opaque string that the server can use to look +up the component they need to validate the signature. It could be an SSH key +fingerprint, an LDAP DN, etc. Management of keys and assignment of `keyId` is +out of scope for this document. + +#### algorithm + +REQUIRED. The `algorithm` parameter is used if the client and server agree on a +non-standard digital signature algorithm. The full list of supported signature +mechanisms is listed below. + +#### headers + +OPTIONAL. The `headers` parameter is used to specify the list of HTTP headers +used to sign the request. If specified, it should be a quoted list of HTTP +header names, separated by a single space character. By default, only one +HTTP header is signed, which is the `Date` header. Note that the list MUST be +specified in the order the values are concatenated together during signing. To +include the HTTP request line in the signature calculation, use the special +`request-line` value. While this is overloading the definition of `headers` in +HTTP linguism, the request-line is defined in RFC 2616, and as the outlier from +headers in useful signature calculation, it is deemed simpler to simply use +`request-line` than to add a separate parameter for it. + +#### extensions + +OPTIONAL. The `extensions` parameter is used to include additional information +which is covered by the request. The content and format of the string is out of +scope for this document, and expected to be specified by implementors. + +#### signature + +REQUIRED. The `signature` parameter is a `Base64` encoded digital signature +generated by the client. The client uses the `algorithm` and `headers` request +parameters to form a canonicalized `signing string`. This `signing string` is +then signed with the key associated with `keyId` and the algorithm +corresponding to `algorithm`. The `signature` parameter is then set to the +`Base64` encoding of the signature. + +### Signing String Composition + +In order to generate the string that is signed with a key, the client MUST take +the values of each HTTP header specified by `headers` in the order they appear. + +1. If the header name is not `request-line` then append the lowercased header + name followed with an ASCII colon `:` and an ASCII space ` `. +2. If the header name is `request-line` then append the HTTP request line, + otherwise append the header value. +3. If value is not the last value then append an ASCII newline `\n`. The string + MUST NOT include a trailing ASCII newline. + +# Example Requests + +All requests refer to the following request (body omitted): + + POST /foo HTTP/1.1 + Host: example.org + Date: Tue, 07 Jun 2014 20:51:35 GMT + Content-Type: application/json + Digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= + Content-Length: 18 + +The "rsa-key-1" keyId refers to a private key known to the client and a public +key known to the server. The "hmac-key-1" keyId refers to key known to the +client and server. + +## Default parameterization + +The authorization header and signature would be generated as: + + Authorization: Signature keyId="rsa-key-1",algorithm="rsa-sha256",signature="Base64(RSA-SHA256(signing string))" + +The client would compose the signing string as: + + date: Tue, 07 Jun 2014 20:51:35 GMT + +## Header List + +The authorization header and signature would be generated as: + + Authorization: Signature keyId="rsa-key-1",algorithm="rsa-sha256",headers="(request-target) date content-type digest",signature="Base64(RSA-SHA256(signing string))" + +The client would compose the signing string as (`+ "\n"` inserted for +readability): + + (request-target) post /foo + "\n" + date: Tue, 07 Jun 2011 20:51:35 GMT + "\n" + content-type: application/json + "\n" + digest: SHA-256=Base64(SHA256(Body)) + +## Algorithm + +The authorization header and signature would be generated as: + + Authorization: Signature keyId="hmac-key-1",algorithm="hmac-sha1",signature="Base64(HMAC-SHA1(signing string))" + +The client would compose the signing string as: + + date: Tue, 07 Jun 2011 20:51:35 GMT + +# Signing Algorithms + +Currently supported algorithm names are: + +* rsa-sha1 +* rsa-sha256 +* rsa-sha512 +* dsa-sha1 +* hmac-sha1 +* hmac-sha256 +* hmac-sha512 + +# Security Considerations + +## Default Parameters + +Note the default parameterization of the `Signature` scheme is only safe if all +requests are carried over a secure transport (i.e., TLS). Sending the default +scheme over a non-secure transport will leave the request vulnerable to +spoofing, tampering, replay/repudiation, and integrity violations (if using the +STRIDE threat-modeling methodology). + +## Insecure Transports + +If sending the request over plain HTTP, service providers SHOULD require clients +to sign ALL HTTP headers, and the `request-line`. Additionally, service +providers SHOULD require `Content-MD5` calculations to be performed to ensure +against any tampering from clients. + +## Nonces + +Nonces are out of scope for this document simply because many service providers +fail to implement them correctly, or do not adopt security specifications +because of the infrastructure complexity. Given the `header` parameterization, +a service provider is fully enabled to add nonce semantics into this scheme by +using something like an `x-request-nonce` header, and ensuring it is signed +with the `Date` header. + +## Clock Skew + +As the default scheme is to sign the `Date` header, service providers SHOULD +protect against logged replay attacks by enforcing a clock skew. The server +SHOULD be synchronized with NTP, and the recommendation in this specification +is to allow 300s of clock skew (in either direction). + +## Required Headers to Sign + +It is out of scope for this document to dictate what headers a service provider +will want to enforce, but service providers SHOULD at minimum include the +`Date` header. + +# References + +## Normative References + +* [RFC2616] Hypertext Transfer Protocol -- HTTP/1.1 +* [RFC2617] HTTP Authentication: Basic and Digest Access Authentication +* [RFC5246] The Transport Layer Security (TLS) Protocol Version 1.2 + +## Informative References + + Name: Mark Cavage (editor) + Company: Joyent, Inc. + Email: mark.cavage@joyent.com + URI: http://www.joyent.com + +# Appendix A - Test Values + +The following test data uses the RSA (1024b) keys, which we will refer +to as `keyId=Test` in the following samples: + + -----BEGIN PUBLIC KEY----- + MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCFENGw33yGihy92pDjZQhl0C3 + 6rPJj+CvfSC8+q28hxA161QFNUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6 + Z4UMR7EOcpfdUE9Hf3m/hs+FUR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJw + oYi+1hqp1fIekaxsyQIDAQAB + -----END PUBLIC KEY----- + + -----BEGIN RSA PRIVATE KEY----- + MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF + NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F + UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB + AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA + QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK + kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg + f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u + 412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc + mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7 + kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA + gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW + G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI + 7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA== + -----END RSA PRIVATE KEY----- + +And all examples use this request: + +<!-- httpreq --> + + POST /foo?param=value&pet=dog HTTP/1.1 + Host: example.com + Date: Thu, 05 Jan 2014 21:31:40 GMT + Content-Type: application/json + Digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= + Content-Length: 18 + + {"hello": "world"} + +<!-- /httpreq --> + +### Default + +The string to sign would be: + +<!-- sign {"name": "Default", "options": {"keyId":"Test", "algorithm": "rsa-sha256"}} --> +<!-- signstring --> + + date: Thu, 05 Jan 2014 21:31:40 GMT + +<!-- /signstring --> + +The Authorization header would be: + +<!-- authz --> + + Authorization: Signature keyId="Test",algorithm="rsa-sha256",headers="date",signature="jKyvPcxB4JbmYY4mByyBY7cZfNl4OW9HpFQlG7N4YcJPteKTu4MWCLyk+gIr0wDgqtLWf9NLpMAMimdfsH7FSWGfbMFSrsVTHNTk0rK3usrfFnti1dxsM4jl0kYJCKTGI/UWkqiaxwNiKqGcdlEDrTcUhhsFsOIo8VhddmZTZ8w=" + +<!-- /authz --> + +### All Headers + +Parameterized to include all headers, the string to sign would be (`+ "\n"` +inserted for readability): + +<!-- sign {"name": "All Headers", "options": {"keyId":"Test", "algorithm": "rsa-sha256", "headers": ["(request-target)", "host", "date", "content-type", "digest", "content-length"]}} --> +<!-- signstring --> + + (request-target): post /foo?param=value&pet=dog + host: example.com + date: Thu, 05 Jan 2014 21:31:40 GMT + content-type: application/json + digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= + content-length: 18 + +<!-- /signstring --> + +The Authorization header would be: + +<!-- authz --> + + Authorization: Signature keyId="Test",algorithm="rsa-sha256",headers="(request-target) host date content-type digest content-length",signature="Ef7MlxLXoBovhil3AlyjtBwAL9g4TN3tibLj7uuNB3CROat/9KaeQ4hW2NiJ+pZ6HQEOx9vYZAyi+7cmIkmJszJCut5kQLAwuX+Ms/mUFvpKlSo9StS2bMXDBNjOh4Auj774GFj4gwjS+3NhFeoqyr/MuN6HsEnkvn6zdgfE2i0=" + +<!-- /authz --> + +## Generating and verifying signatures using `openssl` + +The `openssl` commandline tool can be used to generate or verify the signatures listed above. + +Compose the signing string as usual, and pipe it into the the `openssl dgst` command, then into `openssl enc -base64`, as follows: + + $ printf 'date: Thu, 05 Jan 2014 21:31:40 GMT' | \ + openssl dgst -binary -sign /path/to/private.pem -sha256 | \ + openssl enc -base64 + jKyvPcxB4JbmYY4mByyBY7cZfNl4OW9Hp... + $ + +The `-sha256` option is necessary to produce an `rsa-sha256` signature. You can select other hash algorithms such as `sha1` by changing this argument. + +To verify a signature, first save the signature data, Base64-decoded, into a file, then use `openssl dgst` again with the `-verify` option: + + $ echo 'jKyvPcxB4JbmYY4mByy...' | openssl enc -A -d -base64 > signature + $ printf 'date: Thu, 05 Jan 2014 21:31:40 GMT' | \ + openssl dgst -sha256 -verify /path/to/public.pem -signature ./signature + Verified OK + $ + +## Generating and verifying signatures using `sshpk-sign` + +You can also generate and check signatures using the `sshpk-sign` tool which is +included with the `sshpk` package in `npm`. + +Compose the signing string as above, and pipe it into `sshpk-sign` as follows: + + $ printf 'date: Thu, 05 Jan 2014 21:31:40 GMT' | \ + sshpk-sign -i /path/to/private.pem + jKyvPcxB4JbmYY4mByyBY7cZfNl4OW9Hp... + $ + +This will produce an `rsa-sha256` signature by default, as you can see using +the `-v` option: + + sshpk-sign: using rsa-sha256 with a 1024 bit key + +You can also use `sshpk-verify` in a similar manner: + + $ printf 'date: Thu, 05 Jan 2014 21:31:40 GMT' | \ + sshpk-verify -i ./public.pem -s 'jKyvPcxB4JbmYY...' + OK + $ diff --git a/appasar/canary/node_modules/http-signature/lib/index.js b/appasar/canary/node_modules/http-signature/lib/index.js new file mode 100644 index 0000000..54d4603 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/lib/index.js @@ -0,0 +1,29 @@ +// Copyright 2015 Joyent, Inc. + +var parser = require('./parser'); +var signer = require('./signer'); +var verify = require('./verify'); +var utils = require('./utils'); + + + +///--- API + +module.exports = { + + parse: parser.parseRequest, + parseRequest: parser.parseRequest, + + sign: signer.signRequest, + signRequest: signer.signRequest, + createSigner: signer.createSigner, + isSigner: signer.isSigner, + + sshKeyToPEM: utils.sshKeyToPEM, + sshKeyFingerprint: utils.fingerprint, + pemToRsaSSHKey: utils.pemToRsaSSHKey, + + verify: verify.verifySignature, + verifySignature: verify.verifySignature, + verifyHMAC: verify.verifyHMAC +}; diff --git a/appasar/canary/node_modules/http-signature/lib/parser.js b/appasar/canary/node_modules/http-signature/lib/parser.js new file mode 100644 index 0000000..5994a7e --- /dev/null +++ b/appasar/canary/node_modules/http-signature/lib/parser.js @@ -0,0 +1,315 @@ +// Copyright 2012 Joyent, Inc. All rights reserved. + +var assert = require('assert-plus'); +var util = require('util'); +var utils = require('./utils'); + + + +///--- Globals + +var HASH_ALGOS = utils.HASH_ALGOS; +var PK_ALGOS = utils.PK_ALGOS; +var HttpSignatureError = utils.HttpSignatureError; +var InvalidAlgorithmError = utils.InvalidAlgorithmError; +var validateAlgorithm = utils.validateAlgorithm; + +var State = { + New: 0, + Params: 1 +}; + +var ParamsState = { + Name: 0, + Quote: 1, + Value: 2, + Comma: 3 +}; + + +///--- Specific Errors + + +function ExpiredRequestError(message) { + HttpSignatureError.call(this, message, ExpiredRequestError); +} +util.inherits(ExpiredRequestError, HttpSignatureError); + + +function InvalidHeaderError(message) { + HttpSignatureError.call(this, message, InvalidHeaderError); +} +util.inherits(InvalidHeaderError, HttpSignatureError); + + +function InvalidParamsError(message) { + HttpSignatureError.call(this, message, InvalidParamsError); +} +util.inherits(InvalidParamsError, HttpSignatureError); + + +function MissingHeaderError(message) { + HttpSignatureError.call(this, message, MissingHeaderError); +} +util.inherits(MissingHeaderError, HttpSignatureError); + +function StrictParsingError(message) { + HttpSignatureError.call(this, message, StrictParsingError); +} +util.inherits(StrictParsingError, HttpSignatureError); + +///--- Exported API + +module.exports = { + + /** + * Parses the 'Authorization' header out of an http.ServerRequest object. + * + * Note that this API will fully validate the Authorization header, and throw + * on any error. It will not however check the signature, or the keyId format + * as those are specific to your environment. You can use the options object + * to pass in extra constraints. + * + * As a response object you can expect this: + * + * { + * "scheme": "Signature", + * "params": { + * "keyId": "foo", + * "algorithm": "rsa-sha256", + * "headers": [ + * "date" or "x-date", + * "digest" + * ], + * "signature": "base64" + * }, + * "signingString": "ready to be passed to crypto.verify()" + * } + * + * @param {Object} request an http.ServerRequest. + * @param {Object} options an optional options object with: + * - clockSkew: allowed clock skew in seconds (default 300). + * - headers: required header names (def: date or x-date) + * - algorithms: algorithms to support (default: all). + * - strict: should enforce latest spec parsing + * (default: false). + * @return {Object} parsed out object (see above). + * @throws {TypeError} on invalid input. + * @throws {InvalidHeaderError} on an invalid Authorization header error. + * @throws {InvalidParamsError} if the params in the scheme are invalid. + * @throws {MissingHeaderError} if the params indicate a header not present, + * either in the request headers from the params, + * or not in the params from a required header + * in options. + * @throws {StrictParsingError} if old attributes are used in strict parsing + * mode. + * @throws {ExpiredRequestError} if the value of date or x-date exceeds skew. + */ + parseRequest: function parseRequest(request, options) { + assert.object(request, 'request'); + assert.object(request.headers, 'request.headers'); + if (options === undefined) { + options = {}; + } + if (options.headers === undefined) { + options.headers = [request.headers['x-date'] ? 'x-date' : 'date']; + } + assert.object(options, 'options'); + assert.arrayOfString(options.headers, 'options.headers'); + assert.optionalFinite(options.clockSkew, 'options.clockSkew'); + + var authzHeaderName = options.authorizationHeaderName || 'authorization'; + + if (!request.headers[authzHeaderName]) { + throw new MissingHeaderError('no ' + authzHeaderName + ' header ' + + 'present in the request'); + } + + options.clockSkew = options.clockSkew || 300; + + + var i = 0; + var state = State.New; + var substate = ParamsState.Name; + var tmpName = ''; + var tmpValue = ''; + + var parsed = { + scheme: '', + params: {}, + signingString: '' + }; + + var authz = request.headers[authzHeaderName]; + for (i = 0; i < authz.length; i++) { + var c = authz.charAt(i); + + switch (Number(state)) { + + case State.New: + if (c !== ' ') parsed.scheme += c; + else state = State.Params; + break; + + case State.Params: + switch (Number(substate)) { + + case ParamsState.Name: + var code = c.charCodeAt(0); + // restricted name of A-Z / a-z + if ((code >= 0x41 && code <= 0x5a) || // A-Z + (code >= 0x61 && code <= 0x7a)) { // a-z + tmpName += c; + } else if (c === '=') { + if (tmpName.length === 0) + throw new InvalidHeaderError('bad param format'); + substate = ParamsState.Quote; + } else { + throw new InvalidHeaderError('bad param format'); + } + break; + + case ParamsState.Quote: + if (c === '"') { + tmpValue = ''; + substate = ParamsState.Value; + } else { + throw new InvalidHeaderError('bad param format'); + } + break; + + case ParamsState.Value: + if (c === '"') { + parsed.params[tmpName] = tmpValue; + substate = ParamsState.Comma; + } else { + tmpValue += c; + } + break; + + case ParamsState.Comma: + if (c === ',') { + tmpName = ''; + substate = ParamsState.Name; + } else { + throw new InvalidHeaderError('bad param format'); + } + break; + + default: + throw new Error('Invalid substate'); + } + break; + + default: + throw new Error('Invalid substate'); + } + + } + + if (!parsed.params.headers || parsed.params.headers === '') { + if (request.headers['x-date']) { + parsed.params.headers = ['x-date']; + } else { + parsed.params.headers = ['date']; + } + } else { + parsed.params.headers = parsed.params.headers.split(' '); + } + + // Minimally validate the parsed object + if (!parsed.scheme || parsed.scheme !== 'Signature') + throw new InvalidHeaderError('scheme was not "Signature"'); + + if (!parsed.params.keyId) + throw new InvalidHeaderError('keyId was not specified'); + + if (!parsed.params.algorithm) + throw new InvalidHeaderError('algorithm was not specified'); + + if (!parsed.params.signature) + throw new InvalidHeaderError('signature was not specified'); + + // Check the algorithm against the official list + parsed.params.algorithm = parsed.params.algorithm.toLowerCase(); + try { + validateAlgorithm(parsed.params.algorithm); + } catch (e) { + if (e instanceof InvalidAlgorithmError) + throw (new InvalidParamsError(parsed.params.algorithm + ' is not ' + + 'supported')); + else + throw (e); + } + + // Build the signingString + for (i = 0; i < parsed.params.headers.length; i++) { + var h = parsed.params.headers[i].toLowerCase(); + parsed.params.headers[i] = h; + + if (h === 'request-line') { + if (!options.strict) { + /* + * We allow headers from the older spec drafts if strict parsing isn't + * specified in options. + */ + parsed.signingString += + request.method + ' ' + request.url + ' HTTP/' + request.httpVersion; + } else { + /* Strict parsing doesn't allow older draft headers. */ + throw (new StrictParsingError('request-line is not a valid header ' + + 'with strict parsing enabled.')); + } + } else if (h === '(request-target)') { + parsed.signingString += + '(request-target): ' + request.method.toLowerCase() + ' ' + + request.url; + } else { + var value = request.headers[h]; + if (value === undefined) + throw new MissingHeaderError(h + ' was not in the request'); + parsed.signingString += h + ': ' + value; + } + + if ((i + 1) < parsed.params.headers.length) + parsed.signingString += '\n'; + } + + // Check against the constraints + var date; + if (request.headers.date || request.headers['x-date']) { + if (request.headers['x-date']) { + date = new Date(request.headers['x-date']); + } else { + date = new Date(request.headers.date); + } + var now = new Date(); + var skew = Math.abs(now.getTime() - date.getTime()); + + if (skew > options.clockSkew * 1000) { + throw new ExpiredRequestError('clock skew of ' + + (skew / 1000) + + 's was greater than ' + + options.clockSkew + 's'); + } + } + + options.headers.forEach(function (hdr) { + // Remember that we already checked any headers in the params + // were in the request, so if this passes we're good. + if (parsed.params.headers.indexOf(hdr.toLowerCase()) < 0) + throw new MissingHeaderError(hdr + ' was not a signed header'); + }); + + if (options.algorithms) { + if (options.algorithms.indexOf(parsed.params.algorithm) === -1) + throw new InvalidParamsError(parsed.params.algorithm + + ' is not a supported algorithm'); + } + + parsed.algorithm = parsed.params.algorithm.toUpperCase(); + parsed.keyId = parsed.params.keyId; + return parsed; + } + +}; diff --git a/appasar/canary/node_modules/http-signature/lib/signer.js b/appasar/canary/node_modules/http-signature/lib/signer.js new file mode 100644 index 0000000..deb5878 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/lib/signer.js @@ -0,0 +1,401 @@ +// Copyright 2012 Joyent, Inc. All rights reserved. + +var assert = require('assert-plus'); +var crypto = require('crypto'); +var http = require('http'); +var util = require('util'); +var sshpk = require('sshpk'); +var jsprim = require('jsprim'); +var utils = require('./utils'); + +var sprintf = require('util').format; + +var HASH_ALGOS = utils.HASH_ALGOS; +var PK_ALGOS = utils.PK_ALGOS; +var InvalidAlgorithmError = utils.InvalidAlgorithmError; +var HttpSignatureError = utils.HttpSignatureError; +var validateAlgorithm = utils.validateAlgorithm; + +///--- Globals + +var AUTHZ_FMT = + 'Signature keyId="%s",algorithm="%s",headers="%s",signature="%s"'; + +///--- Specific Errors + +function MissingHeaderError(message) { + HttpSignatureError.call(this, message, MissingHeaderError); +} +util.inherits(MissingHeaderError, HttpSignatureError); + +function StrictParsingError(message) { + HttpSignatureError.call(this, message, StrictParsingError); +} +util.inherits(StrictParsingError, HttpSignatureError); + +/* See createSigner() */ +function RequestSigner(options) { + assert.object(options, 'options'); + + var alg = []; + if (options.algorithm !== undefined) { + assert.string(options.algorithm, 'options.algorithm'); + alg = validateAlgorithm(options.algorithm); + } + this.rs_alg = alg; + + /* + * RequestSigners come in two varieties: ones with an rs_signFunc, and ones + * with an rs_signer. + * + * rs_signFunc-based RequestSigners have to build up their entire signing + * string within the rs_lines array and give it to rs_signFunc as a single + * concat'd blob. rs_signer-based RequestSigners can add a line at a time to + * their signing state by using rs_signer.update(), thus only needing to + * buffer the hash function state and one line at a time. + */ + if (options.sign !== undefined) { + assert.func(options.sign, 'options.sign'); + this.rs_signFunc = options.sign; + + } else if (alg[0] === 'hmac' && options.key !== undefined) { + assert.string(options.keyId, 'options.keyId'); + this.rs_keyId = options.keyId; + + if (typeof (options.key) !== 'string' && !Buffer.isBuffer(options.key)) + throw (new TypeError('options.key for HMAC must be a string or Buffer')); + + /* + * Make an rs_signer for HMACs, not a rs_signFunc -- HMACs digest their + * data in chunks rather than requiring it all to be given in one go + * at the end, so they are more similar to signers than signFuncs. + */ + this.rs_signer = crypto.createHmac(alg[1].toUpperCase(), options.key); + this.rs_signer.sign = function () { + var digest = this.digest('base64'); + return ({ + hashAlgorithm: alg[1], + toString: function () { return (digest); } + }); + }; + + } else if (options.key !== undefined) { + var key = options.key; + if (typeof (key) === 'string' || Buffer.isBuffer(key)) + key = sshpk.parsePrivateKey(key); + + assert.ok(sshpk.PrivateKey.isPrivateKey(key, [1, 2]), + 'options.key must be a sshpk.PrivateKey'); + this.rs_key = key; + + assert.string(options.keyId, 'options.keyId'); + this.rs_keyId = options.keyId; + + if (!PK_ALGOS[key.type]) { + throw (new InvalidAlgorithmError(key.type.toUpperCase() + ' type ' + + 'keys are not supported')); + } + + if (alg[0] !== undefined && key.type !== alg[0]) { + throw (new InvalidAlgorithmError('options.key must be a ' + + alg[0].toUpperCase() + ' key, was given a ' + + key.type.toUpperCase() + ' key instead')); + } + + this.rs_signer = key.createSign(alg[1]); + + } else { + throw (new TypeError('options.sign (func) or options.key is required')); + } + + this.rs_headers = []; + this.rs_lines = []; +} + +/** + * Adds a header to be signed, with its value, into this signer. + * + * @param {String} header + * @param {String} value + * @return {String} value written + */ +RequestSigner.prototype.writeHeader = function (header, value) { + assert.string(header, 'header'); + header = header.toLowerCase(); + assert.string(value, 'value'); + + this.rs_headers.push(header); + + if (this.rs_signFunc) { + this.rs_lines.push(header + ': ' + value); + + } else { + var line = header + ': ' + value; + if (this.rs_headers.length > 0) + line = '\n' + line; + this.rs_signer.update(line); + } + + return (value); +}; + +/** + * Adds a default Date header, returning its value. + * + * @return {String} + */ +RequestSigner.prototype.writeDateHeader = function () { + return (this.writeHeader('date', jsprim.rfc1123(new Date()))); +}; + +/** + * Adds the request target line to be signed. + * + * @param {String} method, HTTP method (e.g. 'get', 'post', 'put') + * @param {String} path + */ +RequestSigner.prototype.writeTarget = function (method, path) { + assert.string(method, 'method'); + assert.string(path, 'path'); + method = method.toLowerCase(); + this.writeHeader('(request-target)', method + ' ' + path); +}; + +/** + * Calculate the value for the Authorization header on this request + * asynchronously. + * + * @param {Func} callback (err, authz) + */ +RequestSigner.prototype.sign = function (cb) { + assert.func(cb, 'callback'); + + if (this.rs_headers.length < 1) + throw (new Error('At least one header must be signed')); + + var alg, authz; + if (this.rs_signFunc) { + var data = this.rs_lines.join('\n'); + var self = this; + this.rs_signFunc(data, function (err, sig) { + if (err) { + cb(err); + return; + } + try { + assert.object(sig, 'signature'); + assert.string(sig.keyId, 'signature.keyId'); + assert.string(sig.algorithm, 'signature.algorithm'); + assert.string(sig.signature, 'signature.signature'); + alg = validateAlgorithm(sig.algorithm); + + authz = sprintf(AUTHZ_FMT, + sig.keyId, + sig.algorithm, + self.rs_headers.join(' '), + sig.signature); + } catch (e) { + cb(e); + return; + } + cb(null, authz); + }); + + } else { + try { + var sigObj = this.rs_signer.sign(); + } catch (e) { + cb(e); + return; + } + alg = (this.rs_alg[0] || this.rs_key.type) + '-' + sigObj.hashAlgorithm; + var signature = sigObj.toString(); + authz = sprintf(AUTHZ_FMT, + this.rs_keyId, + alg, + this.rs_headers.join(' '), + signature); + cb(null, authz); + } +}; + +///--- Exported API + +module.exports = { + /** + * Identifies whether a given object is a request signer or not. + * + * @param {Object} object, the object to identify + * @returns {Boolean} + */ + isSigner: function (obj) { + if (typeof (obj) === 'object' && obj instanceof RequestSigner) + return (true); + return (false); + }, + + /** + * Creates a request signer, used to asynchronously build a signature + * for a request (does not have to be an http.ClientRequest). + * + * @param {Object} options, either: + * - {String} keyId + * - {String|Buffer} key + * - {String} algorithm (optional, required for HMAC) + * or: + * - {Func} sign (data, cb) + * @return {RequestSigner} + */ + createSigner: function createSigner(options) { + return (new RequestSigner(options)); + }, + + /** + * Adds an 'Authorization' header to an http.ClientRequest object. + * + * Note that this API will add a Date header if it's not already set. Any + * other headers in the options.headers array MUST be present, or this + * will throw. + * + * You shouldn't need to check the return type; it's just there if you want + * to be pedantic. + * + * The optional flag indicates whether parsing should use strict enforcement + * of the version draft-cavage-http-signatures-04 of the spec or beyond. + * The default is to be loose and support + * older versions for compatibility. + * + * @param {Object} request an instance of http.ClientRequest. + * @param {Object} options signing parameters object: + * - {String} keyId required. + * - {String} key required (either a PEM or HMAC key). + * - {Array} headers optional; defaults to ['date']. + * - {String} algorithm optional (unless key is HMAC); + * default is the same as the sshpk default + * signing algorithm for the type of key given + * - {String} httpVersion optional; defaults to '1.1'. + * - {Boolean} strict optional; defaults to 'false'. + * @return {Boolean} true if Authorization (and optionally Date) were added. + * @throws {TypeError} on bad parameter types (input). + * @throws {InvalidAlgorithmError} if algorithm was bad or incompatible with + * the given key. + * @throws {sshpk.KeyParseError} if key was bad. + * @throws {MissingHeaderError} if a header to be signed was specified but + * was not present. + */ + signRequest: function signRequest(request, options) { + assert.object(request, 'request'); + assert.object(options, 'options'); + assert.optionalString(options.algorithm, 'options.algorithm'); + assert.string(options.keyId, 'options.keyId'); + assert.optionalArrayOfString(options.headers, 'options.headers'); + assert.optionalString(options.httpVersion, 'options.httpVersion'); + + if (!request.getHeader('Date')) + request.setHeader('Date', jsprim.rfc1123(new Date())); + if (!options.headers) + options.headers = ['date']; + if (!options.httpVersion) + options.httpVersion = '1.1'; + + var alg = []; + if (options.algorithm) { + options.algorithm = options.algorithm.toLowerCase(); + alg = validateAlgorithm(options.algorithm); + } + + var i; + var stringToSign = ''; + for (i = 0; i < options.headers.length; i++) { + if (typeof (options.headers[i]) !== 'string') + throw new TypeError('options.headers must be an array of Strings'); + + var h = options.headers[i].toLowerCase(); + + if (h === 'request-line') { + if (!options.strict) { + /** + * We allow headers from the older spec drafts if strict parsing isn't + * specified in options. + */ + stringToSign += + request.method + ' ' + request.path + ' HTTP/' + + options.httpVersion; + } else { + /* Strict parsing doesn't allow older draft headers. */ + throw (new StrictParsingError('request-line is not a valid header ' + + 'with strict parsing enabled.')); + } + } else if (h === '(request-target)') { + stringToSign += + '(request-target): ' + request.method.toLowerCase() + ' ' + + request.path; + } else { + var value = request.getHeader(h); + if (value === undefined || value === '') { + throw new MissingHeaderError(h + ' was not in the request'); + } + stringToSign += h + ': ' + value; + } + + if ((i + 1) < options.headers.length) + stringToSign += '\n'; + } + + /* This is just for unit tests. */ + if (request.hasOwnProperty('_stringToSign')) { + request._stringToSign = stringToSign; + } + + var signature; + if (alg[0] === 'hmac') { + if (typeof (options.key) !== 'string' && !Buffer.isBuffer(options.key)) + throw (new TypeError('options.key must be a string or Buffer')); + + var hmac = crypto.createHmac(alg[1].toUpperCase(), options.key); + hmac.update(stringToSign); + signature = hmac.digest('base64'); + + } else { + var key = options.key; + if (typeof (key) === 'string' || Buffer.isBuffer(key)) + key = sshpk.parsePrivateKey(options.key); + + assert.ok(sshpk.PrivateKey.isPrivateKey(key, [1, 2]), + 'options.key must be a sshpk.PrivateKey'); + + if (!PK_ALGOS[key.type]) { + throw (new InvalidAlgorithmError(key.type.toUpperCase() + ' type ' + + 'keys are not supported')); + } + + if (alg[0] !== undefined && key.type !== alg[0]) { + throw (new InvalidAlgorithmError('options.key must be a ' + + alg[0].toUpperCase() + ' key, was given a ' + + key.type.toUpperCase() + ' key instead')); + } + + var signer = key.createSign(alg[1]); + signer.update(stringToSign); + var sigObj = signer.sign(); + if (!HASH_ALGOS[sigObj.hashAlgorithm]) { + throw (new InvalidAlgorithmError(sigObj.hashAlgorithm.toUpperCase() + + ' is not a supported hash algorithm')); + } + options.algorithm = key.type + '-' + sigObj.hashAlgorithm; + signature = sigObj.toString(); + assert.notStrictEqual(signature, '', 'empty signature produced'); + } + + var authzHeaderName = options.authorizationHeaderName || 'Authorization'; + + request.setHeader(authzHeaderName, sprintf(AUTHZ_FMT, + options.keyId, + options.algorithm, + options.headers.join(' '), + signature)); + + return true; + } + +}; diff --git a/appasar/canary/node_modules/http-signature/lib/utils.js b/appasar/canary/node_modules/http-signature/lib/utils.js new file mode 100644 index 0000000..bbf2aa8 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/lib/utils.js @@ -0,0 +1,112 @@ +// Copyright 2012 Joyent, Inc. All rights reserved. + +var assert = require('assert-plus'); +var sshpk = require('sshpk'); +var util = require('util'); + +var HASH_ALGOS = { + 'sha1': true, + 'sha256': true, + 'sha512': true +}; + +var PK_ALGOS = { + 'rsa': true, + 'dsa': true, + 'ecdsa': true +}; + +function HttpSignatureError(message, caller) { + if (Error.captureStackTrace) + Error.captureStackTrace(this, caller || HttpSignatureError); + + this.message = message; + this.name = caller.name; +} +util.inherits(HttpSignatureError, Error); + +function InvalidAlgorithmError(message) { + HttpSignatureError.call(this, message, InvalidAlgorithmError); +} +util.inherits(InvalidAlgorithmError, HttpSignatureError); + +function validateAlgorithm(algorithm) { + var alg = algorithm.toLowerCase().split('-'); + + if (alg.length !== 2) { + throw (new InvalidAlgorithmError(alg[0].toUpperCase() + ' is not a ' + + 'valid algorithm')); + } + + if (alg[0] !== 'hmac' && !PK_ALGOS[alg[0]]) { + throw (new InvalidAlgorithmError(alg[0].toUpperCase() + ' type keys ' + + 'are not supported')); + } + + if (!HASH_ALGOS[alg[1]]) { + throw (new InvalidAlgorithmError(alg[1].toUpperCase() + ' is not a ' + + 'supported hash algorithm')); + } + + return (alg); +} + +///--- API + +module.exports = { + + HASH_ALGOS: HASH_ALGOS, + PK_ALGOS: PK_ALGOS, + + HttpSignatureError: HttpSignatureError, + InvalidAlgorithmError: InvalidAlgorithmError, + + validateAlgorithm: validateAlgorithm, + + /** + * Converts an OpenSSH public key (rsa only) to a PKCS#8 PEM file. + * + * The intent of this module is to interoperate with OpenSSL only, + * specifically the node crypto module's `verify` method. + * + * @param {String} key an OpenSSH public key. + * @return {String} PEM encoded form of the RSA public key. + * @throws {TypeError} on bad input. + * @throws {Error} on invalid ssh key formatted data. + */ + sshKeyToPEM: function sshKeyToPEM(key) { + assert.string(key, 'ssh_key'); + + var k = sshpk.parseKey(key, 'ssh'); + return (k.toString('pem')); + }, + + + /** + * Generates an OpenSSH fingerprint from an ssh public key. + * + * @param {String} key an OpenSSH public key. + * @return {String} key fingerprint. + * @throws {TypeError} on bad input. + * @throws {Error} if what you passed doesn't look like an ssh public key. + */ + fingerprint: function fingerprint(key) { + assert.string(key, 'ssh_key'); + + var k = sshpk.parseKey(key, 'ssh'); + return (k.fingerprint('md5').toString('hex')); + }, + + /** + * Converts a PKGCS#8 PEM file to an OpenSSH public key (rsa) + * + * The reverse of the above function. + */ + pemToRsaSSHKey: function pemToRsaSSHKey(pem, comment) { + assert.equal('string', typeof (pem), 'typeof pem'); + + var k = sshpk.parseKey(pem, 'pem'); + k.comment = comment; + return (k.toString('ssh')); + } +}; diff --git a/appasar/canary/node_modules/http-signature/lib/verify.js b/appasar/canary/node_modules/http-signature/lib/verify.js new file mode 100644 index 0000000..b053fd6 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/lib/verify.js @@ -0,0 +1,88 @@ +// Copyright 2015 Joyent, Inc. + +var assert = require('assert-plus'); +var crypto = require('crypto'); +var sshpk = require('sshpk'); +var utils = require('./utils'); + +var HASH_ALGOS = utils.HASH_ALGOS; +var PK_ALGOS = utils.PK_ALGOS; +var InvalidAlgorithmError = utils.InvalidAlgorithmError; +var HttpSignatureError = utils.HttpSignatureError; +var validateAlgorithm = utils.validateAlgorithm; + +///--- Exported API + +module.exports = { + /** + * Verify RSA/DSA signature against public key. You are expected to pass in + * an object that was returned from `parse()`. + * + * @param {Object} parsedSignature the object you got from `parse`. + * @param {String} pubkey RSA/DSA private key PEM. + * @return {Boolean} true if valid, false otherwise. + * @throws {TypeError} if you pass in bad arguments. + * @throws {InvalidAlgorithmError} + */ + verifySignature: function verifySignature(parsedSignature, pubkey) { + assert.object(parsedSignature, 'parsedSignature'); + if (typeof (pubkey) === 'string' || Buffer.isBuffer(pubkey)) + pubkey = sshpk.parseKey(pubkey); + assert.ok(sshpk.Key.isKey(pubkey, [1, 1]), 'pubkey must be a sshpk.Key'); + + var alg = validateAlgorithm(parsedSignature.algorithm); + if (alg[0] === 'hmac' || alg[0] !== pubkey.type) + return (false); + + var v = pubkey.createVerify(alg[1]); + v.update(parsedSignature.signingString); + return (v.verify(parsedSignature.params.signature, 'base64')); + }, + + /** + * Verify HMAC against shared secret. You are expected to pass in an object + * that was returned from `parse()`. + * + * @param {Object} parsedSignature the object you got from `parse`. + * @param {String} secret HMAC shared secret. + * @return {Boolean} true if valid, false otherwise. + * @throws {TypeError} if you pass in bad arguments. + * @throws {InvalidAlgorithmError} + */ + verifyHMAC: function verifyHMAC(parsedSignature, secret) { + assert.object(parsedSignature, 'parsedHMAC'); + assert.string(secret, 'secret'); + + var alg = validateAlgorithm(parsedSignature.algorithm); + if (alg[0] !== 'hmac') + return (false); + + var hashAlg = alg[1].toUpperCase(); + + var hmac = crypto.createHmac(hashAlg, secret); + hmac.update(parsedSignature.signingString); + + /* + * Now double-hash to avoid leaking timing information - there's + * no easy constant-time compare in JS, so we use this approach + * instead. See for more info: + * https://www.isecpartners.com/blog/2011/february/double-hmac- + * verification.aspx + */ + var h1 = crypto.createHmac(hashAlg, secret); + h1.update(hmac.digest()); + h1 = h1.digest(); + var h2 = crypto.createHmac(hashAlg, secret); + h2.update(new Buffer(parsedSignature.params.signature, 'base64')); + h2 = h2.digest(); + + /* Node 0.8 returns strings from .digest(). */ + if (typeof (h1) === 'string') + return (h1 === h2); + /* And node 0.10 lacks the .equals() method on Buffers. */ + if (Buffer.isBuffer(h1) && !h1.equals) + return (h1.toString('binary') === h2.toString('binary')); + + return (h1.equals(h2)); + } +}; diff --git a/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-conv b/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-conv new file mode 120000 index 0000000..90cd5a1 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-conv @@ -0,0 +1 @@ +../../../sshpk/bin/sshpk-conv \ No newline at end of file diff --git a/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-sign b/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-sign new file mode 120000 index 0000000..823f106 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-sign @@ -0,0 +1 @@ +../../../sshpk/bin/sshpk-sign \ No newline at end of file diff --git a/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-verify b/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-verify new file mode 120000 index 0000000..9993bf3 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/node_modules/.bin/sshpk-verify @@ -0,0 +1 @@ +../../../sshpk/bin/sshpk-verify \ No newline at end of file diff --git a/appasar/canary/node_modules/http-signature/package.json b/appasar/canary/node_modules/http-signature/package.json new file mode 100644 index 0000000..df07d53 --- /dev/null +++ b/appasar/canary/node_modules/http-signature/package.json @@ -0,0 +1,39 @@ +{ + "name": "http-signature", + "description": "Reference implementation of Joyent's HTTP Signature scheme.", + "version": "1.2.0", + "license": "MIT", + "author": "Joyent, Inc", + "contributors": [ + "Mark Cavage <mcavage@gmail.com>", + "David I. Lehn <dil@lehn.org>", + "Patrick Mooney <patrick.f.mooney@gmail.com>" + ], + "repository": { + "type": "git", + "url": "git://github.com/joyent/node-http-signature.git" + }, + "homepage": "https://github.com/joyent/node-http-signature/", + "bugs": "https://github.com/joyent/node-http-signature/issues", + "keywords": [ + "https", + "request" + ], + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + }, + "main": "lib/index.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "devDependencies": { + "tap": "0.4.2", + "uuid": "^2.0.2" + } +} diff --git a/appasar/canary/node_modules/inflight/LICENSE b/appasar/canary/node_modules/inflight/LICENSE new file mode 100644 index 0000000..05eeeb8 --- /dev/null +++ b/appasar/canary/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/inflight/README.md b/appasar/canary/node_modules/inflight/README.md new file mode 100644 index 0000000..6dc8929 --- /dev/null +++ b/appasar/canary/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/appasar/canary/node_modules/inflight/inflight.js b/appasar/canary/node_modules/inflight/inflight.js new file mode 100644 index 0000000..48202b3 --- /dev/null +++ b/appasar/canary/node_modules/inflight/inflight.js @@ -0,0 +1,54 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/appasar/canary/node_modules/inflight/package.json b/appasar/canary/node_modules/inflight/package.json new file mode 100644 index 0000000..6084d35 --- /dev/null +++ b/appasar/canary/node_modules/inflight/package.json @@ -0,0 +1,29 @@ +{ + "name": "inflight", + "version": "1.0.6", + "description": "Add callbacks to requests in flight to avoid async duplication", + "main": "inflight.js", + "files": [ + "inflight.js" + ], + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^7.1.2" + }, + "scripts": { + "test": "tap test.js --100" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/inflight.git" + }, + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC" +} diff --git a/appasar/canary/node_modules/inherits/LICENSE b/appasar/canary/node_modules/inherits/LICENSE new file mode 100644 index 0000000..dea3013 --- /dev/null +++ b/appasar/canary/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/appasar/canary/node_modules/inherits/README.md b/appasar/canary/node_modules/inherits/README.md new file mode 100644 index 0000000..b1c5665 --- /dev/null +++ b/appasar/canary/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/appasar/canary/node_modules/inherits/inherits.js b/appasar/canary/node_modules/inherits/inherits.js new file mode 100644 index 0000000..3b94763 --- /dev/null +++ b/appasar/canary/node_modules/inherits/inherits.js @@ -0,0 +1,7 @@ +try { + var util = require('util'); + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + module.exports = require('./inherits_browser.js'); +} diff --git a/appasar/canary/node_modules/inherits/inherits_browser.js b/appasar/canary/node_modules/inherits/inherits_browser.js new file mode 100644 index 0000000..c1e78a7 --- /dev/null +++ b/appasar/canary/node_modules/inherits/inherits_browser.js @@ -0,0 +1,23 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} diff --git a/appasar/canary/node_modules/inherits/package.json b/appasar/canary/node_modules/inherits/package.json new file mode 100644 index 0000000..7cf62b9 --- /dev/null +++ b/appasar/canary/node_modules/inherits/package.json @@ -0,0 +1,29 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.3", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": "git://github.com/isaacs/inherits", + "license": "ISC", + "scripts": { + "test": "node test" + }, + "devDependencies": { + "tap": "^7.1.0" + }, + "files": [ + "inherits.js", + "inherits_browser.js" + ] +} diff --git a/appasar/canary/node_modules/is-typedarray/LICENSE.md b/appasar/canary/node_modules/is-typedarray/LICENSE.md new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/appasar/canary/node_modules/is-typedarray/LICENSE.md @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/is-typedarray/README.md b/appasar/canary/node_modules/is-typedarray/README.md new file mode 100644 index 0000000..2752863 --- /dev/null +++ b/appasar/canary/node_modules/is-typedarray/README.md @@ -0,0 +1,16 @@ +# is-typedarray [![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Detect whether or not an object is a +[Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays). + +## Usage + +[![NPM](https://nodei.co/npm/is-typedarray.png)](https://nodei.co/npm/is-typedarray/) + +### isTypedArray(array) + +Returns `true` when array is a Typed Array, and `false` when it is not. + +## License + +MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details. diff --git a/appasar/canary/node_modules/is-typedarray/index.js b/appasar/canary/node_modules/is-typedarray/index.js new file mode 100644 index 0000000..5859603 --- /dev/null +++ b/appasar/canary/node_modules/is-typedarray/index.js @@ -0,0 +1,41 @@ +module.exports = isTypedArray +isTypedArray.strict = isStrictTypedArray +isTypedArray.loose = isLooseTypedArray + +var toString = Object.prototype.toString +var names = { + '[object Int8Array]': true + , '[object Int16Array]': true + , '[object Int32Array]': true + , '[object Uint8Array]': true + , '[object Uint8ClampedArray]': true + , '[object Uint16Array]': true + , '[object Uint32Array]': true + , '[object Float32Array]': true + , '[object Float64Array]': true +} + +function isTypedArray(arr) { + return ( + isStrictTypedArray(arr) + || isLooseTypedArray(arr) + ) +} + +function isStrictTypedArray(arr) { + return ( + arr instanceof Int8Array + || arr instanceof Int16Array + || arr instanceof Int32Array + || arr instanceof Uint8Array + || arr instanceof Uint8ClampedArray + || arr instanceof Uint16Array + || arr instanceof Uint32Array + || arr instanceof Float32Array + || arr instanceof Float64Array + ) +} + +function isLooseTypedArray(arr) { + return names[toString.call(arr)] +} diff --git a/appasar/canary/node_modules/is-typedarray/package.json b/appasar/canary/node_modules/is-typedarray/package.json new file mode 100644 index 0000000..37f7ae3 --- /dev/null +++ b/appasar/canary/node_modules/is-typedarray/package.json @@ -0,0 +1,30 @@ +{ + "name": "is-typedarray", + "version": "1.0.0", + "description": "Detect whether or not an object is a Typed Array", + "main": "index.js", + "scripts": { + "test": "node test" + }, + "author": "Hugh Kennedy <hughskennedy@gmail.com> (http://hughsk.io/)", + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "tape": "^2.13.1" + }, + "repository": { + "type": "git", + "url": "git://github.com/hughsk/is-typedarray.git" + }, + "keywords": [ + "typed", + "array", + "detect", + "is", + "util" + ], + "bugs": { + "url": "https://github.com/hughsk/is-typedarray/issues" + }, + "homepage": "https://github.com/hughsk/is-typedarray" +} diff --git a/appasar/canary/node_modules/is-typedarray/test.js b/appasar/canary/node_modules/is-typedarray/test.js new file mode 100644 index 0000000..b0c176f --- /dev/null +++ b/appasar/canary/node_modules/is-typedarray/test.js @@ -0,0 +1,34 @@ +var test = require('tape') +var ista = require('./') + +test('strict', function(t) { + t.ok(ista.strict(new Int8Array), 'Int8Array') + t.ok(ista.strict(new Int16Array), 'Int16Array') + t.ok(ista.strict(new Int32Array), 'Int32Array') + t.ok(ista.strict(new Uint8Array), 'Uint8Array') + t.ok(ista.strict(new Uint16Array), 'Uint16Array') + t.ok(ista.strict(new Uint32Array), 'Uint32Array') + t.ok(ista.strict(new Float32Array), 'Float32Array') + t.ok(ista.strict(new Float64Array), 'Float64Array') + + t.ok(!ista.strict(new Array), 'Array') + t.ok(!ista.strict([]), '[]') + + t.end() +}) + +test('loose', function(t) { + t.ok(ista.loose(new Int8Array), 'Int8Array') + t.ok(ista.loose(new Int16Array), 'Int16Array') + t.ok(ista.loose(new Int32Array), 'Int32Array') + t.ok(ista.loose(new Uint8Array), 'Uint8Array') + t.ok(ista.loose(new Uint16Array), 'Uint16Array') + t.ok(ista.loose(new Uint32Array), 'Uint32Array') + t.ok(ista.loose(new Float32Array), 'Float32Array') + t.ok(ista.loose(new Float64Array), 'Float64Array') + + t.ok(!ista.loose(new Array), 'Array') + t.ok(!ista.loose([]), '[]') + + t.end() +}) diff --git a/appasar/canary/node_modules/isstream/.jshintrc b/appasar/canary/node_modules/isstream/.jshintrc new file mode 100644 index 0000000..c8ef3ca --- /dev/null +++ b/appasar/canary/node_modules/isstream/.jshintrc @@ -0,0 +1,59 @@ +{ + "predef": [ ] + , "bitwise": false + , "camelcase": false + , "curly": false + , "eqeqeq": false + , "forin": false + , "immed": false + , "latedef": false + , "noarg": true + , "noempty": true + , "nonew": true + , "plusplus": false + , "quotmark": true + , "regexp": false + , "undef": true + , "unused": true + , "strict": false + , "trailing": true + , "maxlen": 120 + , "asi": true + , "boss": true + , "debug": true + , "eqnull": true + , "esnext": true + , "evil": true + , "expr": true + , "funcscope": false + , "globalstrict": false + , "iterator": false + , "lastsemic": true + , "laxbreak": true + , "laxcomma": true + , "loopfunc": true + , "multistr": false + , "onecase": false + , "proto": false + , "regexdash": false + , "scripturl": true + , "smarttabs": false + , "shadow": false + , "sub": true + , "supernew": false + , "validthis": true + , "browser": true + , "couch": false + , "devel": false + , "dojo": false + , "mootools": false + , "node": true + , "nonstandard": true + , "prototypejs": false + , "rhino": false + , "worker": true + , "wsh": false + , "nomen": false + , "onevar": false + , "passfail": false +} \ No newline at end of file diff --git a/appasar/canary/node_modules/isstream/.npmignore b/appasar/canary/node_modules/isstream/.npmignore new file mode 100644 index 0000000..aa1ec1e --- /dev/null +++ b/appasar/canary/node_modules/isstream/.npmignore @@ -0,0 +1 @@ +*.tgz diff --git a/appasar/canary/node_modules/isstream/.travis.yml b/appasar/canary/node_modules/isstream/.travis.yml new file mode 100644 index 0000000..1fec2ab --- /dev/null +++ b/appasar/canary/node_modules/isstream/.travis.yml @@ -0,0 +1,12 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.11" +branches: + only: + - master +notifications: + email: + - rod@vagg.org +script: npm test diff --git a/appasar/canary/node_modules/isstream/LICENSE.md b/appasar/canary/node_modules/isstream/LICENSE.md new file mode 100644 index 0000000..43f7153 --- /dev/null +++ b/appasar/canary/node_modules/isstream/LICENSE.md @@ -0,0 +1,11 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2015 Rod Vagg +--------------------------- + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/isstream/README.md b/appasar/canary/node_modules/isstream/README.md new file mode 100644 index 0000000..06770e8 --- /dev/null +++ b/appasar/canary/node_modules/isstream/README.md @@ -0,0 +1,66 @@ +# isStream + +[![Build Status](https://secure.travis-ci.org/rvagg/isstream.png)](http://travis-ci.org/rvagg/isstream) + +**Test if an object is a `Stream`** + +[![NPM](https://nodei.co/npm/isstream.svg)](https://nodei.co/npm/isstream/) + +The missing `Stream.isStream(obj)`: determine if an object is standard Node.js `Stream`. Works for Node-core `Stream` objects (for 0.8, 0.10, 0.11, and in theory, older and newer versions) and all versions of **[readable-stream](https://github.com/isaacs/readable-stream)**. + +## Usage: + +```js +var isStream = require('isstream') +var Stream = require('stream') + +isStream(new Stream()) // true + +isStream({}) // false + +isStream(new Stream.Readable()) // true +isStream(new Stream.Writable()) // true +isStream(new Stream.Duplex()) // true +isStream(new Stream.Transform()) // true +isStream(new Stream.PassThrough()) // true +``` + +## But wait! There's more! + +You can also test for `isReadable(obj)`, `isWritable(obj)` and `isDuplex(obj)` to test for implementations of Streams2 (and Streams3) base classes. + +```js +var isReadable = require('isstream').isReadable +var isWritable = require('isstream').isWritable +var isDuplex = require('isstream').isDuplex +var Stream = require('stream') + +isReadable(new Stream()) // false +isWritable(new Stream()) // false +isDuplex(new Stream()) // false + +isReadable(new Stream.Readable()) // true +isReadable(new Stream.Writable()) // false +isReadable(new Stream.Duplex()) // true +isReadable(new Stream.Transform()) // true +isReadable(new Stream.PassThrough()) // true + +isWritable(new Stream.Readable()) // false +isWritable(new Stream.Writable()) // true +isWritable(new Stream.Duplex()) // true +isWritable(new Stream.Transform()) // true +isWritable(new Stream.PassThrough()) // true + +isDuplex(new Stream.Readable()) // false +isDuplex(new Stream.Writable()) // false +isDuplex(new Stream.Duplex()) // true +isDuplex(new Stream.Transform()) // true +isDuplex(new Stream.PassThrough()) // true +``` + +*Reminder: when implementing your own streams, please [use **readable-stream** rather than core streams](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).* + + +## License + +**isStream** is Copyright (c) 2015 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. diff --git a/appasar/canary/node_modules/isstream/isstream.js b/appasar/canary/node_modules/isstream/isstream.js new file mode 100644 index 0000000..a1d104a --- /dev/null +++ b/appasar/canary/node_modules/isstream/isstream.js @@ -0,0 +1,27 @@ +var stream = require('stream') + + +function isStream (obj) { + return obj instanceof stream.Stream +} + + +function isReadable (obj) { + return isStream(obj) && typeof obj._read == 'function' && typeof obj._readableState == 'object' +} + + +function isWritable (obj) { + return isStream(obj) && typeof obj._write == 'function' && typeof obj._writableState == 'object' +} + + +function isDuplex (obj) { + return isReadable(obj) && isWritable(obj) +} + + +module.exports = isStream +module.exports.isReadable = isReadable +module.exports.isWritable = isWritable +module.exports.isDuplex = isDuplex diff --git a/appasar/canary/node_modules/isstream/package.json b/appasar/canary/node_modules/isstream/package.json new file mode 100644 index 0000000..9ee8bf8 --- /dev/null +++ b/appasar/canary/node_modules/isstream/package.json @@ -0,0 +1,33 @@ +{ + "name": "isstream", + "version": "0.1.2", + "description": "Determine if an object is a Stream", + "main": "isstream.js", + "scripts": { + "test": "tar --xform 's/^package/readable-stream-1.0/' -zxf readable-stream-1.0.*.tgz && tar --xform 's/^package/readable-stream-1.1/' -zxf readable-stream-1.1.*.tgz && node test.js; rm -rf readable-stream-1.?/" + }, + "repository": { + "type": "git", + "url": "https://github.com/rvagg/isstream.git" + }, + "keywords": [ + "stream", + "type", + "streams", + "readable-stream", + "hippo" + ], + "devDependencies": { + "tape": "~2.12.3", + "core-util-is": "~1.0.0", + "isarray": "0.0.1", + "string_decoder": "~0.10.x", + "inherits": "~2.0.1" + }, + "author": "Rod Vagg <rod@vagg.org>", + "license": "MIT", + "bugs": { + "url": "https://github.com/rvagg/isstream/issues" + }, + "homepage": "https://github.com/rvagg/isstream" +} diff --git a/appasar/canary/node_modules/isstream/test.js b/appasar/canary/node_modules/isstream/test.js new file mode 100644 index 0000000..8c950c5 --- /dev/null +++ b/appasar/canary/node_modules/isstream/test.js @@ -0,0 +1,168 @@ +var tape = require('tape') + , EE = require('events').EventEmitter + , util = require('util') + + + , isStream = require('./') + , isReadable = require('./').isReadable + , isWritable = require('./').isWritable + , isDuplex = require('./').isDuplex + + , CoreStreams = require('stream') + , ReadableStream10 = require('./readable-stream-1.0/') + , ReadableStream11 = require('./readable-stream-1.1/') + + +function test (pass, type, stream) { + tape('isStream(' + type + ')', function (t) { + t.plan(1) + t.ok(pass === isStream(stream), type) + }) +} + + +function testReadable (pass, type, stream) { + tape('isReadable(' + type + ')', function (t) { + t.plan(1) + t.ok(pass === isReadable(stream), type) + }) +} + + +function testWritable (pass, type, stream) { + tape('isWritable(' + type + ')', function (t) { + t.plan(1) + t.ok(pass === isWritable(stream), type) + }) +} + + +function testDuplex (pass, type, stream) { + tape('isDuplex(' + type + ')', function (t) { + t.plan(1) + t.ok(pass === isDuplex(stream), type) + }) +} + + +[ undefined, null, '', true, false, 0, 1, 1.0, 'string', {}, function foo () {} ].forEach(function (o) { + test(false, 'non-stream / primitive: ' + (JSON.stringify(o) || (o && o.toString()) || o), o) +}) + + +test(false, 'fake stream obj', { pipe: function () {} }) + + +;(function () { + + // looks like a stream! + + function Stream () { + EE.call(this) + } + util.inherits(Stream, EE) + Stream.prototype.pipe = function () {} + Stream.Stream = Stream + + test(false, 'fake stream "new Stream()"', new Stream()) + +}()) + + +test(true, 'CoreStreams.Stream', new (CoreStreams.Stream)()) +test(true, 'CoreStreams.Readable', new (CoreStreams.Readable)()) +test(true, 'CoreStreams.Writable', new (CoreStreams.Writable)()) +test(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)()) +test(true, 'CoreStreams.Transform', new (CoreStreams.Transform)()) +test(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)()) + +test(true, 'ReadableStream10.Readable', new (ReadableStream10.Readable)()) +test(true, 'ReadableStream10.Writable', new (ReadableStream10.Writable)()) +test(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)()) +test(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)()) +test(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)()) + +test(true, 'ReadableStream11.Readable', new (ReadableStream11.Readable)()) +test(true, 'ReadableStream11.Writable', new (ReadableStream11.Writable)()) +test(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)()) +test(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)()) +test(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)()) + + +testReadable(false, 'CoreStreams.Stream', new (CoreStreams.Stream)()) +testReadable(true, 'CoreStreams.Readable', new (CoreStreams.Readable)()) +testReadable(false, 'CoreStreams.Writable', new (CoreStreams.Writable)()) +testReadable(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)()) +testReadable(true, 'CoreStreams.Transform', new (CoreStreams.Transform)()) +testReadable(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)()) + +testReadable(true, 'ReadableStream10.Readable', new (ReadableStream10.Readable)()) +testReadable(false, 'ReadableStream10.Writable', new (ReadableStream10.Writable)()) +testReadable(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)()) +testReadable(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)()) +testReadable(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)()) + +testReadable(true, 'ReadableStream11.Readable', new (ReadableStream11.Readable)()) +testReadable(false, 'ReadableStream11.Writable', new (ReadableStream11.Writable)()) +testReadable(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)()) +testReadable(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)()) +testReadable(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)()) + + +testWritable(false, 'CoreStreams.Stream', new (CoreStreams.Stream)()) +testWritable(false, 'CoreStreams.Readable', new (CoreStreams.Readable)()) +testWritable(true, 'CoreStreams.Writable', new (CoreStreams.Writable)()) +testWritable(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)()) +testWritable(true, 'CoreStreams.Transform', new (CoreStreams.Transform)()) +testWritable(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)()) + +testWritable(false, 'ReadableStream10.Readable', new (ReadableStream10.Readable)()) +testWritable(true, 'ReadableStream10.Writable', new (ReadableStream10.Writable)()) +testWritable(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)()) +testWritable(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)()) +testWritable(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)()) + +testWritable(false, 'ReadableStream11.Readable', new (ReadableStream11.Readable)()) +testWritable(true, 'ReadableStream11.Writable', new (ReadableStream11.Writable)()) +testWritable(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)()) +testWritable(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)()) +testWritable(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)()) + + +testDuplex(false, 'CoreStreams.Stream', new (CoreStreams.Stream)()) +testDuplex(false, 'CoreStreams.Readable', new (CoreStreams.Readable)()) +testDuplex(false, 'CoreStreams.Writable', new (CoreStreams.Writable)()) +testDuplex(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)()) +testDuplex(true, 'CoreStreams.Transform', new (CoreStreams.Transform)()) +testDuplex(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)()) + +testDuplex(false, 'ReadableStream10.Readable', new (ReadableStream10.Readable)()) +testDuplex(false, 'ReadableStream10.Writable', new (ReadableStream10.Writable)()) +testDuplex(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)()) +testDuplex(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)()) +testDuplex(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)()) + +testDuplex(false, 'ReadableStream11.Readable', new (ReadableStream11.Readable)()) +testDuplex(false, 'ReadableStream11.Writable', new (ReadableStream11.Writable)()) +testDuplex(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)()) +testDuplex(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)()) +testDuplex(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)()) + + +;[ CoreStreams, ReadableStream10, ReadableStream11 ].forEach(function (p) { + [ 'Stream', 'Readable', 'Writable', 'Duplex', 'Transform', 'PassThrough' ].forEach(function (k) { + if (!p[k]) + return + + function SubStream () { + p[k].call(this) + } + util.inherits(SubStream, p[k]) + + test(true, 'Stream subclass: ' + p.name + '.' + k, new SubStream()) + + }) +}) + + + diff --git a/appasar/canary/node_modules/jsbn/.npmignore b/appasar/canary/node_modules/jsbn/.npmignore new file mode 100644 index 0000000..28f1ba7 --- /dev/null +++ b/appasar/canary/node_modules/jsbn/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store \ No newline at end of file diff --git a/appasar/canary/node_modules/jsbn/LICENSE b/appasar/canary/node_modules/jsbn/LICENSE new file mode 100644 index 0000000..2a6457e --- /dev/null +++ b/appasar/canary/node_modules/jsbn/LICENSE @@ -0,0 +1,40 @@ +Licensing +--------- + +This software is covered under the following copyright: + +/* + * Copyright (c) 2003-2005 Tom Wu + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following condition applies: + * + * All redistributions must retain an intact copy of this copyright notice + * and disclaimer. + */ + +Address all questions regarding this license to: + + Tom Wu + tjw@cs.Stanford.EDU \ No newline at end of file diff --git a/appasar/canary/node_modules/jsbn/README.md b/appasar/canary/node_modules/jsbn/README.md new file mode 100644 index 0000000..7aac67f --- /dev/null +++ b/appasar/canary/node_modules/jsbn/README.md @@ -0,0 +1,175 @@ +# jsbn: javascript big number + +[Tom Wu's Original Website](http://www-cs-students.stanford.edu/~tjw/jsbn/) + +I felt compelled to put this on github and publish to npm. I haven't tested every other big integer library out there, but the few that I have tested in comparison to this one have not even come close in performance. I am aware of the `bi` module on npm, however it has been modified and I wanted to publish the original without modifications. This is jsbn and jsbn2 from Tom Wu's original website above, with the modular pattern applied to prevent global leaks and to allow for use with node.js on the server side. + +## usage + + var BigInteger = require('jsbn'); + + var a = new BigInteger('91823918239182398123'); + alert(a.bitLength()); // 67 + + +## API + +### bi.toString() + +returns the base-10 number as a string + +### bi.negate() + +returns a new BigInteger equal to the negation of `bi` + +### bi.abs + +returns new BI of absolute value + +### bi.compareTo + + + +### bi.bitLength + + + +### bi.mod + + + +### bi.modPowInt + + + +### bi.clone + + + +### bi.intValue + + + +### bi.byteValue + + + +### bi.shortValue + + + +### bi.signum + + + +### bi.toByteArray + + + +### bi.equals + + + +### bi.min + + + +### bi.max + + + +### bi.and + + + +### bi.or + + + +### bi.xor + + + +### bi.andNot + + + +### bi.not + + + +### bi.shiftLeft + + + +### bi.shiftRight + + + +### bi.getLowestSetBit + + + +### bi.bitCount + + + +### bi.testBit + + + +### bi.setBit + + + +### bi.clearBit + + + +### bi.flipBit + + + +### bi.add + + + +### bi.subtract + + + +### bi.multiply + + + +### bi.divide + + + +### bi.remainder + + + +### bi.divideAndRemainder + + + +### bi.modPow + + + +### bi.modInverse + + + +### bi.pow + + + +### bi.gcd + + + +### bi.isProbablePrime + + diff --git a/appasar/canary/node_modules/jsbn/example.html b/appasar/canary/node_modules/jsbn/example.html new file mode 100644 index 0000000..7c26a56 --- /dev/null +++ b/appasar/canary/node_modules/jsbn/example.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title> + + + + + + + \ No newline at end of file diff --git a/appasar/canary/node_modules/jsbn/example.js b/appasar/canary/node_modules/jsbn/example.js new file mode 100644 index 0000000..664c1b4 --- /dev/null +++ b/appasar/canary/node_modules/jsbn/example.js @@ -0,0 +1,3 @@ +var BigInteger = require('./'); +var a = new BigInteger('91823918239182398123'); +console.log(a.bitLength()); \ No newline at end of file diff --git a/appasar/canary/node_modules/jsbn/index.js b/appasar/canary/node_modules/jsbn/index.js new file mode 100644 index 0000000..973226d --- /dev/null +++ b/appasar/canary/node_modules/jsbn/index.js @@ -0,0 +1,1357 @@ +(function(){ + + // Copyright (c) 2005 Tom Wu + // All Rights Reserved. + // See "LICENSE" for details. + + // Basic JavaScript BN library - subset useful for RSA encryption. + + // Bits per digit + var dbits; + + // JavaScript engine analysis + var canary = 0xdeadbeefcafe; + var j_lm = ((canary&0xffffff)==0xefcafe); + + // (public) Constructor + function BigInteger(a,b,c) { + if(a != null) + if("number" == typeof a) this.fromNumber(a,b,c); + else if(b == null && "string" != typeof a) this.fromString(a,256); + else this.fromString(a,b); + } + + // return new, unset BigInteger + function nbi() { return new BigInteger(null); } + + // am: Compute w_j += (x*this_i), propagate carries, + // c is initial carry, returns final carry. + // c < 3*dvalue, x < 2*dvalue, this_i < dvalue + // We need to select the fastest one that works in this environment. + + // am1: use a single mult and divide to get the high bits, + // max digit bits should be 26 because + // max internal value = 2*dvalue^2-2*dvalue (< 2^53) + function am1(i,x,w,j,c,n) { + while(--n >= 0) { + var v = x*this[i++]+w[j]+c; + c = Math.floor(v/0x4000000); + w[j++] = v&0x3ffffff; + } + return c; + } + // am2 avoids a big mult-and-extract completely. + // Max digit bits should be <= 30 because we do bitwise ops + // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) + function am2(i,x,w,j,c,n) { + var xl = x&0x7fff, xh = x>>15; + while(--n >= 0) { + var l = this[i]&0x7fff; + var h = this[i++]>>15; + var m = xh*l+h*xl; + l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); + c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); + w[j++] = l&0x3fffffff; + } + return c; + } + // Alternately, set max digit bits to 28 since some + // browsers slow down when dealing with 32-bit numbers. + function am3(i,x,w,j,c,n) { + var xl = x&0x3fff, xh = x>>14; + while(--n >= 0) { + var l = this[i]&0x3fff; + var h = this[i++]>>14; + var m = xh*l+h*xl; + l = xl*l+((m&0x3fff)<<14)+w[j]+c; + c = (l>>28)+(m>>14)+xh*h; + w[j++] = l&0xfffffff; + } + return c; + } + var inBrowser = typeof navigator !== "undefined"; + if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) { + BigInteger.prototype.am = am2; + dbits = 30; + } + else if(inBrowser && j_lm && (navigator.appName != "Netscape")) { + BigInteger.prototype.am = am1; + dbits = 26; + } + else { // Mozilla/Netscape seems to prefer am3 + BigInteger.prototype.am = am3; + dbits = 28; + } + + BigInteger.prototype.DB = dbits; + BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i]; + r.t = this.t; + r.s = this.s; + } + + // (protected) set from integer value x, -DV <= x < DV + function bnpFromInt(x) { + this.t = 1; + this.s = (x<0)?-1:0; + if(x > 0) this[0] = x; + else if(x < -1) this[0] = x+this.DV; + else this.t = 0; + } + + // return bigint initialized to value + function nbv(i) { var r = nbi(); r.fromInt(i); return r; } + + // (protected) set from string and radix + function bnpFromString(s,b) { + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 256) k = 8; // byte array + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else { this.fromRadix(s,b); return; } + this.t = 0; + this.s = 0; + var i = s.length, mi = false, sh = 0; + while(--i >= 0) { + var x = (k==8)?s[i]&0xff:intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-") mi = true; + continue; + } + mi = false; + if(sh == 0) + this[this.t++] = x; + else if(sh+k > this.DB) { + this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); + } + else + this[this.t-1] |= x<= this.DB) sh -= this.DB; + } + if(k == 8 && (s[0]&0x80) != 0) { + this.s = -1; + if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t; + } + + // (public) return string representation in given radix + function bnToString(b) { + if(this.s < 0) return "-"+this.negate().toString(b); + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else return this.toRadix(b); + var km = (1< 0) { + if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } + while(i >= 0) { + if(p < k) { + d = (this[i]&((1<>(p+=this.DB-k); + } + else { + d = (this[i]>>(p-=k))&km; + if(p <= 0) { p += this.DB; --i; } + } + if(d > 0) m = true; + if(m) r += int2char(d); + } + } + return m?r:"0"; + } + + // (public) -this + function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } + + // (public) |this| + function bnAbs() { return (this.s<0)?this.negate():this; } + + // (public) return + if this > a, - if this < a, 0 if equal + function bnCompareTo(a) { + var r = this.s-a.s; + if(r != 0) return r; + var i = this.t; + r = i-a.t; + if(r != 0) return (this.s<0)?-r:r; + while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; + return 0; + } + + // returns bit length of the integer x + function nbits(x) { + var r = 1, t; + if((t=x>>>16) != 0) { x = t; r += 16; } + if((t=x>>8) != 0) { x = t; r += 8; } + if((t=x>>4) != 0) { x = t; r += 4; } + if((t=x>>2) != 0) { x = t; r += 2; } + if((t=x>>1) != 0) { x = t; r += 1; } + return r; + } + + // (public) return the number of bits in "this" + function bnBitLength() { + if(this.t <= 0) return 0; + return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); + } + + // (protected) r = this << n*DB + function bnpDLShiftTo(n,r) { + var i; + for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; + for(i = n-1; i >= 0; --i) r[i] = 0; + r.t = this.t+n; + r.s = this.s; + } + + // (protected) r = this >> n*DB + function bnpDRShiftTo(n,r) { + for(var i = n; i < this.t; ++i) r[i-n] = this[i]; + r.t = Math.max(this.t-n,0); + r.s = this.s; + } + + // (protected) r = this << n + function bnpLShiftTo(n,r) { + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<= 0; --i) { + r[i+ds+1] = (this[i]>>cbs)|c; + c = (this[i]&bm)<= 0; --i) r[i] = 0; + r[ds] = c; + r.t = this.t+ds+1; + r.s = this.s; + r.clamp(); + } + + // (protected) r = this >> n + function bnpRShiftTo(n,r) { + r.s = this.s; + var ds = Math.floor(n/this.DB); + if(ds >= this.t) { r.t = 0; return; } + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<>bs; + for(var i = ds+1; i < this.t; ++i) { + r[i-ds-1] |= (this[i]&bm)<>bs; + } + if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB; + } + if(a.t < this.t) { + c -= a.s; + while(i < this.t) { + c += this[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while(i < a.t) { + c -= a[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c -= a.s; + } + r.s = (c<0)?-1:0; + if(c < -1) r[i++] = this.DV+c; + else if(c > 0) r[i++] = c; + r.t = i; + r.clamp(); + } + + // (protected) r = this * a, r != this,a (HAC 14.12) + // "this" should be the larger one if appropriate. + function bnpMultiplyTo(a,r) { + var x = this.abs(), y = a.abs(); + var i = x.t; + r.t = i+y.t; + while(--i >= 0) r[i] = 0; + for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); + r.s = 0; + r.clamp(); + if(this.s != a.s) BigInteger.ZERO.subTo(r,r); + } + + // (protected) r = this^2, r != this (HAC 14.16) + function bnpSquareTo(r) { + var x = this.abs(); + var i = r.t = 2*x.t; + while(--i >= 0) r[i] = 0; + for(i = 0; i < x.t-1; ++i) { + var c = x.am(i,x[i],r,2*i,0,1); + if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { + r[i+x.t] -= x.DV; + r[i+x.t+1] = 1; + } + } + if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); + r.s = 0; + r.clamp(); + } + + // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) + // r != q, this != m. q or r may be null. + function bnpDivRemTo(m,q,r) { + var pm = m.abs(); + if(pm.t <= 0) return; + var pt = this.abs(); + if(pt.t < pm.t) { + if(q != null) q.fromInt(0); + if(r != null) this.copyTo(r); + return; + } + if(r == null) r = nbi(); + var y = nbi(), ts = this.s, ms = m.s; + var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus + if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } + else { pm.copyTo(y); pt.copyTo(r); } + var ys = y.t; + var y0 = y[ys-1]; + if(y0 == 0) return; + var yt = y0*(1<1)?y[ys-2]>>this.F2:0); + var d1 = this.FV/yt, d2 = (1<= 0) { + r[r.t++] = 1; + r.subTo(t,r); + } + BigInteger.ONE.dlShiftTo(ys,t); + t.subTo(y,y); // "negative" y so we can replace sub with am later + while(y.t < ys) y[y.t++] = 0; + while(--j >= 0) { + // Estimate quotient digit + var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); + if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out + y.dlShiftTo(j,t); + r.subTo(t,r); + while(r[i] < --qd) r.subTo(t,r); + } + } + if(q != null) { + r.drShiftTo(ys,q); + if(ts != ms) BigInteger.ZERO.subTo(q,q); + } + r.t = ys; + r.clamp(); + if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder + if(ts < 0) BigInteger.ZERO.subTo(r,r); + } + + // (public) this mod a + function bnMod(a) { + var r = nbi(); + this.abs().divRemTo(a,null,r); + if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); + return r; + } + + // Modular reduction using "classic" algorithm + function Classic(m) { this.m = m; } + function cConvert(x) { + if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); + else return x; + } + function cRevert(x) { return x; } + function cReduce(x) { x.divRemTo(this.m,null,x); } + function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + Classic.prototype.convert = cConvert; + Classic.prototype.revert = cRevert; + Classic.prototype.reduce = cReduce; + Classic.prototype.mulTo = cMulTo; + Classic.prototype.sqrTo = cSqrTo; + + // (protected) return "-1/this % 2^DB"; useful for Mont. reduction + // justification: + // xy == 1 (mod m) + // xy = 1+km + // xy(2-xy) = (1+km)(1-km) + // x[y(2-xy)] = 1-k^2m^2 + // x[y(2-xy)] == 1 (mod m^2) + // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 + // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. + // JS multiply "overflows" differently from C/C++, so care is needed here. + function bnpInvDigit() { + if(this.t < 1) return 0; + var x = this[0]; + if((x&1) == 0) return 0; + var y = x&3; // y == 1/x mod 2^2 + y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 + y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 + y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 + // last step - calculate inverse mod DV directly; + // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints + y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits + // we really want the negative inverse, and -DV < y < DV + return (y>0)?this.DV-y:-y; + } + + // Montgomery reduction + function Montgomery(m) { + this.m = m; + this.mp = m.invDigit(); + this.mpl = this.mp&0x7fff; + this.mph = this.mp>>15; + this.um = (1<<(m.DB-15))-1; + this.mt2 = 2*m.t; + } + + // xR mod m + function montConvert(x) { + var r = nbi(); + x.abs().dlShiftTo(this.m.t,r); + r.divRemTo(this.m,null,r); + if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); + return r; + } + + // x/R mod m + function montRevert(x) { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + } + + // x = x/R mod m (HAC 14.32) + function montReduce(x) { + while(x.t <= this.mt2) // pad x so am has enough room later + x[x.t++] = 0; + for(var i = 0; i < this.m.t; ++i) { + // faster way of calculating u0 = x[i]*mp mod DV + var j = x[i]&0x7fff; + var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; + // use am to combine the multiply-shift-add into one call + j = i+this.m.t; + x[j] += this.m.am(0,u0,x,i,0,this.m.t); + // propagate carry + while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } + } + x.clamp(); + x.drShiftTo(this.m.t,x); + if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + } + + // r = "x^2/R mod m"; x != r + function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + // r = "xy/R mod m"; x,y != r + function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + + Montgomery.prototype.convert = montConvert; + Montgomery.prototype.revert = montRevert; + Montgomery.prototype.reduce = montReduce; + Montgomery.prototype.mulTo = montMulTo; + Montgomery.prototype.sqrTo = montSqrTo; + + // (protected) true iff this is even + function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } + + // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) + function bnpExp(e,z) { + if(e > 0xffffffff || e < 1) return BigInteger.ONE; + var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; + g.copyTo(r); + while(--i >= 0) { + z.sqrTo(r,r2); + if((e&(1< 0) z.mulTo(r2,g,r); + else { var t = r; r = r2; r2 = t; } + } + return z.revert(r); + } + + // (public) this^e % m, 0 <= e < 2^32 + function bnModPowInt(e,m) { + var z; + if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); + return this.exp(e,z); + } + + // protected + BigInteger.prototype.copyTo = bnpCopyTo; + BigInteger.prototype.fromInt = bnpFromInt; + BigInteger.prototype.fromString = bnpFromString; + BigInteger.prototype.clamp = bnpClamp; + BigInteger.prototype.dlShiftTo = bnpDLShiftTo; + BigInteger.prototype.drShiftTo = bnpDRShiftTo; + BigInteger.prototype.lShiftTo = bnpLShiftTo; + BigInteger.prototype.rShiftTo = bnpRShiftTo; + BigInteger.prototype.subTo = bnpSubTo; + BigInteger.prototype.multiplyTo = bnpMultiplyTo; + BigInteger.prototype.squareTo = bnpSquareTo; + BigInteger.prototype.divRemTo = bnpDivRemTo; + BigInteger.prototype.invDigit = bnpInvDigit; + BigInteger.prototype.isEven = bnpIsEven; + BigInteger.prototype.exp = bnpExp; + + // public + BigInteger.prototype.toString = bnToString; + BigInteger.prototype.negate = bnNegate; + BigInteger.prototype.abs = bnAbs; + BigInteger.prototype.compareTo = bnCompareTo; + BigInteger.prototype.bitLength = bnBitLength; + BigInteger.prototype.mod = bnMod; + BigInteger.prototype.modPowInt = bnModPowInt; + + // "constants" + BigInteger.ZERO = nbv(0); + BigInteger.ONE = nbv(1); + + // Copyright (c) 2005-2009 Tom Wu + // All Rights Reserved. + // See "LICENSE" for details. + + // Extended JavaScript BN functions, required for RSA private ops. + + // Version 1.1: new BigInteger("0", 10) returns "proper" zero + // Version 1.2: square() API, isProbablePrime fix + + // (public) + function bnClone() { var r = nbi(); this.copyTo(r); return r; } + + // (public) return value as integer + function bnIntValue() { + if(this.s < 0) { + if(this.t == 1) return this[0]-this.DV; + else if(this.t == 0) return -1; + } + else if(this.t == 1) return this[0]; + else if(this.t == 0) return 0; + // assumes 16 < DB < 32 + return ((this[1]&((1<<(32-this.DB))-1))<>24; } + + // (public) return value as short (assumes DB>=16) + function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } + + // (protected) return x s.t. r^x < DV + function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } + + // (public) 0 if this == 0, 1 if this > 0 + function bnSigNum() { + if(this.s < 0) return -1; + else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; + else return 1; + } + + // (protected) convert to radix string + function bnpToRadix(b) { + if(b == null) b = 10; + if(this.signum() == 0 || b < 2 || b > 36) return "0"; + var cs = this.chunkSize(b); + var a = Math.pow(b,cs); + var d = nbv(a), y = nbi(), z = nbi(), r = ""; + this.divRemTo(d,y,z); + while(y.signum() > 0) { + r = (a+z.intValue()).toString(b).substr(1) + r; + y.divRemTo(d,y,z); + } + return z.intValue().toString(b) + r; + } + + // (protected) convert from radix string + function bnpFromRadix(s,b) { + this.fromInt(0); + if(b == null) b = 10; + var cs = this.chunkSize(b); + var d = Math.pow(b,cs), mi = false, j = 0, w = 0; + for(var i = 0; i < s.length; ++i) { + var x = intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-" && this.signum() == 0) mi = true; + continue; + } + w = b*w+x; + if(++j >= cs) { + this.dMultiply(d); + this.dAddOffset(w,0); + j = 0; + w = 0; + } + } + if(j > 0) { + this.dMultiply(Math.pow(b,j)); + this.dAddOffset(w,0); + } + if(mi) BigInteger.ZERO.subTo(this,this); + } + + // (protected) alternate constructor + function bnpFromNumber(a,b,c) { + if("number" == typeof b) { + // new BigInteger(int,int,RNG) + if(a < 2) this.fromInt(1); + else { + this.fromNumber(a,c); + if(!this.testBit(a-1)) // force MSB set + this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); + if(this.isEven()) this.dAddOffset(1,0); // force odd + while(!this.isProbablePrime(b)) { + this.dAddOffset(2,0); + if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); + } + } + } + else { + // new BigInteger(int,RNG) + var x = new Array(), t = a&7; + x.length = (a>>3)+1; + b.nextBytes(x); + if(t > 0) x[0] &= ((1< 0) { + if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p) + r[k++] = d|(this.s<<(this.DB-p)); + while(i >= 0) { + if(p < 8) { + d = (this[i]&((1<>(p+=this.DB-8); + } + else { + d = (this[i]>>(p-=8))&0xff; + if(p <= 0) { p += this.DB; --i; } + } + if((d&0x80) != 0) d |= -256; + if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; + if(k > 0 || d != this.s) r[k++] = d; + } + } + return r; + } + + function bnEquals(a) { return(this.compareTo(a)==0); } + function bnMin(a) { return(this.compareTo(a)<0)?this:a; } + function bnMax(a) { return(this.compareTo(a)>0)?this:a; } + + // (protected) r = this op a (bitwise) + function bnpBitwiseTo(a,op,r) { + var i, f, m = Math.min(a.t,this.t); + for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]); + if(a.t < this.t) { + f = a.s&this.DM; + for(i = m; i < this.t; ++i) r[i] = op(this[i],f); + r.t = this.t; + } + else { + f = this.s&this.DM; + for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); + r.t = a.t; + } + r.s = op(this.s,a.s); + r.clamp(); + } + + // (public) this & a + function op_and(x,y) { return x&y; } + function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } + + // (public) this | a + function op_or(x,y) { return x|y; } + function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } + + // (public) this ^ a + function op_xor(x,y) { return x^y; } + function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } + + // (public) this & ~a + function op_andnot(x,y) { return x&~y; } + function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } + + // (public) ~this + function bnNot() { + var r = nbi(); + for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; + r.t = this.t; + r.s = ~this.s; + return r; + } + + // (public) this << n + function bnShiftLeft(n) { + var r = nbi(); + if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); + return r; + } + + // (public) this >> n + function bnShiftRight(n) { + var r = nbi(); + if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); + return r; + } + + // return index of lowest 1-bit in x, x < 2^31 + function lbit(x) { + if(x == 0) return -1; + var r = 0; + if((x&0xffff) == 0) { x >>= 16; r += 16; } + if((x&0xff) == 0) { x >>= 8; r += 8; } + if((x&0xf) == 0) { x >>= 4; r += 4; } + if((x&3) == 0) { x >>= 2; r += 2; } + if((x&1) == 0) ++r; + return r; + } + + // (public) returns index of lowest 1-bit (or -1 if none) + function bnGetLowestSetBit() { + for(var i = 0; i < this.t; ++i) + if(this[i] != 0) return i*this.DB+lbit(this[i]); + if(this.s < 0) return this.t*this.DB; + return -1; + } + + // return number of 1 bits in x + function cbit(x) { + var r = 0; + while(x != 0) { x &= x-1; ++r; } + return r; + } + + // (public) return number of set bits + function bnBitCount() { + var r = 0, x = this.s&this.DM; + for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); + return r; + } + + // (public) true iff nth bit is set + function bnTestBit(n) { + var j = Math.floor(n/this.DB); + if(j >= this.t) return(this.s!=0); + return((this[j]&(1<<(n%this.DB)))!=0); + } + + // (protected) this op (1<>= this.DB; + } + if(a.t < this.t) { + c += a.s; + while(i < this.t) { + c += this[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while(i < a.t) { + c += a[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += a.s; + } + r.s = (c<0)?-1:0; + if(c > 0) r[i++] = c; + else if(c < -1) r[i++] = this.DV+c; + r.t = i; + r.clamp(); + } + + // (public) this + a + function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } + + // (public) this - a + function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } + + // (public) this * a + function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } + + // (public) this^2 + function bnSquare() { var r = nbi(); this.squareTo(r); return r; } + + // (public) this / a + function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } + + // (public) this % a + function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } + + // (public) [this/a,this%a] + function bnDivideAndRemainder(a) { + var q = nbi(), r = nbi(); + this.divRemTo(a,q,r); + return new Array(q,r); + } + + // (protected) this *= n, this >= 0, 1 < n < DV + function bnpDMultiply(n) { + this[this.t] = this.am(0,n-1,this,0,0,this.t); + ++this.t; + this.clamp(); + } + + // (protected) this += n << w words, this >= 0 + function bnpDAddOffset(n,w) { + if(n == 0) return; + while(this.t <= w) this[this.t++] = 0; + this[w] += n; + while(this[w] >= this.DV) { + this[w] -= this.DV; + if(++w >= this.t) this[this.t++] = 0; + ++this[w]; + } + } + + // A "null" reducer + function NullExp() {} + function nNop(x) { return x; } + function nMulTo(x,y,r) { x.multiplyTo(y,r); } + function nSqrTo(x,r) { x.squareTo(r); } + + NullExp.prototype.convert = nNop; + NullExp.prototype.revert = nNop; + NullExp.prototype.mulTo = nMulTo; + NullExp.prototype.sqrTo = nSqrTo; + + // (public) this^e + function bnPow(e) { return this.exp(e,new NullExp()); } + + // (protected) r = lower n words of "this * a", a.t <= n + // "this" should be the larger one if appropriate. + function bnpMultiplyLowerTo(a,n,r) { + var i = Math.min(this.t+a.t,n); + r.s = 0; // assumes a,this >= 0 + r.t = i; + while(i > 0) r[--i] = 0; + var j; + for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); + for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); + r.clamp(); + } + + // (protected) r = "this * a" without lower n words, n > 0 + // "this" should be the larger one if appropriate. + function bnpMultiplyUpperTo(a,n,r) { + --n; + var i = r.t = this.t+a.t-n; + r.s = 0; // assumes a,this >= 0 + while(--i >= 0) r[i] = 0; + for(i = Math.max(n-this.t,0); i < a.t; ++i) + r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); + r.clamp(); + r.drShiftTo(1,r); + } + + // Barrett modular reduction + function Barrett(m) { + // setup Barrett + this.r2 = nbi(); + this.q3 = nbi(); + BigInteger.ONE.dlShiftTo(2*m.t,this.r2); + this.mu = this.r2.divide(m); + this.m = m; + } + + function barrettConvert(x) { + if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); + else if(x.compareTo(this.m) < 0) return x; + else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } + } + + function barrettRevert(x) { return x; } + + // x = x mod m (HAC 14.42) + function barrettReduce(x) { + x.drShiftTo(this.m.t-1,this.r2); + if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } + this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); + this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); + while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); + x.subTo(this.r2,x); + while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + } + + // r = x^2 mod m; x != r + function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + // r = x*y mod m; x,y != r + function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + + Barrett.prototype.convert = barrettConvert; + Barrett.prototype.revert = barrettRevert; + Barrett.prototype.reduce = barrettReduce; + Barrett.prototype.mulTo = barrettMulTo; + Barrett.prototype.sqrTo = barrettSqrTo; + + // (public) this^e % m (HAC 14.85) + function bnModPow(e,m) { + var i = e.bitLength(), k, r = nbv(1), z; + if(i <= 0) return r; + else if(i < 18) k = 1; + else if(i < 48) k = 3; + else if(i < 144) k = 4; + else if(i < 768) k = 5; + else k = 6; + if(i < 8) + z = new Classic(m); + else if(m.isEven()) + z = new Barrett(m); + else + z = new Montgomery(m); + + // precomputation + var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { + var g2 = nbi(); + z.sqrTo(g[1],g2); + while(n <= km) { + g[n] = nbi(); + z.mulTo(g2,g[n-2],g[n]); + n += 2; + } + } + + var j = e.t-1, w, is1 = true, r2 = nbi(), t; + i = nbits(e[j])-1; + while(j >= 0) { + if(i >= k1) w = (e[j]>>(i-k1))&km; + else { + w = (e[j]&((1<<(i+1))-1))<<(k1-i); + if(j > 0) w |= e[j-1]>>(this.DB+i-k1); + } + + n = k; + while((w&1) == 0) { w >>= 1; --n; } + if((i -= n) < 0) { i += this.DB; --j; } + if(is1) { // ret == 1, don't bother squaring or multiplying it + g[w].copyTo(r); + is1 = false; + } + else { + while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } + if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } + z.mulTo(r2,g[w],r); + } + + while(j >= 0 && (e[j]&(1< 0) { + x.rShiftTo(g,x); + y.rShiftTo(g,y); + } + while(x.signum() > 0) { + if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); + if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); + if(x.compareTo(y) >= 0) { + x.subTo(y,x); + x.rShiftTo(1,x); + } + else { + y.subTo(x,y); + y.rShiftTo(1,y); + } + } + if(g > 0) y.lShiftTo(g,y); + return y; + } + + // (protected) this % n, n < 2^26 + function bnpModInt(n) { + if(n <= 0) return 0; + var d = this.DV%n, r = (this.s<0)?n-1:0; + if(this.t > 0) + if(d == 0) r = this[0]%n; + else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; + return r; + } + + // (public) 1/this % m (HAC 14.61) + function bnModInverse(m) { + var ac = m.isEven(); + if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; + var u = m.clone(), v = this.clone(); + var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); + while(u.signum() != 0) { + while(u.isEven()) { + u.rShiftTo(1,u); + if(ac) { + if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } + a.rShiftTo(1,a); + } + else if(!b.isEven()) b.subTo(m,b); + b.rShiftTo(1,b); + } + while(v.isEven()) { + v.rShiftTo(1,v); + if(ac) { + if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } + c.rShiftTo(1,c); + } + else if(!d.isEven()) d.subTo(m,d); + d.rShiftTo(1,d); + } + if(u.compareTo(v) >= 0) { + u.subTo(v,u); + if(ac) a.subTo(c,a); + b.subTo(d,b); + } + else { + v.subTo(u,v); + if(ac) c.subTo(a,c); + d.subTo(b,d); + } + } + if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; + if(d.compareTo(m) >= 0) return d.subtract(m); + if(d.signum() < 0) d.addTo(m,d); else return d; + if(d.signum() < 0) return d.add(m); else return d; + } + + var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; + var lplim = (1<<26)/lowprimes[lowprimes.length-1]; + + // (public) test primality with certainty >= 1-.5^t + function bnIsProbablePrime(t) { + var i, x = this.abs(); + if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) { + for(i = 0; i < lowprimes.length; ++i) + if(x[0] == lowprimes[i]) return true; + return false; + } + if(x.isEven()) return false; + i = 1; + while(i < lowprimes.length) { + var m = lowprimes[i], j = i+1; + while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; + m = x.modInt(m); + while(i < j) if(m%lowprimes[i++] == 0) return false; + } + return x.millerRabin(t); + } + + // (protected) true if probably prime (HAC 4.24, Miller-Rabin) + function bnpMillerRabin(t) { + var n1 = this.subtract(BigInteger.ONE); + var k = n1.getLowestSetBit(); + if(k <= 0) return false; + var r = n1.shiftRight(k); + t = (t+1)>>1; + if(t > lowprimes.length) t = lowprimes.length; + var a = nbi(); + for(var i = 0; i < t; ++i) { + //Pick bases at random, instead of starting at 2 + a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); + var y = a.modPow(r,this); + if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { + var j = 1; + while(j++ < k && y.compareTo(n1) != 0) { + y = y.modPowInt(2,this); + if(y.compareTo(BigInteger.ONE) == 0) return false; + } + if(y.compareTo(n1) != 0) return false; + } + } + return true; + } + + // protected + BigInteger.prototype.chunkSize = bnpChunkSize; + BigInteger.prototype.toRadix = bnpToRadix; + BigInteger.prototype.fromRadix = bnpFromRadix; + BigInteger.prototype.fromNumber = bnpFromNumber; + BigInteger.prototype.bitwiseTo = bnpBitwiseTo; + BigInteger.prototype.changeBit = bnpChangeBit; + BigInteger.prototype.addTo = bnpAddTo; + BigInteger.prototype.dMultiply = bnpDMultiply; + BigInteger.prototype.dAddOffset = bnpDAddOffset; + BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; + BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; + BigInteger.prototype.modInt = bnpModInt; + BigInteger.prototype.millerRabin = bnpMillerRabin; + + // public + BigInteger.prototype.clone = bnClone; + BigInteger.prototype.intValue = bnIntValue; + BigInteger.prototype.byteValue = bnByteValue; + BigInteger.prototype.shortValue = bnShortValue; + BigInteger.prototype.signum = bnSigNum; + BigInteger.prototype.toByteArray = bnToByteArray; + BigInteger.prototype.equals = bnEquals; + BigInteger.prototype.min = bnMin; + BigInteger.prototype.max = bnMax; + BigInteger.prototype.and = bnAnd; + BigInteger.prototype.or = bnOr; + BigInteger.prototype.xor = bnXor; + BigInteger.prototype.andNot = bnAndNot; + BigInteger.prototype.not = bnNot; + BigInteger.prototype.shiftLeft = bnShiftLeft; + BigInteger.prototype.shiftRight = bnShiftRight; + BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; + BigInteger.prototype.bitCount = bnBitCount; + BigInteger.prototype.testBit = bnTestBit; + BigInteger.prototype.setBit = bnSetBit; + BigInteger.prototype.clearBit = bnClearBit; + BigInteger.prototype.flipBit = bnFlipBit; + BigInteger.prototype.add = bnAdd; + BigInteger.prototype.subtract = bnSubtract; + BigInteger.prototype.multiply = bnMultiply; + BigInteger.prototype.divide = bnDivide; + BigInteger.prototype.remainder = bnRemainder; + BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; + BigInteger.prototype.modPow = bnModPow; + BigInteger.prototype.modInverse = bnModInverse; + BigInteger.prototype.pow = bnPow; + BigInteger.prototype.gcd = bnGCD; + BigInteger.prototype.isProbablePrime = bnIsProbablePrime; + + // JSBN-specific extension + BigInteger.prototype.square = bnSquare; + + // Expose the Barrett function + BigInteger.prototype.Barrett = Barrett + + // BigInteger interfaces not implemented in jsbn: + + // BigInteger(int signum, byte[] magnitude) + // double doubleValue() + // float floatValue() + // int hashCode() + // long longValue() + // static BigInteger valueOf(long val) + + // Random number generator - requires a PRNG backend, e.g. prng4.js + + // For best results, put code like + // + // in your main HTML document. + + var rng_state; + var rng_pool; + var rng_pptr; + + // Mix in a 32-bit integer into the pool + function rng_seed_int(x) { + rng_pool[rng_pptr++] ^= x & 255; + rng_pool[rng_pptr++] ^= (x >> 8) & 255; + rng_pool[rng_pptr++] ^= (x >> 16) & 255; + rng_pool[rng_pptr++] ^= (x >> 24) & 255; + if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; + } + + // Mix in the current time (w/milliseconds) into the pool + function rng_seed_time() { + rng_seed_int(new Date().getTime()); + } + + // Initialize the pool with junk if needed. + if(rng_pool == null) { + rng_pool = new Array(); + rng_pptr = 0; + var t; + if(typeof window !== "undefined" && window.crypto) { + if (window.crypto.getRandomValues) { + // Use webcrypto if available + var ua = new Uint8Array(32); + window.crypto.getRandomValues(ua); + for(t = 0; t < 32; ++t) + rng_pool[rng_pptr++] = ua[t]; + } + else if(navigator.appName == "Netscape" && navigator.appVersion < "5") { + // Extract entropy (256 bits) from NS4 RNG if available + var z = window.crypto.random(32); + for(t = 0; t < z.length; ++t) + rng_pool[rng_pptr++] = z.charCodeAt(t) & 255; + } + } + while(rng_pptr < rng_psize) { // extract some randomness from Math.random() + t = Math.floor(65536 * Math.random()); + rng_pool[rng_pptr++] = t >>> 8; + rng_pool[rng_pptr++] = t & 255; + } + rng_pptr = 0; + rng_seed_time(); + //rng_seed_int(window.screenX); + //rng_seed_int(window.screenY); + } + + function rng_get_byte() { + if(rng_state == null) { + rng_seed_time(); + rng_state = prng_newstate(); + rng_state.init(rng_pool); + for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) + rng_pool[rng_pptr] = 0; + rng_pptr = 0; + //rng_pool = null; + } + // TODO: allow reseeding after first request + return rng_state.next(); + } + + function rng_get_bytes(ba) { + var i; + for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); + } + + function SecureRandom() {} + + SecureRandom.prototype.nextBytes = rng_get_bytes; + + // prng4.js - uses Arcfour as a PRNG + + function Arcfour() { + this.i = 0; + this.j = 0; + this.S = new Array(); + } + + // Initialize arcfour context from key, an array of ints, each from [0..255] + function ARC4init(key) { + var i, j, t; + for(i = 0; i < 256; ++i) + this.S[i] = i; + j = 0; + for(i = 0; i < 256; ++i) { + j = (j + this.S[i] + key[i % key.length]) & 255; + t = this.S[i]; + this.S[i] = this.S[j]; + this.S[j] = t; + } + this.i = 0; + this.j = 0; + } + + function ARC4next() { + var t; + this.i = (this.i + 1) & 255; + this.j = (this.j + this.S[this.i]) & 255; + t = this.S[this.i]; + this.S[this.i] = this.S[this.j]; + this.S[this.j] = t; + return this.S[(t + this.S[this.i]) & 255]; + } + + Arcfour.prototype.init = ARC4init; + Arcfour.prototype.next = ARC4next; + + // Plug in your RNG constructor here + function prng_newstate() { + return new Arcfour(); + } + + // Pool size must be a multiple of 4 and greater than 32. + // An array of bytes the size of the pool will be passed to init() + var rng_psize = 256; + + BigInteger.SecureRandom = SecureRandom; + BigInteger.BigInteger = BigInteger; + if (typeof exports !== 'undefined') { + exports = module.exports = BigInteger; + } else { + this.BigInteger = BigInteger; + this.SecureRandom = SecureRandom; + } + +}).call(this); diff --git a/appasar/canary/node_modules/jsbn/package.json b/appasar/canary/node_modules/jsbn/package.json new file mode 100644 index 0000000..7220c19 --- /dev/null +++ b/appasar/canary/node_modules/jsbn/package.json @@ -0,0 +1,21 @@ +{ + "name": "jsbn", + "version": "0.1.1", + "description": "The jsbn library is a fast, portable implementation of large-number math in pure JavaScript, enabling public-key crypto and other applications on desktop and mobile browsers.", + "main": "index.js", + "scripts": { + "test": "mocha test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/andyperlitch/jsbn.git" + }, + "keywords": [ + "biginteger", + "bignumber", + "big", + "integer" + ], + "author": "Tom Wu", + "license": "MIT" +} diff --git a/appasar/canary/node_modules/json-schema-traverse/.eslintrc.yml b/appasar/canary/node_modules/json-schema-traverse/.eslintrc.yml new file mode 100644 index 0000000..ab1762d --- /dev/null +++ b/appasar/canary/node_modules/json-schema-traverse/.eslintrc.yml @@ -0,0 +1,27 @@ +extends: eslint:recommended +env: + node: true + browser: true +rules: + block-scoped-var: 2 + complexity: [2, 13] + curly: [2, multi-or-nest, consistent] + dot-location: [2, property] + dot-notation: 2 + indent: [2, 2, SwitchCase: 1] + linebreak-style: [2, unix] + new-cap: 2 + no-console: [2, allow: [warn, error]] + no-else-return: 2 + no-eq-null: 2 + no-fallthrough: 2 + no-invalid-this: 2 + no-return-assign: 2 + no-shadow: 1 + no-trailing-spaces: 2 + no-use-before-define: [2, nofunc] + quotes: [2, single, avoid-escape] + semi: [2, always] + strict: [2, global] + valid-jsdoc: [2, requireReturn: false] + no-control-regex: 0 diff --git a/appasar/canary/node_modules/json-schema-traverse/.npmignore b/appasar/canary/node_modules/json-schema-traverse/.npmignore new file mode 100644 index 0000000..d093557 --- /dev/null +++ b/appasar/canary/node_modules/json-schema-traverse/.npmignore @@ -0,0 +1,60 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +.DS_Store diff --git a/appasar/canary/node_modules/json-schema-traverse/.travis.yml b/appasar/canary/node_modules/json-schema-traverse/.travis.yml new file mode 100644 index 0000000..7ddce74 --- /dev/null +++ b/appasar/canary/node_modules/json-schema-traverse/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "4" + - "6" + - "7" + - "8" +after_script: + - coveralls < coverage/lcov.info diff --git a/appasar/canary/node_modules/json-schema-traverse/LICENSE b/appasar/canary/node_modules/json-schema-traverse/LICENSE new file mode 100644 index 0000000..7f15435 --- /dev/null +++ b/appasar/canary/node_modules/json-schema-traverse/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/json-schema-traverse/README.md b/appasar/canary/node_modules/json-schema-traverse/README.md new file mode 100644 index 0000000..d4286a2 --- /dev/null +++ b/appasar/canary/node_modules/json-schema-traverse/README.md @@ -0,0 +1,69 @@ +# json-schema-traverse +Traverse JSON Schema passing each schema object to callback + +[![Build Status](https://travis-ci.org/epoberezkin/json-schema-traverse.svg?branch=master)](https://travis-ci.org/epoberezkin/json-schema-traverse) +[![npm version](https://badge.fury.io/js/json-schema-traverse.svg)](https://www.npmjs.com/package/json-schema-traverse) +[![Coverage Status](https://coveralls.io/repos/github/epoberezkin/json-schema-traverse/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master) + + +## Install + +``` +npm install json-schema-traverse +``` + + +## Usage + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + properties: { + foo: {type: 'string'}, + bar: {type: 'integer'} + } +}; + +traverse(schema, cb); +// cb is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} +``` + +Callback function is called for each schema object (not including draft-06 boolean schemas), including the root schema. Schema references ($ref) are not resolved, they are passed as is. + +Callback is passed these parameters: + +- _schema_: the current schema object +- _JSON pointer_: from the root schema to the current schema object +- _root schema_: the schema passed to `traverse` object +- _parent JSON pointer_: from the root schema to the parent schema object (see below) +- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.) +- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema +- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'` + + +## Traverse objects in all unknown keywords + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + mySchema: { + minimum: 1, + maximum: 2 + } +}; + +traverse(schema, {allKeys: true}, cb); +// cb is called 2 times with: +// 1. root schema +// 2. mySchema +``` + +Without option `allKeys: true` callback will be called only with root schema. + + +## License + +[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE) diff --git a/appasar/canary/node_modules/json-schema-traverse/index.js b/appasar/canary/node_modules/json-schema-traverse/index.js new file mode 100644 index 0000000..79eeb6a --- /dev/null +++ b/appasar/canary/node_modules/json-schema-traverse/index.js @@ -0,0 +1,81 @@ +'use strict'; + +var traverse = module.exports = function (schema, opts, cb) { + if (typeof opts == 'function') { + cb = opts; + opts = {}; + } + _traverse(opts, cb, schema, '', schema); +}; + + +traverse.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true +}; + +traverse.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true +}; + +traverse.propsKeywords = { + definitions: true, + properties: true, + patternProperties: true, + dependencies: true +}; + +traverse.skipKeywords = { + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true +}; + + +function _traverse(opts, cb, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (schema && typeof schema == 'object' && !Array.isArray(schema)) { + cb(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse.arrayKeywords) { + for (var i=0; i + + + + + + + + + + + + + + +]> + + + + + + + + + A JSON Media Type for Describing the Structure and Meaning of JSON Documents + + + SitePen (USA) +

+ + 530 Lytton Avenue + Palo Alto, CA 94301 + USA + + +1 650 968 8787 + kris@sitepen.com +
+ + + +
+ + + Calgary, AB + Canada + + gary.court@gmail.com +
+
+ + + Internet Engineering Task Force + JSON + Schema + JavaScript + Object + Notation + Hyper Schema + Hypermedia + + + + JSON (JavaScript Object Notation) Schema defines the media type "application/schema+json", + a JSON based format for defining + the structure of JSON data. JSON Schema provides a contract for what JSON + data is required for a given application and how to interact with it. JSON + Schema is intended to define validation, documentation, hyperlink + navigation, and interaction control of JSON data. + + + + + +
+ + JSON (JavaScript Object Notation) Schema is a JSON media type for defining + the structure of JSON data. JSON Schema provides a contract for what JSON + data is required for a given application and how to interact with it. JSON + Schema is intended to define validation, documentation, hyperlink + navigation, and interaction control of JSON data. + +
+ +
+ + + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", + "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be + interpreted as described in RFC 2119. + +
+ + + +
+ + JSON Schema defines the media type "application/schema+json" for + describing the structure of other + JSON documents. JSON Schema is JSON-based and includes facilities + for describing the structure of JSON documents in terms of + allowable values, descriptions, and interpreting relations with other resources. + + + JSON Schema format is organized into several separate definitions. The first + definition is the core schema specification. This definition is primary + concerned with describing a JSON structure and specifying valid elements + in the structure. The second definition is the Hyper Schema specification + which is intended define elements in a structure that can be interpreted as + hyperlinks. + Hyper Schema builds on JSON Schema to describe the hyperlink structure of + other JSON documents and elements of interaction. This allows user agents to be able to successfully navigate + JSON documents based on their schemas. + + + Cumulatively JSON Schema acts as a meta-document that can be used to define the required type and constraints on + property values, as well as define the meaning of the property values + for the purpose of describing a resource and determining hyperlinks + within the representation. + +
+ An example JSON Schema that describes products might look like: + + + + + This schema defines the properties of the instance JSON documents, + the required properties (id, name, and price), as well as an optional + property (tags). This also defines the link relations of the instance + JSON documents. + +
+ +
+ + For this specification, schema will be used to denote a JSON Schema + definition, and an instance refers to a JSON value that the schema + will be describing and validating. + +
+ +
+ + The JSON Schema media type does not attempt to dictate the structure of JSON + representations that contain data, but rather provides a separate format + for flexibly communicating how a JSON representation should be + interpreted and validated, such that user agents can properly understand + acceptable structures and extrapolate hyperlink information + with the JSON document. It is acknowledged that JSON documents come + in a variety of structures, and JSON is unique in that the structure + of stored data structures often prescribes a non-ambiguous definite + JSON representation. Attempting to force a specific structure is generally + not viable, and therefore JSON Schema allows for a great flexibility + in the structure of the JSON data that it describes. + + + This specification is protocol agnostic. + The underlying protocol (such as HTTP) should sufficiently define the + semantics of the client-server interface, the retrieval of resource + representations linked to by JSON representations, and modification of + those resources. The goal of this + format is to sufficiently describe JSON structures such that one can + utilize existing information available in existing JSON + representations from a large variety of services that leverage a representational state transfer + architecture using existing protocols. + +
+
+ +
+ + JSON Schema instances are correlated to their schema by the "describedby" + relation, where the schema is defined to be the target of the relation. + Instance representations may be of the "application/json" media type or + any other subtype. Consequently, dictating how an instance + representation should specify the relation to the schema is beyond the normative scope + of this document (since this document specifically defines the JSON + Schema media type, and no other), but it is recommended that instances + specify their schema so that user agents can interpret the instance + representation and messages may retain the self-descriptive + characteristic, avoiding the need for out-of-band information about + instance data. Two approaches are recommended for declaring the + relation to the schema that describes the meaning of a JSON instance's (or collection + of instances) structure. A MIME type parameter named + "profile" or a relation of "describedby" (which could be defined by a Link header) may be used: + +
+ + + +
+ + or if the content is being transferred by a protocol (such as HTTP) that + provides headers, a Link header can be used: + +
+ +; rel="describedby" +]]> + +
+ + Instances MAY specify multiple schemas, to indicate all the schemas that + are applicable to the data, and the data SHOULD be valid by all the schemas. + The instance data MAY have multiple schemas + that it is defined by (the instance data SHOULD be valid for those schemas). + Or if the document is a collection of instances, the collection MAY contain + instances from different schemas. When collections contain heterogeneous + instances, the "pathStart" attribute MAY be specified in the + schema to disambiguate which schema should be applied for each item in the + collection. However, ultimately, the mechanism for referencing a schema is up to the + media type of the instance documents (if they choose to specify that schemas + can be referenced). +
+ +
+ + JSON Schemas can themselves be described using JSON Schemas. + A self-describing JSON Schema for the core JSON Schema can + be found at http://json-schema.org/schema for the latest version or + http://json-schema.org/draft-03/schema for the draft-03 version. The hyper schema + self-description can be found at http://json-schema.org/hyper-schema + or http://json-schema.org/draft-03/hyper-schema. All schemas + used within a protocol with media type definitions + SHOULD include a MIME parameter that refers to the self-descriptive + hyper schema or another schema that extends this hyper schema: + +
+ + + +
+
+
+
+ +
+ + A JSON Schema is a JSON Object that defines various attributes + (including usage and valid values) of a JSON value. JSON + Schema has recursive capabilities; there are a number of elements + in the structure that allow for nested JSON Schemas. + + +
+ An example JSON Schema definition could look like: + + + +
+ + + A JSON Schema object may have any of the following properties, called schema + attributes (all attributes are optional): + + +
+ + This attribute defines what the primitive type or the schema of the instance MUST be in order to validate. + This attribute can take one of two forms: + + + + A string indicating a primitive or simple type. The following are acceptable string values: + + + Value MUST be a string. + Value MUST be a number, floating point numbers are allowed. + Value MUST be an integer, no floating point numbers are allowed. This is a subset of the number type. + Value MUST be a boolean. + Value MUST be an object. + Value MUST be an array. + Value MUST be null. Note this is mainly for purpose of being able use union types to define nullability. If this type is not included in a union, null values are not allowed (the primitives listed above do not allow nulls on their own). + Value MAY be of any type including null. + + + If the property is not defined or is not in this list, then any type of value is acceptable. + Other type values MAY be used for custom purposes, but minimal validators of the specification + implementation can allow any instance value on unknown type values. + + + + An array of two or more simple type definitions. Each item in the array MUST be a simple type definition or a schema. + The instance value is valid if it is of the same type as one of the simple type definitions, or valid by one of the schemas, in the array. + + + + +
+ For example, a schema that defines if an instance can be a string or a number would be: + + +
+
+ +
+ This attribute is an object with property definitions that define the valid values of instance object property values. When the instance value is an object, the property values of the instance object MUST conform to the property definitions in this object. In this object, each property definition's value MUST be a schema, and the property's name MUST be the name of the instance property that it defines. The instance property value MUST be valid according to the schema from the property definition. Properties are considered unordered, the order of the instance properties MAY be in any order. +
+ +
+ This attribute is an object that defines the schema for a set of property names of an object instance. The name of each property of this attribute's object is a regular expression pattern in the ECMA 262/Perl 5 format, while the value is a schema. If the pattern matches the name of a property on the instance object, the value of the instance's property MUST be valid against the pattern name's schema value. +
+ +
+ This attribute defines a schema for all properties that are not explicitly defined in an object type definition. If specified, the value MUST be a schema or a boolean. If false is provided, no additional properties are allowed beyond the properties defined in the schema. The default value is an empty schema which allows any value for additional properties. +
+ +
+ This attribute defines the allowed items in an instance array, and MUST be a schema or an array of schemas. The default value is an empty schema which allows any value for items in the instance array. + When this attribute value is a schema and the instance value is an array, then all the items in the array MUST be valid according to the schema. + When this attribute value is an array of schemas and the instance value is an array, each position in the instance array MUST conform to the schema in the corresponding position for this array. This called tuple typing. When tuple typing is used, additional items are allowed, disallowed, or constrained by the "additionalItems" attribute using the same rules as "additionalProperties" for objects. +
+ +
+ This provides a definition for additional items in an array instance when tuple definitions of the items is provided. This can be false to indicate additional items in the array are not allowed, or it can be a schema that defines the schema of the additional items. +
+ +
+ This attribute indicates if the instance must have a value, and not be undefined. This is false by default, making the instance optional. +
+ +
+ This attribute is an object that defines the requirements of a property on an instance object. If an object instance has a property with the same name as a property in this attribute's object, then the instance must be valid against the attribute's property value (hereafter referred to as the "dependency value"). + + The dependency value can take one of two forms: + + + + If the dependency value is a string, then the instance object MUST have a property with the same name as the dependency value. + If the dependency value is an array of strings, then the instance object MUST have a property with the same name as each string in the dependency value's array. + + + If the dependency value is a schema, then the instance object MUST be valid against the schema. + + + +
+ +
+ This attribute defines the minimum value of the instance property when the type of the instance value is a number. +
+ +
+ This attribute defines the maximum value of the instance property when the type of the instance value is a number. +
+ +
+ This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "minimum" attribute. This is false by default, meaning the instance value can be greater then or equal to the minimum value. +
+ +
+ This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "maximum" attribute. This is false by default, meaning the instance value can be less then or equal to the maximum value. +
+ +
+ This attribute defines the minimum number of values in an array when the array is the instance value. +
+ +
+ This attribute defines the maximum number of values in an array when the array is the instance value. +
+ +
+ This attribute indicates that all items in an array instance MUST be unique (contains no two identical values). + + Two instance are consider equal if they are both of the same type and: + + + are null; or + are booleans/numbers/strings and have the same value; or + are arrays, contains the same number of items, and each item in the array is equal to the corresponding item in the other array; or + are objects, contains the same property names, and each property in the object is equal to the corresponding property in the other object. + + +
+ +
+ When the instance value is a string, this provides a regular expression that a string instance MUST match in order to be valid. Regular expressions SHOULD follow the regular expression specification from ECMA 262/Perl 5 +
+ +
+ When the instance value is a string, this defines the minimum length of the string. +
+ +
+ When the instance value is a string, this defines the maximum length of the string. +
+ +
+ This provides an enumeration of all possible values that are valid for the instance property. This MUST be an array, and each item in the array represents a possible value for the instance value. If this attribute is defined, the instance value MUST be one of the values in the array in order for the schema to be valid. Comparison of enum values uses the same algorithm as defined in "uniqueItems". +
+ +
+ This attribute defines the default value of the instance when the instance is undefined. +
+ +
+ This attribute is a string that provides a short description of the instance property. +
+ +
+ This attribute is a string that provides a full description of the of purpose the instance property. +
+ +
+ This property defines the type of data, content type, or microformat to be expected in the instance property values. A format attribute MAY be one of the values listed below, and if so, SHOULD adhere to the semantics describing for the format. A format SHOULD only be used to give meaning to primitive types (string, integer, number, or boolean). Validators MAY (but are not required to) validate that the instance values conform to a format. + + + The following formats are predefined: + + + This SHOULD be a date in ISO 8601 format of YYYY-MM-DDThh:mm:ssZ in UTC time. This is the recommended form of date/timestamp. + This SHOULD be a date in the format of YYYY-MM-DD. It is recommended that you use the "date-time" format instead of "date" unless you need to transfer only the date part. + This SHOULD be a time in the format of hh:mm:ss. It is recommended that you use the "date-time" format instead of "time" unless you need to transfer only the time part. + This SHOULD be the difference, measured in milliseconds, between the specified time and midnight, 00:00 of January 1, 1970 UTC. The value SHOULD be a number (integer or float). + A regular expression, following the regular expression specification from ECMA 262/Perl 5. + This is a CSS color (like "#FF0000" or "red"), based on CSS 2.1. + This is a CSS style definition (like "color: red; background-color:#FFF"), based on CSS 2.1. + This SHOULD be a phone number (format MAY follow E.123). + This value SHOULD be a URI. + This SHOULD be an email address. + This SHOULD be an ip version 4 address. + This SHOULD be an ip version 6 address. + This SHOULD be a host-name. + + + + Additional custom formats MAY be created. These custom formats MAY be expressed as an URI, and this URI MAY reference a schema of that format. +
+ +
+ This attribute defines what value the number instance must be divisible by with no remainder (the result of the division must be an integer.) The value of this attribute SHOULD NOT be 0. +
+ +
+ This attribute takes the same values as the "type" attribute, however if the instance matches the type or if this value is an array and the instance matches any type or schema in the array, then this instance is not valid. +
+ +
+ The value of this property MUST be another schema which will provide a base schema which the current schema will inherit from. The inheritance rules are such that any instance that is valid according to the current schema MUST be valid according to the referenced schema. This MAY also be an array, in which case, the instance MUST be valid for all the schemas in the array. A schema that extends another schema MAY define additional attributes, constrain existing attributes, or add other constraints. + + Conceptually, the behavior of extends can be seen as validating an + instance against all constraints in the extending schema as well as + the extended schema(s). More optimized implementations that merge + schemas are possible, but are not required. Some examples of using "extends": + +
+ + + +
+ +
+ + + +
+
+
+ +
+ + This attribute defines the current URI of this schema (this attribute is + effectively a "self" link). This URI MAY be relative or absolute. If + the URI is relative it is resolved against the current URI of the parent + schema it is contained in. If this schema is not contained in any + parent schema, the current URI of the parent schema is held to be the + URI under which this schema was addressed. If id is missing, the current URI of a schema is + defined to be that of the parent schema. The current URI of the schema + is also used to construct relative references such as for $ref. + +
+ +
+ + This attribute defines a URI of a schema that contains the full representation of this schema. + When a validator encounters this attribute, it SHOULD replace the current schema with the schema referenced by the value's URI (if known and available) and re-validate the instance. + This URI MAY be relative or absolute, and relative URIs SHOULD be resolved against the URI of the current schema. + +
+ +
+ + This attribute defines a URI of a JSON Schema that is the schema of the current schema. + When this attribute is defined, a validator SHOULD use the schema referenced by the value's URI (if known and available) when resolving Hyper Schemalinks. + + + + A validator MAY use this attribute's value to determine which version of JSON Schema the current schema is written in, and provide the appropriate validation features and behavior. + Therefore, it is RECOMMENDED that all schema authors include this attribute in their schemas to prevent conflicts with future JSON Schema specification changes. + +
+
+ +
+ + The following attributes are specified in addition to those + attributes that already provided by the core schema with the specific + purpose of informing user agents of relations between resources based + on JSON data. Just as with JSON + schema attributes, all the attributes in hyper schemas are optional. + Therefore, an empty object is a valid (non-informative) schema, and + essentially describes plain JSON (no constraints on the structures). + Addition of attributes provides additive information for user agents. + + +
+ + The value of the links property MUST be an array, where each item + in the array is a link description object which describes the link + relations of the instances. + + +
+ + A link description object is used to describe link relations. In + the context of a schema, it defines the link relations of the + instances of the schema, and can be parameterized by the instance + values. The link description format can be used on its own in + regular (non-schema documents), and use of this format can + be declared by referencing the normative link description + schema as the the schema for the data structure that uses the + links. The URI of the normative link description schema is: + http://json-schema.org/links (latest version) or + http://json-schema.org/draft-03/links (draft-03 version). + + +
+ + The value of the "href" link description property + indicates the target URI of the related resource. The value + of the instance property SHOULD be resolved as a URI-Reference per RFC 3986 + and MAY be a relative URI. The base URI to be used for relative resolution + SHOULD be the URI used to retrieve the instance object (not the schema) + when used within a schema. Also, when links are used within a schema, the URI + SHOULD be parametrized by the property values of the instance + object, if property values exist for the corresponding variables + in the template (otherwise they MAY be provided from alternate sources, like user input). + + + + Instance property values SHOULD be substituted into the URIs where + matching braces ('{', '}') are found surrounding zero or more characters, + creating an expanded URI. Instance property value substitutions are resolved + by using the text between the braces to denote the property name + from the instance to get the value to substitute. + +
+ For example, if an href value is defined: + + + + Then it would be resolved by replace the value of the "id" property value from the instance object. +
+ +
+ If the value of the "id" property was "45", the expanded URI would be: + + + +
+ + If matching braces are found with the string "@" (no quotes) between the braces, then the + actual instance value SHOULD be used to replace the braces, rather than a property value. + This should only be used in situations where the instance is a scalar (string, + boolean, or number), and not for objects or arrays. +
+
+ +
+ + The value of the "rel" property indicates the name of the + relation to the target resource. The relation to the target SHOULD be interpreted as specifically from the instance object that the schema (or sub-schema) applies to, not just the top level resource that contains the object within its hierarchy. If a resource JSON representation contains a sub object with a property interpreted as a link, that sub-object holds the relation with the target. A relation to target from the top level resource MUST be indicated with the schema describing the top level JSON representation. + + + + Relationship definitions SHOULD NOT be media type dependent, and users are encouraged to utilize existing accepted relation definitions, including those in existing relation registries (see RFC 4287). However, we define these relations here for clarity of normative interpretation within the context of JSON hyper schema defined relations: + + + + If the relation value is "self", when this property is encountered in + the instance object, the object represents a resource and the instance object is + treated as a full representation of the target resource identified by + the specified URI. + + + + This indicates that the target of the link is the full representation for the instance object. The object that contains this link possibly may not be the full representation. + + + + This indicates the target of the link is the schema for the instance object. This MAY be used to specifically denote the schemas of objects within a JSON object hierarchy, facilitating polymorphic type data structures. + + + + This relation indicates that the target of the link + SHOULD be treated as the root or the body of the representation for the + purposes of user agent interaction or fragment resolution. All other + properties of the instance objects can be regarded as meta-data + descriptions for the data. + + + + + + The following relations are applicable for schemas (the schema as the "from" resource in the relation): + + + This indicates the target resource that represents collection of instances of a schema. + This indicates a target to use for creating new instances of a schema. This link definition SHOULD be a submission link with a non-safe method (like POST). + + + + +
+ For example, if a schema is defined: + + + +
+ +
+ And if a collection of instance resource's JSON representation was retrieved: + + + +
+ + This would indicate that for the first item in the collection, its own + (self) URI would resolve to "/Resource/thing" and the first item's "up" + relation SHOULD be resolved to the resource at "/Resource/parent". + The "children" collection would be located at "/Resource/?upId=thing". +
+
+ +
+ This property value is a schema that defines the expected structure of the JSON representation of the target of the link. +
+ +
+ + The following properties also apply to link definition objects, and + provide functionality analogous to HTML forms, in providing a + means for submitting extra (often user supplied) information to send to a server. + + +
+ + This attribute defines which method can be used to access the target resource. + In an HTTP environment, this would be "GET" or "POST" (other HTTP methods + such as "PUT" and "DELETE" have semantics that are clearly implied by + accessed resources, and do not need to be defined here). + This defaults to "GET". + +
+ +
+ + If present, this property indicates a query media type format that the server + supports for querying or posting to the collection of instances at the target + resource. The query can be + suffixed to the target URI to query the collection with + property-based constraints on the resources that SHOULD be returned from + the server or used to post data to the resource (depending on the method). + +
+ For example, with the following schema: + + + + This indicates that the client can query the server for instances that have a specific name. +
+ +
+ For example: + + + +
+ + If no enctype or method is specified, only the single URI specified by + the href property is defined. If the method is POST, "application/json" is + the default media type. +
+
+ +
+ + This attribute contains a schema which defines the acceptable structure of the submitted + request (for a GET request, this schema would define the properties for the query string + and for a POST request, this would define the body). + +
+
+
+
+ +
+ + This property indicates the fragment resolution protocol to use for + resolving fragment identifiers in URIs within the instance + representations. This applies to the instance object URIs and all + children of the instance object's URIs. The default fragment resolution + protocol is "slash-delimited", which is defined below. Other fragment + resolution protocols MAY be used, but are not defined in this document. + + + + The fragment identifier is based on RFC 2396, Sec 5, and defines the + mechanism for resolving references to entities within a document. + + +
+ + With the slash-delimited fragment resolution protocol, the fragment + identifier is interpreted as a series of property reference tokens that start with and + are delimited by the "/" character (\x2F). Each property reference token + is a series of unreserved or escaped URI characters. Each property + reference token SHOULD be interpreted, starting from the beginning of + the fragment identifier, as a path reference in the target JSON + structure. The final target value of the fragment can be determined by + starting with the root of the JSON structure from the representation of + the resource identified by the pre-fragment URI. If the target is a JSON + object, then the new target is the value of the property with the name + identified by the next property reference token in the fragment. If the + target is a JSON array, then the target is determined by finding the + item in array the array with the index defined by the next property + reference token (which MUST be a number). The target is successively + updated for each property reference token, until the entire fragment has + been traversed. + + + + Property names SHOULD be URI-encoded. In particular, any "/" in a + property name MUST be encoded to avoid being interpreted as a property + delimiter. + + + +
+ For example, for the following JSON representation: + + + +
+ +
+ The following fragment identifiers would be resolved: + + + +
+
+
+ +
+ + The dot-delimited fragment resolution protocol is the same as + slash-delimited fragment resolution protocol except that the "." character + (\x2E) is used as the delimiter between property names (instead of "/") and + the path does not need to start with a ".". For example, #.foo and #foo are a valid fragment + identifiers for referencing the value of the foo propery. + +
+
+ +
+ This attribute indicates that the instance property SHOULD NOT be changed. Attempts by a user agent to modify the value of this property are expected to be rejected by a server. +
+ +
+ If the instance property value is a string, this attribute defines that the string SHOULD be interpreted as binary data and decoded using the encoding named by this schema property. RFC 2045, Sec 6.1 lists the possible values for this property. +
+ +
+ + This attribute is a URI that defines what the instance's URI MUST start with in order to validate. + The value of the "pathStart" attribute MUST be resolved as per RFC 3986, Sec 5, + and is relative to the instance's URI. + + + + When multiple schemas have been referenced for an instance, the user agent + can determine if this schema is applicable for a particular instance by + determining if the URI of the instance begins with the the value of the "pathStart" + attribute. If the URI of the instance does not start with this URI, + or if another schema specifies a starting URI that is longer and also matches the + instance, this schema SHOULD NOT be applied to the instance. Any schema + that does not have a pathStart attribute SHOULD be considered applicable + to all the instances for which it is referenced. + +
+ +
+ This attribute defines the media type of the instance representations that this schema is defining. +
+
+ +
+ + This specification is a sub-type of the JSON format, and + consequently the security considerations are generally the same as RFC 4627. + However, an additional issue is that when link relation of "self" + is used to denote a full representation of an object, the user agent + SHOULD NOT consider the representation to be the authoritative representation + of the resource denoted by the target URI if the target URI is not + equivalent to or a sub-path of the the URI used to request the resource + representation which contains the target URI with the "self" link. + +
+ For example, if a hyper schema was defined: + + + +
+ +
+ And a resource was requested from somesite.com: + + + +
+ +
+ With a response of: + + + +
+
+
+ +
+ The proposed MIME media type for JSON Schema is "application/schema+json". + Type name: application + Subtype name: schema+json + Required parameters: profile + + The value of the profile parameter SHOULD be a URI (relative or absolute) that + refers to the schema used to define the structure of this structure (the + meta-schema). Normally the value would be http://json-schema.org/draft-03/hyper-schema, + but it is allowable to use other schemas that extend the hyper schema's meta- + schema. + + Optional parameters: pretty + The value of the pretty parameter MAY be true or false to indicate if additional whitespace has been included to make the JSON representation easier to read. + +
+ + This registry is maintained by IANA per RFC 4287 and this specification adds + four values: "full", "create", "instances", "root". New + assignments are subject to IESG Approval, as outlined in RFC 5226. + Requests should be made by email to IANA, which will then forward the + request to the IESG, requesting approval. + +
+
+
+ + + + + &rfc2045; + &rfc2119; + &rfc2396; + &rfc3339; + &rfc3986; + &rfc4287; + + + &rfc2616; + &rfc4627; + &rfc5226; + &iddiscovery; + &uritemplate; + &linkheader; + &html401; + &css21; + + +
+ + + + + Added example and verbiage to "extends" attribute. + Defined slash-delimited to use a leading slash. + Made "root" a relation instead of an attribute. + Removed address values, and MIME media type from format to reduce confusion (mediaType already exists, so it can be used for MIME types). + Added more explanation of nullability. + Removed "alternate" attribute. + Upper cased many normative usages of must, may, and should. + Replaced the link submission "properties" attribute to "schema" attribute. + Replaced "optional" attribute with "required" attribute. + Replaced "maximumCanEqual" attribute with "exclusiveMaximum" attribute. + Replaced "minimumCanEqual" attribute with "exclusiveMinimum" attribute. + Replaced "requires" attribute with "dependencies" attribute. + Moved "contentEncoding" attribute to hyper schema. + Added "additionalItems" attribute. + Added "id" attribute. + Switched self-referencing variable substitution from "-this" to "@" to align with reserved characters in URI template. + Added "patternProperties" attribute. + Schema URIs are now namespace versioned. + Added "$ref" and "$schema" attributes. + + + + + + Replaced "maxDecimal" attribute with "divisibleBy" attribute. + Added slash-delimited fragment resolution protocol and made it the default. + Added language about using links outside of schemas by referencing its normative URI. + Added "uniqueItems" attribute. + Added "targetSchema" attribute to link description object. + + + + + + Fixed category and updates from template. + + + + + + Initial draft. + + + + +
+ +
+ + + Should we give a preference to MIME headers over Link headers (or only use one)? + Should "root" be a MIME parameter? + Should "format" be renamed to "mediaType" or "contentType" to reflect the usage MIME media types that are allowed? + How should dates be handled? + + +
+
+ diff --git a/appasar/canary/node_modules/json-schema/draft-zyp-json-schema-04.xml b/appasar/canary/node_modules/json-schema/draft-zyp-json-schema-04.xml new file mode 100644 index 0000000..8ede6bf --- /dev/null +++ b/appasar/canary/node_modules/json-schema/draft-zyp-json-schema-04.xml @@ -0,0 +1,1072 @@ + + + + + + + + + + + + + + +]> + + + + + + + + + A JSON Media Type for Describing the Structure and Meaning of JSON Documents + + + SitePen (USA) +
+ + 530 Lytton Avenue + Palo Alto, CA 94301 + USA + + +1 650 968 8787 + kris@sitepen.com +
+
+ + +
+ + + Calgary, AB + Canada + + gary.court@gmail.com +
+
+ + + Internet Engineering Task Force + JSON + Schema + JavaScript + Object + Notation + Hyper Schema + Hypermedia + + + + JSON (JavaScript Object Notation) Schema defines the media type "application/schema+json", + a JSON based format for defining the structure of JSON data. JSON Schema provides a contract for what JSON + data is required for a given application and how to interact with it. JSON + Schema is intended to define validation, documentation, hyperlink + navigation, and interaction control of JSON data. + + +
+ + +
+ + JSON (JavaScript Object Notation) Schema is a JSON media type for defining + the structure of JSON data. JSON Schema provides a contract for what JSON + data is required for a given application and how to interact with it. JSON + Schema is intended to define validation, documentation, hyperlink + navigation, and interaction control of JSON data. + +
+ +
+ + + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", + "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be + interpreted as described in RFC 2119. + + + + The terms "JSON", "JSON text", "JSON value", "member", "element", "object", + "array", "number", "string", "boolean", "true", "false", and "null" in this + document are to be interpreted as defined in RFC 4627. + + + + This specification also uses the following defined terms: + + + A JSON Schema object. + Equivalent to "JSON value" as defined in RFC 4627. + Equivalent to "member" as defined in RFC 4627. + Equivalent to "element" as defined in RFC 4627. + A property of a JSON Schema object. + + +
+ +
+ + JSON Schema defines the media type "application/schema+json" for + describing the structure of JSON text. JSON Schemas are also written in JSON and includes facilities + for describing the structure of JSON in terms of + allowable values, descriptions, and interpreting relations with other resources. + + + This document is organized into several separate definitions. The first + definition is the core schema specification. This definition is primary + concerned with describing a JSON structure and specifying valid elements + in the structure. The second definition is the Hyper Schema specification + which is intended to define elements in a structure that can be interpreted as + hyperlinks. + Hyper Schema builds on JSON Schema to describe the hyperlink structure of + JSON values. This allows user agents to be able to successfully navigate + documents containing JSON based on their schemas. + + + Cumulatively JSON Schema acts as meta-JSON that can be used to define the + required type and constraints on JSON values, as well as define the meaning + of the JSON values for the purpose of describing a resource and determining + hyperlinks within the representation. + +
+ An example JSON Schema that describes products might look like: + + + + + This schema defines the properties of the instance, + the required properties (id, name, and price), as well as an optional + property (tags). This also defines the link relations of the instance. + +
+ +
+ + The JSON Schema media type does not attempt to dictate the structure of JSON + values that contain data, but rather provides a separate format + for flexibly communicating how a JSON value should be + interpreted and validated, such that user agents can properly understand + acceptable structures and extrapolate hyperlink information + from the JSON. It is acknowledged that JSON values come + in a variety of structures, and JSON is unique in that the structure + of stored data structures often prescribes a non-ambiguous definite + JSON representation. Attempting to force a specific structure is generally + not viable, and therefore JSON Schema allows for a great flexibility + in the structure of the JSON data that it describes. + + + This specification is protocol agnostic. + The underlying protocol (such as HTTP) should sufficiently define the + semantics of the client-server interface, the retrieval of resource + representations linked to by JSON representations, and modification of + those resources. The goal of this + format is to sufficiently describe JSON structures such that one can + utilize existing information available in existing JSON + representations from a large variety of services that leverage a representational state transfer + architecture using existing protocols. + +
+
+ +
+ + JSON values are correlated to their schema by the "describedby" + relation, where the schema is the target of the relation. + JSON values MUST be of the "application/json" media type or + any other subtype. Consequently, dictating how a JSON value should + specify the relation to the schema is beyond the normative scope + of this document since this document specifically defines the JSON + Schema media type, and no other. It is RECOMMNENDED that JSON values + specify their schema so that user agents can interpret the instance + and retain the self-descriptive characteristics. This avoides the need for out-of-band information about + instance data. Two approaches are recommended for declaring the + relation to the schema that describes the meaning of a JSON instance's (or collection + of instances) structure. A MIME type parameter named + "profile" or a relation of "describedby" (which could be specified by a Link header) may be used: + +
+ + + +
+ + or if the content is being transferred by a protocol (such as HTTP) that + provides headers, a Link header can be used: + +
+ +; rel="describedby" +]]> + +
+ + Instances MAY specify multiple schemas, to indicate all the schemas that + are applicable to the data, and the data SHOULD be valid by all the schemas. + The instance data MAY have multiple schemas + that it is described by (the instance data SHOULD be valid for those schemas). + Or if the document is a collection of instances, the collection MAY contain + instances from different schemas. The mechanism for referencing a schema is + determined by the media type of the instance (if it provides a method for + referencing schemas). +
+ +
+ + JSON Schemas can themselves be described using JSON Schemas. + A self-describing JSON Schema for the core JSON Schema can + be found at http://json-schema.org/schema for the latest version or + http://json-schema.org/draft-04/schema for the draft-04 version. The hyper schema + self-description can be found at http://json-schema.org/hyper-schema + or http://json-schema.org/draft-04/hyper-schema. All schemas + used within a protocol with a media type specified SHOULD include a MIME parameter that refers to the self-descriptive + hyper schema or another schema that extends this hyper schema: + +
+ + + +
+
+
+
+ +
+ + A JSON Schema is a JSON object that defines various attributes + (including usage and valid values) of a JSON value. JSON + Schema has recursive capabilities; there are a number of elements + in the structure that allow for nested JSON Schemas. + + +
+ An example JSON Schema could look like: + + + +
+ + + A JSON Schema object MAY have any of the following optional properties: + + + + + +
+ + This attribute defines what the primitive type or the schema of the instance MUST be in order to validate. + This attribute can take one of two forms: + + + + A string indicating a primitive or simple type. The string MUST be one of the following values: + + + Instance MUST be an object. + Instance MUST be an array. + Instance MUST be a string. + Instance MUST be a number, including floating point numbers. + Instance MUST be the JSON literal "true" or "false". + Instance MUST be the JSON literal "null". Note that without this type, null values are not allowed. + Instance MAY be of any type, including null. + + + + + An array of one or more simple or schema types. + The instance value is valid if it is of the same type as one of the simple types, or valid by one of the schemas, in the array. + + + + If this attribute is not specified, then all value types are accepted. + + +
+ For example, a schema that defines if an instance can be a string or a number would be: + + +
+
+ +
+ + This attribute is an object with properties that specify the schemas for the properties of the instance object. + In this attribute's object, each property value MUST be a schema. + When the instance value is an object, the value of the instance's properties MUST be valid according to the schemas with the same property names specified in this attribute. + Objects are unordered, so therefore the order of the instance properties or attribute properties MUST NOT determine validation success. + +
+ +
+ + This attribute is an object that defines the schema for a set of property names of an object instance. + The name of each property of this attribute's object is a regular expression pattern in the ECMA 262/Perl 5 format, while the value is a schema. + If the pattern matches the name of a property on the instance object, the value of the instance's property MUST be valid against the pattern name's schema value. + +
+ +
+ This attribute specifies how any instance property that is not explicitly defined by either the "properties" or "patternProperties" attributes (hereafter referred to as "additional properties") is handled. If specified, the value MUST be a schema or a boolean. + If a schema is provided, then all additional properties MUST be valid according to the schema. + If false is provided, then no additional properties are allowed. + The default value is an empty schema, which allows any value for additional properties. +
+ +
+ This attribute provides the allowed items in an array instance. If specified, this attribute MUST be a schema or an array of schemas. + When this attribute value is a schema and the instance value is an array, then all the items in the array MUST be valid according to the schema. + When this attribute value is an array of schemas and the instance value is an array, each position in the instance array MUST be valid according to the schema in the corresponding position for this array. This called tuple typing. When tuple typing is used, additional items are allowed, disallowed, or constrained by the "additionalItems" attribute the same way as "additionalProperties" for objects is. +
+ +
+ This attribute specifies how any item in the array instance that is not explicitly defined by "items" (hereafter referred to as "additional items") is handled. If specified, the value MUST be a schema or a boolean. + If a schema is provided: + + If the "items" attribute is unspecified, then all items in the array instance must be valid against this schema. + If the "items" attribute is a schema, then this attribute is ignored. + If the "items" attribute is an array (during tuple typing), then any additional items MUST be valid against this schema. + + + If false is provided, then any additional items in the array are not allowed. + The default value is an empty schema, which allows any value for additional items. +
+ +
+ This attribute is an array of strings that defines all the property names that must exist on the object instance. +
+ +
+ This attribute is an object that specifies the requirements of a property on an object instance. If an object instance has a property with the same name as a property in this attribute's object, then the instance must be valid against the attribute's property value (hereafter referred to as the "dependency value"). + + The dependency value can take one of two forms: + + + + If the dependency value is a string, then the instance object MUST have a property with the same name as the dependency value. + If the dependency value is an array of strings, then the instance object MUST have a property with the same name as each string in the dependency value's array. + + + If the dependency value is a schema, then the instance object MUST be valid against the schema. + + + +
+ +
+ This attribute defines the minimum value of the instance property when the type of the instance value is a number. +
+ +
+ This attribute defines the maximum value of the instance property when the type of the instance value is a number. +
+ +
+ This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "minimum" attribute. This is false by default, meaning the instance value can be greater then or equal to the minimum value. +
+ +
+ This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "maximum" attribute. This is false by default, meaning the instance value can be less then or equal to the maximum value. +
+ +
+ This attribute defines the minimum number of values in an array when the array is the instance value. +
+ +
+ This attribute defines the maximum number of values in an array when the array is the instance value. +
+ +
+ This attribute defines the minimum number of properties required on an object instance. +
+ +
+ This attribute defines the maximum number of properties the object instance can have. +
+ +
+ This attribute indicates that all items in an array instance MUST be unique (contains no two identical values). + + Two instance are consider equal if they are both of the same type and: + + + are null; or + are booleans/numbers/strings and have the same value; or + are arrays, contains the same number of items, and each item in the array is equal to the item at the corresponding index in the other array; or + are objects, contains the same property names, and each property in the object is equal to the corresponding property in the other object. + + +
+ +
+ When the instance value is a string, this provides a regular expression that a string instance MUST match in order to be valid. Regular expressions SHOULD follow the regular expression specification from ECMA 262/Perl 5 +
+ +
+ When the instance value is a string, this defines the minimum length of the string. +
+ +
+ When the instance value is a string, this defines the maximum length of the string. +
+ +
+ This provides an enumeration of all possible values that are valid for the instance property. This MUST be an array, and each item in the array represents a possible value for the instance value. If this attribute is defined, the instance value MUST be one of the values in the array in order for the schema to be valid. Comparison of enum values uses the same algorithm as defined in "uniqueItems". +
+ +
+ This attribute defines the default value of the instance when the instance is undefined. +
+ +
+ This attribute is a string that provides a short description of the instance property. +
+ +
+ This attribute is a string that provides a full description of the of purpose the instance property. +
+ +
+ This attribute defines what value the number instance must be divisible by with no remainder (the result of the division must be an integer.) The value of this attribute SHOULD NOT be 0. +
+ +
+ This attribute takes the same values as the "type" attribute, however if the instance matches the type or if this value is an array and the instance matches any type or schema in the array, then this instance is not valid. +
+ +
+ The value of this property MUST be another schema which will provide a base schema which the current schema will inherit from. The inheritance rules are such that any instance that is valid according to the current schema MUST be valid according to the referenced schema. This MAY also be an array, in which case, the instance MUST be valid for all the schemas in the array. A schema that extends another schema MAY define additional attributes, constrain existing attributes, or add other constraints. + + Conceptually, the behavior of extends can be seen as validating an + instance against all constraints in the extending schema as well as + the extended schema(s). More optimized implementations that merge + schemas are possible, but are not required. Some examples of using "extends": + +
+ + + +
+ +
+ + + +
+
+
+ +
+ + This attribute defines the current URI of this schema (this attribute is + effectively a "self" link). This URI MAY be relative or absolute. If + the URI is relative it is resolved against the current URI of the parent + schema it is contained in. If this schema is not contained in any + parent schema, the current URI of the parent schema is held to be the + URI under which this schema was addressed. If id is missing, the current URI of a schema is + defined to be that of the parent schema. The current URI of the schema + is also used to construct relative references such as for $ref. + +
+ +
+ + This attribute defines a URI of a schema that contains the full representation of this schema. + When a validator encounters this attribute, it SHOULD replace the current schema with the schema referenced by the value's URI (if known and available) and re-validate the instance. + This URI MAY be relative or absolute, and relative URIs SHOULD be resolved against the URI of the current schema. + +
+ +
+ + This attribute defines a URI of a JSON Schema that is the schema of the current schema. + When this attribute is defined, a validator SHOULD use the schema referenced by the value's URI (if known and available) when resolving Hyper Schemalinks. + + + + A validator MAY use this attribute's value to determine which version of JSON Schema the current schema is written in, and provide the appropriate validation features and behavior. + Therefore, it is RECOMMENDED that all schema authors include this attribute in their schemas to prevent conflicts with future JSON Schema specification changes. + +
+
+ +
+ + The following attributes are specified in addition to those + attributes that already provided by the core schema with the specific + purpose of informing user agents of relations between resources based + on JSON data. Just as with JSON + schema attributes, all the attributes in hyper schemas are optional. + Therefore, an empty object is a valid (non-informative) schema, and + essentially describes plain JSON (no constraints on the structures). + Addition of attributes provides additive information for user agents. + + +
+ + The value of the links property MUST be an array, where each item + in the array is a link description object which describes the link + relations of the instances. + + + + +
+ + A link description object is used to describe link relations. In + the context of a schema, it defines the link relations of the + instances of the schema, and can be parameterized by the instance + values. The link description format can be used without JSON Schema, + and use of this format can + be declared by referencing the normative link description + schema as the the schema for the data structure that uses the + links. The URI of the normative link description schema is: + http://json-schema.org/links (latest version) or + http://json-schema.org/draft-04/links (draft-04 version). + + +
+ + The value of the "href" link description property + indicates the target URI of the related resource. The value + of the instance property SHOULD be resolved as a URI-Reference per RFC 3986 + and MAY be a relative URI. The base URI to be used for relative resolution + SHOULD be the URI used to retrieve the instance object (not the schema) + when used within a schema. Also, when links are used within a schema, the URI + SHOULD be parametrized by the property values of the instance + object, if property values exist for the corresponding variables + in the template (otherwise they MAY be provided from alternate sources, like user input). + + + + Instance property values SHOULD be substituted into the URIs where + matching braces ('{', '}') are found surrounding zero or more characters, + creating an expanded URI. Instance property value substitutions are resolved + by using the text between the braces to denote the property name + from the instance to get the value to substitute. + +
+ For example, if an href value is defined: + + + + Then it would be resolved by replace the value of the "id" property value from the instance object. +
+ +
+ If the value of the "id" property was "45", the expanded URI would be: + + + +
+ + If matching braces are found with the string "@" (no quotes) between the braces, then the + actual instance value SHOULD be used to replace the braces, rather than a property value. + This should only be used in situations where the instance is a scalar (string, + boolean, or number), and not for objects or arrays. +
+
+ +
+ + The value of the "rel" property indicates the name of the + relation to the target resource. The relation to the target SHOULD be interpreted as specifically from the instance object that the schema (or sub-schema) applies to, not just the top level resource that contains the object within its hierarchy. If a resource JSON representation contains a sub object with a property interpreted as a link, that sub-object holds the relation with the target. A relation to target from the top level resource MUST be indicated with the schema describing the top level JSON representation. + + + + Relationship definitions SHOULD NOT be media type dependent, and users are encouraged to utilize existing accepted relation definitions, including those in existing relation registries (see RFC 4287). However, we define these relations here for clarity of normative interpretation within the context of JSON hyper schema defined relations: + + + + If the relation value is "self", when this property is encountered in + the instance object, the object represents a resource and the instance object is + treated as a full representation of the target resource identified by + the specified URI. + + + + This indicates that the target of the link is the full representation for the instance object. The object that contains this link possibly may not be the full representation. + + + + This indicates the target of the link is the schema for the instance object. This MAY be used to specifically denote the schemas of objects within a JSON object hierarchy, facilitating polymorphic type data structures. + + + + This relation indicates that the target of the link + SHOULD be treated as the root or the body of the representation for the + purposes of user agent interaction or fragment resolution. All other + properties of the instance objects can be regarded as meta-data + descriptions for the data. + + + + + + The following relations are applicable for schemas (the schema as the "from" resource in the relation): + + + This indicates the target resource that represents collection of instances of a schema. + This indicates a target to use for creating new instances of a schema. This link definition SHOULD be a submission link with a non-safe method (like POST). + + + + +
+ For example, if a schema is defined: + + + +
+ +
+ And if a collection of instance resource's JSON representation was retrieved: + + + +
+ + This would indicate that for the first item in the collection, its own + (self) URI would resolve to "/Resource/thing" and the first item's "up" + relation SHOULD be resolved to the resource at "/Resource/parent". + The "children" collection would be located at "/Resource/?upId=thing". +
+
+ +
+ This property value is a string that defines the templating language used in the "href" attribute. If no templating language is defined, then the default Link Description Object templating langauge is used. +
+ +
+ This property value is a schema that defines the expected structure of the JSON representation of the target of the link. +
+ +
+ + The following properties also apply to link definition objects, and + provide functionality analogous to HTML forms, in providing a + means for submitting extra (often user supplied) information to send to a server. + + +
+ + This attribute defines which method can be used to access the target resource. + In an HTTP environment, this would be "GET" or "POST" (other HTTP methods + such as "PUT" and "DELETE" have semantics that are clearly implied by + accessed resources, and do not need to be defined here). + This defaults to "GET". + +
+ +
+ + If present, this property indicates a query media type format that the server + supports for querying or posting to the collection of instances at the target + resource. The query can be + suffixed to the target URI to query the collection with + property-based constraints on the resources that SHOULD be returned from + the server or used to post data to the resource (depending on the method). + +
+ For example, with the following schema: + + + + This indicates that the client can query the server for instances that have a specific name. +
+ +
+ For example: + + + +
+ + If no enctype or method is specified, only the single URI specified by + the href property is defined. If the method is POST, "application/json" is + the default media type. +
+
+ +
+ + This attribute contains a schema which defines the acceptable structure of the submitted + request (for a GET request, this schema would define the properties for the query string + and for a POST request, this would define the body). + +
+
+
+
+ +
+ + This property indicates the fragment resolution protocol to use for + resolving fragment identifiers in URIs within the instance + representations. This applies to the instance object URIs and all + children of the instance object's URIs. The default fragment resolution + protocol is "json-pointer", which is defined below. Other fragment + resolution protocols MAY be used, but are not defined in this document. + + + + The fragment identifier is based on RFC 3986, Sec 5, and defines the + mechanism for resolving references to entities within a document. + + +
+ The "json-pointer" fragment resolution protocol uses a JSON Pointer to resolve fragment identifiers in URIs within instance representations. +
+
+ + + +
+ This attribute indicates that the instance value SHOULD NOT be changed. Attempts by a user agent to modify the value of this property are expected to be rejected by a server. +
+ +
+ If the instance property value is a string, this attribute defines that the string SHOULD be interpreted as binary data and decoded using the encoding named by this schema property. RFC 2045, Sec 6.1 lists the possible values for this property. +
+ +
+ + This attribute is a URI that defines what the instance's URI MUST start with in order to validate. + The value of the "pathStart" attribute MUST be resolved as per RFC 3986, Sec 5, + and is relative to the instance's URI. + + + + When multiple schemas have been referenced for an instance, the user agent + can determine if this schema is applicable for a particular instance by + determining if the URI of the instance begins with the the value of the "pathStart" + attribute. If the URI of the instance does not start with this URI, + or if another schema specifies a starting URI that is longer and also matches the + instance, this schema SHOULD NOT be applied to the instance. Any schema + that does not have a pathStart attribute SHOULD be considered applicable + to all the instances for which it is referenced. + +
+ +
+ This attribute defines the media type of the instance representations that this schema is defining. +
+
+ +
+ + This specification is a sub-type of the JSON format, and + consequently the security considerations are generally the same as RFC 4627. + However, an additional issue is that when link relation of "self" + is used to denote a full representation of an object, the user agent + SHOULD NOT consider the representation to be the authoritative representation + of the resource denoted by the target URI if the target URI is not + equivalent to or a sub-path of the the URI used to request the resource + representation which contains the target URI with the "self" link. + +
+ For example, if a hyper schema was defined: + + + +
+ +
+ And a resource was requested from somesite.com: + + + +
+ +
+ With a response of: + + + +
+
+
+ +
+ The proposed MIME media type for JSON Schema is "application/schema+json". + Type name: application + Subtype name: schema+json + Required parameters: profile + + The value of the profile parameter SHOULD be a URI (relative or absolute) that + refers to the schema used to define the structure of this structure (the + meta-schema). Normally the value would be http://json-schema.org/draft-04/hyper-schema, + but it is allowable to use other schemas that extend the hyper schema's meta- + schema. + + Optional parameters: pretty + The value of the pretty parameter MAY be true or false to indicate if additional whitespace has been included to make the JSON representation easier to read. + +
+ + This registry is maintained by IANA per RFC 4287 and this specification adds + four values: "full", "create", "instances", "root". New + assignments are subject to IESG Approval, as outlined in RFC 5226. + Requests should be made by email to IANA, which will then forward the + request to the IESG, requesting approval. + +
+
+
+ + + + + &rfc2045; + &rfc2119; + &rfc3339; + &rfc3986; + &rfc4287; + + + JSON Pointer + + ForgeRock US, Inc. + + + SitePen (USA) + + + + + + + &rfc2616; + &rfc4627; + &rfc5226; + &iddiscovery; + &uritemplate; + &linkheader; + &html401; + &css21; + + +
+ + + + + Changed "required" attribute to an array of strings. + Removed "format" attribute. + Added "minProperties" and "maxProperties" attributes. + Replaced "slash-delimited" fragment resolution with "json-pointer". + Added "template" LDO attribute. + Removed irrelevant "Open Issues" section. + Merged Conventions and Terminology sections. + Defined terms used in specification. + Removed "integer" type in favor of {"type":"number", "divisibleBy":1}. + Restricted "type" to only the core JSON types. + Improved wording of many sections. + + + + + + Added example and verbiage to "extends" attribute. + Defined slash-delimited to use a leading slash. + Made "root" a relation instead of an attribute. + Removed address values, and MIME media type from format to reduce confusion (mediaType already exists, so it can be used for MIME types). + Added more explanation of nullability. + Removed "alternate" attribute. + Upper cased many normative usages of must, may, and should. + Replaced the link submission "properties" attribute to "schema" attribute. + Replaced "optional" attribute with "required" attribute. + Replaced "maximumCanEqual" attribute with "exclusiveMaximum" attribute. + Replaced "minimumCanEqual" attribute with "exclusiveMinimum" attribute. + Replaced "requires" attribute with "dependencies" attribute. + Moved "contentEncoding" attribute to hyper schema. + Added "additionalItems" attribute. + Added "id" attribute. + Switched self-referencing variable substitution from "-this" to "@" to align with reserved characters in URI template. + Added "patternProperties" attribute. + Schema URIs are now namespace versioned. + Added "$ref" and "$schema" attributes. + + + + + + Replaced "maxDecimal" attribute with "divisibleBy" attribute. + Added slash-delimited fragment resolution protocol and made it the default. + Added language about using links outside of schemas by referencing its normative URI. + Added "uniqueItems" attribute. + Added "targetSchema" attribute to link description object. + + + + + + Fixed category and updates from template. + + + + + + Initial draft. + + + + +
+
+
diff --git a/appasar/canary/node_modules/json-schema/lib/links.js b/appasar/canary/node_modules/json-schema/lib/links.js new file mode 100644 index 0000000..8a87f02 --- /dev/null +++ b/appasar/canary/node_modules/json-schema/lib/links.js @@ -0,0 +1,66 @@ +/** + * JSON Schema link handler + * Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com) + * Licensed under the MIT (MIT-LICENSE.txt) license. + */ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([], function () { + return factory(); + }); + } else if (typeof module === 'object' && module.exports) { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(); + } else { + // Browser globals + root.jsonSchemaLinks = factory(); + } +}(this, function () {// setup primitive classes to be JSON Schema types +var exports = {}; +exports.cacheLinks = true; +exports.getLink = function(relation, instance, schema){ + // gets the URI of the link for the given relation based on the instance and schema + // for example: + // getLink( + // "brother", + // {"brother_id":33}, + // {links:[{rel:"brother", href:"Brother/{brother_id}"}]}) -> + // "Brother/33" + var links = schema.__linkTemplates; + if(!links){ + links = {}; + var schemaLinks = schema.links; + if(schemaLinks && schemaLinks instanceof Array){ + schemaLinks.forEach(function(link){ + /* // TODO: allow for multiple same-name relations + if(links[link.rel]){ + if(!(links[link.rel] instanceof Array)){ + links[link.rel] = [links[link.rel]]; + } + }*/ + links[link.rel] = link.href; + }); + } + if(exports.cacheLinks){ + schema.__linkTemplates = links; + } + } + var linkTemplate = links[relation]; + return linkTemplate && exports.substitute(linkTemplate, instance); +}; + +exports.substitute = function(linkTemplate, instance){ + return linkTemplate.replace(/\{([^\}]*)\}/g, function(t, property){ + var value = instance[decodeURIComponent(property)]; + if(value instanceof Array){ + // the value is an array, it should produce a URI like /Table/(4,5,8) and store.get() should handle that as an array of values + return '(' + value.join(',') + ')'; + } + return value; + }); +}; +return exports; +})); \ No newline at end of file diff --git a/appasar/canary/node_modules/json-schema/lib/validate.js b/appasar/canary/node_modules/json-schema/lib/validate.js new file mode 100644 index 0000000..e4dc151 --- /dev/null +++ b/appasar/canary/node_modules/json-schema/lib/validate.js @@ -0,0 +1,273 @@ +/** + * JSONSchema Validator - Validates JavaScript objects using JSON Schemas + * (http://www.json.com/json-schema-proposal/) + * + * Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com) + * Licensed under the MIT (MIT-LICENSE.txt) license. +To use the validator call the validate function with an instance object and an optional schema object. +If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating), +that schema will be used to validate and the schema parameter is not necessary (if both exist, +both validations will occur). +The validate method will return an array of validation errors. If there are no errors, then an +empty list will be returned. A validation error will have two properties: +"property" which indicates which property had the error +"message" which indicates what the error was + */ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define([], function () { + return factory(); + }); + } else if (typeof module === 'object' && module.exports) { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(); + } else { + // Browser globals + root.jsonSchema = factory(); + } +}(this, function () {// setup primitive classes to be JSON Schema types +var exports = validate +exports.Integer = {type:"integer"}; +var primitiveConstructors = { + String: String, + Boolean: Boolean, + Number: Number, + Object: Object, + Array: Array, + Date: Date +} +exports.validate = validate; +function validate(/*Any*/instance,/*Object*/schema) { + // Summary: + // To use the validator call JSONSchema.validate with an instance object and an optional schema object. + // If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating), + // that schema will be used to validate and the schema parameter is not necessary (if both exist, + // both validations will occur). + // The validate method will return an object with two properties: + // valid: A boolean indicating if the instance is valid by the schema + // errors: An array of validation errors. If there are no errors, then an + // empty list will be returned. A validation error will have two properties: + // property: which indicates which property had the error + // message: which indicates what the error was + // + return validate(instance, schema, {changing: false});//, coerce: false, existingOnly: false}); + }; +exports.checkPropertyChange = function(/*Any*/value,/*Object*/schema, /*String*/property) { + // Summary: + // The checkPropertyChange method will check to see if an value can legally be in property with the given schema + // This is slightly different than the validate method in that it will fail if the schema is readonly and it will + // not check for self-validation, it is assumed that the passed in value is already internally valid. + // The checkPropertyChange method will return the same object type as validate, see JSONSchema.validate for + // information. + // + return validate(value, schema, {changing: property || "property"}); + }; +var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*Object*/options) { + + if (!options) options = {}; + var _changing = options.changing; + + function getType(schema){ + return schema.type || (primitiveConstructors[schema.name] == schema && schema.name.toLowerCase()); + } + var errors = []; + // validate a value against a property definition + function checkProp(value, schema, path,i){ + + var l; + path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i; + function addError(message){ + errors.push({property:path,message:message}); + } + + if((typeof schema != 'object' || schema instanceof Array) && (path || typeof schema != 'function') && !(schema && getType(schema))){ + if(typeof schema == 'function'){ + if(!(value instanceof schema)){ + addError("is not an instance of the class/constructor " + schema.name); + } + }else if(schema){ + addError("Invalid schema/property definition " + schema); + } + return null; + } + if(_changing && schema.readonly){ + addError("is a readonly field, it can not be changed"); + } + if(schema['extends']){ // if it extends another schema, it must pass that schema as well + checkProp(value,schema['extends'],path,i); + } + // validate a value against a type definition + function checkType(type,value){ + if(type){ + if(typeof type == 'string' && type != 'any' && + (type == 'null' ? value !== null : typeof value != type) && + !(value instanceof Array && type == 'array') && + !(value instanceof Date && type == 'date') && + !(type == 'integer' && value%1===0)){ + return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}]; + } + if(type instanceof Array){ + var unionErrors=[]; + for(var j = 0; j < type.length; j++){ // a union type + if(!(unionErrors=checkType(type[j],value)).length){ + break; + } + } + if(unionErrors.length){ + return unionErrors; + } + }else if(typeof type == 'object'){ + var priorErrors = errors; + errors = []; + checkProp(value,type,path); + var theseErrors = errors; + errors = priorErrors; + return theseErrors; + } + } + return []; + } + if(value === undefined){ + if(schema.required){ + addError("is missing and it is required"); + } + }else{ + errors = errors.concat(checkType(getType(schema),value)); + if(schema.disallow && !checkType(schema.disallow,value).length){ + addError(" disallowed value was matched"); + } + if(value !== null){ + if(value instanceof Array){ + if(schema.items){ + var itemsIsArray = schema.items instanceof Array; + var propDef = schema.items; + for (i = 0, l = value.length; i < l; i += 1) { + if (itemsIsArray) + propDef = schema.items[i]; + if (options.coerce) + value[i] = options.coerce(value[i], propDef); + errors.concat(checkProp(value[i],propDef,path,i)); + } + } + if(schema.minItems && value.length < schema.minItems){ + addError("There must be a minimum of " + schema.minItems + " in the array"); + } + if(schema.maxItems && value.length > schema.maxItems){ + addError("There must be a maximum of " + schema.maxItems + " in the array"); + } + }else if(schema.properties || schema.additionalProperties){ + errors.concat(checkObj(value, schema.properties, path, schema.additionalProperties)); + } + if(schema.pattern && typeof value == 'string' && !value.match(schema.pattern)){ + addError("does not match the regex pattern " + schema.pattern); + } + if(schema.maxLength && typeof value == 'string' && value.length > schema.maxLength){ + addError("may only be " + schema.maxLength + " characters long"); + } + if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){ + addError("must be at least " + schema.minLength + " characters long"); + } + if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum && + schema.minimum > value){ + addError("must have a minimum value of " + schema.minimum); + } + if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum && + schema.maximum < value){ + addError("must have a maximum value of " + schema.maximum); + } + if(schema['enum']){ + var enumer = schema['enum']; + l = enumer.length; + var found; + for(var j = 0; j < l; j++){ + if(enumer[j]===value){ + found=1; + break; + } + } + if(!found){ + addError("does not have a value in the enumeration " + enumer.join(", ")); + } + } + if(typeof schema.maxDecimal == 'number' && + (value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){ + addError("may only have " + schema.maxDecimal + " digits of decimal places"); + } + } + } + return null; + } + // validate an object against a schema + function checkObj(instance,objTypeDef,path,additionalProp){ + + if(typeof objTypeDef =='object'){ + if(typeof instance != 'object' || instance instanceof Array){ + errors.push({property:path,message:"an object is required"}); + } + + for(var i in objTypeDef){ + if(objTypeDef.hasOwnProperty(i)){ + var value = instance[i]; + // skip _not_ specified properties + if (value === undefined && options.existingOnly) continue; + var propDef = objTypeDef[i]; + // set default + if(value === undefined && propDef["default"]){ + value = instance[i] = propDef["default"]; + } + if(options.coerce && i in instance){ + value = instance[i] = options.coerce(value, propDef); + } + checkProp(value,propDef,path,i); + } + } + } + for(i in instance){ + if(instance.hasOwnProperty(i) && !(i.charAt(0) == '_' && i.charAt(1) == '_') && objTypeDef && !objTypeDef[i] && additionalProp===false){ + if (options.filter) { + delete instance[i]; + continue; + } else { + errors.push({property:path,message:(typeof value) + "The property " + i + + " is not defined in the schema and the schema does not allow additional properties"}); + } + } + var requires = objTypeDef && objTypeDef[i] && objTypeDef[i].requires; + if(requires && !(requires in instance)){ + errors.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"}); + } + value = instance[i]; + if(additionalProp && (!(objTypeDef && typeof objTypeDef == 'object') || !(i in objTypeDef))){ + if(options.coerce){ + value = instance[i] = options.coerce(value, additionalProp); + } + checkProp(value,additionalProp,path,i); + } + if(!_changing && value && value.$schema){ + errors = errors.concat(checkProp(value,value.$schema,path,i)); + } + } + return errors; + } + if(schema){ + checkProp(instance,schema,'',_changing || ''); + } + if(!_changing && instance && instance.$schema){ + checkProp(instance,instance.$schema,'',''); + } + return {valid:!errors.length,errors:errors}; +}; +exports.mustBeValid = function(result){ + // summary: + // This checks to ensure that the result is valid and will throw an appropriate error message if it is not + // result: the result returned from checkPropertyChange or validate + if(!result.valid){ + throw new TypeError(result.errors.map(function(error){return "for property " + error.property + ': ' + error.message;}).join(", \n")); + } +} + +return exports; +})); diff --git a/appasar/canary/node_modules/json-schema/package.json b/appasar/canary/node_modules/json-schema/package.json new file mode 100644 index 0000000..b9b7bac --- /dev/null +++ b/appasar/canary/node_modules/json-schema/package.json @@ -0,0 +1,31 @@ +{ + "name": "json-schema", + "version": "0.2.3", + "author": "Kris Zyp", + "description": "JSON Schema validation and specifications", + "maintainers":[ + {"name": "Kris Zyp", "email": "kriszyp@gmail.com"}], + "keywords": [ + "json", + "schema" + ], + "licenses": [ + { + "type": "AFLv2.1", + "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L43" + }, + { + "type": "BSD", + "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L13" + } + ], + "repository": { + "type":"git", + "url":"http://github.com/kriszyp/json-schema" + }, + "directories": { "lib": "./lib" }, + "main": "./lib/validate.js", + "devDependencies": { "vows": "*" }, + "scripts": { "test": "echo TESTS DISABLED vows --spec test/*.js" } +} + diff --git a/appasar/canary/node_modules/json-schema/test/tests.js b/appasar/canary/node_modules/json-schema/test/tests.js new file mode 100644 index 0000000..2938aea --- /dev/null +++ b/appasar/canary/node_modules/json-schema/test/tests.js @@ -0,0 +1,95 @@ +var assert = require('assert'); +var vows = require('vows'); +var path = require('path'); +var fs = require('fs'); + +var validate = require('../lib/validate').validate; + + +var revision = 'draft-03'; +var schemaRoot = path.join(__dirname, '..', revision); +var schemaNames = ['schema', 'hyper-schema', 'links', 'json-ref' ]; +var schemas = {}; + +schemaNames.forEach(function(name) { + var file = path.join(schemaRoot, name); + schemas[name] = loadSchema(file); +}); + +schemaNames.forEach(function(name) { + var s, n = name+'-nsd', f = path.join(schemaRoot, name); + schemas[n] = loadSchema(f); + s = schemas[n]; + delete s['$schema']; +}); + +function loadSchema(path) { + var data = fs.readFileSync(path, 'utf-8'); + var schema = JSON.parse(data); + return schema; +} + +function resultIsValid() { + return function(result) { + assert.isObject(result); + //assert.isBoolean(result.valid); + assert.equal(typeof(result.valid), 'boolean'); + assert.isArray(result.errors); + for (var i = 0; i < result.errors.length; i++) { + assert.notEqual(result.errors[i], null, 'errors['+i+'] is null'); + } + } +} + +function assertValidates(doc, schema) { + var context = {}; + + context[': validate('+doc+', '+schema+')'] = { + topic: validate(schemas[doc], schemas[schema]), + 'returns valid result': resultIsValid(), + 'with valid=true': function(result) { assert.equal(result.valid, true); }, + 'and no errors': function(result) { + // XXX work-around for bug in vows: [null] chokes it + if (result.errors[0] == null) assert.fail('(errors contains null)'); + assert.length(result.errors, 0); + } + }; + + return context; +} + +function assertSelfValidates(doc) { + var context = {}; + + context[': validate('+doc+')'] = { + topic: validate(schemas[doc]), + 'returns valid result': resultIsValid(), + 'with valid=true': function(result) { assert.equal(result.valid, true); }, + 'and no errors': function(result) { assert.length(result.errors, 0); } + }; + + return context; +} + +var suite = vows.describe('JSON Schema').addBatch({ + 'Core-NSD self-validates': assertSelfValidates('schema-nsd'), + 'Core-NSD/Core-NSD': assertValidates('schema-nsd', 'schema-nsd'), + 'Core-NSD/Core': assertValidates('schema-nsd', 'schema'), + + 'Core self-validates': assertSelfValidates('schema'), + 'Core/Core': assertValidates('schema', 'schema'), + + 'Hyper-NSD self-validates': assertSelfValidates('hyper-schema-nsd'), + 'Hyper self-validates': assertSelfValidates('hyper-schema'), + 'Hyper/Hyper': assertValidates('hyper-schema', 'hyper-schema'), + 'Hyper/Core': assertValidates('hyper-schema', 'schema'), + + 'Links-NSD self-validates': assertSelfValidates('links-nsd'), + 'Links self-validates': assertSelfValidates('links'), + 'Links/Hyper': assertValidates('links', 'hyper-schema'), + 'Links/Core': assertValidates('links', 'schema'), + + 'Json-Ref self-validates': assertSelfValidates('json-ref'), + 'Json-Ref/Hyper': assertValidates('json-ref', 'hyper-schema'), + 'Json-Ref/Core': assertValidates('json-ref', 'schema') +}).export(module); diff --git a/appasar/canary/node_modules/json-stringify-safe/.npmignore b/appasar/canary/node_modules/json-stringify-safe/.npmignore new file mode 100644 index 0000000..17d6b36 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/.npmignore @@ -0,0 +1 @@ +/*.tgz diff --git a/appasar/canary/node_modules/json-stringify-safe/CHANGELOG.md b/appasar/canary/node_modules/json-stringify-safe/CHANGELOG.md new file mode 100644 index 0000000..42bcb60 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/CHANGELOG.md @@ -0,0 +1,14 @@ +## Unreleased +- Fixes stringify to only take ancestors into account when checking + circularity. + It previously assumed every visited object was circular which led to [false + positives][issue9]. + Uses the tiny serializer I wrote for [Must.js][must] a year and a half ago. +- Fixes calling the `replacer` function in the proper context (`thisArg`). +- Fixes calling the `cycleReplacer` function in the proper context (`thisArg`). +- Speeds serializing by a factor of + Big-O(h-my-god-it-linearly-searched-every-object) it had ever seen. Searching + only the ancestors for a circular references speeds up things considerably. + +[must]: https://github.com/moll/js-must +[issue9]: https://github.com/isaacs/json-stringify-safe/issues/9 diff --git a/appasar/canary/node_modules/json-stringify-safe/LICENSE b/appasar/canary/node_modules/json-stringify-safe/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/json-stringify-safe/Makefile b/appasar/canary/node_modules/json-stringify-safe/Makefile new file mode 100644 index 0000000..36088c7 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/Makefile @@ -0,0 +1,35 @@ +NODE_OPTS = +TEST_OPTS = + +love: + @echo "Feel like makin' love." + +test: + @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot $(TEST_OPTS) + +spec: + @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec $(TEST_OPTS) + +autotest: + @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot --watch $(TEST_OPTS) + +autospec: + @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec --watch $(TEST_OPTS) + +pack: + @file=$$(npm pack); echo "$$file"; tar tf "$$file" + +publish: + npm publish + +tag: + git tag "v$$(node -e 'console.log(require("./package").version)')" + +clean: + rm -f *.tgz + npm prune --production + +.PHONY: love +.PHONY: test spec autotest autospec +.PHONY: pack publish tag +.PHONY: clean diff --git a/appasar/canary/node_modules/json-stringify-safe/README.md b/appasar/canary/node_modules/json-stringify-safe/README.md new file mode 100644 index 0000000..a11f302 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/README.md @@ -0,0 +1,52 @@ +# json-stringify-safe + +Like JSON.stringify, but doesn't throw on circular references. + +## Usage + +Takes the same arguments as `JSON.stringify`. + +```javascript +var stringify = require('json-stringify-safe'); +var circularObj = {}; +circularObj.circularRef = circularObj; +circularObj.list = [ circularObj, circularObj ]; +console.log(stringify(circularObj, null, 2)); +``` + +Output: + +```json +{ + "circularRef": "[Circular]", + "list": [ + "[Circular]", + "[Circular]" + ] +} +``` + +## Details + +``` +stringify(obj, serializer, indent, decycler) +``` + +The first three arguments are the same as to JSON.stringify. The last +is an argument that's only used when the object has been seen already. + +The default `decycler` function returns the string `'[Circular]'`. +If, for example, you pass in `function(k,v){}` (return nothing) then it +will prune cycles. If you pass in `function(k,v){ return {foo: 'bar'}}`, +then cyclical objects will always be represented as `{"foo":"bar"}` in +the result. + +``` +stringify.getSerialize(serializer, decycler) +``` + +Returns a serializer that can be used elsewhere. This is the actual +function that's passed to JSON.stringify. + +**Note** that the function returned from `getSerialize` is stateful for now, so +do **not** use it more than once. diff --git a/appasar/canary/node_modules/json-stringify-safe/package.json b/appasar/canary/node_modules/json-stringify-safe/package.json new file mode 100644 index 0000000..8e17b12 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/package.json @@ -0,0 +1,31 @@ +{ + "name": "json-stringify-safe", + "version": "5.0.1", + "description": "Like JSON.stringify, but doesn't blow up on circular refs.", + "keywords": [ + "json", + "stringify", + "circular", + "safe" + ], + "homepage": "https://github.com/isaacs/json-stringify-safe", + "bugs": "https://github.com/isaacs/json-stringify-safe/issues", + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "contributors": [ + "Andri Möll (http://themoll.com)" + ], + "license": "ISC", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/json-stringify-safe" + }, + "main": "stringify.js", + "scripts": { + "test": "node test.js" + }, + "devDependencies": { + "mocha": ">= 2.1.0 < 3", + "must": ">= 0.12 < 0.13", + "sinon": ">= 1.12.2 < 2" + } +} diff --git a/appasar/canary/node_modules/json-stringify-safe/stringify.js b/appasar/canary/node_modules/json-stringify-safe/stringify.js new file mode 100644 index 0000000..124a452 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/stringify.js @@ -0,0 +1,27 @@ +exports = module.exports = stringify +exports.getSerialize = serializer + +function stringify(obj, replacer, spaces, cycleReplacer) { + return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces) +} + +function serializer(replacer, cycleReplacer) { + var stack = [], keys = [] + + if (cycleReplacer == null) cycleReplacer = function(key, value) { + if (stack[0] === value) return "[Circular ~]" + return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]" + } + + return function(key, value) { + if (stack.length > 0) { + var thisPos = stack.indexOf(this) + ~thisPos ? stack.splice(thisPos + 1) : stack.push(this) + ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key) + if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value) + } + else stack.push(value) + + return replacer == null ? value : replacer.call(this, key, value) + } +} diff --git a/appasar/canary/node_modules/json-stringify-safe/test/mocha.opts b/appasar/canary/node_modules/json-stringify-safe/test/mocha.opts new file mode 100644 index 0000000..2544e58 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/test/mocha.opts @@ -0,0 +1,2 @@ +--recursive +--require must diff --git a/appasar/canary/node_modules/json-stringify-safe/test/stringify_test.js b/appasar/canary/node_modules/json-stringify-safe/test/stringify_test.js new file mode 100644 index 0000000..5b32583 --- /dev/null +++ b/appasar/canary/node_modules/json-stringify-safe/test/stringify_test.js @@ -0,0 +1,246 @@ +var Sinon = require("sinon") +var stringify = require("..") +function jsonify(obj) { return JSON.stringify(obj, null, 2) } + +describe("Stringify", function() { + it("must stringify circular objects", function() { + var obj = {name: "Alice"} + obj.self = obj + var json = stringify(obj, null, 2) + json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) + }) + + it("must stringify circular objects with intermediaries", function() { + var obj = {name: "Alice"} + obj.identity = {self: obj} + var json = stringify(obj, null, 2) + json.must.eql(jsonify({name: "Alice", identity: {self: "[Circular ~]"}})) + }) + + it("must stringify circular objects deeper", function() { + var obj = {name: "Alice", child: {name: "Bob"}} + obj.child.self = obj.child + + stringify(obj, null, 2).must.eql(jsonify({ + name: "Alice", + child: {name: "Bob", self: "[Circular ~.child]"} + })) + }) + + it("must stringify circular objects deeper with intermediaries", function() { + var obj = {name: "Alice", child: {name: "Bob"}} + obj.child.identity = {self: obj.child} + + stringify(obj, null, 2).must.eql(jsonify({ + name: "Alice", + child: {name: "Bob", identity: {self: "[Circular ~.child]"}} + })) + }) + + it("must stringify circular objects in an array", function() { + var obj = {name: "Alice"} + obj.self = [obj, obj] + + stringify(obj, null, 2).must.eql(jsonify({ + name: "Alice", self: ["[Circular ~]", "[Circular ~]"] + })) + }) + + it("must stringify circular objects deeper in an array", function() { + var obj = {name: "Alice", children: [{name: "Bob"}, {name: "Eve"}]} + obj.children[0].self = obj.children[0] + obj.children[1].self = obj.children[1] + + stringify(obj, null, 2).must.eql(jsonify({ + name: "Alice", + children: [ + {name: "Bob", self: "[Circular ~.children.0]"}, + {name: "Eve", self: "[Circular ~.children.1]"} + ] + })) + }) + + it("must stringify circular arrays", function() { + var obj = [] + obj.push(obj) + obj.push(obj) + var json = stringify(obj, null, 2) + json.must.eql(jsonify(["[Circular ~]", "[Circular ~]"])) + }) + + it("must stringify circular arrays with intermediaries", function() { + var obj = [] + obj.push({name: "Alice", self: obj}) + obj.push({name: "Bob", self: obj}) + + stringify(obj, null, 2).must.eql(jsonify([ + {name: "Alice", self: "[Circular ~]"}, + {name: "Bob", self: "[Circular ~]"} + ])) + }) + + it("must stringify repeated objects in objects", function() { + var obj = {} + var alice = {name: "Alice"} + obj.alice1 = alice + obj.alice2 = alice + + stringify(obj, null, 2).must.eql(jsonify({ + alice1: {name: "Alice"}, + alice2: {name: "Alice"} + })) + }) + + it("must stringify repeated objects in arrays", function() { + var alice = {name: "Alice"} + var obj = [alice, alice] + var json = stringify(obj, null, 2) + json.must.eql(jsonify([{name: "Alice"}, {name: "Alice"}])) + }) + + it("must call given decycler and use its output", function() { + var obj = {} + obj.a = obj + obj.b = obj + + var decycle = Sinon.spy(function() { return decycle.callCount }) + var json = stringify(obj, null, 2, decycle) + json.must.eql(jsonify({a: 1, b: 2}, null, 2)) + + decycle.callCount.must.equal(2) + decycle.thisValues[0].must.equal(obj) + decycle.args[0][0].must.equal("a") + decycle.args[0][1].must.equal(obj) + decycle.thisValues[1].must.equal(obj) + decycle.args[1][0].must.equal("b") + decycle.args[1][1].must.equal(obj) + }) + + it("must call replacer and use its output", function() { + var obj = {name: "Alice", child: {name: "Bob"}} + + var replacer = Sinon.spy(bangString) + var json = stringify(obj, replacer, 2) + json.must.eql(jsonify({name: "Alice!", child: {name: "Bob!"}})) + + replacer.callCount.must.equal(4) + replacer.args[0][0].must.equal("") + replacer.args[0][1].must.equal(obj) + replacer.thisValues[1].must.equal(obj) + replacer.args[1][0].must.equal("name") + replacer.args[1][1].must.equal("Alice") + replacer.thisValues[2].must.equal(obj) + replacer.args[2][0].must.equal("child") + replacer.args[2][1].must.equal(obj.child) + replacer.thisValues[3].must.equal(obj.child) + replacer.args[3][0].must.equal("name") + replacer.args[3][1].must.equal("Bob") + }) + + it("must call replacer after describing circular references", function() { + var obj = {name: "Alice"} + obj.self = obj + + var replacer = Sinon.spy(bangString) + var json = stringify(obj, replacer, 2) + json.must.eql(jsonify({name: "Alice!", self: "[Circular ~]!"})) + + replacer.callCount.must.equal(3) + replacer.args[0][0].must.equal("") + replacer.args[0][1].must.equal(obj) + replacer.thisValues[1].must.equal(obj) + replacer.args[1][0].must.equal("name") + replacer.args[1][1].must.equal("Alice") + replacer.thisValues[2].must.equal(obj) + replacer.args[2][0].must.equal("self") + replacer.args[2][1].must.equal("[Circular ~]") + }) + + it("must call given decycler and use its output for nested objects", + function() { + var obj = {} + obj.a = obj + obj.b = {self: obj} + + var decycle = Sinon.spy(function() { return decycle.callCount }) + var json = stringify(obj, null, 2, decycle) + json.must.eql(jsonify({a: 1, b: {self: 2}})) + + decycle.callCount.must.equal(2) + decycle.args[0][0].must.equal("a") + decycle.args[0][1].must.equal(obj) + decycle.args[1][0].must.equal("self") + decycle.args[1][1].must.equal(obj) + }) + + it("must use decycler's output when it returned null", function() { + var obj = {a: "b"} + obj.self = obj + obj.selves = [obj, obj] + + function decycle() { return null } + stringify(obj, null, 2, decycle).must.eql(jsonify({ + a: "b", + self: null, + selves: [null, null] + })) + }) + + it("must use decycler's output when it returned undefined", function() { + var obj = {a: "b"} + obj.self = obj + obj.selves = [obj, obj] + + function decycle() {} + stringify(obj, null, 2, decycle).must.eql(jsonify({ + a: "b", + selves: [null, null] + })) + }) + + it("must throw given a decycler that returns a cycle", function() { + var obj = {} + obj.self = obj + var err + function identity(key, value) { return value } + try { stringify(obj, null, 2, identity) } catch (ex) { err = ex } + err.must.be.an.instanceof(TypeError) + }) + + describe(".getSerialize", function() { + it("must stringify circular objects", function() { + var obj = {a: "b"} + obj.circularRef = obj + obj.list = [obj, obj] + + var json = JSON.stringify(obj, stringify.getSerialize(), 2) + json.must.eql(jsonify({ + "a": "b", + "circularRef": "[Circular ~]", + "list": ["[Circular ~]", "[Circular ~]"] + })) + }) + + // This is the behavior as of Mar 3, 2015. + // The serializer function keeps state inside the returned function and + // so far I'm not sure how to not do that. JSON.stringify's replacer is not + // called _after_ serialization. + xit("must return a function that could be called twice", function() { + var obj = {name: "Alice"} + obj.self = obj + + var json + var serializer = stringify.getSerialize() + + json = JSON.stringify(obj, serializer, 2) + json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) + + json = JSON.stringify(obj, serializer, 2) + json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) + }) + }) +}) + +function bangString(key, value) { + return typeof value == "string" ? value + "!" : value +} diff --git a/appasar/canary/node_modules/jsprim/CHANGES.md b/appasar/canary/node_modules/jsprim/CHANGES.md new file mode 100644 index 0000000..c52d39d --- /dev/null +++ b/appasar/canary/node_modules/jsprim/CHANGES.md @@ -0,0 +1,49 @@ +# Changelog + +## not yet released + +None yet. + +## v1.4.1 (2017-08-02) + +* #21 Update verror dep +* #22 Update extsprintf dependency +* #23 update contribution guidelines + +## v1.4.0 (2017-03-13) + +* #7 Add parseInteger() function for safer number parsing + +## v1.3.1 (2016-09-12) + +* #13 Incompatible with webpack + +## v1.3.0 (2016-06-22) + +* #14 add safer version of hasOwnProperty() +* #15 forEachKey() should ignore inherited properties + +## v1.2.2 (2015-10-15) + +* #11 NPM package shouldn't include any code that does `require('JSV')` +* #12 jsl.node.conf missing definition for "module" + +## v1.2.1 (2015-10-14) + +* #8 odd date parsing behaviour + +## v1.2.0 (2015-10-13) + +* #9 want function for returning RFC1123 dates + +## v1.1.0 (2015-09-02) + +* #6 a new suite of hrtime manipulation routines: `hrtimeAdd()`, + `hrtimeAccum()`, `hrtimeNanosec()`, `hrtimeMicrosec()` and + `hrtimeMillisec()`. + +## v1.0.0 (2015-09-01) + +First tracked release. Includes everything in previous releases, plus: + +* #4 want function for merging objects diff --git a/appasar/canary/node_modules/jsprim/CONTRIBUTING.md b/appasar/canary/node_modules/jsprim/CONTRIBUTING.md new file mode 100644 index 0000000..750cef8 --- /dev/null +++ b/appasar/canary/node_modules/jsprim/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing + +This repository uses [cr.joyent.us](https://cr.joyent.us) (Gerrit) for new +changes. Anyone can submit changes. To get started, see the [cr.joyent.us user +guide](https://github.com/joyent/joyent-gerrit/blob/master/docs/user/README.md). +This repo does not use GitHub pull requests. + +See the [Joyent Engineering +Guidelines](https://github.com/joyent/eng/blob/master/docs/index.md) for general +best practices expected in this repository. + +Contributions should be "make prepush" clean. The "prepush" target runs the +"check" target, which requires these separate tools: + +* https://github.com/davepacheco/jsstyle +* https://github.com/davepacheco/javascriptlint + +If you're changing something non-trivial or user-facing, you may want to submit +an issue first. diff --git a/appasar/canary/node_modules/jsprim/LICENSE b/appasar/canary/node_modules/jsprim/LICENSE new file mode 100644 index 0000000..cbc0bb3 --- /dev/null +++ b/appasar/canary/node_modules/jsprim/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012, Joyent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE diff --git a/appasar/canary/node_modules/jsprim/README.md b/appasar/canary/node_modules/jsprim/README.md new file mode 100644 index 0000000..b3f28a4 --- /dev/null +++ b/appasar/canary/node_modules/jsprim/README.md @@ -0,0 +1,287 @@ +# jsprim: utilities for primitive JavaScript types + +This module provides miscellaneous facilities for working with strings, +numbers, dates, and objects and arrays of these basic types. + + +### deepCopy(obj) + +Creates a deep copy of a primitive type, object, or array of primitive types. + + +### deepEqual(obj1, obj2) + +Returns whether two objects are equal. + + +### isEmpty(obj) + +Returns true if the given object has no properties and false otherwise. This +is O(1) (unlike `Object.keys(obj).length === 0`, which is O(N)). + +### hasKey(obj, key) + +Returns true if the given object has an enumerable, non-inherited property +called `key`. [For information on enumerability and ownership of properties, see +the MDN +documentation.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties) + +### forEachKey(obj, callback) + +Like Array.forEach, but iterates enumerable, owned properties of an object +rather than elements of an array. Equivalent to: + + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + callback(key, obj[key]); + } + } + + +### flattenObject(obj, depth) + +Flattens an object up to a given level of nesting, returning an array of arrays +of length "depth + 1", where the first "depth" elements correspond to flattened +columns and the last element contains the remaining object . For example: + + flattenObject({ + 'I': { + 'A': { + 'i': { + 'datum1': [ 1, 2 ], + 'datum2': [ 3, 4 ] + }, + 'ii': { + 'datum1': [ 3, 4 ] + } + }, + 'B': { + 'i': { + 'datum1': [ 5, 6 ] + }, + 'ii': { + 'datum1': [ 7, 8 ], + 'datum2': [ 3, 4 ], + }, + 'iii': { + } + } + }, + 'II': { + 'A': { + 'i': { + 'datum1': [ 1, 2 ], + 'datum2': [ 3, 4 ] + } + } + } + }, 3) + +becomes: + + [ + [ 'I', 'A', 'i', { 'datum1': [ 1, 2 ], 'datum2': [ 3, 4 ] } ], + [ 'I', 'A', 'ii', { 'datum1': [ 3, 4 ] } ], + [ 'I', 'B', 'i', { 'datum1': [ 5, 6 ] } ], + [ 'I', 'B', 'ii', { 'datum1': [ 7, 8 ], 'datum2': [ 3, 4 ] } ], + [ 'I', 'B', 'iii', {} ], + [ 'II', 'A', 'i', { 'datum1': [ 1, 2 ], 'datum2': [ 3, 4 ] } ] + ] + +This function is strict: "depth" must be a non-negative integer and "obj" must +be a non-null object with at least "depth" levels of nesting under all keys. + + +### flattenIter(obj, depth, func) + +This is similar to `flattenObject` except that instead of returning an array, +this function invokes `func(entry)` for each `entry` in the array that +`flattenObject` would return. `flattenIter(obj, depth, func)` is logically +equivalent to `flattenObject(obj, depth).forEach(func)`. Importantly, this +version never constructs the full array. Its memory usage is O(depth) rather +than O(n) (where `n` is the number of flattened elements). + +There's another difference between `flattenObject` and `flattenIter` that's +related to the special case where `depth === 0`. In this case, `flattenObject` +omits the array wrapping `obj` (which is regrettable). + + +### pluck(obj, key) + +Fetch nested property "key" from object "obj", traversing objects as needed. +For example, `pluck(obj, "foo.bar.baz")` is roughly equivalent to +`obj.foo.bar.baz`, except that: + +1. If traversal fails, the resulting value is undefined, and no error is + thrown. For example, `pluck({}, "foo.bar")` is just undefined. +2. If "obj" has property "key" directly (without traversing), the + corresponding property is returned. For example, + `pluck({ 'foo.bar': 1 }, 'foo.bar')` is 1, not undefined. This is also + true recursively, so `pluck({ 'a': { 'foo.bar': 1 } }, 'a.foo.bar')` is + also 1, not undefined. + + +### randElt(array) + +Returns an element from "array" selected uniformly at random. If "array" is +empty, throws an Error. + + +### startsWith(str, prefix) + +Returns true if the given string starts with the given prefix and false +otherwise. + + +### endsWith(str, suffix) + +Returns true if the given string ends with the given suffix and false +otherwise. + + +### parseInteger(str, options) + +Parses the contents of `str` (a string) as an integer. On success, the integer +value is returned (as a number). On failure, an error is **returned** describing +why parsing failed. + +By default, leading and trailing whitespace characters are not allowed, nor are +trailing characters that are not part of the numeric representation. This +behaviour can be toggled by using the options below. The empty string (`''`) is +not considered valid input. If the return value cannot be precisely represented +as a number (i.e., is smaller than `Number.MIN_SAFE_INTEGER` or larger than +`Number.MAX_SAFE_INTEGER`), an error is returned. Additionally, the string +`'-0'` will be parsed as the integer `0`, instead of as the IEEE floating point +value `-0`. + +This function accepts both upper and lowercase characters for digits, similar to +`parseInt()`, `Number()`, and [strtol(3C)](https://illumos.org/man/3C/strtol). + +The following may be specified in `options`: + +Option | Type | Default | Meaning +------------------ | ------- | ------- | --------------------------- +base | number | 10 | numeric base (radix) to use, in the range 2 to 36 +allowSign | boolean | true | whether to interpret any leading `+` (positive) and `-` (negative) characters +allowImprecise | boolean | false | whether to accept values that may have lost precision (past `MAX_SAFE_INTEGER` or below `MIN_SAFE_INTEGER`) +allowPrefix | boolean | false | whether to interpret the prefixes `0b` (base 2), `0o` (base 8), `0t` (base 10), or `0x` (base 16) +allowTrailing | boolean | false | whether to ignore trailing characters +trimWhitespace | boolean | false | whether to trim any leading or trailing whitespace/line terminators +leadingZeroIsOctal | boolean | false | whether a leading zero indicates octal + +Note that if `base` is unspecified, and `allowPrefix` or `leadingZeroIsOctal` +are, then the leading characters can change the default base from 10. If `base` +is explicitly specified and `allowPrefix` is true, then the prefix will only be +accepted if it matches the specified base. `base` and `leadingZeroIsOctal` +cannot be used together. + +**Context:** It's tricky to parse integers with JavaScript's built-in facilities +for several reasons: + +- `parseInt()` and `Number()` by default allow the base to be specified in the + input string by a prefix (e.g., `0x` for hex). +- `parseInt()` allows trailing nonnumeric characters. +- `Number(str)` returns 0 when `str` is the empty string (`''`). +- Both functions return incorrect values when the input string represents a + valid integer outside the range of integers that can be represented precisely. + Specifically, `parseInt('9007199254740993')` returns 9007199254740992. +- Both functions always accept `-` and `+` signs before the digit. +- Some older JavaScript engines always interpret a leading 0 as indicating + octal, which can be surprising when parsing input from users who expect a + leading zero to be insignificant. + +While each of these may be desirable in some contexts, there are also times when +none of them are wanted. `parseInteger()` grants greater control over what +input's permissible. + +### iso8601(date) + +Converts a Date object to an ISO8601 date string of the form +"YYYY-MM-DDTHH:MM:SS.sssZ". This format is not customizable. + + +### parseDateTime(str) + +Parses a date expressed as a string, as either a number of milliseconds since +the epoch or any string format that Date accepts, giving preference to the +former where these two sets overlap (e.g., strings containing small numbers). + + +### hrtimeDiff(timeA, timeB) + +Given two hrtime readings (as from Node's `process.hrtime()`), where timeA is +later than timeB, compute the difference and return that as an hrtime. It is +illegal to invoke this for a pair of times where timeB is newer than timeA. + +### hrtimeAdd(timeA, timeB) + +Add two hrtime intervals (as from Node's `process.hrtime()`), returning a new +hrtime interval array. This function does not modify either input argument. + + +### hrtimeAccum(timeA, timeB) + +Add two hrtime intervals (as from Node's `process.hrtime()`), storing the +result in `timeA`. This function overwrites (and returns) the first argument +passed in. + + +### hrtimeNanosec(timeA), hrtimeMicrosec(timeA), hrtimeMillisec(timeA) + +This suite of functions converts a hrtime interval (as from Node's +`process.hrtime()`) into a scalar number of nanoseconds, microseconds or +milliseconds. Results are truncated, as with `Math.floor()`. + + +### validateJsonObject(schema, object) + +Uses JSON validation (via JSV) to validate the given object against the given +schema. On success, returns null. On failure, *returns* (does not throw) a +useful Error object. + + +### extraProperties(object, allowed) + +Check an object for unexpected properties. Accepts the object to check, and an +array of allowed property name strings. If extra properties are detected, an +array of extra property names is returned. If no properties other than those +in the allowed list are present on the object, the returned array will be of +zero length. + +### mergeObjects(provided, overrides, defaults) + +Merge properties from objects "provided", "overrides", and "defaults". The +intended use case is for functions that accept named arguments in an "args" +object, but want to provide some default values and override other values. In +that case, "provided" is what the caller specified, "overrides" are what the +function wants to override, and "defaults" contains default values. + +The function starts with the values in "defaults", overrides them with the +values in "provided", and then overrides those with the values in "overrides". +For convenience, any of these objects may be falsey, in which case they will be +ignored. The input objects are never modified, but properties in the returned +object are not deep-copied. + +For example: + + mergeObjects(undefined, { 'objectMode': true }, { 'highWaterMark': 0 }) + +returns: + + { 'objectMode': true, 'highWaterMark': 0 } + +For another example: + + mergeObjects( + { 'highWaterMark': 16, 'objectMode': 7 }, /* from caller */ + { 'objectMode': true }, /* overrides */ + { 'highWaterMark': 0 }); /* default */ + +returns: + + { 'objectMode': true, 'highWaterMark': 16 } + + +# Contributing + +See separate [contribution guidelines](CONTRIBUTING.md). diff --git a/appasar/canary/node_modules/jsprim/lib/jsprim.js b/appasar/canary/node_modules/jsprim/lib/jsprim.js new file mode 100644 index 0000000..f7d0d81 --- /dev/null +++ b/appasar/canary/node_modules/jsprim/lib/jsprim.js @@ -0,0 +1,735 @@ +/* + * lib/jsprim.js: utilities for primitive JavaScript types + */ + +var mod_assert = require('assert-plus'); +var mod_util = require('util'); + +var mod_extsprintf = require('extsprintf'); +var mod_verror = require('verror'); +var mod_jsonschema = require('json-schema'); + +/* + * Public interface + */ +exports.deepCopy = deepCopy; +exports.deepEqual = deepEqual; +exports.isEmpty = isEmpty; +exports.hasKey = hasKey; +exports.forEachKey = forEachKey; +exports.pluck = pluck; +exports.flattenObject = flattenObject; +exports.flattenIter = flattenIter; +exports.validateJsonObject = validateJsonObjectJS; +exports.validateJsonObjectJS = validateJsonObjectJS; +exports.randElt = randElt; +exports.extraProperties = extraProperties; +exports.mergeObjects = mergeObjects; + +exports.startsWith = startsWith; +exports.endsWith = endsWith; + +exports.parseInteger = parseInteger; + +exports.iso8601 = iso8601; +exports.rfc1123 = rfc1123; +exports.parseDateTime = parseDateTime; + +exports.hrtimediff = hrtimeDiff; +exports.hrtimeDiff = hrtimeDiff; +exports.hrtimeAccum = hrtimeAccum; +exports.hrtimeAdd = hrtimeAdd; +exports.hrtimeNanosec = hrtimeNanosec; +exports.hrtimeMicrosec = hrtimeMicrosec; +exports.hrtimeMillisec = hrtimeMillisec; + + +/* + * Deep copy an acyclic *basic* Javascript object. This only handles basic + * scalars (strings, numbers, booleans) and arbitrarily deep arrays and objects + * containing these. This does *not* handle instances of other classes. + */ +function deepCopy(obj) +{ + var ret, key; + var marker = '__deepCopy'; + + if (obj && obj[marker]) + throw (new Error('attempted deep copy of cyclic object')); + + if (obj && obj.constructor == Object) { + ret = {}; + obj[marker] = true; + + for (key in obj) { + if (key == marker) + continue; + + ret[key] = deepCopy(obj[key]); + } + + delete (obj[marker]); + return (ret); + } + + if (obj && obj.constructor == Array) { + ret = []; + obj[marker] = true; + + for (key = 0; key < obj.length; key++) + ret.push(deepCopy(obj[key])); + + delete (obj[marker]); + return (ret); + } + + /* + * It must be a primitive type -- just return it. + */ + return (obj); +} + +function deepEqual(obj1, obj2) +{ + if (typeof (obj1) != typeof (obj2)) + return (false); + + if (obj1 === null || obj2 === null || typeof (obj1) != 'object') + return (obj1 === obj2); + + if (obj1.constructor != obj2.constructor) + return (false); + + var k; + for (k in obj1) { + if (!obj2.hasOwnProperty(k)) + return (false); + + if (!deepEqual(obj1[k], obj2[k])) + return (false); + } + + for (k in obj2) { + if (!obj1.hasOwnProperty(k)) + return (false); + } + + return (true); +} + +function isEmpty(obj) +{ + var key; + for (key in obj) + return (false); + return (true); +} + +function hasKey(obj, key) +{ + mod_assert.equal(typeof (key), 'string'); + return (Object.prototype.hasOwnProperty.call(obj, key)); +} + +function forEachKey(obj, callback) +{ + for (var key in obj) { + if (hasKey(obj, key)) { + callback(key, obj[key]); + } + } +} + +function pluck(obj, key) +{ + mod_assert.equal(typeof (key), 'string'); + return (pluckv(obj, key)); +} + +function pluckv(obj, key) +{ + if (obj === null || typeof (obj) !== 'object') + return (undefined); + + if (obj.hasOwnProperty(key)) + return (obj[key]); + + var i = key.indexOf('.'); + if (i == -1) + return (undefined); + + var key1 = key.substr(0, i); + if (!obj.hasOwnProperty(key1)) + return (undefined); + + return (pluckv(obj[key1], key.substr(i + 1))); +} + +/* + * Invoke callback(row) for each entry in the array that would be returned by + * flattenObject(data, depth). This is just like flattenObject(data, + * depth).forEach(callback), except that the intermediate array is never + * created. + */ +function flattenIter(data, depth, callback) +{ + doFlattenIter(data, depth, [], callback); +} + +function doFlattenIter(data, depth, accum, callback) +{ + var each; + var key; + + if (depth === 0) { + each = accum.slice(0); + each.push(data); + callback(each); + return; + } + + mod_assert.ok(data !== null); + mod_assert.equal(typeof (data), 'object'); + mod_assert.equal(typeof (depth), 'number'); + mod_assert.ok(depth >= 0); + + for (key in data) { + each = accum.slice(0); + each.push(key); + doFlattenIter(data[key], depth - 1, each, callback); + } +} + +function flattenObject(data, depth) +{ + if (depth === 0) + return ([ data ]); + + mod_assert.ok(data !== null); + mod_assert.equal(typeof (data), 'object'); + mod_assert.equal(typeof (depth), 'number'); + mod_assert.ok(depth >= 0); + + var rv = []; + var key; + + for (key in data) { + flattenObject(data[key], depth - 1).forEach(function (p) { + rv.push([ key ].concat(p)); + }); + } + + return (rv); +} + +function startsWith(str, prefix) +{ + return (str.substr(0, prefix.length) == prefix); +} + +function endsWith(str, suffix) +{ + return (str.substr( + str.length - suffix.length, suffix.length) == suffix); +} + +function iso8601(d) +{ + if (typeof (d) == 'number') + d = new Date(d); + mod_assert.ok(d.constructor === Date); + return (mod_extsprintf.sprintf('%4d-%02d-%02dT%02d:%02d:%02d.%03dZ', + d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate(), + d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), + d.getUTCMilliseconds())); +} + +var RFC1123_MONTHS = [ + 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; +var RFC1123_DAYS = [ + 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; + +function rfc1123(date) { + return (mod_extsprintf.sprintf('%s, %02d %s %04d %02d:%02d:%02d GMT', + RFC1123_DAYS[date.getUTCDay()], date.getUTCDate(), + RFC1123_MONTHS[date.getUTCMonth()], date.getUTCFullYear(), + date.getUTCHours(), date.getUTCMinutes(), + date.getUTCSeconds())); +} + +/* + * Parses a date expressed as a string, as either a number of milliseconds since + * the epoch or any string format that Date accepts, giving preference to the + * former where these two sets overlap (e.g., small numbers). + */ +function parseDateTime(str) +{ + /* + * This is irritatingly implicit, but significantly more concise than + * alternatives. The "+str" will convert a string containing only a + * number directly to a Number, or NaN for other strings. Thus, if the + * conversion succeeds, we use it (this is the milliseconds-since-epoch + * case). Otherwise, we pass the string directly to the Date + * constructor to parse. + */ + var numeric = +str; + if (!isNaN(numeric)) { + return (new Date(numeric)); + } else { + return (new Date(str)); + } +} + + +/* + * Number.*_SAFE_INTEGER isn't present before node v0.12, so we hardcode + * the ES6 definitions here, while allowing for them to someday be higher. + */ +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; +var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991; + + +/* + * Default options for parseInteger(). + */ +var PI_DEFAULTS = { + base: 10, + allowSign: true, + allowPrefix: false, + allowTrailing: false, + allowImprecise: false, + trimWhitespace: false, + leadingZeroIsOctal: false +}; + +var CP_0 = 0x30; +var CP_9 = 0x39; + +var CP_A = 0x41; +var CP_B = 0x42; +var CP_O = 0x4f; +var CP_T = 0x54; +var CP_X = 0x58; +var CP_Z = 0x5a; + +var CP_a = 0x61; +var CP_b = 0x62; +var CP_o = 0x6f; +var CP_t = 0x74; +var CP_x = 0x78; +var CP_z = 0x7a; + +var PI_CONV_DEC = 0x30; +var PI_CONV_UC = 0x37; +var PI_CONV_LC = 0x57; + + +/* + * A stricter version of parseInt() that provides options for changing what + * is an acceptable string (for example, disallowing trailing characters). + */ +function parseInteger(str, uopts) +{ + mod_assert.string(str, 'str'); + mod_assert.optionalObject(uopts, 'options'); + + var baseOverride = false; + var options = PI_DEFAULTS; + + if (uopts) { + baseOverride = hasKey(uopts, 'base'); + options = mergeObjects(options, uopts); + mod_assert.number(options.base, 'options.base'); + mod_assert.ok(options.base >= 2, 'options.base >= 2'); + mod_assert.ok(options.base <= 36, 'options.base <= 36'); + mod_assert.bool(options.allowSign, 'options.allowSign'); + mod_assert.bool(options.allowPrefix, 'options.allowPrefix'); + mod_assert.bool(options.allowTrailing, + 'options.allowTrailing'); + mod_assert.bool(options.allowImprecise, + 'options.allowImprecise'); + mod_assert.bool(options.trimWhitespace, + 'options.trimWhitespace'); + mod_assert.bool(options.leadingZeroIsOctal, + 'options.leadingZeroIsOctal'); + + if (options.leadingZeroIsOctal) { + mod_assert.ok(!baseOverride, + '"base" and "leadingZeroIsOctal" are ' + + 'mutually exclusive'); + } + } + + var c; + var pbase = -1; + var base = options.base; + var start; + var mult = 1; + var value = 0; + var idx = 0; + var len = str.length; + + /* Trim any whitespace on the left side. */ + if (options.trimWhitespace) { + while (idx < len && isSpace(str.charCodeAt(idx))) { + ++idx; + } + } + + /* Check the number for a leading sign. */ + if (options.allowSign) { + if (str[idx] === '-') { + idx += 1; + mult = -1; + } else if (str[idx] === '+') { + idx += 1; + } + } + + /* Parse the base-indicating prefix if there is one. */ + if (str[idx] === '0') { + if (options.allowPrefix) { + pbase = prefixToBase(str.charCodeAt(idx + 1)); + if (pbase !== -1 && (!baseOverride || pbase === base)) { + base = pbase; + idx += 2; + } + } + + if (pbase === -1 && options.leadingZeroIsOctal) { + base = 8; + } + } + + /* Parse the actual digits. */ + for (start = idx; idx < len; ++idx) { + c = translateDigit(str.charCodeAt(idx)); + if (c !== -1 && c < base) { + value *= base; + value += c; + } else { + break; + } + } + + /* If we didn't parse any digits, we have an invalid number. */ + if (start === idx) { + return (new Error('invalid number: ' + JSON.stringify(str))); + } + + /* Trim any whitespace on the right side. */ + if (options.trimWhitespace) { + while (idx < len && isSpace(str.charCodeAt(idx))) { + ++idx; + } + } + + /* Check for trailing characters. */ + if (idx < len && !options.allowTrailing) { + return (new Error('trailing characters after number: ' + + JSON.stringify(str.slice(idx)))); + } + + /* If our value is 0, we return now, to avoid returning -0. */ + if (value === 0) { + return (0); + } + + /* Calculate our final value. */ + var result = value * mult; + + /* + * If the string represents a value that cannot be precisely represented + * by JavaScript, then we want to check that: + * + * - We never increased the value past MAX_SAFE_INTEGER + * - We don't make the result negative and below MIN_SAFE_INTEGER + * + * Because we only ever increment the value during parsing, there's no + * chance of moving past MAX_SAFE_INTEGER and then dropping below it + * again, losing precision in the process. This means that we only need + * to do our checks here, at the end. + */ + if (!options.allowImprecise && + (value > MAX_SAFE_INTEGER || result < MIN_SAFE_INTEGER)) { + return (new Error('number is outside of the supported range: ' + + JSON.stringify(str.slice(start, idx)))); + } + + return (result); +} + + +/* + * Interpret a character code as a base-36 digit. + */ +function translateDigit(d) +{ + if (d >= CP_0 && d <= CP_9) { + /* '0' to '9' -> 0 to 9 */ + return (d - PI_CONV_DEC); + } else if (d >= CP_A && d <= CP_Z) { + /* 'A' - 'Z' -> 10 to 35 */ + return (d - PI_CONV_UC); + } else if (d >= CP_a && d <= CP_z) { + /* 'a' - 'z' -> 10 to 35 */ + return (d - PI_CONV_LC); + } else { + /* Invalid character code */ + return (-1); + } +} + + +/* + * Test if a value matches the ECMAScript definition of trimmable whitespace. + */ +function isSpace(c) +{ + return (c === 0x20) || + (c >= 0x0009 && c <= 0x000d) || + (c === 0x00a0) || + (c === 0x1680) || + (c === 0x180e) || + (c >= 0x2000 && c <= 0x200a) || + (c === 0x2028) || + (c === 0x2029) || + (c === 0x202f) || + (c === 0x205f) || + (c === 0x3000) || + (c === 0xfeff); +} + + +/* + * Determine which base a character indicates (e.g., 'x' indicates hex). + */ +function prefixToBase(c) +{ + if (c === CP_b || c === CP_B) { + /* 0b/0B (binary) */ + return (2); + } else if (c === CP_o || c === CP_O) { + /* 0o/0O (octal) */ + return (8); + } else if (c === CP_t || c === CP_T) { + /* 0t/0T (decimal) */ + return (10); + } else if (c === CP_x || c === CP_X) { + /* 0x/0X (hexadecimal) */ + return (16); + } else { + /* Not a meaningful character */ + return (-1); + } +} + + +function validateJsonObjectJS(schema, input) +{ + var report = mod_jsonschema.validate(input, schema); + + if (report.errors.length === 0) + return (null); + + /* Currently, we only do anything useful with the first error. */ + var error = report.errors[0]; + + /* The failed property is given by a URI with an irrelevant prefix. */ + var propname = error['property']; + var reason = error['message'].toLowerCase(); + var i, j; + + /* + * There's at least one case where the property error message is + * confusing at best. We work around this here. + */ + if ((i = reason.indexOf('the property ')) != -1 && + (j = reason.indexOf(' is not defined in the schema and the ' + + 'schema does not allow additional properties')) != -1) { + i += 'the property '.length; + if (propname === '') + propname = reason.substr(i, j - i); + else + propname = propname + '.' + reason.substr(i, j - i); + + reason = 'unsupported property'; + } + + var rv = new mod_verror.VError('property "%s": %s', propname, reason); + rv.jsv_details = error; + return (rv); +} + +function randElt(arr) +{ + mod_assert.ok(Array.isArray(arr) && arr.length > 0, + 'randElt argument must be a non-empty array'); + + return (arr[Math.floor(Math.random() * arr.length)]); +} + +function assertHrtime(a) +{ + mod_assert.ok(a[0] >= 0 && a[1] >= 0, + 'negative numbers not allowed in hrtimes'); + mod_assert.ok(a[1] < 1e9, 'nanoseconds column overflow'); +} + +/* + * Compute the time elapsed between hrtime readings A and B, where A is later + * than B. hrtime readings come from Node's process.hrtime(). There is no + * defined way to represent negative deltas, so it's illegal to diff B from A + * where the time denoted by B is later than the time denoted by A. If this + * becomes valuable, we can define a representation and extend the + * implementation to support it. + */ +function hrtimeDiff(a, b) +{ + assertHrtime(a); + assertHrtime(b); + mod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]), + 'negative differences not allowed'); + + var rv = [ a[0] - b[0], 0 ]; + + if (a[1] >= b[1]) { + rv[1] = a[1] - b[1]; + } else { + rv[0]--; + rv[1] = 1e9 - (b[1] - a[1]); + } + + return (rv); +} + +/* + * Convert a hrtime reading from the array format returned by Node's + * process.hrtime() into a scalar number of nanoseconds. + */ +function hrtimeNanosec(a) +{ + assertHrtime(a); + + return (Math.floor(a[0] * 1e9 + a[1])); +} + +/* + * Convert a hrtime reading from the array format returned by Node's + * process.hrtime() into a scalar number of microseconds. + */ +function hrtimeMicrosec(a) +{ + assertHrtime(a); + + return (Math.floor(a[0] * 1e6 + a[1] / 1e3)); +} + +/* + * Convert a hrtime reading from the array format returned by Node's + * process.hrtime() into a scalar number of milliseconds. + */ +function hrtimeMillisec(a) +{ + assertHrtime(a); + + return (Math.floor(a[0] * 1e3 + a[1] / 1e6)); +} + +/* + * Add two hrtime readings A and B, overwriting A with the result of the + * addition. This function is useful for accumulating several hrtime intervals + * into a counter. Returns A. + */ +function hrtimeAccum(a, b) +{ + assertHrtime(a); + assertHrtime(b); + + /* + * Accumulate the nanosecond component. + */ + a[1] += b[1]; + if (a[1] >= 1e9) { + /* + * The nanosecond component overflowed, so carry to the seconds + * field. + */ + a[0]++; + a[1] -= 1e9; + } + + /* + * Accumulate the seconds component. + */ + a[0] += b[0]; + + return (a); +} + +/* + * Add two hrtime readings A and B, returning the result as a new hrtime array. + * Does not modify either input argument. + */ +function hrtimeAdd(a, b) +{ + assertHrtime(a); + + var rv = [ a[0], a[1] ]; + + return (hrtimeAccum(rv, b)); +} + + +/* + * Check an object for unexpected properties. Accepts the object to check, and + * an array of allowed property names (strings). Returns an array of key names + * that were found on the object, but did not appear in the list of allowed + * properties. If no properties were found, the returned array will be of + * zero length. + */ +function extraProperties(obj, allowed) +{ + mod_assert.ok(typeof (obj) === 'object' && obj !== null, + 'obj argument must be a non-null object'); + mod_assert.ok(Array.isArray(allowed), + 'allowed argument must be an array of strings'); + for (var i = 0; i < allowed.length; i++) { + mod_assert.ok(typeof (allowed[i]) === 'string', + 'allowed argument must be an array of strings'); + } + + return (Object.keys(obj).filter(function (key) { + return (allowed.indexOf(key) === -1); + })); +} + +/* + * Given three sets of properties "provided" (may be undefined), "overrides" + * (required), and "defaults" (may be undefined), construct an object containing + * the union of these sets with "overrides" overriding "provided", and + * "provided" overriding "defaults". None of the input objects are modified. + */ +function mergeObjects(provided, overrides, defaults) +{ + var rv, k; + + rv = {}; + if (defaults) { + for (k in defaults) + rv[k] = defaults[k]; + } + + if (provided) { + for (k in provided) + rv[k] = provided[k]; + } + + if (overrides) { + for (k in overrides) + rv[k] = overrides[k]; + } + + return (rv); +} diff --git a/appasar/canary/node_modules/jsprim/package.json b/appasar/canary/node_modules/jsprim/package.json new file mode 100644 index 0000000..25345ee --- /dev/null +++ b/appasar/canary/node_modules/jsprim/package.json @@ -0,0 +1,20 @@ +{ + "name": "jsprim", + "version": "1.4.1", + "description": "utilities for primitive JavaScript types", + "main": "./lib/jsprim.js", + "repository": { + "type": "git", + "url": "git://github.com/joyent/node-jsprim.git" + }, + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + }, + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" +} diff --git a/appasar/canary/node_modules/mime-db/HISTORY.md b/appasar/canary/node_modules/mime-db/HISTORY.md new file mode 100644 index 0000000..29a8c4f --- /dev/null +++ b/appasar/canary/node_modules/mime-db/HISTORY.md @@ -0,0 +1,368 @@ +1.33.0 / 2018-02-15 +=================== + + * Add extensions from IANA for `message/*` types + * Add new upstream MIME types + * Fix some incorrect OOXML types + * Remove `application/font-woff2` + +1.32.0 / 2017-11-29 +=================== + + * Add new upstream MIME types + * Update `text/hjson` to registered `application/hjson` + * Add `text/shex` with extension `.shex` + +1.31.0 / 2017-10-25 +=================== + + * Add `application/raml+yaml` with extension `.raml` + * Add `application/wasm` with extension `.wasm` + * Add new `font` type from IANA + * Add new upstream font extensions + * Add new upstream MIME types + * Add extensions for JPEG-2000 images + +1.30.0 / 2017-08-27 +=================== + + * Add `application/vnd.ms-outlook` + * Add `application/x-arj` + * Add extension `.mjs` to `application/javascript` + * Add glTF types and extensions + * Add new upstream MIME types + * Add `text/x-org` + * Add VirtualBox MIME types + * Fix `source` records for `video/*` types that are IANA + * Update `font/opentype` to registered `font/otf` + +1.29.0 / 2017-07-10 +=================== + + * Add `application/fido.trusted-apps+json` + * Add extension `.wadl` to `application/vnd.sun.wadl+xml` + * Add new upstream MIME types + * Add `UTF-8` as default charset for `text/css` + +1.28.0 / 2017-05-14 +=================== + + * Add new upstream MIME types + * Add extension `.gz` to `application/gzip` + * Update extensions `.md` and `.markdown` to be `text/markdown` + +1.27.0 / 2017-03-16 +=================== + + * Add new upstream MIME types + * Add `image/apng` with extension `.apng` + +1.26.0 / 2017-01-14 +=================== + + * Add new upstream MIME types + * Add extension `.geojson` to `application/geo+json` + +1.25.0 / 2016-11-11 +=================== + + * Add new upstream MIME types + +1.24.0 / 2016-09-18 +=================== + + * Add `audio/mp3` + * Add new upstream MIME types + +1.23.0 / 2016-05-01 +=================== + + * Add new upstream MIME types + * Add extension `.3gpp` to `audio/3gpp` + +1.22.0 / 2016-02-15 +=================== + + * Add `text/slim` + * Add extension `.rng` to `application/xml` + * Add new upstream MIME types + * Fix extension of `application/dash+xml` to be `.mpd` + * Update primary extension to `.m4a` for `audio/mp4` + +1.21.0 / 2016-01-06 +=================== + + * Add Google document types + * Add new upstream MIME types + +1.20.0 / 2015-11-10 +=================== + + * Add `text/x-suse-ymp` + * Add new upstream MIME types + +1.19.0 / 2015-09-17 +=================== + + * Add `application/vnd.apple.pkpass` + * Add new upstream MIME types + +1.18.0 / 2015-09-03 +=================== + + * Add new upstream MIME types + +1.17.0 / 2015-08-13 +=================== + + * Add `application/x-msdos-program` + * Add `audio/g711-0` + * Add `image/vnd.mozilla.apng` + * Add extension `.exe` to `application/x-msdos-program` + +1.16.0 / 2015-07-29 +=================== + + * Add `application/vnd.uri-map` + +1.15.0 / 2015-07-13 +=================== + + * Add `application/x-httpd-php` + +1.14.0 / 2015-06-25 +=================== + + * Add `application/scim+json` + * Add `application/vnd.3gpp.ussd+xml` + * Add `application/vnd.biopax.rdf+xml` + * Add `text/x-processing` + +1.13.0 / 2015-06-07 +=================== + + * Add nginx as a source + * Add `application/x-cocoa` + * Add `application/x-java-archive-diff` + * Add `application/x-makeself` + * Add `application/x-perl` + * Add `application/x-pilot` + * Add `application/x-redhat-package-manager` + * Add `application/x-sea` + * Add `audio/x-m4a` + * Add `audio/x-realaudio` + * Add `image/x-jng` + * Add `text/mathml` + +1.12.0 / 2015-06-05 +=================== + + * Add `application/bdoc` + * Add `application/vnd.hyperdrive+json` + * Add `application/x-bdoc` + * Add extension `.rtf` to `text/rtf` + +1.11.0 / 2015-05-31 +=================== + + * Add `audio/wav` + * Add `audio/wave` + * Add extension `.litcoffee` to `text/coffeescript` + * Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data` + * Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install` + +1.10.0 / 2015-05-19 +=================== + + * Add `application/vnd.balsamiq.bmpr` + * Add `application/vnd.microsoft.portable-executable` + * Add `application/x-ns-proxy-autoconfig` + +1.9.1 / 2015-04-19 +================== + + * Remove `.json` extension from `application/manifest+json` + - This is causing bugs downstream + +1.9.0 / 2015-04-19 +================== + + * Add `application/manifest+json` + * Add `application/vnd.micro+json` + * Add `image/vnd.zbrush.pcx` + * Add `image/x-ms-bmp` + +1.8.0 / 2015-03-13 +================== + + * Add `application/vnd.citationstyles.style+xml` + * Add `application/vnd.fastcopy-disk-image` + * Add `application/vnd.gov.sk.xmldatacontainer+xml` + * Add extension `.jsonld` to `application/ld+json` + +1.7.0 / 2015-02-08 +================== + + * Add `application/vnd.gerber` + * Add `application/vnd.msa-disk-image` + +1.6.1 / 2015-02-05 +================== + + * Community extensions ownership transferred from `node-mime` + +1.6.0 / 2015-01-29 +================== + + * Add `application/jose` + * Add `application/jose+json` + * Add `application/json-seq` + * Add `application/jwk+json` + * Add `application/jwk-set+json` + * Add `application/jwt` + * Add `application/rdap+json` + * Add `application/vnd.gov.sk.e-form+xml` + * Add `application/vnd.ims.imsccv1p3` + +1.5.0 / 2014-12-30 +================== + + * Add `application/vnd.oracle.resource+json` + * Fix various invalid MIME type entries + - `application/mbox+xml` + - `application/oscp-response` + - `application/vwg-multiplexed` + - `audio/g721` + +1.4.0 / 2014-12-21 +================== + + * Add `application/vnd.ims.imsccv1p2` + * Fix various invalid MIME type entries + - `application/vnd-acucobol` + - `application/vnd-curl` + - `application/vnd-dart` + - `application/vnd-dxr` + - `application/vnd-fdf` + - `application/vnd-mif` + - `application/vnd-sema` + - `application/vnd-wap-wmlc` + - `application/vnd.adobe.flash-movie` + - `application/vnd.dece-zip` + - `application/vnd.dvb_service` + - `application/vnd.micrografx-igx` + - `application/vnd.sealed-doc` + - `application/vnd.sealed-eml` + - `application/vnd.sealed-mht` + - `application/vnd.sealed-ppt` + - `application/vnd.sealed-tiff` + - `application/vnd.sealed-xls` + - `application/vnd.sealedmedia.softseal-html` + - `application/vnd.sealedmedia.softseal-pdf` + - `application/vnd.wap-slc` + - `application/vnd.wap-wbxml` + - `audio/vnd.sealedmedia.softseal-mpeg` + - `image/vnd-djvu` + - `image/vnd-svf` + - `image/vnd-wap-wbmp` + - `image/vnd.sealed-png` + - `image/vnd.sealedmedia.softseal-gif` + - `image/vnd.sealedmedia.softseal-jpg` + - `model/vnd-dwf` + - `model/vnd.parasolid.transmit-binary` + - `model/vnd.parasolid.transmit-text` + - `text/vnd-a` + - `text/vnd-curl` + - `text/vnd.wap-wml` + * Remove example template MIME types + - `application/example` + - `audio/example` + - `image/example` + - `message/example` + - `model/example` + - `multipart/example` + - `text/example` + - `video/example` + +1.3.1 / 2014-12-16 +================== + + * Fix missing extensions + - `application/json5` + - `text/hjson` + +1.3.0 / 2014-12-07 +================== + + * Add `application/a2l` + * Add `application/aml` + * Add `application/atfx` + * Add `application/atxml` + * Add `application/cdfx+xml` + * Add `application/dii` + * Add `application/json5` + * Add `application/lxf` + * Add `application/mf4` + * Add `application/vnd.apache.thrift.compact` + * Add `application/vnd.apache.thrift.json` + * Add `application/vnd.coffeescript` + * Add `application/vnd.enphase.envoy` + * Add `application/vnd.ims.imsccv1p1` + * Add `text/csv-schema` + * Add `text/hjson` + * Add `text/markdown` + * Add `text/yaml` + +1.2.0 / 2014-11-09 +================== + + * Add `application/cea` + * Add `application/dit` + * Add `application/vnd.gov.sk.e-form+zip` + * Add `application/vnd.tmd.mediaflex.api+xml` + * Type `application/epub+zip` is now IANA-registered + +1.1.2 / 2014-10-23 +================== + + * Rebuild database for `application/x-www-form-urlencoded` change + +1.1.1 / 2014-10-20 +================== + + * Mark `application/x-www-form-urlencoded` as compressible. + +1.1.0 / 2014-09-28 +================== + + * Add `application/font-woff2` + +1.0.3 / 2014-09-25 +================== + + * Fix engine requirement in package + +1.0.2 / 2014-09-25 +================== + + * Add `application/coap-group+json` + * Add `application/dcd` + * Add `application/vnd.apache.thrift.binary` + * Add `image/vnd.tencent.tap` + * Mark all JSON-derived types as compressible + * Update `text/vtt` data + +1.0.1 / 2014-08-30 +================== + + * Fix extension ordering + +1.0.0 / 2014-08-30 +================== + + * Add `application/atf` + * Add `application/merge-patch+json` + * Add `multipart/x-mixed-replace` + * Add `source: 'apache'` metadata + * Add `source: 'iana'` metadata + * Remove badly-assumed charset data diff --git a/appasar/canary/node_modules/mime-db/LICENSE b/appasar/canary/node_modules/mime-db/LICENSE new file mode 100644 index 0000000..a7ae8ee --- /dev/null +++ b/appasar/canary/node_modules/mime-db/LICENSE @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong me@jongleberry.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/appasar/canary/node_modules/mime-db/README.md b/appasar/canary/node_modules/mime-db/README.md new file mode 100644 index 0000000..2416c6d --- /dev/null +++ b/appasar/canary/node_modules/mime-db/README.md @@ -0,0 +1,94 @@ +# mime-db + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][travis-image]][travis-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +This is a database of all mime types. +It consists of a single, public JSON file and does not include any logic, +allowing it to remain as un-opinionated as possible with an API. +It aggregates data from the following sources: + +- http://www.iana.org/assignments/media-types/media-types.xhtml +- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types +- http://hg.nginx.org/nginx/raw-file/default/conf/mime.types + +## Installation + +```bash +npm install mime-db +``` + +### Database Download + +If you're crazy enough to use this in the browser, you can just grab the +JSON file using [RawGit](https://rawgit.com/). It is recommended to replace +`master` with [a release tag](https://github.com/jshttp/mime-db/tags) as the +JSON format may change in the future. + +``` +https://cdn.rawgit.com/jshttp/mime-db/master/db.json +``` + +## Usage + +```js +var db = require('mime-db'); + +// grab data on .js files +var data = db['application/javascript']; +``` + +## Data Structure + +The JSON file is a map lookup for lowercased mime types. +Each mime type has the following properties: + +- `.source` - where the mime type is defined. + If not set, it's probably a custom media type. + - `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) + - `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml) + - `nginx` - [nginx media types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types) +- `.extensions[]` - known extensions associated with this mime type. +- `.compressible` - whether a file of this type can be gzipped. +- `.charset` - the default charset associated with this type, if any. + +If unknown, every property could be `undefined`. + +## Contributing + +To edit the database, only make PRs against `src/custom.json` or +`src/custom-suffix.json`. + +The `src/custom.json` file is a JSON object with the MIME type as the keys +and the values being an object with the following keys: + +- `compressible` - leave out if you don't know, otherwise `true`/`false` for + if the data represented by the time is typically compressible. +- `extensions` - include an array of file extensions that are associated with + the type. +- `notes` - human-readable notes about the type, typically what the type is. +- `sources` - include an array of URLs of where the MIME type and the associated + extensions are sourced from. This needs to be a [primary source](https://en.wikipedia.org/wiki/Primary_source); + links to type aggregating sites and Wikipedia are _not acceptible_. + +To update the build, run `npm run build`. + +## Adding Custom Media Types + +The best way to get new media types included in this library is to register +them with the IANA. The community registration procedure is outlined in +[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types +registered with the IANA are automatically pulled into this library. + +[npm-version-image]: https://img.shields.io/npm/v/mime-db.svg +[npm-downloads-image]: https://img.shields.io/npm/dm/mime-db.svg +[npm-url]: https://npmjs.org/package/mime-db +[travis-image]: https://img.shields.io/travis/jshttp/mime-db/master.svg +[travis-url]: https://travis-ci.org/jshttp/mime-db +[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-db/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master +[node-image]: https://img.shields.io/node/v/mime-db.svg +[node-url]: https://nodejs.org/en/download/ diff --git a/appasar/canary/node_modules/mime-db/db.json b/appasar/canary/node_modules/mime-db/db.json new file mode 100644 index 0000000..a8db93b --- /dev/null +++ b/appasar/canary/node_modules/mime-db/db.json @@ -0,0 +1,7088 @@ +{ + "application/1d-interleaved-parityfec": { + "source": "iana" + }, + "application/3gpdash-qoe-report+xml": { + "source": "iana" + }, + "application/3gpp-ims+xml": { + "source": "iana" + }, + "application/a2l": { + "source": "iana" + }, + "application/activemessage": { + "source": "iana" + }, + "application/alto-costmap+json": { + "source": "iana", + "compressible": true + }, + "application/alto-costmapfilter+json": { + "source": "iana", + "compressible": true + }, + "application/alto-directory+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointcost+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointcostparams+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointprop+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointpropparams+json": { + "source": "iana", + "compressible": true + }, + "application/alto-error+json": { + "source": "iana", + "compressible": true + }, + "application/alto-networkmap+json": { + "source": "iana", + "compressible": true + }, + "application/alto-networkmapfilter+json": { + "source": "iana", + "compressible": true + }, + "application/aml": { + "source": "iana" + }, + "application/andrew-inset": { + "source": "iana", + "extensions": ["ez"] + }, + "application/applefile": { + "source": "iana" + }, + "application/applixware": { + "source": "apache", + "extensions": ["aw"] + }, + "application/atf": { + "source": "iana" + }, + "application/atfx": { + "source": "iana" + }, + "application/atom+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atom"] + }, + "application/atomcat+xml": { + "source": "iana", + "extensions": ["atomcat"] + }, + "application/atomdeleted+xml": { + "source": "iana" + }, + "application/atomicmail": { + "source": "iana" + }, + "application/atomsvc+xml": { + "source": "iana", + "extensions": ["atomsvc"] + }, + "application/atxml": { + "source": "iana" + }, + "application/auth-policy+xml": { + "source": "iana" + }, + "application/bacnet-xdd+zip": { + "source": "iana" + }, + "application/batch-smtp": { + "source": "iana" + }, + "application/bdoc": { + "compressible": false, + "extensions": ["bdoc"] + }, + "application/beep+xml": { + "source": "iana" + }, + "application/calendar+json": { + "source": "iana", + "compressible": true + }, + "application/calendar+xml": { + "source": "iana" + }, + "application/call-completion": { + "source": "iana" + }, + "application/cals-1840": { + "source": "iana" + }, + "application/cbor": { + "source": "iana" + }, + "application/cccex": { + "source": "iana" + }, + "application/ccmp+xml": { + "source": "iana" + }, + "application/ccxml+xml": { + "source": "iana", + "extensions": ["ccxml"] + }, + "application/cdfx+xml": { + "source": "iana" + }, + "application/cdmi-capability": { + "source": "iana", + "extensions": ["cdmia"] + }, + "application/cdmi-container": { + "source": "iana", + "extensions": ["cdmic"] + }, + "application/cdmi-domain": { + "source": "iana", + "extensions": ["cdmid"] + }, + "application/cdmi-object": { + "source": "iana", + "extensions": ["cdmio"] + }, + "application/cdmi-queue": { + "source": "iana", + "extensions": ["cdmiq"] + }, + "application/cdni": { + "source": "iana" + }, + "application/cea": { + "source": "iana" + }, + "application/cea-2018+xml": { + "source": "iana" + }, + "application/cellml+xml": { + "source": "iana" + }, + "application/cfw": { + "source": "iana" + }, + "application/clue_info+xml": { + "source": "iana" + }, + "application/cms": { + "source": "iana" + }, + "application/cnrp+xml": { + "source": "iana" + }, + "application/coap-group+json": { + "source": "iana", + "compressible": true + }, + "application/coap-payload": { + "source": "iana" + }, + "application/commonground": { + "source": "iana" + }, + "application/conference-info+xml": { + "source": "iana" + }, + "application/cose": { + "source": "iana" + }, + "application/cose-key": { + "source": "iana" + }, + "application/cose-key-set": { + "source": "iana" + }, + "application/cpl+xml": { + "source": "iana" + }, + "application/csrattrs": { + "source": "iana" + }, + "application/csta+xml": { + "source": "iana" + }, + "application/cstadata+xml": { + "source": "iana" + }, + "application/csvm+json": { + "source": "iana", + "compressible": true + }, + "application/cu-seeme": { + "source": "apache", + "extensions": ["cu"] + }, + "application/cybercash": { + "source": "iana" + }, + "application/dart": { + "compressible": true + }, + "application/dash+xml": { + "source": "iana", + "extensions": ["mpd"] + }, + "application/dashdelta": { + "source": "iana" + }, + "application/davmount+xml": { + "source": "iana", + "extensions": ["davmount"] + }, + "application/dca-rft": { + "source": "iana" + }, + "application/dcd": { + "source": "iana" + }, + "application/dec-dx": { + "source": "iana" + }, + "application/dialog-info+xml": { + "source": "iana" + }, + "application/dicom": { + "source": "iana" + }, + "application/dicom+json": { + "source": "iana", + "compressible": true + }, + "application/dicom+xml": { + "source": "iana" + }, + "application/dii": { + "source": "iana" + }, + "application/dit": { + "source": "iana" + }, + "application/dns": { + "source": "iana" + }, + "application/docbook+xml": { + "source": "apache", + "extensions": ["dbk"] + }, + "application/dskpp+xml": { + "source": "iana" + }, + "application/dssc+der": { + "source": "iana", + "extensions": ["dssc"] + }, + "application/dssc+xml": { + "source": "iana", + "extensions": ["xdssc"] + }, + "application/dvcs": { + "source": "iana" + }, + "application/ecmascript": { + "source": "iana", + "compressible": true, + "extensions": ["ecma"] + }, + "application/edi-consent": { + "source": "iana" + }, + "application/edi-x12": { + "source": "iana", + "compressible": false + }, + "application/edifact": { + "source": "iana", + "compressible": false + }, + "application/efi": { + "source": "iana" + }, + "application/emergencycalldata.comment+xml": { + "source": "iana" + }, + "application/emergencycalldata.control+xml": { + "source": "iana" + }, + "application/emergencycalldata.deviceinfo+xml": { + "source": "iana" + }, + "application/emergencycalldata.ecall.msd": { + "source": "iana" + }, + "application/emergencycalldata.providerinfo+xml": { + "source": "iana" + }, + "application/emergencycalldata.serviceinfo+xml": { + "source": "iana" + }, + "application/emergencycalldata.subscriberinfo+xml": { + "source": "iana" + }, + "application/emergencycalldata.veds+xml": { + "source": "iana" + }, + "application/emma+xml": { + "source": "iana", + "extensions": ["emma"] + }, + "application/emotionml+xml": { + "source": "iana" + }, + "application/encaprtp": { + "source": "iana" + }, + "application/epp+xml": { + "source": "iana" + }, + "application/epub+zip": { + "source": "iana", + "extensions": ["epub"] + }, + "application/eshop": { + "source": "iana" + }, + "application/exi": { + "source": "iana", + "extensions": ["exi"] + }, + "application/fastinfoset": { + "source": "iana" + }, + "application/fastsoap": { + "source": "iana" + }, + "application/fdt+xml": { + "source": "iana" + }, + "application/fhir+xml": { + "source": "iana" + }, + "application/fido.trusted-apps+json": { + "compressible": true + }, + "application/fits": { + "source": "iana" + }, + "application/font-sfnt": { + "source": "iana" + }, + "application/font-tdpfr": { + "source": "iana", + "extensions": ["pfr"] + }, + "application/font-woff": { + "source": "iana", + "compressible": false, + "extensions": ["woff"] + }, + "application/framework-attributes+xml": { + "source": "iana" + }, + "application/geo+json": { + "source": "iana", + "compressible": true, + "extensions": ["geojson"] + }, + "application/geo+json-seq": { + "source": "iana" + }, + "application/geoxacml+xml": { + "source": "iana" + }, + "application/gml+xml": { + "source": "iana", + "extensions": ["gml"] + }, + "application/gpx+xml": { + "source": "apache", + "extensions": ["gpx"] + }, + "application/gxf": { + "source": "apache", + "extensions": ["gxf"] + }, + "application/gzip": { + "source": "iana", + "compressible": false, + "extensions": ["gz"] + }, + "application/h224": { + "source": "iana" + }, + "application/held+xml": { + "source": "iana" + }, + "application/hjson": { + "extensions": ["hjson"] + }, + "application/http": { + "source": "iana" + }, + "application/hyperstudio": { + "source": "iana", + "extensions": ["stk"] + }, + "application/ibe-key-request+xml": { + "source": "iana" + }, + "application/ibe-pkg-reply+xml": { + "source": "iana" + }, + "application/ibe-pp-data": { + "source": "iana" + }, + "application/iges": { + "source": "iana" + }, + "application/im-iscomposing+xml": { + "source": "iana" + }, + "application/index": { + "source": "iana" + }, + "application/index.cmd": { + "source": "iana" + }, + "application/index.obj": { + "source": "iana" + }, + "application/index.response": { + "source": "iana" + }, + "application/index.vnd": { + "source": "iana" + }, + "application/inkml+xml": { + "source": "iana", + "extensions": ["ink","inkml"] + }, + "application/iotp": { + "source": "iana" + }, + "application/ipfix": { + "source": "iana", + "extensions": ["ipfix"] + }, + "application/ipp": { + "source": "iana" + }, + "application/isup": { + "source": "iana" + }, + "application/its+xml": { + "source": "iana" + }, + "application/java-archive": { + "source": "apache", + "compressible": false, + "extensions": ["jar","war","ear"] + }, + "application/java-serialized-object": { + "source": "apache", + "compressible": false, + "extensions": ["ser"] + }, + "application/java-vm": { + "source": "apache", + "compressible": false, + "extensions": ["class"] + }, + "application/javascript": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["js","mjs"] + }, + "application/jf2feed+json": { + "source": "iana", + "compressible": true + }, + "application/jose": { + "source": "iana" + }, + "application/jose+json": { + "source": "iana", + "compressible": true + }, + "application/jrd+json": { + "source": "iana", + "compressible": true + }, + "application/json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["json","map"] + }, + "application/json-patch+json": { + "source": "iana", + "compressible": true + }, + "application/json-seq": { + "source": "iana" + }, + "application/json5": { + "extensions": ["json5"] + }, + "application/jsonml+json": { + "source": "apache", + "compressible": true, + "extensions": ["jsonml"] + }, + "application/jwk+json": { + "source": "iana", + "compressible": true + }, + "application/jwk-set+json": { + "source": "iana", + "compressible": true + }, + "application/jwt": { + "source": "iana" + }, + "application/kpml-request+xml": { + "source": "iana" + }, + "application/kpml-response+xml": { + "source": "iana" + }, + "application/ld+json": { + "source": "iana", + "compressible": true, + "extensions": ["jsonld"] + }, + "application/lgr+xml": { + "source": "iana" + }, + "application/link-format": { + "source": "iana" + }, + "application/load-control+xml": { + "source": "iana" + }, + "application/lost+xml": { + "source": "iana", + "extensions": ["lostxml"] + }, + "application/lostsync+xml": { + "source": "iana" + }, + "application/lxf": { + "source": "iana" + }, + "application/mac-binhex40": { + "source": "iana", + "extensions": ["hqx"] + }, + "application/mac-compactpro": { + "source": "apache", + "extensions": ["cpt"] + }, + "application/macwriteii": { + "source": "iana" + }, + "application/mads+xml": { + "source": "iana", + "extensions": ["mads"] + }, + "application/manifest+json": { + "charset": "UTF-8", + "compressible": true, + "extensions": ["webmanifest"] + }, + "application/marc": { + "source": "iana", + "extensions": ["mrc"] + }, + "application/marcxml+xml": { + "source": "iana", + "extensions": ["mrcx"] + }, + "application/mathematica": { + "source": "iana", + "extensions": ["ma","nb","mb"] + }, + "application/mathml+xml": { + "source": "iana", + "extensions": ["mathml"] + }, + "application/mathml-content+xml": { + "source": "iana" + }, + "application/mathml-presentation+xml": { + "source": "iana" + }, + "application/mbms-associated-procedure-description+xml": { + "source": "iana" + }, + "application/mbms-deregister+xml": { + "source": "iana" + }, + "application/mbms-envelope+xml": { + "source": "iana" + }, + "application/mbms-msk+xml": { + "source": "iana" + }, + "application/mbms-msk-response+xml": { + "source": "iana" + }, + "application/mbms-protection-description+xml": { + "source": "iana" + }, + "application/mbms-reception-report+xml": { + "source": "iana" + }, + "application/mbms-register+xml": { + "source": "iana" + }, + "application/mbms-register-response+xml": { + "source": "iana" + }, + "application/mbms-schedule+xml": { + "source": "iana" + }, + "application/mbms-user-service-description+xml": { + "source": "iana" + }, + "application/mbox": { + "source": "iana", + "extensions": ["mbox"] + }, + "application/media-policy-dataset+xml": { + "source": "iana" + }, + "application/media_control+xml": { + "source": "iana" + }, + "application/mediaservercontrol+xml": { + "source": "iana", + "extensions": ["mscml"] + }, + "application/merge-patch+json": { + "source": "iana", + "compressible": true + }, + "application/metalink+xml": { + "source": "apache", + "extensions": ["metalink"] + }, + "application/metalink4+xml": { + "source": "iana", + "extensions": ["meta4"] + }, + "application/mets+xml": { + "source": "iana", + "extensions": ["mets"] + }, + "application/mf4": { + "source": "iana" + }, + "application/mikey": { + "source": "iana" + }, + "application/mmt-usd+xml": { + "source": "iana" + }, + "application/mods+xml": { + "source": "iana", + "extensions": ["mods"] + }, + "application/moss-keys": { + "source": "iana" + }, + "application/moss-signature": { + "source": "iana" + }, + "application/mosskey-data": { + "source": "iana" + }, + "application/mosskey-request": { + "source": "iana" + }, + "application/mp21": { + "source": "iana", + "extensions": ["m21","mp21"] + }, + "application/mp4": { + "source": "iana", + "extensions": ["mp4s","m4p"] + }, + "application/mpeg4-generic": { + "source": "iana" + }, + "application/mpeg4-iod": { + "source": "iana" + }, + "application/mpeg4-iod-xmt": { + "source": "iana" + }, + "application/mrb-consumer+xml": { + "source": "iana" + }, + "application/mrb-publish+xml": { + "source": "iana" + }, + "application/msc-ivr+xml": { + "source": "iana" + }, + "application/msc-mixer+xml": { + "source": "iana" + }, + "application/msword": { + "source": "iana", + "compressible": false, + "extensions": ["doc","dot"] + }, + "application/mud+json": { + "source": "iana", + "compressible": true + }, + "application/mxf": { + "source": "iana", + "extensions": ["mxf"] + }, + "application/n-quads": { + "source": "iana" + }, + "application/n-triples": { + "source": "iana" + }, + "application/nasdata": { + "source": "iana" + }, + "application/news-checkgroups": { + "source": "iana" + }, + "application/news-groupinfo": { + "source": "iana" + }, + "application/news-transmission": { + "source": "iana" + }, + "application/nlsml+xml": { + "source": "iana" + }, + "application/node": { + "source": "iana" + }, + "application/nss": { + "source": "iana" + }, + "application/ocsp-request": { + "source": "iana" + }, + "application/ocsp-response": { + "source": "iana" + }, + "application/octet-stream": { + "source": "iana", + "compressible": false, + "extensions": ["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"] + }, + "application/oda": { + "source": "iana", + "extensions": ["oda"] + }, + "application/odx": { + "source": "iana" + }, + "application/oebps-package+xml": { + "source": "iana", + "extensions": ["opf"] + }, + "application/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["ogx"] + }, + "application/omdoc+xml": { + "source": "apache", + "extensions": ["omdoc"] + }, + "application/onenote": { + "source": "apache", + "extensions": ["onetoc","onetoc2","onetmp","onepkg"] + }, + "application/oxps": { + "source": "iana", + "extensions": ["oxps"] + }, + "application/p2p-overlay+xml": { + "source": "iana" + }, + "application/parityfec": { + "source": "iana" + }, + "application/passport": { + "source": "iana" + }, + "application/patch-ops-error+xml": { + "source": "iana", + "extensions": ["xer"] + }, + "application/pdf": { + "source": "iana", + "compressible": false, + "extensions": ["pdf"] + }, + "application/pdx": { + "source": "iana" + }, + "application/pgp-encrypted": { + "source": "iana", + "compressible": false, + "extensions": ["pgp"] + }, + "application/pgp-keys": { + "source": "iana" + }, + "application/pgp-signature": { + "source": "iana", + "extensions": ["asc","sig"] + }, + "application/pics-rules": { + "source": "apache", + "extensions": ["prf"] + }, + "application/pidf+xml": { + "source": "iana" + }, + "application/pidf-diff+xml": { + "source": "iana" + }, + "application/pkcs10": { + "source": "iana", + "extensions": ["p10"] + }, + "application/pkcs12": { + "source": "iana" + }, + "application/pkcs7-mime": { + "source": "iana", + "extensions": ["p7m","p7c"] + }, + "application/pkcs7-signature": { + "source": "iana", + "extensions": ["p7s"] + }, + "application/pkcs8": { + "source": "iana", + "extensions": ["p8"] + }, + "application/pkcs8-encrypted": { + "source": "iana" + }, + "application/pkix-attr-cert": { + "source": "iana", + "extensions": ["ac"] + }, + "application/pkix-cert": { + "source": "iana", + "extensions": ["cer"] + }, + "application/pkix-crl": { + "source": "iana", + "extensions": ["crl"] + }, + "application/pkix-pkipath": { + "source": "iana", + "extensions": ["pkipath"] + }, + "application/pkixcmp": { + "source": "iana", + "extensions": ["pki"] + }, + "application/pls+xml": { + "source": "iana", + "extensions": ["pls"] + }, + "application/poc-settings+xml": { + "source": "iana" + }, + "application/postscript": { + "source": "iana", + "compressible": true, + "extensions": ["ai","eps","ps"] + }, + "application/ppsp-tracker+json": { + "source": "iana", + "compressible": true + }, + "application/problem+json": { + "source": "iana", + "compressible": true + }, + "application/problem+xml": { + "source": "iana" + }, + "application/provenance+xml": { + "source": "iana" + }, + "application/prs.alvestrand.titrax-sheet": { + "source": "iana" + }, + "application/prs.cww": { + "source": "iana", + "extensions": ["cww"] + }, + "application/prs.hpub+zip": { + "source": "iana" + }, + "application/prs.nprend": { + "source": "iana" + }, + "application/prs.plucker": { + "source": "iana" + }, + "application/prs.rdf-xml-crypt": { + "source": "iana" + }, + "application/prs.xsf+xml": { + "source": "iana" + }, + "application/pskc+xml": { + "source": "iana", + "extensions": ["pskcxml"] + }, + "application/qsig": { + "source": "iana" + }, + "application/raml+yaml": { + "compressible": true, + "extensions": ["raml"] + }, + "application/raptorfec": { + "source": "iana" + }, + "application/rdap+json": { + "source": "iana", + "compressible": true + }, + "application/rdf+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rdf"] + }, + "application/reginfo+xml": { + "source": "iana", + "extensions": ["rif"] + }, + "application/relax-ng-compact-syntax": { + "source": "iana", + "extensions": ["rnc"] + }, + "application/remote-printing": { + "source": "iana" + }, + "application/reputon+json": { + "source": "iana", + "compressible": true + }, + "application/resource-lists+xml": { + "source": "iana", + "extensions": ["rl"] + }, + "application/resource-lists-diff+xml": { + "source": "iana", + "extensions": ["rld"] + }, + "application/rfc+xml": { + "source": "iana" + }, + "application/riscos": { + "source": "iana" + }, + "application/rlmi+xml": { + "source": "iana" + }, + "application/rls-services+xml": { + "source": "iana", + "extensions": ["rs"] + }, + "application/route-apd+xml": { + "source": "iana" + }, + "application/route-s-tsid+xml": { + "source": "iana" + }, + "application/route-usd+xml": { + "source": "iana" + }, + "application/rpki-ghostbusters": { + "source": "iana", + "extensions": ["gbr"] + }, + "application/rpki-manifest": { + "source": "iana", + "extensions": ["mft"] + }, + "application/rpki-publication": { + "source": "iana" + }, + "application/rpki-roa": { + "source": "iana", + "extensions": ["roa"] + }, + "application/rpki-updown": { + "source": "iana" + }, + "application/rsd+xml": { + "source": "apache", + "extensions": ["rsd"] + }, + "application/rss+xml": { + "source": "apache", + "compressible": true, + "extensions": ["rss"] + }, + "application/rtf": { + "source": "iana", + "compressible": true, + "extensions": ["rtf"] + }, + "application/rtploopback": { + "source": "iana" + }, + "application/rtx": { + "source": "iana" + }, + "application/samlassertion+xml": { + "source": "iana" + }, + "application/samlmetadata+xml": { + "source": "iana" + }, + "application/sbml+xml": { + "source": "iana", + "extensions": ["sbml"] + }, + "application/scaip+xml": { + "source": "iana" + }, + "application/scim+json": { + "source": "iana", + "compressible": true + }, + "application/scvp-cv-request": { + "source": "iana", + "extensions": ["scq"] + }, + "application/scvp-cv-response": { + "source": "iana", + "extensions": ["scs"] + }, + "application/scvp-vp-request": { + "source": "iana", + "extensions": ["spq"] + }, + "application/scvp-vp-response": { + "source": "iana", + "extensions": ["spp"] + }, + "application/sdp": { + "source": "iana", + "extensions": ["sdp"] + }, + "application/sep+xml": { + "source": "iana" + }, + "application/sep-exi": { + "source": "iana" + }, + "application/session-info": { + "source": "iana" + }, + "application/set-payment": { + "source": "iana" + }, + "application/set-payment-initiation": { + "source": "iana", + "extensions": ["setpay"] + }, + "application/set-registration": { + "source": "iana" + }, + "application/set-registration-initiation": { + "source": "iana", + "extensions": ["setreg"] + }, + "application/sgml": { + "source": "iana" + }, + "application/sgml-open-catalog": { + "source": "iana" + }, + "application/shf+xml": { + "source": "iana", + "extensions": ["shf"] + }, + "application/sieve": { + "source": "iana" + }, + "application/simple-filter+xml": { + "source": "iana" + }, + "application/simple-message-summary": { + "source": "iana" + }, + "application/simplesymbolcontainer": { + "source": "iana" + }, + "application/slate": { + "source": "iana" + }, + "application/smil": { + "source": "iana" + }, + "application/smil+xml": { + "source": "iana", + "extensions": ["smi","smil"] + }, + "application/smpte336m": { + "source": "iana" + }, + "application/soap+fastinfoset": { + "source": "iana" + }, + "application/soap+xml": { + "source": "iana", + "compressible": true + }, + "application/sparql-query": { + "source": "iana", + "extensions": ["rq"] + }, + "application/sparql-results+xml": { + "source": "iana", + "extensions": ["srx"] + }, + "application/spirits-event+xml": { + "source": "iana" + }, + "application/sql": { + "source": "iana" + }, + "application/srgs": { + "source": "iana", + "extensions": ["gram"] + }, + "application/srgs+xml": { + "source": "iana", + "extensions": ["grxml"] + }, + "application/sru+xml": { + "source": "iana", + "extensions": ["sru"] + }, + "application/ssdl+xml": { + "source": "apache", + "extensions": ["ssdl"] + }, + "application/ssml+xml": { + "source": "iana", + "extensions": ["ssml"] + }, + "application/tamp-apex-update": { + "source": "iana" + }, + "application/tamp-apex-update-confirm": { + "source": "iana" + }, + "application/tamp-community-update": { + "source": "iana" + }, + "application/tamp-community-update-confirm": { + "source": "iana" + }, + "application/tamp-error": { + "source": "iana" + }, + "application/tamp-sequence-adjust": { + "source": "iana" + }, + "application/tamp-sequence-adjust-confirm": { + "source": "iana" + }, + "application/tamp-status-query": { + "source": "iana" + }, + "application/tamp-status-response": { + "source": "iana" + }, + "application/tamp-update": { + "source": "iana" + }, + "application/tamp-update-confirm": { + "source": "iana" + }, + "application/tar": { + "compressible": true + }, + "application/tei+xml": { + "source": "iana", + "extensions": ["tei","teicorpus"] + }, + "application/thraud+xml": { + "source": "iana", + "extensions": ["tfi"] + }, + "application/timestamp-query": { + "source": "iana" + }, + "application/timestamp-reply": { + "source": "iana" + }, + "application/timestamped-data": { + "source": "iana", + "extensions": ["tsd"] + }, + "application/tnauthlist": { + "source": "iana" + }, + "application/trig": { + "source": "iana" + }, + "application/ttml+xml": { + "source": "iana" + }, + "application/tve-trigger": { + "source": "iana" + }, + "application/ulpfec": { + "source": "iana" + }, + "application/urc-grpsheet+xml": { + "source": "iana" + }, + "application/urc-ressheet+xml": { + "source": "iana" + }, + "application/urc-targetdesc+xml": { + "source": "iana" + }, + "application/urc-uisocketdesc+xml": { + "source": "iana" + }, + "application/vcard+json": { + "source": "iana", + "compressible": true + }, + "application/vcard+xml": { + "source": "iana" + }, + "application/vemmi": { + "source": "iana" + }, + "application/vividence.scriptfile": { + "source": "apache" + }, + "application/vnd.1000minds.decision-model+xml": { + "source": "iana" + }, + "application/vnd.3gpp-prose+xml": { + "source": "iana" + }, + "application/vnd.3gpp-prose-pc3ch+xml": { + "source": "iana" + }, + "application/vnd.3gpp-v2x-local-service-information": { + "source": "iana" + }, + "application/vnd.3gpp.access-transfer-events+xml": { + "source": "iana" + }, + "application/vnd.3gpp.bsf+xml": { + "source": "iana" + }, + "application/vnd.3gpp.gmop+xml": { + "source": "iana" + }, + "application/vnd.3gpp.mcptt-affiliation-command+xml": { + "source": "iana" + }, + "application/vnd.3gpp.mcptt-floor-request+xml": { + "source": "iana" + }, + "application/vnd.3gpp.mcptt-info+xml": { + "source": "iana" + }, + "application/vnd.3gpp.mcptt-location-info+xml": { + "source": "iana" + }, + "application/vnd.3gpp.mcptt-mbms-usage-info+xml": { + "source": "iana" + }, + "application/vnd.3gpp.mcptt-signed+xml": { + "source": "iana" + }, + "application/vnd.3gpp.mid-call+xml": { + "source": "iana" + }, + "application/vnd.3gpp.pic-bw-large": { + "source": "iana", + "extensions": ["plb"] + }, + "application/vnd.3gpp.pic-bw-small": { + "source": "iana", + "extensions": ["psb"] + }, + "application/vnd.3gpp.pic-bw-var": { + "source": "iana", + "extensions": ["pvb"] + }, + "application/vnd.3gpp.sms": { + "source": "iana" + }, + "application/vnd.3gpp.sms+xml": { + "source": "iana" + }, + "application/vnd.3gpp.srvcc-ext+xml": { + "source": "iana" + }, + "application/vnd.3gpp.srvcc-info+xml": { + "source": "iana" + }, + "application/vnd.3gpp.state-and-event-info+xml": { + "source": "iana" + }, + "application/vnd.3gpp.ussd+xml": { + "source": "iana" + }, + "application/vnd.3gpp2.bcmcsinfo+xml": { + "source": "iana" + }, + "application/vnd.3gpp2.sms": { + "source": "iana" + }, + "application/vnd.3gpp2.tcap": { + "source": "iana", + "extensions": ["tcap"] + }, + "application/vnd.3lightssoftware.imagescal": { + "source": "iana" + }, + "application/vnd.3m.post-it-notes": { + "source": "iana", + "extensions": ["pwn"] + }, + "application/vnd.accpac.simply.aso": { + "source": "iana", + "extensions": ["aso"] + }, + "application/vnd.accpac.simply.imp": { + "source": "iana", + "extensions": ["imp"] + }, + "application/vnd.acucobol": { + "source": "iana", + "extensions": ["acu"] + }, + "application/vnd.acucorp": { + "source": "iana", + "extensions": ["atc","acutc"] + }, + "application/vnd.adobe.air-application-installer-package+zip": { + "source": "apache", + "extensions": ["air"] + }, + "application/vnd.adobe.flash.movie": { + "source": "iana" + }, + "application/vnd.adobe.formscentral.fcdt": { + "source": "iana", + "extensions": ["fcdt"] + }, + "application/vnd.adobe.fxp": { + "source": "iana", + "extensions": ["fxp","fxpl"] + }, + "application/vnd.adobe.partial-upload": { + "source": "iana" + }, + "application/vnd.adobe.xdp+xml": { + "source": "iana", + "extensions": ["xdp"] + }, + "application/vnd.adobe.xfdf": { + "source": "iana", + "extensions": ["xfdf"] + }, + "application/vnd.aether.imp": { + "source": "iana" + }, + "application/vnd.ah-barcode": { + "source": "iana" + }, + "application/vnd.ahead.space": { + "source": "iana", + "extensions": ["ahead"] + }, + "application/vnd.airzip.filesecure.azf": { + "source": "iana", + "extensions": ["azf"] + }, + "application/vnd.airzip.filesecure.azs": { + "source": "iana", + "extensions": ["azs"] + }, + "application/vnd.amadeus+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.amazon.ebook": { + "source": "apache", + "extensions": ["azw"] + }, + "application/vnd.amazon.mobi8-ebook": { + "source": "iana" + }, + "application/vnd.americandynamics.acc": { + "source": "iana", + "extensions": ["acc"] + }, + "application/vnd.amiga.ami": { + "source": "iana", + "extensions": ["ami"] + }, + "application/vnd.amundsen.maze+xml": { + "source": "iana" + }, + "application/vnd.android.package-archive": { + "source": "apache", + "compressible": false, + "extensions": ["apk"] + }, + "application/vnd.anki": { + "source": "iana" + }, + "application/vnd.anser-web-certificate-issue-initiation": { + "source": "iana", + "extensions": ["cii"] + }, + "application/vnd.anser-web-funds-transfer-initiation": { + "source": "apache", + "extensions": ["fti"] + }, + "application/vnd.antix.game-component": { + "source": "iana", + "extensions": ["atx"] + }, + "application/vnd.apache.thrift.binary": { + "source": "iana" + }, + "application/vnd.apache.thrift.compact": { + "source": "iana" + }, + "application/vnd.apache.thrift.json": { + "source": "iana" + }, + "application/vnd.api+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.apothekende.reservation+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.apple.installer+xml": { + "source": "iana", + "extensions": ["mpkg"] + }, + "application/vnd.apple.mpegurl": { + "source": "iana", + "extensions": ["m3u8"] + }, + "application/vnd.apple.pkpass": { + "compressible": false, + "extensions": ["pkpass"] + }, + "application/vnd.arastra.swi": { + "source": "iana" + }, + "application/vnd.aristanetworks.swi": { + "source": "iana", + "extensions": ["swi"] + }, + "application/vnd.artsquare": { + "source": "iana" + }, + "application/vnd.astraea-software.iota": { + "source": "iana", + "extensions": ["iota"] + }, + "application/vnd.audiograph": { + "source": "iana", + "extensions": ["aep"] + }, + "application/vnd.autopackage": { + "source": "iana" + }, + "application/vnd.avalon+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.avistar+xml": { + "source": "iana" + }, + "application/vnd.balsamiq.bmml+xml": { + "source": "iana" + }, + "application/vnd.balsamiq.bmpr": { + "source": "iana" + }, + "application/vnd.bbf.usp.msg": { + "source": "iana" + }, + "application/vnd.bbf.usp.msg+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.bekitzur-stech+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.bint.med-content": { + "source": "iana" + }, + "application/vnd.biopax.rdf+xml": { + "source": "iana" + }, + "application/vnd.blink-idb-value-wrapper": { + "source": "iana" + }, + "application/vnd.blueice.multipass": { + "source": "iana", + "extensions": ["mpm"] + }, + "application/vnd.bluetooth.ep.oob": { + "source": "iana" + }, + "application/vnd.bluetooth.le.oob": { + "source": "iana" + }, + "application/vnd.bmi": { + "source": "iana", + "extensions": ["bmi"] + }, + "application/vnd.businessobjects": { + "source": "iana", + "extensions": ["rep"] + }, + "application/vnd.cab-jscript": { + "source": "iana" + }, + "application/vnd.canon-cpdl": { + "source": "iana" + }, + "application/vnd.canon-lips": { + "source": "iana" + }, + "application/vnd.capasystems-pg+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cendio.thinlinc.clientconf": { + "source": "iana" + }, + "application/vnd.century-systems.tcp_stream": { + "source": "iana" + }, + "application/vnd.chemdraw+xml": { + "source": "iana", + "extensions": ["cdxml"] + }, + "application/vnd.chess-pgn": { + "source": "iana" + }, + "application/vnd.chipnuts.karaoke-mmd": { + "source": "iana", + "extensions": ["mmd"] + }, + "application/vnd.cinderella": { + "source": "iana", + "extensions": ["cdy"] + }, + "application/vnd.cirpack.isdn-ext": { + "source": "iana" + }, + "application/vnd.citationstyles.style+xml": { + "source": "iana" + }, + "application/vnd.claymore": { + "source": "iana", + "extensions": ["cla"] + }, + "application/vnd.cloanto.rp9": { + "source": "iana", + "extensions": ["rp9"] + }, + "application/vnd.clonk.c4group": { + "source": "iana", + "extensions": ["c4g","c4d","c4f","c4p","c4u"] + }, + "application/vnd.cluetrust.cartomobile-config": { + "source": "iana", + "extensions": ["c11amc"] + }, + "application/vnd.cluetrust.cartomobile-config-pkg": { + "source": "iana", + "extensions": ["c11amz"] + }, + "application/vnd.coffeescript": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.document": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.document-template": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.presentation": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.presentation-template": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.spreadsheet": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.spreadsheet-template": { + "source": "iana" + }, + "application/vnd.collection+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.collection.doc+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.collection.next+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.comicbook+zip": { + "source": "iana" + }, + "application/vnd.comicbook-rar": { + "source": "iana" + }, + "application/vnd.commerce-battelle": { + "source": "iana" + }, + "application/vnd.commonspace": { + "source": "iana", + "extensions": ["csp"] + }, + "application/vnd.contact.cmsg": { + "source": "iana", + "extensions": ["cdbcmsg"] + }, + "application/vnd.coreos.ignition+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cosmocaller": { + "source": "iana", + "extensions": ["cmc"] + }, + "application/vnd.crick.clicker": { + "source": "iana", + "extensions": ["clkx"] + }, + "application/vnd.crick.clicker.keyboard": { + "source": "iana", + "extensions": ["clkk"] + }, + "application/vnd.crick.clicker.palette": { + "source": "iana", + "extensions": ["clkp"] + }, + "application/vnd.crick.clicker.template": { + "source": "iana", + "extensions": ["clkt"] + }, + "application/vnd.crick.clicker.wordbank": { + "source": "iana", + "extensions": ["clkw"] + }, + "application/vnd.criticaltools.wbs+xml": { + "source": "iana", + "extensions": ["wbs"] + }, + "application/vnd.ctc-posml": { + "source": "iana", + "extensions": ["pml"] + }, + "application/vnd.ctct.ws+xml": { + "source": "iana" + }, + "application/vnd.cups-pdf": { + "source": "iana" + }, + "application/vnd.cups-postscript": { + "source": "iana" + }, + "application/vnd.cups-ppd": { + "source": "iana", + "extensions": ["ppd"] + }, + "application/vnd.cups-raster": { + "source": "iana" + }, + "application/vnd.cups-raw": { + "source": "iana" + }, + "application/vnd.curl": { + "source": "iana" + }, + "application/vnd.curl.car": { + "source": "apache", + "extensions": ["car"] + }, + "application/vnd.curl.pcurl": { + "source": "apache", + "extensions": ["pcurl"] + }, + "application/vnd.cyan.dean.root+xml": { + "source": "iana" + }, + "application/vnd.cybank": { + "source": "iana" + }, + "application/vnd.d2l.coursepackage1p0+zip": { + "source": "iana" + }, + "application/vnd.dart": { + "source": "iana", + "compressible": true, + "extensions": ["dart"] + }, + "application/vnd.data-vision.rdz": { + "source": "iana", + "extensions": ["rdz"] + }, + "application/vnd.datapackage+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.dataresource+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.debian.binary-package": { + "source": "iana" + }, + "application/vnd.dece.data": { + "source": "iana", + "extensions": ["uvf","uvvf","uvd","uvvd"] + }, + "application/vnd.dece.ttml+xml": { + "source": "iana", + "extensions": ["uvt","uvvt"] + }, + "application/vnd.dece.unspecified": { + "source": "iana", + "extensions": ["uvx","uvvx"] + }, + "application/vnd.dece.zip": { + "source": "iana", + "extensions": ["uvz","uvvz"] + }, + "application/vnd.denovo.fcselayout-link": { + "source": "iana", + "extensions": ["fe_launch"] + }, + "application/vnd.desmume-movie": { + "source": "iana" + }, + "application/vnd.desmume.movie": { + "source": "apache" + }, + "application/vnd.dir-bi.plate-dl-nosuffix": { + "source": "iana" + }, + "application/vnd.dm.delegation+xml": { + "source": "iana" + }, + "application/vnd.dna": { + "source": "iana", + "extensions": ["dna"] + }, + "application/vnd.document+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.dolby.mlp": { + "source": "apache", + "extensions": ["mlp"] + }, + "application/vnd.dolby.mobile.1": { + "source": "iana" + }, + "application/vnd.dolby.mobile.2": { + "source": "iana" + }, + "application/vnd.doremir.scorecloud-binary-document": { + "source": "iana" + }, + "application/vnd.dpgraph": { + "source": "iana", + "extensions": ["dpg"] + }, + "application/vnd.dreamfactory": { + "source": "iana", + "extensions": ["dfac"] + }, + "application/vnd.drive+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ds-keypoint": { + "source": "apache", + "extensions": ["kpxx"] + }, + "application/vnd.dtg.local": { + "source": "iana" + }, + "application/vnd.dtg.local.flash": { + "source": "iana" + }, + "application/vnd.dtg.local.html": { + "source": "iana" + }, + "application/vnd.dvb.ait": { + "source": "iana", + "extensions": ["ait"] + }, + "application/vnd.dvb.dvbj": { + "source": "iana" + }, + "application/vnd.dvb.esgcontainer": { + "source": "iana" + }, + "application/vnd.dvb.ipdcdftnotifaccess": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgaccess": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgaccess2": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgpdd": { + "source": "iana" + }, + "application/vnd.dvb.ipdcroaming": { + "source": "iana" + }, + "application/vnd.dvb.iptv.alfec-base": { + "source": "iana" + }, + "application/vnd.dvb.iptv.alfec-enhancement": { + "source": "iana" + }, + "application/vnd.dvb.notif-aggregate-root+xml": { + "source": "iana" + }, + "application/vnd.dvb.notif-container+xml": { + "source": "iana" + }, + "application/vnd.dvb.notif-generic+xml": { + "source": "iana" + }, + "application/vnd.dvb.notif-ia-msglist+xml": { + "source": "iana" + }, + "application/vnd.dvb.notif-ia-registration-request+xml": { + "source": "iana" + }, + "application/vnd.dvb.notif-ia-registration-response+xml": { + "source": "iana" + }, + "application/vnd.dvb.notif-init+xml": { + "source": "iana" + }, + "application/vnd.dvb.pfr": { + "source": "iana" + }, + "application/vnd.dvb.service": { + "source": "iana", + "extensions": ["svc"] + }, + "application/vnd.dxr": { + "source": "iana" + }, + "application/vnd.dynageo": { + "source": "iana", + "extensions": ["geo"] + }, + "application/vnd.dzr": { + "source": "iana" + }, + "application/vnd.easykaraoke.cdgdownload": { + "source": "iana" + }, + "application/vnd.ecdis-update": { + "source": "iana" + }, + "application/vnd.ecip.rlp": { + "source": "iana" + }, + "application/vnd.ecowin.chart": { + "source": "iana", + "extensions": ["mag"] + }, + "application/vnd.ecowin.filerequest": { + "source": "iana" + }, + "application/vnd.ecowin.fileupdate": { + "source": "iana" + }, + "application/vnd.ecowin.series": { + "source": "iana" + }, + "application/vnd.ecowin.seriesrequest": { + "source": "iana" + }, + "application/vnd.ecowin.seriesupdate": { + "source": "iana" + }, + "application/vnd.efi.img": { + "source": "iana" + }, + "application/vnd.efi.iso": { + "source": "iana" + }, + "application/vnd.emclient.accessrequest+xml": { + "source": "iana" + }, + "application/vnd.enliven": { + "source": "iana", + "extensions": ["nml"] + }, + "application/vnd.enphase.envoy": { + "source": "iana" + }, + "application/vnd.eprints.data+xml": { + "source": "iana" + }, + "application/vnd.epson.esf": { + "source": "iana", + "extensions": ["esf"] + }, + "application/vnd.epson.msf": { + "source": "iana", + "extensions": ["msf"] + }, + "application/vnd.epson.quickanime": { + "source": "iana", + "extensions": ["qam"] + }, + "application/vnd.epson.salt": { + "source": "iana", + "extensions": ["slt"] + }, + "application/vnd.epson.ssf": { + "source": "iana", + "extensions": ["ssf"] + }, + "application/vnd.ericsson.quickcall": { + "source": "iana" + }, + "application/vnd.espass-espass+zip": { + "source": "iana" + }, + "application/vnd.eszigno3+xml": { + "source": "iana", + "extensions": ["es3","et3"] + }, + "application/vnd.etsi.aoc+xml": { + "source": "iana" + }, + "application/vnd.etsi.asic-e+zip": { + "source": "iana" + }, + "application/vnd.etsi.asic-s+zip": { + "source": "iana" + }, + "application/vnd.etsi.cug+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvcommand+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvdiscovery+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvprofile+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvsad-bc+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvsad-cod+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvsad-npvr+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvservice+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvsync+xml": { + "source": "iana" + }, + "application/vnd.etsi.iptvueprofile+xml": { + "source": "iana" + }, + "application/vnd.etsi.mcid+xml": { + "source": "iana" + }, + "application/vnd.etsi.mheg5": { + "source": "iana" + }, + "application/vnd.etsi.overload-control-policy-dataset+xml": { + "source": "iana" + }, + "application/vnd.etsi.pstn+xml": { + "source": "iana" + }, + "application/vnd.etsi.sci+xml": { + "source": "iana" + }, + "application/vnd.etsi.simservs+xml": { + "source": "iana" + }, + "application/vnd.etsi.timestamp-token": { + "source": "iana" + }, + "application/vnd.etsi.tsl+xml": { + "source": "iana" + }, + "application/vnd.etsi.tsl.der": { + "source": "iana" + }, + "application/vnd.eudora.data": { + "source": "iana" + }, + "application/vnd.evolv.ecig.profile": { + "source": "iana" + }, + "application/vnd.evolv.ecig.settings": { + "source": "iana" + }, + "application/vnd.evolv.ecig.theme": { + "source": "iana" + }, + "application/vnd.ezpix-album": { + "source": "iana", + "extensions": ["ez2"] + }, + "application/vnd.ezpix-package": { + "source": "iana", + "extensions": ["ez3"] + }, + "application/vnd.f-secure.mobile": { + "source": "iana" + }, + "application/vnd.fastcopy-disk-image": { + "source": "iana" + }, + "application/vnd.fdf": { + "source": "iana", + "extensions": ["fdf"] + }, + "application/vnd.fdsn.mseed": { + "source": "iana", + "extensions": ["mseed"] + }, + "application/vnd.fdsn.seed": { + "source": "iana", + "extensions": ["seed","dataless"] + }, + "application/vnd.ffsns": { + "source": "iana" + }, + "application/vnd.filmit.zfc": { + "source": "iana" + }, + "application/vnd.fints": { + "source": "iana" + }, + "application/vnd.firemonkeys.cloudcell": { + "source": "iana" + }, + "application/vnd.flographit": { + "source": "iana", + "extensions": ["gph"] + }, + "application/vnd.fluxtime.clip": { + "source": "iana", + "extensions": ["ftc"] + }, + "application/vnd.font-fontforge-sfd": { + "source": "iana" + }, + "application/vnd.framemaker": { + "source": "iana", + "extensions": ["fm","frame","maker","book"] + }, + "application/vnd.frogans.fnc": { + "source": "iana", + "extensions": ["fnc"] + }, + "application/vnd.frogans.ltf": { + "source": "iana", + "extensions": ["ltf"] + }, + "application/vnd.fsc.weblaunch": { + "source": "iana", + "extensions": ["fsc"] + }, + "application/vnd.fujitsu.oasys": { + "source": "iana", + "extensions": ["oas"] + }, + "application/vnd.fujitsu.oasys2": { + "source": "iana", + "extensions": ["oa2"] + }, + "application/vnd.fujitsu.oasys3": { + "source": "iana", + "extensions": ["oa3"] + }, + "application/vnd.fujitsu.oasysgp": { + "source": "iana", + "extensions": ["fg5"] + }, + "application/vnd.fujitsu.oasysprs": { + "source": "iana", + "extensions": ["bh2"] + }, + "application/vnd.fujixerox.art-ex": { + "source": "iana" + }, + "application/vnd.fujixerox.art4": { + "source": "iana" + }, + "application/vnd.fujixerox.ddd": { + "source": "iana", + "extensions": ["ddd"] + }, + "application/vnd.fujixerox.docuworks": { + "source": "iana", + "extensions": ["xdw"] + }, + "application/vnd.fujixerox.docuworks.binder": { + "source": "iana", + "extensions": ["xbd"] + }, + "application/vnd.fujixerox.docuworks.container": { + "source": "iana" + }, + "application/vnd.fujixerox.hbpl": { + "source": "iana" + }, + "application/vnd.fut-misnet": { + "source": "iana" + }, + "application/vnd.fuzzysheet": { + "source": "iana", + "extensions": ["fzs"] + }, + "application/vnd.genomatix.tuxedo": { + "source": "iana", + "extensions": ["txd"] + }, + "application/vnd.geo+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.geocube+xml": { + "source": "iana" + }, + "application/vnd.geogebra.file": { + "source": "iana", + "extensions": ["ggb"] + }, + "application/vnd.geogebra.tool": { + "source": "iana", + "extensions": ["ggt"] + }, + "application/vnd.geometry-explorer": { + "source": "iana", + "extensions": ["gex","gre"] + }, + "application/vnd.geonext": { + "source": "iana", + "extensions": ["gxt"] + }, + "application/vnd.geoplan": { + "source": "iana", + "extensions": ["g2w"] + }, + "application/vnd.geospace": { + "source": "iana", + "extensions": ["g3w"] + }, + "application/vnd.gerber": { + "source": "iana" + }, + "application/vnd.globalplatform.card-content-mgt": { + "source": "iana" + }, + "application/vnd.globalplatform.card-content-mgt-response": { + "source": "iana" + }, + "application/vnd.gmx": { + "source": "iana", + "extensions": ["gmx"] + }, + "application/vnd.google-apps.document": { + "compressible": false, + "extensions": ["gdoc"] + }, + "application/vnd.google-apps.presentation": { + "compressible": false, + "extensions": ["gslides"] + }, + "application/vnd.google-apps.spreadsheet": { + "compressible": false, + "extensions": ["gsheet"] + }, + "application/vnd.google-earth.kml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["kml"] + }, + "application/vnd.google-earth.kmz": { + "source": "iana", + "compressible": false, + "extensions": ["kmz"] + }, + "application/vnd.gov.sk.e-form+xml": { + "source": "iana" + }, + "application/vnd.gov.sk.e-form+zip": { + "source": "iana" + }, + "application/vnd.gov.sk.xmldatacontainer+xml": { + "source": "iana" + }, + "application/vnd.grafeq": { + "source": "iana", + "extensions": ["gqf","gqs"] + }, + "application/vnd.gridmp": { + "source": "iana" + }, + "application/vnd.groove-account": { + "source": "iana", + "extensions": ["gac"] + }, + "application/vnd.groove-help": { + "source": "iana", + "extensions": ["ghf"] + }, + "application/vnd.groove-identity-message": { + "source": "iana", + "extensions": ["gim"] + }, + "application/vnd.groove-injector": { + "source": "iana", + "extensions": ["grv"] + }, + "application/vnd.groove-tool-message": { + "source": "iana", + "extensions": ["gtm"] + }, + "application/vnd.groove-tool-template": { + "source": "iana", + "extensions": ["tpl"] + }, + "application/vnd.groove-vcard": { + "source": "iana", + "extensions": ["vcg"] + }, + "application/vnd.hal+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hal+xml": { + "source": "iana", + "extensions": ["hal"] + }, + "application/vnd.handheld-entertainment+xml": { + "source": "iana", + "extensions": ["zmm"] + }, + "application/vnd.hbci": { + "source": "iana", + "extensions": ["hbci"] + }, + "application/vnd.hc+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hcl-bireports": { + "source": "iana" + }, + "application/vnd.hdt": { + "source": "iana" + }, + "application/vnd.heroku+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hhe.lesson-player": { + "source": "iana", + "extensions": ["les"] + }, + "application/vnd.hp-hpgl": { + "source": "iana", + "extensions": ["hpgl"] + }, + "application/vnd.hp-hpid": { + "source": "iana", + "extensions": ["hpid"] + }, + "application/vnd.hp-hps": { + "source": "iana", + "extensions": ["hps"] + }, + "application/vnd.hp-jlyt": { + "source": "iana", + "extensions": ["jlt"] + }, + "application/vnd.hp-pcl": { + "source": "iana", + "extensions": ["pcl"] + }, + "application/vnd.hp-pclxl": { + "source": "iana", + "extensions": ["pclxl"] + }, + "application/vnd.httphone": { + "source": "iana" + }, + "application/vnd.hydrostatix.sof-data": { + "source": "iana", + "extensions": ["sfd-hdstx"] + }, + "application/vnd.hyper-item+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hyperdrive+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hzn-3d-crossword": { + "source": "iana" + }, + "application/vnd.ibm.afplinedata": { + "source": "iana" + }, + "application/vnd.ibm.electronic-media": { + "source": "iana" + }, + "application/vnd.ibm.minipay": { + "source": "iana", + "extensions": ["mpy"] + }, + "application/vnd.ibm.modcap": { + "source": "iana", + "extensions": ["afp","listafp","list3820"] + }, + "application/vnd.ibm.rights-management": { + "source": "iana", + "extensions": ["irm"] + }, + "application/vnd.ibm.secure-container": { + "source": "iana", + "extensions": ["sc"] + }, + "application/vnd.iccprofile": { + "source": "iana", + "extensions": ["icc","icm"] + }, + "application/vnd.ieee.1905": { + "source": "iana" + }, + "application/vnd.igloader": { + "source": "iana", + "extensions": ["igl"] + }, + "application/vnd.imagemeter.folder+zip": { + "source": "iana" + }, + "application/vnd.imagemeter.image+zip": { + "source": "iana" + }, + "application/vnd.immervision-ivp": { + "source": "iana", + "extensions": ["ivp"] + }, + "application/vnd.immervision-ivu": { + "source": "iana", + "extensions": ["ivu"] + }, + "application/vnd.ims.imsccv1p1": { + "source": "iana" + }, + "application/vnd.ims.imsccv1p2": { + "source": "iana" + }, + "application/vnd.ims.imsccv1p3": { + "source": "iana" + }, + "application/vnd.ims.lis.v2.result+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolconsumerprofile+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolproxy+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolproxy.id+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolsettings+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolsettings.simple+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.informedcontrol.rms+xml": { + "source": "iana" + }, + "application/vnd.informix-visionary": { + "source": "iana" + }, + "application/vnd.infotech.project": { + "source": "iana" + }, + "application/vnd.infotech.project+xml": { + "source": "iana" + }, + "application/vnd.innopath.wamp.notification": { + "source": "iana" + }, + "application/vnd.insors.igm": { + "source": "iana", + "extensions": ["igm"] + }, + "application/vnd.intercon.formnet": { + "source": "iana", + "extensions": ["xpw","xpx"] + }, + "application/vnd.intergeo": { + "source": "iana", + "extensions": ["i2g"] + }, + "application/vnd.intertrust.digibox": { + "source": "iana" + }, + "application/vnd.intertrust.nncp": { + "source": "iana" + }, + "application/vnd.intu.qbo": { + "source": "iana", + "extensions": ["qbo"] + }, + "application/vnd.intu.qfx": { + "source": "iana", + "extensions": ["qfx"] + }, + "application/vnd.iptc.g2.catalogitem+xml": { + "source": "iana" + }, + "application/vnd.iptc.g2.conceptitem+xml": { + "source": "iana" + }, + "application/vnd.iptc.g2.knowledgeitem+xml": { + "source": "iana" + }, + "application/vnd.iptc.g2.newsitem+xml": { + "source": "iana" + }, + "application/vnd.iptc.g2.newsmessage+xml": { + "source": "iana" + }, + "application/vnd.iptc.g2.packageitem+xml": { + "source": "iana" + }, + "application/vnd.iptc.g2.planningitem+xml": { + "source": "iana" + }, + "application/vnd.ipunplugged.rcprofile": { + "source": "iana", + "extensions": ["rcprofile"] + }, + "application/vnd.irepository.package+xml": { + "source": "iana", + "extensions": ["irp"] + }, + "application/vnd.is-xpr": { + "source": "iana", + "extensions": ["xpr"] + }, + "application/vnd.isac.fcs": { + "source": "iana", + "extensions": ["fcs"] + }, + "application/vnd.jam": { + "source": "iana", + "extensions": ["jam"] + }, + "application/vnd.japannet-directory-service": { + "source": "iana" + }, + "application/vnd.japannet-jpnstore-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-payment-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-registration": { + "source": "iana" + }, + "application/vnd.japannet-registration-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-setstore-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-verification": { + "source": "iana" + }, + "application/vnd.japannet-verification-wakeup": { + "source": "iana" + }, + "application/vnd.jcp.javame.midlet-rms": { + "source": "iana", + "extensions": ["rms"] + }, + "application/vnd.jisp": { + "source": "iana", + "extensions": ["jisp"] + }, + "application/vnd.joost.joda-archive": { + "source": "iana", + "extensions": ["joda"] + }, + "application/vnd.jsk.isdn-ngn": { + "source": "iana" + }, + "application/vnd.kahootz": { + "source": "iana", + "extensions": ["ktz","ktr"] + }, + "application/vnd.kde.karbon": { + "source": "iana", + "extensions": ["karbon"] + }, + "application/vnd.kde.kchart": { + "source": "iana", + "extensions": ["chrt"] + }, + "application/vnd.kde.kformula": { + "source": "iana", + "extensions": ["kfo"] + }, + "application/vnd.kde.kivio": { + "source": "iana", + "extensions": ["flw"] + }, + "application/vnd.kde.kontour": { + "source": "iana", + "extensions": ["kon"] + }, + "application/vnd.kde.kpresenter": { + "source": "iana", + "extensions": ["kpr","kpt"] + }, + "application/vnd.kde.kspread": { + "source": "iana", + "extensions": ["ksp"] + }, + "application/vnd.kde.kword": { + "source": "iana", + "extensions": ["kwd","kwt"] + }, + "application/vnd.kenameaapp": { + "source": "iana", + "extensions": ["htke"] + }, + "application/vnd.kidspiration": { + "source": "iana", + "extensions": ["kia"] + }, + "application/vnd.kinar": { + "source": "iana", + "extensions": ["kne","knp"] + }, + "application/vnd.koan": { + "source": "iana", + "extensions": ["skp","skd","skt","skm"] + }, + "application/vnd.kodak-descriptor": { + "source": "iana", + "extensions": ["sse"] + }, + "application/vnd.las.las+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.las.las+xml": { + "source": "iana", + "extensions": ["lasxml"] + }, + "application/vnd.liberty-request+xml": { + "source": "iana" + }, + "application/vnd.llamagraphics.life-balance.desktop": { + "source": "iana", + "extensions": ["lbd"] + }, + "application/vnd.llamagraphics.life-balance.exchange+xml": { + "source": "iana", + "extensions": ["lbe"] + }, + "application/vnd.lotus-1-2-3": { + "source": "iana", + "extensions": ["123"] + }, + "application/vnd.lotus-approach": { + "source": "iana", + "extensions": ["apr"] + }, + "application/vnd.lotus-freelance": { + "source": "iana", + "extensions": ["pre"] + }, + "application/vnd.lotus-notes": { + "source": "iana", + "extensions": ["nsf"] + }, + "application/vnd.lotus-organizer": { + "source": "iana", + "extensions": ["org"] + }, + "application/vnd.lotus-screencam": { + "source": "iana", + "extensions": ["scm"] + }, + "application/vnd.lotus-wordpro": { + "source": "iana", + "extensions": ["lwp"] + }, + "application/vnd.macports.portpkg": { + "source": "iana", + "extensions": ["portpkg"] + }, + "application/vnd.mapbox-vector-tile": { + "source": "iana" + }, + "application/vnd.marlin.drm.actiontoken+xml": { + "source": "iana" + }, + "application/vnd.marlin.drm.conftoken+xml": { + "source": "iana" + }, + "application/vnd.marlin.drm.license+xml": { + "source": "iana" + }, + "application/vnd.marlin.drm.mdcf": { + "source": "iana" + }, + "application/vnd.mason+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.maxmind.maxmind-db": { + "source": "iana" + }, + "application/vnd.mcd": { + "source": "iana", + "extensions": ["mcd"] + }, + "application/vnd.medcalcdata": { + "source": "iana", + "extensions": ["mc1"] + }, + "application/vnd.mediastation.cdkey": { + "source": "iana", + "extensions": ["cdkey"] + }, + "application/vnd.meridian-slingshot": { + "source": "iana" + }, + "application/vnd.mfer": { + "source": "iana", + "extensions": ["mwf"] + }, + "application/vnd.mfmp": { + "source": "iana", + "extensions": ["mfm"] + }, + "application/vnd.micro+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.micrografx.flo": { + "source": "iana", + "extensions": ["flo"] + }, + "application/vnd.micrografx.igx": { + "source": "iana", + "extensions": ["igx"] + }, + "application/vnd.microsoft.portable-executable": { + "source": "iana" + }, + "application/vnd.microsoft.windows.thumbnail-cache": { + "source": "iana" + }, + "application/vnd.miele+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.mif": { + "source": "iana", + "extensions": ["mif"] + }, + "application/vnd.minisoft-hp3000-save": { + "source": "iana" + }, + "application/vnd.mitsubishi.misty-guard.trustweb": { + "source": "iana" + }, + "application/vnd.mobius.daf": { + "source": "iana", + "extensions": ["daf"] + }, + "application/vnd.mobius.dis": { + "source": "iana", + "extensions": ["dis"] + }, + "application/vnd.mobius.mbk": { + "source": "iana", + "extensions": ["mbk"] + }, + "application/vnd.mobius.mqy": { + "source": "iana", + "extensions": ["mqy"] + }, + "application/vnd.mobius.msl": { + "source": "iana", + "extensions": ["msl"] + }, + "application/vnd.mobius.plc": { + "source": "iana", + "extensions": ["plc"] + }, + "application/vnd.mobius.txf": { + "source": "iana", + "extensions": ["txf"] + }, + "application/vnd.mophun.application": { + "source": "iana", + "extensions": ["mpn"] + }, + "application/vnd.mophun.certificate": { + "source": "iana", + "extensions": ["mpc"] + }, + "application/vnd.motorola.flexsuite": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.adsi": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.fis": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.gotap": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.kmr": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.ttc": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.wem": { + "source": "iana" + }, + "application/vnd.motorola.iprm": { + "source": "iana" + }, + "application/vnd.mozilla.xul+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xul"] + }, + "application/vnd.ms-3mfdocument": { + "source": "iana" + }, + "application/vnd.ms-artgalry": { + "source": "iana", + "extensions": ["cil"] + }, + "application/vnd.ms-asf": { + "source": "iana" + }, + "application/vnd.ms-cab-compressed": { + "source": "iana", + "extensions": ["cab"] + }, + "application/vnd.ms-color.iccprofile": { + "source": "apache" + }, + "application/vnd.ms-excel": { + "source": "iana", + "compressible": false, + "extensions": ["xls","xlm","xla","xlc","xlt","xlw"] + }, + "application/vnd.ms-excel.addin.macroenabled.12": { + "source": "iana", + "extensions": ["xlam"] + }, + "application/vnd.ms-excel.sheet.binary.macroenabled.12": { + "source": "iana", + "extensions": ["xlsb"] + }, + "application/vnd.ms-excel.sheet.macroenabled.12": { + "source": "iana", + "extensions": ["xlsm"] + }, + "application/vnd.ms-excel.template.macroenabled.12": { + "source": "iana", + "extensions": ["xltm"] + }, + "application/vnd.ms-fontobject": { + "source": "iana", + "compressible": true, + "extensions": ["eot"] + }, + "application/vnd.ms-htmlhelp": { + "source": "iana", + "extensions": ["chm"] + }, + "application/vnd.ms-ims": { + "source": "iana", + "extensions": ["ims"] + }, + "application/vnd.ms-lrm": { + "source": "iana", + "extensions": ["lrm"] + }, + "application/vnd.ms-office.activex+xml": { + "source": "iana" + }, + "application/vnd.ms-officetheme": { + "source": "iana", + "extensions": ["thmx"] + }, + "application/vnd.ms-opentype": { + "source": "apache", + "compressible": true + }, + "application/vnd.ms-outlook": { + "compressible": false, + "extensions": ["msg"] + }, + "application/vnd.ms-package.obfuscated-opentype": { + "source": "apache" + }, + "application/vnd.ms-pki.seccat": { + "source": "apache", + "extensions": ["cat"] + }, + "application/vnd.ms-pki.stl": { + "source": "apache", + "extensions": ["stl"] + }, + "application/vnd.ms-playready.initiator+xml": { + "source": "iana" + }, + "application/vnd.ms-powerpoint": { + "source": "iana", + "compressible": false, + "extensions": ["ppt","pps","pot"] + }, + "application/vnd.ms-powerpoint.addin.macroenabled.12": { + "source": "iana", + "extensions": ["ppam"] + }, + "application/vnd.ms-powerpoint.presentation.macroenabled.12": { + "source": "iana", + "extensions": ["pptm"] + }, + "application/vnd.ms-powerpoint.slide.macroenabled.12": { + "source": "iana", + "extensions": ["sldm"] + }, + "application/vnd.ms-powerpoint.slideshow.macroenabled.12": { + "source": "iana", + "extensions": ["ppsm"] + }, + "application/vnd.ms-powerpoint.template.macroenabled.12": { + "source": "iana", + "extensions": ["potm"] + }, + "application/vnd.ms-printdevicecapabilities+xml": { + "source": "iana" + }, + "application/vnd.ms-printing.printticket+xml": { + "source": "apache" + }, + "application/vnd.ms-printschematicket+xml": { + "source": "iana" + }, + "application/vnd.ms-project": { + "source": "iana", + "extensions": ["mpp","mpt"] + }, + "application/vnd.ms-tnef": { + "source": "iana" + }, + "application/vnd.ms-windows.devicepairing": { + "source": "iana" + }, + "application/vnd.ms-windows.nwprinting.oob": { + "source": "iana" + }, + "application/vnd.ms-windows.printerpairing": { + "source": "iana" + }, + "application/vnd.ms-windows.wsd.oob": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.lic-chlg-req": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.lic-resp": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.meter-chlg-req": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.meter-resp": { + "source": "iana" + }, + "application/vnd.ms-word.document.macroenabled.12": { + "source": "iana", + "extensions": ["docm"] + }, + "application/vnd.ms-word.template.macroenabled.12": { + "source": "iana", + "extensions": ["dotm"] + }, + "application/vnd.ms-works": { + "source": "iana", + "extensions": ["wps","wks","wcm","wdb"] + }, + "application/vnd.ms-wpl": { + "source": "iana", + "extensions": ["wpl"] + }, + "application/vnd.ms-xpsdocument": { + "source": "iana", + "compressible": false, + "extensions": ["xps"] + }, + "application/vnd.msa-disk-image": { + "source": "iana" + }, + "application/vnd.mseq": { + "source": "iana", + "extensions": ["mseq"] + }, + "application/vnd.msign": { + "source": "iana" + }, + "application/vnd.multiad.creator": { + "source": "iana" + }, + "application/vnd.multiad.creator.cif": { + "source": "iana" + }, + "application/vnd.music-niff": { + "source": "iana" + }, + "application/vnd.musician": { + "source": "iana", + "extensions": ["mus"] + }, + "application/vnd.muvee.style": { + "source": "iana", + "extensions": ["msty"] + }, + "application/vnd.mynfc": { + "source": "iana", + "extensions": ["taglet"] + }, + "application/vnd.ncd.control": { + "source": "iana" + }, + "application/vnd.ncd.reference": { + "source": "iana" + }, + "application/vnd.nearst.inv+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.nervana": { + "source": "iana" + }, + "application/vnd.netfpx": { + "source": "iana" + }, + "application/vnd.neurolanguage.nlu": { + "source": "iana", + "extensions": ["nlu"] + }, + "application/vnd.nintendo.nitro.rom": { + "source": "iana" + }, + "application/vnd.nintendo.snes.rom": { + "source": "iana" + }, + "application/vnd.nitf": { + "source": "iana", + "extensions": ["ntf","nitf"] + }, + "application/vnd.noblenet-directory": { + "source": "iana", + "extensions": ["nnd"] + }, + "application/vnd.noblenet-sealer": { + "source": "iana", + "extensions": ["nns"] + }, + "application/vnd.noblenet-web": { + "source": "iana", + "extensions": ["nnw"] + }, + "application/vnd.nokia.catalogs": { + "source": "iana" + }, + "application/vnd.nokia.conml+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.conml+xml": { + "source": "iana" + }, + "application/vnd.nokia.iptv.config+xml": { + "source": "iana" + }, + "application/vnd.nokia.isds-radio-presets": { + "source": "iana" + }, + "application/vnd.nokia.landmark+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.landmark+xml": { + "source": "iana" + }, + "application/vnd.nokia.landmarkcollection+xml": { + "source": "iana" + }, + "application/vnd.nokia.n-gage.ac+xml": { + "source": "iana" + }, + "application/vnd.nokia.n-gage.data": { + "source": "iana", + "extensions": ["ngdat"] + }, + "application/vnd.nokia.n-gage.symbian.install": { + "source": "iana", + "extensions": ["n-gage"] + }, + "application/vnd.nokia.ncd": { + "source": "iana" + }, + "application/vnd.nokia.pcd+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.pcd+xml": { + "source": "iana" + }, + "application/vnd.nokia.radio-preset": { + "source": "iana", + "extensions": ["rpst"] + }, + "application/vnd.nokia.radio-presets": { + "source": "iana", + "extensions": ["rpss"] + }, + "application/vnd.novadigm.edm": { + "source": "iana", + "extensions": ["edm"] + }, + "application/vnd.novadigm.edx": { + "source": "iana", + "extensions": ["edx"] + }, + "application/vnd.novadigm.ext": { + "source": "iana", + "extensions": ["ext"] + }, + "application/vnd.ntt-local.content-share": { + "source": "iana" + }, + "application/vnd.ntt-local.file-transfer": { + "source": "iana" + }, + "application/vnd.ntt-local.ogw_remote-access": { + "source": "iana" + }, + "application/vnd.ntt-local.sip-ta_remote": { + "source": "iana" + }, + "application/vnd.ntt-local.sip-ta_tcp_stream": { + "source": "iana" + }, + "application/vnd.oasis.opendocument.chart": { + "source": "iana", + "extensions": ["odc"] + }, + "application/vnd.oasis.opendocument.chart-template": { + "source": "iana", + "extensions": ["otc"] + }, + "application/vnd.oasis.opendocument.database": { + "source": "iana", + "extensions": ["odb"] + }, + "application/vnd.oasis.opendocument.formula": { + "source": "iana", + "extensions": ["odf"] + }, + "application/vnd.oasis.opendocument.formula-template": { + "source": "iana", + "extensions": ["odft"] + }, + "application/vnd.oasis.opendocument.graphics": { + "source": "iana", + "compressible": false, + "extensions": ["odg"] + }, + "application/vnd.oasis.opendocument.graphics-template": { + "source": "iana", + "extensions": ["otg"] + }, + "application/vnd.oasis.opendocument.image": { + "source": "iana", + "extensions": ["odi"] + }, + "application/vnd.oasis.opendocument.image-template": { + "source": "iana", + "extensions": ["oti"] + }, + "application/vnd.oasis.opendocument.presentation": { + "source": "iana", + "compressible": false, + "extensions": ["odp"] + }, + "application/vnd.oasis.opendocument.presentation-template": { + "source": "iana", + "extensions": ["otp"] + }, + "application/vnd.oasis.opendocument.spreadsheet": { + "source": "iana", + "compressible": false, + "extensions": ["ods"] + }, + "application/vnd.oasis.opendocument.spreadsheet-template": { + "source": "iana", + "extensions": ["ots"] + }, + "application/vnd.oasis.opendocument.text": { + "source": "iana", + "compressible": false, + "extensions": ["odt"] + }, + "application/vnd.oasis.opendocument.text-master": { + "source": "iana", + "extensions": ["odm"] + }, + "application/vnd.oasis.opendocument.text-template": { + "source": "iana", + "extensions": ["ott"] + }, + "application/vnd.oasis.opendocument.text-web": { + "source": "iana", + "extensions": ["oth"] + }, + "application/vnd.obn": { + "source": "iana" + }, + "application/vnd.ocf+cbor": { + "source": "iana" + }, + "application/vnd.oftn.l10n+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.contentaccessdownload+xml": { + "source": "iana" + }, + "application/vnd.oipf.contentaccessstreaming+xml": { + "source": "iana" + }, + "application/vnd.oipf.cspg-hexbinary": { + "source": "iana" + }, + "application/vnd.oipf.dae.svg+xml": { + "source": "iana" + }, + "application/vnd.oipf.dae.xhtml+xml": { + "source": "iana" + }, + "application/vnd.oipf.mippvcontrolmessage+xml": { + "source": "iana" + }, + "application/vnd.oipf.pae.gem": { + "source": "iana" + }, + "application/vnd.oipf.spdiscovery+xml": { + "source": "iana" + }, + "application/vnd.oipf.spdlist+xml": { + "source": "iana" + }, + "application/vnd.oipf.ueprofile+xml": { + "source": "iana" + }, + "application/vnd.oipf.userprofile+xml": { + "source": "iana" + }, + "application/vnd.olpc-sugar": { + "source": "iana", + "extensions": ["xo"] + }, + "application/vnd.oma-scws-config": { + "source": "iana" + }, + "application/vnd.oma-scws-http-request": { + "source": "iana" + }, + "application/vnd.oma-scws-http-response": { + "source": "iana" + }, + "application/vnd.oma.bcast.associated-procedure-parameter+xml": { + "source": "iana" + }, + "application/vnd.oma.bcast.drm-trigger+xml": { + "source": "iana" + }, + "application/vnd.oma.bcast.imd+xml": { + "source": "iana" + }, + "application/vnd.oma.bcast.ltkm": { + "source": "iana" + }, + "application/vnd.oma.bcast.notification+xml": { + "source": "iana" + }, + "application/vnd.oma.bcast.provisioningtrigger": { + "source": "iana" + }, + "application/vnd.oma.bcast.sgboot": { + "source": "iana" + }, + "application/vnd.oma.bcast.sgdd+xml": { + "source": "iana" + }, + "application/vnd.oma.bcast.sgdu": { + "source": "iana" + }, + "application/vnd.oma.bcast.simple-symbol-container": { + "source": "iana" + }, + "application/vnd.oma.bcast.smartcard-trigger+xml": { + "source": "iana" + }, + "application/vnd.oma.bcast.sprov+xml": { + "source": "iana" + }, + "application/vnd.oma.bcast.stkm": { + "source": "iana" + }, + "application/vnd.oma.cab-address-book+xml": { + "source": "iana" + }, + "application/vnd.oma.cab-feature-handler+xml": { + "source": "iana" + }, + "application/vnd.oma.cab-pcc+xml": { + "source": "iana" + }, + "application/vnd.oma.cab-subs-invite+xml": { + "source": "iana" + }, + "application/vnd.oma.cab-user-prefs+xml": { + "source": "iana" + }, + "application/vnd.oma.dcd": { + "source": "iana" + }, + "application/vnd.oma.dcdc": { + "source": "iana" + }, + "application/vnd.oma.dd2+xml": { + "source": "iana", + "extensions": ["dd2"] + }, + "application/vnd.oma.drm.risd+xml": { + "source": "iana" + }, + "application/vnd.oma.group-usage-list+xml": { + "source": "iana" + }, + "application/vnd.oma.lwm2m+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.lwm2m+tlv": { + "source": "iana" + }, + "application/vnd.oma.pal+xml": { + "source": "iana" + }, + "application/vnd.oma.poc.detailed-progress-report+xml": { + "source": "iana" + }, + "application/vnd.oma.poc.final-report+xml": { + "source": "iana" + }, + "application/vnd.oma.poc.groups+xml": { + "source": "iana" + }, + "application/vnd.oma.poc.invocation-descriptor+xml": { + "source": "iana" + }, + "application/vnd.oma.poc.optimized-progress-report+xml": { + "source": "iana" + }, + "application/vnd.oma.push": { + "source": "iana" + }, + "application/vnd.oma.scidm.messages+xml": { + "source": "iana" + }, + "application/vnd.oma.xcap-directory+xml": { + "source": "iana" + }, + "application/vnd.omads-email+xml": { + "source": "iana" + }, + "application/vnd.omads-file+xml": { + "source": "iana" + }, + "application/vnd.omads-folder+xml": { + "source": "iana" + }, + "application/vnd.omaloc-supl-init": { + "source": "iana" + }, + "application/vnd.onepager": { + "source": "iana" + }, + "application/vnd.onepagertamp": { + "source": "iana" + }, + "application/vnd.onepagertamx": { + "source": "iana" + }, + "application/vnd.onepagertat": { + "source": "iana" + }, + "application/vnd.onepagertatp": { + "source": "iana" + }, + "application/vnd.onepagertatx": { + "source": "iana" + }, + "application/vnd.openblox.game+xml": { + "source": "iana" + }, + "application/vnd.openblox.game-binary": { + "source": "iana" + }, + "application/vnd.openeye.oeb": { + "source": "iana" + }, + "application/vnd.openofficeorg.extension": { + "source": "apache", + "extensions": ["oxt"] + }, + "application/vnd.openstreetmap.data+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.custom-properties+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.customxmlproperties+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.drawing+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.extended-properties+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.comments+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.presentation": { + "source": "iana", + "compressible": false, + "extensions": ["pptx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.slide": { + "source": "iana", + "extensions": ["sldx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.slide+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideshow": { + "source": "iana", + "extensions": ["ppsx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.tags+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.template": { + "source": "iana", + "extensions": ["potx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": { + "source": "iana", + "compressible": false, + "extensions": ["xlsx"] + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.template": { + "source": "iana", + "extensions": ["xltx"] + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.theme+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.themeoverride+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.vmldrawing": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { + "source": "iana", + "compressible": false, + "extensions": ["docx"] + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.template": { + "source": "iana", + "extensions": ["dotx"] + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-package.core-properties+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": { + "source": "iana" + }, + "application/vnd.openxmlformats-package.relationships+xml": { + "source": "iana" + }, + "application/vnd.oracle.resource+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.orange.indata": { + "source": "iana" + }, + "application/vnd.osa.netdeploy": { + "source": "iana" + }, + "application/vnd.osgeo.mapguide.package": { + "source": "iana", + "extensions": ["mgp"] + }, + "application/vnd.osgi.bundle": { + "source": "iana" + }, + "application/vnd.osgi.dp": { + "source": "iana", + "extensions": ["dp"] + }, + "application/vnd.osgi.subsystem": { + "source": "iana", + "extensions": ["esa"] + }, + "application/vnd.otps.ct-kip+xml": { + "source": "iana" + }, + "application/vnd.oxli.countgraph": { + "source": "iana" + }, + "application/vnd.pagerduty+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.palm": { + "source": "iana", + "extensions": ["pdb","pqa","oprc"] + }, + "application/vnd.panoply": { + "source": "iana" + }, + "application/vnd.paos+xml": { + "source": "iana" + }, + "application/vnd.paos.xml": { + "source": "apache" + }, + "application/vnd.patentdive": { + "source": "iana" + }, + "application/vnd.pawaafile": { + "source": "iana", + "extensions": ["paw"] + }, + "application/vnd.pcos": { + "source": "iana" + }, + "application/vnd.pg.format": { + "source": "iana", + "extensions": ["str"] + }, + "application/vnd.pg.osasli": { + "source": "iana", + "extensions": ["ei6"] + }, + "application/vnd.piaccess.application-licence": { + "source": "iana" + }, + "application/vnd.picsel": { + "source": "iana", + "extensions": ["efif"] + }, + "application/vnd.pmi.widget": { + "source": "iana", + "extensions": ["wg"] + }, + "application/vnd.poc.group-advertisement+xml": { + "source": "iana" + }, + "application/vnd.pocketlearn": { + "source": "iana", + "extensions": ["plf"] + }, + "application/vnd.powerbuilder6": { + "source": "iana", + "extensions": ["pbd"] + }, + "application/vnd.powerbuilder6-s": { + "source": "iana" + }, + "application/vnd.powerbuilder7": { + "source": "iana" + }, + "application/vnd.powerbuilder7-s": { + "source": "iana" + }, + "application/vnd.powerbuilder75": { + "source": "iana" + }, + "application/vnd.powerbuilder75-s": { + "source": "iana" + }, + "application/vnd.preminet": { + "source": "iana" + }, + "application/vnd.previewsystems.box": { + "source": "iana", + "extensions": ["box"] + }, + "application/vnd.proteus.magazine": { + "source": "iana", + "extensions": ["mgz"] + }, + "application/vnd.publishare-delta-tree": { + "source": "iana", + "extensions": ["qps"] + }, + "application/vnd.pvi.ptid1": { + "source": "iana", + "extensions": ["ptid"] + }, + "application/vnd.pwg-multiplexed": { + "source": "iana" + }, + "application/vnd.pwg-xhtml-print+xml": { + "source": "iana" + }, + "application/vnd.qualcomm.brew-app-res": { + "source": "iana" + }, + "application/vnd.quarantainenet": { + "source": "iana" + }, + "application/vnd.quark.quarkxpress": { + "source": "iana", + "extensions": ["qxd","qxt","qwd","qwt","qxl","qxb"] + }, + "application/vnd.quobject-quoxdocument": { + "source": "iana" + }, + "application/vnd.radisys.moml+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-audit+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-audit-conf+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-audit-conn+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-audit-dialog+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-audit-stream+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-conf+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-dialog+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-dialog-base+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-dialog-fax-detect+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-dialog-fax-sendrecv+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-dialog-group+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-dialog-speech+xml": { + "source": "iana" + }, + "application/vnd.radisys.msml-dialog-transform+xml": { + "source": "iana" + }, + "application/vnd.rainstor.data": { + "source": "iana" + }, + "application/vnd.rapid": { + "source": "iana" + }, + "application/vnd.rar": { + "source": "iana" + }, + "application/vnd.realvnc.bed": { + "source": "iana", + "extensions": ["bed"] + }, + "application/vnd.recordare.musicxml": { + "source": "iana", + "extensions": ["mxl"] + }, + "application/vnd.recordare.musicxml+xml": { + "source": "iana", + "extensions": ["musicxml"] + }, + "application/vnd.renlearn.rlprint": { + "source": "iana" + }, + "application/vnd.restful+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.rig.cryptonote": { + "source": "iana", + "extensions": ["cryptonote"] + }, + "application/vnd.rim.cod": { + "source": "apache", + "extensions": ["cod"] + }, + "application/vnd.rn-realmedia": { + "source": "apache", + "extensions": ["rm"] + }, + "application/vnd.rn-realmedia-vbr": { + "source": "apache", + "extensions": ["rmvb"] + }, + "application/vnd.route66.link66+xml": { + "source": "iana", + "extensions": ["link66"] + }, + "application/vnd.rs-274x": { + "source": "iana" + }, + "application/vnd.ruckus.download": { + "source": "iana" + }, + "application/vnd.s3sms": { + "source": "iana" + }, + "application/vnd.sailingtracker.track": { + "source": "iana", + "extensions": ["st"] + }, + "application/vnd.sbm.cid": { + "source": "iana" + }, + "application/vnd.sbm.mid2": { + "source": "iana" + }, + "application/vnd.scribus": { + "source": "iana" + }, + "application/vnd.sealed.3df": { + "source": "iana" + }, + "application/vnd.sealed.csf": { + "source": "iana" + }, + "application/vnd.sealed.doc": { + "source": "iana" + }, + "application/vnd.sealed.eml": { + "source": "iana" + }, + "application/vnd.sealed.mht": { + "source": "iana" + }, + "application/vnd.sealed.net": { + "source": "iana" + }, + "application/vnd.sealed.ppt": { + "source": "iana" + }, + "application/vnd.sealed.tiff": { + "source": "iana" + }, + "application/vnd.sealed.xls": { + "source": "iana" + }, + "application/vnd.sealedmedia.softseal.html": { + "source": "iana" + }, + "application/vnd.sealedmedia.softseal.pdf": { + "source": "iana" + }, + "application/vnd.seemail": { + "source": "iana", + "extensions": ["see"] + }, + "application/vnd.sema": { + "source": "iana", + "extensions": ["sema"] + }, + "application/vnd.semd": { + "source": "iana", + "extensions": ["semd"] + }, + "application/vnd.semf": { + "source": "iana", + "extensions": ["semf"] + }, + "application/vnd.shana.informed.formdata": { + "source": "iana", + "extensions": ["ifm"] + }, + "application/vnd.shana.informed.formtemplate": { + "source": "iana", + "extensions": ["itp"] + }, + "application/vnd.shana.informed.interchange": { + "source": "iana", + "extensions": ["iif"] + }, + "application/vnd.shana.informed.package": { + "source": "iana", + "extensions": ["ipk"] + }, + "application/vnd.sigrok.session": { + "source": "iana" + }, + "application/vnd.simtech-mindmapper": { + "source": "iana", + "extensions": ["twd","twds"] + }, + "application/vnd.siren+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.smaf": { + "source": "iana", + "extensions": ["mmf"] + }, + "application/vnd.smart.notebook": { + "source": "iana" + }, + "application/vnd.smart.teacher": { + "source": "iana", + "extensions": ["teacher"] + }, + "application/vnd.software602.filler.form+xml": { + "source": "iana" + }, + "application/vnd.software602.filler.form-xml-zip": { + "source": "iana" + }, + "application/vnd.solent.sdkm+xml": { + "source": "iana", + "extensions": ["sdkm","sdkd"] + }, + "application/vnd.spotfire.dxp": { + "source": "iana", + "extensions": ["dxp"] + }, + "application/vnd.spotfire.sfs": { + "source": "iana", + "extensions": ["sfs"] + }, + "application/vnd.sqlite3": { + "source": "iana" + }, + "application/vnd.sss-cod": { + "source": "iana" + }, + "application/vnd.sss-dtf": { + "source": "iana" + }, + "application/vnd.sss-ntf": { + "source": "iana" + }, + "application/vnd.stardivision.calc": { + "source": "apache", + "extensions": ["sdc"] + }, + "application/vnd.stardivision.draw": { + "source": "apache", + "extensions": ["sda"] + }, + "application/vnd.stardivision.impress": { + "source": "apache", + "extensions": ["sdd"] + }, + "application/vnd.stardivision.math": { + "source": "apache", + "extensions": ["smf"] + }, + "application/vnd.stardivision.writer": { + "source": "apache", + "extensions": ["sdw","vor"] + }, + "application/vnd.stardivision.writer-global": { + "source": "apache", + "extensions": ["sgl"] + }, + "application/vnd.stepmania.package": { + "source": "iana", + "extensions": ["smzip"] + }, + "application/vnd.stepmania.stepchart": { + "source": "iana", + "extensions": ["sm"] + }, + "application/vnd.street-stream": { + "source": "iana" + }, + "application/vnd.sun.wadl+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wadl"] + }, + "application/vnd.sun.xml.calc": { + "source": "apache", + "extensions": ["sxc"] + }, + "application/vnd.sun.xml.calc.template": { + "source": "apache", + "extensions": ["stc"] + }, + "application/vnd.sun.xml.draw": { + "source": "apache", + "extensions": ["sxd"] + }, + "application/vnd.sun.xml.draw.template": { + "source": "apache", + "extensions": ["std"] + }, + "application/vnd.sun.xml.impress": { + "source": "apache", + "extensions": ["sxi"] + }, + "application/vnd.sun.xml.impress.template": { + "source": "apache", + "extensions": ["sti"] + }, + "application/vnd.sun.xml.math": { + "source": "apache", + "extensions": ["sxm"] + }, + "application/vnd.sun.xml.writer": { + "source": "apache", + "extensions": ["sxw"] + }, + "application/vnd.sun.xml.writer.global": { + "source": "apache", + "extensions": ["sxg"] + }, + "application/vnd.sun.xml.writer.template": { + "source": "apache", + "extensions": ["stw"] + }, + "application/vnd.sus-calendar": { + "source": "iana", + "extensions": ["sus","susp"] + }, + "application/vnd.svd": { + "source": "iana", + "extensions": ["svd"] + }, + "application/vnd.swiftview-ics": { + "source": "iana" + }, + "application/vnd.symbian.install": { + "source": "apache", + "extensions": ["sis","sisx"] + }, + "application/vnd.syncml+xml": { + "source": "iana", + "extensions": ["xsm"] + }, + "application/vnd.syncml.dm+wbxml": { + "source": "iana", + "extensions": ["bdm"] + }, + "application/vnd.syncml.dm+xml": { + "source": "iana", + "extensions": ["xdm"] + }, + "application/vnd.syncml.dm.notification": { + "source": "iana" + }, + "application/vnd.syncml.dmddf+wbxml": { + "source": "iana" + }, + "application/vnd.syncml.dmddf+xml": { + "source": "iana" + }, + "application/vnd.syncml.dmtnds+wbxml": { + "source": "iana" + }, + "application/vnd.syncml.dmtnds+xml": { + "source": "iana" + }, + "application/vnd.syncml.ds.notification": { + "source": "iana" + }, + "application/vnd.tableschema+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.tao.intent-module-archive": { + "source": "iana", + "extensions": ["tao"] + }, + "application/vnd.tcpdump.pcap": { + "source": "iana", + "extensions": ["pcap","cap","dmp"] + }, + "application/vnd.tmd.mediaflex.api+xml": { + "source": "iana" + }, + "application/vnd.tml": { + "source": "iana" + }, + "application/vnd.tmobile-livetv": { + "source": "iana", + "extensions": ["tmo"] + }, + "application/vnd.tri.onesource": { + "source": "iana" + }, + "application/vnd.trid.tpt": { + "source": "iana", + "extensions": ["tpt"] + }, + "application/vnd.triscape.mxs": { + "source": "iana", + "extensions": ["mxs"] + }, + "application/vnd.trueapp": { + "source": "iana", + "extensions": ["tra"] + }, + "application/vnd.truedoc": { + "source": "iana" + }, + "application/vnd.ubisoft.webplayer": { + "source": "iana" + }, + "application/vnd.ufdl": { + "source": "iana", + "extensions": ["ufd","ufdl"] + }, + "application/vnd.uiq.theme": { + "source": "iana", + "extensions": ["utz"] + }, + "application/vnd.umajin": { + "source": "iana", + "extensions": ["umj"] + }, + "application/vnd.unity": { + "source": "iana", + "extensions": ["unityweb"] + }, + "application/vnd.uoml+xml": { + "source": "iana", + "extensions": ["uoml"] + }, + "application/vnd.uplanet.alert": { + "source": "iana" + }, + "application/vnd.uplanet.alert-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.bearer-choice": { + "source": "iana" + }, + "application/vnd.uplanet.bearer-choice-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.cacheop": { + "source": "iana" + }, + "application/vnd.uplanet.cacheop-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.channel": { + "source": "iana" + }, + "application/vnd.uplanet.channel-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.list": { + "source": "iana" + }, + "application/vnd.uplanet.list-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.listcmd": { + "source": "iana" + }, + "application/vnd.uplanet.listcmd-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.signal": { + "source": "iana" + }, + "application/vnd.uri-map": { + "source": "iana" + }, + "application/vnd.valve.source.material": { + "source": "iana" + }, + "application/vnd.vcx": { + "source": "iana", + "extensions": ["vcx"] + }, + "application/vnd.vd-study": { + "source": "iana" + }, + "application/vnd.vectorworks": { + "source": "iana" + }, + "application/vnd.vel+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.verimatrix.vcas": { + "source": "iana" + }, + "application/vnd.vidsoft.vidconference": { + "source": "iana" + }, + "application/vnd.visio": { + "source": "iana", + "extensions": ["vsd","vst","vss","vsw"] + }, + "application/vnd.visionary": { + "source": "iana", + "extensions": ["vis"] + }, + "application/vnd.vividence.scriptfile": { + "source": "iana" + }, + "application/vnd.vsf": { + "source": "iana", + "extensions": ["vsf"] + }, + "application/vnd.wap.sic": { + "source": "iana" + }, + "application/vnd.wap.slc": { + "source": "iana" + }, + "application/vnd.wap.wbxml": { + "source": "iana", + "extensions": ["wbxml"] + }, + "application/vnd.wap.wmlc": { + "source": "iana", + "extensions": ["wmlc"] + }, + "application/vnd.wap.wmlscriptc": { + "source": "iana", + "extensions": ["wmlsc"] + }, + "application/vnd.webturbo": { + "source": "iana", + "extensions": ["wtb"] + }, + "application/vnd.wfa.p2p": { + "source": "iana" + }, + "application/vnd.wfa.wsc": { + "source": "iana" + }, + "application/vnd.windows.devicepairing": { + "source": "iana" + }, + "application/vnd.wmc": { + "source": "iana" + }, + "application/vnd.wmf.bootstrap": { + "source": "iana" + }, + "application/vnd.wolfram.mathematica": { + "source": "iana" + }, + "application/vnd.wolfram.mathematica.package": { + "source": "iana" + }, + "application/vnd.wolfram.player": { + "source": "iana", + "extensions": ["nbp"] + }, + "application/vnd.wordperfect": { + "source": "iana", + "extensions": ["wpd"] + }, + "application/vnd.wqd": { + "source": "iana", + "extensions": ["wqd"] + }, + "application/vnd.wrq-hp3000-labelled": { + "source": "iana" + }, + "application/vnd.wt.stf": { + "source": "iana", + "extensions": ["stf"] + }, + "application/vnd.wv.csp+wbxml": { + "source": "iana" + }, + "application/vnd.wv.csp+xml": { + "source": "iana" + }, + "application/vnd.wv.ssp+xml": { + "source": "iana" + }, + "application/vnd.xacml+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.xara": { + "source": "iana", + "extensions": ["xar"] + }, + "application/vnd.xfdl": { + "source": "iana", + "extensions": ["xfdl"] + }, + "application/vnd.xfdl.webform": { + "source": "iana" + }, + "application/vnd.xmi+xml": { + "source": "iana" + }, + "application/vnd.xmpie.cpkg": { + "source": "iana" + }, + "application/vnd.xmpie.dpkg": { + "source": "iana" + }, + "application/vnd.xmpie.plan": { + "source": "iana" + }, + "application/vnd.xmpie.ppkg": { + "source": "iana" + }, + "application/vnd.xmpie.xlim": { + "source": "iana" + }, + "application/vnd.yamaha.hv-dic": { + "source": "iana", + "extensions": ["hvd"] + }, + "application/vnd.yamaha.hv-script": { + "source": "iana", + "extensions": ["hvs"] + }, + "application/vnd.yamaha.hv-voice": { + "source": "iana", + "extensions": ["hvp"] + }, + "application/vnd.yamaha.openscoreformat": { + "source": "iana", + "extensions": ["osf"] + }, + "application/vnd.yamaha.openscoreformat.osfpvg+xml": { + "source": "iana", + "extensions": ["osfpvg"] + }, + "application/vnd.yamaha.remote-setup": { + "source": "iana" + }, + "application/vnd.yamaha.smaf-audio": { + "source": "iana", + "extensions": ["saf"] + }, + "application/vnd.yamaha.smaf-phrase": { + "source": "iana", + "extensions": ["spf"] + }, + "application/vnd.yamaha.through-ngn": { + "source": "iana" + }, + "application/vnd.yamaha.tunnel-udpencap": { + "source": "iana" + }, + "application/vnd.yaoweme": { + "source": "iana" + }, + "application/vnd.yellowriver-custom-menu": { + "source": "iana", + "extensions": ["cmp"] + }, + "application/vnd.youtube.yt": { + "source": "iana" + }, + "application/vnd.zul": { + "source": "iana", + "extensions": ["zir","zirz"] + }, + "application/vnd.zzazz.deck+xml": { + "source": "iana", + "extensions": ["zaz"] + }, + "application/voicexml+xml": { + "source": "iana", + "extensions": ["vxml"] + }, + "application/voucher-cms+json": { + "source": "iana", + "compressible": true + }, + "application/vq-rtcpxr": { + "source": "iana" + }, + "application/wasm": { + "compressible": true, + "extensions": ["wasm"] + }, + "application/watcherinfo+xml": { + "source": "iana" + }, + "application/webpush-options+json": { + "source": "iana", + "compressible": true + }, + "application/whoispp-query": { + "source": "iana" + }, + "application/whoispp-response": { + "source": "iana" + }, + "application/widget": { + "source": "iana", + "extensions": ["wgt"] + }, + "application/winhlp": { + "source": "apache", + "extensions": ["hlp"] + }, + "application/wita": { + "source": "iana" + }, + "application/wordperfect5.1": { + "source": "iana" + }, + "application/wsdl+xml": { + "source": "iana", + "extensions": ["wsdl"] + }, + "application/wspolicy+xml": { + "source": "iana", + "extensions": ["wspolicy"] + }, + "application/x-7z-compressed": { + "source": "apache", + "compressible": false, + "extensions": ["7z"] + }, + "application/x-abiword": { + "source": "apache", + "extensions": ["abw"] + }, + "application/x-ace-compressed": { + "source": "apache", + "extensions": ["ace"] + }, + "application/x-amf": { + "source": "apache" + }, + "application/x-apple-diskimage": { + "source": "apache", + "extensions": ["dmg"] + }, + "application/x-arj": { + "compressible": false, + "extensions": ["arj"] + }, + "application/x-authorware-bin": { + "source": "apache", + "extensions": ["aab","x32","u32","vox"] + }, + "application/x-authorware-map": { + "source": "apache", + "extensions": ["aam"] + }, + "application/x-authorware-seg": { + "source": "apache", + "extensions": ["aas"] + }, + "application/x-bcpio": { + "source": "apache", + "extensions": ["bcpio"] + }, + "application/x-bdoc": { + "compressible": false, + "extensions": ["bdoc"] + }, + "application/x-bittorrent": { + "source": "apache", + "extensions": ["torrent"] + }, + "application/x-blorb": { + "source": "apache", + "extensions": ["blb","blorb"] + }, + "application/x-bzip": { + "source": "apache", + "compressible": false, + "extensions": ["bz"] + }, + "application/x-bzip2": { + "source": "apache", + "compressible": false, + "extensions": ["bz2","boz"] + }, + "application/x-cbr": { + "source": "apache", + "extensions": ["cbr","cba","cbt","cbz","cb7"] + }, + "application/x-cdlink": { + "source": "apache", + "extensions": ["vcd"] + }, + "application/x-cfs-compressed": { + "source": "apache", + "extensions": ["cfs"] + }, + "application/x-chat": { + "source": "apache", + "extensions": ["chat"] + }, + "application/x-chess-pgn": { + "source": "apache", + "extensions": ["pgn"] + }, + "application/x-chrome-extension": { + "extensions": ["crx"] + }, + "application/x-cocoa": { + "source": "nginx", + "extensions": ["cco"] + }, + "application/x-compress": { + "source": "apache" + }, + "application/x-conference": { + "source": "apache", + "extensions": ["nsc"] + }, + "application/x-cpio": { + "source": "apache", + "extensions": ["cpio"] + }, + "application/x-csh": { + "source": "apache", + "extensions": ["csh"] + }, + "application/x-deb": { + "compressible": false + }, + "application/x-debian-package": { + "source": "apache", + "extensions": ["deb","udeb"] + }, + "application/x-dgc-compressed": { + "source": "apache", + "extensions": ["dgc"] + }, + "application/x-director": { + "source": "apache", + "extensions": ["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"] + }, + "application/x-doom": { + "source": "apache", + "extensions": ["wad"] + }, + "application/x-dtbncx+xml": { + "source": "apache", + "extensions": ["ncx"] + }, + "application/x-dtbook+xml": { + "source": "apache", + "extensions": ["dtb"] + }, + "application/x-dtbresource+xml": { + "source": "apache", + "extensions": ["res"] + }, + "application/x-dvi": { + "source": "apache", + "compressible": false, + "extensions": ["dvi"] + }, + "application/x-envoy": { + "source": "apache", + "extensions": ["evy"] + }, + "application/x-eva": { + "source": "apache", + "extensions": ["eva"] + }, + "application/x-font-bdf": { + "source": "apache", + "extensions": ["bdf"] + }, + "application/x-font-dos": { + "source": "apache" + }, + "application/x-font-framemaker": { + "source": "apache" + }, + "application/x-font-ghostscript": { + "source": "apache", + "extensions": ["gsf"] + }, + "application/x-font-libgrx": { + "source": "apache" + }, + "application/x-font-linux-psf": { + "source": "apache", + "extensions": ["psf"] + }, + "application/x-font-pcf": { + "source": "apache", + "extensions": ["pcf"] + }, + "application/x-font-snf": { + "source": "apache", + "extensions": ["snf"] + }, + "application/x-font-speedo": { + "source": "apache" + }, + "application/x-font-sunos-news": { + "source": "apache" + }, + "application/x-font-type1": { + "source": "apache", + "extensions": ["pfa","pfb","pfm","afm"] + }, + "application/x-font-vfont": { + "source": "apache" + }, + "application/x-freearc": { + "source": "apache", + "extensions": ["arc"] + }, + "application/x-futuresplash": { + "source": "apache", + "extensions": ["spl"] + }, + "application/x-gca-compressed": { + "source": "apache", + "extensions": ["gca"] + }, + "application/x-glulx": { + "source": "apache", + "extensions": ["ulx"] + }, + "application/x-gnumeric": { + "source": "apache", + "extensions": ["gnumeric"] + }, + "application/x-gramps-xml": { + "source": "apache", + "extensions": ["gramps"] + }, + "application/x-gtar": { + "source": "apache", + "extensions": ["gtar"] + }, + "application/x-gzip": { + "source": "apache" + }, + "application/x-hdf": { + "source": "apache", + "extensions": ["hdf"] + }, + "application/x-httpd-php": { + "compressible": true, + "extensions": ["php"] + }, + "application/x-install-instructions": { + "source": "apache", + "extensions": ["install"] + }, + "application/x-iso9660-image": { + "source": "apache", + "extensions": ["iso"] + }, + "application/x-java-archive-diff": { + "source": "nginx", + "extensions": ["jardiff"] + }, + "application/x-java-jnlp-file": { + "source": "apache", + "compressible": false, + "extensions": ["jnlp"] + }, + "application/x-javascript": { + "compressible": true + }, + "application/x-latex": { + "source": "apache", + "compressible": false, + "extensions": ["latex"] + }, + "application/x-lua-bytecode": { + "extensions": ["luac"] + }, + "application/x-lzh-compressed": { + "source": "apache", + "extensions": ["lzh","lha"] + }, + "application/x-makeself": { + "source": "nginx", + "extensions": ["run"] + }, + "application/x-mie": { + "source": "apache", + "extensions": ["mie"] + }, + "application/x-mobipocket-ebook": { + "source": "apache", + "extensions": ["prc","mobi"] + }, + "application/x-mpegurl": { + "compressible": false + }, + "application/x-ms-application": { + "source": "apache", + "extensions": ["application"] + }, + "application/x-ms-shortcut": { + "source": "apache", + "extensions": ["lnk"] + }, + "application/x-ms-wmd": { + "source": "apache", + "extensions": ["wmd"] + }, + "application/x-ms-wmz": { + "source": "apache", + "extensions": ["wmz"] + }, + "application/x-ms-xbap": { + "source": "apache", + "extensions": ["xbap"] + }, + "application/x-msaccess": { + "source": "apache", + "extensions": ["mdb"] + }, + "application/x-msbinder": { + "source": "apache", + "extensions": ["obd"] + }, + "application/x-mscardfile": { + "source": "apache", + "extensions": ["crd"] + }, + "application/x-msclip": { + "source": "apache", + "extensions": ["clp"] + }, + "application/x-msdos-program": { + "extensions": ["exe"] + }, + "application/x-msdownload": { + "source": "apache", + "extensions": ["exe","dll","com","bat","msi"] + }, + "application/x-msmediaview": { + "source": "apache", + "extensions": ["mvb","m13","m14"] + }, + "application/x-msmetafile": { + "source": "apache", + "extensions": ["wmf","wmz","emf","emz"] + }, + "application/x-msmoney": { + "source": "apache", + "extensions": ["mny"] + }, + "application/x-mspublisher": { + "source": "apache", + "extensions": ["pub"] + }, + "application/x-msschedule": { + "source": "apache", + "extensions": ["scd"] + }, + "application/x-msterminal": { + "source": "apache", + "extensions": ["trm"] + }, + "application/x-mswrite": { + "source": "apache", + "extensions": ["wri"] + }, + "application/x-netcdf": { + "source": "apache", + "extensions": ["nc","cdf"] + }, + "application/x-ns-proxy-autoconfig": { + "compressible": true, + "extensions": ["pac"] + }, + "application/x-nzb": { + "source": "apache", + "extensions": ["nzb"] + }, + "application/x-perl": { + "source": "nginx", + "extensions": ["pl","pm"] + }, + "application/x-pilot": { + "source": "nginx", + "extensions": ["prc","pdb"] + }, + "application/x-pkcs12": { + "source": "apache", + "compressible": false, + "extensions": ["p12","pfx"] + }, + "application/x-pkcs7-certificates": { + "source": "apache", + "extensions": ["p7b","spc"] + }, + "application/x-pkcs7-certreqresp": { + "source": "apache", + "extensions": ["p7r"] + }, + "application/x-rar-compressed": { + "source": "apache", + "compressible": false, + "extensions": ["rar"] + }, + "application/x-redhat-package-manager": { + "source": "nginx", + "extensions": ["rpm"] + }, + "application/x-research-info-systems": { + "source": "apache", + "extensions": ["ris"] + }, + "application/x-sea": { + "source": "nginx", + "extensions": ["sea"] + }, + "application/x-sh": { + "source": "apache", + "compressible": true, + "extensions": ["sh"] + }, + "application/x-shar": { + "source": "apache", + "extensions": ["shar"] + }, + "application/x-shockwave-flash": { + "source": "apache", + "compressible": false, + "extensions": ["swf"] + }, + "application/x-silverlight-app": { + "source": "apache", + "extensions": ["xap"] + }, + "application/x-sql": { + "source": "apache", + "extensions": ["sql"] + }, + "application/x-stuffit": { + "source": "apache", + "compressible": false, + "extensions": ["sit"] + }, + "application/x-stuffitx": { + "source": "apache", + "extensions": ["sitx"] + }, + "application/x-subrip": { + "source": "apache", + "extensions": ["srt"] + }, + "application/x-sv4cpio": { + "source": "apache", + "extensions": ["sv4cpio"] + }, + "application/x-sv4crc": { + "source": "apache", + "extensions": ["sv4crc"] + }, + "application/x-t3vm-image": { + "source": "apache", + "extensions": ["t3"] + }, + "application/x-tads": { + "source": "apache", + "extensions": ["gam"] + }, + "application/x-tar": { + "source": "apache", + "compressible": true, + "extensions": ["tar"] + }, + "application/x-tcl": { + "source": "apache", + "extensions": ["tcl","tk"] + }, + "application/x-tex": { + "source": "apache", + "extensions": ["tex"] + }, + "application/x-tex-tfm": { + "source": "apache", + "extensions": ["tfm"] + }, + "application/x-texinfo": { + "source": "apache", + "extensions": ["texinfo","texi"] + }, + "application/x-tgif": { + "source": "apache", + "extensions": ["obj"] + }, + "application/x-ustar": { + "source": "apache", + "extensions": ["ustar"] + }, + "application/x-virtualbox-hdd": { + "compressible": true, + "extensions": ["hdd"] + }, + "application/x-virtualbox-ova": { + "compressible": true, + "extensions": ["ova"] + }, + "application/x-virtualbox-ovf": { + "compressible": true, + "extensions": ["ovf"] + }, + "application/x-virtualbox-vbox": { + "compressible": true, + "extensions": ["vbox"] + }, + "application/x-virtualbox-vbox-extpack": { + "compressible": false, + "extensions": ["vbox-extpack"] + }, + "application/x-virtualbox-vdi": { + "compressible": true, + "extensions": ["vdi"] + }, + "application/x-virtualbox-vhd": { + "compressible": true, + "extensions": ["vhd"] + }, + "application/x-virtualbox-vmdk": { + "compressible": true, + "extensions": ["vmdk"] + }, + "application/x-wais-source": { + "source": "apache", + "extensions": ["src"] + }, + "application/x-web-app-manifest+json": { + "compressible": true, + "extensions": ["webapp"] + }, + "application/x-www-form-urlencoded": { + "source": "iana", + "compressible": true + }, + "application/x-x509-ca-cert": { + "source": "apache", + "extensions": ["der","crt","pem"] + }, + "application/x-xfig": { + "source": "apache", + "extensions": ["fig"] + }, + "application/x-xliff+xml": { + "source": "apache", + "extensions": ["xlf"] + }, + "application/x-xpinstall": { + "source": "apache", + "compressible": false, + "extensions": ["xpi"] + }, + "application/x-xz": { + "source": "apache", + "extensions": ["xz"] + }, + "application/x-zmachine": { + "source": "apache", + "extensions": ["z1","z2","z3","z4","z5","z6","z7","z8"] + }, + "application/x400-bp": { + "source": "iana" + }, + "application/xacml+xml": { + "source": "iana" + }, + "application/xaml+xml": { + "source": "apache", + "extensions": ["xaml"] + }, + "application/xcap-att+xml": { + "source": "iana" + }, + "application/xcap-caps+xml": { + "source": "iana" + }, + "application/xcap-diff+xml": { + "source": "iana", + "extensions": ["xdf"] + }, + "application/xcap-el+xml": { + "source": "iana" + }, + "application/xcap-error+xml": { + "source": "iana" + }, + "application/xcap-ns+xml": { + "source": "iana" + }, + "application/xcon-conference-info+xml": { + "source": "iana" + }, + "application/xcon-conference-info-diff+xml": { + "source": "iana" + }, + "application/xenc+xml": { + "source": "iana", + "extensions": ["xenc"] + }, + "application/xhtml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xhtml","xht"] + }, + "application/xhtml-voice+xml": { + "source": "apache" + }, + "application/xml": { + "source": "iana", + "compressible": true, + "extensions": ["xml","xsl","xsd","rng"] + }, + "application/xml-dtd": { + "source": "iana", + "compressible": true, + "extensions": ["dtd"] + }, + "application/xml-external-parsed-entity": { + "source": "iana" + }, + "application/xml-patch+xml": { + "source": "iana" + }, + "application/xmpp+xml": { + "source": "iana" + }, + "application/xop+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xop"] + }, + "application/xproc+xml": { + "source": "apache", + "extensions": ["xpl"] + }, + "application/xslt+xml": { + "source": "iana", + "extensions": ["xslt"] + }, + "application/xspf+xml": { + "source": "apache", + "extensions": ["xspf"] + }, + "application/xv+xml": { + "source": "iana", + "extensions": ["mxml","xhvml","xvml","xvm"] + }, + "application/yang": { + "source": "iana", + "extensions": ["yang"] + }, + "application/yang-data+json": { + "source": "iana", + "compressible": true + }, + "application/yang-data+xml": { + "source": "iana" + }, + "application/yang-patch+json": { + "source": "iana", + "compressible": true + }, + "application/yang-patch+xml": { + "source": "iana" + }, + "application/yin+xml": { + "source": "iana", + "extensions": ["yin"] + }, + "application/zip": { + "source": "iana", + "compressible": false, + "extensions": ["zip"] + }, + "application/zlib": { + "source": "iana" + }, + "audio/1d-interleaved-parityfec": { + "source": "iana" + }, + "audio/32kadpcm": { + "source": "iana" + }, + "audio/3gpp": { + "source": "iana", + "compressible": false, + "extensions": ["3gpp"] + }, + "audio/3gpp2": { + "source": "iana" + }, + "audio/ac3": { + "source": "iana" + }, + "audio/adpcm": { + "source": "apache", + "extensions": ["adp"] + }, + "audio/amr": { + "source": "iana" + }, + "audio/amr-wb": { + "source": "iana" + }, + "audio/amr-wb+": { + "source": "iana" + }, + "audio/aptx": { + "source": "iana" + }, + "audio/asc": { + "source": "iana" + }, + "audio/atrac-advanced-lossless": { + "source": "iana" + }, + "audio/atrac-x": { + "source": "iana" + }, + "audio/atrac3": { + "source": "iana" + }, + "audio/basic": { + "source": "iana", + "compressible": false, + "extensions": ["au","snd"] + }, + "audio/bv16": { + "source": "iana" + }, + "audio/bv32": { + "source": "iana" + }, + "audio/clearmode": { + "source": "iana" + }, + "audio/cn": { + "source": "iana" + }, + "audio/dat12": { + "source": "iana" + }, + "audio/dls": { + "source": "iana" + }, + "audio/dsr-es201108": { + "source": "iana" + }, + "audio/dsr-es202050": { + "source": "iana" + }, + "audio/dsr-es202211": { + "source": "iana" + }, + "audio/dsr-es202212": { + "source": "iana" + }, + "audio/dv": { + "source": "iana" + }, + "audio/dvi4": { + "source": "iana" + }, + "audio/eac3": { + "source": "iana" + }, + "audio/encaprtp": { + "source": "iana" + }, + "audio/evrc": { + "source": "iana" + }, + "audio/evrc-qcp": { + "source": "iana" + }, + "audio/evrc0": { + "source": "iana" + }, + "audio/evrc1": { + "source": "iana" + }, + "audio/evrcb": { + "source": "iana" + }, + "audio/evrcb0": { + "source": "iana" + }, + "audio/evrcb1": { + "source": "iana" + }, + "audio/evrcnw": { + "source": "iana" + }, + "audio/evrcnw0": { + "source": "iana" + }, + "audio/evrcnw1": { + "source": "iana" + }, + "audio/evrcwb": { + "source": "iana" + }, + "audio/evrcwb0": { + "source": "iana" + }, + "audio/evrcwb1": { + "source": "iana" + }, + "audio/evs": { + "source": "iana" + }, + "audio/fwdred": { + "source": "iana" + }, + "audio/g711-0": { + "source": "iana" + }, + "audio/g719": { + "source": "iana" + }, + "audio/g722": { + "source": "iana" + }, + "audio/g7221": { + "source": "iana" + }, + "audio/g723": { + "source": "iana" + }, + "audio/g726-16": { + "source": "iana" + }, + "audio/g726-24": { + "source": "iana" + }, + "audio/g726-32": { + "source": "iana" + }, + "audio/g726-40": { + "source": "iana" + }, + "audio/g728": { + "source": "iana" + }, + "audio/g729": { + "source": "iana" + }, + "audio/g7291": { + "source": "iana" + }, + "audio/g729d": { + "source": "iana" + }, + "audio/g729e": { + "source": "iana" + }, + "audio/gsm": { + "source": "iana" + }, + "audio/gsm-efr": { + "source": "iana" + }, + "audio/gsm-hr-08": { + "source": "iana" + }, + "audio/ilbc": { + "source": "iana" + }, + "audio/ip-mr_v2.5": { + "source": "iana" + }, + "audio/isac": { + "source": "apache" + }, + "audio/l16": { + "source": "iana" + }, + "audio/l20": { + "source": "iana" + }, + "audio/l24": { + "source": "iana", + "compressible": false + }, + "audio/l8": { + "source": "iana" + }, + "audio/lpc": { + "source": "iana" + }, + "audio/melp": { + "source": "iana" + }, + "audio/melp1200": { + "source": "iana" + }, + "audio/melp2400": { + "source": "iana" + }, + "audio/melp600": { + "source": "iana" + }, + "audio/midi": { + "source": "apache", + "extensions": ["mid","midi","kar","rmi"] + }, + "audio/mobile-xmf": { + "source": "iana" + }, + "audio/mp3": { + "compressible": false, + "extensions": ["mp3"] + }, + "audio/mp4": { + "source": "iana", + "compressible": false, + "extensions": ["m4a","mp4a"] + }, + "audio/mp4a-latm": { + "source": "iana" + }, + "audio/mpa": { + "source": "iana" + }, + "audio/mpa-robust": { + "source": "iana" + }, + "audio/mpeg": { + "source": "iana", + "compressible": false, + "extensions": ["mpga","mp2","mp2a","mp3","m2a","m3a"] + }, + "audio/mpeg4-generic": { + "source": "iana" + }, + "audio/musepack": { + "source": "apache" + }, + "audio/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["oga","ogg","spx"] + }, + "audio/opus": { + "source": "iana" + }, + "audio/parityfec": { + "source": "iana" + }, + "audio/pcma": { + "source": "iana" + }, + "audio/pcma-wb": { + "source": "iana" + }, + "audio/pcmu": { + "source": "iana" + }, + "audio/pcmu-wb": { + "source": "iana" + }, + "audio/prs.sid": { + "source": "iana" + }, + "audio/qcelp": { + "source": "iana" + }, + "audio/raptorfec": { + "source": "iana" + }, + "audio/red": { + "source": "iana" + }, + "audio/rtp-enc-aescm128": { + "source": "iana" + }, + "audio/rtp-midi": { + "source": "iana" + }, + "audio/rtploopback": { + "source": "iana" + }, + "audio/rtx": { + "source": "iana" + }, + "audio/s3m": { + "source": "apache", + "extensions": ["s3m"] + }, + "audio/silk": { + "source": "apache", + "extensions": ["sil"] + }, + "audio/smv": { + "source": "iana" + }, + "audio/smv-qcp": { + "source": "iana" + }, + "audio/smv0": { + "source": "iana" + }, + "audio/sp-midi": { + "source": "iana" + }, + "audio/speex": { + "source": "iana" + }, + "audio/t140c": { + "source": "iana" + }, + "audio/t38": { + "source": "iana" + }, + "audio/telephone-event": { + "source": "iana" + }, + "audio/tone": { + "source": "iana" + }, + "audio/uemclip": { + "source": "iana" + }, + "audio/ulpfec": { + "source": "iana" + }, + "audio/vdvi": { + "source": "iana" + }, + "audio/vmr-wb": { + "source": "iana" + }, + "audio/vnd.3gpp.iufp": { + "source": "iana" + }, + "audio/vnd.4sb": { + "source": "iana" + }, + "audio/vnd.audiokoz": { + "source": "iana" + }, + "audio/vnd.celp": { + "source": "iana" + }, + "audio/vnd.cisco.nse": { + "source": "iana" + }, + "audio/vnd.cmles.radio-events": { + "source": "iana" + }, + "audio/vnd.cns.anp1": { + "source": "iana" + }, + "audio/vnd.cns.inf1": { + "source": "iana" + }, + "audio/vnd.dece.audio": { + "source": "iana", + "extensions": ["uva","uvva"] + }, + "audio/vnd.digital-winds": { + "source": "iana", + "extensions": ["eol"] + }, + "audio/vnd.dlna.adts": { + "source": "iana" + }, + "audio/vnd.dolby.heaac.1": { + "source": "iana" + }, + "audio/vnd.dolby.heaac.2": { + "source": "iana" + }, + "audio/vnd.dolby.mlp": { + "source": "iana" + }, + "audio/vnd.dolby.mps": { + "source": "iana" + }, + "audio/vnd.dolby.pl2": { + "source": "iana" + }, + "audio/vnd.dolby.pl2x": { + "source": "iana" + }, + "audio/vnd.dolby.pl2z": { + "source": "iana" + }, + "audio/vnd.dolby.pulse.1": { + "source": "iana" + }, + "audio/vnd.dra": { + "source": "iana", + "extensions": ["dra"] + }, + "audio/vnd.dts": { + "source": "iana", + "extensions": ["dts"] + }, + "audio/vnd.dts.hd": { + "source": "iana", + "extensions": ["dtshd"] + }, + "audio/vnd.dvb.file": { + "source": "iana" + }, + "audio/vnd.everad.plj": { + "source": "iana" + }, + "audio/vnd.hns.audio": { + "source": "iana" + }, + "audio/vnd.lucent.voice": { + "source": "iana", + "extensions": ["lvp"] + }, + "audio/vnd.ms-playready.media.pya": { + "source": "iana", + "extensions": ["pya"] + }, + "audio/vnd.nokia.mobile-xmf": { + "source": "iana" + }, + "audio/vnd.nortel.vbk": { + "source": "iana" + }, + "audio/vnd.nuera.ecelp4800": { + "source": "iana", + "extensions": ["ecelp4800"] + }, + "audio/vnd.nuera.ecelp7470": { + "source": "iana", + "extensions": ["ecelp7470"] + }, + "audio/vnd.nuera.ecelp9600": { + "source": "iana", + "extensions": ["ecelp9600"] + }, + "audio/vnd.octel.sbc": { + "source": "iana" + }, + "audio/vnd.presonus.multitrack": { + "source": "iana" + }, + "audio/vnd.qcelp": { + "source": "iana" + }, + "audio/vnd.rhetorex.32kadpcm": { + "source": "iana" + }, + "audio/vnd.rip": { + "source": "iana", + "extensions": ["rip"] + }, + "audio/vnd.rn-realaudio": { + "compressible": false + }, + "audio/vnd.sealedmedia.softseal.mpeg": { + "source": "iana" + }, + "audio/vnd.vmx.cvsd": { + "source": "iana" + }, + "audio/vnd.wave": { + "compressible": false + }, + "audio/vorbis": { + "source": "iana", + "compressible": false + }, + "audio/vorbis-config": { + "source": "iana" + }, + "audio/wav": { + "compressible": false, + "extensions": ["wav"] + }, + "audio/wave": { + "compressible": false, + "extensions": ["wav"] + }, + "audio/webm": { + "source": "apache", + "compressible": false, + "extensions": ["weba"] + }, + "audio/x-aac": { + "source": "apache", + "compressible": false, + "extensions": ["aac"] + }, + "audio/x-aiff": { + "source": "apache", + "extensions": ["aif","aiff","aifc"] + }, + "audio/x-caf": { + "source": "apache", + "compressible": false, + "extensions": ["caf"] + }, + "audio/x-flac": { + "source": "apache", + "extensions": ["flac"] + }, + "audio/x-m4a": { + "source": "nginx", + "extensions": ["m4a"] + }, + "audio/x-matroska": { + "source": "apache", + "extensions": ["mka"] + }, + "audio/x-mpegurl": { + "source": "apache", + "extensions": ["m3u"] + }, + "audio/x-ms-wax": { + "source": "apache", + "extensions": ["wax"] + }, + "audio/x-ms-wma": { + "source": "apache", + "extensions": ["wma"] + }, + "audio/x-pn-realaudio": { + "source": "apache", + "extensions": ["ram","ra"] + }, + "audio/x-pn-realaudio-plugin": { + "source": "apache", + "extensions": ["rmp"] + }, + "audio/x-realaudio": { + "source": "nginx", + "extensions": ["ra"] + }, + "audio/x-tta": { + "source": "apache" + }, + "audio/x-wav": { + "source": "apache", + "extensions": ["wav"] + }, + "audio/xm": { + "source": "apache", + "extensions": ["xm"] + }, + "chemical/x-cdx": { + "source": "apache", + "extensions": ["cdx"] + }, + "chemical/x-cif": { + "source": "apache", + "extensions": ["cif"] + }, + "chemical/x-cmdf": { + "source": "apache", + "extensions": ["cmdf"] + }, + "chemical/x-cml": { + "source": "apache", + "extensions": ["cml"] + }, + "chemical/x-csml": { + "source": "apache", + "extensions": ["csml"] + }, + "chemical/x-pdb": { + "source": "apache" + }, + "chemical/x-xyz": { + "source": "apache", + "extensions": ["xyz"] + }, + "font/collection": { + "source": "iana", + "extensions": ["ttc"] + }, + "font/otf": { + "source": "iana", + "compressible": true, + "extensions": ["otf"] + }, + "font/sfnt": { + "source": "iana" + }, + "font/ttf": { + "source": "iana", + "extensions": ["ttf"] + }, + "font/woff": { + "source": "iana", + "extensions": ["woff"] + }, + "font/woff2": { + "source": "iana", + "extensions": ["woff2"] + }, + "image/aces": { + "source": "iana" + }, + "image/apng": { + "compressible": false, + "extensions": ["apng"] + }, + "image/bmp": { + "source": "iana", + "compressible": true, + "extensions": ["bmp"] + }, + "image/cgm": { + "source": "iana", + "extensions": ["cgm"] + }, + "image/dicom-rle": { + "source": "iana" + }, + "image/emf": { + "source": "iana" + }, + "image/fits": { + "source": "iana" + }, + "image/g3fax": { + "source": "iana", + "extensions": ["g3"] + }, + "image/gif": { + "source": "iana", + "compressible": false, + "extensions": ["gif"] + }, + "image/ief": { + "source": "iana", + "extensions": ["ief"] + }, + "image/jls": { + "source": "iana" + }, + "image/jp2": { + "source": "iana", + "compressible": false, + "extensions": ["jp2","jpg2"] + }, + "image/jpeg": { + "source": "iana", + "compressible": false, + "extensions": ["jpeg","jpg","jpe"] + }, + "image/jpm": { + "source": "iana", + "compressible": false, + "extensions": ["jpm"] + }, + "image/jpx": { + "source": "iana", + "compressible": false, + "extensions": ["jpx","jpf"] + }, + "image/ktx": { + "source": "iana", + "extensions": ["ktx"] + }, + "image/naplps": { + "source": "iana" + }, + "image/pjpeg": { + "compressible": false + }, + "image/png": { + "source": "iana", + "compressible": false, + "extensions": ["png"] + }, + "image/prs.btif": { + "source": "iana", + "extensions": ["btif"] + }, + "image/prs.pti": { + "source": "iana" + }, + "image/pwg-raster": { + "source": "iana" + }, + "image/sgi": { + "source": "apache", + "extensions": ["sgi"] + }, + "image/svg+xml": { + "source": "iana", + "compressible": true, + "extensions": ["svg","svgz"] + }, + "image/t38": { + "source": "iana" + }, + "image/tiff": { + "source": "iana", + "compressible": false, + "extensions": ["tiff","tif"] + }, + "image/tiff-fx": { + "source": "iana" + }, + "image/vnd.adobe.photoshop": { + "source": "iana", + "compressible": true, + "extensions": ["psd"] + }, + "image/vnd.airzip.accelerator.azv": { + "source": "iana" + }, + "image/vnd.cns.inf2": { + "source": "iana" + }, + "image/vnd.dece.graphic": { + "source": "iana", + "extensions": ["uvi","uvvi","uvg","uvvg"] + }, + "image/vnd.djvu": { + "source": "iana", + "extensions": ["djvu","djv"] + }, + "image/vnd.dvb.subtitle": { + "source": "iana", + "extensions": ["sub"] + }, + "image/vnd.dwg": { + "source": "iana", + "extensions": ["dwg"] + }, + "image/vnd.dxf": { + "source": "iana", + "extensions": ["dxf"] + }, + "image/vnd.fastbidsheet": { + "source": "iana", + "extensions": ["fbs"] + }, + "image/vnd.fpx": { + "source": "iana", + "extensions": ["fpx"] + }, + "image/vnd.fst": { + "source": "iana", + "extensions": ["fst"] + }, + "image/vnd.fujixerox.edmics-mmr": { + "source": "iana", + "extensions": ["mmr"] + }, + "image/vnd.fujixerox.edmics-rlc": { + "source": "iana", + "extensions": ["rlc"] + }, + "image/vnd.globalgraphics.pgb": { + "source": "iana" + }, + "image/vnd.microsoft.icon": { + "source": "iana" + }, + "image/vnd.mix": { + "source": "iana" + }, + "image/vnd.mozilla.apng": { + "source": "iana" + }, + "image/vnd.ms-modi": { + "source": "iana", + "extensions": ["mdi"] + }, + "image/vnd.ms-photo": { + "source": "apache", + "extensions": ["wdp"] + }, + "image/vnd.net-fpx": { + "source": "iana", + "extensions": ["npx"] + }, + "image/vnd.radiance": { + "source": "iana" + }, + "image/vnd.sealed.png": { + "source": "iana" + }, + "image/vnd.sealedmedia.softseal.gif": { + "source": "iana" + }, + "image/vnd.sealedmedia.softseal.jpg": { + "source": "iana" + }, + "image/vnd.svf": { + "source": "iana" + }, + "image/vnd.tencent.tap": { + "source": "iana" + }, + "image/vnd.valve.source.texture": { + "source": "iana" + }, + "image/vnd.wap.wbmp": { + "source": "iana", + "extensions": ["wbmp"] + }, + "image/vnd.xiff": { + "source": "iana", + "extensions": ["xif"] + }, + "image/vnd.zbrush.pcx": { + "source": "iana" + }, + "image/webp": { + "source": "apache", + "extensions": ["webp"] + }, + "image/wmf": { + "source": "iana" + }, + "image/x-3ds": { + "source": "apache", + "extensions": ["3ds"] + }, + "image/x-cmu-raster": { + "source": "apache", + "extensions": ["ras"] + }, + "image/x-cmx": { + "source": "apache", + "extensions": ["cmx"] + }, + "image/x-freehand": { + "source": "apache", + "extensions": ["fh","fhc","fh4","fh5","fh7"] + }, + "image/x-icon": { + "source": "apache", + "compressible": true, + "extensions": ["ico"] + }, + "image/x-jng": { + "source": "nginx", + "extensions": ["jng"] + }, + "image/x-mrsid-image": { + "source": "apache", + "extensions": ["sid"] + }, + "image/x-ms-bmp": { + "source": "nginx", + "compressible": true, + "extensions": ["bmp"] + }, + "image/x-pcx": { + "source": "apache", + "extensions": ["pcx"] + }, + "image/x-pict": { + "source": "apache", + "extensions": ["pic","pct"] + }, + "image/x-portable-anymap": { + "source": "apache", + "extensions": ["pnm"] + }, + "image/x-portable-bitmap": { + "source": "apache", + "extensions": ["pbm"] + }, + "image/x-portable-graymap": { + "source": "apache", + "extensions": ["pgm"] + }, + "image/x-portable-pixmap": { + "source": "apache", + "extensions": ["ppm"] + }, + "image/x-rgb": { + "source": "apache", + "extensions": ["rgb"] + }, + "image/x-tga": { + "source": "apache", + "extensions": ["tga"] + }, + "image/x-xbitmap": { + "source": "apache", + "extensions": ["xbm"] + }, + "image/x-xcf": { + "compressible": false + }, + "image/x-xpixmap": { + "source": "apache", + "extensions": ["xpm"] + }, + "image/x-xwindowdump": { + "source": "apache", + "extensions": ["xwd"] + }, + "message/cpim": { + "source": "iana" + }, + "message/delivery-status": { + "source": "iana" + }, + "message/disposition-notification": { + "source": "iana", + "extensions": [ + "disposition-notification" + ] + }, + "message/external-body": { + "source": "iana" + }, + "message/feedback-report": { + "source": "iana" + }, + "message/global": { + "source": "iana", + "extensions": ["u8msg"] + }, + "message/global-delivery-status": { + "source": "iana", + "extensions": ["u8dsn"] + }, + "message/global-disposition-notification": { + "source": "iana", + "extensions": ["u8mdn"] + }, + "message/global-headers": { + "source": "iana", + "extensions": ["u8hdr"] + }, + "message/http": { + "source": "iana", + "compressible": false + }, + "message/imdn+xml": { + "source": "iana", + "compressible": true + }, + "message/news": { + "source": "iana" + }, + "message/partial": { + "source": "iana", + "compressible": false + }, + "message/rfc822": { + "source": "iana", + "compressible": true, + "extensions": ["eml","mime"] + }, + "message/s-http": { + "source": "iana" + }, + "message/sip": { + "source": "iana" + }, + "message/sipfrag": { + "source": "iana" + }, + "message/tracking-status": { + "source": "iana" + }, + "message/vnd.si.simp": { + "source": "iana" + }, + "message/vnd.wfa.wsc": { + "source": "iana", + "extensions": ["wsc"] + }, + "model/3mf": { + "source": "iana" + }, + "model/gltf+json": { + "source": "iana", + "compressible": true, + "extensions": ["gltf"] + }, + "model/gltf-binary": { + "source": "iana", + "compressible": true, + "extensions": ["glb"] + }, + "model/iges": { + "source": "iana", + "compressible": false, + "extensions": ["igs","iges"] + }, + "model/mesh": { + "source": "iana", + "compressible": false, + "extensions": ["msh","mesh","silo"] + }, + "model/vnd.collada+xml": { + "source": "iana", + "extensions": ["dae"] + }, + "model/vnd.dwf": { + "source": "iana", + "extensions": ["dwf"] + }, + "model/vnd.flatland.3dml": { + "source": "iana" + }, + "model/vnd.gdl": { + "source": "iana", + "extensions": ["gdl"] + }, + "model/vnd.gs-gdl": { + "source": "apache" + }, + "model/vnd.gs.gdl": { + "source": "iana" + }, + "model/vnd.gtw": { + "source": "iana", + "extensions": ["gtw"] + }, + "model/vnd.moml+xml": { + "source": "iana" + }, + "model/vnd.mts": { + "source": "iana", + "extensions": ["mts"] + }, + "model/vnd.opengex": { + "source": "iana" + }, + "model/vnd.parasolid.transmit.binary": { + "source": "iana" + }, + "model/vnd.parasolid.transmit.text": { + "source": "iana" + }, + "model/vnd.rosette.annotated-data-model": { + "source": "iana" + }, + "model/vnd.valve.source.compiled-map": { + "source": "iana" + }, + "model/vnd.vtu": { + "source": "iana", + "extensions": ["vtu"] + }, + "model/vrml": { + "source": "iana", + "compressible": false, + "extensions": ["wrl","vrml"] + }, + "model/x3d+binary": { + "source": "apache", + "compressible": false, + "extensions": ["x3db","x3dbz"] + }, + "model/x3d+fastinfoset": { + "source": "iana" + }, + "model/x3d+vrml": { + "source": "apache", + "compressible": false, + "extensions": ["x3dv","x3dvz"] + }, + "model/x3d+xml": { + "source": "iana", + "compressible": true, + "extensions": ["x3d","x3dz"] + }, + "model/x3d-vrml": { + "source": "iana" + }, + "multipart/alternative": { + "source": "iana", + "compressible": false + }, + "multipart/appledouble": { + "source": "iana" + }, + "multipart/byteranges": { + "source": "iana" + }, + "multipart/digest": { + "source": "iana" + }, + "multipart/encrypted": { + "source": "iana", + "compressible": false + }, + "multipart/form-data": { + "source": "iana", + "compressible": false + }, + "multipart/header-set": { + "source": "iana" + }, + "multipart/mixed": { + "source": "iana", + "compressible": false + }, + "multipart/multilingual": { + "source": "iana" + }, + "multipart/parallel": { + "source": "iana" + }, + "multipart/related": { + "source": "iana", + "compressible": false + }, + "multipart/report": { + "source": "iana" + }, + "multipart/signed": { + "source": "iana", + "compressible": false + }, + "multipart/vnd.bint.med-plus": { + "source": "iana" + }, + "multipart/voice-message": { + "source": "iana" + }, + "multipart/x-mixed-replace": { + "source": "iana" + }, + "text/1d-interleaved-parityfec": { + "source": "iana" + }, + "text/cache-manifest": { + "source": "iana", + "compressible": true, + "extensions": ["appcache","manifest"] + }, + "text/calendar": { + "source": "iana", + "extensions": ["ics","ifb"] + }, + "text/calender": { + "compressible": true + }, + "text/cmd": { + "compressible": true + }, + "text/coffeescript": { + "extensions": ["coffee","litcoffee"] + }, + "text/css": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["css"] + }, + "text/csv": { + "source": "iana", + "compressible": true, + "extensions": ["csv"] + }, + "text/csv-schema": { + "source": "iana" + }, + "text/directory": { + "source": "iana" + }, + "text/dns": { + "source": "iana" + }, + "text/ecmascript": { + "source": "iana" + }, + "text/encaprtp": { + "source": "iana" + }, + "text/enriched": { + "source": "iana" + }, + "text/fwdred": { + "source": "iana" + }, + "text/grammar-ref-list": { + "source": "iana" + }, + "text/html": { + "source": "iana", + "compressible": true, + "extensions": ["html","htm","shtml"] + }, + "text/jade": { + "extensions": ["jade"] + }, + "text/javascript": { + "source": "iana", + "compressible": true + }, + "text/jcr-cnd": { + "source": "iana" + }, + "text/jsx": { + "compressible": true, + "extensions": ["jsx"] + }, + "text/less": { + "extensions": ["less"] + }, + "text/markdown": { + "source": "iana", + "compressible": true, + "extensions": ["markdown","md"] + }, + "text/mathml": { + "source": "nginx", + "extensions": ["mml"] + }, + "text/mizar": { + "source": "iana" + }, + "text/n3": { + "source": "iana", + "compressible": true, + "extensions": ["n3"] + }, + "text/parameters": { + "source": "iana" + }, + "text/parityfec": { + "source": "iana" + }, + "text/plain": { + "source": "iana", + "compressible": true, + "extensions": ["txt","text","conf","def","list","log","in","ini"] + }, + "text/provenance-notation": { + "source": "iana" + }, + "text/prs.fallenstein.rst": { + "source": "iana" + }, + "text/prs.lines.tag": { + "source": "iana", + "extensions": ["dsc"] + }, + "text/prs.prop.logic": { + "source": "iana" + }, + "text/raptorfec": { + "source": "iana" + }, + "text/red": { + "source": "iana" + }, + "text/rfc822-headers": { + "source": "iana" + }, + "text/richtext": { + "source": "iana", + "compressible": true, + "extensions": ["rtx"] + }, + "text/rtf": { + "source": "iana", + "compressible": true, + "extensions": ["rtf"] + }, + "text/rtp-enc-aescm128": { + "source": "iana" + }, + "text/rtploopback": { + "source": "iana" + }, + "text/rtx": { + "source": "iana" + }, + "text/sgml": { + "source": "iana", + "extensions": ["sgml","sgm"] + }, + "text/shex": { + "extensions": ["shex"] + }, + "text/slim": { + "extensions": ["slim","slm"] + }, + "text/strings": { + "source": "iana" + }, + "text/stylus": { + "extensions": ["stylus","styl"] + }, + "text/t140": { + "source": "iana" + }, + "text/tab-separated-values": { + "source": "iana", + "compressible": true, + "extensions": ["tsv"] + }, + "text/troff": { + "source": "iana", + "extensions": ["t","tr","roff","man","me","ms"] + }, + "text/turtle": { + "source": "iana", + "extensions": ["ttl"] + }, + "text/ulpfec": { + "source": "iana" + }, + "text/uri-list": { + "source": "iana", + "compressible": true, + "extensions": ["uri","uris","urls"] + }, + "text/vcard": { + "source": "iana", + "compressible": true, + "extensions": ["vcard"] + }, + "text/vnd.a": { + "source": "iana" + }, + "text/vnd.abc": { + "source": "iana" + }, + "text/vnd.ascii-art": { + "source": "iana" + }, + "text/vnd.curl": { + "source": "iana", + "extensions": ["curl"] + }, + "text/vnd.curl.dcurl": { + "source": "apache", + "extensions": ["dcurl"] + }, + "text/vnd.curl.mcurl": { + "source": "apache", + "extensions": ["mcurl"] + }, + "text/vnd.curl.scurl": { + "source": "apache", + "extensions": ["scurl"] + }, + "text/vnd.debian.copyright": { + "source": "iana" + }, + "text/vnd.dmclientscript": { + "source": "iana" + }, + "text/vnd.dvb.subtitle": { + "source": "iana", + "extensions": ["sub"] + }, + "text/vnd.esmertec.theme-descriptor": { + "source": "iana" + }, + "text/vnd.fly": { + "source": "iana", + "extensions": ["fly"] + }, + "text/vnd.fmi.flexstor": { + "source": "iana", + "extensions": ["flx"] + }, + "text/vnd.graphviz": { + "source": "iana", + "extensions": ["gv"] + }, + "text/vnd.in3d.3dml": { + "source": "iana", + "extensions": ["3dml"] + }, + "text/vnd.in3d.spot": { + "source": "iana", + "extensions": ["spot"] + }, + "text/vnd.iptc.newsml": { + "source": "iana" + }, + "text/vnd.iptc.nitf": { + "source": "iana" + }, + "text/vnd.latex-z": { + "source": "iana" + }, + "text/vnd.motorola.reflex": { + "source": "iana" + }, + "text/vnd.ms-mediapackage": { + "source": "iana" + }, + "text/vnd.net2phone.commcenter.command": { + "source": "iana" + }, + "text/vnd.radisys.msml-basic-layout": { + "source": "iana" + }, + "text/vnd.si.uricatalogue": { + "source": "iana" + }, + "text/vnd.sun.j2me.app-descriptor": { + "source": "iana", + "extensions": ["jad"] + }, + "text/vnd.trolltech.linguist": { + "source": "iana" + }, + "text/vnd.wap.si": { + "source": "iana" + }, + "text/vnd.wap.sl": { + "source": "iana" + }, + "text/vnd.wap.wml": { + "source": "iana", + "extensions": ["wml"] + }, + "text/vnd.wap.wmlscript": { + "source": "iana", + "extensions": ["wmls"] + }, + "text/vtt": { + "charset": "UTF-8", + "compressible": true, + "extensions": ["vtt"] + }, + "text/x-asm": { + "source": "apache", + "extensions": ["s","asm"] + }, + "text/x-c": { + "source": "apache", + "extensions": ["c","cc","cxx","cpp","h","hh","dic"] + }, + "text/x-component": { + "source": "nginx", + "extensions": ["htc"] + }, + "text/x-fortran": { + "source": "apache", + "extensions": ["f","for","f77","f90"] + }, + "text/x-gwt-rpc": { + "compressible": true + }, + "text/x-handlebars-template": { + "extensions": ["hbs"] + }, + "text/x-java-source": { + "source": "apache", + "extensions": ["java"] + }, + "text/x-jquery-tmpl": { + "compressible": true + }, + "text/x-lua": { + "extensions": ["lua"] + }, + "text/x-markdown": { + "compressible": true, + "extensions": ["mkd"] + }, + "text/x-nfo": { + "source": "apache", + "extensions": ["nfo"] + }, + "text/x-opml": { + "source": "apache", + "extensions": ["opml"] + }, + "text/x-org": { + "compressible": true, + "extensions": ["org"] + }, + "text/x-pascal": { + "source": "apache", + "extensions": ["p","pas"] + }, + "text/x-processing": { + "compressible": true, + "extensions": ["pde"] + }, + "text/x-sass": { + "extensions": ["sass"] + }, + "text/x-scss": { + "extensions": ["scss"] + }, + "text/x-setext": { + "source": "apache", + "extensions": ["etx"] + }, + "text/x-sfv": { + "source": "apache", + "extensions": ["sfv"] + }, + "text/x-suse-ymp": { + "compressible": true, + "extensions": ["ymp"] + }, + "text/x-uuencode": { + "source": "apache", + "extensions": ["uu"] + }, + "text/x-vcalendar": { + "source": "apache", + "extensions": ["vcs"] + }, + "text/x-vcard": { + "source": "apache", + "extensions": ["vcf"] + }, + "text/xml": { + "source": "iana", + "compressible": true, + "extensions": ["xml"] + }, + "text/xml-external-parsed-entity": { + "source": "iana" + }, + "text/yaml": { + "extensions": ["yaml","yml"] + }, + "video/1d-interleaved-parityfec": { + "source": "iana" + }, + "video/3gpp": { + "source": "iana", + "extensions": ["3gp","3gpp"] + }, + "video/3gpp-tt": { + "source": "iana" + }, + "video/3gpp2": { + "source": "iana", + "extensions": ["3g2"] + }, + "video/bmpeg": { + "source": "iana" + }, + "video/bt656": { + "source": "iana" + }, + "video/celb": { + "source": "iana" + }, + "video/dv": { + "source": "iana" + }, + "video/encaprtp": { + "source": "iana" + }, + "video/h261": { + "source": "iana", + "extensions": ["h261"] + }, + "video/h263": { + "source": "iana", + "extensions": ["h263"] + }, + "video/h263-1998": { + "source": "iana" + }, + "video/h263-2000": { + "source": "iana" + }, + "video/h264": { + "source": "iana", + "extensions": ["h264"] + }, + "video/h264-rcdo": { + "source": "iana" + }, + "video/h264-svc": { + "source": "iana" + }, + "video/h265": { + "source": "iana" + }, + "video/iso.segment": { + "source": "iana" + }, + "video/jpeg": { + "source": "iana", + "extensions": ["jpgv"] + }, + "video/jpeg2000": { + "source": "iana" + }, + "video/jpm": { + "source": "apache", + "extensions": ["jpm","jpgm"] + }, + "video/mj2": { + "source": "iana", + "extensions": ["mj2","mjp2"] + }, + "video/mp1s": { + "source": "iana" + }, + "video/mp2p": { + "source": "iana" + }, + "video/mp2t": { + "source": "iana", + "extensions": ["ts"] + }, + "video/mp4": { + "source": "iana", + "compressible": false, + "extensions": ["mp4","mp4v","mpg4"] + }, + "video/mp4v-es": { + "source": "iana" + }, + "video/mpeg": { + "source": "iana", + "compressible": false, + "extensions": ["mpeg","mpg","mpe","m1v","m2v"] + }, + "video/mpeg4-generic": { + "source": "iana" + }, + "video/mpv": { + "source": "iana" + }, + "video/nv": { + "source": "iana" + }, + "video/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["ogv"] + }, + "video/parityfec": { + "source": "iana" + }, + "video/pointer": { + "source": "iana" + }, + "video/quicktime": { + "source": "iana", + "compressible": false, + "extensions": ["qt","mov"] + }, + "video/raptorfec": { + "source": "iana" + }, + "video/raw": { + "source": "iana" + }, + "video/rtp-enc-aescm128": { + "source": "iana" + }, + "video/rtploopback": { + "source": "iana" + }, + "video/rtx": { + "source": "iana" + }, + "video/smpte291": { + "source": "iana" + }, + "video/smpte292m": { + "source": "iana" + }, + "video/ulpfec": { + "source": "iana" + }, + "video/vc1": { + "source": "iana" + }, + "video/vnd.cctv": { + "source": "iana" + }, + "video/vnd.dece.hd": { + "source": "iana", + "extensions": ["uvh","uvvh"] + }, + "video/vnd.dece.mobile": { + "source": "iana", + "extensions": ["uvm","uvvm"] + }, + "video/vnd.dece.mp4": { + "source": "iana" + }, + "video/vnd.dece.pd": { + "source": "iana", + "extensions": ["uvp","uvvp"] + }, + "video/vnd.dece.sd": { + "source": "iana", + "extensions": ["uvs","uvvs"] + }, + "video/vnd.dece.video": { + "source": "iana", + "extensions": ["uvv","uvvv"] + }, + "video/vnd.directv.mpeg": { + "source": "iana" + }, + "video/vnd.directv.mpeg-tts": { + "source": "iana" + }, + "video/vnd.dlna.mpeg-tts": { + "source": "iana" + }, + "video/vnd.dvb.file": { + "source": "iana", + "extensions": ["dvb"] + }, + "video/vnd.fvt": { + "source": "iana", + "extensions": ["fvt"] + }, + "video/vnd.hns.video": { + "source": "iana" + }, + "video/vnd.iptvforum.1dparityfec-1010": { + "source": "iana" + }, + "video/vnd.iptvforum.1dparityfec-2005": { + "source": "iana" + }, + "video/vnd.iptvforum.2dparityfec-1010": { + "source": "iana" + }, + "video/vnd.iptvforum.2dparityfec-2005": { + "source": "iana" + }, + "video/vnd.iptvforum.ttsavc": { + "source": "iana" + }, + "video/vnd.iptvforum.ttsmpeg2": { + "source": "iana" + }, + "video/vnd.motorola.video": { + "source": "iana" + }, + "video/vnd.motorola.videop": { + "source": "iana" + }, + "video/vnd.mpegurl": { + "source": "iana", + "extensions": ["mxu","m4u"] + }, + "video/vnd.ms-playready.media.pyv": { + "source": "iana", + "extensions": ["pyv"] + }, + "video/vnd.nokia.interleaved-multimedia": { + "source": "iana" + }, + "video/vnd.nokia.mp4vr": { + "source": "iana" + }, + "video/vnd.nokia.videovoip": { + "source": "iana" + }, + "video/vnd.objectvideo": { + "source": "iana" + }, + "video/vnd.radgamettools.bink": { + "source": "iana" + }, + "video/vnd.radgamettools.smacker": { + "source": "iana" + }, + "video/vnd.sealed.mpeg1": { + "source": "iana" + }, + "video/vnd.sealed.mpeg4": { + "source": "iana" + }, + "video/vnd.sealed.swf": { + "source": "iana" + }, + "video/vnd.sealedmedia.softseal.mov": { + "source": "iana" + }, + "video/vnd.uvvu.mp4": { + "source": "iana", + "extensions": ["uvu","uvvu"] + }, + "video/vnd.vivo": { + "source": "iana", + "extensions": ["viv"] + }, + "video/vp8": { + "source": "iana" + }, + "video/webm": { + "source": "apache", + "compressible": false, + "extensions": ["webm"] + }, + "video/x-f4v": { + "source": "apache", + "extensions": ["f4v"] + }, + "video/x-fli": { + "source": "apache", + "extensions": ["fli"] + }, + "video/x-flv": { + "source": "apache", + "compressible": false, + "extensions": ["flv"] + }, + "video/x-m4v": { + "source": "apache", + "extensions": ["m4v"] + }, + "video/x-matroska": { + "source": "apache", + "compressible": false, + "extensions": ["mkv","mk3d","mks"] + }, + "video/x-mng": { + "source": "apache", + "extensions": ["mng"] + }, + "video/x-ms-asf": { + "source": "apache", + "extensions": ["asf","asx"] + }, + "video/x-ms-vob": { + "source": "apache", + "extensions": ["vob"] + }, + "video/x-ms-wm": { + "source": "apache", + "extensions": ["wm"] + }, + "video/x-ms-wmv": { + "source": "apache", + "compressible": false, + "extensions": ["wmv"] + }, + "video/x-ms-wmx": { + "source": "apache", + "extensions": ["wmx"] + }, + "video/x-ms-wvx": { + "source": "apache", + "extensions": ["wvx"] + }, + "video/x-msvideo": { + "source": "apache", + "extensions": ["avi"] + }, + "video/x-sgi-movie": { + "source": "apache", + "extensions": ["movie"] + }, + "video/x-smv": { + "source": "apache", + "extensions": ["smv"] + }, + "x-conference/x-cooltalk": { + "source": "apache", + "extensions": ["ice"] + }, + "x-shader/x-fragment": { + "compressible": true + }, + "x-shader/x-vertex": { + "compressible": true + } +} diff --git a/appasar/canary/node_modules/mime-db/index.js b/appasar/canary/node_modules/mime-db/index.js new file mode 100644 index 0000000..551031f --- /dev/null +++ b/appasar/canary/node_modules/mime-db/index.js @@ -0,0 +1,11 @@ +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * MIT Licensed + */ + +/** + * Module exports. + */ + +module.exports = require('./db.json') diff --git a/appasar/canary/node_modules/mime-db/package.json b/appasar/canary/node_modules/mime-db/package.json new file mode 100644 index 0000000..134c809 --- /dev/null +++ b/appasar/canary/node_modules/mime-db/package.json @@ -0,0 +1,57 @@ +{ + "name": "mime-db", + "description": "Media Type Database", + "version": "1.33.0", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)", + "Robert Kieffer (http://github.com/broofa)" + ], + "license": "MIT", + "keywords": [ + "mime", + "db", + "type", + "types", + "database", + "charset", + "charsets" + ], + "repository": "jshttp/mime-db", + "devDependencies": { + "bluebird": "3.5.1", + "co": "4.6.0", + "cogent": "1.0.1", + "csv-parse": "1.3.1", + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.8.0", + "eslint-plugin-node": "5.2.1", + "eslint-plugin-promise": "3.6.0", + "eslint-plugin-standard": "3.0.1", + "gnode": "0.1.2", + "mocha": "1.21.5", + "nyc": "11.4.1", + "raw-body": "2.3.2", + "stream-to-array": "2.3.0" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "db.json", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "build": "node scripts/build", + "fetch": "gnode scripts/fetch-apache && gnode scripts/fetch-iana && gnode scripts/fetch-nginx", + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "test-travis": "nyc --reporter=text npm test", + "update": "npm run fetch && npm run build" + } +} diff --git a/appasar/canary/node_modules/mime-types/HISTORY.md b/appasar/canary/node_modules/mime-types/HISTORY.md new file mode 100644 index 0000000..ecdc59a --- /dev/null +++ b/appasar/canary/node_modules/mime-types/HISTORY.md @@ -0,0 +1,260 @@ +2.1.18 / 2018-02-16 +=================== + + * deps: mime-db@~1.33.0 + - Add `application/raml+yaml` with extension `.raml` + - Add `application/wasm` with extension `.wasm` + - Add `text/shex` with extension `.shex` + - Add extensions for JPEG-2000 images + - Add extensions from IANA for `message/*` types + - Add new upstream MIME types + - Update font MIME types + - Update `text/hjson` to registered `application/hjson` + +2.1.17 / 2017-09-01 +=================== + + * deps: mime-db@~1.30.0 + - Add `application/vnd.ms-outlook` + - Add `application/x-arj` + - Add extension `.mjs` to `application/javascript` + - Add glTF types and extensions + - Add new upstream MIME types + - Add `text/x-org` + - Add VirtualBox MIME types + - Fix `source` records for `video/*` types that are IANA + - Update `font/opentype` to registered `font/otf` + +2.1.16 / 2017-07-24 +=================== + + * deps: mime-db@~1.29.0 + - Add `application/fido.trusted-apps+json` + - Add extension `.wadl` to `application/vnd.sun.wadl+xml` + - Add extension `.gz` to `application/gzip` + - Add new upstream MIME types + - Update extensions `.md` and `.markdown` to be `text/markdown` + +2.1.15 / 2017-03-23 +=================== + + * deps: mime-db@~1.27.0 + - Add new mime types + - Add `image/apng` + +2.1.14 / 2017-01-14 +=================== + + * deps: mime-db@~1.26.0 + - Add new mime types + +2.1.13 / 2016-11-18 +=================== + + * deps: mime-db@~1.25.0 + - Add new mime types + +2.1.12 / 2016-09-18 +=================== + + * deps: mime-db@~1.24.0 + - Add new mime types + - Add `audio/mp3` + +2.1.11 / 2016-05-01 +=================== + + * deps: mime-db@~1.23.0 + - Add new mime types + +2.1.10 / 2016-02-15 +=================== + + * deps: mime-db@~1.22.0 + - Add new mime types + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + +2.1.9 / 2016-01-06 +================== + + * deps: mime-db@~1.21.0 + - Add new mime types + +2.1.8 / 2015-11-30 +================== + + * deps: mime-db@~1.20.0 + - Add new mime types + +2.1.7 / 2015-09-20 +================== + + * deps: mime-db@~1.19.0 + - Add new mime types + +2.1.6 / 2015-09-03 +================== + + * deps: mime-db@~1.18.0 + - Add new mime types + +2.1.5 / 2015-08-20 +================== + + * deps: mime-db@~1.17.0 + - Add new mime types + +2.1.4 / 2015-07-30 +================== + + * deps: mime-db@~1.16.0 + - Add new mime types + +2.1.3 / 2015-07-13 +================== + + * deps: mime-db@~1.15.0 + - Add new mime types + +2.1.2 / 2015-06-25 +================== + + * deps: mime-db@~1.14.0 + - Add new mime types + +2.1.1 / 2015-06-08 +================== + + * perf: fix deopt during mapping + +2.1.0 / 2015-06-07 +================== + + * Fix incorrectly treating extension-less file name as extension + - i.e. `'path/to/json'` will no longer return `application/json` + * Fix `.charset(type)` to accept parameters + * Fix `.charset(type)` to match case-insensitive + * Improve generation of extension to MIME mapping + * Refactor internals for readability and no argument reassignment + * Prefer `application/*` MIME types from the same source + * Prefer any type over `application/octet-stream` + * deps: mime-db@~1.13.0 + - Add nginx as a source + - Add new mime types + +2.0.14 / 2015-06-06 +=================== + + * deps: mime-db@~1.12.0 + - Add new mime types + +2.0.13 / 2015-05-31 +=================== + + * deps: mime-db@~1.11.0 + - Add new mime types + +2.0.12 / 2015-05-19 +=================== + + * deps: mime-db@~1.10.0 + - Add new mime types + +2.0.11 / 2015-05-05 +=================== + + * deps: mime-db@~1.9.1 + - Add new mime types + +2.0.10 / 2015-03-13 +=================== + + * deps: mime-db@~1.8.0 + - Add new mime types + +2.0.9 / 2015-02-09 +================== + + * deps: mime-db@~1.7.0 + - Add new mime types + - Community extensions ownership transferred from `node-mime` + +2.0.8 / 2015-01-29 +================== + + * deps: mime-db@~1.6.0 + - Add new mime types + +2.0.7 / 2014-12-30 +================== + + * deps: mime-db@~1.5.0 + - Add new mime types + - Fix various invalid MIME type entries + +2.0.6 / 2014-12-30 +================== + + * deps: mime-db@~1.4.0 + - Add new mime types + - Fix various invalid MIME type entries + - Remove example template MIME types + +2.0.5 / 2014-12-29 +================== + + * deps: mime-db@~1.3.1 + - Fix missing extensions + +2.0.4 / 2014-12-10 +================== + + * deps: mime-db@~1.3.0 + - Add new mime types + +2.0.3 / 2014-11-09 +================== + + * deps: mime-db@~1.2.0 + - Add new mime types + +2.0.2 / 2014-09-28 +================== + + * deps: mime-db@~1.1.0 + - Add new mime types + - Add additional compressible + - Update charsets + +2.0.1 / 2014-09-07 +================== + + * Support Node.js 0.6 + +2.0.0 / 2014-09-02 +================== + + * Use `mime-db` + * Remove `.define()` + +1.0.2 / 2014-08-04 +================== + + * Set charset=utf-8 for `text/javascript` + +1.0.1 / 2014-06-24 +================== + + * Add `text/jsx` type + +1.0.0 / 2014-05-12 +================== + + * Return `false` for unknown types + * Set charset=utf-8 for `application/json` + +0.1.0 / 2014-05-02 +================== + + * Initial release diff --git a/appasar/canary/node_modules/mime-types/LICENSE b/appasar/canary/node_modules/mime-types/LICENSE new file mode 100644 index 0000000..0616607 --- /dev/null +++ b/appasar/canary/node_modules/mime-types/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/mime-types/README.md b/appasar/canary/node_modules/mime-types/README.md new file mode 100644 index 0000000..b58cae6 --- /dev/null +++ b/appasar/canary/node_modules/mime-types/README.md @@ -0,0 +1,108 @@ +# mime-types + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +The ultimate javascript content-type utility. + +Similar to [the `mime@1.x` module](https://www.npmjs.com/package/mime), except: + +- __No fallbacks.__ Instead of naively returning the first available type, + `mime-types` simply returns `false`, so do + `var type = mime.lookup('unrecognized') || 'application/octet-stream'`. +- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`. +- No `.define()` functionality +- Bug fixes for `.lookup(path)` + +Otherwise, the API is compatible with `mime` 1.x. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install mime-types +``` + +## Adding Types + +All mime types are based on [mime-db](https://www.npmjs.com/package/mime-db), +so open a PR there if you'd like to add mime types. + +## API + +```js +var mime = require('mime-types') +``` + +All functions return `false` if input is invalid or not found. + +### mime.lookup(path) + +Lookup the content-type associated with a file. + +```js +mime.lookup('json') // 'application/json' +mime.lookup('.md') // 'text/markdown' +mime.lookup('file.html') // 'text/html' +mime.lookup('folder/file.js') // 'application/javascript' +mime.lookup('folder/.htaccess') // false + +mime.lookup('cats') // false +``` + +### mime.contentType(type) + +Create a full content-type header given a content-type or extension. + +```js +mime.contentType('markdown') // 'text/x-markdown; charset=utf-8' +mime.contentType('file.json') // 'application/json; charset=utf-8' + +// from a full path +mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8' +``` + +### mime.extension(type) + +Get the default extension for a content-type. + +```js +mime.extension('application/octet-stream') // 'bin' +``` + +### mime.charset(type) + +Lookup the implied default charset of a content-type. + +```js +mime.charset('text/markdown') // 'UTF-8' +``` + +### var type = mime.types[extension] + +A map of content-types by extension. + +### [extensions...] = mime.extensions[type] + +A map of extensions by content-type. + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/mime-types.svg +[npm-url]: https://npmjs.org/package/mime-types +[node-version-image]: https://img.shields.io/node/v/mime-types.svg +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/jshttp/mime-types/master.svg +[travis-url]: https://travis-ci.org/jshttp/mime-types +[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-types/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/mime-types +[downloads-image]: https://img.shields.io/npm/dm/mime-types.svg +[downloads-url]: https://npmjs.org/package/mime-types diff --git a/appasar/canary/node_modules/mime-types/index.js b/appasar/canary/node_modules/mime-types/index.js new file mode 100644 index 0000000..b9f34d5 --- /dev/null +++ b/appasar/canary/node_modules/mime-types/index.js @@ -0,0 +1,188 @@ +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var db = require('mime-db') +var extname = require('path').extname + +/** + * Module variables. + * @private + */ + +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i + +/** + * Module exports. + * @public + */ + +exports.charset = charset +exports.charsets = { lookup: charset } +exports.contentType = contentType +exports.extension = extension +exports.extensions = Object.create(null) +exports.lookup = lookup +exports.types = Object.create(null) + +// Populate the extensions/types maps +populateMaps(exports.extensions, exports.types) + +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && db[match[1].toLowerCase()] + + if (mime && mime.charset) { + return mime.charset + } + + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } + + return false +} + +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {boolean|string} + */ + +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } + + var mime = str.indexOf('/') === -1 + ? exports.lookup(str) + : str + + if (!mime) { + return false + } + + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } + + return mime +} + +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + + // get extensions + var exts = match && exports.extensions[match[1].toLowerCase()] + + if (!exts || !exts.length) { + return false + } + + return exts[0] +} + +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {boolean|string} + */ + +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } + + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .substr(1) + + if (!extension) { + return false + } + + return exports.types[extension] || false +} + +/** + * Populate the extensions and types maps. + * @private + */ + +function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] + + Object.keys(db).forEach(function forEachMimeType (type) { + var mime = db[type] + var exts = mime.extensions + + if (!exts || !exts.length) { + return + } + + // mime -> extensions + extensions[type] = exts + + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] + + if (types[extension]) { + var from = preference.indexOf(db[types[extension]].source) + var to = preference.indexOf(mime.source) + + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } + } + + // set the extension -> mime + types[extension] = type + } + }) +} diff --git a/appasar/canary/node_modules/mime-types/package.json b/appasar/canary/node_modules/mime-types/package.json new file mode 100644 index 0000000..3394e9e --- /dev/null +++ b/appasar/canary/node_modules/mime-types/package.json @@ -0,0 +1,43 @@ +{ + "name": "mime-types", + "description": "The ultimate javascript content-type utility.", + "version": "2.1.18", + "contributors": [ + "Douglas Christopher Wilson ", + "Jeremiah Senkpiel (https://searchbeam.jit.su)", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "keywords": [ + "mime", + "types" + ], + "repository": "jshttp/mime-types", + "dependencies": { + "mime-db": "~1.33.0" + }, + "devDependencies": { + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.8.0", + "eslint-plugin-node": "5.2.1", + "eslint-plugin-promise": "3.6.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "1.21.5" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec test/test.js", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js" + } +} diff --git a/appasar/canary/node_modules/minimatch/LICENSE b/appasar/canary/node_modules/minimatch/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/appasar/canary/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/minimatch/README.md b/appasar/canary/node_modules/minimatch/README.md new file mode 100644 index 0000000..ad72b81 --- /dev/null +++ b/appasar/canary/node_modules/minimatch/README.md @@ -0,0 +1,209 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.svg)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/appasar/canary/node_modules/minimatch/minimatch.js b/appasar/canary/node_modules/minimatch/minimatch.js new file mode 100644 index 0000000..5b5f8cf --- /dev/null +++ b/appasar/canary/node_modules/minimatch/minimatch.js @@ -0,0 +1,923 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long') + } + + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/appasar/canary/node_modules/minimatch/package.json b/appasar/canary/node_modules/minimatch/package.json new file mode 100644 index 0000000..c4514c8 --- /dev/null +++ b/appasar/canary/node_modules/minimatch/package.json @@ -0,0 +1,30 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "3.0.4", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "test": "tap test/*.js --cov", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "devDependencies": { + "tap": "^10.3.2" + }, + "license": "ISC", + "files": [ + "minimatch.js" + ] +} diff --git a/appasar/canary/node_modules/minimist/.travis.yml b/appasar/canary/node_modules/minimist/.travis.yml new file mode 100644 index 0000000..cc4dba2 --- /dev/null +++ b/appasar/canary/node_modules/minimist/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/appasar/canary/node_modules/minimist/LICENSE b/appasar/canary/node_modules/minimist/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/appasar/canary/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/minimist/example/parse.js b/appasar/canary/node_modules/minimist/example/parse.js new file mode 100644 index 0000000..abff3e8 --- /dev/null +++ b/appasar/canary/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.dir(argv); diff --git a/appasar/canary/node_modules/minimist/index.js b/appasar/canary/node_modules/minimist/index.js new file mode 100644 index 0000000..584f551 --- /dev/null +++ b/appasar/canary/node_modules/minimist/index.js @@ -0,0 +1,187 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {} }; + + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + }); + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function setArg (key, val) { + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + setArg(m[1], m[2]); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, next); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true'); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2)); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !flags.bools[aliases[key]] : true)) { + setArg(key, args[i+1]); + i++; + } + else if (args[i+1] && /true|false/.test(args[i+1])) { + setArg(key, args[i+1] === 'true'); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true); + } + } + } + else { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + notFlags.forEach(function(key) { + argv._.push(key); + }); + + return argv; +}; + +function hasKey (obj, keys) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + o = (o[key] || {}); + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function setKey (obj, keys, value) { + var o = obj; + keys.slice(0,-1).forEach(function (key) { + if (o[key] === undefined) o[key] = {}; + o = o[key]; + }); + + var key = keys[keys.length - 1]; + if (o[key] === undefined || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } +} + +function isNumber (x) { + if (typeof x === 'number') return true; + if (/^0x[0-9a-f]+$/i.test(x)) return true; + return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); +} + +function longest (xs) { + return Math.max.apply(null, xs.map(function (x) { return x.length })); +} diff --git a/appasar/canary/node_modules/minimist/package.json b/appasar/canary/node_modules/minimist/package.json new file mode 100644 index 0000000..af6250b --- /dev/null +++ b/appasar/canary/node_modules/minimist/package.json @@ -0,0 +1,40 @@ +{ + "name": "minimist", + "version": "0.0.8", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "tape": "~1.0.4", + "tap": "~0.4.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : [ + "ie/6..latest", + "ff/5", "firefox/latest", + "chrome/10", "chrome/latest", + "safari/5.1", "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT" +} diff --git a/appasar/canary/node_modules/minimist/readme.markdown b/appasar/canary/node_modules/minimist/readme.markdown new file mode 100644 index 0000000..c256353 --- /dev/null +++ b/appasar/canary/node_modules/minimist/readme.markdown @@ -0,0 +1,73 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) + +[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.dir(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a string or array of strings to always treat as booleans +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/appasar/canary/node_modules/minimist/test/dash.js b/appasar/canary/node_modules/minimist/test/dash.js new file mode 100644 index 0000000..8b034b9 --- /dev/null +++ b/appasar/canary/node_modules/minimist/test/dash.js @@ -0,0 +1,24 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); diff --git a/appasar/canary/node_modules/minimist/test/default_bool.js b/appasar/canary/node_modules/minimist/test/default_bool.js new file mode 100644 index 0000000..f0041ee --- /dev/null +++ b/appasar/canary/node_modules/minimist/test/default_bool.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); diff --git a/appasar/canary/node_modules/minimist/test/dotted.js b/appasar/canary/node_modules/minimist/test/dotted.js new file mode 100644 index 0000000..ef0ae34 --- /dev/null +++ b/appasar/canary/node_modules/minimist/test/dotted.js @@ -0,0 +1,16 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); diff --git a/appasar/canary/node_modules/minimist/test/long.js b/appasar/canary/node_modules/minimist/test/long.js new file mode 100644 index 0000000..5d3a1e0 --- /dev/null +++ b/appasar/canary/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/appasar/canary/node_modules/minimist/test/parse.js b/appasar/canary/node_modules/minimist/test/parse.js new file mode 100644 index 0000000..8a90646 --- /dev/null +++ b/appasar/canary/node_modules/minimist/test/parse.js @@ -0,0 +1,318 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); + +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); diff --git a/appasar/canary/node_modules/minimist/test/parse_modified.js b/appasar/canary/node_modules/minimist/test/parse_modified.js new file mode 100644 index 0000000..21851b0 --- /dev/null +++ b/appasar/canary/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: ['123'] }); +}); diff --git a/appasar/canary/node_modules/minimist/test/short.js b/appasar/canary/node_modules/minimist/test/short.js new file mode 100644 index 0000000..d513a1c --- /dev/null +++ b/appasar/canary/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/appasar/canary/node_modules/minimist/test/whitespace.js b/appasar/canary/node_modules/minimist/test/whitespace.js new file mode 100644 index 0000000..8a52a58 --- /dev/null +++ b/appasar/canary/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/appasar/canary/node_modules/mkdirp/.travis.yml b/appasar/canary/node_modules/mkdirp/.travis.yml new file mode 100644 index 0000000..74c57bf --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.12" + - "iojs" +before_install: + - npm install -g npm@~1.4.6 diff --git a/appasar/canary/node_modules/mkdirp/LICENSE b/appasar/canary/node_modules/mkdirp/LICENSE new file mode 100644 index 0000000..432d1ae --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 license: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/appasar/canary/node_modules/mkdirp/bin/cmd.js b/appasar/canary/node_modules/mkdirp/bin/cmd.js new file mode 100644 index 0000000..d95de15 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/bin/cmd.js @@ -0,0 +1,33 @@ +#!/usr/bin/env node + +var mkdirp = require('../'); +var minimist = require('minimist'); +var fs = require('fs'); + +var argv = minimist(process.argv.slice(2), { + alias: { m: 'mode', h: 'help' }, + string: [ 'mode' ] +}); +if (argv.help) { + fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout); + return; +} + +var paths = argv._.slice(); +var mode = argv.mode ? parseInt(argv.mode, 8) : undefined; + +(function next () { + if (paths.length === 0) return; + var p = paths.shift(); + + if (mode === undefined) mkdirp(p, cb) + else mkdirp(p, mode, cb) + + function cb (err) { + if (err) { + console.error(err.message); + process.exit(1); + } + else next(); + } +})(); diff --git a/appasar/canary/node_modules/mkdirp/bin/usage.txt b/appasar/canary/node_modules/mkdirp/bin/usage.txt new file mode 100644 index 0000000..f952aa2 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/bin/usage.txt @@ -0,0 +1,12 @@ +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories that + don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m, --mode If a directory needs to be created, set the mode as an octal + permission string. + diff --git a/appasar/canary/node_modules/mkdirp/examples/pow.js b/appasar/canary/node_modules/mkdirp/examples/pow.js new file mode 100644 index 0000000..e692421 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/examples/pow.js @@ -0,0 +1,6 @@ +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') +}); diff --git a/appasar/canary/node_modules/mkdirp/index.js b/appasar/canary/node_modules/mkdirp/index.js new file mode 100644 index 0000000..6ce241b --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/index.js @@ -0,0 +1,98 @@ +var path = require('path'); +var fs = require('fs'); +var _0777 = parseInt('0777', 8); + +module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + +function mkdirP (p, opts, f, made) { + if (typeof opts === 'function') { + f = opts; + opts = {}; + } + else if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 & (~process.umask()); + } + if (!made) made = null; + + var cb = f || function () {}; + p = path.resolve(p); + + xfs.mkdir(p, mode, function (er) { + if (!er) { + made = made || p; + return cb(null, made); + } + switch (er.code) { + case 'ENOENT': + mkdirP(path.dirname(p), opts, function (er, made) { + if (er) cb(er, made); + else mkdirP(p, opts, cb, made); + }); + break; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, function (er2, stat) { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) cb(er, made) + else cb(null, made); + }); + break; + } + }); +} + +mkdirP.sync = function sync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 & (~process.umask()); + } + if (!made) made = null; + + p = path.resolve(p); + + try { + xfs.mkdirSync(p, mode); + made = made || p; + } + catch (err0) { + switch (err0.code) { + case 'ENOENT' : + made = sync(path.dirname(p), opts, made); + sync(p, opts, made); + break; + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + var stat; + try { + stat = xfs.statSync(p); + } + catch (err1) { + throw err0; + } + if (!stat.isDirectory()) throw err0; + break; + } + } + + return made; +}; diff --git a/appasar/canary/node_modules/mkdirp/package.json b/appasar/canary/node_modules/mkdirp/package.json new file mode 100644 index 0000000..863e860 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/package.json @@ -0,0 +1,27 @@ +{ + "name": "mkdirp", + "description": "Recursively mkdir, like `mkdir -p`", + "version": "0.5.1", + "author": "James Halliday (http://substack.net)", + "main": "index.js", + "keywords": [ + "mkdir", + "directory" + ], + "repository": { + "type": "git", + "url": "https://github.com/substack/node-mkdirp.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "minimist": "0.0.8" + }, + "devDependencies": { + "tap": "1", + "mock-fs": "2 >=2.7.0" + }, + "bin": "bin/cmd.js", + "license": "MIT" +} diff --git a/appasar/canary/node_modules/mkdirp/readme.markdown b/appasar/canary/node_modules/mkdirp/readme.markdown new file mode 100644 index 0000000..3cc1315 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/readme.markdown @@ -0,0 +1,100 @@ +# mkdirp + +Like `mkdir -p`, but in node.js! + +[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) + +# example + +## pow.js + +```js +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') +}); +``` + +Output + +``` +pow! +``` + +And now /tmp/foo/bar/baz exists, huzzah! + +# methods + +```js +var mkdirp = require('mkdirp'); +``` + +## mkdirp(dir, opts, cb) + +Create a new directory and any necessary subdirectories at `dir` with octal +permission string `opts.mode`. If `opts` is a non-object, it will be treated as +the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +`cb(err, made)` fires with the error or the first directory `made` +that had to be created, if any. + +You can optionally pass in an alternate `fs` implementation by passing in +`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and +`opts.fs.stat(path, cb)`. + +## mkdirp.sync(dir, opts) + +Synchronously create a new directory and any necessary subdirectories at `dir` +with octal permission string `opts.mode`. If `opts` is a non-object, it will be +treated as the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +Returns the first directory that had to be created, if any. + +You can optionally pass in an alternate `fs` implementation by passing in +`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and +`opts.fs.statSync(path)`. + +# usage + +This package also ships with a `mkdirp` command. + +``` +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories that + don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m, --mode If a directory needs to be created, set the mode as an octal + permission string. + +``` + +# install + +With [npm](http://npmjs.org) do: + +``` +npm install mkdirp +``` + +to get the library, or + +``` +npm install -g mkdirp +``` + +to get the command. + +# license + +MIT diff --git a/appasar/canary/node_modules/mkdirp/test/chmod.js b/appasar/canary/node_modules/mkdirp/test/chmod.js new file mode 100644 index 0000000..6a404b9 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/chmod.js @@ -0,0 +1,41 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); +var _0744 = parseInt('0744', 8); + +var ps = [ '', 'tmp' ]; + +for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); +} + +var file = ps.join('/'); + +test('chmod-pre', function (t) { + var mode = _0744 + mkdirp(file, mode, function (er) { + t.ifError(er, 'should not error'); + fs.stat(file, function (er, stat) { + t.ifError(er, 'should exist'); + t.ok(stat && stat.isDirectory(), 'should be directory'); + t.equal(stat && stat.mode & _0777, mode, 'should be 0744'); + t.end(); + }); + }); +}); + +test('chmod', function (t) { + var mode = _0755 + mkdirp(file, mode, function (er) { + t.ifError(er, 'should not error'); + fs.stat(file, function (er, stat) { + t.ifError(er, 'should exist'); + t.ok(stat && stat.isDirectory(), 'should be directory'); + t.end(); + }); + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/clobber.js b/appasar/canary/node_modules/mkdirp/test/clobber.js new file mode 100644 index 0000000..2433b9a --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/clobber.js @@ -0,0 +1,38 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; +var _0755 = parseInt('0755', 8); + +var ps = [ '', 'tmp' ]; + +for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); +} + +var file = ps.join('/'); + +// a file in the way +var itw = ps.slice(0, 3).join('/'); + + +test('clobber-pre', function (t) { + console.error("about to write to "+itw) + fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); + + fs.stat(itw, function (er, stat) { + t.ifError(er) + t.ok(stat && stat.isFile(), 'should be file') + t.end() + }) +}) + +test('clobber', function (t) { + t.plan(2); + mkdirp(file, _0755, function (err) { + t.ok(err); + t.equal(err.code, 'ENOTDIR'); + t.end(); + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/mkdirp.js b/appasar/canary/node_modules/mkdirp/test/mkdirp.js new file mode 100644 index 0000000..eaa8921 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/mkdirp.js @@ -0,0 +1,28 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('woo', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + mkdirp(file, _0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/opts_fs.js b/appasar/canary/node_modules/mkdirp/test/opts_fs.js new file mode 100644 index 0000000..97186b6 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/opts_fs.js @@ -0,0 +1,29 @@ +var mkdirp = require('../'); +var path = require('path'); +var test = require('tap').test; +var mockfs = require('mock-fs'); +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('opts.fs', function (t) { + t.plan(5); + + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/beep/boop/' + [x,y,z].join('/'); + var xfs = mockfs.fs(); + + mkdirp(file, { fs: xfs, mode: _0755 }, function (err) { + t.ifError(err); + xfs.exists(file, function (ex) { + t.ok(ex, 'created file'); + xfs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/opts_fs_sync.js b/appasar/canary/node_modules/mkdirp/test/opts_fs_sync.js new file mode 100644 index 0000000..6c370aa --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/opts_fs_sync.js @@ -0,0 +1,27 @@ +var mkdirp = require('../'); +var path = require('path'); +var test = require('tap').test; +var mockfs = require('mock-fs'); +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('opts.fs sync', function (t) { + t.plan(4); + + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/beep/boop/' + [x,y,z].join('/'); + var xfs = mockfs.fs(); + + mkdirp.sync(file, { fs: xfs, mode: _0755 }); + xfs.exists(file, function (ex) { + t.ok(ex, 'created file'); + xfs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/perm.js b/appasar/canary/node_modules/mkdirp/test/perm.js new file mode 100644 index 0000000..fbce44b --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/perm.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('async perm', function (t) { + t.plan(5); + var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); + + mkdirp(file, _0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); + +test('async root perm', function (t) { + mkdirp('/tmp', _0755, function (err) { + if (err) t.fail(err); + t.end(); + }); + t.end(); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/perm_sync.js b/appasar/canary/node_modules/mkdirp/test/perm_sync.js new file mode 100644 index 0000000..398229f --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/perm_sync.js @@ -0,0 +1,36 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('sync perm', function (t) { + t.plan(4); + var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; + + mkdirp.sync(file, _0755); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); + +test('sync root perm', function (t) { + t.plan(3); + + var file = '/tmp'; + mkdirp.sync(file, _0755); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/race.js b/appasar/canary/node_modules/mkdirp/test/race.js new file mode 100644 index 0000000..b0b9e18 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/race.js @@ -0,0 +1,37 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('race', function (t) { + t.plan(10); + var ps = [ '', 'tmp' ]; + + for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); + } + var file = ps.join('/'); + + var res = 2; + mk(file); + + mk(file); + + function mk (file, cb) { + mkdirp(file, _0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }) + }); + } +}); diff --git a/appasar/canary/node_modules/mkdirp/test/rel.js b/appasar/canary/node_modules/mkdirp/test/rel.js new file mode 100644 index 0000000..4ddb342 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/rel.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('rel', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var cwd = process.cwd(); + process.chdir('/tmp'); + + var file = [x,y,z].join('/'); + + mkdirp(file, _0755, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + process.chdir(cwd); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }) + }) + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/return.js b/appasar/canary/node_modules/mkdirp/test/return.js new file mode 100644 index 0000000..bce68e5 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/return.js @@ -0,0 +1,25 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('return value', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + // should return the first dir created. + // By this point, it would be profoundly surprising if /tmp didn't + // already exist, since every other test makes things in there. + mkdirp(file, function (err, made) { + t.ifError(err); + t.equal(made, '/tmp/' + x); + mkdirp(file, function (err, made) { + t.ifError(err); + t.equal(made, null); + }); + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/return_sync.js b/appasar/canary/node_modules/mkdirp/test/return_sync.js new file mode 100644 index 0000000..7c222d3 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/return_sync.js @@ -0,0 +1,24 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('return value', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + // should return the first dir created. + // By this point, it would be profoundly surprising if /tmp didn't + // already exist, since every other test makes things in there. + // Note that this will throw on failure, which will fail the test. + var made = mkdirp.sync(file); + t.equal(made, '/tmp/' + x); + + // making the same file again should have no effect. + made = mkdirp.sync(file); + t.equal(made, null); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/root.js b/appasar/canary/node_modules/mkdirp/test/root.js new file mode 100644 index 0000000..9e7d079 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/root.js @@ -0,0 +1,19 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; +var _0755 = parseInt('0755', 8); + +test('root', function (t) { + // '/' on unix, 'c:/' on windows. + var file = path.resolve('/'); + + mkdirp(file, _0755, function (err) { + if (err) throw err + fs.stat(file, function (er, stat) { + if (er) throw er + t.ok(stat.isDirectory(), 'target is a directory'); + t.end(); + }) + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/sync.js b/appasar/canary/node_modules/mkdirp/test/sync.js new file mode 100644 index 0000000..8c8dc93 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/sync.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('sync', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + try { + mkdirp.sync(file, _0755); + } catch (err) { + t.fail(err); + return t.end(); + } + + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0755); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/umask.js b/appasar/canary/node_modules/mkdirp/test/umask.js new file mode 100644 index 0000000..2033c63 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/umask.js @@ -0,0 +1,28 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('implicit mode from umask', function (t) { + t.plan(5); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + mkdirp(file, function (err) { + t.ifError(err); + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, _0777 & (~process.umask())); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }) + }); +}); diff --git a/appasar/canary/node_modules/mkdirp/test/umask_sync.js b/appasar/canary/node_modules/mkdirp/test/umask_sync.js new file mode 100644 index 0000000..11a7614 --- /dev/null +++ b/appasar/canary/node_modules/mkdirp/test/umask_sync.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var exists = fs.exists || path.exists; +var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); + +test('umask sync modes', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + try { + mkdirp.sync(file); + } catch (err) { + t.fail(err); + return t.end(); + } + + exists(file, function (ex) { + t.ok(ex, 'file created'); + fs.stat(file, function (err, stat) { + t.ifError(err); + t.equal(stat.mode & _0777, (_0777 & (~process.umask()))); + t.ok(stat.isDirectory(), 'target not a directory'); + }); + }); +}); diff --git a/appasar/canary/node_modules/oauth-sign/LICENSE b/appasar/canary/node_modules/oauth-sign/LICENSE new file mode 100644 index 0000000..a4a9aee --- /dev/null +++ b/appasar/canary/node_modules/oauth-sign/LICENSE @@ -0,0 +1,55 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/appasar/canary/node_modules/oauth-sign/README.md b/appasar/canary/node_modules/oauth-sign/README.md new file mode 100644 index 0000000..34c4a85 --- /dev/null +++ b/appasar/canary/node_modules/oauth-sign/README.md @@ -0,0 +1,4 @@ +oauth-sign +========== + +OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module. diff --git a/appasar/canary/node_modules/oauth-sign/index.js b/appasar/canary/node_modules/oauth-sign/index.js new file mode 100644 index 0000000..dadcba9 --- /dev/null +++ b/appasar/canary/node_modules/oauth-sign/index.js @@ -0,0 +1,136 @@ +var crypto = require('crypto') + , qs = require('querystring') + ; + +function sha1 (key, body) { + return crypto.createHmac('sha1', key).update(body).digest('base64') +} + +function rsa (key, body) { + return crypto.createSign("RSA-SHA1").update(body).sign(key, 'base64'); +} + +function rfc3986 (str) { + return encodeURIComponent(str) + .replace(/!/g,'%21') + .replace(/\*/g,'%2A') + .replace(/\(/g,'%28') + .replace(/\)/g,'%29') + .replace(/'/g,'%27') + ; +} + +// Maps object to bi-dimensional array +// Converts { foo: 'A', bar: [ 'b', 'B' ]} to +// [ ['foo', 'A'], ['bar', 'b'], ['bar', 'B'] ] +function map (obj) { + var key, val, arr = [] + for (key in obj) { + val = obj[key] + if (Array.isArray(val)) + for (var i = 0; i < val.length; i++) + arr.push([key, val[i]]) + else if (typeof val === "object") + for (var prop in val) + arr.push([key + '[' + prop + ']', val[prop]]); + else + arr.push([key, val]) + } + return arr +} + +// Compare function for sort +function compare (a, b) { + return a > b ? 1 : a < b ? -1 : 0 +} + +function generateBase (httpMethod, base_uri, params) { + // adapted from https://dev.twitter.com/docs/auth/oauth and + // https://dev.twitter.com/docs/auth/creating-signature + + // Parameter normalization + // http://tools.ietf.org/html/rfc5849#section-3.4.1.3.2 + var normalized = map(params) + // 1. First, the name and value of each parameter are encoded + .map(function (p) { + return [ rfc3986(p[0]), rfc3986(p[1] || '') ] + }) + // 2. The parameters are sorted by name, using ascending byte value + // ordering. If two or more parameters share the same name, they + // are sorted by their value. + .sort(function (a, b) { + return compare(a[0], b[0]) || compare(a[1], b[1]) + }) + // 3. The name of each parameter is concatenated to its corresponding + // value using an "=" character (ASCII code 61) as a separator, even + // if the value is empty. + .map(function (p) { return p.join('=') }) + // 4. The sorted name/value pairs are concatenated together into a + // single string by using an "&" character (ASCII code 38) as + // separator. + .join('&') + + var base = [ + rfc3986(httpMethod ? httpMethod.toUpperCase() : 'GET'), + rfc3986(base_uri), + rfc3986(normalized) + ].join('&') + + return base +} + +function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret) { + var base = generateBase(httpMethod, base_uri, params) + var key = [ + consumer_secret || '', + token_secret || '' + ].map(rfc3986).join('&') + + return sha1(key, base) +} + +function rsasign (httpMethod, base_uri, params, private_key, token_secret) { + var base = generateBase(httpMethod, base_uri, params) + var key = private_key || '' + + return rsa(key, base) +} + +function plaintext (consumer_secret, token_secret) { + var key = [ + consumer_secret || '', + token_secret || '' + ].map(rfc3986).join('&') + + return key +} + +function sign (signMethod, httpMethod, base_uri, params, consumer_secret, token_secret) { + var method + var skipArgs = 1 + + switch (signMethod) { + case 'RSA-SHA1': + method = rsasign + break + case 'HMAC-SHA1': + method = hmacsign + break + case 'PLAINTEXT': + method = plaintext + skipArgs = 4 + break + default: + throw new Error("Signature method not supported: " + signMethod) + } + + return method.apply(null, [].slice.call(arguments, skipArgs)) +} + +exports.hmacsign = hmacsign +exports.rsasign = rsasign +exports.plaintext = plaintext +exports.sign = sign +exports.rfc3986 = rfc3986 +exports.generateBase = generateBase + diff --git a/appasar/canary/node_modules/oauth-sign/package.json b/appasar/canary/node_modules/oauth-sign/package.json new file mode 100644 index 0000000..4c7991e --- /dev/null +++ b/appasar/canary/node_modules/oauth-sign/package.json @@ -0,0 +1,23 @@ +{ + "author": "Mikeal Rogers (http://www.futurealoof.com)", + "name": "oauth-sign", + "description": "OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module.", + "version": "0.8.2", + "license": "Apache-2.0", + "repository": { + "url": "https://github.com/mikeal/oauth-sign" + }, + "main": "index.js", + "files": [ + "index.js" + ], + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "scripts": { + "test": "node test.js" + } +} diff --git a/appasar/canary/node_modules/once/LICENSE b/appasar/canary/node_modules/once/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/appasar/canary/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/once/README.md b/appasar/canary/node_modules/once/README.md new file mode 100644 index 0000000..1f1ffca --- /dev/null +++ b/appasar/canary/node_modules/once/README.md @@ -0,0 +1,79 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` + +## `once.strict(func)` + +Throw an error if the function is called twice. + +Some functions are expected to be called only once. Using `once` for them would +potentially hide logical errors. + +In the example below, the `greet` function has to call the callback only once: + +```javascript +function greet (name, cb) { + // return is missing from the if statement + // when no name is passed, the callback is called twice + if (!name) cb('Hello anonymous') + cb('Hello ' + name) +} + +function log (msg) { + console.log(msg) +} + +// this will print 'Hello anonymous' but the logical error will be missed +greet(null, once(msg)) + +// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time +greet(null, once.strict(msg)) +``` diff --git a/appasar/canary/node_modules/once/once.js b/appasar/canary/node_modules/once/once.js new file mode 100644 index 0000000..2354067 --- /dev/null +++ b/appasar/canary/node_modules/once/once.js @@ -0,0 +1,42 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} diff --git a/appasar/canary/node_modules/once/package.json b/appasar/canary/node_modules/once/package.json new file mode 100644 index 0000000..16815b2 --- /dev/null +++ b/appasar/canary/node_modules/once/package.json @@ -0,0 +1,33 @@ +{ + "name": "once", + "version": "1.4.0", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "^7.0.1" + }, + "scripts": { + "test": "tap test/*.js" + }, + "files": [ + "once.js" + ], + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC" +} diff --git a/appasar/canary/node_modules/path-is-absolute/index.js b/appasar/canary/node_modules/path-is-absolute/index.js new file mode 100644 index 0000000..22aa6c3 --- /dev/null +++ b/appasar/canary/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +} + +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); + + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/appasar/canary/node_modules/path-is-absolute/license b/appasar/canary/node_modules/path-is-absolute/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/appasar/canary/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/appasar/canary/node_modules/path-is-absolute/package.json b/appasar/canary/node_modules/path-is-absolute/package.json new file mode 100644 index 0000000..91196d5 --- /dev/null +++ b/appasar/canary/node_modules/path-is-absolute/package.json @@ -0,0 +1,43 @@ +{ + "name": "path-is-absolute", + "version": "1.0.1", + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "license": "MIT", + "repository": "sindresorhus/path-is-absolute", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "devDependencies": { + "xo": "^0.16.0" + } +} diff --git a/appasar/canary/node_modules/path-is-absolute/readme.md b/appasar/canary/node_modules/path-is-absolute/readme.md new file mode 100644 index 0000000..8dbdf5f --- /dev/null +++ b/appasar/canary/node_modules/path-is-absolute/readme.md @@ -0,0 +1,59 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +const pathIsAbsolute = require('path-is-absolute'); + +// Running on Linux +pathIsAbsolute('/home/foo'); +//=> true +pathIsAbsolute('C:/Users/foo'); +//=> false + +// Running on Windows +pathIsAbsolute('C:/Users/foo'); +//=> true +pathIsAbsolute('/home/foo'); +//=> false + +// Running on any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +POSIX specific version. + +### pathIsAbsolute.win32(path) + +Windows specific version. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/appasar/canary/node_modules/pend/LICENSE b/appasar/canary/node_modules/pend/LICENSE new file mode 100644 index 0000000..0bbb53e --- /dev/null +++ b/appasar/canary/node_modules/pend/LICENSE @@ -0,0 +1,23 @@ +The MIT License (Expat) + +Copyright (c) 2014 Andrew Kelley + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/pend/README.md b/appasar/canary/node_modules/pend/README.md new file mode 100644 index 0000000..bb40a07 --- /dev/null +++ b/appasar/canary/node_modules/pend/README.md @@ -0,0 +1,41 @@ +# Pend + +Dead-simple optimistic async helper. + +## Usage + +```js +var Pend = require('pend'); +var pend = new Pend(); +pend.max = 10; // defaults to Infinity +setTimeout(pend.hold(), 1000); // pend.wait will have to wait for this hold to finish +pend.go(function(cb) { + console.log("this function is immediately executed"); + setTimeout(function() { + console.log("calling cb 1"); + cb(); + }, 500); +}); +pend.go(function(cb) { + console.log("this function is also immediately executed"); + setTimeout(function() { + console.log("calling cb 2"); + cb(); + }, 1000); +}); +pend.wait(function(err) { + console.log("this is excuted when the first 2 have returned."); + console.log("err is a possible error in the standard callback style."); +}); +``` + +Output: + +``` +this function is immediately executed +this function is also immediately executed +calling cb 1 +calling cb 2 +this is excuted when the first 2 have returned. +err is a possible error in the standard callback style. +``` diff --git a/appasar/canary/node_modules/pend/index.js b/appasar/canary/node_modules/pend/index.js new file mode 100644 index 0000000..3bf485e --- /dev/null +++ b/appasar/canary/node_modules/pend/index.js @@ -0,0 +1,55 @@ +module.exports = Pend; + +function Pend() { + this.pending = 0; + this.max = Infinity; + this.listeners = []; + this.waiting = []; + this.error = null; +} + +Pend.prototype.go = function(fn) { + if (this.pending < this.max) { + pendGo(this, fn); + } else { + this.waiting.push(fn); + } +}; + +Pend.prototype.wait = function(cb) { + if (this.pending === 0) { + cb(this.error); + } else { + this.listeners.push(cb); + } +}; + +Pend.prototype.hold = function() { + return pendHold(this); +}; + +function pendHold(self) { + self.pending += 1; + var called = false; + return onCb; + function onCb(err) { + if (called) throw new Error("callback called twice"); + called = true; + self.error = self.error || err; + self.pending -= 1; + if (self.waiting.length > 0 && self.pending < self.max) { + pendGo(self, self.waiting.shift()); + } else if (self.pending === 0) { + var listeners = self.listeners; + self.listeners = []; + listeners.forEach(cbListener); + } + } + function cbListener(listener) { + listener(self.error); + } +} + +function pendGo(self, fn) { + fn(pendHold(self)); +} diff --git a/appasar/canary/node_modules/pend/package.json b/appasar/canary/node_modules/pend/package.json new file mode 100644 index 0000000..8181f8b --- /dev/null +++ b/appasar/canary/node_modules/pend/package.json @@ -0,0 +1,18 @@ +{ + "name": "pend", + "version": "1.2.0", + "description": "dead-simple optimistic async helper", + "main": "index.js", + "scripts": { + "test": "node test.js" + }, + "author": "Andrew Kelley ", + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/andrewrk/node-pend.git" + }, + "bugs": { + "url": "https://github.com/andrewrk/node-pend/issues" + } +} diff --git a/appasar/canary/node_modules/pend/test.js b/appasar/canary/node_modules/pend/test.js new file mode 100644 index 0000000..75c0f2a --- /dev/null +++ b/appasar/canary/node_modules/pend/test.js @@ -0,0 +1,137 @@ +var assert = require('assert'); +var Pend = require('./'); + +var tests = [ + { + name: "basic", + fn: testBasic, + }, + { + name: "max", + fn: testWithMax, + }, + { + name: "callback twice", + fn: testCallbackTwice, + }, + { + name: "calling wait twice", + fn: testCallingWaitTwice, + }, + { + name: "hold()", + fn: testHoldFn, + }, +]; +var testCount = tests.length; + +doOneTest(); + +function doOneTest() { + var test = tests.shift(); + if (!test) { + console.log(testCount + " tests passed."); + return; + } + process.stdout.write(test.name + "..."); + test.fn(function() { + process.stdout.write("OK\n"); + doOneTest(); + }); +} + +function testBasic(cb) { + var pend = new Pend(); + var results = []; + pend.go(function(cb) { + results.push(1); + setTimeout(function() { + results.push(3); + cb(); + }, 500); + }); + pend.go(function(cb) { + results.push(2); + setTimeout(function() { + results.push(4); + cb(); + }, 1000); + }); + pend.wait(function(err) { + assert.deepEqual(results, [1,2,3,4]); + cb(); + }); + assert.deepEqual(results, [1, 2]); +} + +function testWithMax(cb) { + var pend = new Pend(); + var results = []; + pend.max = 2; + pend.go(function(cb) { + results.push('a'); + setTimeout(function() { + results.push(1); + cb(); + }, 500); + }); + pend.go(function(cb) { + results.push('b'); + setTimeout(function() { + results.push(1); + cb(); + }, 500); + }); + pend.go(function(cb) { + results.push('c'); + setTimeout(function() { + results.push(2); + cb(); + }, 100); + }); + pend.wait(function(err) { + assert.deepEqual(results, ['a', 'b', 1, 'c', 1, 2]); + cb(); + }); + assert.deepEqual(results, ['a', 'b']); +} + +function testCallbackTwice(cb) { + var pend = new Pend(); + pend.go(function(cb) { + setTimeout(cb, 100); + }); + pend.go(function(cb) { + cb(); + assert.throws(cb, /callback called twice/); + }); + pend.wait(cb); +} + +function testCallingWaitTwice(cb) { + var pend = new Pend(); + pend.go(function(cb) { + setTimeout(cb, 100); + }); + pend.wait(function() { + pend.go(function(cb) { + setTimeout(cb, 50); + }); + pend.go(function(cb) { + setTimeout(cb, 10); + }); + pend.go(function(cb) { + setTimeout(cb, 20); + }); + pend.wait(cb); + }); +} + +function testHoldFn(cb) { + var pend = new Pend(); + setTimeout(pend.hold(), 100); + pend.go(function(cb) { + cb(); + }); + pend.wait(cb); +} diff --git a/appasar/canary/node_modules/performance-now/.npmignore b/appasar/canary/node_modules/performance-now/.npmignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/appasar/canary/node_modules/performance-now/.npmignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/appasar/canary/node_modules/performance-now/.tm_properties b/appasar/canary/node_modules/performance-now/.tm_properties new file mode 100644 index 0000000..4b8eb3f --- /dev/null +++ b/appasar/canary/node_modules/performance-now/.tm_properties @@ -0,0 +1,7 @@ +excludeDirectories = "{.git,node_modules}" +excludeInFolderSearch = "{excludeDirectories,lib}" + +includeFiles = "{.gitignore,.npmignore,.travis.yml}" + +[ attr.untitled ] +fileType = 'source.coffee' \ No newline at end of file diff --git a/appasar/canary/node_modules/performance-now/.travis.yml b/appasar/canary/node_modules/performance-now/.travis.yml new file mode 100644 index 0000000..1543c19 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "node" + - "6" + - "4" + - "0.12" diff --git a/appasar/canary/node_modules/performance-now/README.md b/appasar/canary/node_modules/performance-now/README.md new file mode 100644 index 0000000..28080f8 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/README.md @@ -0,0 +1,30 @@ +# performance-now [![Build Status](https://travis-ci.org/braveg1rl/performance-now.png?branch=master)](https://travis-ci.org/braveg1rl/performance-now) [![Dependency Status](https://david-dm.org/braveg1rl/performance-now.png)](https://david-dm.org/braveg1rl/performance-now) + +Implements a function similar to `performance.now` (based on `process.hrtime`). + +Modern browsers have a `window.performance` object with - among others - a `now` method which gives time in milliseconds, but with sub-millisecond precision. This module offers the same function based on the Node.js native `process.hrtime` function. + +Using `process.hrtime` means that the reported time will be monotonically increasing, and not subject to clock-drift. + +According to the [High Resolution Time specification](http://www.w3.org/TR/hr-time/), the number of milliseconds reported by `performance.now` should be relative to the value of `performance.timing.navigationStart`. + +In the current version of the module (2.0) the reported time is relative to the time the current Node process has started (inferred from `process.uptime()`). + +Version 1.0 reported a different time. The reported time was relative to the time the module was loaded (i.e. the time it was first `require`d). If you need this functionality, version 1.0 is still available on NPM. + +## Example usage + +```javascript +var now = require("performance-now") +var start = now() +var end = now() +console.log(start.toFixed(3)) // the number of milliseconds the current node process is running +console.log((start-end).toFixed(3)) // ~ 0.002 on my system +``` + +Running the now function two times right after each other yields a time difference of a few microseconds. Given this overhead, I think it's best to assume that the precision of intervals computed with this method is not higher than 10 microseconds, if you don't know the exact overhead on your own system. + +## License + +performance-now is released under the [MIT License](http://opensource.org/licenses/MIT). +Copyright (c) 2017 Braveg1rl diff --git a/appasar/canary/node_modules/performance-now/lib/performance-now.js b/appasar/canary/node_modules/performance-now/lib/performance-now.js new file mode 100644 index 0000000..37f569d --- /dev/null +++ b/appasar/canary/node_modules/performance-now/lib/performance-now.js @@ -0,0 +1,36 @@ +// Generated by CoffeeScript 1.12.2 +(function() { + var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; + + if ((typeof performance !== "undefined" && performance !== null) && performance.now) { + module.exports = function() { + return performance.now(); + }; + } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) { + module.exports = function() { + return (getNanoSeconds() - nodeLoadTime) / 1e6; + }; + hrtime = process.hrtime; + getNanoSeconds = function() { + var hr; + hr = hrtime(); + return hr[0] * 1e9 + hr[1]; + }; + moduleLoadTime = getNanoSeconds(); + upTime = process.uptime() * 1e9; + nodeLoadTime = moduleLoadTime - upTime; + } else if (Date.now) { + module.exports = function() { + return Date.now() - loadTime; + }; + loadTime = Date.now(); + } else { + module.exports = function() { + return new Date().getTime() - loadTime; + }; + loadTime = new Date().getTime(); + } + +}).call(this); + +//# sourceMappingURL=performance-now.js.map diff --git a/appasar/canary/node_modules/performance-now/lib/performance-now.js.map b/appasar/canary/node_modules/performance-now/lib/performance-now.js.map new file mode 100644 index 0000000..bef8362 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/lib/performance-now.js.map @@ -0,0 +1,10 @@ +{ + "version": 3, + "file": "performance-now.js", + "sourceRoot": "..", + "sources": [ + "src/performance-now.coffee" + ], + "names": [], + "mappings": ";AAAA;AAAA,MAAA;;EAAA,IAAG,4DAAA,IAAiB,WAAW,CAAC,GAAhC;IACE,MAAM,CAAC,OAAP,GAAiB,SAAA;aAAG,WAAW,CAAC,GAAZ,CAAA;IAAH,EADnB;GAAA,MAEK,IAAG,oDAAA,IAAa,OAAO,CAAC,MAAxB;IACH,MAAM,CAAC,OAAP,GAAiB,SAAA;aAAG,CAAC,cAAA,CAAA,CAAA,GAAmB,YAApB,CAAA,GAAoC;IAAvC;IACjB,MAAA,GAAS,OAAO,CAAC;IACjB,cAAA,GAAiB,SAAA;AACf,UAAA;MAAA,EAAA,GAAK,MAAA,CAAA;aACL,EAAG,CAAA,CAAA,CAAH,GAAQ,GAAR,GAAc,EAAG,CAAA,CAAA;IAFF;IAGjB,cAAA,GAAiB,cAAA,CAAA;IACjB,MAAA,GAAS,OAAO,CAAC,MAAR,CAAA,CAAA,GAAmB;IAC5B,YAAA,GAAe,cAAA,GAAiB,OAR7B;GAAA,MASA,IAAG,IAAI,CAAC,GAAR;IACH,MAAM,CAAC,OAAP,GAAiB,SAAA;aAAG,IAAI,CAAC,GAAL,CAAA,CAAA,GAAa;IAAhB;IACjB,QAAA,GAAW,IAAI,CAAC,GAAL,CAAA,EAFR;GAAA,MAAA;IAIH,MAAM,CAAC,OAAP,GAAiB,SAAA;aAAO,IAAA,IAAA,CAAA,CAAM,CAAC,OAAP,CAAA,CAAJ,GAAuB;IAA1B;IACjB,QAAA,GAAe,IAAA,IAAA,CAAA,CAAM,CAAC,OAAP,CAAA,EALZ;;AAXL" +} \ No newline at end of file diff --git a/appasar/canary/node_modules/performance-now/license.txt b/appasar/canary/node_modules/performance-now/license.txt new file mode 100644 index 0000000..0bf51b4 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/license.txt @@ -0,0 +1,7 @@ +Copyright (c) 2013 Braveg1rl + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/appasar/canary/node_modules/performance-now/package.json b/appasar/canary/node_modules/performance-now/package.json new file mode 100644 index 0000000..962bfc8 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/package.json @@ -0,0 +1,35 @@ +{ + "name": "performance-now", + "description": "Implements performance.now (based on process.hrtime).", + "keywords": [], + "version": "2.1.0", + "author": "Braveg1rl ", + "license": "MIT", + "homepage": "https://github.com/braveg1rl/performance-now", + "bugs": "https://github.com/braveg1rl/performance-now/issues", + "repository": { + "type": "git", + "url": "git://github.com/braveg1rl/performance-now.git" + }, + "private": false, + "dependencies": {}, + "devDependencies": { + "bluebird": "^3.4.7", + "call-delayed": "^1.0.0", + "chai": "^3.5.0", + "chai-increasing": "^1.2.0", + "coffee-script": "~1.12.2", + "mocha": "~3.2.0", + "pre-commit": "^1.2.2" + }, + "optionalDependencies": {}, + "main": "lib/performance-now.js", + "scripts": { + "build": "mkdir -p lib && rm -rf lib/* && node_modules/.bin/coffee --compile -m --output lib/ src/", + "prepublish": "npm test", + "pretest": "npm run build", + "test": "node_modules/.bin/mocha", + "watch": "node_modules/.bin/coffee --watch --compile --output lib/ src/" + }, + "typings": "src/index.d.ts" +} diff --git a/appasar/canary/node_modules/performance-now/src/index.d.ts b/appasar/canary/node_modules/performance-now/src/index.d.ts new file mode 100644 index 0000000..68dca8e --- /dev/null +++ b/appasar/canary/node_modules/performance-now/src/index.d.ts @@ -0,0 +1,8 @@ +// This file describes the package to typescript. + +/** + * Returns the number of milliseconds since the page was loaded (if browser) + * or the node process was started. + */ +declare function now(): number; +export = now; diff --git a/appasar/canary/node_modules/performance-now/src/performance-now.coffee b/appasar/canary/node_modules/performance-now/src/performance-now.coffee new file mode 100644 index 0000000..a8e075a --- /dev/null +++ b/appasar/canary/node_modules/performance-now/src/performance-now.coffee @@ -0,0 +1,17 @@ +if performance? and performance.now + module.exports = -> performance.now() +else if process? and process.hrtime + module.exports = -> (getNanoSeconds() - nodeLoadTime) / 1e6 + hrtime = process.hrtime + getNanoSeconds = -> + hr = hrtime() + hr[0] * 1e9 + hr[1] + moduleLoadTime = getNanoSeconds() + upTime = process.uptime() * 1e9 + nodeLoadTime = moduleLoadTime - upTime +else if Date.now + module.exports = -> Date.now() - loadTime + loadTime = Date.now() +else + module.exports = -> new Date().getTime() - loadTime + loadTime = new Date().getTime() diff --git a/appasar/canary/node_modules/performance-now/test/mocha.opts b/appasar/canary/node_modules/performance-now/test/mocha.opts new file mode 100644 index 0000000..55d8492 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/test/mocha.opts @@ -0,0 +1,3 @@ +--require coffee-script/register +--compilers coffee:coffee-script/register +--reporter spec \ No newline at end of file diff --git a/appasar/canary/node_modules/performance-now/test/performance-now.coffee b/appasar/canary/node_modules/performance-now/test/performance-now.coffee new file mode 100644 index 0000000..c99e95c --- /dev/null +++ b/appasar/canary/node_modules/performance-now/test/performance-now.coffee @@ -0,0 +1,43 @@ +chai = require "chai" +chai.use(require "chai-increasing") +{assert,expect} = chai +Bluebird = require "bluebird" + +now = require "../" + +getUptime = -> process.uptime() * 1e3 + +describe "now", -> + it "reported time differs at most 1ms from a freshly reported uptime", -> + assert.isAtMost Math.abs(now()-getUptime()), 1 + + it "two subsequent calls return an increasing number", -> + assert.isBelow now(), now() + + it "has less than 10 microseconds overhead", -> + assert.isBelow Math.abs(now() - now()), 0.010 + + it "can be called 1 million times in under 1 second (averaging under 1 microsecond per call)", -> + @timeout 1000 + now() for [0...1e6] + undefined + + it "for 10,000 numbers, number n is never bigger than number n-1", -> + stamps = (now() for [1...10000]) + expect(stamps).to.be.increasing + + it "shows that at least 0.2 ms has passed after a timeout of 1 ms", -> + earlier = now() + Bluebird.resolve().delay(1).then -> assert.isAbove (now()-earlier), 0.2 + + it "shows that at most 3 ms has passed after a timeout of 1 ms", -> + earlier = now() + Bluebird.resolve().delay(1).then -> assert.isBelow (now()-earlier), 3 + + it "shows that at least 190ms ms has passed after a timeout of 200ms", -> + earlier = now() + Bluebird.resolve().delay(200).then -> assert.isAbove (now()-earlier), 190 + + it "shows that at most 220 ms has passed after a timeout of 200ms", -> + earlier = now() + Bluebird.resolve().delay(200).then -> assert.isBelow (now()-earlier), 220 diff --git a/appasar/canary/node_modules/performance-now/test/scripts.coffee b/appasar/canary/node_modules/performance-now/test/scripts.coffee new file mode 100644 index 0000000..16312f1 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/test/scripts.coffee @@ -0,0 +1,27 @@ +Bluebird = require "bluebird" +exec = require("child_process").execSync +{assert} = require "chai" + +describe "scripts/initital-value.coffee (module.uptime(), expressed in milliseconds)", -> + result = exec("./test/scripts/initial-value.coffee").toString().trim() + it "printed #{result}", -> + it "printed a value above 100", -> assert.isAbove result, 100 + it "printed a value below 350", -> assert.isBelow result, 350 + +describe "scripts/delayed-require.coffee (sum of uptime and 250 ms delay`)", -> + result = exec("./test/scripts/delayed-require.coffee").toString().trim() + it "printed #{result}", -> + it "printed a value above 350", -> assert.isAbove result, 350 + it "printed a value below 600", -> assert.isBelow result, 600 + +describe "scripts/delayed-call.coffee (sum of uptime and 250 ms delay`)", -> + result = exec("./test/scripts/delayed-call.coffee").toString().trim() + it "printed #{result}", -> + it "printed a value above 350", -> assert.isAbove result, 350 + it "printed a value below 600", -> assert.isBelow result, 600 + +describe "scripts/difference.coffee", -> + result = exec("./test/scripts/difference.coffee").toString().trim() + it "printed #{result}", -> + it "printed a value above 0.005", -> assert.isAbove result, 0.005 + it "printed a value below 0.07", -> assert.isBelow result, 0.07 diff --git a/appasar/canary/node_modules/performance-now/test/scripts/delayed-call.coffee b/appasar/canary/node_modules/performance-now/test/scripts/delayed-call.coffee new file mode 100644 index 0000000..0c3bab5 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/test/scripts/delayed-call.coffee @@ -0,0 +1,11 @@ +#!/usr/bin/env ./node_modules/.bin/coffee + +### +Expected output is a number above 350 and below 600. +The time reported is relative to the time the node.js process was started +this is approximately at `(Date.now() process.uptime() * 1000)` +### + +delay = require "call-delayed" +now = require "../../lib/performance-now" +delay 250, -> console.log now().toFixed 3 diff --git a/appasar/canary/node_modules/performance-now/test/scripts/delayed-require.coffee b/appasar/canary/node_modules/performance-now/test/scripts/delayed-require.coffee new file mode 100644 index 0000000..3ddee95 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/test/scripts/delayed-require.coffee @@ -0,0 +1,12 @@ +#!/usr/bin/env ./node_modules/.bin/coffee + +### +Expected output is a number above 350 and below 600. +The time reported is relative to the time the node.js process was started +this is approximately at `(Date.now() process.uptime() * 1000)` +### + +delay = require "call-delayed" +delay 250, -> + now = require "../../lib/performance-now" + console.log now().toFixed 3 diff --git a/appasar/canary/node_modules/performance-now/test/scripts/difference.coffee b/appasar/canary/node_modules/performance-now/test/scripts/difference.coffee new file mode 100644 index 0000000..0b5edf6 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/test/scripts/difference.coffee @@ -0,0 +1,6 @@ +#!/usr/bin/env ./node_modules/.bin/coffee + +# Expected output is above 0.005 and below 0.07. + +now = require('../../lib/performance-now') +console.log -(now() - now()).toFixed 3 diff --git a/appasar/canary/node_modules/performance-now/test/scripts/initial-value.coffee b/appasar/canary/node_modules/performance-now/test/scripts/initial-value.coffee new file mode 100644 index 0000000..19ef4e0 --- /dev/null +++ b/appasar/canary/node_modules/performance-now/test/scripts/initial-value.coffee @@ -0,0 +1,10 @@ +#!/usr/bin/env ./node_modules/.bin/coffee + +### +Expected output is a number above 100 and below 350. +The time reported is relative to the time the node.js process was started +this is approximately at `(Date.now() process.uptime() * 1000)` +### + +now = require '../../lib/performance-now' +console.log now().toFixed 3 diff --git a/appasar/canary/node_modules/punycode/LICENSE-MIT.txt b/appasar/canary/node_modules/punycode/LICENSE-MIT.txt new file mode 100644 index 0000000..a41e0a7 --- /dev/null +++ b/appasar/canary/node_modules/punycode/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/punycode/README.md b/appasar/canary/node_modules/punycode/README.md new file mode 100644 index 0000000..7ad7d1f --- /dev/null +++ b/appasar/canary/node_modules/punycode/README.md @@ -0,0 +1,176 @@ +# Punycode.js [![Build status](https://travis-ci.org/bestiejs/punycode.js.svg?branch=master)](https://travis-ci.org/bestiejs/punycode.js) [![Code coverage status](http://img.shields.io/coveralls/bestiejs/punycode.js/master.svg)](https://coveralls.io/r/bestiejs/punycode.js) [![Dependency status](https://gemnasium.com/bestiejs/punycode.js.svg)](https://gemnasium.com/bestiejs/punycode.js) + +A robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891), and works on nearly all JavaScript platforms. + +This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm: + +* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C) +* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c) +* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c) +* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287) +* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072)) + +This project is [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with [Node.js v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) and [io.js v1.0.0+](https://github.com/iojs/io.js/blob/v1.x/lib/punycode.js). + +## Installation + +Via [npm](https://www.npmjs.com/) (only required for Node.js releases older than v0.6.2): + +```bash +npm install punycode +``` + +Via [Bower](http://bower.io/): + +```bash +bower install punycode +``` + +Via [Component](https://github.com/component/component): + +```bash +component install bestiejs/punycode.js +``` + +In a browser: + +```html + +``` + +In [Node.js](https://nodejs.org/), [io.js](https://iojs.org/), [Narwhal](http://narwhaljs.org/), and [RingoJS](http://ringojs.org/): + +```js +var punycode = require('punycode'); +``` + +In [Rhino](http://www.mozilla.org/rhino/): + +```js +load('punycode.js'); +``` + +Using an AMD loader like [RequireJS](http://requirejs.org/): + +```js +require( + { + 'paths': { + 'punycode': 'path/to/punycode' + } + }, + ['punycode'], + function(punycode) { + console.log(punycode); + } +); +``` + +## API + +### `punycode.decode(string)` + +Converts a Punycode string of ASCII symbols to a string of Unicode symbols. + +```js +// decode domain name parts +punycode.decode('maana-pta'); // 'mañana' +punycode.decode('--dqo34k'); // '☃-⌘' +``` + +### `punycode.encode(string)` + +Converts a string of Unicode symbols to a Punycode string of ASCII symbols. + +```js +// encode domain name parts +punycode.encode('mañana'); // 'maana-pta' +punycode.encode('☃-⌘'); // '--dqo34k' +``` + +### `punycode.toUnicode(input)` + +Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode. + +```js +// decode domain names +punycode.toUnicode('xn--maana-pta.com'); +// → 'mañana.com' +punycode.toUnicode('xn----dqo34k.com'); +// → '☃-⌘.com' + +// decode email addresses +punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'); +// → 'джумла@джpумлатест.bрфa' +``` + +### `punycode.toASCII(input)` + +Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII. + +```js +// encode domain names +punycode.toASCII('mañana.com'); +// → 'xn--maana-pta.com' +punycode.toASCII('☃-⌘.com'); +// → 'xn----dqo34k.com' + +// encode email addresses +punycode.toASCII('джумла@джpумлатест.bрфa'); +// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq' +``` + +### `punycode.ucs2` + +#### `punycode.ucs2.decode(string)` + +Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16. + +```js +punycode.ucs2.decode('abc'); +// → [0x61, 0x62, 0x63] +// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE: +punycode.ucs2.decode('\uD834\uDF06'); +// → [0x1D306] +``` + +#### `punycode.ucs2.encode(codePoints)` + +Creates a string based on an array of numeric code point values. + +```js +punycode.ucs2.encode([0x61, 0x62, 0x63]); +// → 'abc' +punycode.ucs2.encode([0x1D306]); +// → '\uD834\uDF06' +``` + +### `punycode.version` + +A string representing the current Punycode.js version number. + +## Unit tests & code coverage + +After cloning this repository, run `npm install --dev` to install the dependencies needed for Punycode.js development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`. + +Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`. + +To generate the code coverage report, use `grunt cover`. + +Feel free to fork if you see possible improvements! + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## Contributors + +| [![twitter/jdalton](https://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") | +|---| +| [John-David Dalton](http://allyoucanleet.com/) | + +## License + +Punycode.js is available under the [MIT](https://mths.be/mit) license. diff --git a/appasar/canary/node_modules/punycode/package.json b/appasar/canary/node_modules/punycode/package.json new file mode 100644 index 0000000..accb530 --- /dev/null +++ b/appasar/canary/node_modules/punycode/package.json @@ -0,0 +1,60 @@ +{ + "name": "punycode", + "version": "1.4.1", + "description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.", + "homepage": "https://mths.be/punycode", + "main": "punycode.js", + "keywords": [ + "punycode", + "unicode", + "idn", + "idna", + "dns", + "url", + "domain" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "contributors": [ + { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + { + "name": "John-David Dalton", + "url": "http://allyoucanleet.com/" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git" + }, + "bugs": "https://github.com/bestiejs/punycode.js/issues", + "files": [ + "LICENSE-MIT.txt", + "punycode.js" + ], + "scripts": { + "test": "node tests/tests.js" + }, + "devDependencies": { + "coveralls": "^2.11.4", + "grunt": "^0.4.5", + "grunt-contrib-uglify": "^0.11.0", + "grunt-shell": "^1.1.2", + "istanbul": "^0.4.1", + "qunit-extras": "^1.4.4", + "qunitjs": "~1.11.0", + "requirejs": "^2.1.22" + }, + "jspm": { + "map": { + "./punycode.js": { + "node": "@node/punycode" + } + } + } +} diff --git a/appasar/canary/node_modules/punycode/punycode.js b/appasar/canary/node_modules/punycode/punycode.js new file mode 100644 index 0000000..2c87f6c --- /dev/null +++ b/appasar/canary/node_modules/punycode/punycode.js @@ -0,0 +1,533 @@ +/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); diff --git a/appasar/canary/node_modules/qs/.editorconfig b/appasar/canary/node_modules/qs/.editorconfig new file mode 100644 index 0000000..b2654e7 --- /dev/null +++ b/appasar/canary/node_modules/qs/.editorconfig @@ -0,0 +1,30 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 140 + +[test/*] +max_line_length = off + +[*.md] +max_line_length = off + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[LICENSE] +indent_size = 2 +max_line_length = off diff --git a/appasar/canary/node_modules/qs/.eslintignore b/appasar/canary/node_modules/qs/.eslintignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/appasar/canary/node_modules/qs/.eslintignore @@ -0,0 +1 @@ +dist diff --git a/appasar/canary/node_modules/qs/.eslintrc b/appasar/canary/node_modules/qs/.eslintrc new file mode 100644 index 0000000..a33d179 --- /dev/null +++ b/appasar/canary/node_modules/qs/.eslintrc @@ -0,0 +1,19 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": [2, 28], + "consistent-return": 1, + "func-name-matching": 0, + "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], + "indent": [2, 4], + "max-params": [2, 12], + "max-statements": [2, 45], + "no-continue": 1, + "no-magic-numbers": 0, + "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], + "operator-linebreak": [2, "before"], + } +} diff --git a/appasar/canary/node_modules/qs/CHANGELOG.md b/appasar/canary/node_modules/qs/CHANGELOG.md new file mode 100644 index 0000000..71d5a3e --- /dev/null +++ b/appasar/canary/node_modules/qs/CHANGELOG.md @@ -0,0 +1,221 @@ +## **6.5.1** +- [Fix] Fix parsing & compacting very deep objects (#224) +- [Refactor] name utils functions +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` +- [Tests] up to `node` `v8.4`; use `nvm install-latest-npm` so newer npm doesn’t break older node +- [Tests] Use precise dist for Node.js 0.6 runtime (#225) +- [Tests] make 0.6 required, now that it’s passing +- [Tests] on `node` `v8.2`; fix npm on node 0.6 + +## **6.5.0** +- [New] add `utils.assign` +- [New] pass default encoder/decoder to custom encoder/decoder functions (#206) +- [New] `parse`/`stringify`: add `ignoreQueryPrefix`/`addQueryPrefix` options, respectively (#213) +- [Fix] Handle stringifying empty objects with addQueryPrefix (#217) +- [Fix] do not mutate `options` argument (#207) +- [Refactor] `parse`: cache index to reuse in else statement (#182) +- [Docs] add various badges to readme (#208) +- [Dev Deps] update `eslint`, `browserify`, `iconv-lite`, `tape` +- [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`; npm v4.6 breaks on node < v1; npm v5+ breaks on node < v4 +- [Tests] add `editorconfig-tools` + +## **6.4.0** +- [New] `qs.stringify`: add `encodeValuesOnly` option +- [Fix] follow `allowPrototypes` option during merge (#201, #201) +- [Fix] support keys starting with brackets (#202, #200) +- [Fix] chmod a-x +- [Dev Deps] update `eslint` +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds +- [eslint] reduce warnings + +## **6.3.2** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Dev Deps] update `eslint` +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.3.1** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties (thanks, @snyk!) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `iconv-lite`, `qs-iconv`, `tape` +- [Tests] on all node minors; improve test matrix +- [Docs] document stringify option `allowDots` (#195) +- [Docs] add empty object and array values example (#195) +- [Docs] Fix minor inconsistency/typo (#192) +- [Docs] document stringify option `sort` (#191) +- [Refactor] `stringify`: throw faster with an invalid encoder +- [Refactor] remove unnecessary escapes (#184) +- Remove contributing.md, since `qs` is no longer part of `hapi` (#183) + +## **6.3.0** +- [New] Add support for RFC 1738 (#174, #173) +- [New] `stringify`: Add `serializeDate` option to customize Date serialization (#159) +- [Fix] ensure `utils.merge` handles merging two arrays +- [Refactor] only constructors should be capitalized +- [Refactor] capitalized var names are for constructors only +- [Refactor] avoid using a sparse array +- [Robustness] `formats`: cache `String#replace` +- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` +- [Tests] up to `node` `v6.8`, `v4.6`; improve test matrix +- [Tests] flesh out arrayLimit/arrayFormat tests (#107) +- [Tests] skip Object.create tests when null objects are not available +- [Tests] Turn on eslint for test files (#175) + +## **6.2.3** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.2.2** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties + +## **6.2.1** +- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values +- [Refactor] Be explicit and use `Object.prototype.hasOwnProperty.call` +- [Tests] remove `parallelshell` since it does not reliably report failures +- [Tests] up to `node` `v6.3`, `v5.12` +- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `qs-iconv` + +## [**6.2.0**](https://github.com/ljharb/qs/issues?milestone=36&state=closed) +- [New] pass Buffers to the encoder/decoder directly (#161) +- [New] add "encoder" and "decoder" options, for custom param encoding/decoding (#160) +- [Fix] fix compacting of nested sparse arrays (#150) + +## **6.1.2 +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.1.1** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties + +## [**6.1.0**](https://github.com/ljharb/qs/issues?milestone=35&state=closed) +- [New] allowDots option for `stringify` (#151) +- [Fix] "sort" option should work at a depth of 3 or more (#151) +- [Fix] Restore `dist` directory; will be removed in v7 (#148) + +## **6.0.4** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.0.3** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties +- [Fix] Restore `dist` directory; will be removed in v7 (#148) + +## [**6.0.2**](https://github.com/ljharb/qs/issues?milestone=33&state=closed) +- Revert ES6 requirement and restore support for node down to v0.8. + +## [**6.0.1**](https://github.com/ljharb/qs/issues?milestone=32&state=closed) +- [**#127**](https://github.com/ljharb/qs/pull/127) Fix engines definition in package.json + +## [**6.0.0**](https://github.com/ljharb/qs/issues?milestone=31&state=closed) +- [**#124**](https://github.com/ljharb/qs/issues/124) Use ES6 and drop support for node < v4 + +## **5.2.1** +- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values + +## [**5.2.0**](https://github.com/ljharb/qs/issues?milestone=30&state=closed) +- [**#64**](https://github.com/ljharb/qs/issues/64) Add option to sort object keys in the query string + +## [**5.1.0**](https://github.com/ljharb/qs/issues?milestone=29&state=closed) +- [**#117**](https://github.com/ljharb/qs/issues/117) make URI encoding stringified results optional +- [**#106**](https://github.com/ljharb/qs/issues/106) Add flag `skipNulls` to optionally skip null values in stringify + +## [**5.0.0**](https://github.com/ljharb/qs/issues?milestone=28&state=closed) +- [**#114**](https://github.com/ljharb/qs/issues/114) default allowDots to false +- [**#100**](https://github.com/ljharb/qs/issues/100) include dist to npm + +## [**4.0.0**](https://github.com/ljharb/qs/issues?milestone=26&state=closed) +- [**#98**](https://github.com/ljharb/qs/issues/98) make returning plain objects and allowing prototype overwriting properties optional + +## [**3.1.0**](https://github.com/ljharb/qs/issues?milestone=24&state=closed) +- [**#89**](https://github.com/ljharb/qs/issues/89) Add option to disable "Transform dot notation to bracket notation" + +## [**3.0.0**](https://github.com/ljharb/qs/issues?milestone=23&state=closed) +- [**#80**](https://github.com/ljharb/qs/issues/80) qs.parse silently drops properties +- [**#77**](https://github.com/ljharb/qs/issues/77) Perf boost +- [**#60**](https://github.com/ljharb/qs/issues/60) Add explicit option to disable array parsing +- [**#74**](https://github.com/ljharb/qs/issues/74) Bad parse when turning array into object +- [**#81**](https://github.com/ljharb/qs/issues/81) Add a `filter` option +- [**#68**](https://github.com/ljharb/qs/issues/68) Fixed issue with recursion and passing strings into objects. +- [**#66**](https://github.com/ljharb/qs/issues/66) Add mixed array and object dot notation support Closes: #47 +- [**#76**](https://github.com/ljharb/qs/issues/76) RFC 3986 +- [**#85**](https://github.com/ljharb/qs/issues/85) No equal sign +- [**#84**](https://github.com/ljharb/qs/issues/84) update license attribute + +## [**2.4.1**](https://github.com/ljharb/qs/issues?milestone=20&state=closed) +- [**#73**](https://github.com/ljharb/qs/issues/73) Property 'hasOwnProperty' of object # is not a function + +## [**2.4.0**](https://github.com/ljharb/qs/issues?milestone=19&state=closed) +- [**#70**](https://github.com/ljharb/qs/issues/70) Add arrayFormat option + +## [**2.3.3**](https://github.com/ljharb/qs/issues?milestone=18&state=closed) +- [**#59**](https://github.com/ljharb/qs/issues/59) make sure array indexes are >= 0, closes #57 +- [**#58**](https://github.com/ljharb/qs/issues/58) make qs usable for browser loader + +## [**2.3.2**](https://github.com/ljharb/qs/issues?milestone=17&state=closed) +- [**#55**](https://github.com/ljharb/qs/issues/55) allow merging a string into an object + +## [**2.3.1**](https://github.com/ljharb/qs/issues?milestone=16&state=closed) +- [**#52**](https://github.com/ljharb/qs/issues/52) Return "undefined" and "false" instead of throwing "TypeError". + +## [**2.3.0**](https://github.com/ljharb/qs/issues?milestone=15&state=closed) +- [**#50**](https://github.com/ljharb/qs/issues/50) add option to omit array indices, closes #46 + +## [**2.2.5**](https://github.com/ljharb/qs/issues?milestone=14&state=closed) +- [**#39**](https://github.com/ljharb/qs/issues/39) Is there an alternative to Buffer.isBuffer? +- [**#49**](https://github.com/ljharb/qs/issues/49) refactor utils.merge, fixes #45 +- [**#41**](https://github.com/ljharb/qs/issues/41) avoid browserifying Buffer, for #39 + +## [**2.2.4**](https://github.com/ljharb/qs/issues?milestone=13&state=closed) +- [**#38**](https://github.com/ljharb/qs/issues/38) how to handle object keys beginning with a number + +## [**2.2.3**](https://github.com/ljharb/qs/issues?milestone=12&state=closed) +- [**#37**](https://github.com/ljharb/qs/issues/37) parser discards first empty value in array +- [**#36**](https://github.com/ljharb/qs/issues/36) Update to lab 4.x + +## [**2.2.2**](https://github.com/ljharb/qs/issues?milestone=11&state=closed) +- [**#33**](https://github.com/ljharb/qs/issues/33) Error when plain object in a value +- [**#34**](https://github.com/ljharb/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty +- [**#24**](https://github.com/ljharb/qs/issues/24) Changelog? Semver? + +## [**2.2.1**](https://github.com/ljharb/qs/issues?milestone=10&state=closed) +- [**#32**](https://github.com/ljharb/qs/issues/32) account for circular references properly, closes #31 +- [**#31**](https://github.com/ljharb/qs/issues/31) qs.parse stackoverflow on circular objects + +## [**2.2.0**](https://github.com/ljharb/qs/issues?milestone=9&state=closed) +- [**#26**](https://github.com/ljharb/qs/issues/26) Don't use Buffer global if it's not present +- [**#30**](https://github.com/ljharb/qs/issues/30) Bug when merging non-object values into arrays +- [**#29**](https://github.com/ljharb/qs/issues/29) Don't call Utils.clone at the top of Utils.merge +- [**#23**](https://github.com/ljharb/qs/issues/23) Ability to not limit parameters? + +## [**2.1.0**](https://github.com/ljharb/qs/issues?milestone=8&state=closed) +- [**#22**](https://github.com/ljharb/qs/issues/22) Enable using a RegExp as delimiter + +## [**2.0.0**](https://github.com/ljharb/qs/issues?milestone=7&state=closed) +- [**#18**](https://github.com/ljharb/qs/issues/18) Why is there arrayLimit? +- [**#20**](https://github.com/ljharb/qs/issues/20) Configurable parametersLimit +- [**#21**](https://github.com/ljharb/qs/issues/21) make all limits optional, for #18, for #20 + +## [**1.2.2**](https://github.com/ljharb/qs/issues?milestone=6&state=closed) +- [**#19**](https://github.com/ljharb/qs/issues/19) Don't overwrite null values + +## [**1.2.1**](https://github.com/ljharb/qs/issues?milestone=5&state=closed) +- [**#16**](https://github.com/ljharb/qs/issues/16) ignore non-string delimiters +- [**#15**](https://github.com/ljharb/qs/issues/15) Close code block + +## [**1.2.0**](https://github.com/ljharb/qs/issues?milestone=4&state=closed) +- [**#12**](https://github.com/ljharb/qs/issues/12) Add optional delim argument +- [**#13**](https://github.com/ljharb/qs/issues/13) fix #11: flattened keys in array are now correctly parsed + +## [**1.1.0**](https://github.com/ljharb/qs/issues?milestone=3&state=closed) +- [**#7**](https://github.com/ljharb/qs/issues/7) Empty values of a POST array disappear after being submitted +- [**#9**](https://github.com/ljharb/qs/issues/9) Should not omit equals signs (=) when value is null +- [**#6**](https://github.com/ljharb/qs/issues/6) Minor grammar fix in README + +## [**1.0.2**](https://github.com/ljharb/qs/issues?milestone=2&state=closed) +- [**#5**](https://github.com/ljharb/qs/issues/5) array holes incorrectly copied into object on large index diff --git a/appasar/canary/node_modules/qs/LICENSE b/appasar/canary/node_modules/qs/LICENSE new file mode 100644 index 0000000..d456948 --- /dev/null +++ b/appasar/canary/node_modules/qs/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2014 Nathan LaFreniere and other contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * The names of any contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * * * + +The complete list of contributors can be found at: https://github.com/hapijs/qs/graphs/contributors diff --git a/appasar/canary/node_modules/qs/README.md b/appasar/canary/node_modules/qs/README.md new file mode 100644 index 0000000..d811966 --- /dev/null +++ b/appasar/canary/node_modules/qs/README.md @@ -0,0 +1,475 @@ +# qs [![Version Badge][2]][1] + +[![Build Status][3]][4] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +A querystring parsing and stringifying library with some added security. + +Lead Maintainer: [Jordan Harband](https://github.com/ljharb) + +The **qs** module was originally created and maintained by [TJ Holowaychuk](https://github.com/visionmedia/node-querystring). + +## Usage + +```javascript +var qs = require('qs'); +var assert = require('assert'); + +var obj = qs.parse('a=c'); +assert.deepEqual(obj, { a: 'c' }); + +var str = qs.stringify(obj); +assert.equal(str, 'a=c'); +``` + +### Parsing Objects + +[](#preventEval) +```javascript +qs.parse(string, [options]); +``` + +**qs** allows you to create nested objects within your query strings, by surrounding the name of sub-keys with square brackets `[]`. +For example, the string `'foo[bar]=baz'` converts to: + +```javascript +assert.deepEqual(qs.parse('foo[bar]=baz'), { + foo: { + bar: 'baz' + } +}); +``` + +When using the `plainObjects` option the parsed value is returned as a null object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like: + +```javascript +var nullObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); +assert.deepEqual(nullObject, { a: { hasOwnProperty: 'b' } }); +``` + +By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use `plainObjects` as mentioned above, or set `allowPrototypes` to `true` which will allow user input to overwrite those properties. *WARNING* It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option. + +```javascript +var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); +assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); +``` + +URI encoded strings work too: + +```javascript +assert.deepEqual(qs.parse('a%5Bb%5D=c'), { + a: { b: 'c' } +}); +``` + +You can also nest your objects, like `'foo[bar][baz]=foobarbaz'`: + +```javascript +assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { + foo: { + bar: { + baz: 'foobarbaz' + } + } +}); +``` + +By default, when nesting objects **qs** will only parse up to 5 children deep. This means if you attempt to parse a string like +`'a[b][c][d][e][f][g][h][i]=j'` your resulting object will be: + +```javascript +var expected = { + a: { + b: { + c: { + d: { + e: { + f: { + '[g][h][i]': 'j' + } + } + } + } + } + } +}; +var string = 'a[b][c][d][e][f][g][h][i]=j'; +assert.deepEqual(qs.parse(string), expected); +``` + +This depth can be overridden by passing a `depth` option to `qs.parse(string, [options])`: + +```javascript +var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); +assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); +``` + +The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number. + +For similar reasons, by default **qs** will only parse up to 1000 parameters. This can be overridden by passing a `parameterLimit` option: + +```javascript +var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); +assert.deepEqual(limited, { a: 'b' }); +``` + +To bypass the leading question mark, use `ignoreQueryPrefix`: + +```javascript +var prefixed = qs.parse('?a=b&c=d', { ignoreQueryPrefix: true }); +assert.deepEqual(prefixed, { a: 'b', c: 'd' }); +``` + +An optional delimiter can also be passed: + +```javascript +var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); +assert.deepEqual(delimited, { a: 'b', c: 'd' }); +``` + +Delimiters can be a regular expression too: + +```javascript +var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); +assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); +``` + +Option `allowDots` can be used to enable dot notation: + +```javascript +var withDots = qs.parse('a.b=c', { allowDots: true }); +assert.deepEqual(withDots, { a: { b: 'c' } }); +``` + +### Parsing Arrays + +**qs** can also parse arrays using a similar `[]` notation: + +```javascript +var withArray = qs.parse('a[]=b&a[]=c'); +assert.deepEqual(withArray, { a: ['b', 'c'] }); +``` + +You may specify an index as well: + +```javascript +var withIndexes = qs.parse('a[1]=c&a[0]=b'); +assert.deepEqual(withIndexes, { a: ['b', 'c'] }); +``` + +Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number +to create an array. When creating arrays with specific indices, **qs** will compact a sparse array to only the existing values preserving +their order: + +```javascript +var noSparse = qs.parse('a[1]=b&a[15]=c'); +assert.deepEqual(noSparse, { a: ['b', 'c'] }); +``` + +Note that an empty string is also a value, and will be preserved: + +```javascript +var withEmptyString = qs.parse('a[]=&a[]=b'); +assert.deepEqual(withEmptyString, { a: ['', 'b'] }); + +var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); +assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); +``` + +**qs** will also limit specifying indices in an array to a maximum index of `20`. Any array members with an index of greater than `20` will +instead be converted to an object with the index as the key: + +```javascript +var withMaxIndex = qs.parse('a[100]=b'); +assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); +``` + +This limit can be overridden by passing an `arrayLimit` option: + +```javascript +var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); +assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); +``` + +To disable array parsing entirely, set `parseArrays` to `false`. + +```javascript +var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); +assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); +``` + +If you mix notations, **qs** will merge the two items into an object: + +```javascript +var mixedNotation = qs.parse('a[0]=b&a[b]=c'); +assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); +``` + +You can also create arrays of objects: + +```javascript +var arraysOfObjects = qs.parse('a[][b]=c'); +assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); +``` + +### Stringifying + +[](#preventEval) +```javascript +qs.stringify(object, [options]); +``` + +When stringifying, **qs** by default URI encodes output. Objects are stringified as you would expect: + +```javascript +assert.equal(qs.stringify({ a: 'b' }), 'a=b'); +assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); +``` + +This encoding can be disabled by setting the `encode` option to `false`: + +```javascript +var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); +assert.equal(unencoded, 'a[b]=c'); +``` + +Encoding can be disabled for keys by setting the `encodeValuesOnly` option to `true`: +```javascript +var encodedValues = qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true } +); +assert.equal(encodedValues,'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h'); +``` + +This encoding can also be replaced by a custom encoding method set as `encoder` option: + +```javascript +var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) { + // Passed in values `a`, `b`, `c` + return // Return encoded string +}}) +``` + +_(Note: the `encoder` option does not apply if `encode` is `false`)_ + +Analogue to the `encoder` there is a `decoder` option for `parse` to override decoding of properties and values: + +```javascript +var decoded = qs.parse('x=z', { decoder: function (str) { + // Passed in values `x`, `z` + return // Return decoded string +}}) +``` + +Examples beyond this point will be shown as though the output is not URI encoded for clarity. Please note that the return values in these cases *will* be URI encoded during real usage. + +When arrays are stringified, by default they are given explicit indices: + +```javascript +qs.stringify({ a: ['b', 'c', 'd'] }); +// 'a[0]=b&a[1]=c&a[2]=d' +``` + +You may override this by setting the `indices` option to `false`: + +```javascript +qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); +// 'a=b&a=c&a=d' +``` + +You may use the `arrayFormat` option to specify the format of the output array: + +```javascript +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) +// 'a[0]=b&a[1]=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) +// 'a[]=b&a[]=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) +// 'a=b&a=c' +``` + +When objects are stringified, by default they use bracket notation: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }); +// 'a[b][c]=d&a[b][e]=f' +``` + +You may override this to use dot notation by setting the `allowDots` option to `true`: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }, { allowDots: true }); +// 'a.b.c=d&a.b.e=f' +``` + +Empty strings and null values will omit the value, but the equals sign (=) remains in place: + +```javascript +assert.equal(qs.stringify({ a: '' }), 'a='); +``` + +Key with no values (such as an empty object or array) will return nothing: + +```javascript +assert.equal(qs.stringify({ a: [] }), ''); +assert.equal(qs.stringify({ a: {} }), ''); +assert.equal(qs.stringify({ a: [{}] }), ''); +assert.equal(qs.stringify({ a: { b: []} }), ''); +assert.equal(qs.stringify({ a: { b: {}} }), ''); +``` + +Properties that are set to `undefined` will be omitted entirely: + +```javascript +assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); +``` + +The query string may optionally be prepended with a question mark: + +```javascript +assert.equal(qs.stringify({ a: 'b', c: 'd' }, { addQueryPrefix: true }), '?a=b&c=d'); +``` + +The delimiter may be overridden with stringify as well: + +```javascript +assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); +``` + +If you only want to override the serialization of `Date` objects, you can provide a `serializeDate` option: + +```javascript +var date = new Date(7); +assert.equal(qs.stringify({ a: date }), 'a=1970-01-01T00:00:00.007Z'.replace(/:/g, '%3A')); +assert.equal( + qs.stringify({ a: date }, { serializeDate: function (d) { return d.getTime(); } }), + 'a=7' +); +``` + +You may use the `sort` option to affect the order of parameter keys: + +```javascript +function alphabeticalSort(a, b) { + return a.localeCompare(b); +} +assert.equal(qs.stringify({ a: 'c', z: 'y', b : 'f' }, { sort: alphabeticalSort }), 'a=c&b=f&z=y'); +``` + +Finally, you can use the `filter` option to restrict which keys will be included in the stringified output. +If you pass a function, it will be called for each key to obtain the replacement value. Otherwise, if you +pass an array, it will be used to select properties and array indices for stringification: + +```javascript +function filterFunc(prefix, value) { + if (prefix == 'b') { + // Return an `undefined` value to omit a property. + return; + } + if (prefix == 'e[f]') { + return value.getTime(); + } + if (prefix == 'e[g][0]') { + return value * 2; + } + return value; +} +qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: filterFunc }); +// 'a=b&c=d&e[f]=123&e[g][0]=4' +qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); +// 'a=b&e=f' +qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); +// 'a[0]=b&a[2]=d' +``` + +### Handling of `null` values + +By default, `null` values are treated like empty strings: + +```javascript +var withNull = qs.stringify({ a: null, b: '' }); +assert.equal(withNull, 'a=&b='); +``` + +Parsing does not distinguish between parameters with and without equal signs. Both are converted to empty strings. + +```javascript +var equalsInsensitive = qs.parse('a&b='); +assert.deepEqual(equalsInsensitive, { a: '', b: '' }); +``` + +To distinguish between `null` values and empty strings use the `strictNullHandling` flag. In the result string the `null` +values have no `=` sign: + +```javascript +var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); +assert.equal(strictNull, 'a&b='); +``` + +To parse values without `=` back to `null` use the `strictNullHandling` flag: + +```javascript +var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); +assert.deepEqual(parsedStrictNull, { a: null, b: '' }); +``` + +To completely skip rendering keys with `null` values, use the `skipNulls` flag: + +```javascript +var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true }); +assert.equal(nullsSkipped, 'a=b'); +``` + +### Dealing with special character sets + +By default the encoding and decoding of characters is done in `utf-8`. If you +wish to encode querystrings to a different character set (i.e. +[Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the +[`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library: + +```javascript +var encoder = require('qs-iconv/encoder')('shift_jis'); +var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); +assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); +``` + +This also works for decoding of query strings: + +```javascript +var decoder = require('qs-iconv/decoder')('shift_jis'); +var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); +assert.deepEqual(obj, { a: 'こんにちは!' }); +``` + +### RFC 3986 and RFC 1738 space encoding + +RFC3986 used as default option and encodes ' ' to *%20* which is backward compatible. +In the same time, output can be stringified as per RFC1738 with ' ' equal to '+'. + +``` +assert.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); +assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC3986' }), 'a=b%20c'); +assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC1738' }), 'a=b+c'); +``` + +[1]: https://npmjs.org/package/qs +[2]: http://versionbadg.es/ljharb/qs.svg +[3]: https://api.travis-ci.org/ljharb/qs.svg +[4]: https://travis-ci.org/ljharb/qs +[5]: https://david-dm.org/ljharb/qs.svg +[6]: https://david-dm.org/ljharb/qs +[7]: https://david-dm.org/ljharb/qs/dev-status.svg +[8]: https://david-dm.org/ljharb/qs?type=dev +[9]: https://ci.testling.com/ljharb/qs.png +[10]: https://ci.testling.com/ljharb/qs +[11]: https://nodei.co/npm/qs.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/qs.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/qs.svg +[downloads-url]: http://npm-stat.com/charts.html?package=qs diff --git a/appasar/canary/node_modules/qs/dist/qs.js b/appasar/canary/node_modules/qs/dist/qs.js new file mode 100644 index 0000000..713c6d1 --- /dev/null +++ b/appasar/canary/node_modules/qs/dist/qs.js @@ -0,0 +1,627 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0; --i) { + var obj; + var root = chain[i]; + + if (root === '[]') { + obj = []; + obj = obj.concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if ( + !isNaN(index) + && root !== cleanRoot + && String(index) === cleanRoot + && index >= 0 + && (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = leaf; + } else { + obj[cleanRoot] = leaf; + } + } + + leaf = obj; + } + + return leaf; +}; + +var parseKeys = function parseQueryStringKeys(givenKey, val, options) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys + // that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while ((segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options); +}; + +module.exports = function (str, opts) { + var options = opts ? utils.assign({}, opts) : {}; + + if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + options.ignoreQueryPrefix = options.ignoreQueryPrefix === true; + options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit; + options.parseArrays = options.parseArrays !== false; + options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder; + options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots; + options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects; + options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit; + options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options); + obj = utils.merge(obj, newObj, options); + } + + return utils.compact(obj); +}; + +},{"./utils":5}],4:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); +var formats = require('./formats'); + +var arrayPrefixGenerators = { + brackets: function brackets(prefix) { // eslint-disable-line func-name-matching + return prefix + '[]'; + }, + indices: function indices(prefix, key) { // eslint-disable-line func-name-matching + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { // eslint-disable-line func-name-matching + return prefix; + } +}; + +var toISO = Date.prototype.toISOString; + +var defaults = { + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false +}; + +var stringify = function stringify( // eslint-disable-line func-name-matching + object, + prefix, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly +) { + var obj = object; + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix; + } + + obj = ''; + } + + if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder); + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (Array.isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + if (Array.isArray(obj)) { + values = values.concat(stringify( + obj[key], + generateArrayPrefix(prefix, key), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } else { + values = values.concat(stringify( + obj[key], + prefix + (allowDots ? '.' + key : '[' + key + ']'), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + } + + return values; +}; + +module.exports = function (object, opts) { + var obj = object; + var options = opts ? utils.assign({}, opts) : {}; + + if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter; + var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls; + var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode; + var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder; + var sort = typeof options.sort === 'function' ? options.sort : null; + var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; + var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate; + var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly; + if (typeof options.format === 'undefined') { + options.format = formats['default']; + } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) { + throw new TypeError('Unknown format option provided.'); + } + var formatter = formats.formatters[options.format]; + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (Array.isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (options.arrayFormat in arrayPrefixGenerators) { + arrayFormat = options.arrayFormat; + } else if ('indices' in options) { + arrayFormat = options.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (sort) { + objKeys.sort(sort); + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + keys = keys.concat(stringify( + obj[key], + key, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encode ? encoder : null, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + + var joined = keys.join(delimiter); + var prefix = options.addQueryPrefix === true ? '?' : ''; + + return joined.length > 0 ? prefix + joined : ''; +}; + +},{"./formats":1,"./utils":5}],5:[function(require,module,exports){ +'use strict'; + +var has = Object.prototype.hasOwnProperty; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +}()); + +var compactQueue = function compactQueue(queue) { + var obj; + + while (queue.length) { + var item = queue.pop(); + obj = item.obj[item.prop]; + + if (Array.isArray(obj)) { + var compacted = []; + + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + item.obj[item.prop] = compacted; + } + } + + return obj; +}; + +exports.arrayToObject = function arrayToObject(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +}; + +exports.merge = function merge(target, source, options) { + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (Array.isArray(target)) { + target.push(source); + } else if (typeof target === 'object') { + if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (Array.isArray(target) && !Array.isArray(source)) { + mergeTarget = exports.arrayToObject(target, options); + } + + if (Array.isArray(target) && Array.isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + if (target[i] && typeof target[i] === 'object') { + target[i] = exports.merge(target[i], item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (has.call(acc, key)) { + acc[key] = exports.merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +}; + +exports.assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +}; + +exports.decode = function (str) { + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (e) { + return str; + } +}; + +exports.encode = function encode(str) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = typeof str === 'string' ? str : String(str); + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + out += hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + } + + return out; +}; + +exports.compact = function compact(value) { + var queue = [{ obj: { o: value }, prop: 'o' }]; + var refs = []; + + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + return compactQueue(queue); +}; + +exports.isRegExp = function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + +exports.isBuffer = function isBuffer(obj) { + if (obj === null || typeof obj === 'undefined') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +}; + +},{}]},{},[2])(2) +}); \ No newline at end of file diff --git a/appasar/canary/node_modules/qs/lib/formats.js b/appasar/canary/node_modules/qs/lib/formats.js new file mode 100644 index 0000000..df45997 --- /dev/null +++ b/appasar/canary/node_modules/qs/lib/formats.js @@ -0,0 +1,18 @@ +'use strict'; + +var replace = String.prototype.replace; +var percentTwenties = /%20/g; + +module.exports = { + 'default': 'RFC3986', + formatters: { + RFC1738: function (value) { + return replace.call(value, percentTwenties, '+'); + }, + RFC3986: function (value) { + return value; + } + }, + RFC1738: 'RFC1738', + RFC3986: 'RFC3986' +}; diff --git a/appasar/canary/node_modules/qs/lib/index.js b/appasar/canary/node_modules/qs/lib/index.js new file mode 100644 index 0000000..0d6a97d --- /dev/null +++ b/appasar/canary/node_modules/qs/lib/index.js @@ -0,0 +1,11 @@ +'use strict'; + +var stringify = require('./stringify'); +var parse = require('./parse'); +var formats = require('./formats'); + +module.exports = { + formats: formats, + parse: parse, + stringify: stringify +}; diff --git a/appasar/canary/node_modules/qs/lib/parse.js b/appasar/canary/node_modules/qs/lib/parse.js new file mode 100644 index 0000000..8c9872e --- /dev/null +++ b/appasar/canary/node_modules/qs/lib/parse.js @@ -0,0 +1,174 @@ +'use strict'; + +var utils = require('./utils'); + +var has = Object.prototype.hasOwnProperty; + +var defaults = { + allowDots: false, + allowPrototypes: false, + arrayLimit: 20, + decoder: utils.decode, + delimiter: '&', + depth: 5, + parameterLimit: 1000, + plainObjects: false, + strictNullHandling: false +}; + +var parseValues = function parseQueryStringValues(str, options) { + var obj = {}; + var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; + var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; + var parts = cleanStr.split(options.delimiter, limit); + + for (var i = 0; i < parts.length; ++i) { + var part = parts[i]; + + var bracketEqualsPos = part.indexOf(']='); + var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; + + var key, val; + if (pos === -1) { + key = options.decoder(part, defaults.decoder); + val = options.strictNullHandling ? null : ''; + } else { + key = options.decoder(part.slice(0, pos), defaults.decoder); + val = options.decoder(part.slice(pos + 1), defaults.decoder); + } + if (has.call(obj, key)) { + obj[key] = [].concat(obj[key]).concat(val); + } else { + obj[key] = val; + } + } + + return obj; +}; + +var parseObject = function (chain, val, options) { + var leaf = val; + + for (var i = chain.length - 1; i >= 0; --i) { + var obj; + var root = chain[i]; + + if (root === '[]') { + obj = []; + obj = obj.concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if ( + !isNaN(index) + && root !== cleanRoot + && String(index) === cleanRoot + && index >= 0 + && (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = leaf; + } else { + obj[cleanRoot] = leaf; + } + } + + leaf = obj; + } + + return leaf; +}; + +var parseKeys = function parseQueryStringKeys(givenKey, val, options) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys + // that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while ((segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options); +}; + +module.exports = function (str, opts) { + var options = opts ? utils.assign({}, opts) : {}; + + if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + options.ignoreQueryPrefix = options.ignoreQueryPrefix === true; + options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit; + options.parseArrays = options.parseArrays !== false; + options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder; + options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots; + options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects; + options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit; + options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options); + obj = utils.merge(obj, newObj, options); + } + + return utils.compact(obj); +}; diff --git a/appasar/canary/node_modules/qs/lib/stringify.js b/appasar/canary/node_modules/qs/lib/stringify.js new file mode 100644 index 0000000..ab915ac --- /dev/null +++ b/appasar/canary/node_modules/qs/lib/stringify.js @@ -0,0 +1,210 @@ +'use strict'; + +var utils = require('./utils'); +var formats = require('./formats'); + +var arrayPrefixGenerators = { + brackets: function brackets(prefix) { // eslint-disable-line func-name-matching + return prefix + '[]'; + }, + indices: function indices(prefix, key) { // eslint-disable-line func-name-matching + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { // eslint-disable-line func-name-matching + return prefix; + } +}; + +var toISO = Date.prototype.toISOString; + +var defaults = { + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false +}; + +var stringify = function stringify( // eslint-disable-line func-name-matching + object, + prefix, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly +) { + var obj = object; + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix; + } + + obj = ''; + } + + if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder); + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (Array.isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + if (Array.isArray(obj)) { + values = values.concat(stringify( + obj[key], + generateArrayPrefix(prefix, key), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } else { + values = values.concat(stringify( + obj[key], + prefix + (allowDots ? '.' + key : '[' + key + ']'), + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + } + + return values; +}; + +module.exports = function (object, opts) { + var obj = object; + var options = opts ? utils.assign({}, opts) : {}; + + if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter; + var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; + var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls; + var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode; + var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder; + var sort = typeof options.sort === 'function' ? options.sort : null; + var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; + var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate; + var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly; + if (typeof options.format === 'undefined') { + options.format = formats['default']; + } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) { + throw new TypeError('Unknown format option provided.'); + } + var formatter = formats.formatters[options.format]; + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (Array.isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (options.arrayFormat in arrayPrefixGenerators) { + arrayFormat = options.arrayFormat; + } else if ('indices' in options) { + arrayFormat = options.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (sort) { + objKeys.sort(sort); + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (skipNulls && obj[key] === null) { + continue; + } + + keys = keys.concat(stringify( + obj[key], + key, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encode ? encoder : null, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly + )); + } + + var joined = keys.join(delimiter); + var prefix = options.addQueryPrefix === true ? '?' : ''; + + return joined.length > 0 ? prefix + joined : ''; +}; diff --git a/appasar/canary/node_modules/qs/lib/utils.js b/appasar/canary/node_modules/qs/lib/utils.js new file mode 100644 index 0000000..06cae2f --- /dev/null +++ b/appasar/canary/node_modules/qs/lib/utils.js @@ -0,0 +1,202 @@ +'use strict'; + +var has = Object.prototype.hasOwnProperty; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +}()); + +var compactQueue = function compactQueue(queue) { + var obj; + + while (queue.length) { + var item = queue.pop(); + obj = item.obj[item.prop]; + + if (Array.isArray(obj)) { + var compacted = []; + + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + item.obj[item.prop] = compacted; + } + } + + return obj; +}; + +exports.arrayToObject = function arrayToObject(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +}; + +exports.merge = function merge(target, source, options) { + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (Array.isArray(target)) { + target.push(source); + } else if (typeof target === 'object') { + if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (Array.isArray(target) && !Array.isArray(source)) { + mergeTarget = exports.arrayToObject(target, options); + } + + if (Array.isArray(target) && Array.isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + if (target[i] && typeof target[i] === 'object') { + target[i] = exports.merge(target[i], item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (has.call(acc, key)) { + acc[key] = exports.merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +}; + +exports.assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +}; + +exports.decode = function (str) { + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (e) { + return str; + } +}; + +exports.encode = function encode(str) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = typeof str === 'string' ? str : String(str); + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + out += hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + } + + return out; +}; + +exports.compact = function compact(value) { + var queue = [{ obj: { o: value }, prop: 'o' }]; + var refs = []; + + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + return compactQueue(queue); +}; + +exports.isRegExp = function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + +exports.isBuffer = function isBuffer(obj) { + if (obj === null || typeof obj === 'undefined') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +}; diff --git a/appasar/canary/node_modules/qs/package.json b/appasar/canary/node_modules/qs/package.json new file mode 100644 index 0000000..8867196 --- /dev/null +++ b/appasar/canary/node_modules/qs/package.json @@ -0,0 +1,51 @@ +{ + "name": "qs", + "description": "A querystring parser that supports nesting and arrays, with a depth limit", + "homepage": "https://github.com/ljharb/qs", + "version": "6.5.1", + "repository": { + "type": "git", + "url": "https://github.com/ljharb/qs.git" + }, + "main": "lib/index.js", + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "keywords": [ + "querystring", + "qs" + ], + "engines": { + "node": ">=0.6" + }, + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "browserify": "^14.4.0", + "covert": "^1.1.0", + "editorconfig-tools": "^0.1.1", + "eslint": "^4.6.1", + "evalmd": "^0.0.17", + "iconv-lite": "^0.4.18", + "mkdirp": "^0.5.1", + "qs-iconv": "^1.0.4", + "safe-publish-latest": "^1.1.1", + "tape": "^4.8.0" + }, + "scripts": { + "prepublish": "safe-publish-latest && npm run dist", + "pretest": "npm run --silent readme && npm run --silent lint", + "test": "npm run --silent coverage", + "tests-only": "node test", + "readme": "evalmd README.md", + "prelint": "editorconfig-tools check * lib/* test/*", + "lint": "eslint lib/*.js test/*.js", + "coverage": "covert test", + "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js" + }, + "license": "BSD-3-Clause" +} diff --git a/appasar/canary/node_modules/qs/test/.eslintrc b/appasar/canary/node_modules/qs/test/.eslintrc new file mode 100644 index 0000000..20175d6 --- /dev/null +++ b/appasar/canary/node_modules/qs/test/.eslintrc @@ -0,0 +1,15 @@ +{ + "rules": { + "array-bracket-newline": 0, + "array-element-newline": 0, + "consistent-return": 2, + "max-lines": 0, + "max-nested-callbacks": [2, 3], + "max-statements": 0, + "no-buffer-constructor": 0, + "no-extend-native": 0, + "no-magic-numbers": 0, + "object-curly-newline": 0, + "sort-keys": 0 + } +} diff --git a/appasar/canary/node_modules/qs/test/index.js b/appasar/canary/node_modules/qs/test/index.js new file mode 100644 index 0000000..5e6bc8f --- /dev/null +++ b/appasar/canary/node_modules/qs/test/index.js @@ -0,0 +1,7 @@ +'use strict'; + +require('./parse'); + +require('./stringify'); + +require('./utils'); diff --git a/appasar/canary/node_modules/qs/test/parse.js b/appasar/canary/node_modules/qs/test/parse.js new file mode 100644 index 0000000..d7d8641 --- /dev/null +++ b/appasar/canary/node_modules/qs/test/parse.js @@ -0,0 +1,573 @@ +'use strict'; + +var test = require('tape'); +var qs = require('../'); +var utils = require('../lib/utils'); +var iconv = require('iconv-lite'); + +test('parse()', function (t) { + t.test('parses a simple string', function (st) { + st.deepEqual(qs.parse('0=foo'), { 0: 'foo' }); + st.deepEqual(qs.parse('foo=c++'), { foo: 'c ' }); + st.deepEqual(qs.parse('a[>=]=23'), { a: { '>=': '23' } }); + st.deepEqual(qs.parse('a[<=>]==23'), { a: { '<=>': '=23' } }); + st.deepEqual(qs.parse('a[==]=23'), { a: { '==': '23' } }); + st.deepEqual(qs.parse('foo', { strictNullHandling: true }), { foo: null }); + st.deepEqual(qs.parse('foo'), { foo: '' }); + st.deepEqual(qs.parse('foo='), { foo: '' }); + st.deepEqual(qs.parse('foo=bar'), { foo: 'bar' }); + st.deepEqual(qs.parse(' foo = bar = baz '), { ' foo ': ' bar = baz ' }); + st.deepEqual(qs.parse('foo=bar=baz'), { foo: 'bar=baz' }); + st.deepEqual(qs.parse('foo=bar&bar=baz'), { foo: 'bar', bar: 'baz' }); + st.deepEqual(qs.parse('foo2=bar2&baz2='), { foo2: 'bar2', baz2: '' }); + st.deepEqual(qs.parse('foo=bar&baz', { strictNullHandling: true }), { foo: 'bar', baz: null }); + st.deepEqual(qs.parse('foo=bar&baz'), { foo: 'bar', baz: '' }); + st.deepEqual(qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World'), { + cht: 'p3', + chd: 't:60,40', + chs: '250x100', + chl: 'Hello|World' + }); + st.end(); + }); + + t.test('allows enabling dot notation', function (st) { + st.deepEqual(qs.parse('a.b=c'), { 'a.b': 'c' }); + st.deepEqual(qs.parse('a.b=c', { allowDots: true }), { a: { b: 'c' } }); + st.end(); + }); + + t.deepEqual(qs.parse('a[b]=c'), { a: { b: 'c' } }, 'parses a single nested string'); + t.deepEqual(qs.parse('a[b][c]=d'), { a: { b: { c: 'd' } } }, 'parses a double nested string'); + t.deepEqual( + qs.parse('a[b][c][d][e][f][g][h]=i'), + { a: { b: { c: { d: { e: { f: { '[g][h]': 'i' } } } } } } }, + 'defaults to a depth of 5' + ); + + t.test('only parses one level when depth = 1', function (st) { + st.deepEqual(qs.parse('a[b][c]=d', { depth: 1 }), { a: { b: { '[c]': 'd' } } }); + st.deepEqual(qs.parse('a[b][c][d]=e', { depth: 1 }), { a: { b: { '[c][d]': 'e' } } }); + st.end(); + }); + + t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array'); + + t.test('parses an explicit array', function (st) { + st.deepEqual(qs.parse('a[]=b'), { a: ['b'] }); + st.deepEqual(qs.parse('a[]=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a[]=c&a[]=d'), { a: ['b', 'c', 'd'] }); + st.end(); + }); + + t.test('parses a mix of simple and explicit arrays', function (st) { + st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[0]=c'), { a: ['b', 'c'] }); + + st.deepEqual(qs.parse('a[1]=b&a=c', { arrayLimit: 20 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c', { arrayLimit: 0 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); + + st.deepEqual(qs.parse('a=b&a[1]=c', { arrayLimit: 20 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[]=c', { arrayLimit: 0 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); + + st.end(); + }); + + t.test('parses a nested array', function (st) { + st.deepEqual(qs.parse('a[b][]=c&a[b][]=d'), { a: { b: ['c', 'd'] } }); + st.deepEqual(qs.parse('a[>=]=25'), { a: { '>=': '25' } }); + st.end(); + }); + + t.test('allows to specify array indices', function (st) { + st.deepEqual(qs.parse('a[1]=c&a[0]=b&a[2]=d'), { a: ['b', 'c', 'd'] }); + st.deepEqual(qs.parse('a[1]=c&a[0]=b'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 20 }), { a: ['c'] }); + st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 0 }), { a: { 1: 'c' } }); + st.deepEqual(qs.parse('a[1]=c'), { a: ['c'] }); + st.end(); + }); + + t.test('limits specific array indices to arrayLimit', function (st) { + st.deepEqual(qs.parse('a[20]=a', { arrayLimit: 20 }), { a: ['a'] }); + st.deepEqual(qs.parse('a[21]=a', { arrayLimit: 20 }), { a: { 21: 'a' } }); + st.end(); + }); + + t.deepEqual(qs.parse('a[12b]=c'), { a: { '12b': 'c' } }, 'supports keys that begin with a number'); + + t.test('supports encoded = signs', function (st) { + st.deepEqual(qs.parse('he%3Dllo=th%3Dere'), { 'he=llo': 'th=ere' }); + st.end(); + }); + + t.test('is ok with url encoded strings', function (st) { + st.deepEqual(qs.parse('a[b%20c]=d'), { a: { 'b c': 'd' } }); + st.deepEqual(qs.parse('a[b]=c%20d'), { a: { b: 'c d' } }); + st.end(); + }); + + t.test('allows brackets in the value', function (st) { + st.deepEqual(qs.parse('pets=["tobi"]'), { pets: '["tobi"]' }); + st.deepEqual(qs.parse('operators=[">=", "<="]'), { operators: '[">=", "<="]' }); + st.end(); + }); + + t.test('allows empty values', function (st) { + st.deepEqual(qs.parse(''), {}); + st.deepEqual(qs.parse(null), {}); + st.deepEqual(qs.parse(undefined), {}); + st.end(); + }); + + t.test('transforms arrays to objects', function (st) { + st.deepEqual(qs.parse('foo[0]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[0]=bar'), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar'), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } }); + st.deepEqual(qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb'), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); + + st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: false }), { a: { 0: 'b', t: 'u' } }); + st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: true }), { a: { 0: 'b', t: 'u', hasOwnProperty: 'c' } }); + st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: false }), { a: { 0: 'b', x: 'y' } }); + st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: true }), { a: { 0: 'b', hasOwnProperty: 'c', x: 'y' } }); + st.end(); + }); + + t.test('transforms arrays to objects (dot notation)', function (st) { + st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: 'baz' } }); + st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad.boo=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: { boo: 'baz' } } }); + st.deepEqual(qs.parse('foo[0][0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [[{ baz: 'bar' }]], fool: { bad: 'baz' } }); + st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15'], bar: '2' }] }); + st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].baz[1]=16&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15', '16'], bar: '2' }] }); + st.deepEqual(qs.parse('foo.bad=baz&foo[0]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[]=bar&foo.bad=baz', { allowDots: true }), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar&foo[]=foo', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } }); + st.deepEqual(qs.parse('foo[0].a=a&foo[0].b=b&foo[1].a=aa&foo[1].b=bb', { allowDots: true }), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); + st.end(); + }); + + t.test('correctly prunes undefined values when converting an array to an object', function (st) { + st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { 2: 'b', 99999999: 'c' } }); + st.end(); + }); + + t.test('supports malformed uri characters', function (st) { + st.deepEqual(qs.parse('{%:%}', { strictNullHandling: true }), { '{%:%}': null }); + st.deepEqual(qs.parse('{%:%}='), { '{%:%}': '' }); + st.deepEqual(qs.parse('foo=%:%}'), { foo: '%:%}' }); + st.end(); + }); + + t.test('doesn\'t produce empty keys', function (st) { + st.deepEqual(qs.parse('_r=1&'), { _r: '1' }); + st.end(); + }); + + t.test('cannot access Object prototype', function (st) { + qs.parse('constructor[prototype][bad]=bad'); + qs.parse('bad[constructor][prototype][bad]=bad'); + st.equal(typeof Object.prototype.bad, 'undefined'); + st.end(); + }); + + t.test('parses arrays of objects', function (st) { + st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); + st.deepEqual(qs.parse('a[0][b]=c'), { a: [{ b: 'c' }] }); + st.end(); + }); + + t.test('allows for empty strings in arrays', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=&a[]=c'), { a: ['b', '', 'c'] }); + + st.deepEqual( + qs.parse('a[0]=b&a[1]&a[2]=c&a[19]=', { strictNullHandling: true, arrayLimit: 20 }), + { a: ['b', null, 'c', ''] }, + 'with arrayLimit 20 + array indices: null then empty string works' + ); + st.deepEqual( + qs.parse('a[]=b&a[]&a[]=c&a[]=', { strictNullHandling: true, arrayLimit: 0 }), + { a: ['b', null, 'c', ''] }, + 'with arrayLimit 0 + array brackets: null then empty string works' + ); + + st.deepEqual( + qs.parse('a[0]=b&a[1]=&a[2]=c&a[19]', { strictNullHandling: true, arrayLimit: 20 }), + { a: ['b', '', 'c', null] }, + 'with arrayLimit 20 + array indices: empty string then null works' + ); + st.deepEqual( + qs.parse('a[]=b&a[]=&a[]=c&a[]', { strictNullHandling: true, arrayLimit: 0 }), + { a: ['b', '', 'c', null] }, + 'with arrayLimit 0 + array brackets: empty string then null works' + ); + + st.deepEqual( + qs.parse('a[]=&a[]=b&a[]=c'), + { a: ['', 'b', 'c'] }, + 'array brackets: empty strings work' + ); + st.end(); + }); + + t.test('compacts sparse arrays', function (st) { + st.deepEqual(qs.parse('a[10]=1&a[2]=2', { arrayLimit: 20 }), { a: ['2', '1'] }); + st.deepEqual(qs.parse('a[1][b][2][c]=1', { arrayLimit: 20 }), { a: [{ b: [{ c: '1' }] }] }); + st.deepEqual(qs.parse('a[1][2][3][c]=1', { arrayLimit: 20 }), { a: [[[{ c: '1' }]]] }); + st.deepEqual(qs.parse('a[1][2][3][c][1]=1', { arrayLimit: 20 }), { a: [[[{ c: ['1'] }]]] }); + st.end(); + }); + + t.test('parses semi-parsed strings', function (st) { + st.deepEqual(qs.parse({ 'a[b]': 'c' }), { a: { b: 'c' } }); + st.deepEqual(qs.parse({ 'a[b]': 'c', 'a[d]': 'e' }), { a: { b: 'c', d: 'e' } }); + st.end(); + }); + + t.test('parses buffers correctly', function (st) { + var b = new Buffer('test'); + st.deepEqual(qs.parse({ a: b }), { a: b }); + st.end(); + }); + + t.test('continues parsing when no parent is found', function (st) { + st.deepEqual(qs.parse('[]=&a=b'), { 0: '', a: 'b' }); + st.deepEqual(qs.parse('[]&a=b', { strictNullHandling: true }), { 0: null, a: 'b' }); + st.deepEqual(qs.parse('[foo]=bar'), { foo: 'bar' }); + st.end(); + }); + + t.test('does not error when parsing a very long array', function (st) { + var str = 'a[]=a'; + while (Buffer.byteLength(str) < 128 * 1024) { + str = str + '&' + str; + } + + st.doesNotThrow(function () { + qs.parse(str); + }); + + st.end(); + }); + + t.test('should not throw when a native prototype has an enumerable property', { parallel: false }, function (st) { + Object.prototype.crash = ''; + Array.prototype.crash = ''; + st.doesNotThrow(qs.parse.bind(null, 'a=b')); + st.deepEqual(qs.parse('a=b'), { a: 'b' }); + st.doesNotThrow(qs.parse.bind(null, 'a[][b]=c')); + st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); + delete Object.prototype.crash; + delete Array.prototype.crash; + st.end(); + }); + + t.test('parses a string with an alternative string delimiter', function (st) { + st.deepEqual(qs.parse('a=b;c=d', { delimiter: ';' }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('parses a string with an alternative RegExp delimiter', function (st) { + st.deepEqual(qs.parse('a=b; c=d', { delimiter: /[;,] */ }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('does not use non-splittable objects as delimiters', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { delimiter: true }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('allows overriding parameter limit', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: 1 }), { a: 'b' }); + st.end(); + }); + + t.test('allows setting the parameter limit to Infinity', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: Infinity }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('allows overriding array limit', function (st) { + st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { 0: 'b' } }); + st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { 0: 'b', 1: 'c' } }); + st.end(); + }); + + t.test('allows disabling array parsing', function (st) { + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { parseArrays: false }), { a: { 0: 'b', 1: 'c' } }); + st.end(); + }); + + t.test('allows for query string prefix', function (st) { + st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' }); + st.deepEqual(qs.parse('foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' }); + st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: false }), { '?foo': 'bar' }); + st.end(); + }); + + t.test('parses an object', function (st) { + var input = { + 'user[name]': { 'pop[bob]': 3 }, + 'user[email]': null + }; + + var expected = { + user: { + name: { 'pop[bob]': 3 }, + email: null + } + }; + + var result = qs.parse(input); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('parses an object in dot notation', function (st) { + var input = { + 'user.name': { 'pop[bob]': 3 }, + 'user.email.': null + }; + + var expected = { + user: { + name: { 'pop[bob]': 3 }, + email: null + } + }; + + var result = qs.parse(input, { allowDots: true }); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('parses an object and not child values', function (st) { + var input = { + 'user[name]': { 'pop[bob]': { test: 3 } }, + 'user[email]': null + }; + + var expected = { + user: { + name: { 'pop[bob]': { test: 3 } }, + email: null + } + }; + + var result = qs.parse(input); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('does not blow up when Buffer global is missing', function (st) { + var tempBuffer = global.Buffer; + delete global.Buffer; + var result = qs.parse('a=b&c=d'); + global.Buffer = tempBuffer; + st.deepEqual(result, { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('does not crash when parsing circular references', function (st) { + var a = {}; + a.b = a; + + var parsed; + + st.doesNotThrow(function () { + parsed = qs.parse({ 'foo[bar]': 'baz', 'foo[baz]': a }); + }); + + st.equal('foo' in parsed, true, 'parsed has "foo" property'); + st.equal('bar' in parsed.foo, true); + st.equal('baz' in parsed.foo, true); + st.equal(parsed.foo.bar, 'baz'); + st.deepEqual(parsed.foo.baz, a); + st.end(); + }); + + t.test('does not crash when parsing deep objects', function (st) { + var parsed; + var str = 'foo'; + + for (var i = 0; i < 5000; i++) { + str += '[p]'; + } + + str += '=bar'; + + st.doesNotThrow(function () { + parsed = qs.parse(str, { depth: 5000 }); + }); + + st.equal('foo' in parsed, true, 'parsed has "foo" property'); + + var depth = 0; + var ref = parsed.foo; + while ((ref = ref.p)) { + depth += 1; + } + + st.equal(depth, 5000, 'parsed is 5000 properties deep'); + + st.end(); + }); + + t.test('parses null objects correctly', { skip: !Object.create }, function (st) { + var a = Object.create(null); + a.b = 'c'; + + st.deepEqual(qs.parse(a), { b: 'c' }); + var result = qs.parse({ a: a }); + st.equal('a' in result, true, 'result has "a" property'); + st.deepEqual(result.a, a); + st.end(); + }); + + t.test('parses dates correctly', function (st) { + var now = new Date(); + st.deepEqual(qs.parse({ a: now }), { a: now }); + st.end(); + }); + + t.test('parses regular expressions correctly', function (st) { + var re = /^test$/; + st.deepEqual(qs.parse({ a: re }), { a: re }); + st.end(); + }); + + t.test('does not allow overwriting prototype properties', function (st) { + st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: false }), {}); + st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: false }), {}); + + st.deepEqual( + qs.parse('toString', { allowPrototypes: false }), + {}, + 'bare "toString" results in {}' + ); + + st.end(); + }); + + t.test('can allow overwriting prototype properties', function (st) { + st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }), { a: { hasOwnProperty: 'b' } }); + st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: true }), { hasOwnProperty: 'b' }); + + st.deepEqual( + qs.parse('toString', { allowPrototypes: true }), + { toString: '' }, + 'bare "toString" results in { toString: "" }' + ); + + st.end(); + }); + + t.test('params starting with a closing bracket', function (st) { + st.deepEqual(qs.parse(']=toString'), { ']': 'toString' }); + st.deepEqual(qs.parse(']]=toString'), { ']]': 'toString' }); + st.deepEqual(qs.parse(']hello]=toString'), { ']hello]': 'toString' }); + st.end(); + }); + + t.test('params starting with a starting bracket', function (st) { + st.deepEqual(qs.parse('[=toString'), { '[': 'toString' }); + st.deepEqual(qs.parse('[[=toString'), { '[[': 'toString' }); + st.deepEqual(qs.parse('[hello[=toString'), { '[hello[': 'toString' }); + st.end(); + }); + + t.test('add keys to objects', function (st) { + st.deepEqual( + qs.parse('a[b]=c&a=d'), + { a: { b: 'c', d: true } }, + 'can add keys to objects' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString'), + { a: { b: 'c' } }, + 'can not overwrite prototype' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString', { allowPrototypes: true }), + { a: { b: 'c', toString: true } }, + 'can overwrite prototype with allowPrototypes true' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString', { plainObjects: true }), + { a: { b: 'c', toString: true } }, + 'can overwrite prototype with plainObjects true' + ); + + st.end(); + }); + + t.test('can return null objects', { skip: !Object.create }, function (st) { + var expected = Object.create(null); + expected.a = Object.create(null); + expected.a.b = 'c'; + expected.a.hasOwnProperty = 'd'; + st.deepEqual(qs.parse('a[b]=c&a[hasOwnProperty]=d', { plainObjects: true }), expected); + st.deepEqual(qs.parse(null, { plainObjects: true }), Object.create(null)); + var expectedArray = Object.create(null); + expectedArray.a = Object.create(null); + expectedArray.a[0] = 'b'; + expectedArray.a.c = 'd'; + st.deepEqual(qs.parse('a[]=b&a[c]=d', { plainObjects: true }), expectedArray); + st.end(); + }); + + t.test('can parse with custom encoding', function (st) { + st.deepEqual(qs.parse('%8c%a7=%91%e5%8d%e3%95%7b', { + decoder: function (str) { + var reg = /%([0-9A-F]{2})/ig; + var result = []; + var parts = reg.exec(str); + while (parts) { + result.push(parseInt(parts[1], 16)); + parts = reg.exec(str); + } + return iconv.decode(new Buffer(result), 'shift_jis').toString(); + } + }), { 県: '大阪府' }); + st.end(); + }); + + t.test('receives the default decoder as a second argument', function (st) { + st.plan(1); + qs.parse('a', { + decoder: function (str, defaultDecoder) { + st.equal(defaultDecoder, utils.decode); + } + }); + st.end(); + }); + + t.test('throws error with wrong decoder', function (st) { + st['throws'](function () { + qs.parse({}, { decoder: 'string' }); + }, new TypeError('Decoder has to be a function.')); + st.end(); + }); + + t.test('does not mutate the options argument', function (st) { + var options = {}; + qs.parse('a[b]=true', options); + st.deepEqual(options, {}); + st.end(); + }); + + t.end(); +}); diff --git a/appasar/canary/node_modules/qs/test/stringify.js b/appasar/canary/node_modules/qs/test/stringify.js new file mode 100644 index 0000000..124a99d --- /dev/null +++ b/appasar/canary/node_modules/qs/test/stringify.js @@ -0,0 +1,596 @@ +'use strict'; + +var test = require('tape'); +var qs = require('../'); +var utils = require('../lib/utils'); +var iconv = require('iconv-lite'); + +test('stringify()', function (t) { + t.test('stringifies a querystring object', function (st) { + st.equal(qs.stringify({ a: 'b' }), 'a=b'); + st.equal(qs.stringify({ a: 1 }), 'a=1'); + st.equal(qs.stringify({ a: 1, b: 2 }), 'a=1&b=2'); + st.equal(qs.stringify({ a: 'A_Z' }), 'a=A_Z'); + st.equal(qs.stringify({ a: '€' }), 'a=%E2%82%AC'); + st.equal(qs.stringify({ a: '' }), 'a=%EE%80%80'); + st.equal(qs.stringify({ a: 'א' }), 'a=%D7%90'); + st.equal(qs.stringify({ a: '𐐷' }), 'a=%F0%90%90%B7'); + st.end(); + }); + + t.test('adds query prefix', function (st) { + st.equal(qs.stringify({ a: 'b' }, { addQueryPrefix: true }), '?a=b'); + st.end(); + }); + + t.test('with query prefix, outputs blank string given an empty object', function (st) { + st.equal(qs.stringify({}, { addQueryPrefix: true }), ''); + st.end(); + }); + + t.test('stringifies a nested object', function (st) { + st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }), 'a%5Bb%5D%5Bc%5D%5Bd%5D=e'); + st.end(); + }); + + t.test('stringifies a nested object with dots notation', function (st) { + st.equal(qs.stringify({ a: { b: 'c' } }, { allowDots: true }), 'a.b=c'); + st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }, { allowDots: true }), 'a.b.c.d=e'); + st.end(); + }); + + t.test('stringifies an array value', function (st) { + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'indices' }), + 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'brackets' }), + 'a%5B%5D=b&a%5B%5D=c&a%5B%5D=d', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }), + 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d', + 'default => indices' + ); + st.end(); + }); + + t.test('omits nulls when asked', function (st) { + st.equal(qs.stringify({ a: 'b', c: null }, { skipNulls: true }), 'a=b'); + st.end(); + }); + + t.test('omits nested nulls when asked', function (st) { + st.equal(qs.stringify({ a: { b: 'c', d: null } }, { skipNulls: true }), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('omits array indices when asked', function (st) { + st.equal(qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }), 'a=b&a=c&a=d'); + st.end(); + }); + + t.test('stringifies a nested array value', function (st) { + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { arrayFormat: 'indices' }), 'a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { arrayFormat: 'brackets' }), 'a%5Bb%5D%5B%5D=c&a%5Bb%5D%5B%5D=d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }), 'a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d'); + st.end(); + }); + + t.test('stringifies a nested array value with dots notation', function (st) { + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a.b[0]=c&a.b[1]=d', + 'indices: stringifies with dots + indices' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a.b[]=c&a.b[]=d', + 'brackets: stringifies with dots + brackets' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encode: false } + ), + 'a.b[0]=c&a.b[1]=d', + 'default: stringifies with dots + indices' + ); + st.end(); + }); + + t.test('stringifies an object inside an array', function (st) { + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'indices' }), + 'a%5B0%5D%5Bb%5D=c', + 'indices => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'brackets' }), + 'a%5B%5D%5Bb%5D=c', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }), + 'a%5B0%5D%5Bb%5D=c', + 'default => indices' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'indices' }), + 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1', + 'indices => indices' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'brackets' }), + 'a%5B%5D%5Bb%5D%5Bc%5D%5B%5D=1', + 'brackets => brackets' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }), + 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1', + 'default => indices' + ); + + st.end(); + }); + + t.test('stringifies an array with mixed objects and primitives', function (st) { + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false, arrayFormat: 'indices' }), + 'a[0][b]=1&a[1]=2&a[2]=3', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false, arrayFormat: 'brackets' }), + 'a[][b]=1&a[]=2&a[]=3', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false }), + 'a[0][b]=1&a[1]=2&a[2]=3', + 'default => indices' + ); + + st.end(); + }); + + t.test('stringifies an object inside an array with dots notation', function (st) { + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a[0].b=c', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a[].b=c', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false } + ), + 'a[0].b=c', + 'default => indices' + ); + + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a[0].b.c[0]=1', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a[].b.c[]=1', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false } + ), + 'a[0].b.c[0]=1', + 'default => indices' + ); + + st.end(); + }); + + t.test('does not omit object keys when indices = false', function (st) { + st.equal(qs.stringify({ a: [{ b: 'c' }] }, { indices: false }), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when indices=true', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { indices: true }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when no arrayFormat is specified', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when no arrayFormat=indices', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses repeat notation for arrays when no arrayFormat=repeat', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }), 'a=b&a=c'); + st.end(); + }); + + t.test('uses brackets notation for arrays when no arrayFormat=brackets', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }), 'a%5B%5D=b&a%5B%5D=c'); + st.end(); + }); + + t.test('stringifies a complicated object', function (st) { + st.equal(qs.stringify({ a: { b: 'c', d: 'e' } }), 'a%5Bb%5D=c&a%5Bd%5D=e'); + st.end(); + }); + + t.test('stringifies an empty value', function (st) { + st.equal(qs.stringify({ a: '' }), 'a='); + st.equal(qs.stringify({ a: null }, { strictNullHandling: true }), 'a'); + + st.equal(qs.stringify({ a: '', b: '' }), 'a=&b='); + st.equal(qs.stringify({ a: null, b: '' }, { strictNullHandling: true }), 'a&b='); + + st.equal(qs.stringify({ a: { b: '' } }), 'a%5Bb%5D='); + st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: true }), 'a%5Bb%5D'); + st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: false }), 'a%5Bb%5D='); + + st.end(); + }); + + t.test('stringifies a null object', { skip: !Object.create }, function (st) { + var obj = Object.create(null); + obj.a = 'b'; + st.equal(qs.stringify(obj), 'a=b'); + st.end(); + }); + + t.test('returns an empty string for invalid input', function (st) { + st.equal(qs.stringify(undefined), ''); + st.equal(qs.stringify(false), ''); + st.equal(qs.stringify(null), ''); + st.equal(qs.stringify(''), ''); + st.end(); + }); + + t.test('stringifies an object with a null object as a child', { skip: !Object.create }, function (st) { + var obj = { a: Object.create(null) }; + + obj.a.b = 'c'; + st.equal(qs.stringify(obj), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('drops keys with a value of undefined', function (st) { + st.equal(qs.stringify({ a: undefined }), ''); + + st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: true }), 'a%5Bc%5D'); + st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: false }), 'a%5Bc%5D='); + st.equal(qs.stringify({ a: { b: undefined, c: '' } }), 'a%5Bc%5D='); + st.end(); + }); + + t.test('url encodes values', function (st) { + st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); + st.end(); + }); + + t.test('stringifies a date', function (st) { + var now = new Date(); + var str = 'a=' + encodeURIComponent(now.toISOString()); + st.equal(qs.stringify({ a: now }), str); + st.end(); + }); + + t.test('stringifies the weird object from qs', function (st) { + st.equal(qs.stringify({ 'my weird field': '~q1!2"\'w$5&7/z8)?' }), 'my%20weird%20field=~q1%212%22%27w%245%267%2Fz8%29%3F'); + st.end(); + }); + + t.test('skips properties that are part of the object prototype', function (st) { + Object.prototype.crash = 'test'; + st.equal(qs.stringify({ a: 'b' }), 'a=b'); + st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + delete Object.prototype.crash; + st.end(); + }); + + t.test('stringifies boolean values', function (st) { + st.equal(qs.stringify({ a: true }), 'a=true'); + st.equal(qs.stringify({ a: { b: true } }), 'a%5Bb%5D=true'); + st.equal(qs.stringify({ b: false }), 'b=false'); + st.equal(qs.stringify({ b: { c: false } }), 'b%5Bc%5D=false'); + st.end(); + }); + + t.test('stringifies buffer values', function (st) { + st.equal(qs.stringify({ a: new Buffer('test') }), 'a=test'); + st.equal(qs.stringify({ a: { b: new Buffer('test') } }), 'a%5Bb%5D=test'); + st.end(); + }); + + t.test('stringifies an object using an alternative delimiter', function (st) { + st.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); + st.end(); + }); + + t.test('doesn\'t blow up when Buffer global is missing', function (st) { + var tempBuffer = global.Buffer; + delete global.Buffer; + var result = qs.stringify({ a: 'b', c: 'd' }); + global.Buffer = tempBuffer; + st.equal(result, 'a=b&c=d'); + st.end(); + }); + + t.test('selects properties when filter=array', function (st) { + st.equal(qs.stringify({ a: 'b' }, { filter: ['a'] }), 'a=b'); + st.equal(qs.stringify({ a: 1 }, { filter: [] }), ''); + + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2], arrayFormat: 'indices' } + ), + 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2], arrayFormat: 'brackets' } + ), + 'a%5Bb%5D%5B%5D=1&a%5Bb%5D%5B%5D=3', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2] } + ), + 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3', + 'default => indices' + ); + + st.end(); + }); + + t.test('supports custom representations when filter=function', function (st) { + var calls = 0; + var obj = { a: 'b', c: 'd', e: { f: new Date(1257894000000) } }; + var filterFunc = function (prefix, value) { + calls += 1; + if (calls === 1) { + st.equal(prefix, '', 'prefix is empty'); + st.equal(value, obj); + } else if (prefix === 'c') { + return void 0; + } else if (value instanceof Date) { + st.equal(prefix, 'e[f]'); + return value.getTime(); + } + return value; + }; + + st.equal(qs.stringify(obj, { filter: filterFunc }), 'a=b&e%5Bf%5D=1257894000000'); + st.equal(calls, 5); + st.end(); + }); + + t.test('can disable uri encoding', function (st) { + st.equal(qs.stringify({ a: 'b' }, { encode: false }), 'a=b'); + st.equal(qs.stringify({ a: { b: 'c' } }, { encode: false }), 'a[b]=c'); + st.equal(qs.stringify({ a: 'b', c: null }, { strictNullHandling: true, encode: false }), 'a=b&c'); + st.end(); + }); + + t.test('can sort the keys', function (st) { + var sort = function (a, b) { + return a.localeCompare(b); + }; + st.equal(qs.stringify({ a: 'c', z: 'y', b: 'f' }, { sort: sort }), 'a=c&b=f&z=y'); + st.equal(qs.stringify({ a: 'c', z: { j: 'a', i: 'b' }, b: 'f' }, { sort: sort }), 'a=c&b=f&z%5Bi%5D=b&z%5Bj%5D=a'); + st.end(); + }); + + t.test('can sort the keys at depth 3 or more too', function (st) { + var sort = function (a, b) { + return a.localeCompare(b); + }; + st.equal( + qs.stringify( + { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' }, + { sort: sort, encode: false } + ), + 'a=a&b=b&z[zi][zia]=zia&z[zi][zib]=zib&z[zj][zja]=zja&z[zj][zjb]=zjb' + ); + st.equal( + qs.stringify( + { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' }, + { sort: null, encode: false } + ), + 'a=a&z[zj][zjb]=zjb&z[zj][zja]=zja&z[zi][zib]=zib&z[zi][zia]=zia&b=b' + ); + st.end(); + }); + + t.test('can stringify with custom encoding', function (st) { + st.equal(qs.stringify({ 県: '大阪府', '': '' }, { + encoder: function (str) { + if (str.length === 0) { + return ''; + } + var buf = iconv.encode(str, 'shiftjis'); + var result = []; + for (var i = 0; i < buf.length; ++i) { + result.push(buf.readUInt8(i).toString(16)); + } + return '%' + result.join('%'); + } + }), '%8c%a7=%91%e5%8d%e3%95%7b&='); + st.end(); + }); + + t.test('receives the default encoder as a second argument', function (st) { + st.plan(2); + qs.stringify({ a: 1 }, { + encoder: function (str, defaultEncoder) { + st.equal(defaultEncoder, utils.encode); + } + }); + st.end(); + }); + + t.test('throws error with wrong encoder', function (st) { + st['throws'](function () { + qs.stringify({}, { encoder: 'string' }); + }, new TypeError('Encoder has to be a function.')); + st.end(); + }); + + t.test('can use custom encoder for a buffer object', { skip: typeof Buffer === 'undefined' }, function (st) { + st.equal(qs.stringify({ a: new Buffer([1]) }, { + encoder: function (buffer) { + if (typeof buffer === 'string') { + return buffer; + } + return String.fromCharCode(buffer.readUInt8(0) + 97); + } + }), 'a=b'); + st.end(); + }); + + t.test('serializeDate option', function (st) { + var date = new Date(); + st.equal( + qs.stringify({ a: date }), + 'a=' + date.toISOString().replace(/:/g, '%3A'), + 'default is toISOString' + ); + + var mutatedDate = new Date(); + mutatedDate.toISOString = function () { + throw new SyntaxError(); + }; + st['throws'](function () { + mutatedDate.toISOString(); + }, SyntaxError); + st.equal( + qs.stringify({ a: mutatedDate }), + 'a=' + Date.prototype.toISOString.call(mutatedDate).replace(/:/g, '%3A'), + 'toISOString works even when method is not locally present' + ); + + var specificDate = new Date(6); + st.equal( + qs.stringify( + { a: specificDate }, + { serializeDate: function (d) { return d.getTime() * 7; } } + ), + 'a=42', + 'custom serializeDate function called' + ); + + st.end(); + }); + + t.test('RFC 1738 spaces serialization', function (st) { + st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC1738 }), 'a=b+c'); + st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC1738 }), 'a+b=c+d'); + st.end(); + }); + + t.test('RFC 3986 spaces serialization', function (st) { + st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC3986 }), 'a=b%20c'); + st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC3986 }), 'a%20b=c%20d'); + st.end(); + }); + + t.test('Backward compatibility to RFC 3986', function (st) { + st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); + st.end(); + }); + + t.test('Edge cases and unknown formats', function (st) { + ['UFO1234', false, 1234, null, {}, []].forEach( + function (format) { + st['throws']( + function () { + qs.stringify({ a: 'b c' }, { format: format }); + }, + new TypeError('Unknown format option provided.') + ); + } + ); + st.end(); + }); + + t.test('encodeValuesOnly', function (st) { + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true } + ), + 'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h' + ); + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e'], f: [['g'], ['h']] } + ), + 'a=b&c%5B0%5D=d&c%5B1%5D=e&f%5B0%5D%5B0%5D=g&f%5B1%5D%5B0%5D=h' + ); + st.end(); + }); + + t.test('encodeValuesOnly - strictNullHandling', function (st) { + st.equal( + qs.stringify( + { a: { b: null } }, + { encodeValuesOnly: true, strictNullHandling: true } + ), + 'a[b]' + ); + st.end(); + }); + + t.test('does not mutate the options argument', function (st) { + var options = {}; + qs.stringify({}, options); + st.deepEqual(options, {}); + st.end(); + }); + + t.end(); +}); diff --git a/appasar/canary/node_modules/qs/test/utils.js b/appasar/canary/node_modules/qs/test/utils.js new file mode 100644 index 0000000..eff4011 --- /dev/null +++ b/appasar/canary/node_modules/qs/test/utils.js @@ -0,0 +1,34 @@ +'use strict'; + +var test = require('tape'); +var utils = require('../lib/utils'); + +test('merge()', function (t) { + t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key'); + + var oneMerged = utils.merge({ foo: 'bar' }, { foo: { first: '123' } }); + t.deepEqual(oneMerged, { foo: ['bar', { first: '123' }] }, 'merges a standalone and an object into an array'); + + var twoMerged = utils.merge({ foo: ['bar', { first: '123' }] }, { foo: { second: '456' } }); + t.deepEqual(twoMerged, { foo: { 0: 'bar', 1: { first: '123' }, second: '456' } }, 'merges a standalone and two objects into an array'); + + var sandwiched = utils.merge({ foo: ['bar', { first: '123', second: '456' }] }, { foo: 'baz' }); + t.deepEqual(sandwiched, { foo: ['bar', { first: '123', second: '456' }, 'baz'] }, 'merges an object sandwiched by two standalones into an array'); + + var nestedArrays = utils.merge({ foo: ['baz'] }, { foo: ['bar', 'xyzzy'] }); + t.deepEqual(nestedArrays, { foo: ['baz', 'bar', 'xyzzy'] }); + + t.end(); +}); + +test('assign()', function (t) { + var target = { a: 1, b: 2 }; + var source = { b: 3, c: 4 }; + var result = utils.assign(target, source); + + t.equal(result, target, 'returns the target'); + t.deepEqual(target, { a: 1, b: 3, c: 4 }, 'target and source are merged'); + t.deepEqual(source, { b: 3, c: 4 }, 'source is untouched'); + + t.end(); +}); diff --git a/appasar/canary/node_modules/request/CHANGELOG.md b/appasar/canary/node_modules/request/CHANGELOG.md new file mode 100644 index 0000000..af76719 --- /dev/null +++ b/appasar/canary/node_modules/request/CHANGELOG.md @@ -0,0 +1,674 @@ +## Change Log + +### v2.81.0 (2017/03/09) +- [#2584](https://github.com/request/request/pull/2584) Security issue: Upgrade qs to version 6.4.0 (@sergejmueller) +- [#2574](https://github.com/request/request/pull/2574) Migrating to safe-buffer for improved security. (@mikeal) +- [#2573](https://github.com/request/request/pull/2573) fixes #2572 (@ahmadnassri) + +### v2.80.0 (2017/03/04) +- [#2571](https://github.com/request/request/pull/2571) Correctly format the Host header for IPv6 addresses (@JamesMGreene) +- [#2558](https://github.com/request/request/pull/2558) Update README.md example snippet (@FredKSchott) +- [#2221](https://github.com/request/request/pull/2221) Adding a simple Response object reference in argument specification (@calamarico) +- [#2452](https://github.com/request/request/pull/2452) Adds .timings array with DNC, TCP, request and response times (@nicjansma) +- [#2553](https://github.com/request/request/pull/2553) add ISSUE_TEMPLATE, move PR template (@FredKSchott) +- [#2539](https://github.com/request/request/pull/2539) Create PULL_REQUEST_TEMPLATE.md (@FredKSchott) +- [#2524](https://github.com/request/request/pull/2524) Update caseless to version 0.12.0 🚀 (@greenkeeperio-bot) +- [#2460](https://github.com/request/request/pull/2460) Fix wrong MIME type in example (@OwnageIsMagic) +- [#2514](https://github.com/request/request/pull/2514) Change tags to keywords in package.json (@humphd) +- [#2492](https://github.com/request/request/pull/2492) More lenient gzip decompression (@addaleax) + +### v2.79.0 (2016/11/18) +- [#2368](https://github.com/request/request/pull/2368) Fix typeof check in test-pool.js (@forivall) +- [#2394](https://github.com/request/request/pull/2394) Use `files` in package.json (@SimenB) +- [#2463](https://github.com/request/request/pull/2463) AWS support for session tokens for temporary credentials (@simov) +- [#2467](https://github.com/request/request/pull/2467) Migrate to uuid (@simov, @antialias) +- [#2459](https://github.com/request/request/pull/2459) Update taper to version 0.5.0 🚀 (@greenkeeperio-bot) +- [#2448](https://github.com/request/request/pull/2448) Make other connect timeout test more reliable too (@mscdex) + +### v2.78.0 (2016/11/03) +- [#2447](https://github.com/request/request/pull/2447) Always set request timeout on keep-alive connections (@mscdex) + +### v2.77.0 (2016/11/03) +- [#2439](https://github.com/request/request/pull/2439) Fix socket 'connect' listener handling (@mscdex) +- [#2442](https://github.com/request/request/pull/2442) 👻😱 Node.js 0.10 is unmaintained 😱👻 (@greenkeeperio-bot) +- [#2435](https://github.com/request/request/pull/2435) Add followOriginalHttpMethod to redirect to original HTTP method (@kirrg001) +- [#2414](https://github.com/request/request/pull/2414) Improve test-timeout reliability (@mscdex) + +### v2.76.0 (2016/10/25) +- [#2424](https://github.com/request/request/pull/2424) Handle buffers directly instead of using "bl" (@zertosh) +- [#2415](https://github.com/request/request/pull/2415) Re-enable timeout tests on Travis + other fixes (@mscdex) +- [#2431](https://github.com/request/request/pull/2431) Improve timeouts accuracy and node v6.8.0+ compatibility (@mscdex, @greenkeeperio-bot) +- [#2428](https://github.com/request/request/pull/2428) Update qs to version 6.3.0 🚀 (@greenkeeperio-bot) +- [#2420](https://github.com/request/request/pull/2420) change .on to .once, remove possible memory leaks (@duereg) +- [#2426](https://github.com/request/request/pull/2426) Remove "isFunction" helper in favor of "typeof" check (@zertosh) +- [#2425](https://github.com/request/request/pull/2425) Simplify "defer" helper creation (@zertosh) +- [#2402](https://github.com/request/request/pull/2402) form-data@2.1.1 breaks build 🚨 (@greenkeeperio-bot) +- [#2393](https://github.com/request/request/pull/2393) Update form-data to version 2.1.0 🚀 (@greenkeeperio-bot) + +### v2.75.0 (2016/09/17) +- [#2381](https://github.com/request/request/pull/2381) Drop support for Node 0.10 (@simov) +- [#2377](https://github.com/request/request/pull/2377) Update form-data to version 2.0.0 🚀 (@greenkeeperio-bot) +- [#2353](https://github.com/request/request/pull/2353) Add greenkeeper ignored packages (@simov) +- [#2351](https://github.com/request/request/pull/2351) Update karma-tap to version 3.0.1 🚀 (@greenkeeperio-bot) +- [#2348](https://github.com/request/request/pull/2348) form-data@1.0.1 breaks build 🚨 (@greenkeeperio-bot) +- [#2349](https://github.com/request/request/pull/2349) Check error type instead of string (@scotttrinh) + +### v2.74.0 (2016/07/22) +- [#2295](https://github.com/request/request/pull/2295) Update tough-cookie to 2.3.0 (@stash-sfdc) +- [#2280](https://github.com/request/request/pull/2280) Update karma-tap to version 2.0.1 🚀 (@greenkeeperio-bot) + +### v2.73.0 (2016/07/09) +- [#2240](https://github.com/request/request/pull/2240) Remove connectionErrorHandler to fix #1903 (@zarenner) +- [#2251](https://github.com/request/request/pull/2251) tape@4.6.0 breaks build 🚨 (@greenkeeperio-bot) +- [#2225](https://github.com/request/request/pull/2225) Update docs (@ArtskydJ) +- [#2203](https://github.com/request/request/pull/2203) Update browserify to version 13.0.1 🚀 (@greenkeeperio-bot) +- [#2275](https://github.com/request/request/pull/2275) Update karma to version 1.1.1 🚀 (@greenkeeperio-bot) +- [#2204](https://github.com/request/request/pull/2204) Add codecov.yml and disable PR comments (@simov) +- [#2212](https://github.com/request/request/pull/2212) Fix link to http.IncomingMessage documentation (@nazieb) +- [#2208](https://github.com/request/request/pull/2208) Update to form-data RC4 and pass null values to it (@simov) +- [#2207](https://github.com/request/request/pull/2207) Move aws4 require statement to the top (@simov) +- [#2199](https://github.com/request/request/pull/2199) Update karma-coverage to version 1.0.0 🚀 (@greenkeeperio-bot) +- [#2206](https://github.com/request/request/pull/2206) Update qs to version 6.2.0 🚀 (@greenkeeperio-bot) +- [#2205](https://github.com/request/request/pull/2205) Use server-destory to close hanging sockets in tests (@simov) +- [#2200](https://github.com/request/request/pull/2200) Update karma-cli to version 1.0.0 🚀 (@greenkeeperio-bot) + +### v2.72.0 (2016/04/17) +- [#2176](https://github.com/request/request/pull/2176) Do not try to pipe Gzip responses with no body (@simov) +- [#2175](https://github.com/request/request/pull/2175) Add 'delete' alias for the 'del' API method (@simov, @MuhanZou) +- [#2172](https://github.com/request/request/pull/2172) Add support for deflate content encoding (@czardoz) +- [#2169](https://github.com/request/request/pull/2169) Add callback option (@simov) +- [#2165](https://github.com/request/request/pull/2165) Check for self.req existence inside the write method (@simov) +- [#2167](https://github.com/request/request/pull/2167) Fix TravisCI badge reference master branch (@a0viedo) + +### v2.71.0 (2016/04/12) +- [#2164](https://github.com/request/request/pull/2164) Catch errors from the underlying http module (@simov) + +### v2.70.0 (2016/04/05) +- [#2147](https://github.com/request/request/pull/2147) Update eslint to version 2.5.3 🚀 (@simov, @greenkeeperio-bot) +- [#2009](https://github.com/request/request/pull/2009) Support JSON stringify replacer argument. (@elyobo) +- [#2142](https://github.com/request/request/pull/2142) Update eslint to version 2.5.1 🚀 (@greenkeeperio-bot) +- [#2128](https://github.com/request/request/pull/2128) Update browserify-istanbul to version 2.0.0 🚀 (@greenkeeperio-bot) +- [#2115](https://github.com/request/request/pull/2115) Update eslint to version 2.3.0 🚀 (@simov, @greenkeeperio-bot) +- [#2089](https://github.com/request/request/pull/2089) Fix badges (@simov) +- [#2092](https://github.com/request/request/pull/2092) Update browserify-istanbul to version 1.0.0 🚀 (@greenkeeperio-bot) +- [#2079](https://github.com/request/request/pull/2079) Accept read stream as body option (@simov) +- [#2070](https://github.com/request/request/pull/2070) Update bl to version 1.1.2 🚀 (@greenkeeperio-bot) +- [#2063](https://github.com/request/request/pull/2063) Up bluebird and oauth-sign (@simov) +- [#2058](https://github.com/request/request/pull/2058) Karma fixes for latest versions (@eiriksm) +- [#2057](https://github.com/request/request/pull/2057) Update contributing guidelines (@simov) +- [#2054](https://github.com/request/request/pull/2054) Update qs to version 6.1.0 🚀 (@greenkeeperio-bot) + +### v2.69.0 (2016/01/27) +- [#2041](https://github.com/request/request/pull/2041) restore aws4 as regular dependency (@rmg) + +### v2.68.0 (2016/01/27) +- [#2036](https://github.com/request/request/pull/2036) Add AWS Signature Version 4 (@simov, @mirkods) +- [#2022](https://github.com/request/request/pull/2022) Convert numeric multipart bodies to string (@simov, @feross) +- [#2024](https://github.com/request/request/pull/2024) Update har-validator dependency for nsp advisory #76 (@TylerDixon) +- [#2016](https://github.com/request/request/pull/2016) Update qs to version 6.0.2 🚀 (@greenkeeperio-bot) +- [#2007](https://github.com/request/request/pull/2007) Use the `extend` module instead of util._extend (@simov) +- [#2003](https://github.com/request/request/pull/2003) Update browserify to version 13.0.0 🚀 (@greenkeeperio-bot) +- [#1989](https://github.com/request/request/pull/1989) Update buffer-equal to version 1.0.0 🚀 (@greenkeeperio-bot) +- [#1956](https://github.com/request/request/pull/1956) Check form-data content-length value before setting up the header (@jongyoonlee) +- [#1958](https://github.com/request/request/pull/1958) Use IncomingMessage.destroy method (@simov) +- [#1952](https://github.com/request/request/pull/1952) Adds example for Tor proxy (@prometheansacrifice) +- [#1943](https://github.com/request/request/pull/1943) Update eslint to version 1.10.3 🚀 (@simov, @greenkeeperio-bot) +- [#1924](https://github.com/request/request/pull/1924) Update eslint to version 1.10.1 🚀 (@greenkeeperio-bot) +- [#1915](https://github.com/request/request/pull/1915) Remove content-length and transfer-encoding headers from defaultProxyHeaderWhiteList (@yaxia) + +### v2.67.0 (2015/11/19) +- [#1913](https://github.com/request/request/pull/1913) Update http-signature to version 1.1.0 🚀 (@greenkeeperio-bot) + +### v2.66.0 (2015/11/18) +- [#1906](https://github.com/request/request/pull/1906) Update README URLs based on HTTP redirects (@ReadmeCritic) +- [#1905](https://github.com/request/request/pull/1905) Convert typed arrays into regular buffers (@simov) +- [#1902](https://github.com/request/request/pull/1902) node-uuid@1.4.7 breaks build 🚨 (@greenkeeperio-bot) +- [#1894](https://github.com/request/request/pull/1894) Fix tunneling after redirection from https (Original: #1881) (@simov, @falms) +- [#1893](https://github.com/request/request/pull/1893) Update eslint to version 1.9.0 🚀 (@greenkeeperio-bot) +- [#1852](https://github.com/request/request/pull/1852) Update eslint to version 1.7.3 🚀 (@simov, @greenkeeperio-bot, @paulomcnally, @michelsalib, @arbaaz, @nsklkn, @LoicMahieu, @JoshWillik, @jzaefferer, @ryanwholey, @djchie, @thisconnect, @mgenereu, @acroca, @Sebmaster, @KoltesDigital) +- [#1876](https://github.com/request/request/pull/1876) Implement loose matching for har mime types (@simov) +- [#1875](https://github.com/request/request/pull/1875) Update bluebird to version 3.0.2 🚀 (@simov, @greenkeeperio-bot) +- [#1871](https://github.com/request/request/pull/1871) Update browserify to version 12.0.1 🚀 (@greenkeeperio-bot) +- [#1866](https://github.com/request/request/pull/1866) Add missing quotes on x-token property in README (@miguelmota) +- [#1874](https://github.com/request/request/pull/1874) Fix typo in README.md (@gswalden) +- [#1860](https://github.com/request/request/pull/1860) Improve referer header tests and docs (@simov) +- [#1861](https://github.com/request/request/pull/1861) Remove redundant call to Stream constructor (@watson) +- [#1857](https://github.com/request/request/pull/1857) Fix Referer header to point to the original host name (@simov) +- [#1850](https://github.com/request/request/pull/1850) Update karma-coverage to version 0.5.3 🚀 (@greenkeeperio-bot) +- [#1847](https://github.com/request/request/pull/1847) Use node's latest version when building (@simov) +- [#1836](https://github.com/request/request/pull/1836) Tunnel: fix wrong property name (@KoltesDigital) +- [#1820](https://github.com/request/request/pull/1820) Set href as request.js uses it (@mgenereu) +- [#1840](https://github.com/request/request/pull/1840) Update http-signature to version 1.0.2 🚀 (@greenkeeperio-bot) +- [#1845](https://github.com/request/request/pull/1845) Update istanbul to version 0.4.0 🚀 (@greenkeeperio-bot) + +### v2.65.0 (2015/10/11) +- [#1833](https://github.com/request/request/pull/1833) Update aws-sign2 to version 0.6.0 🚀 (@greenkeeperio-bot) +- [#1811](https://github.com/request/request/pull/1811) Enable loose cookie parsing in tough-cookie (@Sebmaster) +- [#1830](https://github.com/request/request/pull/1830) Bring back tilde ranges for all dependencies (@simov) +- [#1821](https://github.com/request/request/pull/1821) Implement support for RFC 2617 MD5-sess algorithm. (@BigDSK) +- [#1828](https://github.com/request/request/pull/1828) Updated qs dependency to 5.2.0 (@acroca) +- [#1818](https://github.com/request/request/pull/1818) Extract `readResponseBody` method out of `onRequestResponse` (@pvoisin) +- [#1819](https://github.com/request/request/pull/1819) Run stringify once (@mgenereu) +- [#1814](https://github.com/request/request/pull/1814) Updated har-validator to version 2.0.2 (@greenkeeperio-bot) +- [#1807](https://github.com/request/request/pull/1807) Updated tough-cookie to version 2.1.0 (@greenkeeperio-bot) +- [#1800](https://github.com/request/request/pull/1800) Add caret ranges for devDependencies, except eslint (@simov) +- [#1799](https://github.com/request/request/pull/1799) Updated karma-browserify to version 4.4.0 (@greenkeeperio-bot) +- [#1797](https://github.com/request/request/pull/1797) Updated tape to version 4.2.0 (@greenkeeperio-bot) +- [#1788](https://github.com/request/request/pull/1788) Pinned all dependencies (@greenkeeperio-bot) + +### v2.64.0 (2015/09/25) +- [#1787](https://github.com/request/request/pull/1787) npm ignore examples, release.sh and disabled.appveyor.yml (@thisconnect) +- [#1775](https://github.com/request/request/pull/1775) Fix typo in README.md (@djchie) +- [#1776](https://github.com/request/request/pull/1776) Changed word 'conjuction' to read 'conjunction' in README.md (@ryanwholey) +- [#1785](https://github.com/request/request/pull/1785) Revert: Set default application/json content-type when using json option #1772 (@simov) + +### v2.63.0 (2015/09/21) +- [#1772](https://github.com/request/request/pull/1772) Set default application/json content-type when using json option (@jzaefferer) + +### v2.62.0 (2015/09/15) +- [#1768](https://github.com/request/request/pull/1768) Add node 4.0 to the list of build targets (@simov) +- [#1767](https://github.com/request/request/pull/1767) Query strings now cooperate with unix sockets (@JoshWillik) +- [#1750](https://github.com/request/request/pull/1750) Revert doc about installation of tough-cookie added in #884 (@LoicMahieu) +- [#1746](https://github.com/request/request/pull/1746) Missed comma in Readme (@nsklkn) +- [#1743](https://github.com/request/request/pull/1743) Fix options not being initialized in defaults method (@simov) + +### v2.61.0 (2015/08/19) +- [#1721](https://github.com/request/request/pull/1721) Minor fix in README.md (@arbaaz) +- [#1733](https://github.com/request/request/pull/1733) Avoid useless Buffer transformation (@michelsalib) +- [#1726](https://github.com/request/request/pull/1726) Update README.md (@paulomcnally) +- [#1715](https://github.com/request/request/pull/1715) Fix forever option in node > 0.10 #1709 (@calibr) +- [#1716](https://github.com/request/request/pull/1716) Do not create Buffer from Object in setContentLength(iojs v3.0 issue) (@calibr) +- [#1711](https://github.com/request/request/pull/1711) Add ability to detect connect timeouts (@kevinburke) +- [#1712](https://github.com/request/request/pull/1712) Set certificate expiration to August 2, 2018 (@kevinburke) +- [#1700](https://github.com/request/request/pull/1700) debug() when JSON.parse() on a response body fails (@phillipj) + +### v2.60.0 (2015/07/21) +- [#1687](https://github.com/request/request/pull/1687) Fix caseless bug - content-type not being set for multipart/form-data (@simov, @garymathews) + +### v2.59.0 (2015/07/20) +- [#1671](https://github.com/request/request/pull/1671) Add tests and docs for using the agent, agentClass, agentOptions and forever options. Forever option defaults to using http(s).Agent in node 0.12+ (@simov) +- [#1679](https://github.com/request/request/pull/1679) Fix - do not remove OAuth param when using OAuth realm (@simov, @jhalickman) +- [#1668](https://github.com/request/request/pull/1668) updated dependencies (@deamme) +- [#1656](https://github.com/request/request/pull/1656) Fix form method (@simov) +- [#1651](https://github.com/request/request/pull/1651) Preserve HEAD method when using followAllRedirects (@simov) +- [#1652](https://github.com/request/request/pull/1652) Update `encoding` option documentation in README.md (@daniel347x) +- [#1650](https://github.com/request/request/pull/1650) Allow content-type overriding when using the `form` option (@simov) +- [#1646](https://github.com/request/request/pull/1646) Clarify the nature of setting `ca` in `agentOptions` (@jeffcharles) + +### v2.58.0 (2015/06/16) +- [#1638](https://github.com/request/request/pull/1638) Use the `extend` module to deep extend in the defaults method (@simov) +- [#1631](https://github.com/request/request/pull/1631) Move tunnel logic into separate module (@simov) +- [#1634](https://github.com/request/request/pull/1634) Fix OAuth query transport_method (@simov) +- [#1603](https://github.com/request/request/pull/1603) Add codecov (@simov) + +### v2.57.0 (2015/05/31) +- [#1615](https://github.com/request/request/pull/1615) Replace '.client' with '.socket' as the former was deprecated in 2.2.0. (@ChALkeR) + +### v2.56.0 (2015/05/28) +- [#1610](https://github.com/request/request/pull/1610) Bump module dependencies (@simov) +- [#1600](https://github.com/request/request/pull/1600) Extract the querystring logic into separate module (@simov) +- [#1607](https://github.com/request/request/pull/1607) Re-generate certificates (@simov) +- [#1599](https://github.com/request/request/pull/1599) Move getProxyFromURI logic below the check for Invaild URI (#1595) (@simov) +- [#1598](https://github.com/request/request/pull/1598) Fix the way http verbs are defined in order to please intellisense IDEs (@simov, @flannelJesus) +- [#1591](https://github.com/request/request/pull/1591) A few minor fixes: (@simov) +- [#1584](https://github.com/request/request/pull/1584) Refactor test-default tests (according to comments in #1430) (@simov) +- [#1585](https://github.com/request/request/pull/1585) Fixing documentation regarding TLS options (#1583) (@mainakae) +- [#1574](https://github.com/request/request/pull/1574) Refresh the oauth_nonce on redirect (#1573) (@simov) +- [#1570](https://github.com/request/request/pull/1570) Discovered tests that weren't properly running (@seanstrom) +- [#1569](https://github.com/request/request/pull/1569) Fix pause before response arrives (@kevinoid) +- [#1558](https://github.com/request/request/pull/1558) Emit error instead of throw (@simov) +- [#1568](https://github.com/request/request/pull/1568) Fix stall when piping gzipped response (@kevinoid) +- [#1560](https://github.com/request/request/pull/1560) Update combined-stream (@apechimp) +- [#1543](https://github.com/request/request/pull/1543) Initial support for oauth_body_hash on json payloads (@simov, @aesopwolf) +- [#1541](https://github.com/request/request/pull/1541) Fix coveralls (@simov) +- [#1540](https://github.com/request/request/pull/1540) Fix recursive defaults for convenience methods (@simov) +- [#1536](https://github.com/request/request/pull/1536) More eslint style rules (@froatsnook) +- [#1533](https://github.com/request/request/pull/1533) Adding dependency status bar to README.md (@YasharF) +- [#1539](https://github.com/request/request/pull/1539) ensure the latest version of har-validator is included (@ahmadnassri) +- [#1516](https://github.com/request/request/pull/1516) forever+pool test (@devTristan) + +### v2.55.0 (2015/04/05) +- [#1520](https://github.com/request/request/pull/1520) Refactor defaults (@simov) +- [#1525](https://github.com/request/request/pull/1525) Delete request headers with undefined value. (@froatsnook) +- [#1521](https://github.com/request/request/pull/1521) Add promise tests (@simov) +- [#1518](https://github.com/request/request/pull/1518) Fix defaults (@simov) +- [#1515](https://github.com/request/request/pull/1515) Allow static invoking of convenience methods (@simov) +- [#1505](https://github.com/request/request/pull/1505) Fix multipart boundary extraction regexp (@simov) +- [#1510](https://github.com/request/request/pull/1510) Fix basic auth form data (@simov) + +### v2.54.0 (2015/03/24) +- [#1501](https://github.com/request/request/pull/1501) HTTP Archive 1.2 support (@ahmadnassri) +- [#1486](https://github.com/request/request/pull/1486) Add a test for the forever agent (@akshayp) +- [#1500](https://github.com/request/request/pull/1500) Adding handling for no auth method and null bearer (@philberg) +- [#1498](https://github.com/request/request/pull/1498) Add table of contents in readme (@simov) +- [#1477](https://github.com/request/request/pull/1477) Add support for qs options via qsOptions key (@simov) +- [#1496](https://github.com/request/request/pull/1496) Parameters encoded to base 64 should be decoded as UTF-8, not ASCII. (@albanm) +- [#1494](https://github.com/request/request/pull/1494) Update eslint (@froatsnook) +- [#1474](https://github.com/request/request/pull/1474) Require Colon in Basic Auth (@erykwalder) +- [#1481](https://github.com/request/request/pull/1481) Fix baseUrl and redirections. (@burningtree) +- [#1469](https://github.com/request/request/pull/1469) Feature/base url (@froatsnook) +- [#1459](https://github.com/request/request/pull/1459) Add option to time request/response cycle (including rollup of redirects) (@aaron-em) +- [#1468](https://github.com/request/request/pull/1468) Re-enable io.js/node 0.12 build (@simov, @mikeal, @BBB) +- [#1442](https://github.com/request/request/pull/1442) Fixed the issue with strictSSL tests on 0.12 & io.js by explicitly setting a cipher that matches the cert. (@BBB, @nickmccurdy, @demohi, @simov, @0x4139) +- [#1460](https://github.com/request/request/pull/1460) localAddress or proxy config is lost when redirecting (@simov, @0x4139) +- [#1453](https://github.com/request/request/pull/1453) Test on Node.js 0.12 and io.js with allowed failures (@nickmccurdy, @demohi) +- [#1426](https://github.com/request/request/pull/1426) Fixing tests to pass on io.js and node 0.12 (only test-https.js stiff failing) (@mikeal) +- [#1446](https://github.com/request/request/pull/1446) Missing HTTP referer header with redirects Fixes #1038 (@simov, @guimon) +- [#1428](https://github.com/request/request/pull/1428) Deprecate Node v0.8.x (@nylen) +- [#1436](https://github.com/request/request/pull/1436) Add ability to set a requester without setting default options (@tikotzky) +- [#1435](https://github.com/request/request/pull/1435) dry up verb methods (@sethpollack) +- [#1423](https://github.com/request/request/pull/1423) Allow fully qualified multipart content-type header (@simov) +- [#1430](https://github.com/request/request/pull/1430) Fix recursive requester (@tikotzky) +- [#1429](https://github.com/request/request/pull/1429) Throw error when making HEAD request with a body (@tikotzky) +- [#1419](https://github.com/request/request/pull/1419) Add note that the project is broken in 0.12.x (@nylen) +- [#1413](https://github.com/request/request/pull/1413) Fix basic auth (@simov) +- [#1397](https://github.com/request/request/pull/1397) Improve pipe-from-file tests (@nylen) + +### v2.53.0 (2015/02/02) +- [#1396](https://github.com/request/request/pull/1396) Do not rfc3986 escape JSON bodies (@nylen, @simov) +- [#1392](https://github.com/request/request/pull/1392) Improve `timeout` option description (@watson) + +### v2.52.0 (2015/02/02) +- [#1383](https://github.com/request/request/pull/1383) Add missing HTTPS options that were not being passed to tunnel (@brichard19) (@nylen) +- [#1388](https://github.com/request/request/pull/1388) Upgrade mime-types package version (@roderickhsiao) +- [#1389](https://github.com/request/request/pull/1389) Revise Setup Tunnel Function (@seanstrom) +- [#1374](https://github.com/request/request/pull/1374) Allow explicitly disabling tunneling for proxied https destinations (@nylen) +- [#1376](https://github.com/request/request/pull/1376) Use karma-browserify for tests. Add browser test coverage reporter. (@eiriksm) +- [#1366](https://github.com/request/request/pull/1366) Refactor OAuth into separate module (@simov) +- [#1373](https://github.com/request/request/pull/1373) Rewrite tunnel test to be pure Node.js (@nylen) +- [#1371](https://github.com/request/request/pull/1371) Upgrade test reporter (@nylen) +- [#1360](https://github.com/request/request/pull/1360) Refactor basic, bearer, digest auth logic into separate class (@simov) +- [#1354](https://github.com/request/request/pull/1354) Remove circular dependency from debugging code (@nylen) +- [#1351](https://github.com/request/request/pull/1351) Move digest auth into private prototype method (@simov) +- [#1352](https://github.com/request/request/pull/1352) Update hawk dependency to ~2.3.0 (@mridgway) +- [#1353](https://github.com/request/request/pull/1353) Correct travis-ci badge (@dogancelik) +- [#1349](https://github.com/request/request/pull/1349) Make sure we return on errored browser requests. (@eiriksm) +- [#1346](https://github.com/request/request/pull/1346) getProxyFromURI Extraction Refactor (@seanstrom) +- [#1337](https://github.com/request/request/pull/1337) Standardize test ports on 6767 (@nylen) +- [#1341](https://github.com/request/request/pull/1341) Emit FormData error events as Request error events (@nylen, @rwky) +- [#1343](https://github.com/request/request/pull/1343) Clean up readme badges, and add Travis and Coveralls badges (@nylen) +- [#1345](https://github.com/request/request/pull/1345) Update README.md (@Aaron-Hartwig) +- [#1338](https://github.com/request/request/pull/1338) Always wait for server.close() callback in tests (@nylen) +- [#1342](https://github.com/request/request/pull/1342) Add mock https server and redo start of browser tests for this purpose. (@eiriksm) +- [#1339](https://github.com/request/request/pull/1339) Improve auth docs (@nylen) +- [#1335](https://github.com/request/request/pull/1335) Add support for OAuth plaintext signature method (@simov) +- [#1332](https://github.com/request/request/pull/1332) Add clean script to remove test-browser.js after the tests run (@seanstrom) +- [#1327](https://github.com/request/request/pull/1327) Fix errors generating coverage reports. (@nylen) +- [#1330](https://github.com/request/request/pull/1330) Return empty buffer upon empty response body and encoding is set to null (@seanstrom) +- [#1326](https://github.com/request/request/pull/1326) Use faster container-based infrastructure on Travis (@nylen) +- [#1315](https://github.com/request/request/pull/1315) Implement rfc3986 option (@simov, @nylen, @apoco, @DullReferenceException, @mmalecki, @oliamb, @cliffcrosland, @LewisJEllis, @eiriksm, @poislagarde) +- [#1314](https://github.com/request/request/pull/1314) Detect urlencoded form data header via regex (@simov) +- [#1317](https://github.com/request/request/pull/1317) Improve OAuth1.0 server side flow example (@simov) + +### v2.51.0 (2014/12/10) +- [#1310](https://github.com/request/request/pull/1310) Revert changes introduced in https://github.com/request/request/pull/1282 (@simov) + +### v2.50.0 (2014/12/09) +- [#1308](https://github.com/request/request/pull/1308) Add browser test to keep track of browserify compability. (@eiriksm) +- [#1299](https://github.com/request/request/pull/1299) Add optional support for jsonReviver (@poislagarde) +- [#1277](https://github.com/request/request/pull/1277) Add Coveralls configuration (@simov) +- [#1307](https://github.com/request/request/pull/1307) Upgrade form-data, add back browserify compability. Fixes #455. (@eiriksm) +- [#1305](https://github.com/request/request/pull/1305) Fix typo in README.md (@LewisJEllis) +- [#1288](https://github.com/request/request/pull/1288) Update README.md to explain custom file use case (@cliffcrosland) + +### v2.49.0 (2014/11/28) +- [#1295](https://github.com/request/request/pull/1295) fix(proxy): no-proxy false positive (@oliamb) +- [#1292](https://github.com/request/request/pull/1292) Upgrade `caseless` to 0.8.1 (@mmalecki) +- [#1276](https://github.com/request/request/pull/1276) Set transfer encoding for multipart/related to chunked by default (@simov) +- [#1275](https://github.com/request/request/pull/1275) Fix multipart content-type headers detection (@simov) +- [#1269](https://github.com/request/request/pull/1269) adds streams example for review (@tbuchok) +- [#1238](https://github.com/request/request/pull/1238) Add examples README.md (@simov) + +### v2.48.0 (2014/11/12) +- [#1263](https://github.com/request/request/pull/1263) Fixed a syntax error / typo in README.md (@xna2) +- [#1253](https://github.com/request/request/pull/1253) Add multipart chunked flag (@simov, @nylen) +- [#1251](https://github.com/request/request/pull/1251) Clarify that defaults() does not modify global defaults (@nylen) +- [#1250](https://github.com/request/request/pull/1250) Improve documentation for pool and maxSockets options (@nylen) +- [#1237](https://github.com/request/request/pull/1237) Documenting error handling when using streams (@vmattos) +- [#1244](https://github.com/request/request/pull/1244) Finalize changelog command (@nylen) +- [#1241](https://github.com/request/request/pull/1241) Fix typo (@alexanderGugel) +- [#1223](https://github.com/request/request/pull/1223) Show latest version number instead of "upcoming" in changelog (@nylen) +- [#1236](https://github.com/request/request/pull/1236) Document how to use custom CA in README (#1229) (@hypesystem) +- [#1228](https://github.com/request/request/pull/1228) Support for oauth with RSA-SHA1 signing (@nylen) +- [#1216](https://github.com/request/request/pull/1216) Made json and multipart options coexist (@nylen, @simov) +- [#1225](https://github.com/request/request/pull/1225) Allow header white/exclusive lists in any case. (@RReverser) + +### v2.47.0 (2014/10/26) +- [#1222](https://github.com/request/request/pull/1222) Move from mikeal/request to request/request (@nylen) +- [#1220](https://github.com/request/request/pull/1220) update qs dependency to 2.3.1 (@FredKSchott) +- [#1212](https://github.com/request/request/pull/1212) Improve tests/test-timeout.js (@nylen) +- [#1219](https://github.com/request/request/pull/1219) remove old globalAgent workaround for node 0.4 (@request) +- [#1214](https://github.com/request/request/pull/1214) Remove cruft left over from optional dependencies (@nylen) +- [#1215](https://github.com/request/request/pull/1215) Add proxyHeaderExclusiveList option for proxy-only headers. (@RReverser) +- [#1211](https://github.com/request/request/pull/1211) Allow 'Host' header instead of 'host' and remember case across redirects (@nylen) +- [#1208](https://github.com/request/request/pull/1208) Improve release script (@nylen) +- [#1213](https://github.com/request/request/pull/1213) Support for custom cookie store (@nylen, @mitsuru) +- [#1197](https://github.com/request/request/pull/1197) Clean up some code around setting the agent (@FredKSchott) +- [#1209](https://github.com/request/request/pull/1209) Improve multipart form append test (@simov) +- [#1207](https://github.com/request/request/pull/1207) Update changelog (@nylen) +- [#1185](https://github.com/request/request/pull/1185) Stream multipart/related bodies (@simov) + +### v2.46.0 (2014/10/23) +- [#1198](https://github.com/request/request/pull/1198) doc for TLS/SSL protocol options (@shawnzhu) +- [#1200](https://github.com/request/request/pull/1200) Add a Gitter chat badge to README.md (@gitter-badger) +- [#1196](https://github.com/request/request/pull/1196) Upgrade taper test reporter to v0.3.0 (@nylen) +- [#1199](https://github.com/request/request/pull/1199) Fix lint error: undeclared var i (@nylen) +- [#1191](https://github.com/request/request/pull/1191) Move self.proxy decision logic out of init and into a helper (@FredKSchott) +- [#1190](https://github.com/request/request/pull/1190) Move _buildRequest() logic back into init (@FredKSchott) +- [#1186](https://github.com/request/request/pull/1186) Support Smarter Unix URL Scheme (@FredKSchott) +- [#1178](https://github.com/request/request/pull/1178) update form documentation for new usage (@FredKSchott) +- [#1180](https://github.com/request/request/pull/1180) Enable no-mixed-requires linting rule (@nylen) +- [#1184](https://github.com/request/request/pull/1184) Don't forward authorization header across redirects to different hosts (@nylen) +- [#1183](https://github.com/request/request/pull/1183) Correct README about pre and postamble CRLF using multipart and not mult... (@netpoetica) +- [#1179](https://github.com/request/request/pull/1179) Lint tests directory (@nylen) +- [#1169](https://github.com/request/request/pull/1169) add metadata for form-data file field (@dotcypress) +- [#1173](https://github.com/request/request/pull/1173) remove optional dependencies (@seanstrom) +- [#1165](https://github.com/request/request/pull/1165) Cleanup event listeners and remove function creation from init (@FredKSchott) +- [#1174](https://github.com/request/request/pull/1174) update the request.cookie docs to have a valid cookie example (@seanstrom) +- [#1168](https://github.com/request/request/pull/1168) create a detach helper and use detach helper in replace of nextTick (@seanstrom) +- [#1171](https://github.com/request/request/pull/1171) in post can send form data and use callback (@MiroRadenovic) +- [#1159](https://github.com/request/request/pull/1159) accept charset for x-www-form-urlencoded content-type (@seanstrom) +- [#1157](https://github.com/request/request/pull/1157) Update README.md: body with json=true (@Rob--W) +- [#1164](https://github.com/request/request/pull/1164) Disable tests/test-timeout.js on Travis (@nylen) +- [#1153](https://github.com/request/request/pull/1153) Document how to run a single test (@nylen) +- [#1144](https://github.com/request/request/pull/1144) adds documentation for the "response" event within the streaming section (@tbuchok) +- [#1162](https://github.com/request/request/pull/1162) Update eslintrc file to no longer allow past errors (@FredKSchott) +- [#1155](https://github.com/request/request/pull/1155) Support/use self everywhere (@seanstrom) +- [#1161](https://github.com/request/request/pull/1161) fix no-use-before-define lint warnings (@emkay) +- [#1156](https://github.com/request/request/pull/1156) adding curly brackets to get rid of lint errors (@emkay) +- [#1151](https://github.com/request/request/pull/1151) Fix localAddress test on OS X (@nylen) +- [#1145](https://github.com/request/request/pull/1145) documentation: fix outdated reference to setCookieSync old name in README (@FredKSchott) +- [#1131](https://github.com/request/request/pull/1131) Update pool documentation (@FredKSchott) +- [#1143](https://github.com/request/request/pull/1143) Rewrite all tests to use tape (@nylen) +- [#1137](https://github.com/request/request/pull/1137) Add ability to specifiy querystring lib in options. (@jgrund) +- [#1138](https://github.com/request/request/pull/1138) allow hostname and port in place of host on uri (@cappslock) +- [#1134](https://github.com/request/request/pull/1134) Fix multiple redirects and `self.followRedirect` (@blakeembrey) +- [#1130](https://github.com/request/request/pull/1130) documentation fix: add note about npm test for contributing (@FredKSchott) +- [#1120](https://github.com/request/request/pull/1120) Support/refactor request setup tunnel (@seanstrom) +- [#1129](https://github.com/request/request/pull/1129) linting fix: convert double quote strings to use single quotes (@FredKSchott) +- [#1124](https://github.com/request/request/pull/1124) linting fix: remove unneccesary semi-colons (@FredKSchott) + +### v2.45.0 (2014/10/06) +- [#1128](https://github.com/request/request/pull/1128) Add test for setCookie regression (@nylen) +- [#1127](https://github.com/request/request/pull/1127) added tests around using objects as values in a query string (@bcoe) +- [#1103](https://github.com/request/request/pull/1103) Support/refactor request constructor (@nylen, @seanstrom) +- [#1119](https://github.com/request/request/pull/1119) add basic linting to request library (@FredKSchott) +- [#1121](https://github.com/request/request/pull/1121) Revert "Explicitly use sync versions of cookie functions" (@nylen) +- [#1118](https://github.com/request/request/pull/1118) linting fix: Restructure bad empty if statement (@FredKSchott) +- [#1117](https://github.com/request/request/pull/1117) Fix a bad check for valid URIs (@FredKSchott) +- [#1113](https://github.com/request/request/pull/1113) linting fix: space out operators (@FredKSchott) +- [#1116](https://github.com/request/request/pull/1116) Fix typo in `noProxyHost` definition (@FredKSchott) +- [#1114](https://github.com/request/request/pull/1114) linting fix: Added a `new` operator that was missing when creating and throwing a new error (@FredKSchott) +- [#1096](https://github.com/request/request/pull/1096) No_proxy support (@samcday) +- [#1107](https://github.com/request/request/pull/1107) linting-fix: remove unused variables (@FredKSchott) +- [#1112](https://github.com/request/request/pull/1112) linting fix: Make return values consistent and more straitforward (@FredKSchott) +- [#1111](https://github.com/request/request/pull/1111) linting fix: authPieces was getting redeclared (@FredKSchott) +- [#1105](https://github.com/request/request/pull/1105) Use strict mode in request (@FredKSchott) +- [#1110](https://github.com/request/request/pull/1110) linting fix: replace lazy '==' with more strict '===' (@FredKSchott) +- [#1109](https://github.com/request/request/pull/1109) linting fix: remove function call from if-else conditional statement (@FredKSchott) +- [#1102](https://github.com/request/request/pull/1102) Fix to allow setting a `requester` on recursive calls to `request.defaults` (@tikotzky) +- [#1095](https://github.com/request/request/pull/1095) Tweaking engines in package.json (@pdehaan) +- [#1082](https://github.com/request/request/pull/1082) Forward the socket event from the httpModule request (@seanstrom) +- [#972](https://github.com/request/request/pull/972) Clarify gzip handling in the README (@kevinoid) +- [#1089](https://github.com/request/request/pull/1089) Mention that encoding defaults to utf8, not Buffer (@stuartpb) +- [#1088](https://github.com/request/request/pull/1088) Fix cookie example in README.md and make it more clear (@pipi32167) +- [#1027](https://github.com/request/request/pull/1027) Add support for multipart form data in request options. (@crocket) +- [#1076](https://github.com/request/request/pull/1076) use Request.abort() to abort the request when the request has timed-out (@seanstrom) +- [#1068](https://github.com/request/request/pull/1068) add optional postamble required by .NET multipart requests (@netpoetica) + +### v2.43.0 (2014/09/18) +- [#1057](https://github.com/request/request/pull/1057) Defaults should not overwrite defined options (@davidwood) +- [#1046](https://github.com/request/request/pull/1046) Propagate datastream errors, useful in case gzip fails. (@ZJONSSON, @Janpot) +- [#1063](https://github.com/request/request/pull/1063) copy the input headers object #1060 (@finnp) +- [#1031](https://github.com/request/request/pull/1031) Explicitly use sync versions of cookie functions (@ZJONSSON) +- [#1056](https://github.com/request/request/pull/1056) Fix redirects when passing url.parse(x) as URL to convenience method (@nylen) + +### v2.42.0 (2014/09/04) +- [#1053](https://github.com/request/request/pull/1053) Fix #1051 Parse auth properly when using non-tunneling proxy (@isaacs) + +### v2.41.0 (2014/09/04) +- [#1050](https://github.com/request/request/pull/1050) Pass whitelisted headers to tunneling proxy. Organize all tunneling logic. (@isaacs, @Feldhacker) +- [#1035](https://github.com/request/request/pull/1035) souped up nodei.co badge (@rvagg) +- [#1048](https://github.com/request/request/pull/1048) Aws is now possible over a proxy (@steven-aerts) +- [#1039](https://github.com/request/request/pull/1039) extract out helper functions to a helper file (@seanstrom) +- [#1021](https://github.com/request/request/pull/1021) Support/refactor indexjs (@seanstrom) +- [#1033](https://github.com/request/request/pull/1033) Improve and document debug options (@nylen) +- [#1034](https://github.com/request/request/pull/1034) Fix readme headings (@nylen) +- [#1030](https://github.com/request/request/pull/1030) Allow recursive request.defaults (@tikotzky) +- [#1029](https://github.com/request/request/pull/1029) Fix a couple of typos (@nylen) +- [#675](https://github.com/request/request/pull/675) Checking for SSL fault on connection before reading SSL properties (@VRMink) +- [#989](https://github.com/request/request/pull/989) Added allowRedirect function. Should return true if redirect is allowed or false otherwise (@doronin) +- [#1025](https://github.com/request/request/pull/1025) [fixes #1023] Set self._ended to true once response has ended (@mridgway) +- [#1020](https://github.com/request/request/pull/1020) Add back removed debug metadata (@FredKSchott) +- [#1008](https://github.com/request/request/pull/1008) Moving to module instead of cutomer buffer concatenation. (@mikeal) +- [#770](https://github.com/request/request/pull/770) Added dependency badge for README file; (@timgluz, @mafintosh, @lalitkapoor, @stash, @bobyrizov) +- [#1016](https://github.com/request/request/pull/1016) toJSON no longer results in an infinite loop, returns simple objects (@FredKSchott) +- [#1018](https://github.com/request/request/pull/1018) Remove pre-0.4.4 HTTPS fix (@mmalecki) +- [#1006](https://github.com/request/request/pull/1006) Migrate to caseless, fixes #1001 (@mikeal) +- [#995](https://github.com/request/request/pull/995) Fix parsing array of objects (@sjonnet19) +- [#999](https://github.com/request/request/pull/999) Fix fallback for browserify for optional modules. (@eiriksm) +- [#996](https://github.com/request/request/pull/996) Wrong oauth signature when multiple same param keys exist [updated] (@bengl) + +### v2.40.0 (2014/08/06) +- [#992](https://github.com/request/request/pull/992) Fix security vulnerability. Update qs (@poeticninja) +- [#988](https://github.com/request/request/pull/988) “--” -> “—” (@upisfree) +- [#987](https://github.com/request/request/pull/987) Show optional modules as being loaded by the module that reqeusted them (@iarna) + +### v2.39.0 (2014/07/24) +- [#976](https://github.com/request/request/pull/976) Update README.md (@pvoznenko) + +### v2.38.0 (2014/07/22) +- [#952](https://github.com/request/request/pull/952) Adding support to client certificate with proxy use case (@ofirshaked) +- [#884](https://github.com/request/request/pull/884) Documented tough-cookie installation. (@wbyoung) +- [#935](https://github.com/request/request/pull/935) Correct repository url (@fritx) +- [#963](https://github.com/request/request/pull/963) Update changelog (@nylen) +- [#960](https://github.com/request/request/pull/960) Support gzip with encoding on node pre-v0.9.4 (@kevinoid) +- [#953](https://github.com/request/request/pull/953) Add async Content-Length computation when using form-data (@LoicMahieu) +- [#844](https://github.com/request/request/pull/844) Add support for HTTP[S]_PROXY environment variables. Fixes #595. (@jvmccarthy) +- [#946](https://github.com/request/request/pull/946) defaults: merge headers (@aj0strow) + +### v2.37.0 (2014/07/07) +- [#957](https://github.com/request/request/pull/957) Silence EventEmitter memory leak warning #311 (@watson) +- [#955](https://github.com/request/request/pull/955) check for content-length header before setting it in nextTick (@camilleanne) +- [#951](https://github.com/request/request/pull/951) Add support for gzip content decoding (@kevinoid) +- [#949](https://github.com/request/request/pull/949) Manually enter querystring in form option (@charlespwd) +- [#944](https://github.com/request/request/pull/944) Make request work with browserify (@eiriksm) +- [#943](https://github.com/request/request/pull/943) New mime module (@eiriksm) +- [#927](https://github.com/request/request/pull/927) Bump version of hawk dep. (@samccone) +- [#907](https://github.com/request/request/pull/907) append secureOptions to poolKey (@medovob) + +### v2.35.0 (2014/05/17) +- [#901](https://github.com/request/request/pull/901) Fixes #555 (@pigulla) +- [#897](https://github.com/request/request/pull/897) merge with default options (@vohof) +- [#891](https://github.com/request/request/pull/891) fixes 857 - options object is mutated by calling request (@lalitkapoor) +- [#869](https://github.com/request/request/pull/869) Pipefilter test (@tgohn) +- [#866](https://github.com/request/request/pull/866) Fix typo (@dandv) +- [#861](https://github.com/request/request/pull/861) Add support for RFC 6750 Bearer Tokens (@phedny) +- [#809](https://github.com/request/request/pull/809) upgrade tunnel-proxy to 0.4.0 (@ksato9700) +- [#850](https://github.com/request/request/pull/850) Fix word consistency in readme (@0xNobody) +- [#810](https://github.com/request/request/pull/810) add some exposition to mpu example in README.md (@mikermcneil) +- [#840](https://github.com/request/request/pull/840) improve error reporting for invalid protocols (@FND) +- [#821](https://github.com/request/request/pull/821) added secureOptions back (@nw) +- [#815](https://github.com/request/request/pull/815) Create changelog based on pull requests (@lalitkapoor) + +### v2.34.0 (2014/02/18) +- [#516](https://github.com/request/request/pull/516) UNIX Socket URL Support (@lyuzashi) +- [#801](https://github.com/request/request/pull/801) 794 ignore cookie parsing and domain errors (@lalitkapoor) +- [#802](https://github.com/request/request/pull/802) Added the Apache license to the package.json. (@keskival) +- [#793](https://github.com/request/request/pull/793) Adds content-length calculation when submitting forms using form-data li... (@Juul) +- [#785](https://github.com/request/request/pull/785) Provide ability to override content-type when `json` option used (@vvo) +- [#781](https://github.com/request/request/pull/781) simpler isReadStream function (@joaojeronimo) + +### v2.32.0 (2014/01/16) +- [#767](https://github.com/request/request/pull/767) Use tough-cookie CookieJar sync API (@stash) +- [#764](https://github.com/request/request/pull/764) Case-insensitive authentication scheme (@bobyrizov) +- [#763](https://github.com/request/request/pull/763) Upgrade tough-cookie to 0.10.0 (@stash) +- [#744](https://github.com/request/request/pull/744) Use Cookie.parse (@lalitkapoor) +- [#757](https://github.com/request/request/pull/757) require aws-sign2 (@mafintosh) + +### v2.31.0 (2014/01/08) +- [#645](https://github.com/request/request/pull/645) update twitter api url to v1.1 (@mick) +- [#746](https://github.com/request/request/pull/746) README: Markdown code highlight (@weakish) +- [#745](https://github.com/request/request/pull/745) updating setCookie example to make it clear that the callback is required (@emkay) +- [#742](https://github.com/request/request/pull/742) Add note about JSON output body type (@iansltx) +- [#741](https://github.com/request/request/pull/741) README example is using old cookie jar api (@emkay) +- [#736](https://github.com/request/request/pull/736) Fix callback arguments documentation (@mmalecki) +- [#732](https://github.com/request/request/pull/732) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. (@Fritz-Lium) +- [#730](https://github.com/request/request/pull/730) better HTTP DIGEST support (@dai-shi) +- [#728](https://github.com/request/request/pull/728) Fix TypeError when calling request.cookie (@scarletmeow) +- [#727](https://github.com/request/request/pull/727) fix requester bug (@jchris) +- [#724](https://github.com/request/request/pull/724) README.md: add custom HTTP Headers example. (@tcort) +- [#719](https://github.com/request/request/pull/719) Made a comment gender neutral. (@unsetbit) +- [#715](https://github.com/request/request/pull/715) Request.multipart no longer crashes when header 'Content-type' present (@pastaclub) +- [#710](https://github.com/request/request/pull/710) Fixing listing in callback part of docs. (@lukasz-zak) +- [#696](https://github.com/request/request/pull/696) Edited README.md for formatting and clarity of phrasing (@Zearin) +- [#694](https://github.com/request/request/pull/694) Typo in README (@VRMink) +- [#690](https://github.com/request/request/pull/690) Handle blank password in basic auth. (@diversario) +- [#682](https://github.com/request/request/pull/682) Optional dependencies (@Turbo87) +- [#683](https://github.com/request/request/pull/683) Travis CI support (@Turbo87) +- [#674](https://github.com/request/request/pull/674) change cookie module,to tough-cookie.please check it . (@sxyizhiren) +- [#666](https://github.com/request/request/pull/666) make `ciphers` and `secureProtocol` to work in https request (@richarddong) +- [#656](https://github.com/request/request/pull/656) Test case for #304. (@diversario) +- [#662](https://github.com/request/request/pull/662) option.tunnel to explicitly disable tunneling (@seanmonstar) +- [#659](https://github.com/request/request/pull/659) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm) +- [#630](https://github.com/request/request/pull/630) Send random cnonce for HTTP Digest requests (@wprl) +- [#619](https://github.com/request/request/pull/619) decouple things a bit (@joaojeronimo) +- [#613](https://github.com/request/request/pull/613) Fixes #583, moved initialization of self.uri.pathname (@lexander) +- [#605](https://github.com/request/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker) +- [#596](https://github.com/request/request/pull/596) Global agent is being used when pool is specified (@Cauldrath) +- [#594](https://github.com/request/request/pull/594) Emit complete event when there is no callback (@RomainLK) +- [#601](https://github.com/request/request/pull/601) Fixed a small typo (@michalstanko) +- [#589](https://github.com/request/request/pull/589) Prevent setting headers after they are sent (@geek) +- [#587](https://github.com/request/request/pull/587) Global cookie jar disabled by default (@threepointone) +- [#544](https://github.com/request/request/pull/544) Update http-signature version. (@davidlehn) +- [#581](https://github.com/request/request/pull/581) Fix spelling of "ignoring." (@bigeasy) +- [#568](https://github.com/request/request/pull/568) use agentOptions to create agent when specified in request (@SamPlacette) +- [#564](https://github.com/request/request/pull/564) Fix redirections (@criloz) +- [#541](https://github.com/request/request/pull/541) The exported request function doesn't have an auth method (@tschaub) +- [#542](https://github.com/request/request/pull/542) Expose Request class (@regality) +- [#536](https://github.com/request/request/pull/536) Allow explicitly empty user field for basic authentication. (@mikeando) +- [#532](https://github.com/request/request/pull/532) fix typo (@fredericosilva) +- [#497](https://github.com/request/request/pull/497) Added redirect event (@Cauldrath) +- [#503](https://github.com/request/request/pull/503) Fix basic auth for passwords that contain colons (@tonistiigi) +- [#521](https://github.com/request/request/pull/521) Improving test-localAddress.js (@noway) +- [#529](https://github.com/request/request/pull/529) dependencies versions bump (@jodaka) +- [#523](https://github.com/request/request/pull/523) Updating dependencies (@noway) +- [#520](https://github.com/request/request/pull/520) Fixing test-tunnel.js (@noway) +- [#519](https://github.com/request/request/pull/519) Update internal path state on post-creation QS changes (@jblebrun) +- [#510](https://github.com/request/request/pull/510) Add HTTP Signature support. (@davidlehn) +- [#502](https://github.com/request/request/pull/502) Fix POST (and probably other) requests that are retried after 401 Unauthorized (@nylen) +- [#508](https://github.com/request/request/pull/508) Honor the .strictSSL option when using proxies (tunnel-agent) (@jhs) +- [#512](https://github.com/request/request/pull/512) Make password optional to support the format: http://username@hostname/ (@pajato1) +- [#513](https://github.com/request/request/pull/513) add 'localAddress' support (@yyfrankyy) +- [#498](https://github.com/request/request/pull/498) Moving response emit above setHeaders on destination streams (@kenperkins) +- [#490](https://github.com/request/request/pull/490) Empty response body (3-rd argument) must be passed to callback as an empty string (@Olegas) +- [#479](https://github.com/request/request/pull/479) Changing so if Accept header is explicitly set, sending json does not ov... (@RoryH) +- [#475](https://github.com/request/request/pull/475) Use `unescape` from `querystring` (@shimaore) +- [#473](https://github.com/request/request/pull/473) V0.10 compat (@isaacs) +- [#471](https://github.com/request/request/pull/471) Using querystring library from visionmedia (@kbackowski) +- [#461](https://github.com/request/request/pull/461) Strip the UTF8 BOM from a UTF encoded response (@kppullin) +- [#460](https://github.com/request/request/pull/460) hawk 0.10.0 (@hueniverse) +- [#462](https://github.com/request/request/pull/462) if query params are empty, then request path shouldn't end with a '?' (merges cleanly now) (@jaipandya) +- [#456](https://github.com/request/request/pull/456) hawk 0.9.0 (@hueniverse) +- [#429](https://github.com/request/request/pull/429) Copy options before adding callback. (@nrn, @nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki) +- [#454](https://github.com/request/request/pull/454) Destroy the response if present when destroying the request (clean merge) (@mafintosh) +- [#310](https://github.com/request/request/pull/310) Twitter Oauth Stuff Out of Date; Now Updated (@joemccann, @isaacs, @mscdex) +- [#413](https://github.com/request/request/pull/413) rename googledoodle.png to .jpg (@nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki) +- [#448](https://github.com/request/request/pull/448) Convenience method for PATCH (@mloar) +- [#444](https://github.com/request/request/pull/444) protect against double callbacks on error path (@spollack) +- [#433](https://github.com/request/request/pull/433) Added support for HTTPS cert & key (@mmalecki) +- [#430](https://github.com/request/request/pull/430) Respect specified {Host,host} headers, not just {host} (@andrewschaaf) +- [#415](https://github.com/request/request/pull/415) Fixed a typo. (@jerem) +- [#338](https://github.com/request/request/pull/338) Add more auth options, including digest support (@nylen) +- [#403](https://github.com/request/request/pull/403) Optimize environment lookup to happen once only (@mmalecki) +- [#398](https://github.com/request/request/pull/398) Add more reporting to tests (@mmalecki) +- [#388](https://github.com/request/request/pull/388) Ensure "safe" toJSON doesn't break EventEmitters (@othiym23) +- [#381](https://github.com/request/request/pull/381) Resolving "Invalid signature. Expected signature base string: " (@landeiro) +- [#380](https://github.com/request/request/pull/380) Fixes missing host header on retried request when using forever agent (@mac-) +- [#376](https://github.com/request/request/pull/376) Headers lost on redirect (@kapetan) +- [#375](https://github.com/request/request/pull/375) Fix for missing oauth_timestamp parameter (@jplock) +- [#374](https://github.com/request/request/pull/374) Correct Host header for proxy tunnel CONNECT (@youurayy) +- [#370](https://github.com/request/request/pull/370) Twitter reverse auth uses x_auth_mode not x_auth_type (@drudge) +- [#369](https://github.com/request/request/pull/369) Don't remove x_auth_mode for Twitter reverse auth (@drudge) +- [#344](https://github.com/request/request/pull/344) Make AWS auth signing find headers correctly (@nlf) +- [#363](https://github.com/request/request/pull/363) rfc3986 on base_uri, now passes tests (@jeffmarshall) +- [#362](https://github.com/request/request/pull/362) Running `rfc3986` on `base_uri` in `oauth.hmacsign` instead of just `encodeURIComponent` (@jeffmarshall) +- [#361](https://github.com/request/request/pull/361) Don't create a Content-Length header if we already have it set (@danjenkins) +- [#360](https://github.com/request/request/pull/360) Delete self._form along with everything else on redirect (@jgautier) +- [#355](https://github.com/request/request/pull/355) stop sending erroneous headers on redirected requests (@azylman) +- [#332](https://github.com/request/request/pull/332) Fix #296 - Only set Content-Type if body exists (@Marsup) +- [#343](https://github.com/request/request/pull/343) Allow AWS to work in more situations, added a note in the README on its usage (@nlf) +- [#320](https://github.com/request/request/pull/320) request.defaults() doesn't need to wrap jar() (@StuartHarris) +- [#322](https://github.com/request/request/pull/322) Fix + test for piped into request bumped into redirect. #321 (@alexindigo) +- [#326](https://github.com/request/request/pull/326) Do not try to remove listener from an undefined connection (@CartoDB) +- [#318](https://github.com/request/request/pull/318) Pass servername to tunneling secure socket creation (@isaacs) +- [#317](https://github.com/request/request/pull/317) Workaround for #313 (@isaacs) +- [#293](https://github.com/request/request/pull/293) Allow parser errors to bubble up to request (@mscdex) +- [#290](https://github.com/request/request/pull/290) A test for #289 (@isaacs) +- [#280](https://github.com/request/request/pull/280) Like in node.js print options if NODE_DEBUG contains the word request (@Filirom1) +- [#207](https://github.com/request/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs) +- [#214](https://github.com/request/request/pull/214) documenting additional behavior of json option (@jphaas, @vpulim) +- [#272](https://github.com/request/request/pull/272) Boundary begins with CRLF? (@elspoono, @timshadel, @naholyr, @nanodocumet, @TehShrike) +- [#284](https://github.com/request/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry) +- [#241](https://github.com/request/request/pull/241) Composability updates suggested by issue #239 (@polotek) +- [#282](https://github.com/request/request/pull/282) OAuth Authorization header contains non-"oauth_" parameters (@jplock) +- [#279](https://github.com/request/request/pull/279) fix tests with boundary by injecting boundry from header (@benatkin) +- [#273](https://github.com/request/request/pull/273) Pipe back pressure issue (@mafintosh) +- [#268](https://github.com/request/request/pull/268) I'm not OCD seriously (@TehShrike) +- [#263](https://github.com/request/request/pull/263) Bug in OAuth key generation for sha1 (@nanodocumet) +- [#265](https://github.com/request/request/pull/265) uncaughtException when redirected to invalid URI (@naholyr) +- [#262](https://github.com/request/request/pull/262) JSON test should check for equality (@timshadel) +- [#261](https://github.com/request/request/pull/261) Setting 'pool' to 'false' does NOT disable Agent pooling (@timshadel) +- [#249](https://github.com/request/request/pull/249) Fix for the fix of your (closed) issue #89 where self.headers[content-length] is set to 0 for all methods (@sethbridges, @polotek, @zephrax, @jeromegn) +- [#255](https://github.com/request/request/pull/255) multipart allow body === '' ( the empty string ) (@Filirom1) +- [#260](https://github.com/request/request/pull/260) fixed just another leak of 'i' (@sreuter) +- [#246](https://github.com/request/request/pull/246) Fixing the set-cookie header (@jeromegn) +- [#243](https://github.com/request/request/pull/243) Dynamic boundary (@zephrax) +- [#240](https://github.com/request/request/pull/240) don't error when null is passed for options (@polotek) +- [#211](https://github.com/request/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso, @vpulim) +- [#224](https://github.com/request/request/pull/224) Multipart content-type change (@janjongboom) +- [#217](https://github.com/request/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup) +- [#203](https://github.com/request/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@vpulim) +- [#199](https://github.com/request/request/pull/199) Tunnel (@isaacs) +- [#198](https://github.com/request/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs) +- [#197](https://github.com/request/request/pull/197) Make ForeverAgent work with HTTPS (@isaacs) +- [#193](https://github.com/request/request/pull/193) Fixes GH-119 (@goatslacker) +- [#188](https://github.com/request/request/pull/188) Add abort support to the returned request (@itay) +- [#176](https://github.com/request/request/pull/176) Querystring option (@csainty) +- [#182](https://github.com/request/request/pull/182) Fix request.defaults to support (uri, options, callback) api (@twilson63) +- [#180](https://github.com/request/request/pull/180) Modified the post, put, head and del shortcuts to support uri optional param (@twilson63) +- [#179](https://github.com/request/request/pull/179) fix to add opts in .pipe(stream, opts) (@substack) +- [#177](https://github.com/request/request/pull/177) Issue #173 Support uri as first and optional config as second argument (@twilson63) +- [#170](https://github.com/request/request/pull/170) can't create a cookie in a wrapped request (defaults) (@fabianonunes) +- [#168](https://github.com/request/request/pull/168) Picking off an EasyFix by adding some missing mimetypes. (@serby) +- [#161](https://github.com/request/request/pull/161) Fix cookie jar/headers.cookie collision (#125) (@papandreou) +- [#162](https://github.com/request/request/pull/162) Fix issue #159 (@dpetukhov) +- [#90](https://github.com/request/request/pull/90) add option followAllRedirects to follow post/put redirects (@jroes) +- [#148](https://github.com/request/request/pull/148) Retry Agent (@thejh) +- [#146](https://github.com/request/request/pull/146) Multipart should respect content-type if previously set (@apeace) +- [#144](https://github.com/request/request/pull/144) added "form" option to readme (@petejkim) +- [#133](https://github.com/request/request/pull/133) Fixed cookies parsing (@afanasy) +- [#135](https://github.com/request/request/pull/135) host vs hostname (@iangreenleaf) +- [#132](https://github.com/request/request/pull/132) return the body as a Buffer when encoding is set to null (@jahewson) +- [#112](https://github.com/request/request/pull/112) Support using a custom http-like module (@jhs) +- [#104](https://github.com/request/request/pull/104) Cookie handling contains bugs (@janjongboom) +- [#121](https://github.com/request/request/pull/121) Another patch for cookie handling regression (@jhurliman) +- [#117](https://github.com/request/request/pull/117) Remove the global `i` (@3rd-Eden) +- [#110](https://github.com/request/request/pull/110) Update to Iris Couch URL (@jhs) +- [#86](https://github.com/request/request/pull/86) Can't post binary to multipart requests (@kkaefer) +- [#105](https://github.com/request/request/pull/105) added test for proxy option. (@dominictarr) +- [#102](https://github.com/request/request/pull/102) Implemented cookies - closes issue 82: https://github.com/mikeal/request/issues/82 (@alessioalex) +- [#97](https://github.com/request/request/pull/97) Typo in previous pull causes TypeError in non-0.5.11 versions (@isaacs) +- [#96](https://github.com/request/request/pull/96) Authless parsed url host support (@isaacs) +- [#81](https://github.com/request/request/pull/81) Enhance redirect handling (@danmactough) +- [#78](https://github.com/request/request/pull/78) Don't try to do strictSSL for non-ssl connections (@isaacs) +- [#76](https://github.com/request/request/pull/76) Bug when a request fails and a timeout is set (@Marsup) +- [#70](https://github.com/request/request/pull/70) add test script to package.json (@isaacs, @aheckmann) +- [#73](https://github.com/request/request/pull/73) Fix #71 Respect the strictSSL flag (@isaacs) +- [#69](https://github.com/request/request/pull/69) Flatten chunked requests properly (@isaacs) +- [#67](https://github.com/request/request/pull/67) fixed global variable leaks (@aheckmann) +- [#66](https://github.com/request/request/pull/66) Do not overwrite established content-type headers for read stream deliver (@voodootikigod) +- [#53](https://github.com/request/request/pull/53) Parse json: Issue #51 (@benatkin) +- [#45](https://github.com/request/request/pull/45) Added timeout option (@mbrevoort) +- [#35](https://github.com/request/request/pull/35) The "end" event isn't emitted for some responses (@voxpelli) +- [#31](https://github.com/request/request/pull/31) Error on piping a request to a destination (@tobowers) \ No newline at end of file diff --git a/appasar/canary/node_modules/request/LICENSE b/appasar/canary/node_modules/request/LICENSE new file mode 100644 index 0000000..a4a9aee --- /dev/null +++ b/appasar/canary/node_modules/request/LICENSE @@ -0,0 +1,55 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/appasar/canary/node_modules/request/README.md b/appasar/canary/node_modules/request/README.md new file mode 100644 index 0000000..cedc19d --- /dev/null +++ b/appasar/canary/node_modules/request/README.md @@ -0,0 +1,1097 @@ + +# Request - Simplified HTTP client + +[![npm package](https://nodei.co/npm/request.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/request/) + +[![Build status](https://img.shields.io/travis/request/request/master.svg?style=flat-square)](https://travis-ci.org/request/request) +[![Coverage](https://img.shields.io/codecov/c/github/request/request.svg?style=flat-square)](https://codecov.io/github/request/request?branch=master) +[![Coverage](https://img.shields.io/coveralls/request/request.svg?style=flat-square)](https://coveralls.io/r/request/request) +[![Dependency Status](https://img.shields.io/david/request/request.svg?style=flat-square)](https://david-dm.org/request/request) +[![Known Vulnerabilities](https://snyk.io/test/npm/request/badge.svg?style=flat-square)](https://snyk.io/test/npm/request) +[![Gitter](https://img.shields.io/badge/gitter-join_chat-blue.svg?style=flat-square)](https://gitter.im/request/request?utm_source=badge) + + +## Super simple to use + +Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default. + +```js +var request = require('request'); +request('http://www.google.com', function (error, response, body) { + console.log('error:', error); // Print the error if one occurred + console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received + console.log('body:', body); // Print the HTML for the Google homepage. +}); +``` + + +## Table of contents + +- [Streaming](#streaming) +- [Promises & Async/Await](#promises--asyncawait) +- [Forms](#forms) +- [HTTP Authentication](#http-authentication) +- [Custom HTTP Headers](#custom-http-headers) +- [OAuth Signing](#oauth-signing) +- [Proxies](#proxies) +- [Unix Domain Sockets](#unix-domain-sockets) +- [TLS/SSL Protocol](#tlsssl-protocol) +- [Support for HAR 1.2](#support-for-har-12) +- [**All Available Options**](#requestoptions-callback) + +Request also offers [convenience methods](#convenience-methods) like +`request.defaults` and `request.post`, and there are +lots of [usage examples](#examples) and several +[debugging techniques](#debugging). + + +--- + + +## Streaming + +You can stream any response to a file stream. + +```js +request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) +``` + +You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types (in this case `application/json`) and use the proper `content-type` in the PUT request (if the headers don’t already provide one). + +```js +fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) +``` + +Request can also `pipe` to itself. When doing so, `content-type` and `content-length` are preserved in the PUT headers. + +```js +request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) +``` + +Request emits a "response" event when a response is received. The `response` argument will be an instance of [http.IncomingMessage](https://nodejs.org/api/http.html#http_class_http_incomingmessage). + +```js +request + .get('http://google.com/img.png') + .on('response', function(response) { + console.log(response.statusCode) // 200 + console.log(response.headers['content-type']) // 'image/png' + }) + .pipe(request.put('http://mysite.com/img.png')) +``` + +To easily handle errors when streaming requests, listen to the `error` event before piping: + +```js +request + .get('http://mysite.com/doodle.png') + .on('error', function(err) { + console.log(err) + }) + .pipe(fs.createWriteStream('doodle.png')) +``` + +Now let’s get fancy. + +```js +http.createServer(function (req, resp) { + if (req.url === '/doodle.png') { + if (req.method === 'PUT') { + req.pipe(request.put('http://mysite.com/doodle.png')) + } else if (req.method === 'GET' || req.method === 'HEAD') { + request.get('http://mysite.com/doodle.png').pipe(resp) + } + } +}) +``` + +You can also `pipe()` from `http.ServerRequest` instances, as well as to `http.ServerResponse` instances. The HTTP method, headers, and entity-body data will be sent. Which means that, if you don't really care about security, you can do: + +```js +http.createServer(function (req, resp) { + if (req.url === '/doodle.png') { + var x = request('http://mysite.com/doodle.png') + req.pipe(x) + x.pipe(resp) + } +}) +``` + +And since `pipe()` returns the destination stream in ≥ Node 0.5.x you can do one line proxying. :) + +```js +req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) +``` + +Also, none of this new functionality conflicts with requests previous features, it just expands them. + +```js +var r = request.defaults({'proxy':'http://localproxy.com'}) + +http.createServer(function (req, resp) { + if (req.url === '/doodle.png') { + r.get('http://google.com/doodle.png').pipe(resp) + } +}) +``` + +You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. + +[back to top](#table-of-contents) + + +--- + + +## Promises & Async/Await + +`request` supports both streaming and callback interfaces natively. If you'd like `request` to return a Promise instead, you can use an alternative interface wrapper for `request`. These wrappers can be useful if you prefer to work with Promises, or if you'd like to use `async`/`await` in ES2017. + +Several alternative interfaces are provided by the request team, including: +- [`request-promise`](https://github.com/request/request-promise) (uses [Bluebird](https://github.com/petkaantonov/bluebird) Promises) +- [`request-promise-native`](https://github.com/request/request-promise-native) (uses native Promises) +- [`request-promise-any`](https://github.com/request/request-promise-any) (uses [any-promise](https://www.npmjs.com/package/any-promise) Promises) + + +[back to top](#table-of-contents) + + +--- + + +## Forms + +`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API. + + +#### application/x-www-form-urlencoded (URL-Encoded Forms) + +URL-encoded forms are simple. + +```js +request.post('http://service.com/upload', {form:{key:'value'}}) +// or +request.post('http://service.com/upload').form({key:'value'}) +// or +request.post({url:'http://service.com/upload', form: {key:'value'}}, function(err,httpResponse,body){ /* ... */ }) +``` + + +#### multipart/form-data (Multipart Form Uploads) + +For `multipart/form-data` we use the [form-data](https://github.com/form-data/form-data) library by [@felixge](https://github.com/felixge). For the most cases, you can pass your upload form data via the `formData` option. + + +```js +var formData = { + // Pass a simple key-value pair + my_field: 'my_value', + // Pass data via Buffers + my_buffer: new Buffer([1, 2, 3]), + // Pass data via Streams + my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), + // Pass multiple values /w an Array + attachments: [ + fs.createReadStream(__dirname + '/attachment1.jpg'), + fs.createReadStream(__dirname + '/attachment2.jpg') + ], + // Pass optional meta-data with an 'options' object with style: {value: DATA, options: OPTIONS} + // Use case: for some types of streams, you'll need to provide "file"-related information manually. + // See the `form-data` README for more information about options: https://github.com/form-data/form-data + custom_file: { + value: fs.createReadStream('/dev/urandom'), + options: { + filename: 'topsecret.jpg', + contentType: 'image/jpeg' + } + } +}; +request.post({url:'http://service.com/upload', formData: formData}, function optionalCallback(err, httpResponse, body) { + if (err) { + return console.error('upload failed:', err); + } + console.log('Upload successful! Server responded with:', body); +}); +``` + +For advanced cases, you can access the form-data object itself via `r.form()`. This can be modified until the request is fired on the next cycle of the event-loop. (Note that this calling `form()` will clear the currently set form data for that request.) + +```js +// NOTE: Advanced use-case, for normal use see 'formData' usage above +var r = request.post('http://service.com/upload', function optionalCallback(err, httpResponse, body) {...}) +var form = r.form(); +form.append('my_field', 'my_value'); +form.append('my_buffer', new Buffer([1, 2, 3])); +form.append('custom_file', fs.createReadStream(__dirname + '/unicycle.jpg'), {filename: 'unicycle.jpg'}); +``` +See the [form-data README](https://github.com/form-data/form-data) for more information & examples. + + +#### multipart/related + +Some variations in different HTTP implementations require a newline/CRLF before, after, or both before and after the boundary of a `multipart/related` request (using the multipart option). This has been observed in the .NET WebAPI version 4.0. You can turn on a boundary preambleCRLF or postamble by passing them as `true` to your request options. + +```js + request({ + method: 'PUT', + preambleCRLF: true, + postambleCRLF: true, + uri: 'http://service.com/upload', + multipart: [ + { + 'content-type': 'application/json', + body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + }, + { body: 'I am an attachment' }, + { body: fs.createReadStream('image.png') } + ], + // alternatively pass an object containing additional options + multipart: { + chunked: false, + data: [ + { + 'content-type': 'application/json', + body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + }, + { body: 'I am an attachment' } + ] + } + }, + function (error, response, body) { + if (error) { + return console.error('upload failed:', error); + } + console.log('Upload successful! Server responded with:', body); + }) +``` + +[back to top](#table-of-contents) + + +--- + + +## HTTP Authentication + +```js +request.get('http://some.server.com/').auth('username', 'password', false); +// or +request.get('http://some.server.com/', { + 'auth': { + 'user': 'username', + 'pass': 'password', + 'sendImmediately': false + } +}); +// or +request.get('http://some.server.com/').auth(null, null, true, 'bearerToken'); +// or +request.get('http://some.server.com/', { + 'auth': { + 'bearer': 'bearerToken' + } +}); +``` + +If passed as an option, `auth` should be a hash containing values: + +- `user` || `username` +- `pass` || `password` +- `sendImmediately` (optional) +- `bearer` (optional) + +The method form takes parameters +`auth(username, password, sendImmediately, bearer)`. + +`sendImmediately` defaults to `true`, which causes a basic or bearer +authentication header to be sent. If `sendImmediately` is `false`, then +`request` will retry with a proper authentication header after receiving a +`401` response from the server (which must contain a `WWW-Authenticate` header +indicating the required authentication method). + +Note that you can also specify basic authentication using the URL itself, as +detailed in [RFC 1738](http://www.ietf.org/rfc/rfc1738.txt). Simply pass the +`user:password` before the host with an `@` sign: + +```js +var username = 'username', + password = 'password', + url = 'http://' + username + ':' + password + '@some.server.com'; + +request({url: url}, function (error, response, body) { + // Do more stuff with 'body' here +}); +``` + +Digest authentication is supported, but it only works with `sendImmediately` +set to `false`; otherwise `request` will send basic authentication on the +initial request, which will probably cause the request to fail. + +Bearer authentication is supported, and is activated when the `bearer` value is +available. The value may be either a `String` or a `Function` returning a +`String`. Using a function to supply the bearer token is particularly useful if +used in conjunction with `defaults` to allow a single function to supply the +last known token at the time of sending a request, or to compute one on the fly. + +[back to top](#table-of-contents) + + +--- + + +## Custom HTTP Headers + +HTTP Headers, such as `User-Agent`, can be set in the `options` object. +In the example below, we call the github API to find out the number +of stars and forks for the request repository. This requires a +custom `User-Agent` header as well as https. + +```js +var request = require('request'); + +var options = { + url: 'https://api.github.com/repos/request/request', + headers: { + 'User-Agent': 'request' + } +}; + +function callback(error, response, body) { + if (!error && response.statusCode == 200) { + var info = JSON.parse(body); + console.log(info.stargazers_count + " Stars"); + console.log(info.forks_count + " Forks"); + } +} + +request(options, callback); +``` + +[back to top](#table-of-contents) + + +--- + + +## OAuth Signing + +[OAuth version 1.0](https://tools.ietf.org/html/rfc5849) is supported. The +default signing algorithm is +[HMAC-SHA1](https://tools.ietf.org/html/rfc5849#section-3.4.2): + +```js +// OAuth1.0 - 3-legged server side flow (Twitter example) +// step 1 +var qs = require('querystring') + , oauth = + { callback: 'http://mysite.com/callback/' + , consumer_key: CONSUMER_KEY + , consumer_secret: CONSUMER_SECRET + } + , url = 'https://api.twitter.com/oauth/request_token' + ; +request.post({url:url, oauth:oauth}, function (e, r, body) { + // Ideally, you would take the body in the response + // and construct a URL that a user clicks on (like a sign in button). + // The verifier is only available in the response after a user has + // verified with twitter that they are authorizing your app. + + // step 2 + var req_data = qs.parse(body) + var uri = 'https://api.twitter.com/oauth/authenticate' + + '?' + qs.stringify({oauth_token: req_data.oauth_token}) + // redirect the user to the authorize uri + + // step 3 + // after the user is redirected back to your server + var auth_data = qs.parse(body) + , oauth = + { consumer_key: CONSUMER_KEY + , consumer_secret: CONSUMER_SECRET + , token: auth_data.oauth_token + , token_secret: req_data.oauth_token_secret + , verifier: auth_data.oauth_verifier + } + , url = 'https://api.twitter.com/oauth/access_token' + ; + request.post({url:url, oauth:oauth}, function (e, r, body) { + // ready to make signed requests on behalf of the user + var perm_data = qs.parse(body) + , oauth = + { consumer_key: CONSUMER_KEY + , consumer_secret: CONSUMER_SECRET + , token: perm_data.oauth_token + , token_secret: perm_data.oauth_token_secret + } + , url = 'https://api.twitter.com/1.1/users/show.json' + , qs = + { screen_name: perm_data.screen_name + , user_id: perm_data.user_id + } + ; + request.get({url:url, oauth:oauth, qs:qs, json:true}, function (e, r, user) { + console.log(user) + }) + }) +}) +``` + +For [RSA-SHA1 signing](https://tools.ietf.org/html/rfc5849#section-3.4.3), make +the following changes to the OAuth options object: +* Pass `signature_method : 'RSA-SHA1'` +* Instead of `consumer_secret`, specify a `private_key` string in + [PEM format](http://how2ssl.com/articles/working_with_pem_files/) + +For [PLAINTEXT signing](http://oauth.net/core/1.0/#anchor22), make +the following changes to the OAuth options object: +* Pass `signature_method : 'PLAINTEXT'` + +To send OAuth parameters via query params or in a post body as described in The +[Consumer Request Parameters](http://oauth.net/core/1.0/#consumer_req_param) +section of the oauth1 spec: +* Pass `transport_method : 'query'` or `transport_method : 'body'` in the OAuth + options object. +* `transport_method` defaults to `'header'` + +To use [Request Body Hash](https://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html) you can either +* Manually generate the body hash and pass it as a string `body_hash: '...'` +* Automatically generate the body hash by passing `body_hash: true` + +[back to top](#table-of-contents) + + +--- + + +## Proxies + +If you specify a `proxy` option, then the request (and any subsequent +redirects) will be sent via a connection to the proxy server. + +If your endpoint is an `https` url, and you are using a proxy, then +request will send a `CONNECT` request to the proxy server *first*, and +then use the supplied connection to connect to the endpoint. + +That is, first it will make a request like: + +``` +HTTP/1.1 CONNECT endpoint-server.com:80 +Host: proxy-server.com +User-Agent: whatever user agent you specify +``` + +and then the proxy server make a TCP connection to `endpoint-server` +on port `80`, and return a response that looks like: + +``` +HTTP/1.1 200 OK +``` + +At this point, the connection is left open, and the client is +communicating directly with the `endpoint-server.com` machine. + +See [the wikipedia page on HTTP Tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel) +for more information. + +By default, when proxying `http` traffic, request will simply make a +standard proxied `http` request. This is done by making the `url` +section of the initial line of the request a fully qualified url to +the endpoint. + +For example, it will make a single request that looks like: + +``` +HTTP/1.1 GET http://endpoint-server.com/some-url +Host: proxy-server.com +Other-Headers: all go here + +request body or whatever +``` + +Because a pure "http over http" tunnel offers no additional security +or other features, it is generally simpler to go with a +straightforward HTTP proxy in this case. However, if you would like +to force a tunneling proxy, you may set the `tunnel` option to `true`. + +You can also make a standard proxied `http` request by explicitly setting +`tunnel : false`, but **note that this will allow the proxy to see the traffic +to/from the destination server**. + +If you are using a tunneling proxy, you may set the +`proxyHeaderWhiteList` to share certain headers with the proxy. + +You can also set the `proxyHeaderExclusiveList` to share certain +headers only with the proxy and not with destination host. + +By default, this set is: + +``` +accept +accept-charset +accept-encoding +accept-language +accept-ranges +cache-control +content-encoding +content-language +content-length +content-location +content-md5 +content-range +content-type +connection +date +expect +max-forwards +pragma +proxy-authorization +referer +te +transfer-encoding +user-agent +via +``` + +Note that, when using a tunneling proxy, the `proxy-authorization` +header and any headers from custom `proxyHeaderExclusiveList` are +*never* sent to the endpoint server, but only to the proxy server. + + +### Controlling proxy behaviour using environment variables + +The following environment variables are respected by `request`: + + * `HTTP_PROXY` / `http_proxy` + * `HTTPS_PROXY` / `https_proxy` + * `NO_PROXY` / `no_proxy` + +When `HTTP_PROXY` / `http_proxy` are set, they will be used to proxy non-SSL requests that do not have an explicit `proxy` configuration option present. Similarly, `HTTPS_PROXY` / `https_proxy` will be respected for SSL requests that do not have an explicit `proxy` configuration option. It is valid to define a proxy in one of the environment variables, but then override it for a specific request, using the `proxy` configuration option. Furthermore, the `proxy` configuration option can be explicitly set to false / null to opt out of proxying altogether for that request. + +`request` is also aware of the `NO_PROXY`/`no_proxy` environment variables. These variables provide a granular way to opt out of proxying, on a per-host basis. It should contain a comma separated list of hosts to opt out of proxying. It is also possible to opt of proxying when a particular destination port is used. Finally, the variable may be set to `*` to opt out of the implicit proxy configuration of the other environment variables. + +Here's some examples of valid `no_proxy` values: + + * `google.com` - don't proxy HTTP/HTTPS requests to Google. + * `google.com:443` - don't proxy HTTPS requests to Google, but *do* proxy HTTP requests to Google. + * `google.com:443, yahoo.com:80` - don't proxy HTTPS requests to Google, and don't proxy HTTP requests to Yahoo! + * `*` - ignore `https_proxy`/`http_proxy` environment variables altogether. + +[back to top](#table-of-contents) + + +--- + + +## UNIX Domain Sockets + +`request` supports making requests to [UNIX Domain Sockets](https://en.wikipedia.org/wiki/Unix_domain_socket). To make one, use the following URL scheme: + +```js +/* Pattern */ 'http://unix:SOCKET:PATH' +/* Example */ request.get('http://unix:/absolute/path/to/unix.socket:/request/path') +``` + +Note: The `SOCKET` path is assumed to be absolute to the root of the host file system. + +[back to top](#table-of-contents) + + +--- + + +## TLS/SSL Protocol + +TLS/SSL Protocol options, such as `cert`, `key` and `passphrase`, can be +set directly in `options` object, in the `agentOptions` property of the `options` object, or even in `https.globalAgent.options`. Keep in mind that, although `agentOptions` allows for a slightly wider range of configurations, the recommended way is via `options` object directly, as using `agentOptions` or `https.globalAgent.options` would not be applied in the same way in proxied environments (as data travels through a TLS connection instead of an http/https agent). + +```js +var fs = require('fs') + , path = require('path') + , certFile = path.resolve(__dirname, 'ssl/client.crt') + , keyFile = path.resolve(__dirname, 'ssl/client.key') + , caFile = path.resolve(__dirname, 'ssl/ca.cert.pem') + , request = require('request'); + +var options = { + url: 'https://api.some-server.com/', + cert: fs.readFileSync(certFile), + key: fs.readFileSync(keyFile), + passphrase: 'password', + ca: fs.readFileSync(caFile) +}; + +request.get(options); +``` + +### Using `options.agentOptions` + +In the example below, we call an API that requires client side SSL certificate +(in PEM format) with passphrase protected private key (in PEM format) and disable the SSLv3 protocol: + +```js +var fs = require('fs') + , path = require('path') + , certFile = path.resolve(__dirname, 'ssl/client.crt') + , keyFile = path.resolve(__dirname, 'ssl/client.key') + , request = require('request'); + +var options = { + url: 'https://api.some-server.com/', + agentOptions: { + cert: fs.readFileSync(certFile), + key: fs.readFileSync(keyFile), + // Or use `pfx` property replacing `cert` and `key` when using private key, certificate and CA certs in PFX or PKCS12 format: + // pfx: fs.readFileSync(pfxFilePath), + passphrase: 'password', + securityOptions: 'SSL_OP_NO_SSLv3' + } +}; + +request.get(options); +``` + +It is able to force using SSLv3 only by specifying `secureProtocol`: + +```js +request.get({ + url: 'https://api.some-server.com/', + agentOptions: { + secureProtocol: 'SSLv3_method' + } +}); +``` + +It is possible to accept other certificates than those signed by generally allowed Certificate Authorities (CAs). +This can be useful, for example, when using self-signed certificates. +To require a different root certificate, you can specify the signing CA by adding the contents of the CA's certificate file to the `agentOptions`. +The certificate the domain presents must be signed by the root certificate specified: + +```js +request.get({ + url: 'https://api.some-server.com/', + agentOptions: { + ca: fs.readFileSync('ca.cert.pem') + } +}); +``` + +[back to top](#table-of-contents) + + +--- + +## Support for HAR 1.2 + +The `options.har` property will override the values: `url`, `method`, `qs`, `headers`, `form`, `formData`, `body`, `json`, as well as construct multipart data and read files from disk when `request.postData.params[].fileName` is present without a matching `value`. + +A validation step will check if the HAR Request format matches the latest spec (v1.2) and will skip parsing if not matching. + +```js + var request = require('request') + request({ + // will be ignored + method: 'GET', + uri: 'http://www.google.com', + + // HTTP Archive Request Object + har: { + url: 'http://www.mockbin.com/har', + method: 'POST', + headers: [ + { + name: 'content-type', + value: 'application/x-www-form-urlencoded' + } + ], + postData: { + mimeType: 'application/x-www-form-urlencoded', + params: [ + { + name: 'foo', + value: 'bar' + }, + { + name: 'hello', + value: 'world' + } + ] + } + } + }) + + // a POST request will be sent to http://www.mockbin.com + // with body an application/x-www-form-urlencoded body: + // foo=bar&hello=world +``` + +[back to top](#table-of-contents) + + +--- + +## request(options, callback) + +The first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional. + +- `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()` +- `baseUrl` - fully qualified uri string used as the base url. Most useful with `request.defaults`, for example when you want to do many requests to the same domain. If `baseUrl` is `https://example.com/api/`, then requesting `/end/point?test=true` will fetch `https://example.com/api/end/point?test=true`. When `baseUrl` is given, `uri` must also be a string. +- `method` - http method (default: `"GET"`) +- `headers` - http headers (default: `{}`) + +--- + +- `qs` - object containing querystring values to be appended to the `uri` +- `qsParseOptions` - object containing options to pass to the [qs.parse](https://github.com/hapijs/qs#parsing-objects) method. Alternatively pass options to the [querystring.parse](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_parse_str_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}` +- `qsStringifyOptions` - object containing options to pass to the [qs.stringify](https://github.com/hapijs/qs#stringifying) method. Alternatively pass options to the [querystring.stringify](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}`. For example, to change the way arrays are converted to query strings using the `qs` module pass the `arrayFormat` option with one of `indices|brackets|repeat` +- `useQuerystring` - if true, use `querystring` to stringify and parse + querystrings, otherwise use `qs` (default: `false`). Set this option to + `true` if you need arrays to be serialized as `foo=bar&foo=baz` instead of the + default `foo[0]=bar&foo[1]=baz`. + +--- + +- `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer`, `String` or `ReadStream`. If `json` is `true`, then `body` must be a JSON-serializable object. +- `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above. +- `formData` - data to pass for a `multipart/form-data` request. See + [Forms](#forms) section above. +- `multipart` - array of objects which contain their own headers and `body` + attributes. Sends a `multipart/related` request. See [Forms](#forms) section + above. + - Alternatively you can pass in an object `{chunked: false, data: []}` where + `chunked` is used to specify whether the request is sent in + [chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) + In non-chunked requests, data items with body streams are not allowed. +- `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request. +- `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request. +- `json` - sets `body` to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON. +- `jsonReviver` - a [reviver function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) that will be passed to `JSON.parse()` when parsing a JSON response body. +- `jsonReplacer` - a [replacer function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) that will be passed to `JSON.stringify()` when stringifying a JSON request body. + +--- + +- `auth` - a hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above. +- `oauth` - options for OAuth HMAC-SHA1 signing. See documentation above. +- `hawk` - options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example). +- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`, and optionally `session` (note that this only works for services that require session as part of the canonical string). Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services). If you want to use AWS sign version 4 use the parameter `sign_version` with value `4` otherwise the default is version 2. **Note:** you need to `npm install aws4` first. +- `httpSignature` - options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options. + +--- + +- `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise. +- `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`) +- `followOriginalHttpMethod` - by default we redirect to HTTP method GET. you can enable this property to redirect to the original HTTP method (default: `false`) +- `maxRedirects` - the maximum number of redirects to follow (default: `10`) +- `removeRefererHeader` - removes the referer header when a redirect happens (default: `false`). **Note:** if true, referer header set in the initial request is preserved during redirect chain. + +--- + +- `encoding` - encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). (**Note:** if you expect binary data, you should set `encoding: null`.) +- `gzip` - if `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below. +- `jar` - if `true`, remember cookies for future use (or define your custom cookie jar; see examples section) + +--- + +- `agent` - `http(s).Agent` instance to use +- `agentClass` - alternatively specify your agent's class name +- `agentOptions` - and pass its options. **Note:** for HTTPS see [tls API doc for TLS/SSL options](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback) and the [documentation above](#using-optionsagentoptions). +- `forever` - set to `true` to use the [forever-agent](https://github.com/request/forever-agent) **Note:** Defaults to `http(s).Agent({keepAlive:true})` in node 0.12+ +- `pool` - an object describing which agents to use for the request. If this option is omitted the request will use the global agent (as long as your options allow for it). Otherwise, request will search the pool for your custom agent. If no custom agent is found, a new agent will be created and added to the pool. **Note:** `pool` is used only when the `agent` option is not specified. + - A `maxSockets` property can also be provided on the `pool` object to set the max number of sockets for all agents created (ex: `pool: {maxSockets: Infinity}`). + - Note that if you are sending multiple requests in a loop and creating + multiple new `pool` objects, `maxSockets` will not work as intended. To + work around this, either use [`request.defaults`](#requestdefaultsoptions) + with your pool options or create the pool object with the `maxSockets` + property outside of the loop. +- `timeout` - integer containing the number of milliseconds to wait for a +server to send response headers (and start the response body) before aborting +the request. Note that if the underlying TCP connection cannot be established, +the OS-wide TCP connection timeout will overrule the `timeout` option ([the +default in Linux can be anywhere from 20-120 seconds][linux-timeout]). + +[linux-timeout]: http://www.sekuda.com/overriding_the_default_linux_kernel_20_second_tcp_socket_connect_timeout + +--- + +- `localAddress` - local interface to bind for network connections. +- `proxy` - an HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`) +- `strictSSL` - if `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option. +- `tunnel` - controls the behavior of + [HTTP `CONNECT` tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_tunneling) + as follows: + - `undefined` (default) - `true` if the destination is `https`, `false` otherwise + - `true` - always tunnel to the destination by making a `CONNECT` request to + the proxy + - `false` - request the destination as a `GET` request. +- `proxyHeaderWhiteList` - a whitelist of headers to send to a + tunneling proxy. +- `proxyHeaderExclusiveList` - a whitelist of headers to send + exclusively to a tunneling proxy and not to destination. + +--- + +- `time` - if `true`, the request-response cycle (including all redirects) is timed at millisecond resolution. When set, the following properties are added to the response object: + - `elapsedTime` Duration of the entire request/response in milliseconds (*deprecated*). + - `responseStartTime` Timestamp when the response began (in Unix Epoch milliseconds) (*deprecated*). + - `timingStart` Timestamp of the start of the request (in Unix Epoch milliseconds). + - `timings` Contains event timestamps in millisecond resolution relative to `timingStart`. If there were redirects, the properties reflect the timings of the final request in the redirect chain: + - `socket` Relative timestamp when the [`http`](https://nodejs.org/api/http.html#http_event_socket) module's `socket` event fires. This happens when the socket is assigned to the request. + - `lookup` Relative timestamp when the [`net`](https://nodejs.org/api/net.html#net_event_lookup) module's `lookup` event fires. This happens when the DNS has been resolved. + - `connect`: Relative timestamp when the [`net`](https://nodejs.org/api/net.html#net_event_connect) module's `connect` event fires. This happens when the server acknowledges the TCP connection. + - `response`: Relative timestamp when the [`http`](https://nodejs.org/api/http.html#http_event_response) module's `response` event fires. This happens when the first bytes are received from the server. + - `end`: Relative timestamp when the last bytes of the response are received. + - `timingPhases` Contains the durations of each request phase. If there were redirects, the properties reflect the timings of the final request in the redirect chain: + - `wait`: Duration of socket initialization (`timings.socket`) + - `dns`: Duration of DNS lookup (`timings.lookup` - `timings.socket`) + - `tcp`: Duration of TCP connection (`timings.connect` - `timings.socket`) + - `firstByte`: Duration of HTTP server response (`timings.response` - `timings.connect`) + - `download`: Duration of HTTP download (`timings.end` - `timings.response`) + - `total`: Duration entire HTTP round-trip (`timings.end`) + +- `har` - a [HAR 1.2 Request Object](http://www.softwareishard.com/blog/har-12-spec/#request), will be processed from HAR format into options overwriting matching values *(see the [HAR 1.2 section](#support-for-har-1.2) for details)* +- `callback` - alternatively pass the request's callback in the options object + +The callback argument gets 3 arguments: + +1. An `error` when applicable (usually from [`http.ClientRequest`](http://nodejs.org/api/http.html#http_class_http_clientrequest) object) +2. An [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) object (Response object) +3. The third is the `response` body (`String` or `Buffer`, or JSON object if the `json` option is supplied) + +[back to top](#table-of-contents) + + +--- + +## Convenience methods + +There are also shorthand methods for different HTTP METHODs and some other conveniences. + + +### request.defaults(options) + +This method **returns a wrapper** around the normal request API that defaults +to whatever options you pass to it. + +**Note:** `request.defaults()` **does not** modify the global request API; +instead, it **returns a wrapper** that has your default settings applied to it. + +**Note:** You can call `.defaults()` on the wrapper that is returned from +`request.defaults` to add/override defaults that were previously defaulted. + +For example: +```js +//requests using baseRequest() will set the 'x-token' header +var baseRequest = request.defaults({ + headers: {'x-token': 'my-token'} +}) + +//requests using specialRequest() will include the 'x-token' header set in +//baseRequest and will also include the 'special' header +var specialRequest = baseRequest.defaults({ + headers: {special: 'special value'} +}) +``` + +### request.METHOD() + +These HTTP method convenience functions act just like `request()` but with a default method already set for you: + +- *request.get()*: Defaults to `method: "GET"`. +- *request.post()*: Defaults to `method: "POST"`. +- *request.put()*: Defaults to `method: "PUT"`. +- *request.patch()*: Defaults to `method: "PATCH"`. +- *request.del() / request.delete()*: Defaults to `method: "DELETE"`. +- *request.head()*: Defaults to `method: "HEAD"`. +- *request.options()*: Defaults to `method: "OPTIONS"`. + +### request.cookie() + +Function that creates a new cookie. + +```js +request.cookie('key1=value1') +``` +### request.jar() + +Function that creates a new cookie jar. + +```js +request.jar() +``` + +[back to top](#table-of-contents) + + +--- + + +## Debugging + +There are at least three ways to debug the operation of `request`: + +1. Launch the node process like `NODE_DEBUG=request node script.js` + (`lib,request,otherlib` works too). + +2. Set `require('request').debug = true` at any time (this does the same thing + as #1). + +3. Use the [request-debug module](https://github.com/request/request-debug) to + view request and response headers and bodies. + +[back to top](#table-of-contents) + + +--- + +## Timeouts + +Most requests to external servers should have a timeout attached, in case the +server is not responding in a timely manner. Without a timeout, your code may +have a socket open/consume resources for minutes or more. + +There are two main types of timeouts: **connection timeouts** and **read +timeouts**. A connect timeout occurs if the timeout is hit while your client is +attempting to establish a connection to a remote machine (corresponding to the +[connect() call][connect] on the socket). A read timeout occurs any time the +server is too slow to send back a part of the response. + +These two situations have widely different implications for what went wrong +with the request, so it's useful to be able to distinguish them. You can detect +timeout errors by checking `err.code` for an 'ETIMEDOUT' value. Further, you +can detect whether the timeout was a connection timeout by checking if the +`err.connect` property is set to `true`. + +```js +request.get('http://10.255.255.1', {timeout: 1500}, function(err) { + console.log(err.code === 'ETIMEDOUT'); + // Set to `true` if the timeout was a connection timeout, `false` or + // `undefined` otherwise. + console.log(err.connect === true); + process.exit(0); +}); +``` + +[connect]: http://linux.die.net/man/2/connect + +## Examples: + +```js + var request = require('request') + , rand = Math.floor(Math.random()*100000000).toString() + ; + request( + { method: 'PUT' + , uri: 'http://mikeal.iriscouch.com/testjs/' + rand + , multipart: + [ { 'content-type': 'application/json' + , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + } + , { body: 'I am an attachment' } + ] + } + , function (error, response, body) { + if(response.statusCode == 201){ + console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) + } else { + console.log('error: '+ response.statusCode) + console.log(body) + } + } + ) +``` + +For backwards-compatibility, response compression is not supported by default. +To accept gzip-compressed responses, set the `gzip` option to `true`. Note +that the body data passed through `request` is automatically decompressed +while the response object is unmodified and will contain compressed data if +the server sent a compressed response. + +```js + var request = require('request') + request( + { method: 'GET' + , uri: 'http://www.google.com' + , gzip: true + } + , function (error, response, body) { + // body is the decompressed response body + console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity')) + console.log('the decoded data is: ' + body) + } + ) + .on('data', function(data) { + // decompressed data as it is received + console.log('decoded chunk: ' + data) + }) + .on('response', function(response) { + // unmodified http.IncomingMessage object + response.on('data', function(data) { + // compressed data as it is received + console.log('received ' + data.length + ' bytes of compressed data') + }) + }) +``` + +Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`). + +```js +var request = request.defaults({jar: true}) +request('http://www.google.com', function () { + request('http://images.google.com') +}) +``` + +To use a custom cookie jar (instead of `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`) + +```js +var j = request.jar() +var request = request.defaults({jar:j}) +request('http://www.google.com', function () { + request('http://images.google.com') +}) +``` + +OR + +```js +var j = request.jar(); +var cookie = request.cookie('key1=value1'); +var url = 'http://www.google.com'; +j.setCookie(cookie, url); +request({url: url, jar: j}, function () { + request('http://images.google.com') +}) +``` + +To use a custom cookie store (such as a +[`FileCookieStore`](https://github.com/mitsuru/tough-cookie-filestore) +which supports saving to and restoring from JSON files), pass it as a parameter +to `request.jar()`: + +```js +var FileCookieStore = require('tough-cookie-filestore'); +// NOTE - currently the 'cookies.json' file must already exist! +var j = request.jar(new FileCookieStore('cookies.json')); +request = request.defaults({ jar : j }) +request('http://www.google.com', function() { + request('http://images.google.com') +}) +``` + +The cookie store must be a +[`tough-cookie`](https://github.com/SalesforceEng/tough-cookie) +store and it must support synchronous operations; see the +[`CookieStore` API docs](https://github.com/SalesforceEng/tough-cookie#cookiestore-api) +for details. + +To inspect your cookie jar after a request: + +```js +var j = request.jar() +request({url: 'http://www.google.com', jar: j}, function () { + var cookie_string = j.getCookieString(url); // "key1=value1; key2=value2; ..." + var cookies = j.getCookies(url); + // [{key: 'key1', value: 'value1', domain: "www.google.com", ...}, ...] +}) +``` + +[back to top](#table-of-contents) diff --git a/appasar/canary/node_modules/request/index.js b/appasar/canary/node_modules/request/index.js new file mode 100644 index 0000000..f9b480a --- /dev/null +++ b/appasar/canary/node_modules/request/index.js @@ -0,0 +1,155 @@ +// Copyright 2010-2012 Mikeal Rogers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict' + +var extend = require('extend') +var cookies = require('./lib/cookies') +var helpers = require('./lib/helpers') + +var paramsHaveRequestBody = helpers.paramsHaveRequestBody + +// organize params for patch, post, put, head, del +function initParams (uri, options, callback) { + if (typeof options === 'function') { + callback = options + } + + var params = {} + if (typeof options === 'object') { + extend(params, options, {uri: uri}) + } else if (typeof uri === 'string') { + extend(params, {uri: uri}) + } else { + extend(params, uri) + } + + params.callback = callback || params.callback + return params +} + +function request (uri, options, callback) { + if (typeof uri === 'undefined') { + throw new Error('undefined is not a valid uri or options object.') + } + + var params = initParams(uri, options, callback) + + if (params.method === 'HEAD' && paramsHaveRequestBody(params)) { + throw new Error('HTTP HEAD requests MUST NOT include a request body.') + } + + return new request.Request(params) +} + +function verbFunc (verb) { + var method = verb.toUpperCase() + return function (uri, options, callback) { + var params = initParams(uri, options, callback) + params.method = method + return request(params, params.callback) + } +} + +// define like this to please codeintel/intellisense IDEs +request.get = verbFunc('get') +request.head = verbFunc('head') +request.options = verbFunc('options') +request.post = verbFunc('post') +request.put = verbFunc('put') +request.patch = verbFunc('patch') +request.del = verbFunc('delete') +request['delete'] = verbFunc('delete') + +request.jar = function (store) { + return cookies.jar(store) +} + +request.cookie = function (str) { + return cookies.parse(str) +} + +function wrapRequestMethod (method, options, requester, verb) { + return function (uri, opts, callback) { + var params = initParams(uri, opts, callback) + + var target = {} + extend(true, target, options, params) + + target.pool = params.pool || options.pool + + if (verb) { + target.method = verb.toUpperCase() + } + + if (typeof requester === 'function') { + method = requester + } + + return method(target, target.callback) + } +} + +request.defaults = function (options, requester) { + var self = this + + options = options || {} + + if (typeof options === 'function') { + requester = options + options = {} + } + + var defaults = wrapRequestMethod(self, options, requester) + + var verbs = ['get', 'head', 'post', 'put', 'patch', 'del', 'delete'] + verbs.forEach(function (verb) { + defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb) + }) + + defaults.cookie = wrapRequestMethod(self.cookie, options, requester) + defaults.jar = self.jar + defaults.defaults = self.defaults + return defaults +} + +request.forever = function (agentOptions, optionsArg) { + var options = {} + if (optionsArg) { + extend(options, optionsArg) + } + if (agentOptions) { + options.agentOptions = agentOptions + } + + options.forever = true + return request.defaults(options) +} + +// Exports + +module.exports = request +request.Request = require('./request') +request.initParams = initParams + +// Backwards compatibility for request.debug +Object.defineProperty(request, 'debug', { + enumerable: true, + get: function () { + return request.Request.debug + }, + set: function (debug) { + request.Request.debug = debug + } +}) diff --git a/appasar/canary/node_modules/request/lib/auth.js b/appasar/canary/node_modules/request/lib/auth.js new file mode 100644 index 0000000..42f9ada --- /dev/null +++ b/appasar/canary/node_modules/request/lib/auth.js @@ -0,0 +1,167 @@ +'use strict' + +var caseless = require('caseless') +var uuid = require('uuid') +var helpers = require('./helpers') + +var md5 = helpers.md5 +var toBase64 = helpers.toBase64 + +function Auth (request) { + // define all public properties here + this.request = request + this.hasAuth = false + this.sentAuth = false + this.bearerToken = null + this.user = null + this.pass = null +} + +Auth.prototype.basic = function (user, pass, sendImmediately) { + var self = this + if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) { + self.request.emit('error', new Error('auth() received invalid user or password')) + } + self.user = user + self.pass = pass + self.hasAuth = true + var header = user + ':' + (pass || '') + if (sendImmediately || typeof sendImmediately === 'undefined') { + var authHeader = 'Basic ' + toBase64(header) + self.sentAuth = true + return authHeader + } +} + +Auth.prototype.bearer = function (bearer, sendImmediately) { + var self = this + self.bearerToken = bearer + self.hasAuth = true + if (sendImmediately || typeof sendImmediately === 'undefined') { + if (typeof bearer === 'function') { + bearer = bearer() + } + var authHeader = 'Bearer ' + (bearer || '') + self.sentAuth = true + return authHeader + } +} + +Auth.prototype.digest = function (method, path, authHeader) { + // TODO: More complete implementation of RFC 2617. + // - handle challenge.domain + // - support qop="auth-int" only + // - handle Authentication-Info (not necessarily?) + // - check challenge.stale (not necessarily?) + // - increase nc (not necessarily?) + // For reference: + // http://tools.ietf.org/html/rfc2617#section-3 + // https://github.com/bagder/curl/blob/master/lib/http_digest.c + + var self = this + + var challenge = {} + var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi + for (;;) { + var match = re.exec(authHeader) + if (!match) { + break + } + challenge[match[1]] = match[2] || match[3] + } + + /** + * RFC 2617: handle both MD5 and MD5-sess algorithms. + * + * If the algorithm directive's value is "MD5" or unspecified, then HA1 is + * HA1=MD5(username:realm:password) + * If the algorithm directive's value is "MD5-sess", then HA1 is + * HA1=MD5(MD5(username:realm:password):nonce:cnonce) + */ + var ha1Compute = function (algorithm, user, realm, pass, nonce, cnonce) { + var ha1 = md5(user + ':' + realm + ':' + pass) + if (algorithm && algorithm.toLowerCase() === 'md5-sess') { + return md5(ha1 + ':' + nonce + ':' + cnonce) + } else { + return ha1 + } + } + + var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth' + var nc = qop && '00000001' + var cnonce = qop && uuid().replace(/-/g, '') + var ha1 = ha1Compute(challenge.algorithm, self.user, challenge.realm, self.pass, challenge.nonce, cnonce) + var ha2 = md5(method + ':' + path) + var digestResponse = qop + ? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2) + : md5(ha1 + ':' + challenge.nonce + ':' + ha2) + var authValues = { + username: self.user, + realm: challenge.realm, + nonce: challenge.nonce, + uri: path, + qop: qop, + response: digestResponse, + nc: nc, + cnonce: cnonce, + algorithm: challenge.algorithm, + opaque: challenge.opaque + } + + authHeader = [] + for (var k in authValues) { + if (authValues[k]) { + if (k === 'qop' || k === 'nc' || k === 'algorithm') { + authHeader.push(k + '=' + authValues[k]) + } else { + authHeader.push(k + '="' + authValues[k] + '"') + } + } + } + authHeader = 'Digest ' + authHeader.join(', ') + self.sentAuth = true + return authHeader +} + +Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) { + var self = this + var request = self.request + + var authHeader + if (bearer === undefined && user === undefined) { + self.request.emit('error', new Error('no auth mechanism defined')) + } else if (bearer !== undefined) { + authHeader = self.bearer(bearer, sendImmediately) + } else { + authHeader = self.basic(user, pass, sendImmediately) + } + if (authHeader) { + request.setHeader('authorization', authHeader) + } +} + +Auth.prototype.onResponse = function (response) { + var self = this + var request = self.request + + if (!self.hasAuth || self.sentAuth) { return null } + + var c = caseless(response.headers) + + var authHeader = c.get('www-authenticate') + var authVerb = authHeader && authHeader.split(' ')[0].toLowerCase() + request.debug('reauth', authVerb) + + switch (authVerb) { + case 'basic': + return self.basic(self.user, self.pass, true) + + case 'bearer': + return self.bearer(self.bearerToken, true) + + case 'digest': + return self.digest(request.method, request.path, authHeader) + } +} + +exports.Auth = Auth diff --git a/appasar/canary/node_modules/request/lib/cookies.js b/appasar/canary/node_modules/request/lib/cookies.js new file mode 100644 index 0000000..bd5d46b --- /dev/null +++ b/appasar/canary/node_modules/request/lib/cookies.js @@ -0,0 +1,38 @@ +'use strict' + +var tough = require('tough-cookie') + +var Cookie = tough.Cookie +var CookieJar = tough.CookieJar + +exports.parse = function (str) { + if (str && str.uri) { + str = str.uri + } + if (typeof str !== 'string') { + throw new Error('The cookie function only accepts STRING as param') + } + return Cookie.parse(str, {loose: true}) +} + +// Adapt the sometimes-Async api of tough.CookieJar to our requirements +function RequestJar (store) { + var self = this + self._jar = new CookieJar(store, {looseMode: true}) +} +RequestJar.prototype.setCookie = function (cookieOrStr, uri, options) { + var self = this + return self._jar.setCookieSync(cookieOrStr, uri, options || {}) +} +RequestJar.prototype.getCookieString = function (uri) { + var self = this + return self._jar.getCookieStringSync(uri) +} +RequestJar.prototype.getCookies = function (uri) { + var self = this + return self._jar.getCookiesSync(uri) +} + +exports.jar = function (store) { + return new RequestJar(store) +} diff --git a/appasar/canary/node_modules/request/lib/getProxyFromURI.js b/appasar/canary/node_modules/request/lib/getProxyFromURI.js new file mode 100644 index 0000000..4633ba5 --- /dev/null +++ b/appasar/canary/node_modules/request/lib/getProxyFromURI.js @@ -0,0 +1,79 @@ +'use strict' + +function formatHostname (hostname) { + // canonicalize the hostname, so that 'oogle.com' won't match 'google.com' + return hostname.replace(/^\.*/, '.').toLowerCase() +} + +function parseNoProxyZone (zone) { + zone = zone.trim().toLowerCase() + + var zoneParts = zone.split(':', 2) + var zoneHost = formatHostname(zoneParts[0]) + var zonePort = zoneParts[1] + var hasPort = zone.indexOf(':') > -1 + + return {hostname: zoneHost, port: zonePort, hasPort: hasPort} +} + +function uriInNoProxy (uri, noProxy) { + var port = uri.port || (uri.protocol === 'https:' ? '443' : '80') + var hostname = formatHostname(uri.hostname) + var noProxyList = noProxy.split(',') + + // iterate through the noProxyList until it finds a match. + return noProxyList.map(parseNoProxyZone).some(function (noProxyZone) { + var isMatchedAt = hostname.indexOf(noProxyZone.hostname) + var hostnameMatched = ( + isMatchedAt > -1 && + (isMatchedAt === hostname.length - noProxyZone.hostname.length) + ) + + if (noProxyZone.hasPort) { + return (port === noProxyZone.port) && hostnameMatched + } + + return hostnameMatched + }) +} + +function getProxyFromURI (uri) { + // Decide the proper request proxy to use based on the request URI object and the + // environmental variables (NO_PROXY, HTTP_PROXY, etc.) + // respect NO_PROXY environment variables (see: http://lynx.isc.org/current/breakout/lynx_help/keystrokes/environments.html) + + var noProxy = process.env.NO_PROXY || process.env.no_proxy || '' + + // if the noProxy is a wildcard then return null + + if (noProxy === '*') { + return null + } + + // if the noProxy is not empty and the uri is found return null + + if (noProxy !== '' && uriInNoProxy(uri, noProxy)) { + return null + } + + // Check for HTTP or HTTPS Proxy in environment Else default to null + + if (uri.protocol === 'http:') { + return process.env.HTTP_PROXY || + process.env.http_proxy || null + } + + if (uri.protocol === 'https:') { + return process.env.HTTPS_PROXY || + process.env.https_proxy || + process.env.HTTP_PROXY || + process.env.http_proxy || null + } + + // if none of that works, return null + // (What uri protocol are you using then?) + + return null +} + +module.exports = getProxyFromURI diff --git a/appasar/canary/node_modules/request/lib/har.js b/appasar/canary/node_modules/request/lib/har.js new file mode 100644 index 0000000..2f66030 --- /dev/null +++ b/appasar/canary/node_modules/request/lib/har.js @@ -0,0 +1,205 @@ +'use strict' + +var fs = require('fs') +var qs = require('querystring') +var validate = require('har-validator') +var extend = require('extend') + +function Har (request) { + this.request = request +} + +Har.prototype.reducer = function (obj, pair) { + // new property ? + if (obj[pair.name] === undefined) { + obj[pair.name] = pair.value + return obj + } + + // existing? convert to array + var arr = [ + obj[pair.name], + pair.value + ] + + obj[pair.name] = arr + + return obj +} + +Har.prototype.prep = function (data) { + // construct utility properties + data.queryObj = {} + data.headersObj = {} + data.postData.jsonObj = false + data.postData.paramsObj = false + + // construct query objects + if (data.queryString && data.queryString.length) { + data.queryObj = data.queryString.reduce(this.reducer, {}) + } + + // construct headers objects + if (data.headers && data.headers.length) { + // loweCase header keys + data.headersObj = data.headers.reduceRight(function (headers, header) { + headers[header.name] = header.value + return headers + }, {}) + } + + // construct Cookie header + if (data.cookies && data.cookies.length) { + var cookies = data.cookies.map(function (cookie) { + return cookie.name + '=' + cookie.value + }) + + if (cookies.length) { + data.headersObj.cookie = cookies.join('; ') + } + } + + // prep body + function some (arr) { + return arr.some(function (type) { + return data.postData.mimeType.indexOf(type) === 0 + }) + } + + if (some([ + 'multipart/mixed', + 'multipart/related', + 'multipart/form-data', + 'multipart/alternative'])) { + // reset values + data.postData.mimeType = 'multipart/form-data' + } else if (some([ + 'application/x-www-form-urlencoded'])) { + if (!data.postData.params) { + data.postData.text = '' + } else { + data.postData.paramsObj = data.postData.params.reduce(this.reducer, {}) + + // always overwrite + data.postData.text = qs.stringify(data.postData.paramsObj) + } + } else if (some([ + 'text/json', + 'text/x-json', + 'application/json', + 'application/x-json'])) { + data.postData.mimeType = 'application/json' + + if (data.postData.text) { + try { + data.postData.jsonObj = JSON.parse(data.postData.text) + } catch (e) { + this.request.debug(e) + + // force back to text/plain + data.postData.mimeType = 'text/plain' + } + } + } + + return data +} + +Har.prototype.options = function (options) { + // skip if no har property defined + if (!options.har) { + return options + } + + var har = {} + extend(har, options.har) + + // only process the first entry + if (har.log && har.log.entries) { + har = har.log.entries[0] + } + + // add optional properties to make validation successful + har.url = har.url || options.url || options.uri || options.baseUrl || '/' + har.httpVersion = har.httpVersion || 'HTTP/1.1' + har.queryString = har.queryString || [] + har.headers = har.headers || [] + har.cookies = har.cookies || [] + har.postData = har.postData || {} + har.postData.mimeType = har.postData.mimeType || 'application/octet-stream' + + har.bodySize = 0 + har.headersSize = 0 + har.postData.size = 0 + + if (!validate.request(har)) { + return options + } + + // clean up and get some utility properties + var req = this.prep(har) + + // construct new options + if (req.url) { + options.url = req.url + } + + if (req.method) { + options.method = req.method + } + + if (Object.keys(req.queryObj).length) { + options.qs = req.queryObj + } + + if (Object.keys(req.headersObj).length) { + options.headers = req.headersObj + } + + function test (type) { + return req.postData.mimeType.indexOf(type) === 0 + } + if (test('application/x-www-form-urlencoded')) { + options.form = req.postData.paramsObj + } else if (test('application/json')) { + if (req.postData.jsonObj) { + options.body = req.postData.jsonObj + options.json = true + } + } else if (test('multipart/form-data')) { + options.formData = {} + + req.postData.params.forEach(function (param) { + var attachment = {} + + if (!param.fileName && !param.fileName && !param.contentType) { + options.formData[param.name] = param.value + return + } + + // attempt to read from disk! + if (param.fileName && !param.value) { + attachment.value = fs.createReadStream(param.fileName) + } else if (param.value) { + attachment.value = param.value + } + + if (param.fileName) { + attachment.options = { + filename: param.fileName, + contentType: param.contentType ? param.contentType : null + } + } + + options.formData[param.name] = attachment + }) + } else { + if (req.postData.text) { + options.body = req.postData.text + } + } + + return options +} + +exports.Har = Har diff --git a/appasar/canary/node_modules/request/lib/helpers.js b/appasar/canary/node_modules/request/lib/helpers.js new file mode 100644 index 0000000..8b2a7e6 --- /dev/null +++ b/appasar/canary/node_modules/request/lib/helpers.js @@ -0,0 +1,66 @@ +'use strict' + +var jsonSafeStringify = require('json-stringify-safe') +var crypto = require('crypto') +var Buffer = require('safe-buffer').Buffer + +var defer = typeof setImmediate === 'undefined' + ? process.nextTick + : setImmediate + +function paramsHaveRequestBody (params) { + return ( + params.body || + params.requestBodyStream || + (params.json && typeof params.json !== 'boolean') || + params.multipart + ) +} + +function safeStringify (obj, replacer) { + var ret + try { + ret = JSON.stringify(obj, replacer) + } catch (e) { + ret = jsonSafeStringify(obj, replacer) + } + return ret +} + +function md5 (str) { + return crypto.createHash('md5').update(str).digest('hex') +} + +function isReadStream (rs) { + return rs.readable && rs.path && rs.mode +} + +function toBase64 (str) { + return Buffer.from(str || '', 'utf8').toString('base64') +} + +function copy (obj) { + var o = {} + Object.keys(obj).forEach(function (i) { + o[i] = obj[i] + }) + return o +} + +function version () { + var numbers = process.version.replace('v', '').split('.') + return { + major: parseInt(numbers[0], 10), + minor: parseInt(numbers[1], 10), + patch: parseInt(numbers[2], 10) + } +} + +exports.paramsHaveRequestBody = paramsHaveRequestBody +exports.safeStringify = safeStringify +exports.md5 = md5 +exports.isReadStream = isReadStream +exports.toBase64 = toBase64 +exports.copy = copy +exports.version = version +exports.defer = defer diff --git a/appasar/canary/node_modules/request/lib/multipart.js b/appasar/canary/node_modules/request/lib/multipart.js new file mode 100644 index 0000000..d6b9812 --- /dev/null +++ b/appasar/canary/node_modules/request/lib/multipart.js @@ -0,0 +1,112 @@ +'use strict' + +var uuid = require('uuid') +var CombinedStream = require('combined-stream') +var isstream = require('isstream') +var Buffer = require('safe-buffer').Buffer + +function Multipart (request) { + this.request = request + this.boundary = uuid() + this.chunked = false + this.body = null +} + +Multipart.prototype.isChunked = function (options) { + var self = this + var chunked = false + var parts = options.data || options + + if (!parts.forEach) { + self.request.emit('error', new Error('Argument error, options.multipart.')) + } + + if (options.chunked !== undefined) { + chunked = options.chunked + } + + if (self.request.getHeader('transfer-encoding') === 'chunked') { + chunked = true + } + + if (!chunked) { + parts.forEach(function (part) { + if (typeof part.body === 'undefined') { + self.request.emit('error', new Error('Body attribute missing in multipart.')) + } + if (isstream(part.body)) { + chunked = true + } + }) + } + + return chunked +} + +Multipart.prototype.setHeaders = function (chunked) { + var self = this + + if (chunked && !self.request.hasHeader('transfer-encoding')) { + self.request.setHeader('transfer-encoding', 'chunked') + } + + var header = self.request.getHeader('content-type') + + if (!header || header.indexOf('multipart') === -1) { + self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary) + } else { + if (header.indexOf('boundary') !== -1) { + self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1') + } else { + self.request.setHeader('content-type', header + '; boundary=' + self.boundary) + } + } +} + +Multipart.prototype.build = function (parts, chunked) { + var self = this + var body = chunked ? new CombinedStream() : [] + + function add (part) { + if (typeof part === 'number') { + part = part.toString() + } + return chunked ? body.append(part) : body.push(Buffer.from(part)) + } + + if (self.request.preambleCRLF) { + add('\r\n') + } + + parts.forEach(function (part) { + var preamble = '--' + self.boundary + '\r\n' + Object.keys(part).forEach(function (key) { + if (key === 'body') { return } + preamble += key + ': ' + part[key] + '\r\n' + }) + preamble += '\r\n' + add(preamble) + add(part.body) + add('\r\n') + }) + add('--' + self.boundary + '--') + + if (self.request.postambleCRLF) { + add('\r\n') + } + + return body +} + +Multipart.prototype.onRequest = function (options) { + var self = this + + var chunked = self.isChunked(options) + var parts = options.data || options + + self.setHeaders(chunked) + self.chunked = chunked + self.body = self.build(parts, chunked) +} + +exports.Multipart = Multipart diff --git a/appasar/canary/node_modules/request/lib/oauth.js b/appasar/canary/node_modules/request/lib/oauth.js new file mode 100644 index 0000000..0c9c57c --- /dev/null +++ b/appasar/canary/node_modules/request/lib/oauth.js @@ -0,0 +1,148 @@ +'use strict' + +var url = require('url') +var qs = require('qs') +var caseless = require('caseless') +var uuid = require('uuid') +var oauth = require('oauth-sign') +var crypto = require('crypto') +var Buffer = require('safe-buffer').Buffer + +function OAuth (request) { + this.request = request + this.params = null +} + +OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib) { + var oa = {} + for (var i in _oauth) { + oa['oauth_' + i] = _oauth[i] + } + if (!oa.oauth_version) { + oa.oauth_version = '1.0' + } + if (!oa.oauth_timestamp) { + oa.oauth_timestamp = Math.floor(Date.now() / 1000).toString() + } + if (!oa.oauth_nonce) { + oa.oauth_nonce = uuid().replace(/-/g, '') + } + if (!oa.oauth_signature_method) { + oa.oauth_signature_method = 'HMAC-SHA1' + } + + var consumer_secret_or_private_key = oa.oauth_consumer_secret || oa.oauth_private_key // eslint-disable-line camelcase + delete oa.oauth_consumer_secret + delete oa.oauth_private_key + + var token_secret = oa.oauth_token_secret // eslint-disable-line camelcase + delete oa.oauth_token_secret + + var realm = oa.oauth_realm + delete oa.oauth_realm + delete oa.oauth_transport_method + + var baseurl = uri.protocol + '//' + uri.host + uri.pathname + var params = qsLib.parse([].concat(query, form, qsLib.stringify(oa)).join('&')) + + oa.oauth_signature = oauth.sign( + oa.oauth_signature_method, + method, + baseurl, + params, + consumer_secret_or_private_key, // eslint-disable-line camelcase + token_secret // eslint-disable-line camelcase + ) + + if (realm) { + oa.realm = realm + } + + return oa +} + +OAuth.prototype.buildBodyHash = function (_oauth, body) { + if (['HMAC-SHA1', 'RSA-SHA1'].indexOf(_oauth.signature_method || 'HMAC-SHA1') < 0) { + this.request.emit('error', new Error('oauth: ' + _oauth.signature_method + + ' signature_method not supported with body_hash signing.')) + } + + var shasum = crypto.createHash('sha1') + shasum.update(body || '') + var sha1 = shasum.digest('hex') + + return Buffer.from(sha1).toString('base64') +} + +OAuth.prototype.concatParams = function (oa, sep, wrap) { + wrap = wrap || '' + + var params = Object.keys(oa).filter(function (i) { + return i !== 'realm' && i !== 'oauth_signature' + }).sort() + + if (oa.realm) { + params.splice(0, 0, 'realm') + } + params.push('oauth_signature') + + return params.map(function (i) { + return i + '=' + wrap + oauth.rfc3986(oa[i]) + wrap + }).join(sep) +} + +OAuth.prototype.onRequest = function (_oauth) { + var self = this + self.params = _oauth + + var uri = self.request.uri || {} + var method = self.request.method || '' + var headers = caseless(self.request.headers) + var body = self.request.body || '' + var qsLib = self.request.qsLib || qs + + var form + var query + var contentType = headers.get('content-type') || '' + var formContentType = 'application/x-www-form-urlencoded' + var transport = _oauth.transport_method || 'header' + + if (contentType.slice(0, formContentType.length) === formContentType) { + contentType = formContentType + form = body + } + if (uri.query) { + query = uri.query + } + if (transport === 'body' && (method !== 'POST' || contentType !== formContentType)) { + self.request.emit('error', new Error('oauth: transport_method of body requires POST ' + + 'and content-type ' + formContentType)) + } + + if (!form && typeof _oauth.body_hash === 'boolean') { + _oauth.body_hash = self.buildBodyHash(_oauth, self.request.body.toString()) + } + + var oa = self.buildParams(_oauth, uri, method, query, form, qsLib) + + switch (transport) { + case 'header': + self.request.setHeader('Authorization', 'OAuth ' + self.concatParams(oa, ',', '"')) + break + + case 'query': + var href = self.request.uri.href += (query ? '&' : '?') + self.concatParams(oa, '&') + self.request.uri = url.parse(href) + self.request.path = self.request.uri.path + break + + case 'body': + self.request.body = (form ? form + '&' : '') + self.concatParams(oa, '&') + break + + default: + self.request.emit('error', new Error('oauth: transport_method invalid')) + } +} + +exports.OAuth = OAuth diff --git a/appasar/canary/node_modules/request/lib/querystring.js b/appasar/canary/node_modules/request/lib/querystring.js new file mode 100644 index 0000000..4a32cd1 --- /dev/null +++ b/appasar/canary/node_modules/request/lib/querystring.js @@ -0,0 +1,50 @@ +'use strict' + +var qs = require('qs') +var querystring = require('querystring') + +function Querystring (request) { + this.request = request + this.lib = null + this.useQuerystring = null + this.parseOptions = null + this.stringifyOptions = null +} + +Querystring.prototype.init = function (options) { + if (this.lib) { return } + + this.useQuerystring = options.useQuerystring + this.lib = (this.useQuerystring ? querystring : qs) + + this.parseOptions = options.qsParseOptions || {} + this.stringifyOptions = options.qsStringifyOptions || {} +} + +Querystring.prototype.stringify = function (obj) { + return (this.useQuerystring) + ? this.rfc3986(this.lib.stringify(obj, + this.stringifyOptions.sep || null, + this.stringifyOptions.eq || null, + this.stringifyOptions)) + : this.lib.stringify(obj, this.stringifyOptions) +} + +Querystring.prototype.parse = function (str) { + return (this.useQuerystring) + ? this.lib.parse(str, + this.parseOptions.sep || null, + this.parseOptions.eq || null, + this.parseOptions) + : this.lib.parse(str, this.parseOptions) +} + +Querystring.prototype.rfc3986 = function (str) { + return str.replace(/[!'()*]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} + +Querystring.prototype.unescape = querystring.unescape + +exports.Querystring = Querystring diff --git a/appasar/canary/node_modules/request/lib/redirect.js b/appasar/canary/node_modules/request/lib/redirect.js new file mode 100644 index 0000000..b9150e7 --- /dev/null +++ b/appasar/canary/node_modules/request/lib/redirect.js @@ -0,0 +1,154 @@ +'use strict' + +var url = require('url') +var isUrl = /^https?:/ + +function Redirect (request) { + this.request = request + this.followRedirect = true + this.followRedirects = true + this.followAllRedirects = false + this.followOriginalHttpMethod = false + this.allowRedirect = function () { return true } + this.maxRedirects = 10 + this.redirects = [] + this.redirectsFollowed = 0 + this.removeRefererHeader = false +} + +Redirect.prototype.onRequest = function (options) { + var self = this + + if (options.maxRedirects !== undefined) { + self.maxRedirects = options.maxRedirects + } + if (typeof options.followRedirect === 'function') { + self.allowRedirect = options.followRedirect + } + if (options.followRedirect !== undefined) { + self.followRedirects = !!options.followRedirect + } + if (options.followAllRedirects !== undefined) { + self.followAllRedirects = options.followAllRedirects + } + if (self.followRedirects || self.followAllRedirects) { + self.redirects = self.redirects || [] + } + if (options.removeRefererHeader !== undefined) { + self.removeRefererHeader = options.removeRefererHeader + } + if (options.followOriginalHttpMethod !== undefined) { + self.followOriginalHttpMethod = options.followOriginalHttpMethod + } +} + +Redirect.prototype.redirectTo = function (response) { + var self = this + var request = self.request + + var redirectTo = null + if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) { + var location = response.caseless.get('location') + request.debug('redirect', location) + + if (self.followAllRedirects) { + redirectTo = location + } else if (self.followRedirects) { + switch (request.method) { + case 'PATCH': + case 'PUT': + case 'POST': + case 'DELETE': + // Do not follow redirects + break + default: + redirectTo = location + break + } + } + } else if (response.statusCode === 401) { + var authHeader = request._auth.onResponse(response) + if (authHeader) { + request.setHeader('authorization', authHeader) + redirectTo = request.uri + } + } + return redirectTo +} + +Redirect.prototype.onResponse = function (response) { + var self = this + var request = self.request + + var redirectTo = self.redirectTo(response) + if (!redirectTo || !self.allowRedirect.call(request, response)) { + return false + } + + request.debug('redirect to', redirectTo) + + // ignore any potential response body. it cannot possibly be useful + // to us at this point. + // response.resume should be defined, but check anyway before calling. Workaround for browserify. + if (response.resume) { + response.resume() + } + + if (self.redirectsFollowed >= self.maxRedirects) { + request.emit('error', new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + request.uri.href)) + return false + } + self.redirectsFollowed += 1 + + if (!isUrl.test(redirectTo)) { + redirectTo = url.resolve(request.uri.href, redirectTo) + } + + var uriPrev = request.uri + request.uri = url.parse(redirectTo) + + // handle the case where we change protocol from https to http or vice versa + if (request.uri.protocol !== uriPrev.protocol) { + delete request.agent + } + + self.redirects.push({ statusCode: response.statusCode, redirectUri: redirectTo }) + + if (self.followAllRedirects && request.method !== 'HEAD' && + response.statusCode !== 401 && response.statusCode !== 307) { + request.method = self.followOriginalHttpMethod ? request.method : 'GET' + } + // request.method = 'GET' // Force all redirects to use GET || commented out fixes #215 + delete request.src + delete request.req + delete request._started + if (response.statusCode !== 401 && response.statusCode !== 307) { + // Remove parameters from the previous response, unless this is the second request + // for a server that requires digest authentication. + delete request.body + delete request._form + if (request.headers) { + request.removeHeader('host') + request.removeHeader('content-type') + request.removeHeader('content-length') + if (request.uri.hostname !== request.originalHost.split(':')[0]) { + // Remove authorization if changing hostnames (but not if just + // changing ports or protocols). This matches the behavior of curl: + // https://github.com/bagder/curl/blob/6beb0eee/lib/http.c#L710 + request.removeHeader('authorization') + } + } + } + + if (!self.removeRefererHeader) { + request.setHeader('referer', uriPrev.href) + } + + request.emit('redirect') + + request.init() + + return true +} + +exports.Redirect = Redirect diff --git a/appasar/canary/node_modules/request/lib/tunnel.js b/appasar/canary/node_modules/request/lib/tunnel.js new file mode 100644 index 0000000..4479003 --- /dev/null +++ b/appasar/canary/node_modules/request/lib/tunnel.js @@ -0,0 +1,175 @@ +'use strict' + +var url = require('url') +var tunnel = require('tunnel-agent') + +var defaultProxyHeaderWhiteList = [ + 'accept', + 'accept-charset', + 'accept-encoding', + 'accept-language', + 'accept-ranges', + 'cache-control', + 'content-encoding', + 'content-language', + 'content-location', + 'content-md5', + 'content-range', + 'content-type', + 'connection', + 'date', + 'expect', + 'max-forwards', + 'pragma', + 'referer', + 'te', + 'user-agent', + 'via' +] + +var defaultProxyHeaderExclusiveList = [ + 'proxy-authorization' +] + +function constructProxyHost (uriObject) { + var port = uriObject.port + var protocol = uriObject.protocol + var proxyHost = uriObject.hostname + ':' + + if (port) { + proxyHost += port + } else if (protocol === 'https:') { + proxyHost += '443' + } else { + proxyHost += '80' + } + + return proxyHost +} + +function constructProxyHeaderWhiteList (headers, proxyHeaderWhiteList) { + var whiteList = proxyHeaderWhiteList + .reduce(function (set, header) { + set[header.toLowerCase()] = true + return set + }, {}) + + return Object.keys(headers) + .filter(function (header) { + return whiteList[header.toLowerCase()] + }) + .reduce(function (set, header) { + set[header] = headers[header] + return set + }, {}) +} + +function constructTunnelOptions (request, proxyHeaders) { + var proxy = request.proxy + + var tunnelOptions = { + proxy: { + host: proxy.hostname, + port: +proxy.port, + proxyAuth: proxy.auth, + headers: proxyHeaders + }, + headers: request.headers, + ca: request.ca, + cert: request.cert, + key: request.key, + passphrase: request.passphrase, + pfx: request.pfx, + ciphers: request.ciphers, + rejectUnauthorized: request.rejectUnauthorized, + secureOptions: request.secureOptions, + secureProtocol: request.secureProtocol + } + + return tunnelOptions +} + +function constructTunnelFnName (uri, proxy) { + var uriProtocol = (uri.protocol === 'https:' ? 'https' : 'http') + var proxyProtocol = (proxy.protocol === 'https:' ? 'Https' : 'Http') + return [uriProtocol, proxyProtocol].join('Over') +} + +function getTunnelFn (request) { + var uri = request.uri + var proxy = request.proxy + var tunnelFnName = constructTunnelFnName(uri, proxy) + return tunnel[tunnelFnName] +} + +function Tunnel (request) { + this.request = request + this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList + this.proxyHeaderExclusiveList = [] + if (typeof request.tunnel !== 'undefined') { + this.tunnelOverride = request.tunnel + } +} + +Tunnel.prototype.isEnabled = function () { + var self = this + var request = self.request + // Tunnel HTTPS by default. Allow the user to override this setting. + + // If self.tunnelOverride is set (the user specified a value), use it. + if (typeof self.tunnelOverride !== 'undefined') { + return self.tunnelOverride + } + + // If the destination is HTTPS, tunnel. + if (request.uri.protocol === 'https:') { + return true + } + + // Otherwise, do not use tunnel. + return false +} + +Tunnel.prototype.setup = function (options) { + var self = this + var request = self.request + + options = options || {} + + if (typeof request.proxy === 'string') { + request.proxy = url.parse(request.proxy) + } + + if (!request.proxy || !request.tunnel) { + return false + } + + // Setup Proxy Header Exclusive List and White List + if (options.proxyHeaderWhiteList) { + self.proxyHeaderWhiteList = options.proxyHeaderWhiteList + } + if (options.proxyHeaderExclusiveList) { + self.proxyHeaderExclusiveList = options.proxyHeaderExclusiveList + } + + var proxyHeaderExclusiveList = self.proxyHeaderExclusiveList.concat(defaultProxyHeaderExclusiveList) + var proxyHeaderWhiteList = self.proxyHeaderWhiteList.concat(proxyHeaderExclusiveList) + + // Setup Proxy Headers and Proxy Headers Host + // Only send the Proxy White Listed Header names + var proxyHeaders = constructProxyHeaderWhiteList(request.headers, proxyHeaderWhiteList) + proxyHeaders.host = constructProxyHost(request.uri) + + proxyHeaderExclusiveList.forEach(request.removeHeader, request) + + // Set Agent from Tunnel Data + var tunnelFn = getTunnelFn(request) + var tunnelOptions = constructTunnelOptions(request, proxyHeaders) + request.agent = tunnelFn(tunnelOptions) + + return true +} + +Tunnel.defaultProxyHeaderWhiteList = defaultProxyHeaderWhiteList +Tunnel.defaultProxyHeaderExclusiveList = defaultProxyHeaderExclusiveList +exports.Tunnel = Tunnel diff --git a/appasar/canary/node_modules/request/node_modules/.bin/uuid b/appasar/canary/node_modules/request/node_modules/.bin/uuid new file mode 120000 index 0000000..740f800 --- /dev/null +++ b/appasar/canary/node_modules/request/node_modules/.bin/uuid @@ -0,0 +1 @@ +../../../uuid/bin/uuid \ No newline at end of file diff --git a/appasar/canary/node_modules/request/package.json b/appasar/canary/node_modules/request/package.json new file mode 100644 index 0000000..f2afc82 --- /dev/null +++ b/appasar/canary/node_modules/request/package.json @@ -0,0 +1,88 @@ +{ + "name": "request", + "description": "Simplified HTTP request client.", + "keywords": [ + "http", + "simple", + "util", + "utility" + ], + "version": "2.83.0", + "author": "Mikeal Rogers ", + "repository": { + "type": "git", + "url": "https://github.com/request/request.git" + }, + "bugs": { + "url": "http://github.com/request/request/issues" + }, + "license": "Apache-2.0", + "engines": { + "node": ">= 4" + }, + "main": "index.js", + "files": [ + "lib/", + "index.js", + "request.js" + ], + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "hawk": "~6.0.2", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "stringstream": "~0.0.5", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + }, + "scripts": { + "test": "npm run lint && npm run test-ci && npm run test-browser", + "test-ci": "taper tests/test-*.js", + "test-cov": "istanbul cover tape tests/test-*.js", + "test-browser": "node tests/browser/start.js", + "lint": "standard" + }, + "devDependencies": { + "bluebird": "^3.2.1", + "browserify": "^13.0.1", + "browserify-istanbul": "^2.0.0", + "buffer-equal": "^1.0.0", + "codecov": "^2.0.2", + "coveralls": "^2.11.4", + "function-bind": "^1.0.2", + "istanbul": "^0.4.0", + "karma": "^1.1.1", + "karma-browserify": "^5.0.1", + "karma-cli": "^1.0.0", + "karma-coverage": "^1.0.0", + "karma-phantomjs-launcher": "^1.0.0", + "karma-tap": "^3.0.1", + "phantomjs-prebuilt": "^2.1.3", + "rimraf": "^2.2.8", + "server-destroy": "^1.0.1", + "standard": "^9.0.0", + "tape": "^4.6.0", + "taper": "^0.5.0" + }, + "greenkeeper": { + "ignore": [ + "hawk", + "har-validator" + ] + } +} diff --git a/appasar/canary/node_modules/request/request.js b/appasar/canary/node_modules/request/request.js new file mode 100644 index 0000000..ff19ca3 --- /dev/null +++ b/appasar/canary/node_modules/request/request.js @@ -0,0 +1,1552 @@ +'use strict' + +var http = require('http') +var https = require('https') +var url = require('url') +var util = require('util') +var stream = require('stream') +var zlib = require('zlib') +var hawk = require('hawk') +var aws2 = require('aws-sign2') +var aws4 = require('aws4') +var httpSignature = require('http-signature') +var mime = require('mime-types') +var stringstream = require('stringstream') +var caseless = require('caseless') +var ForeverAgent = require('forever-agent') +var FormData = require('form-data') +var extend = require('extend') +var isstream = require('isstream') +var isTypedArray = require('is-typedarray').strict +var helpers = require('./lib/helpers') +var cookies = require('./lib/cookies') +var getProxyFromURI = require('./lib/getProxyFromURI') +var Querystring = require('./lib/querystring').Querystring +var Har = require('./lib/har').Har +var Auth = require('./lib/auth').Auth +var OAuth = require('./lib/oauth').OAuth +var Multipart = require('./lib/multipart').Multipart +var Redirect = require('./lib/redirect').Redirect +var Tunnel = require('./lib/tunnel').Tunnel +var now = require('performance-now') +var Buffer = require('safe-buffer').Buffer + +var safeStringify = helpers.safeStringify +var isReadStream = helpers.isReadStream +var toBase64 = helpers.toBase64 +var defer = helpers.defer +var copy = helpers.copy +var version = helpers.version +var globalCookieJar = cookies.jar() + +var globalPool = {} + +function filterForNonReserved (reserved, options) { + // Filter out properties that are not reserved. + // Reserved values are passed in at call site. + + var object = {} + for (var i in options) { + var notReserved = (reserved.indexOf(i) === -1) + if (notReserved) { + object[i] = options[i] + } + } + return object +} + +function filterOutReservedFunctions (reserved, options) { + // Filter out properties that are functions and are reserved. + // Reserved values are passed in at call site. + + var object = {} + for (var i in options) { + var isReserved = !(reserved.indexOf(i) === -1) + var isFunction = (typeof options[i] === 'function') + if (!(isReserved && isFunction)) { + object[i] = options[i] + } + } + return object +} + +// Return a simpler request object to allow serialization +function requestToJSON () { + var self = this + return { + uri: self.uri, + method: self.method, + headers: self.headers + } +} + +// Return a simpler response object to allow serialization +function responseToJSON () { + var self = this + return { + statusCode: self.statusCode, + body: self.body, + headers: self.headers, + request: requestToJSON.call(self.request) + } +} + +function Request (options) { + // if given the method property in options, set property explicitMethod to true + + // extend the Request instance with any non-reserved properties + // remove any reserved functions from the options object + // set Request instance to be readable and writable + // call init + + var self = this + + // start with HAR, then override with additional options + if (options.har) { + self._har = new Har(self) + options = self._har.options(options) + } + + stream.Stream.call(self) + var reserved = Object.keys(Request.prototype) + var nonReserved = filterForNonReserved(reserved, options) + + extend(self, nonReserved) + options = filterOutReservedFunctions(reserved, options) + + self.readable = true + self.writable = true + if (options.method) { + self.explicitMethod = true + } + self._qs = new Querystring(self) + self._auth = new Auth(self) + self._oauth = new OAuth(self) + self._multipart = new Multipart(self) + self._redirect = new Redirect(self) + self._tunnel = new Tunnel(self) + self.init(options) +} + +util.inherits(Request, stream.Stream) + +// Debugging +Request.debug = process.env.NODE_DEBUG && /\brequest\b/.test(process.env.NODE_DEBUG) +function debug () { + if (Request.debug) { + console.error('REQUEST %s', util.format.apply(util, arguments)) + } +} +Request.prototype.debug = debug + +Request.prototype.init = function (options) { + // init() contains all the code to setup the request object. + // the actual outgoing request is not started until start() is called + // this function is called from both the constructor and on redirect. + var self = this + if (!options) { + options = {} + } + self.headers = self.headers ? copy(self.headers) : {} + + // Delete headers with value undefined since they break + // ClientRequest.OutgoingMessage.setHeader in node 0.12 + for (var headerName in self.headers) { + if (typeof self.headers[headerName] === 'undefined') { + delete self.headers[headerName] + } + } + + caseless.httpify(self, self.headers) + + if (!self.method) { + self.method = options.method || 'GET' + } + if (!self.localAddress) { + self.localAddress = options.localAddress + } + + self._qs.init(options) + + debug(options) + if (!self.pool && self.pool !== false) { + self.pool = globalPool + } + self.dests = self.dests || [] + self.__isRequestRequest = true + + // Protect against double callback + if (!self._callback && self.callback) { + self._callback = self.callback + self.callback = function () { + if (self._callbackCalled) { + return // Print a warning maybe? + } + self._callbackCalled = true + self._callback.apply(self, arguments) + } + self.on('error', self.callback.bind()) + self.on('complete', self.callback.bind(self, null)) + } + + // People use this property instead all the time, so support it + if (!self.uri && self.url) { + self.uri = self.url + delete self.url + } + + // If there's a baseUrl, then use it as the base URL (i.e. uri must be + // specified as a relative path and is appended to baseUrl). + if (self.baseUrl) { + if (typeof self.baseUrl !== 'string') { + return self.emit('error', new Error('options.baseUrl must be a string')) + } + + if (typeof self.uri !== 'string') { + return self.emit('error', new Error('options.uri must be a string when using options.baseUrl')) + } + + if (self.uri.indexOf('//') === 0 || self.uri.indexOf('://') !== -1) { + return self.emit('error', new Error('options.uri must be a path when using options.baseUrl')) + } + + // Handle all cases to make sure that there's only one slash between + // baseUrl and uri. + var baseUrlEndsWithSlash = self.baseUrl.lastIndexOf('/') === self.baseUrl.length - 1 + var uriStartsWithSlash = self.uri.indexOf('/') === 0 + + if (baseUrlEndsWithSlash && uriStartsWithSlash) { + self.uri = self.baseUrl + self.uri.slice(1) + } else if (baseUrlEndsWithSlash || uriStartsWithSlash) { + self.uri = self.baseUrl + self.uri + } else if (self.uri === '') { + self.uri = self.baseUrl + } else { + self.uri = self.baseUrl + '/' + self.uri + } + delete self.baseUrl + } + + // A URI is needed by this point, emit error if we haven't been able to get one + if (!self.uri) { + return self.emit('error', new Error('options.uri is a required argument')) + } + + // If a string URI/URL was given, parse it into a URL object + if (typeof self.uri === 'string') { + self.uri = url.parse(self.uri) + } + + // Some URL objects are not from a URL parsed string and need href added + if (!self.uri.href) { + self.uri.href = url.format(self.uri) + } + + // DEPRECATED: Warning for users of the old Unix Sockets URL Scheme + if (self.uri.protocol === 'unix:') { + return self.emit('error', new Error('`unix://` URL scheme is no longer supported. Please use the format `http://unix:SOCKET:PATH`')) + } + + // Support Unix Sockets + if (self.uri.host === 'unix') { + self.enableUnixSocket() + } + + if (self.strictSSL === false) { + self.rejectUnauthorized = false + } + + if (!self.uri.pathname) { self.uri.pathname = '/' } + + if (!(self.uri.host || (self.uri.hostname && self.uri.port)) && !self.uri.isUnix) { + // Invalid URI: it may generate lot of bad errors, like 'TypeError: Cannot call method `indexOf` of undefined' in CookieJar + // Detect and reject it as soon as possible + var faultyUri = url.format(self.uri) + var message = 'Invalid URI "' + faultyUri + '"' + if (Object.keys(options).length === 0) { + // No option ? This can be the sign of a redirect + // As this is a case where the user cannot do anything (they didn't call request directly with this URL) + // they should be warned that it can be caused by a redirection (can save some hair) + message += '. This can be caused by a crappy redirection.' + } + // This error was fatal + self.abort() + return self.emit('error', new Error(message)) + } + + if (!self.hasOwnProperty('proxy')) { + self.proxy = getProxyFromURI(self.uri) + } + + self.tunnel = self._tunnel.isEnabled() + if (self.proxy) { + self._tunnel.setup(options) + } + + self._redirect.onRequest(options) + + self.setHost = false + if (!self.hasHeader('host')) { + var hostHeaderName = self.originalHostHeaderName || 'host' + // When used with an IPv6 address, `host` will provide + // the correct bracketed format, unlike using `hostname` and + // optionally adding the `port` when necessary. + self.setHeader(hostHeaderName, self.uri.host) + self.setHost = true + } + + self.jar(self._jar || options.jar) + + if (!self.uri.port) { + if (self.uri.protocol === 'http:') { self.uri.port = 80 } else if (self.uri.protocol === 'https:') { self.uri.port = 443 } + } + + if (self.proxy && !self.tunnel) { + self.port = self.proxy.port + self.host = self.proxy.hostname + } else { + self.port = self.uri.port + self.host = self.uri.hostname + } + + if (options.form) { + self.form(options.form) + } + + if (options.formData) { + var formData = options.formData + var requestForm = self.form() + var appendFormValue = function (key, value) { + if (value && value.hasOwnProperty('value') && value.hasOwnProperty('options')) { + requestForm.append(key, value.value, value.options) + } else { + requestForm.append(key, value) + } + } + for (var formKey in formData) { + if (formData.hasOwnProperty(formKey)) { + var formValue = formData[formKey] + if (formValue instanceof Array) { + for (var j = 0; j < formValue.length; j++) { + appendFormValue(formKey, formValue[j]) + } + } else { + appendFormValue(formKey, formValue) + } + } + } + } + + if (options.qs) { + self.qs(options.qs) + } + + if (self.uri.path) { + self.path = self.uri.path + } else { + self.path = self.uri.pathname + (self.uri.search || '') + } + + if (self.path.length === 0) { + self.path = '/' + } + + // Auth must happen last in case signing is dependent on other headers + if (options.aws) { + self.aws(options.aws) + } + + if (options.hawk) { + self.hawk(options.hawk) + } + + if (options.httpSignature) { + self.httpSignature(options.httpSignature) + } + + if (options.auth) { + if (Object.prototype.hasOwnProperty.call(options.auth, 'username')) { + options.auth.user = options.auth.username + } + if (Object.prototype.hasOwnProperty.call(options.auth, 'password')) { + options.auth.pass = options.auth.password + } + + self.auth( + options.auth.user, + options.auth.pass, + options.auth.sendImmediately, + options.auth.bearer + ) + } + + if (self.gzip && !self.hasHeader('accept-encoding')) { + self.setHeader('accept-encoding', 'gzip, deflate') + } + + if (self.uri.auth && !self.hasHeader('authorization')) { + var uriAuthPieces = self.uri.auth.split(':').map(function (item) { return self._qs.unescape(item) }) + self.auth(uriAuthPieces[0], uriAuthPieces.slice(1).join(':'), true) + } + + if (!self.tunnel && self.proxy && self.proxy.auth && !self.hasHeader('proxy-authorization')) { + var proxyAuthPieces = self.proxy.auth.split(':').map(function (item) { return self._qs.unescape(item) }) + var authHeader = 'Basic ' + toBase64(proxyAuthPieces.join(':')) + self.setHeader('proxy-authorization', authHeader) + } + + if (self.proxy && !self.tunnel) { + self.path = (self.uri.protocol + '//' + self.uri.host + self.path) + } + + if (options.json) { + self.json(options.json) + } + if (options.multipart) { + self.multipart(options.multipart) + } + + if (options.time) { + self.timing = true + + // NOTE: elapsedTime is deprecated in favor of .timings + self.elapsedTime = self.elapsedTime || 0 + } + + function setContentLength () { + if (isTypedArray(self.body)) { + self.body = Buffer.from(self.body) + } + + if (!self.hasHeader('content-length')) { + var length + if (typeof self.body === 'string') { + length = Buffer.byteLength(self.body) + } else if (Array.isArray(self.body)) { + length = self.body.reduce(function (a, b) { return a + b.length }, 0) + } else { + length = self.body.length + } + + if (length) { + self.setHeader('content-length', length) + } else { + self.emit('error', new Error('Argument error, options.body.')) + } + } + } + if (self.body && !isstream(self.body)) { + setContentLength() + } + + if (options.oauth) { + self.oauth(options.oauth) + } else if (self._oauth.params && self.hasHeader('authorization')) { + self.oauth(self._oauth.params) + } + + var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol + var defaultModules = {'http:': http, 'https:': https} + var httpModules = self.httpModules || {} + + self.httpModule = httpModules[protocol] || defaultModules[protocol] + + if (!self.httpModule) { + return self.emit('error', new Error('Invalid protocol: ' + protocol)) + } + + if (options.ca) { + self.ca = options.ca + } + + if (!self.agent) { + if (options.agentOptions) { + self.agentOptions = options.agentOptions + } + + if (options.agentClass) { + self.agentClass = options.agentClass + } else if (options.forever) { + var v = version() + // use ForeverAgent in node 0.10- only + if (v.major === 0 && v.minor <= 10) { + self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL + } else { + self.agentClass = self.httpModule.Agent + self.agentOptions = self.agentOptions || {} + self.agentOptions.keepAlive = true + } + } else { + self.agentClass = self.httpModule.Agent + } + } + + if (self.pool === false) { + self.agent = false + } else { + self.agent = self.agent || self.getNewAgent() + } + + self.on('pipe', function (src) { + if (self.ntick && self._started) { + self.emit('error', new Error('You cannot pipe to this stream after the outbound request has started.')) + } + self.src = src + if (isReadStream(src)) { + if (!self.hasHeader('content-type')) { + self.setHeader('content-type', mime.lookup(src.path)) + } + } else { + if (src.headers) { + for (var i in src.headers) { + if (!self.hasHeader(i)) { + self.setHeader(i, src.headers[i]) + } + } + } + if (self._json && !self.hasHeader('content-type')) { + self.setHeader('content-type', 'application/json') + } + if (src.method && !self.explicitMethod) { + self.method = src.method + } + } + + // self.on('pipe', function () { + // console.error('You have already piped to this stream. Pipeing twice is likely to break the request.') + // }) + }) + + defer(function () { + if (self._aborted) { + return + } + + var end = function () { + if (self._form) { + if (!self._auth.hasAuth) { + self._form.pipe(self) + } else if (self._auth.hasAuth && self._auth.sentAuth) { + self._form.pipe(self) + } + } + if (self._multipart && self._multipart.chunked) { + self._multipart.body.pipe(self) + } + if (self.body) { + if (isstream(self.body)) { + self.body.pipe(self) + } else { + setContentLength() + if (Array.isArray(self.body)) { + self.body.forEach(function (part) { + self.write(part) + }) + } else { + self.write(self.body) + } + self.end() + } + } else if (self.requestBodyStream) { + console.warn('options.requestBodyStream is deprecated, please pass the request object to stream.pipe.') + self.requestBodyStream.pipe(self) + } else if (!self.src) { + if (self._auth.hasAuth && !self._auth.sentAuth) { + self.end() + return + } + if (self.method !== 'GET' && typeof self.method !== 'undefined') { + self.setHeader('content-length', 0) + } + self.end() + } + } + + if (self._form && !self.hasHeader('content-length')) { + // Before ending the request, we had to compute the length of the whole form, asyncly + self.setHeader(self._form.getHeaders(), true) + self._form.getLength(function (err, length) { + if (!err && !isNaN(length)) { + self.setHeader('content-length', length) + } + end() + }) + } else { + end() + } + + self.ntick = true + }) +} + +Request.prototype.getNewAgent = function () { + var self = this + var Agent = self.agentClass + var options = {} + if (self.agentOptions) { + for (var i in self.agentOptions) { + options[i] = self.agentOptions[i] + } + } + if (self.ca) { + options.ca = self.ca + } + if (self.ciphers) { + options.ciphers = self.ciphers + } + if (self.secureProtocol) { + options.secureProtocol = self.secureProtocol + } + if (self.secureOptions) { + options.secureOptions = self.secureOptions + } + if (typeof self.rejectUnauthorized !== 'undefined') { + options.rejectUnauthorized = self.rejectUnauthorized + } + + if (self.cert && self.key) { + options.key = self.key + options.cert = self.cert + } + + if (self.pfx) { + options.pfx = self.pfx + } + + if (self.passphrase) { + options.passphrase = self.passphrase + } + + var poolKey = '' + + // different types of agents are in different pools + if (Agent !== self.httpModule.Agent) { + poolKey += Agent.name + } + + // ca option is only relevant if proxy or destination are https + var proxy = self.proxy + if (typeof proxy === 'string') { + proxy = url.parse(proxy) + } + var isHttps = (proxy && proxy.protocol === 'https:') || this.uri.protocol === 'https:' + + if (isHttps) { + if (options.ca) { + if (poolKey) { + poolKey += ':' + } + poolKey += options.ca + } + + if (typeof options.rejectUnauthorized !== 'undefined') { + if (poolKey) { + poolKey += ':' + } + poolKey += options.rejectUnauthorized + } + + if (options.cert) { + if (poolKey) { + poolKey += ':' + } + poolKey += options.cert.toString('ascii') + options.key.toString('ascii') + } + + if (options.pfx) { + if (poolKey) { + poolKey += ':' + } + poolKey += options.pfx.toString('ascii') + } + + if (options.ciphers) { + if (poolKey) { + poolKey += ':' + } + poolKey += options.ciphers + } + + if (options.secureProtocol) { + if (poolKey) { + poolKey += ':' + } + poolKey += options.secureProtocol + } + + if (options.secureOptions) { + if (poolKey) { + poolKey += ':' + } + poolKey += options.secureOptions + } + } + + if (self.pool === globalPool && !poolKey && Object.keys(options).length === 0 && self.httpModule.globalAgent) { + // not doing anything special. Use the globalAgent + return self.httpModule.globalAgent + } + + // we're using a stored agent. Make sure it's protocol-specific + poolKey = self.uri.protocol + poolKey + + // generate a new agent for this setting if none yet exists + if (!self.pool[poolKey]) { + self.pool[poolKey] = new Agent(options) + // properly set maxSockets on new agents + if (self.pool.maxSockets) { + self.pool[poolKey].maxSockets = self.pool.maxSockets + } + } + + return self.pool[poolKey] +} + +Request.prototype.start = function () { + // start() is called once we are ready to send the outgoing HTTP request. + // this is usually called on the first write(), end() or on nextTick() + var self = this + + if (self.timing) { + // All timings will be relative to this request's startTime. In order to do this, + // we need to capture the wall-clock start time (via Date), immediately followed + // by the high-resolution timer (via now()). While these two won't be set + // at the _exact_ same time, they should be close enough to be able to calculate + // high-resolution, monotonically non-decreasing timestamps relative to startTime. + var startTime = new Date().getTime() + var startTimeNow = now() + } + + if (self._aborted) { + return + } + + self._started = true + self.method = self.method || 'GET' + self.href = self.uri.href + + if (self.src && self.src.stat && self.src.stat.size && !self.hasHeader('content-length')) { + self.setHeader('content-length', self.src.stat.size) + } + if (self._aws) { + self.aws(self._aws, true) + } + + // We have a method named auth, which is completely different from the http.request + // auth option. If we don't remove it, we're gonna have a bad time. + var reqOptions = copy(self) + delete reqOptions.auth + + debug('make request', self.uri.href) + + // node v6.8.0 now supports a `timeout` value in `http.request()`, but we + // should delete it for now since we handle timeouts manually for better + // consistency with node versions before v6.8.0 + delete reqOptions.timeout + + try { + self.req = self.httpModule.request(reqOptions) + } catch (err) { + self.emit('error', err) + return + } + + if (self.timing) { + self.startTime = startTime + self.startTimeNow = startTimeNow + + // Timing values will all be relative to startTime (by comparing to startTimeNow + // so we have an accurate clock) + self.timings = {} + } + + var timeout + if (self.timeout && !self.timeoutTimer) { + if (self.timeout < 0) { + timeout = 0 + } else if (typeof self.timeout === 'number' && isFinite(self.timeout)) { + timeout = self.timeout + } + } + + self.req.on('response', self.onRequestResponse.bind(self)) + self.req.on('error', self.onRequestError.bind(self)) + self.req.on('drain', function () { + self.emit('drain') + }) + + self.req.on('socket', function (socket) { + // `._connecting` was the old property which was made public in node v6.1.0 + var isConnecting = socket._connecting || socket.connecting + if (self.timing) { + self.timings.socket = now() - self.startTimeNow + + if (isConnecting) { + var onLookupTiming = function () { + self.timings.lookup = now() - self.startTimeNow + } + + var onConnectTiming = function () { + self.timings.connect = now() - self.startTimeNow + } + + socket.once('lookup', onLookupTiming) + socket.once('connect', onConnectTiming) + + // clean up timing event listeners if needed on error + self.req.once('error', function () { + socket.removeListener('lookup', onLookupTiming) + socket.removeListener('connect', onConnectTiming) + }) + } + } + + var setReqTimeout = function () { + // This timeout sets the amount of time to wait *between* bytes sent + // from the server once connected. + // + // In particular, it's useful for erroring if the server fails to send + // data halfway through streaming a response. + self.req.setTimeout(timeout, function () { + if (self.req) { + self.abort() + var e = new Error('ESOCKETTIMEDOUT') + e.code = 'ESOCKETTIMEDOUT' + e.connect = false + self.emit('error', e) + } + }) + } + if (timeout !== undefined) { + // Only start the connection timer if we're actually connecting a new + // socket, otherwise if we're already connected (because this is a + // keep-alive connection) do not bother. This is important since we won't + // get a 'connect' event for an already connected socket. + if (isConnecting) { + var onReqSockConnect = function () { + socket.removeListener('connect', onReqSockConnect) + clearTimeout(self.timeoutTimer) + self.timeoutTimer = null + setReqTimeout() + } + + socket.on('connect', onReqSockConnect) + + self.req.on('error', function (err) { // eslint-disable-line handle-callback-err + socket.removeListener('connect', onReqSockConnect) + }) + + // Set a timeout in memory - this block will throw if the server takes more + // than `timeout` to write the HTTP status and headers (corresponding to + // the on('response') event on the client). NB: this measures wall-clock + // time, not the time between bytes sent by the server. + self.timeoutTimer = setTimeout(function () { + socket.removeListener('connect', onReqSockConnect) + self.abort() + var e = new Error('ETIMEDOUT') + e.code = 'ETIMEDOUT' + e.connect = true + self.emit('error', e) + }, timeout) + } else { + // We're already connected + setReqTimeout() + } + } + self.emit('socket', socket) + }) + + self.emit('request', self.req) +} + +Request.prototype.onRequestError = function (error) { + var self = this + if (self._aborted) { + return + } + if (self.req && self.req._reusedSocket && error.code === 'ECONNRESET' && + self.agent.addRequestNoreuse) { + self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } + self.start() + self.req.end() + return + } + if (self.timeout && self.timeoutTimer) { + clearTimeout(self.timeoutTimer) + self.timeoutTimer = null + } + self.emit('error', error) +} + +Request.prototype.onRequestResponse = function (response) { + var self = this + + if (self.timing) { + self.timings.response = now() - self.startTimeNow + } + + debug('onRequestResponse', self.uri.href, response.statusCode, response.headers) + response.on('end', function () { + if (self.timing) { + self.timings.end = now() - self.startTimeNow + response.timingStart = self.startTime + + // fill in the blanks for any periods that didn't trigger, such as + // no lookup or connect due to keep alive + if (!self.timings.socket) { + self.timings.socket = 0 + } + if (!self.timings.lookup) { + self.timings.lookup = self.timings.socket + } + if (!self.timings.connect) { + self.timings.connect = self.timings.lookup + } + if (!self.timings.response) { + self.timings.response = self.timings.connect + } + + debug('elapsed time', self.timings.end) + + // elapsedTime includes all redirects + self.elapsedTime += Math.round(self.timings.end) + + // NOTE: elapsedTime is deprecated in favor of .timings + response.elapsedTime = self.elapsedTime + + // timings is just for the final fetch + response.timings = self.timings + + // pre-calculate phase timings as well + response.timingPhases = { + wait: self.timings.socket, + dns: self.timings.lookup - self.timings.socket, + tcp: self.timings.connect - self.timings.lookup, + firstByte: self.timings.response - self.timings.connect, + download: self.timings.end - self.timings.response, + total: self.timings.end + } + } + debug('response end', self.uri.href, response.statusCode, response.headers) + }) + + if (self._aborted) { + debug('aborted', self.uri.href) + response.resume() + return + } + + self.response = response + response.request = self + response.toJSON = responseToJSON + + // XXX This is different on 0.10, because SSL is strict by default + if (self.httpModule === https && + self.strictSSL && (!response.hasOwnProperty('socket') || + !response.socket.authorized)) { + debug('strict ssl error', self.uri.href) + var sslErr = response.hasOwnProperty('socket') ? response.socket.authorizationError : self.uri.href + ' does not support SSL' + self.emit('error', new Error('SSL Error: ' + sslErr)) + return + } + + // Save the original host before any redirect (if it changes, we need to + // remove any authorization headers). Also remember the case of the header + // name because lots of broken servers expect Host instead of host and we + // want the caller to be able to specify this. + self.originalHost = self.getHeader('host') + if (!self.originalHostHeaderName) { + self.originalHostHeaderName = self.hasHeader('host') + } + if (self.setHost) { + self.removeHeader('host') + } + if (self.timeout && self.timeoutTimer) { + clearTimeout(self.timeoutTimer) + self.timeoutTimer = null + } + + var targetCookieJar = (self._jar && self._jar.setCookie) ? self._jar : globalCookieJar + var addCookie = function (cookie) { + // set the cookie if it's domain in the href's domain. + try { + targetCookieJar.setCookie(cookie, self.uri.href, {ignoreError: true}) + } catch (e) { + self.emit('error', e) + } + } + + response.caseless = caseless(response.headers) + + if (response.caseless.has('set-cookie') && (!self._disableCookies)) { + var headerName = response.caseless.has('set-cookie') + if (Array.isArray(response.headers[headerName])) { + response.headers[headerName].forEach(addCookie) + } else { + addCookie(response.headers[headerName]) + } + } + + if (self._redirect.onResponse(response)) { + return // Ignore the rest of the response + } else { + // Be a good stream and emit end when the response is finished. + // Hack to emit end on close because of a core bug that never fires end + response.on('close', function () { + if (!self._ended) { + self.response.emit('end') + } + }) + + response.once('end', function () { + self._ended = true + }) + + var noBody = function (code) { + return ( + self.method === 'HEAD' || + // Informational + (code >= 100 && code < 200) || + // No Content + code === 204 || + // Not Modified + code === 304 + ) + } + + var responseContent + if (self.gzip && !noBody(response.statusCode)) { + var contentEncoding = response.headers['content-encoding'] || 'identity' + contentEncoding = contentEncoding.trim().toLowerCase() + + // Be more lenient with decoding compressed responses, since (very rarely) + // servers send slightly invalid gzip responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + var zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + } + + if (contentEncoding === 'gzip') { + responseContent = zlib.createGunzip(zlibOptions) + response.pipe(responseContent) + } else if (contentEncoding === 'deflate') { + responseContent = zlib.createInflate(zlibOptions) + response.pipe(responseContent) + } else { + // Since previous versions didn't check for Content-Encoding header, + // ignore any invalid values to preserve backwards-compatibility + if (contentEncoding !== 'identity') { + debug('ignoring unrecognized Content-Encoding ' + contentEncoding) + } + responseContent = response + } + } else { + responseContent = response + } + + if (self.encoding) { + if (self.dests.length !== 0) { + console.error('Ignoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.') + } else if (responseContent.setEncoding) { + responseContent.setEncoding(self.encoding) + } else { + // Should only occur on node pre-v0.9.4 (joyent/node@9b5abe5) with + // zlib streams. + // If/When support for 0.9.4 is dropped, this should be unnecessary. + responseContent = responseContent.pipe(stringstream(self.encoding)) + } + } + + if (self._paused) { + responseContent.pause() + } + + self.responseContent = responseContent + + self.emit('response', response) + + self.dests.forEach(function (dest) { + self.pipeDest(dest) + }) + + responseContent.on('data', function (chunk) { + if (self.timing && !self.responseStarted) { + self.responseStartTime = (new Date()).getTime() + + // NOTE: responseStartTime is deprecated in favor of .timings + response.responseStartTime = self.responseStartTime + } + self._destdata = true + self.emit('data', chunk) + }) + responseContent.once('end', function (chunk) { + self.emit('end', chunk) + }) + responseContent.on('error', function (error) { + self.emit('error', error) + }) + responseContent.on('close', function () { self.emit('close') }) + + if (self.callback) { + self.readResponseBody(response) + } else { // if no callback + self.on('end', function () { + if (self._aborted) { + debug('aborted', self.uri.href) + return + } + self.emit('complete', response) + }) + } + } + debug('finish init function', self.uri.href) +} + +Request.prototype.readResponseBody = function (response) { + var self = this + debug("reading response's body") + var buffers = [] + var bufferLength = 0 + var strings = [] + + self.on('data', function (chunk) { + if (!Buffer.isBuffer(chunk)) { + strings.push(chunk) + } else if (chunk.length) { + bufferLength += chunk.length + buffers.push(chunk) + } + }) + self.on('end', function () { + debug('end event', self.uri.href) + if (self._aborted) { + debug('aborted', self.uri.href) + // `buffer` is defined in the parent scope and used in a closure it exists for the life of the request. + // This can lead to leaky behavior if the user retains a reference to the request object. + buffers = [] + bufferLength = 0 + return + } + + if (bufferLength) { + debug('has body', self.uri.href, bufferLength) + response.body = Buffer.concat(buffers, bufferLength) + if (self.encoding !== null) { + response.body = response.body.toString(self.encoding) + } + // `buffer` is defined in the parent scope and used in a closure it exists for the life of the Request. + // This can lead to leaky behavior if the user retains a reference to the request object. + buffers = [] + bufferLength = 0 + } else if (strings.length) { + // The UTF8 BOM [0xEF,0xBB,0xBF] is converted to [0xFE,0xFF] in the JS UTC16/UCS2 representation. + // Strip this value out when the encoding is set to 'utf8', as upstream consumers won't expect it and it breaks JSON.parse(). + if (self.encoding === 'utf8' && strings[0].length > 0 && strings[0][0] === '\uFEFF') { + strings[0] = strings[0].substring(1) + } + response.body = strings.join('') + } + + if (self._json) { + try { + response.body = JSON.parse(response.body, self._jsonReviver) + } catch (e) { + debug('invalid JSON received', self.uri.href) + } + } + debug('emitting complete', self.uri.href) + if (typeof response.body === 'undefined' && !self._json) { + response.body = self.encoding === null ? Buffer.alloc(0) : '' + } + self.emit('complete', response, response.body) + }) +} + +Request.prototype.abort = function () { + var self = this + self._aborted = true + + if (self.req) { + self.req.abort() + } else if (self.response) { + self.response.destroy() + } + + self.emit('abort') +} + +Request.prototype.pipeDest = function (dest) { + var self = this + var response = self.response + // Called after the response is received + if (dest.headers && !dest.headersSent) { + if (response.caseless.has('content-type')) { + var ctname = response.caseless.has('content-type') + if (dest.setHeader) { + dest.setHeader(ctname, response.headers[ctname]) + } else { + dest.headers[ctname] = response.headers[ctname] + } + } + + if (response.caseless.has('content-length')) { + var clname = response.caseless.has('content-length') + if (dest.setHeader) { + dest.setHeader(clname, response.headers[clname]) + } else { + dest.headers[clname] = response.headers[clname] + } + } + } + if (dest.setHeader && !dest.headersSent) { + for (var i in response.headers) { + // If the response content is being decoded, the Content-Encoding header + // of the response doesn't represent the piped content, so don't pass it. + if (!self.gzip || i !== 'content-encoding') { + dest.setHeader(i, response.headers[i]) + } + } + dest.statusCode = response.statusCode + } + if (self.pipefilter) { + self.pipefilter(response, dest) + } +} + +Request.prototype.qs = function (q, clobber) { + var self = this + var base + if (!clobber && self.uri.query) { + base = self._qs.parse(self.uri.query) + } else { + base = {} + } + + for (var i in q) { + base[i] = q[i] + } + + var qs = self._qs.stringify(base) + + if (qs === '') { + return self + } + + self.uri = url.parse(self.uri.href.split('?')[0] + '?' + qs) + self.url = self.uri + self.path = self.uri.path + + if (self.uri.host === 'unix') { + self.enableUnixSocket() + } + + return self +} +Request.prototype.form = function (form) { + var self = this + if (form) { + if (!/^application\/x-www-form-urlencoded\b/.test(self.getHeader('content-type'))) { + self.setHeader('content-type', 'application/x-www-form-urlencoded') + } + self.body = (typeof form === 'string') + ? self._qs.rfc3986(form.toString('utf8')) + : self._qs.stringify(form).toString('utf8') + return self + } + // create form-data object + self._form = new FormData() + self._form.on('error', function (err) { + err.message = 'form-data: ' + err.message + self.emit('error', err) + self.abort() + }) + return self._form +} +Request.prototype.multipart = function (multipart) { + var self = this + + self._multipart.onRequest(multipart) + + if (!self._multipart.chunked) { + self.body = self._multipart.body + } + + return self +} +Request.prototype.json = function (val) { + var self = this + + if (!self.hasHeader('accept')) { + self.setHeader('accept', 'application/json') + } + + if (typeof self.jsonReplacer === 'function') { + self._jsonReplacer = self.jsonReplacer + } + + self._json = true + if (typeof val === 'boolean') { + if (self.body !== undefined) { + if (!/^application\/x-www-form-urlencoded\b/.test(self.getHeader('content-type'))) { + self.body = safeStringify(self.body, self._jsonReplacer) + } else { + self.body = self._qs.rfc3986(self.body) + } + if (!self.hasHeader('content-type')) { + self.setHeader('content-type', 'application/json') + } + } + } else { + self.body = safeStringify(val, self._jsonReplacer) + if (!self.hasHeader('content-type')) { + self.setHeader('content-type', 'application/json') + } + } + + if (typeof self.jsonReviver === 'function') { + self._jsonReviver = self.jsonReviver + } + + return self +} +Request.prototype.getHeader = function (name, headers) { + var self = this + var result, re, match + if (!headers) { + headers = self.headers + } + Object.keys(headers).forEach(function (key) { + if (key.length !== name.length) { + return + } + re = new RegExp(name, 'i') + match = key.match(re) + if (match) { + result = headers[key] + } + }) + return result +} +Request.prototype.enableUnixSocket = function () { + // Get the socket & request paths from the URL + var unixParts = this.uri.path.split(':') + var host = unixParts[0] + var path = unixParts[1] + // Apply unix properties to request + this.socketPath = host + this.uri.pathname = path + this.uri.path = path + this.uri.host = host + this.uri.hostname = host + this.uri.isUnix = true +} + +Request.prototype.auth = function (user, pass, sendImmediately, bearer) { + var self = this + + self._auth.onRequest(user, pass, sendImmediately, bearer) + + return self +} +Request.prototype.aws = function (opts, now) { + var self = this + + if (!now) { + self._aws = opts + return self + } + + if (opts.sign_version === 4 || opts.sign_version === '4') { + // use aws4 + var options = { + host: self.uri.host, + path: self.uri.path, + method: self.method, + headers: { + 'content-type': self.getHeader('content-type') || '' + }, + body: self.body + } + var signRes = aws4.sign(options, { + accessKeyId: opts.key, + secretAccessKey: opts.secret, + sessionToken: opts.session + }) + self.setHeader('authorization', signRes.headers.Authorization) + self.setHeader('x-amz-date', signRes.headers['X-Amz-Date']) + if (signRes.headers['X-Amz-Security-Token']) { + self.setHeader('x-amz-security-token', signRes.headers['X-Amz-Security-Token']) + } + } else { + // default: use aws-sign2 + var date = new Date() + self.setHeader('date', date.toUTCString()) + var auth = { + key: opts.key, + secret: opts.secret, + verb: self.method.toUpperCase(), + date: date, + contentType: self.getHeader('content-type') || '', + md5: self.getHeader('content-md5') || '', + amazonHeaders: aws2.canonicalizeHeaders(self.headers) + } + var path = self.uri.path + if (opts.bucket && path) { + auth.resource = '/' + opts.bucket + path + } else if (opts.bucket && !path) { + auth.resource = '/' + opts.bucket + } else if (!opts.bucket && path) { + auth.resource = path + } else if (!opts.bucket && !path) { + auth.resource = '/' + } + auth.resource = aws2.canonicalizeResource(auth.resource) + self.setHeader('authorization', aws2.authorization(auth)) + } + + return self +} +Request.prototype.httpSignature = function (opts) { + var self = this + httpSignature.signRequest({ + getHeader: function (header) { + return self.getHeader(header, self.headers) + }, + setHeader: function (header, value) { + self.setHeader(header, value) + }, + method: self.method, + path: self.path + }, opts) + debug('httpSignature authorization', self.getHeader('authorization')) + + return self +} +Request.prototype.hawk = function (opts) { + var self = this + self.setHeader('Authorization', hawk.client.header(self.uri, self.method, opts).field) +} +Request.prototype.oauth = function (_oauth) { + var self = this + + self._oauth.onRequest(_oauth) + + return self +} + +Request.prototype.jar = function (jar) { + var self = this + var cookies + + if (self._redirect.redirectsFollowed === 0) { + self.originalCookieHeader = self.getHeader('cookie') + } + + if (!jar) { + // disable cookies + cookies = false + self._disableCookies = true + } else { + var targetCookieJar = (jar && jar.getCookieString) ? jar : globalCookieJar + var urihref = self.uri.href + // fetch cookie in the Specified host + if (targetCookieJar) { + cookies = targetCookieJar.getCookieString(urihref) + } + } + + // if need cookie and cookie is not empty + if (cookies && cookies.length) { + if (self.originalCookieHeader) { + // Don't overwrite existing Cookie header + self.setHeader('cookie', self.originalCookieHeader + '; ' + cookies) + } else { + self.setHeader('cookie', cookies) + } + } + self._jar = jar + return self +} + +// Stream API +Request.prototype.pipe = function (dest, opts) { + var self = this + + if (self.response) { + if (self._destdata) { + self.emit('error', new Error('You cannot pipe after data has been emitted from the response.')) + } else if (self._ended) { + self.emit('error', new Error('You cannot pipe after the response has been ended.')) + } else { + stream.Stream.prototype.pipe.call(self, dest, opts) + self.pipeDest(dest) + return dest + } + } else { + self.dests.push(dest) + stream.Stream.prototype.pipe.call(self, dest, opts) + return dest + } +} +Request.prototype.write = function () { + var self = this + if (self._aborted) { return } + + if (!self._started) { + self.start() + } + if (self.req) { + return self.req.write.apply(self.req, arguments) + } +} +Request.prototype.end = function (chunk) { + var self = this + if (self._aborted) { return } + + if (chunk) { + self.write(chunk) + } + if (!self._started) { + self.start() + } + if (self.req) { + self.req.end() + } +} +Request.prototype.pause = function () { + var self = this + if (!self.responseContent) { + self._paused = true + } else { + self.responseContent.pause.apply(self.responseContent, arguments) + } +} +Request.prototype.resume = function () { + var self = this + if (!self.responseContent) { + self._paused = false + } else { + self.responseContent.resume.apply(self.responseContent, arguments) + } +} +Request.prototype.destroy = function () { + var self = this + if (!self._ended) { + self.end() + } else if (self.response) { + self.response.destroy() + } +} + +Request.defaultProxyHeaderWhiteList = + Tunnel.defaultProxyHeaderWhiteList.slice() + +Request.defaultProxyHeaderExclusiveList = + Tunnel.defaultProxyHeaderExclusiveList.slice() + +// Exports + +Request.prototype.toJSON = requestToJSON +module.exports = Request diff --git a/appasar/canary/node_modules/rimraf/LICENSE b/appasar/canary/node_modules/rimraf/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/appasar/canary/node_modules/rimraf/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/rimraf/README.md b/appasar/canary/node_modules/rimraf/README.md new file mode 100644 index 0000000..423b8cf --- /dev/null +++ b/appasar/canary/node_modules/rimraf/README.md @@ -0,0 +1,101 @@ +[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies) + +The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. + +Install with `npm install rimraf`, or just drop rimraf.js somewhere. + +## API + +`rimraf(f, [opts], callback)` + +The first parameter will be interpreted as a globbing pattern for files. If you +want to disable globbing you can do so with `opts.disableGlob` (defaults to +`false`). This might be handy, for instance, if you have filenames that contain +globbing wildcard characters. + +The callback will be called with an error if there is one. Certain +errors are handled for you: + +* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of + `opts.maxBusyTries` times before giving up, adding 100ms of wait + between each attempt. The default `maxBusyTries` is 3. +* `ENOENT` - If the file doesn't exist, rimraf will return + successfully, since your desired outcome is already the case. +* `EMFILE` - Since `readdir` requires opening a file descriptor, it's + possible to hit `EMFILE` if too many file descriptors are in use. + In the sync case, there's nothing to be done for this. But in the + async case, rimraf will gradually back off with timeouts up to + `opts.emfileWait` ms, which defaults to 1000. + +## options + +* unlink, chmod, stat, lstat, rmdir, readdir, + unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync + + In order to use a custom file system library, you can override + specific fs functions on the options object. + + If any of these functions are present on the options object, then + the supplied function will be used instead of the default fs + method. + + Sync methods are only relevant for `rimraf.sync()`, of course. + + For example: + + ```javascript + var myCustomFS = require('some-custom-fs') + + rimraf('some-thing', myCustomFS, callback) + ``` + +* maxBusyTries + + If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered + on Windows systems, then rimraf will retry with a linear backoff + wait of 100ms longer on each try. The default maxBusyTries is 3. + + Only relevant for async usage. + +* emfileWait + + If an `EMFILE` error is encountered, then rimraf will retry + repeatedly with a linear backoff of 1ms longer on each try, until + the timeout counter hits this max. The default limit is 1000. + + If you repeatedly encounter `EMFILE` errors, then consider using + [graceful-fs](http://npm.im/graceful-fs) in your program. + + Only relevant for async usage. + +* glob + + Set to `false` to disable [glob](http://npm.im/glob) pattern + matching. + + Set to an object to pass options to the glob module. The default + glob options are `{ nosort: true, silent: true }`. + + Glob version 6 is used in this module. + + Relevant for both sync and async usage. + +* disableGlob + + Set to any non-falsey value to disable globbing entirely. + (Equivalent to setting `glob: false`.) + +## rimraf.sync + +It can remove stuff synchronously, too. But that's not so good. Use +the async API. It's better. + +## CLI + +If installed with `npm install rimraf -g` it can be used as a global +command `rimraf [ ...]` which is useful for cross platform support. + +## mkdirp + +If you need to create a directory recursively, check out +[mkdirp](https://github.com/substack/node-mkdirp). diff --git a/appasar/canary/node_modules/rimraf/bin.js b/appasar/canary/node_modules/rimraf/bin.js new file mode 100644 index 0000000..0d1e17b --- /dev/null +++ b/appasar/canary/node_modules/rimraf/bin.js @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +var rimraf = require('./') + +var help = false +var dashdash = false +var noglob = false +var args = process.argv.slice(2).filter(function(arg) { + if (dashdash) + return !!arg + else if (arg === '--') + dashdash = true + else if (arg === '--no-glob' || arg === '-G') + noglob = true + else if (arg === '--glob' || arg === '-g') + noglob = false + else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) + help = true + else + return !!arg +}) + +if (help || args.length === 0) { + // If they didn't ask for help, then this is not a "success" + var log = help ? console.log : console.error + log('Usage: rimraf [ ...]') + log('') + log(' Deletes all files and folders at "path" recursively.') + log('') + log('Options:') + log('') + log(' -h, --help Display this usage info') + log(' -G, --no-glob Do not expand glob patterns in arguments') + log(' -g, --glob Expand glob patterns in arguments (default)') + process.exit(help ? 0 : 1) +} else + go(0) + +function go (n) { + if (n >= args.length) + return + var options = {} + if (noglob) + options = { glob: false } + rimraf(args[n], options, function (er) { + if (er) + throw er + go(n+1) + }) +} diff --git a/appasar/canary/node_modules/rimraf/package.json b/appasar/canary/node_modules/rimraf/package.json new file mode 100644 index 0000000..28aed65 --- /dev/null +++ b/appasar/canary/node_modules/rimraf/package.json @@ -0,0 +1,26 @@ +{ + "name": "rimraf", + "version": "2.6.2", + "main": "rimraf.js", + "description": "A deep deletion module for node (like `rm -rf`)", + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": "git://github.com/isaacs/rimraf.git", + "scripts": { + "test": "tap test/*.js" + }, + "bin": "./bin.js", + "dependencies": { + "glob": "^7.0.5" + }, + "files": [ + "LICENSE", + "README.md", + "bin.js", + "rimraf.js" + ], + "devDependencies": { + "mkdirp": "^0.5.1", + "tap": "^10.1.2" + } +} diff --git a/appasar/canary/node_modules/rimraf/rimraf.js b/appasar/canary/node_modules/rimraf/rimraf.js new file mode 100644 index 0000000..e80dd10 --- /dev/null +++ b/appasar/canary/node_modules/rimraf/rimraf.js @@ -0,0 +1,364 @@ +module.exports = rimraf +rimraf.sync = rimrafSync + +var assert = require("assert") +var path = require("path") +var fs = require("fs") +var glob = require("glob") +var _0666 = parseInt('666', 8) + +var defaultGlobOpts = { + nosort: true, + silent: true +} + +// for EMFILE handling +var timeout = 0 + +var isWindows = (process.platform === "win32") + +function defaults (options) { + var methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(function(m) { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 + options.emfileWait = options.emfileWait || 1000 + if (options.glob === false) { + options.disableGlob = true + } + options.disableGlob = options.disableGlob || false + options.glob = options.glob || defaultGlobOpts +} + +function rimraf (p, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert.equal(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + var busyTries = 0 + var errState = null + var n = 0 + + if (options.disableGlob || !glob.hasMagic(p)) + return afterGlob(null, [p]) + + options.lstat(p, function (er, stat) { + if (!er) + return afterGlob(null, [p]) + + glob(p, options.glob, afterGlob) + }) + + function next (er) { + errState = errState || er + if (--n === 0) + cb(errState) + } + + function afterGlob (er, results) { + if (er) + return cb(er) + + n = results.length + if (n === 0) + return cb() + + results.forEach(function (p) { + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && + busyTries < options.maxBusyTries) { + busyTries ++ + var time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(function () { + rimraf_(p, options, CB) + }, time) + } + + // this one won't happen if graceful-fs is used. + if (er.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(function () { + rimraf_(p, options, CB) + }, timeout ++) + } + + // already gone + if (er.code === "ENOENT") er = null + } + + timeout = 0 + next(er) + }) + }) + } +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, function (er, st) { + if (er && er.code === "ENOENT") + return cb(null) + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === "EPERM" && isWindows) + fixWinEPERM(p, options, er, cb) + + if (st && st.isDirectory()) + return rmdir(p, options, er, cb) + + options.unlink(p, function (er) { + if (er) { + if (er.code === "ENOENT") + return cb(null) + if (er.code === "EPERM") + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + if (er.code === "EISDIR") + return rmdir(p, options, er, cb) + } + return cb(er) + }) + }) +} + +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) + assert(er instanceof Error) + + options.chmod(p, _0666, function (er2) { + if (er2) + cb(er2.code === "ENOENT" ? null : er) + else + options.stat(p, function(er3, stats) { + if (er3) + cb(er3.code === "ENOENT" ? null : er) + else if (stats.isDirectory()) + rmdir(p, options, er, cb) + else + options.unlink(p, cb) + }) + }) +} + +function fixWinEPERMSync (p, options, er) { + assert(p) + assert(options) + if (er) + assert(er instanceof Error) + + try { + options.chmodSync(p, _0666) + } catch (er2) { + if (er2.code === "ENOENT") + return + else + throw er + } + + try { + var stats = options.statSync(p) + } catch (er3) { + if (er3.code === "ENOENT") + return + else + throw er + } + + if (stats.isDirectory()) + rmdirSync(p, options, er) + else + options.unlinkSync(p) +} + +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) + assert(originalEr instanceof Error) + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, function (er) { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) + rmkids(p, options, cb) + else if (er && er.code === "ENOTDIR") + cb(originalEr) + else + cb(er) + }) +} + +function rmkids(p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, function (er, files) { + if (er) + return cb(er) + var n = files.length + if (n === 0) + return options.rmdir(p, cb) + var errState + files.forEach(function (f) { + rimraf(path.join(p, f), options, function (er) { + if (errState) + return + if (er) + return cb(errState = er) + if (--n === 0) + options.rmdir(p, cb) + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + var results + + if (options.disableGlob || !glob.hasMagic(p)) { + results = [p] + } else { + try { + options.lstatSync(p) + results = [p] + } catch (er) { + results = glob.sync(p, options.glob) + } + } + + if (!results.length) + return + + for (var i = 0; i < results.length; i++) { + var p = results[i] + + try { + var st = options.lstatSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + + // Windows can EPERM on stat. Life is suffering. + if (er.code === "EPERM" && isWindows) + fixWinEPERMSync(p, options, er) + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) + rmdirSync(p, options, null) + else + options.unlinkSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + if (er.code !== "EISDIR") + throw er + + rmdirSync(p, options, er) + } + } +} + +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) + assert(originalEr instanceof Error) + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "ENOTDIR") + throw originalEr + if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") + rmkidsSync(p, options) + } +} + +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(function (f) { + rimrafSync(path.join(p, f), options) + }) + + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + var retries = isWindows ? 100 : 1 + var i = 0 + do { + var threw = true + try { + var ret = options.rmdirSync(p, options) + threw = false + return ret + } finally { + if (++i < retries && threw) + continue + } + } while (true) +} diff --git a/appasar/canary/node_modules/safe-buffer/.travis.yml b/appasar/canary/node_modules/safe-buffer/.travis.yml new file mode 100644 index 0000000..7b20f28 --- /dev/null +++ b/appasar/canary/node_modules/safe-buffer/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - 'node' + - '5' + - '4' + - '0.12' + - '0.10' diff --git a/appasar/canary/node_modules/safe-buffer/LICENSE b/appasar/canary/node_modules/safe-buffer/LICENSE new file mode 100644 index 0000000..0c068ce --- /dev/null +++ b/appasar/canary/node_modules/safe-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/appasar/canary/node_modules/safe-buffer/README.md b/appasar/canary/node_modules/safe-buffer/README.md new file mode 100644 index 0000000..e9a81af --- /dev/null +++ b/appasar/canary/node_modules/safe-buffer/README.md @@ -0,0 +1,584 @@ +# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/safe-buffer +[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg +[npm-url]: https://npmjs.org/package/safe-buffer +[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg +[downloads-url]: https://npmjs.org/package/safe-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### Safer Node.js Buffer API + +**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, +`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** + +**Uses the built-in implementation when available.** + +## install + +``` +npm install safe-buffer +``` + +## usage + +The goal of this package is to provide a safe replacement for the node.js `Buffer`. + +It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to +the top of your node.js modules: + +```js +var Buffer = require('safe-buffer').Buffer + +// Existing buffer code will continue to work without issues: + +new Buffer('hey', 'utf8') +new Buffer([1, 2, 3], 'utf8') +new Buffer(obj) +new Buffer(16) // create an uninitialized buffer (potentially unsafe) + +// But you can use these new explicit APIs to make clear what you want: + +Buffer.from('hey', 'utf8') // convert from many types to a Buffer +Buffer.alloc(16) // create a zero-filled buffer (safe) +Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) +``` + +## api + +### Class Method: Buffer.from(array) + + +* `array` {Array} + +Allocates a new `Buffer` using an `array` of octets. + +```js +const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +A `TypeError` will be thrown if `array` is not an `Array`. + +### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) + + +* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or + a `new ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +When passed a reference to the `.buffer` property of a `TypedArray` instance, +the newly created `Buffer` will share the same allocated memory as the +TypedArray. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: + +// changing the TypedArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: +``` + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const ab = new ArrayBuffer(10); +const buf = Buffer.from(ab, 0, 2); +console.log(buf.length); + // Prints: 2 +``` + +A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. + +### Class Method: Buffer.from(buffer) + + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = Buffer.from('buffer'); +const buf2 = Buffer.from(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +A `TypeError` will be thrown if `buffer` is not a `Buffer`. + +### Class Method: Buffer.from(str[, encoding]) + + +* `str` {String} String to encode. +* `encoding` {String} Encoding to use, Default: `'utf8'` + +Creates a new `Buffer` containing the given JavaScript string `str`. If +provided, the `encoding` parameter identifies the character encoding. +If not provided, `encoding` defaults to `'utf8'`. + +```js +const buf1 = Buffer.from('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +A `TypeError` will be thrown if `str` is not a string. + +### Class Method: Buffer.alloc(size[, fill[, encoding]]) + + +* `size` {Number} +* `fill` {Value} Default: `undefined` +* `encoding` {String} Default: `utf8` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the +`Buffer` will be *zero-filled*. + +```js +const buf = Buffer.alloc(5); +console.log(buf); + // +``` + +The `size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +If `fill` is specified, the allocated `Buffer` will be initialized by calling +`buf.fill(fill)`. See [`buf.fill()`][] for more information. + +```js +const buf = Buffer.alloc(5, 'a'); +console.log(buf); + // +``` + +If both `fill` and `encoding` are specified, the allocated `Buffer` will be +initialized by calling `buf.fill(fill, encoding)`. For example: + +```js +const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); +console.log(buf); + // +``` + +Calling `Buffer.alloc(size)` can be significantly slower than the alternative +`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance +contents will *never contain sensitive data*. + +A `TypeError` will be thrown if `size` is not a number. + +### Class Method: Buffer.allocUnsafe(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must +be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. A zero-length Buffer will be created if a `size` less than or equal to +0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +```js +const buf = Buffer.allocUnsafe(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +A `TypeError` will be thrown if `size` is not a number. + +Note that the `Buffer` module pre-allocates an internal `Buffer` instance of +size `Buffer.poolSize` that is used as a pool for the fast allocation of new +`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated +`new Buffer(size)` constructor) only when `size` is less than or equal to +`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default +value of `Buffer.poolSize` is `8192` but can be modified. + +Use of this pre-allocated internal memory pool is a key difference between +calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. +Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer +pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal +Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The +difference is subtle but can be important when an application requires the +additional performance that `Buffer.allocUnsafe(size)` provides. + +### Class Method: Buffer.allocUnsafeSlow(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The +`size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, +allocations under 4KB are, by default, sliced from a single pre-allocated +`Buffer`. This allows applications to avoid the garbage collection overhead of +creating many individually allocated Buffers. This approach improves both +performance and memory usage by eliminating the need to track and cleanup as +many `Persistent` objects. + +However, in the case where a developer may need to retain a small chunk of +memory from a pool for an indeterminate amount of time, it may be appropriate +to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then +copy out the relevant bits. + +```js +// need to keep around a few small chunks of memory +const store = []; + +socket.on('readable', () => { + const data = socket.read(); + // allocate for retained data + const sb = Buffer.allocUnsafeSlow(10); + // copy the data into the new allocation + data.copy(sb, 0, 0, 10); + store.push(sb); +}); +``` + +Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* +a developer has observed undue memory retention in their applications. + +A `TypeError` will be thrown if `size` is not a number. + +### All the Rest + +The rest of the `Buffer` API is exactly the same as in node.js. +[See the docs](https://nodejs.org/api/buffer.html). + + +## Related links + +- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) +- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) + +## Why is `Buffer` unsafe? + +Today, the node.js `Buffer` constructor is overloaded to handle many different argument +types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), +`ArrayBuffer`, and also `Number`. + +The API is optimized for convenience: you can throw any type at it, and it will try to do +what you want. + +Because the Buffer constructor is so powerful, you often see code like this: + +```js +// Convert UTF-8 strings to hex +function toHex (str) { + return new Buffer(str).toString('hex') +} +``` + +***But what happens if `toHex` is called with a `Number` argument?*** + +### Remote Memory Disclosure + +If an attacker can make your program call the `Buffer` constructor with a `Number` +argument, then they can make it allocate uninitialized memory from the node.js process. +This could potentially disclose TLS private keys, user data, or database passwords. + +When the `Buffer` constructor is passed a `Number` argument, it returns an +**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like +this, you **MUST** overwrite the contents before returning it to the user. + +From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): + +> `new Buffer(size)` +> +> - `size` Number +> +> The underlying memory for `Buffer` instances created in this way is not initialized. +> **The contents of a newly created `Buffer` are unknown and could contain sensitive +> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. + +(Emphasis our own.) + +Whenever the programmer intended to create an uninitialized `Buffer` you often see code +like this: + +```js +var buf = new Buffer(16) + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### Would this ever be a problem in real code? + +Yes. It's surprisingly common to forget to check the type of your variables in a +dynamically-typed language like JavaScript. + +Usually the consequences of assuming the wrong type is that your program crashes with an +uncaught exception. But the failure mode for forgetting to check the type of arguments to +the `Buffer` constructor is more catastrophic. + +Here's an example of a vulnerable service that takes a JSON payload and converts it to +hex: + +```js +// Take a JSON payload {str: "some string"} and convert it to hex +var server = http.createServer(function (req, res) { + var data = '' + req.setEncoding('utf8') + req.on('data', function (chunk) { + data += chunk + }) + req.on('end', function () { + var body = JSON.parse(data) + res.end(new Buffer(body.str).toString('hex')) + }) +}) + +server.listen(8080) +``` + +In this example, an http client just has to send: + +```json +{ + "str": 1000 +} +``` + +and it will get back 1,000 bytes of uninitialized memory from the server. + +This is a very serious bug. It's similar in severity to the +[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process +memory by remote attackers. + + +### Which real-world packages were vulnerable? + +#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) + +[Mathias Buus](https://github.com/mafintosh) and I +([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, +[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow +anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get +them to reveal 20 bytes at a time of uninitialized memory from the node.js process. + +Here's +[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) +that fixed it. We released a new fixed version, created a +[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all +vulnerable versions on npm so users will get a warning to upgrade to a newer version. + +#### [`ws`](https://www.npmjs.com/package/ws) + +That got us wondering if there were other vulnerable packages. Sure enough, within a short +period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the +most popular WebSocket implementation in node.js. + +If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as +expected, then uninitialized server memory would be disclosed to the remote peer. + +These were the vulnerable methods: + +```js +socket.send(number) +socket.ping(number) +socket.pong(number) +``` + +Here's a vulnerable socket server with some echo functionality: + +```js +server.on('connection', function (socket) { + socket.on('message', function (message) { + message = JSON.parse(message) + if (message.type === 'echo') { + socket.send(message.data) // send back the user's message + } + }) +}) +``` + +`socket.send(number)` called on the server, will disclose server memory. + +Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue +was fixed, with a more detailed explanation. Props to +[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the +[Node Security Project disclosure](https://nodesecurity.io/advisories/67). + + +### What's the solution? + +It's important that node.js offers a fast way to get memory otherwise performance-critical +applications would needlessly get a lot slower. + +But we need a better way to *signal our intent* as programmers. **When we want +uninitialized memory, we should request it explicitly.** + +Sensitive functionality should not be packed into a developer-friendly API that loosely +accepts many different types. This type of API encourages the lazy practice of passing +variables in without checking the type very carefully. + +#### A new API: `Buffer.allocUnsafe(number)` + +The functionality of creating buffers with uninitialized memory should be part of another +API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that +frequently gets user input of all sorts of different types passed into it. + +```js +var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### How do we fix node.js core? + +We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as +`semver-major`) which defends against one case: + +```js +var str = 16 +new Buffer(str, 'utf8') +``` + +In this situation, it's implied that the programmer intended the first argument to be a +string, since they passed an encoding as a second argument. Today, node.js will allocate +uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not +what the programmer intended. + +But this is only a partial solution, since if the programmer does `new Buffer(variable)` +(without an `encoding` parameter) there's no way to know what they intended. If `variable` +is sometimes a number, then uninitialized memory will sometimes be returned. + +### What's the real long-term fix? + +We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when +we need uninitialized memory. But that would break 1000s of packages. + +~~We believe the best solution is to:~~ + +~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ + +~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ + +#### Update + +We now support adding three new APIs: + +- `Buffer.from(value)` - convert from any type to a buffer +- `Buffer.alloc(size)` - create a zero-filled buffer +- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size + +This solves the core problem that affected `ws` and `bittorrent-dht` which is +`Buffer(variable)` getting tricked into taking a number argument. + +This way, existing code continues working and the impact on the npm ecosystem will be +minimal. Over time, npm maintainers can migrate performance-critical code to use +`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. + + +### Conclusion + +We think there's a serious design issue with the `Buffer` API as it exists today. It +promotes insecure software by putting high-risk functionality into a convenient API +with friendly "developer ergonomics". + +This wasn't merely a theoretical exercise because we found the issue in some of the +most popular npm packages. + +Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of +`buffer`. + +```js +var Buffer = require('safe-buffer').Buffer +``` + +Eventually, we hope that node.js core can switch to this new, safer behavior. We believe +the impact on the ecosystem would be minimal since it's not a breaking change. +Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while +older, insecure packages would magically become safe from this attack vector. + + +## links + +- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) +- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) +- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) + + +## credit + +The original issues in `bittorrent-dht` +([disclosure](https://nodesecurity.io/advisories/68)) and +`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by +[Mathias Buus](https://github.com/mafintosh) and +[Feross Aboukhadijeh](http://feross.org/). + +Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues +and for his work running the [Node Security Project](https://nodesecurity.io/). + +Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and +auditing the code. + + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/appasar/canary/node_modules/safe-buffer/index.js b/appasar/canary/node_modules/safe-buffer/index.js new file mode 100644 index 0000000..22438da --- /dev/null +++ b/appasar/canary/node_modules/safe-buffer/index.js @@ -0,0 +1,62 @@ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} diff --git a/appasar/canary/node_modules/safe-buffer/package.json b/appasar/canary/node_modules/safe-buffer/package.json new file mode 100644 index 0000000..356d8bf --- /dev/null +++ b/appasar/canary/node_modules/safe-buffer/package.json @@ -0,0 +1,37 @@ +{ + "name": "safe-buffer", + "description": "Safer Node.js Buffer API", + "version": "5.1.1", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "devDependencies": { + "standard": "*", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "homepage": "https://github.com/feross/safe-buffer", + "keywords": [ + "buffer", + "buffer allocate", + "node security", + "safe", + "safe-buffer", + "security", + "uninitialized" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test.js" + } +} diff --git a/appasar/canary/node_modules/safe-buffer/test.js b/appasar/canary/node_modules/safe-buffer/test.js new file mode 100644 index 0000000..4925059 --- /dev/null +++ b/appasar/canary/node_modules/safe-buffer/test.js @@ -0,0 +1,101 @@ +/* eslint-disable node/no-deprecated-api */ + +var test = require('tape') +var SafeBuffer = require('./').Buffer + +test('new SafeBuffer(value) works just like Buffer', function (t) { + t.deepEqual(new SafeBuffer('hey'), new Buffer('hey')) + t.deepEqual(new SafeBuffer('hey', 'utf8'), new Buffer('hey', 'utf8')) + t.deepEqual(new SafeBuffer('686579', 'hex'), new Buffer('686579', 'hex')) + t.deepEqual(new SafeBuffer([1, 2, 3]), new Buffer([1, 2, 3])) + t.deepEqual(new SafeBuffer(new Uint8Array([1, 2, 3])), new Buffer(new Uint8Array([1, 2, 3]))) + + t.equal(typeof SafeBuffer.isBuffer, 'function') + t.equal(SafeBuffer.isBuffer(new SafeBuffer('hey')), true) + t.equal(Buffer.isBuffer(new SafeBuffer('hey')), true) + t.notOk(SafeBuffer.isBuffer({})) + + t.end() +}) + +test('SafeBuffer.from(value) converts to a Buffer', function (t) { + t.deepEqual(SafeBuffer.from('hey'), new Buffer('hey')) + t.deepEqual(SafeBuffer.from('hey', 'utf8'), new Buffer('hey', 'utf8')) + t.deepEqual(SafeBuffer.from('686579', 'hex'), new Buffer('686579', 'hex')) + t.deepEqual(SafeBuffer.from([1, 2, 3]), new Buffer([1, 2, 3])) + t.deepEqual(SafeBuffer.from(new Uint8Array([1, 2, 3])), new Buffer(new Uint8Array([1, 2, 3]))) + + t.end() +}) + +test('SafeBuffer.alloc(number) returns zeroed-out memory', function (t) { + for (var i = 0; i < 10; i++) { + var expected1 = new Buffer(1000) + expected1.fill(0) + t.deepEqual(SafeBuffer.alloc(1000), expected1) + + var expected2 = new Buffer(1000 * 1000) + expected2.fill(0) + t.deepEqual(SafeBuffer.alloc(1000 * 1000), expected2) + } + t.end() +}) + +test('SafeBuffer.allocUnsafe(number)', function (t) { + var buf = SafeBuffer.allocUnsafe(100) // unitialized memory + t.equal(buf.length, 100) + t.equal(SafeBuffer.isBuffer(buf), true) + t.equal(Buffer.isBuffer(buf), true) + t.end() +}) + +test('SafeBuffer.from() throws with number types', function (t) { + t.plan(5) + t.throws(function () { + SafeBuffer.from(0) + }) + t.throws(function () { + SafeBuffer.from(-1) + }) + t.throws(function () { + SafeBuffer.from(NaN) + }) + t.throws(function () { + SafeBuffer.from(Infinity) + }) + t.throws(function () { + SafeBuffer.from(99) + }) +}) + +test('SafeBuffer.allocUnsafe() throws with non-number types', function (t) { + t.plan(4) + t.throws(function () { + SafeBuffer.allocUnsafe('hey') + }) + t.throws(function () { + SafeBuffer.allocUnsafe('hey', 'utf8') + }) + t.throws(function () { + SafeBuffer.allocUnsafe([1, 2, 3]) + }) + t.throws(function () { + SafeBuffer.allocUnsafe({}) + }) +}) + +test('SafeBuffer.alloc() throws with non-number types', function (t) { + t.plan(4) + t.throws(function () { + SafeBuffer.alloc('hey') + }) + t.throws(function () { + SafeBuffer.alloc('hey', 'utf8') + }) + t.throws(function () { + SafeBuffer.alloc([1, 2, 3]) + }) + t.throws(function () { + SafeBuffer.alloc({}) + }) +}) diff --git a/appasar/canary/node_modules/sntp/.npmignore b/appasar/canary/node_modules/sntp/.npmignore new file mode 100644 index 0000000..10c1307 --- /dev/null +++ b/appasar/canary/node_modules/sntp/.npmignore @@ -0,0 +1,3 @@ +* +!lib/** +!.npmignore diff --git a/appasar/canary/node_modules/sntp/LICENSE b/appasar/canary/node_modules/sntp/LICENSE new file mode 100644 index 0000000..6dc3e82 --- /dev/null +++ b/appasar/canary/node_modules/sntp/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2012-2016, Eran Hammer and Project contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * The names of any contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + * * * + +The complete list of contributors can be found at: https://github.com/hueniverse/sntp/graphs/contributors diff --git a/appasar/canary/node_modules/sntp/README.md b/appasar/canary/node_modules/sntp/README.md new file mode 100644 index 0000000..98a6e02 --- /dev/null +++ b/appasar/canary/node_modules/sntp/README.md @@ -0,0 +1,68 @@ +# sntp + +An SNTP v4 client (RFC4330) for node. Simpy connects to the NTP or SNTP server requested and returns the server time +along with the roundtrip duration and clock offset. To adjust the local time to the NTP time, add the returned `t` offset +to the local time. + +[![Build Status](https://secure.travis-ci.org/hueniverse/sntp.png)](http://travis-ci.org/hueniverse/sntp) + +# Usage + +```javascript +var Sntp = require('sntp'); + +// All options are optional + +var options = { + host: 'nist1-sj.ustiming.org', // Defaults to pool.ntp.org + port: 123, // Defaults to 123 (NTP) + resolveReference: true, // Default to false (not resolving) + timeout: 1000 // Defaults to zero (no timeout) +}; + +// Request server time + +Sntp.time(options, function (err, time) { + + if (err) { + console.log('Failed: ' + err.message); + process.exit(1); + } + + console.log('Local clock is off by: ' + time.t + ' milliseconds'); + process.exit(0); +}); +``` + +If an application needs to maintain continuous time synchronization, the module provides a stateful method for +querying the current offset only when the last one is too old (defaults to daily). + +```javascript +// Request offset once + +Sntp.offset(function (err, offset) { + + console.log(offset); // New (served fresh) + + // Request offset again + + Sntp.offset(function (err, offset) { + + console.log(offset); // Identical (served from cache) + }); +}); +``` + +To set a background offset refresh, start the interval and use the provided now() method. If for any reason the +client fails to obtain an up-to-date offset, the current system clock is used. + +```javascript +var before = Sntp.now(); // System time without offset + +Sntp.start(function () { + + var now = Sntp.now(); // With offset + Sntp.stop(); +}); +``` + diff --git a/appasar/canary/node_modules/sntp/lib/index.js b/appasar/canary/node_modules/sntp/lib/index.js new file mode 100644 index 0000000..83eb458 --- /dev/null +++ b/appasar/canary/node_modules/sntp/lib/index.js @@ -0,0 +1,412 @@ +'use strict'; + +// Load modules + +const Dgram = require('dgram'); +const Dns = require('dns'); + +const Hoek = require('hoek'); + + +// Declare internals + +const internals = {}; + + +exports.time = function (options, callback) { + + if (arguments.length !== 2) { + callback = arguments[0]; + options = {}; + } + + const settings = Hoek.clone(options); + settings.host = settings.host || 'time.google.com'; + settings.port = settings.port || 123; + settings.resolveReference = settings.resolveReference || false; + + // Declare variables used by callback + + let timeoutId = null; + let sent = 0; + + // Ensure callback is only called once + + const finish = Hoek.once((err, result) => { + + clearTimeout(timeoutId); + + socket.removeAllListeners(); + socket.once('error', Hoek.ignore); + + try { + socket.close(); + } + catch (ignoreErr) { } // Ignore errors if the socket is already closed + + return callback(err, result); + }); + + // Set timeout + + if (settings.timeout) { + timeoutId = setTimeout(() => { + + return finish(new Error('Timeout')); + }, settings.timeout); + } + + // Create UDP socket + + const socket = Dgram.createSocket('udp4'); + + socket.once('error', (err) => finish(err)); + + // Listen to incoming messages + + socket.on('message', (buffer, rinfo) => { + + const received = Date.now(); + + const message = new internals.NtpMessage(buffer); + if (!message.isValid) { + return finish(new Error('Invalid server response'), message); + } + + if (message.originateTimestamp !== sent) { + return finish(new Error('Wrong originate timestamp'), message); + } + + // Timestamp Name ID When Generated + // ------------------------------------------------------------ + // Originate Timestamp T1 time request sent by client + // Receive Timestamp T2 time request received by server + // Transmit Timestamp T3 time reply sent by server + // Destination Timestamp T4 time reply received by client + // + // The roundtrip delay d and system clock offset t are defined as: + // + // d = (T4 - T1) - (T3 - T2) t = ((T2 - T1) + (T3 - T4)) / 2 + + const T1 = message.originateTimestamp; + const T2 = message.receiveTimestamp; + const T3 = message.transmitTimestamp; + const T4 = received; + + message.d = (T4 - T1) - (T3 - T2); + message.t = ((T2 - T1) + (T3 - T4)) / 2; + message.receivedLocally = received; + + if (!settings.resolveReference || + message.stratum !== 'secondary') { + + return finish(null, message); + } + + // Resolve reference IP address + + Dns.reverse(message.referenceId, (err, domains) => { + + if (/* $lab:coverage:off$ */ !err /* $lab:coverage:on$ */) { + message.referenceHost = domains[0]; + } + + return finish(null, message); + }); + }); + + // Construct NTP message + + const message = new Buffer(48); + for (let i = 0; i < 48; ++i) { // Zero message + message[i] = 0; + } + + message[0] = (0 << 6) + (4 << 3) + (3 << 0); // Set version number to 4 and Mode to 3 (client) + sent = Date.now(); + internals.fromMsecs(sent, message, 40); // Set transmit timestamp (returns as originate) + + // Send NTP request + + socket.send(message, 0, message.length, settings.port, settings.host, (err, bytes) => { + + if (err || + bytes !== 48) { + + return finish(err || new Error('Could not send entire message')); + } + }); +}; + + +internals.NtpMessage = function (buffer) { + + this.isValid = false; + + // Validate + + if (buffer.length !== 48) { + return; + } + + // Leap indicator + + const li = (buffer[0] >> 6); + switch (li) { + case 0: this.leapIndicator = 'no-warning'; break; + case 1: this.leapIndicator = 'last-minute-61'; break; + case 2: this.leapIndicator = 'last-minute-59'; break; + case 3: this.leapIndicator = 'alarm'; break; + } + + // Version + + const vn = ((buffer[0] & 0x38) >> 3); + this.version = vn; + + // Mode + + const mode = (buffer[0] & 0x7); + switch (mode) { + case 1: this.mode = 'symmetric-active'; break; + case 2: this.mode = 'symmetric-passive'; break; + case 3: this.mode = 'client'; break; + case 4: this.mode = 'server'; break; + case 5: this.mode = 'broadcast'; break; + case 0: + case 6: + case 7: this.mode = 'reserved'; break; + } + + // Stratum + + const stratum = buffer[1]; + if (stratum === 0) { + this.stratum = 'death'; + } + else if (stratum === 1) { + this.stratum = 'primary'; + } + else if (stratum <= 15) { + this.stratum = 'secondary'; + } + else { + this.stratum = 'reserved'; + } + + // Poll interval (msec) + + this.pollInterval = Math.round(Math.pow(2, buffer[2])) * 1000; + + // Precision (msecs) + + this.precision = Math.pow(2, buffer[3]) * 1000; + + // Root delay (msecs) + + const rootDelay = 256 * (256 * (256 * buffer[4] + buffer[5]) + buffer[6]) + buffer[7]; + this.rootDelay = 1000 * (rootDelay / 0x10000); + + // Root dispersion (msecs) + + this.rootDispersion = ((buffer[8] << 8) + buffer[9] + ((buffer[10] << 8) + buffer[11]) / Math.pow(2, 16)) * 1000; + + // Reference identifier + + this.referenceId = ''; + switch (this.stratum) { + case 'death': + case 'primary': + this.referenceId = String.fromCharCode(buffer[12]) + String.fromCharCode(buffer[13]) + String.fromCharCode(buffer[14]) + String.fromCharCode(buffer[15]); + break; + case 'secondary': + this.referenceId = '' + buffer[12] + '.' + buffer[13] + '.' + buffer[14] + '.' + buffer[15]; + break; + } + + // Reference timestamp + + this.referenceTimestamp = internals.toMsecs(buffer, 16); + + // Originate timestamp + + this.originateTimestamp = internals.toMsecs(buffer, 24); + + // Receive timestamp + + this.receiveTimestamp = internals.toMsecs(buffer, 32); + + // Transmit timestamp + + this.transmitTimestamp = internals.toMsecs(buffer, 40); + + // Validate + + if (this.version === 4 && + this.stratum !== 'reserved' && + this.mode === 'server' && + this.originateTimestamp && + this.receiveTimestamp && + this.transmitTimestamp) { + + this.isValid = true; + } + + return this; +}; + + +internals.toMsecs = function (buffer, offset) { + + let seconds = 0; + let fraction = 0; + + for (let i = 0; i < 4; ++i) { + seconds = (seconds * 256) + buffer[offset + i]; + } + + for (let i = 4; i < 8; ++i) { + fraction = (fraction * 256) + buffer[offset + i]; + } + + return ((seconds - 2208988800 + (fraction / Math.pow(2, 32))) * 1000); +}; + + +internals.fromMsecs = function (ts, buffer, offset) { + + const seconds = Math.floor(ts / 1000) + 2208988800; + const fraction = Math.round((ts % 1000) / 1000 * Math.pow(2, 32)); + + buffer[offset + 0] = (seconds & 0xFF000000) >> 24; + buffer[offset + 1] = (seconds & 0x00FF0000) >> 16; + buffer[offset + 2] = (seconds & 0x0000FF00) >> 8; + buffer[offset + 3] = (seconds & 0x000000FF); + + buffer[offset + 4] = (fraction & 0xFF000000) >> 24; + buffer[offset + 5] = (fraction & 0x00FF0000) >> 16; + buffer[offset + 6] = (fraction & 0x0000FF00) >> 8; + buffer[offset + 7] = (fraction & 0x000000FF); +}; + + +// Offset singleton + +internals.last = { + offset: 0, + expires: 0, + host: '', + port: 0 +}; + + +exports.offset = function (options, callback) { + + if (arguments.length !== 2) { + callback = arguments[0]; + options = {}; + } + + const now = Date.now(); + const clockSyncRefresh = options.clockSyncRefresh || 24 * 60 * 60 * 1000; // Daily + + if (internals.last.offset && + internals.last.host === options.host && + internals.last.port === options.port && + now < internals.last.expires) { + + process.nextTick(() => callback(null, internals.last.offset)); + return; + } + + exports.time(options, (err, time) => { + + if (err) { + return callback(err, 0); + } + + internals.last = { + offset: Math.round(time.t), + expires: now + clockSyncRefresh, + host: options.host, + port: options.port + }; + + return callback(null, internals.last.offset); + }); +}; + + +// Now singleton + +internals.now = { + started: false, + intervalId: null +}; + + +exports.start = function (options, callback) { + + if (arguments.length !== 2) { + callback = arguments[0]; + options = {}; + } + + if (internals.now.started) { + process.nextTick(() => callback()); + return; + } + + const report = (err) => { + + if (err && + options.onError) { + + options.onError(err); + } + }; + + internals.now.started = true; + exports.offset(options, (err, offset) => { + + report(err); + + internals.now.intervalId = setInterval(() => { + + exports.offset(options, report); + }, options.clockSyncRefresh || 24 * 60 * 60 * 1000); // Daily + + return callback(); + }); +}; + + +exports.stop = function () { + + if (!internals.now.started) { + return; + } + + clearInterval(internals.now.intervalId); + internals.now.started = false; + internals.now.intervalId = null; +}; + + +exports.isLive = function () { + + return internals.now.started; +}; + + +exports.now = function () { + + const now = Date.now(); + if (!exports.isLive() || + now >= internals.last.expires) { + + return now; + } + + return now + internals.last.offset; +}; diff --git a/appasar/canary/node_modules/sntp/package.json b/appasar/canary/node_modules/sntp/package.json new file mode 100644 index 0000000..ffea647 --- /dev/null +++ b/appasar/canary/node_modules/sntp/package.json @@ -0,0 +1,31 @@ +{ + "name": "sntp", + "description": "SNTP Client", + "version": "2.1.0", + "author": "Eran Hammer (http://hueniverse.com)", + "repository": { + "type": "git", + "url": "git://github.com/hueniverse/sntp" + }, + "main": "lib/index.js", + "keywords": [ + "sntp", + "ntp", + "time" + ], + "engines": { + "node": ">=4.0.0" + }, + "dependencies": { + "hoek": "4.x.x" + }, + "devDependencies": { + "code": "4.x.x", + "lab": "14.x.x" + }, + "scripts": { + "test": "lab -a code -t 100 -L -m 20000", + "test-cov-html": "lab -a code -r html -o coverage.html -m 20000" + }, + "license": "BSD-3-Clause" +} diff --git a/appasar/canary/node_modules/sshpk/.npmignore b/appasar/canary/node_modules/sshpk/.npmignore new file mode 100644 index 0000000..8000b59 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/.npmignore @@ -0,0 +1,9 @@ +.gitmodules +deps +docs +Makefile +node_modules +test +tools +coverage +man/src diff --git a/appasar/canary/node_modules/sshpk/.travis.yml b/appasar/canary/node_modules/sshpk/.travis.yml new file mode 100644 index 0000000..c3394c2 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: + - "5.10" + - "4.4" + - "4.1" + - "0.12" + - "0.10" +before_install: + - "make check" +after_success: + - '[ "${TRAVIS_NODE_VERSION}" = "4.4" ] && make codecovio' diff --git a/appasar/canary/node_modules/sshpk/LICENSE b/appasar/canary/node_modules/sshpk/LICENSE new file mode 100644 index 0000000..f6d947d --- /dev/null +++ b/appasar/canary/node_modules/sshpk/LICENSE @@ -0,0 +1,18 @@ +Copyright Joyent, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/sshpk/README.md b/appasar/canary/node_modules/sshpk/README.md new file mode 100644 index 0000000..310c2ee --- /dev/null +++ b/appasar/canary/node_modules/sshpk/README.md @@ -0,0 +1,698 @@ +sshpk +========= + +Parse, convert, fingerprint and use SSH keys (both public and private) in pure +node -- no `ssh-keygen` or other external dependencies. + +Supports RSA, DSA, ECDSA (nistp-\*) and ED25519 key types, in PEM (PKCS#1, +PKCS#8) and OpenSSH formats. + +This library has been extracted from +[`node-http-signature`](https://github.com/joyent/node-http-signature) +(work by [Mark Cavage](https://github.com/mcavage) and +[Dave Eddy](https://github.com/bahamas10)) and +[`node-ssh-fingerprint`](https://github.com/bahamas10/node-ssh-fingerprint) +(work by Dave Eddy), with additions (including ECDSA support) by +[Alex Wilson](https://github.com/arekinath). + +Install +------- + +``` +npm install sshpk +``` + +Examples +-------- + +```js +var sshpk = require('sshpk'); + +var fs = require('fs'); + +/* Read in an OpenSSH-format public key */ +var keyPub = fs.readFileSync('id_rsa.pub'); +var key = sshpk.parseKey(keyPub, 'ssh'); + +/* Get metadata about the key */ +console.log('type => %s', key.type); +console.log('size => %d bits', key.size); +console.log('comment => %s', key.comment); + +/* Compute key fingerprints, in new OpenSSH (>6.7) format, and old MD5 */ +console.log('fingerprint => %s', key.fingerprint().toString()); +console.log('old-style fingerprint => %s', key.fingerprint('md5').toString()); +``` + +Example output: + +``` +type => rsa +size => 2048 bits +comment => foo@foo.com +fingerprint => SHA256:PYC9kPVC6J873CSIbfp0LwYeczP/W4ffObNCuDJ1u5w +old-style fingerprint => a0:c8:ad:6c:32:9a:32:fa:59:cc:a9:8c:0a:0d:6e:bd +``` + +More examples: converting between formats: + +```js +/* Read in a PEM public key */ +var keyPem = fs.readFileSync('id_rsa.pem'); +var key = sshpk.parseKey(keyPem, 'pem'); + +/* Convert to PEM PKCS#8 public key format */ +var pemBuf = key.toBuffer('pkcs8'); + +/* Convert to SSH public key format (and return as a string) */ +var sshKey = key.toString('ssh'); +``` + +Signing and verifying: + +```js +/* Read in an OpenSSH/PEM *private* key */ +var keyPriv = fs.readFileSync('id_ecdsa'); +var key = sshpk.parsePrivateKey(keyPriv, 'pem'); + +var data = 'some data'; + +/* Sign some data with the key */ +var s = key.createSign('sha1'); +s.update(data); +var signature = s.sign(); + +/* Now load the public key (could also use just key.toPublic()) */ +var keyPub = fs.readFileSync('id_ecdsa.pub'); +key = sshpk.parseKey(keyPub, 'ssh'); + +/* Make a crypto.Verifier with this key */ +var v = key.createVerify('sha1'); +v.update(data); +var valid = v.verify(signature); +/* => true! */ +``` + +Matching fingerprints with keys: + +```js +var fp = sshpk.parseFingerprint('SHA256:PYC9kPVC6J873CSIbfp0LwYeczP/W4ffObNCuDJ1u5w'); + +var keys = [sshpk.parseKey(...), sshpk.parseKey(...), ...]; + +keys.forEach(function (key) { + if (fp.matches(key)) + console.log('found it!'); +}); +``` + +Usage +----- + +## Public keys + +### `parseKey(data[, format = 'auto'[, options]])` + +Parses a key from a given data format and returns a new `Key` object. + +Parameters + +- `data` -- Either a Buffer or String, containing the key +- `format` -- String name of format to use, valid options are: + - `auto`: choose automatically from all below + - `pem`: supports both PKCS#1 and PKCS#8 + - `ssh`: standard OpenSSH format, + - `pkcs1`, `pkcs8`: variants of `pem` + - `rfc4253`: raw OpenSSH wire format + - `openssh`: new post-OpenSSH 6.5 internal format, produced by + `ssh-keygen -o` +- `options` -- Optional Object, extra options, with keys: + - `filename` -- Optional String, name for the key being parsed + (eg. the filename that was opened). Used to generate + Error messages + - `passphrase` -- Optional String, encryption passphrase used to decrypt an + encrypted PEM file + +### `Key.isKey(obj)` + +Returns `true` if the given object is a valid `Key` object created by a version +of `sshpk` compatible with this one. + +Parameters + +- `obj` -- Object to identify + +### `Key#type` + +String, the type of key. Valid options are `rsa`, `dsa`, `ecdsa`. + +### `Key#size` + +Integer, "size" of the key in bits. For RSA/DSA this is the size of the modulus; +for ECDSA this is the bit size of the curve in use. + +### `Key#comment` + +Optional string, a key comment used by some formats (eg the `ssh` format). + +### `Key#curve` + +Only present if `this.type === 'ecdsa'`, string containing the name of the +named curve used with this key. Possible values include `nistp256`, `nistp384` +and `nistp521`. + +### `Key#toBuffer([format = 'ssh'])` + +Convert the key into a given data format and return the serialized key as +a Buffer. + +Parameters + +- `format` -- String name of format to use, for valid options see `parseKey()` + +### `Key#toString([format = 'ssh])` + +Same as `this.toBuffer(format).toString()`. + +### `Key#fingerprint([algorithm = 'sha256'])` + +Creates a new `Fingerprint` object representing this Key's fingerprint. + +Parameters + +- `algorithm` -- String name of hash algorithm to use, valid options are `md5`, + `sha1`, `sha256`, `sha384`, `sha512` + +### `Key#createVerify([hashAlgorithm])` + +Creates a `crypto.Verifier` specialized to use this Key (and the correct public +key algorithm to match it). The returned Verifier has the same API as a regular +one, except that the `verify()` function takes only the target signature as an +argument. + +Parameters + +- `hashAlgorithm` -- optional String name of hash algorithm to use, any + supported by OpenSSL are valid, usually including + `sha1`, `sha256`. + +`v.verify(signature[, format])` Parameters + +- `signature` -- either a Signature object, or a Buffer or String +- `format` -- optional String, name of format to interpret given String with. + Not valid if `signature` is a Signature or Buffer. + +### `Key#createDiffieHellman()` +### `Key#createDH()` + +Creates a Diffie-Hellman key exchange object initialized with this key and all +necessary parameters. This has the same API as a `crypto.DiffieHellman` +instance, except that functions take `Key` and `PrivateKey` objects as +arguments, and return them where indicated for. + +This is only valid for keys belonging to a cryptosystem that supports DHE +or a close analogue (i.e. `dsa`, `ecdsa` and `curve25519` keys). An attempt +to call this function on other keys will yield an `Error`. + +## Private keys + +### `parsePrivateKey(data[, format = 'auto'[, options]])` + +Parses a private key from a given data format and returns a new +`PrivateKey` object. + +Parameters + +- `data` -- Either a Buffer or String, containing the key +- `format` -- String name of format to use, valid options are: + - `auto`: choose automatically from all below + - `pem`: supports both PKCS#1 and PKCS#8 + - `ssh`, `openssh`: new post-OpenSSH 6.5 internal format, produced by + `ssh-keygen -o` + - `pkcs1`, `pkcs8`: variants of `pem` + - `rfc4253`: raw OpenSSH wire format +- `options` -- Optional Object, extra options, with keys: + - `filename` -- Optional String, name for the key being parsed + (eg. the filename that was opened). Used to generate + Error messages + - `passphrase` -- Optional String, encryption passphrase used to decrypt an + encrypted PEM file + +### `generatePrivateKey(type[, options])` + +Generates a new private key of a certain key type, from random data. + +Parameters + +- `type` -- String, type of key to generate. Currently supported are `'ecdsa'` + and `'ed25519'` +- `options` -- optional Object, with keys: + - `curve` -- optional String, for `'ecdsa'` keys, specifies the curve to use. + If ECDSA is specified and this option is not given, defaults to + using `'nistp256'`. + +### `PrivateKey.isPrivateKey(obj)` + +Returns `true` if the given object is a valid `PrivateKey` object created by a +version of `sshpk` compatible with this one. + +Parameters + +- `obj` -- Object to identify + +### `PrivateKey#type` + +String, the type of key. Valid options are `rsa`, `dsa`, `ecdsa`. + +### `PrivateKey#size` + +Integer, "size" of the key in bits. For RSA/DSA this is the size of the modulus; +for ECDSA this is the bit size of the curve in use. + +### `PrivateKey#curve` + +Only present if `this.type === 'ecdsa'`, string containing the name of the +named curve used with this key. Possible values include `nistp256`, `nistp384` +and `nistp521`. + +### `PrivateKey#toBuffer([format = 'pkcs1'])` + +Convert the key into a given data format and return the serialized key as +a Buffer. + +Parameters + +- `format` -- String name of format to use, valid options are listed under + `parsePrivateKey`. Note that ED25519 keys default to `openssh` + format instead (as they have no `pkcs1` representation). + +### `PrivateKey#toString([format = 'pkcs1'])` + +Same as `this.toBuffer(format).toString()`. + +### `PrivateKey#toPublic()` + +Extract just the public part of this private key, and return it as a `Key` +object. + +### `PrivateKey#fingerprint([algorithm = 'sha256'])` + +Same as `this.toPublic().fingerprint()`. + +### `PrivateKey#createVerify([hashAlgorithm])` + +Same as `this.toPublic().createVerify()`. + +### `PrivateKey#createSign([hashAlgorithm])` + +Creates a `crypto.Sign` specialized to use this PrivateKey (and the correct +key algorithm to match it). The returned Signer has the same API as a regular +one, except that the `sign()` function takes no arguments, and returns a +`Signature` object. + +Parameters + +- `hashAlgorithm` -- optional String name of hash algorithm to use, any + supported by OpenSSL are valid, usually including + `sha1`, `sha256`. + +`v.sign()` Parameters + +- none + +### `PrivateKey#derive(newType)` + +Derives a related key of type `newType` from this key. Currently this is +only supported to change between `ed25519` and `curve25519` keys which are +stored with the same private key (but usually distinct public keys in order +to avoid degenerate keys that lead to a weak Diffie-Hellman exchange). + +Parameters + +- `newType` -- String, type of key to derive, either `ed25519` or `curve25519` + +## Fingerprints + +### `parseFingerprint(fingerprint[, algorithms])` + +Pre-parses a fingerprint, creating a `Fingerprint` object that can be used to +quickly locate a key by using the `Fingerprint#matches` function. + +Parameters + +- `fingerprint` -- String, the fingerprint value, in any supported format +- `algorithms` -- Optional list of strings, names of hash algorithms to limit + support to. If `fingerprint` uses a hash algorithm not on + this list, throws `InvalidAlgorithmError`. + +### `Fingerprint.isFingerprint(obj)` + +Returns `true` if the given object is a valid `Fingerprint` object created by a +version of `sshpk` compatible with this one. + +Parameters + +- `obj` -- Object to identify + +### `Fingerprint#toString([format])` + +Returns a fingerprint as a string, in the given format. + +Parameters + +- `format` -- Optional String, format to use, valid options are `hex` and + `base64`. If this `Fingerprint` uses the `md5` algorithm, the + default format is `hex`. Otherwise, the default is `base64`. + +### `Fingerprint#matches(key)` + +Verifies whether or not this `Fingerprint` matches a given `Key`. This function +uses double-hashing to avoid leaking timing information. Returns a boolean. + +Parameters + +- `key` -- a `Key` object, the key to match this fingerprint against + +## Signatures + +### `parseSignature(signature, algorithm, format)` + +Parses a signature in a given format, creating a `Signature` object. Useful +for converting between the SSH and ASN.1 (PKCS/OpenSSL) signature formats, and +also returned as output from `PrivateKey#createSign().sign()`. + +A Signature object can also be passed to a verifier produced by +`Key#createVerify()` and it will automatically be converted internally into the +correct format for verification. + +Parameters + +- `signature` -- a Buffer (binary) or String (base64), data of the actual + signature in the given format +- `algorithm` -- a String, name of the algorithm to be used, possible values + are `rsa`, `dsa`, `ecdsa` +- `format` -- a String, either `asn1` or `ssh` + +### `Signature.isSignature(obj)` + +Returns `true` if the given object is a valid `Signature` object created by a +version of `sshpk` compatible with this one. + +Parameters + +- `obj` -- Object to identify + +### `Signature#toBuffer([format = 'asn1'])` + +Converts a Signature to the given format and returns it as a Buffer. + +Parameters + +- `format` -- a String, either `asn1` or `ssh` + +### `Signature#toString([format = 'asn1'])` + +Same as `this.toBuffer(format).toString('base64')`. + +## Certificates + +`sshpk` includes basic support for parsing certificates in X.509 (PEM) format +and the OpenSSH certificate format. This feature is intended to be used mainly +to access basic metadata about certificates, extract public keys from them, and +also to generate simple self-signed certificates from an existing key. + +Notably, there is no implementation of CA chain-of-trust verification, and only +very minimal support for key usage restrictions. Please do the security world +a favour, and DO NOT use this code for certificate verification in the +traditional X.509 CA chain style. + +### `parseCertificate(data, format)` + +Parameters + + - `data` -- a Buffer or String + - `format` -- a String, format to use, one of `'openssh'`, `'pem'` (X.509 in a + PEM wrapper), or `'x509'` (raw DER encoded) + +### `createSelfSignedCertificate(subject, privateKey[, options])` + +Parameters + + - `subject` -- an Identity, the subject of the certificate + - `privateKey` -- a PrivateKey, the key of the subject: will be used both to be + placed in the certificate and also to sign it (since this is + a self-signed certificate) + - `options` -- optional Object, with keys: + - `lifetime` -- optional Number, lifetime of the certificate from now in + seconds + - `validFrom`, `validUntil` -- optional Dates, beginning and end of + certificate validity period. If given + `lifetime` will be ignored + - `serial` -- optional Buffer, the serial number of the certificate + - `purposes` -- optional Array of String, X.509 key usage restrictions + +### `createCertificate(subject, key, issuer, issuerKey[, options])` + +Parameters + + - `subject` -- an Identity, the subject of the certificate + - `key` -- a Key, the public key of the subject + - `issuer` -- an Identity, the issuer of the certificate who will sign it + - `issuerKey` -- a PrivateKey, the issuer's private key for signing + - `options` -- optional Object, with keys: + - `lifetime` -- optional Number, lifetime of the certificate from now in + seconds + - `validFrom`, `validUntil` -- optional Dates, beginning and end of + certificate validity period. If given + `lifetime` will be ignored + - `serial` -- optional Buffer, the serial number of the certificate + - `purposes` -- optional Array of String, X.509 key usage restrictions + +### `Certificate#subjects` + +Array of `Identity` instances describing the subject of this certificate. + +### `Certificate#issuer` + +The `Identity` of the Certificate's issuer (signer). + +### `Certificate#subjectKey` + +The public key of the subject of the certificate, as a `Key` instance. + +### `Certificate#issuerKey` + +The public key of the signing issuer of this certificate, as a `Key` instance. +May be `undefined` if the issuer's key is unknown (e.g. on an X509 certificate). + +### `Certificate#serial` + +The serial number of the certificate. As this is normally a 64-bit or wider +integer, it is returned as a Buffer. + +### `Certificate#purposes` + +Array of Strings indicating the X.509 key usage purposes that this certificate +is valid for. The possible strings at the moment are: + + * `'signature'` -- key can be used for digital signatures + * `'identity'` -- key can be used to attest about the identity of the signer + (X.509 calls this `nonRepudiation`) + * `'codeSigning'` -- key can be used to sign executable code + * `'keyEncryption'` -- key can be used to encrypt other keys + * `'encryption'` -- key can be used to encrypt data (only applies for RSA) + * `'keyAgreement'` -- key can be used for key exchange protocols such as + Diffie-Hellman + * `'ca'` -- key can be used to sign other certificates (is a Certificate + Authority) + * `'crl'` -- key can be used to sign Certificate Revocation Lists (CRLs) + +### `Certificate#isExpired([when])` + +Tests whether the Certificate is currently expired (i.e. the `validFrom` and +`validUntil` dates specify a range of time that does not include the current +time). + +Parameters + + - `when` -- optional Date, if specified, tests whether the Certificate was or + will be expired at the specified time instead of now + +Returns a Boolean. + +### `Certificate#isSignedByKey(key)` + +Tests whether the Certificate was validly signed by the given (public) Key. + +Parameters + + - `key` -- a Key instance + +Returns a Boolean. + +### `Certificate#isSignedBy(certificate)` + +Tests whether this Certificate was validly signed by the subject of the given +certificate. Also tests that the issuer Identity of this Certificate and the +subject Identity of the other Certificate are equivalent. + +Parameters + + - `certificate` -- another Certificate instance + +Returns a Boolean. + +### `Certificate#fingerprint([hashAlgo])` + +Returns the X509-style fingerprint of the entire certificate (as a Fingerprint +instance). This matches what a web-browser or similar would display as the +certificate fingerprint and should not be confused with the fingerprint of the +subject's public key. + +Parameters + + - `hashAlgo` -- an optional String, any hash function name + +### `Certificate#toBuffer([format])` + +Serializes the Certificate to a Buffer and returns it. + +Parameters + + - `format` -- an optional String, output format, one of `'openssh'`, `'pem'` or + `'x509'`. Defaults to `'x509'`. + +Returns a Buffer. + +### `Certificate#toString([format])` + + - `format` -- an optional String, output format, one of `'openssh'`, `'pem'` or + `'x509'`. Defaults to `'pem'`. + +Returns a String. + +## Certificate identities + +### `identityForHost(hostname)` + +Constructs a host-type Identity for a given hostname. + +Parameters + + - `hostname` -- the fully qualified DNS name of the host + +Returns an Identity instance. + +### `identityForUser(uid)` + +Constructs a user-type Identity for a given UID. + +Parameters + + - `uid` -- a String, user identifier (login name) + +Returns an Identity instance. + +### `identityForEmail(email)` + +Constructs an email-type Identity for a given email address. + +Parameters + + - `email` -- a String, email address + +Returns an Identity instance. + +### `identityFromDN(dn)` + +Parses an LDAP-style DN string (e.g. `'CN=foo, C=US'`) and turns it into an +Identity instance. + +Parameters + + - `dn` -- a String + +Returns an Identity instance. + +### `Identity#toString()` + +Returns the identity as an LDAP-style DN string. +e.g. `'CN=foo, O=bar corp, C=us'` + +### `Identity#type` + +The type of identity. One of `'host'`, `'user'`, `'email'` or `'unknown'` + +### `Identity#hostname` +### `Identity#uid` +### `Identity#email` + +Set when `type` is `'host'`, `'user'`, or `'email'`, respectively. Strings. + +### `Identity#cn` + +The value of the first `CN=` in the DN, if any. + +Errors +------ + +### `InvalidAlgorithmError` + +The specified algorithm is not valid, either because it is not supported, or +because it was not included on a list of allowed algorithms. + +Thrown by `Fingerprint.parse`, `Key#fingerprint`. + +Properties + +- `algorithm` -- the algorithm that could not be validated + +### `FingerprintFormatError` + +The fingerprint string given could not be parsed as a supported fingerprint +format, or the specified fingerprint format is invalid. + +Thrown by `Fingerprint.parse`, `Fingerprint#toString`. + +Properties + +- `fingerprint` -- if caused by a fingerprint, the string value given +- `format` -- if caused by an invalid format specification, the string value given + +### `KeyParseError` + +The key data given could not be parsed as a valid key. + +Properties + +- `keyName` -- `filename` that was given to `parseKey` +- `format` -- the `format` that was trying to parse the key (see `parseKey`) +- `innerErr` -- the inner Error thrown by the format parser + +### `KeyEncryptedError` + +The key is encrypted with a symmetric key (ie, it is password protected). The +parsing operation would succeed if it was given the `passphrase` option. + +Properties + +- `keyName` -- `filename` that was given to `parseKey` +- `format` -- the `format` that was trying to parse the key (currently can only + be `"pem"`) + +### `CertificateParseError` + +The certificate data given could not be parsed as a valid certificate. + +Properties + +- `certName` -- `filename` that was given to `parseCertificate` +- `format` -- the `format` that was trying to parse the key + (see `parseCertificate`) +- `innerErr` -- the inner Error thrown by the format parser + +Friends of sshpk +---------------- + + * [`sshpk-agent`](https://github.com/arekinath/node-sshpk-agent) is a library + for speaking the `ssh-agent` protocol from node.js, which uses `sshpk` diff --git a/appasar/canary/node_modules/sshpk/bin/sshpk-conv b/appasar/canary/node_modules/sshpk/bin/sshpk-conv new file mode 100644 index 0000000..444045a --- /dev/null +++ b/appasar/canary/node_modules/sshpk/bin/sshpk-conv @@ -0,0 +1,201 @@ +#!/usr/bin/env node +// -*- mode: js -*- +// vim: set filetype=javascript : +// Copyright 2015 Joyent, Inc. All rights reserved. + +var dashdash = require('dashdash'); +var sshpk = require('../lib/index'); +var fs = require('fs'); +var path = require('path'); +var tty = require('tty'); +var readline = require('readline'); +var getPassword = require('getpass').getPass; + +var options = [ + { + names: ['outformat', 't'], + type: 'string', + help: 'Output format' + }, + { + names: ['informat', 'T'], + type: 'string', + help: 'Input format' + }, + { + names: ['file', 'f'], + type: 'string', + help: 'Input file name (default stdin)' + }, + { + names: ['out', 'o'], + type: 'string', + help: 'Output file name (default stdout)' + }, + { + names: ['private', 'p'], + type: 'bool', + help: 'Produce a private key as output' + }, + { + names: ['derive', 'd'], + type: 'string', + help: 'Output a new key derived from this one, with given algo' + }, + { + names: ['identify', 'i'], + type: 'bool', + help: 'Print key metadata instead of converting' + }, + { + names: ['comment', 'c'], + type: 'string', + help: 'Set key comment, if output format supports' + }, + { + names: ['help', 'h'], + type: 'bool', + help: 'Shows this help text' + } +]; + +if (require.main === module) { + var parser = dashdash.createParser({ + options: options + }); + + try { + var opts = parser.parse(process.argv); + } catch (e) { + console.error('sshpk-conv: error: %s', e.message); + process.exit(1); + } + + if (opts.help || opts._args.length > 1) { + var help = parser.help({}).trimRight(); + console.error('sshpk-conv: converts between SSH key formats\n'); + console.error(help); + console.error('\navailable formats:'); + console.error(' - pem, pkcs1 eg id_rsa'); + console.error(' - ssh eg id_rsa.pub'); + console.error(' - pkcs8 format you want for openssl'); + console.error(' - openssh like output of ssh-keygen -o'); + console.error(' - rfc4253 raw OpenSSH wire format'); + process.exit(1); + } + + /* + * Key derivation can only be done on private keys, so use of the -d + * option necessarily implies -p. + */ + if (opts.derive) + opts.private = true; + + var inFile = process.stdin; + var inFileName = 'stdin'; + + var inFilePath; + if (opts.file) { + inFilePath = opts.file; + } else if (opts._args.length === 1) { + inFilePath = opts._args[0]; + } + + if (inFilePath) + inFileName = path.basename(inFilePath); + + try { + if (inFilePath) { + fs.accessSync(inFilePath, fs.R_OK); + inFile = fs.createReadStream(inFilePath); + } + } catch (e) { + console.error('sshpk-conv: error opening input file' + + ': ' + e.name + ': ' + e.message); + process.exit(1); + } + + var outFile = process.stdout; + + try { + if (opts.out && !opts.identify) { + fs.accessSync(path.dirname(opts.out), fs.W_OK); + outFile = fs.createWriteStream(opts.out); + } + } catch (e) { + console.error('sshpk-conv: error opening output file' + + ': ' + e.name + ': ' + e.message); + process.exit(1); + } + + var bufs = []; + inFile.on('readable', function () { + var data; + while ((data = inFile.read())) + bufs.push(data); + }); + var parseOpts = {}; + parseOpts.filename = inFileName; + inFile.on('end', function processKey() { + var buf = Buffer.concat(bufs); + var fmt = 'auto'; + if (opts.informat) + fmt = opts.informat; + var f = sshpk.parseKey; + if (opts.private) + f = sshpk.parsePrivateKey; + try { + var key = f(buf, fmt, parseOpts); + } catch (e) { + if (e.name === 'KeyEncryptedError') { + getPassword(function (err, pw) { + if (err) { + console.log('sshpk-conv: ' + + err.name + ': ' + + err.message); + process.exit(1); + } + parseOpts.passphrase = pw; + processKey(); + }); + return; + } + console.error('sshpk-conv: ' + + e.name + ': ' + e.message); + process.exit(1); + } + + if (opts.derive) + key = key.derive(opts.derive); + + if (opts.comment) + key.comment = opts.comment; + + if (!opts.identify) { + fmt = undefined; + if (opts.outformat) + fmt = opts.outformat; + outFile.write(key.toBuffer(fmt)); + if (fmt === 'ssh' || + (!opts.private && fmt === undefined)) + outFile.write('\n'); + outFile.once('drain', function () { + process.exit(0); + }); + } else { + var kind = 'public'; + if (sshpk.PrivateKey.isPrivateKey(key)) + kind = 'private'; + console.log('%s: a %d bit %s %s key', inFileName, + key.size, key.type.toUpperCase(), kind); + if (key.type === 'ecdsa') + console.log('ECDSA curve: %s', key.curve); + if (key.comment) + console.log('Comment: %s', key.comment); + console.log('Fingerprint:'); + console.log(' ' + key.fingerprint().toString()); + console.log(' ' + key.fingerprint('md5').toString()); + process.exit(0); + } + }); +} diff --git a/appasar/canary/node_modules/sshpk/bin/sshpk-sign b/appasar/canary/node_modules/sshpk/bin/sshpk-sign new file mode 100644 index 0000000..673fc98 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/bin/sshpk-sign @@ -0,0 +1,191 @@ +#!/usr/bin/env node +// -*- mode: js -*- +// vim: set filetype=javascript : +// Copyright 2015 Joyent, Inc. All rights reserved. + +var dashdash = require('dashdash'); +var sshpk = require('../lib/index'); +var fs = require('fs'); +var path = require('path'); +var getPassword = require('getpass').getPass; + +var options = [ + { + names: ['hash', 'H'], + type: 'string', + help: 'Hash algorithm (sha1, sha256, sha384, sha512)' + }, + { + names: ['verbose', 'v'], + type: 'bool', + help: 'Display verbose info about key and hash used' + }, + { + names: ['identity', 'i'], + type: 'string', + help: 'Path to key to use' + }, + { + names: ['file', 'f'], + type: 'string', + help: 'Input filename' + }, + { + names: ['out', 'o'], + type: 'string', + help: 'Output filename' + }, + { + names: ['format', 't'], + type: 'string', + help: 'Signature format (asn1, ssh, raw)' + }, + { + names: ['binary', 'b'], + type: 'bool', + help: 'Output raw binary instead of base64' + }, + { + names: ['help', 'h'], + type: 'bool', + help: 'Shows this help text' + } +]; + +var parseOpts = {}; + +if (require.main === module) { + var parser = dashdash.createParser({ + options: options + }); + + try { + var opts = parser.parse(process.argv); + } catch (e) { + console.error('sshpk-sign: error: %s', e.message); + process.exit(1); + } + + if (opts.help || opts._args.length > 1) { + var help = parser.help({}).trimRight(); + console.error('sshpk-sign: sign data using an SSH key\n'); + console.error(help); + process.exit(1); + } + + if (!opts.identity) { + var help = parser.help({}).trimRight(); + console.error('sshpk-sign: the -i or --identity option ' + + 'is required\n'); + console.error(help); + process.exit(1); + } + + var keyData = fs.readFileSync(opts.identity); + parseOpts.filename = opts.identity; + + run(); +} + +function run() { + var key; + try { + key = sshpk.parsePrivateKey(keyData, 'auto', parseOpts); + } catch (e) { + if (e.name === 'KeyEncryptedError') { + getPassword(function (err, pw) { + parseOpts.passphrase = pw; + run(); + }); + return; + } + console.error('sshpk-sign: error loading private key "' + + opts.identity + '": ' + e.name + ': ' + e.message); + process.exit(1); + } + + var hash = opts.hash || key.defaultHashAlgorithm(); + + var signer; + try { + signer = key.createSign(hash); + } catch (e) { + console.error('sshpk-sign: error creating signer: ' + + e.name + ': ' + e.message); + process.exit(1); + } + + if (opts.verbose) { + console.error('sshpk-sign: using %s-%s with a %d bit key', + key.type, hash, key.size); + } + + var inFile = process.stdin; + var inFileName = 'stdin'; + + var inFilePath; + if (opts.file) { + inFilePath = opts.file; + } else if (opts._args.length === 1) { + inFilePath = opts._args[0]; + } + + if (inFilePath) + inFileName = path.basename(inFilePath); + + try { + if (inFilePath) { + fs.accessSync(inFilePath, fs.R_OK); + inFile = fs.createReadStream(inFilePath); + } + } catch (e) { + console.error('sshpk-sign: error opening input file' + + ': ' + e.name + ': ' + e.message); + process.exit(1); + } + + var outFile = process.stdout; + + try { + if (opts.out && !opts.identify) { + fs.accessSync(path.dirname(opts.out), fs.W_OK); + outFile = fs.createWriteStream(opts.out); + } + } catch (e) { + console.error('sshpk-sign: error opening output file' + + ': ' + e.name + ': ' + e.message); + process.exit(1); + } + + inFile.pipe(signer); + inFile.on('end', function () { + var sig; + try { + sig = signer.sign(); + } catch (e) { + console.error('sshpk-sign: error signing data: ' + + e.name + ': ' + e.message); + process.exit(1); + } + + var fmt = opts.format || 'asn1'; + var output; + try { + output = sig.toBuffer(fmt); + if (!opts.binary) + output = output.toString('base64'); + } catch (e) { + console.error('sshpk-sign: error converting signature' + + ' to ' + fmt + ' format: ' + e.name + ': ' + + e.message); + process.exit(1); + } + + outFile.write(output); + if (!opts.binary) + outFile.write('\n'); + outFile.once('drain', function () { + process.exit(0); + }); + }); +} diff --git a/appasar/canary/node_modules/sshpk/bin/sshpk-verify b/appasar/canary/node_modules/sshpk/bin/sshpk-verify new file mode 100644 index 0000000..a1669f4 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/bin/sshpk-verify @@ -0,0 +1,166 @@ +#!/usr/bin/env node +// -*- mode: js -*- +// vim: set filetype=javascript : +// Copyright 2015 Joyent, Inc. All rights reserved. + +var dashdash = require('dashdash'); +var sshpk = require('../lib/index'); +var fs = require('fs'); +var path = require('path'); + +var options = [ + { + names: ['hash', 'H'], + type: 'string', + help: 'Hash algorithm (sha1, sha256, sha384, sha512)' + }, + { + names: ['verbose', 'v'], + type: 'bool', + help: 'Display verbose info about key and hash used' + }, + { + names: ['identity', 'i'], + type: 'string', + help: 'Path to (public) key to use' + }, + { + names: ['file', 'f'], + type: 'string', + help: 'Input filename' + }, + { + names: ['format', 't'], + type: 'string', + help: 'Signature format (asn1, ssh, raw)' + }, + { + names: ['signature', 's'], + type: 'string', + help: 'base64-encoded signature data' + }, + { + names: ['help', 'h'], + type: 'bool', + help: 'Shows this help text' + } +]; + +if (require.main === module) { + var parser = dashdash.createParser({ + options: options + }); + + try { + var opts = parser.parse(process.argv); + } catch (e) { + console.error('sshpk-verify: error: %s', e.message); + process.exit(3); + } + + if (opts.help || opts._args.length > 1) { + var help = parser.help({}).trimRight(); + console.error('sshpk-verify: sign data using an SSH key\n'); + console.error(help); + process.exit(3); + } + + if (!opts.identity) { + var help = parser.help({}).trimRight(); + console.error('sshpk-verify: the -i or --identity option ' + + 'is required\n'); + console.error(help); + process.exit(3); + } + + if (!opts.signature) { + var help = parser.help({}).trimRight(); + console.error('sshpk-verify: the -s or --signature option ' + + 'is required\n'); + console.error(help); + process.exit(3); + } + + var keyData = fs.readFileSync(opts.identity); + + var key; + try { + key = sshpk.parseKey(keyData); + } catch (e) { + console.error('sshpk-verify: error loading key "' + + opts.identity + '": ' + e.name + ': ' + e.message); + process.exit(2); + } + + var fmt = opts.format || 'asn1'; + var sigData = new Buffer(opts.signature, 'base64'); + + var sig; + try { + sig = sshpk.parseSignature(sigData, key.type, fmt); + } catch (e) { + console.error('sshpk-verify: error parsing signature: ' + + e.name + ': ' + e.message); + process.exit(2); + } + + var hash = opts.hash || key.defaultHashAlgorithm(); + + var verifier; + try { + verifier = key.createVerify(hash); + } catch (e) { + console.error('sshpk-verify: error creating verifier: ' + + e.name + ': ' + e.message); + process.exit(2); + } + + if (opts.verbose) { + console.error('sshpk-verify: using %s-%s with a %d bit key', + key.type, hash, key.size); + } + + var inFile = process.stdin; + var inFileName = 'stdin'; + + var inFilePath; + if (opts.file) { + inFilePath = opts.file; + } else if (opts._args.length === 1) { + inFilePath = opts._args[0]; + } + + if (inFilePath) + inFileName = path.basename(inFilePath); + + try { + if (inFilePath) { + fs.accessSync(inFilePath, fs.R_OK); + inFile = fs.createReadStream(inFilePath); + } + } catch (e) { + console.error('sshpk-verify: error opening input file' + + ': ' + e.name + ': ' + e.message); + process.exit(2); + } + + inFile.pipe(verifier); + inFile.on('end', function () { + var ret; + try { + ret = verifier.verify(sig); + } catch (e) { + console.error('sshpk-verify: error verifying data: ' + + e.name + ': ' + e.message); + process.exit(1); + } + + if (ret) { + console.error('OK'); + process.exit(0); + } + + console.error('NOT OK'); + process.exit(1); + }); +} diff --git a/appasar/canary/node_modules/sshpk/lib/algs.js b/appasar/canary/node_modules/sshpk/lib/algs.js new file mode 100644 index 0000000..f30af56 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/algs.js @@ -0,0 +1,168 @@ +// Copyright 2015 Joyent, Inc. + +var algInfo = { + 'dsa': { + parts: ['p', 'q', 'g', 'y'], + sizePart: 'p' + }, + 'rsa': { + parts: ['e', 'n'], + sizePart: 'n' + }, + 'ecdsa': { + parts: ['curve', 'Q'], + sizePart: 'Q' + }, + 'ed25519': { + parts: ['R'], + normalize: false, + sizePart: 'R' + } +}; +algInfo['curve25519'] = algInfo['ed25519']; + +var algPrivInfo = { + 'dsa': { + parts: ['p', 'q', 'g', 'y', 'x'] + }, + 'rsa': { + parts: ['n', 'e', 'd', 'iqmp', 'p', 'q'] + }, + 'ecdsa': { + parts: ['curve', 'Q', 'd'] + }, + 'ed25519': { + parts: ['R', 'r'], + normalize: false + } +}; +algPrivInfo['curve25519'] = algPrivInfo['ed25519']; + +var hashAlgs = { + 'md5': true, + 'sha1': true, + 'sha256': true, + 'sha384': true, + 'sha512': true +}; + +/* + * Taken from + * http://csrc.nist.gov/groups/ST/toolkit/documents/dss/NISTReCur.pdf + */ +var curves = { + 'nistp256': { + size: 256, + pkcs8oid: '1.2.840.10045.3.1.7', + p: new Buffer(('00' + + 'ffffffff 00000001 00000000 00000000' + + '00000000 ffffffff ffffffff ffffffff'). + replace(/ /g, ''), 'hex'), + a: new Buffer(('00' + + 'FFFFFFFF 00000001 00000000 00000000' + + '00000000 FFFFFFFF FFFFFFFF FFFFFFFC'). + replace(/ /g, ''), 'hex'), + b: new Buffer(( + '5ac635d8 aa3a93e7 b3ebbd55 769886bc' + + '651d06b0 cc53b0f6 3bce3c3e 27d2604b'). + replace(/ /g, ''), 'hex'), + s: new Buffer(('00' + + 'c49d3608 86e70493 6a6678e1 139d26b7' + + '819f7e90'). + replace(/ /g, ''), 'hex'), + n: new Buffer(('00' + + 'ffffffff 00000000 ffffffff ffffffff' + + 'bce6faad a7179e84 f3b9cac2 fc632551'). + replace(/ /g, ''), 'hex'), + G: new Buffer(('04' + + '6b17d1f2 e12c4247 f8bce6e5 63a440f2' + + '77037d81 2deb33a0 f4a13945 d898c296' + + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16' + + '2bce3357 6b315ece cbb64068 37bf51f5'). + replace(/ /g, ''), 'hex') + }, + 'nistp384': { + size: 384, + pkcs8oid: '1.3.132.0.34', + p: new Buffer(('00' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff fffffffe' + + 'ffffffff 00000000 00000000 ffffffff'). + replace(/ /g, ''), 'hex'), + a: new Buffer(('00' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE' + + 'FFFFFFFF 00000000 00000000 FFFFFFFC'). + replace(/ /g, ''), 'hex'), + b: new Buffer(( + 'b3312fa7 e23ee7e4 988e056b e3f82d19' + + '181d9c6e fe814112 0314088f 5013875a' + + 'c656398d 8a2ed19d 2a85c8ed d3ec2aef'). + replace(/ /g, ''), 'hex'), + s: new Buffer(('00' + + 'a335926a a319a27a 1d00896a 6773a482' + + '7acdac73'). + replace(/ /g, ''), 'hex'), + n: new Buffer(('00' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff c7634d81 f4372ddf' + + '581a0db2 48b0a77a ecec196a ccc52973'). + replace(/ /g, ''), 'hex'), + G: new Buffer(('04' + + 'aa87ca22 be8b0537 8eb1c71e f320ad74' + + '6e1d3b62 8ba79b98 59f741e0 82542a38' + + '5502f25d bf55296c 3a545e38 72760ab7' + + '3617de4a 96262c6f 5d9e98bf 9292dc29' + + 'f8f41dbd 289a147c e9da3113 b5f0b8c0' + + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'). + replace(/ /g, ''), 'hex') + }, + 'nistp521': { + size: 521, + pkcs8oid: '1.3.132.0.35', + p: new Buffer(( + '01ffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffff').replace(/ /g, ''), 'hex'), + a: new Buffer(('01FF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF' + + 'FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFC'). + replace(/ /g, ''), 'hex'), + b: new Buffer(('51' + + '953eb961 8e1c9a1f 929a21a0 b68540ee' + + 'a2da725b 99b315f3 b8b48991 8ef109e1' + + '56193951 ec7e937b 1652c0bd 3bb1bf07' + + '3573df88 3d2c34f1 ef451fd4 6b503f00'). + replace(/ /g, ''), 'hex'), + s: new Buffer(('00' + + 'd09e8800 291cb853 96cc6717 393284aa' + + 'a0da64ba').replace(/ /g, ''), 'hex'), + n: new Buffer(('01ff' + + 'ffffffff ffffffff ffffffff ffffffff' + + 'ffffffff ffffffff ffffffff fffffffa' + + '51868783 bf2f966b 7fcc0148 f709a5d0' + + '3bb5c9b8 899c47ae bb6fb71e 91386409'). + replace(/ /g, ''), 'hex'), + G: new Buffer(('04' + + '00c6 858e06b7 0404e9cd 9e3ecb66 2395b442' + + '9c648139 053fb521 f828af60 6b4d3dba' + + 'a14b5e77 efe75928 fe1dc127 a2ffa8de' + + '3348b3c1 856a429b f97e7e31 c2e5bd66' + + '0118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9' + + '98f54449 579b4468 17afbd17 273e662c' + + '97ee7299 5ef42640 c550b901 3fad0761' + + '353c7086 a272c240 88be9476 9fd16650'). + replace(/ /g, ''), 'hex') + } +}; + +module.exports = { + info: algInfo, + privInfo: algPrivInfo, + hashAlgs: hashAlgs, + curves: curves +}; diff --git a/appasar/canary/node_modules/sshpk/lib/certificate.js b/appasar/canary/node_modules/sshpk/lib/certificate.js new file mode 100644 index 0000000..f6b25c9 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/certificate.js @@ -0,0 +1,377 @@ +// Copyright 2016 Joyent, Inc. + +module.exports = Certificate; + +var assert = require('assert-plus'); +var algs = require('./algs'); +var crypto = require('crypto'); +var Fingerprint = require('./fingerprint'); +var Signature = require('./signature'); +var errs = require('./errors'); +var util = require('util'); +var utils = require('./utils'); +var Key = require('./key'); +var PrivateKey = require('./private-key'); +var Identity = require('./identity'); + +var formats = {}; +formats['openssh'] = require('./formats/openssh-cert'); +formats['x509'] = require('./formats/x509'); +formats['pem'] = require('./formats/x509-pem'); + +var CertificateParseError = errs.CertificateParseError; +var InvalidAlgorithmError = errs.InvalidAlgorithmError; + +function Certificate(opts) { + assert.object(opts, 'options'); + assert.arrayOfObject(opts.subjects, 'options.subjects'); + utils.assertCompatible(opts.subjects[0], Identity, [1, 0], + 'options.subjects'); + utils.assertCompatible(opts.subjectKey, Key, [1, 0], + 'options.subjectKey'); + utils.assertCompatible(opts.issuer, Identity, [1, 0], 'options.issuer'); + if (opts.issuerKey !== undefined) { + utils.assertCompatible(opts.issuerKey, Key, [1, 0], + 'options.issuerKey'); + } + assert.object(opts.signatures, 'options.signatures'); + assert.buffer(opts.serial, 'options.serial'); + assert.date(opts.validFrom, 'options.validFrom'); + assert.date(opts.validUntil, 'optons.validUntil'); + + assert.optionalArrayOfString(opts.purposes, 'options.purposes'); + + this._hashCache = {}; + + this.subjects = opts.subjects; + this.issuer = opts.issuer; + this.subjectKey = opts.subjectKey; + this.issuerKey = opts.issuerKey; + this.signatures = opts.signatures; + this.serial = opts.serial; + this.validFrom = opts.validFrom; + this.validUntil = opts.validUntil; + this.purposes = opts.purposes; +} + +Certificate.formats = formats; + +Certificate.prototype.toBuffer = function (format, options) { + if (format === undefined) + format = 'x509'; + assert.string(format, 'format'); + assert.object(formats[format], 'formats[format]'); + assert.optionalObject(options, 'options'); + + return (formats[format].write(this, options)); +}; + +Certificate.prototype.toString = function (format, options) { + if (format === undefined) + format = 'pem'; + return (this.toBuffer(format, options).toString()); +}; + +Certificate.prototype.fingerprint = function (algo) { + if (algo === undefined) + algo = 'sha256'; + assert.string(algo, 'algorithm'); + var opts = { + type: 'certificate', + hash: this.hash(algo), + algorithm: algo + }; + return (new Fingerprint(opts)); +}; + +Certificate.prototype.hash = function (algo) { + assert.string(algo, 'algorithm'); + algo = algo.toLowerCase(); + if (algs.hashAlgs[algo] === undefined) + throw (new InvalidAlgorithmError(algo)); + + if (this._hashCache[algo]) + return (this._hashCache[algo]); + + var hash = crypto.createHash(algo). + update(this.toBuffer('x509')).digest(); + this._hashCache[algo] = hash; + return (hash); +}; + +Certificate.prototype.isExpired = function (when) { + if (when === undefined) + when = new Date(); + return (!((when.getTime() >= this.validFrom.getTime()) && + (when.getTime() < this.validUntil.getTime()))); +}; + +Certificate.prototype.isSignedBy = function (issuerCert) { + utils.assertCompatible(issuerCert, Certificate, [1, 0], 'issuer'); + + if (!this.issuer.equals(issuerCert.subjects[0])) + return (false); + if (this.issuer.purposes && this.issuer.purposes.length > 0 && + this.issuer.purposes.indexOf('ca') === -1) { + return (false); + } + + return (this.isSignedByKey(issuerCert.subjectKey)); +}; + +Certificate.prototype.isSignedByKey = function (issuerKey) { + utils.assertCompatible(issuerKey, Key, [1, 2], 'issuerKey'); + + if (this.issuerKey !== undefined) { + return (this.issuerKey. + fingerprint('sha512').matches(issuerKey)); + } + + var fmt = Object.keys(this.signatures)[0]; + var valid = formats[fmt].verify(this, issuerKey); + if (valid) + this.issuerKey = issuerKey; + return (valid); +}; + +Certificate.prototype.signWith = function (key) { + utils.assertCompatible(key, PrivateKey, [1, 2], 'key'); + var fmts = Object.keys(formats); + var didOne = false; + for (var i = 0; i < fmts.length; ++i) { + if (fmts[i] !== 'pem') { + var ret = formats[fmts[i]].sign(this, key); + if (ret === true) + didOne = true; + } + } + if (!didOne) { + throw (new Error('Failed to sign the certificate for any ' + + 'available certificate formats')); + } +}; + +Certificate.createSelfSigned = function (subjectOrSubjects, key, options) { + var subjects; + if (Array.isArray(subjectOrSubjects)) + subjects = subjectOrSubjects; + else + subjects = [subjectOrSubjects]; + + assert.arrayOfObject(subjects); + subjects.forEach(function (subject) { + utils.assertCompatible(subject, Identity, [1, 0], 'subject'); + }); + + utils.assertCompatible(key, PrivateKey, [1, 2], 'private key'); + + assert.optionalObject(options, 'options'); + if (options === undefined) + options = {}; + assert.optionalObject(options.validFrom, 'options.validFrom'); + assert.optionalObject(options.validUntil, 'options.validUntil'); + var validFrom = options.validFrom; + var validUntil = options.validUntil; + if (validFrom === undefined) + validFrom = new Date(); + if (validUntil === undefined) { + assert.optionalNumber(options.lifetime, 'options.lifetime'); + var lifetime = options.lifetime; + if (lifetime === undefined) + lifetime = 10*365*24*3600; + validUntil = new Date(); + validUntil.setTime(validUntil.getTime() + lifetime*1000); + } + assert.optionalBuffer(options.serial, 'options.serial'); + var serial = options.serial; + if (serial === undefined) + serial = new Buffer('0000000000000001', 'hex'); + + var purposes = options.purposes; + if (purposes === undefined) + purposes = []; + + if (purposes.indexOf('signature') === -1) + purposes.push('signature'); + + /* Self-signed certs are always CAs. */ + if (purposes.indexOf('ca') === -1) + purposes.push('ca'); + if (purposes.indexOf('crl') === -1) + purposes.push('crl'); + + /* + * If we weren't explicitly given any other purposes, do the sensible + * thing and add some basic ones depending on the subject type. + */ + if (purposes.length <= 3) { + var hostSubjects = subjects.filter(function (subject) { + return (subject.type === 'host'); + }); + var userSubjects = subjects.filter(function (subject) { + return (subject.type === 'user'); + }); + if (hostSubjects.length > 0) { + if (purposes.indexOf('serverAuth') === -1) + purposes.push('serverAuth'); + } + if (userSubjects.length > 0) { + if (purposes.indexOf('clientAuth') === -1) + purposes.push('clientAuth'); + } + if (userSubjects.length > 0 || hostSubjects.length > 0) { + if (purposes.indexOf('keyAgreement') === -1) + purposes.push('keyAgreement'); + if (key.type === 'rsa' && + purposes.indexOf('encryption') === -1) + purposes.push('encryption'); + } + } + + var cert = new Certificate({ + subjects: subjects, + issuer: subjects[0], + subjectKey: key.toPublic(), + issuerKey: key.toPublic(), + signatures: {}, + serial: serial, + validFrom: validFrom, + validUntil: validUntil, + purposes: purposes + }); + cert.signWith(key); + + return (cert); +}; + +Certificate.create = + function (subjectOrSubjects, key, issuer, issuerKey, options) { + var subjects; + if (Array.isArray(subjectOrSubjects)) + subjects = subjectOrSubjects; + else + subjects = [subjectOrSubjects]; + + assert.arrayOfObject(subjects); + subjects.forEach(function (subject) { + utils.assertCompatible(subject, Identity, [1, 0], 'subject'); + }); + + utils.assertCompatible(key, Key, [1, 0], 'key'); + if (PrivateKey.isPrivateKey(key)) + key = key.toPublic(); + utils.assertCompatible(issuer, Identity, [1, 0], 'issuer'); + utils.assertCompatible(issuerKey, PrivateKey, [1, 2], 'issuer key'); + + assert.optionalObject(options, 'options'); + if (options === undefined) + options = {}; + assert.optionalObject(options.validFrom, 'options.validFrom'); + assert.optionalObject(options.validUntil, 'options.validUntil'); + var validFrom = options.validFrom; + var validUntil = options.validUntil; + if (validFrom === undefined) + validFrom = new Date(); + if (validUntil === undefined) { + assert.optionalNumber(options.lifetime, 'options.lifetime'); + var lifetime = options.lifetime; + if (lifetime === undefined) + lifetime = 10*365*24*3600; + validUntil = new Date(); + validUntil.setTime(validUntil.getTime() + lifetime*1000); + } + assert.optionalBuffer(options.serial, 'options.serial'); + var serial = options.serial; + if (serial === undefined) + serial = new Buffer('0000000000000001', 'hex'); + + var purposes = options.purposes; + if (purposes === undefined) + purposes = []; + + if (purposes.indexOf('signature') === -1) + purposes.push('signature'); + + if (options.ca === true) { + if (purposes.indexOf('ca') === -1) + purposes.push('ca'); + if (purposes.indexOf('crl') === -1) + purposes.push('crl'); + } + + var hostSubjects = subjects.filter(function (subject) { + return (subject.type === 'host'); + }); + var userSubjects = subjects.filter(function (subject) { + return (subject.type === 'user'); + }); + if (hostSubjects.length > 0) { + if (purposes.indexOf('serverAuth') === -1) + purposes.push('serverAuth'); + } + if (userSubjects.length > 0) { + if (purposes.indexOf('clientAuth') === -1) + purposes.push('clientAuth'); + } + if (userSubjects.length > 0 || hostSubjects.length > 0) { + if (purposes.indexOf('keyAgreement') === -1) + purposes.push('keyAgreement'); + if (key.type === 'rsa' && + purposes.indexOf('encryption') === -1) + purposes.push('encryption'); + } + + var cert = new Certificate({ + subjects: subjects, + issuer: issuer, + subjectKey: key, + issuerKey: issuerKey.toPublic(), + signatures: {}, + serial: serial, + validFrom: validFrom, + validUntil: validUntil, + purposes: purposes + }); + cert.signWith(issuerKey); + + return (cert); +}; + +Certificate.parse = function (data, format, options) { + if (typeof (data) !== 'string') + assert.buffer(data, 'data'); + if (format === undefined) + format = 'auto'; + assert.string(format, 'format'); + if (typeof (options) === 'string') + options = { filename: options }; + assert.optionalObject(options, 'options'); + if (options === undefined) + options = {}; + assert.optionalString(options.filename, 'options.filename'); + if (options.filename === undefined) + options.filename = '(unnamed)'; + + assert.object(formats[format], 'formats[format]'); + + try { + var k = formats[format].read(data, options); + return (k); + } catch (e) { + throw (new CertificateParseError(options.filename, format, e)); + } +}; + +Certificate.isCertificate = function (obj, ver) { + return (utils.isCompatible(obj, Certificate, ver)); +}; + +/* + * API versions for Certificate: + * [1,0] -- initial ver + */ +Certificate.prototype._sshpkApiVersion = [1, 0]; + +Certificate._oldVersionDetect = function (obj) { + return ([1, 0]); +}; diff --git a/appasar/canary/node_modules/sshpk/lib/dhe.js b/appasar/canary/node_modules/sshpk/lib/dhe.js new file mode 100644 index 0000000..b4d3662 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/dhe.js @@ -0,0 +1,411 @@ +// Copyright 2017 Joyent, Inc. + +module.exports = { + DiffieHellman: DiffieHellman, + generateECDSA: generateECDSA, + generateED25519: generateED25519 +}; + +var assert = require('assert-plus'); +var crypto = require('crypto'); +var algs = require('./algs'); +var utils = require('./utils'); +var nacl; + +var Key = require('./key'); +var PrivateKey = require('./private-key'); + +var CRYPTO_HAVE_ECDH = (crypto.createECDH !== undefined); + +var ecdh, ec, jsbn; + +function DiffieHellman(key) { + utils.assertCompatible(key, Key, [1, 4], 'key'); + this._isPriv = PrivateKey.isPrivateKey(key, [1, 3]); + this._algo = key.type; + this._curve = key.curve; + this._key = key; + if (key.type === 'dsa') { + if (!CRYPTO_HAVE_ECDH) { + throw (new Error('Due to bugs in the node 0.10 ' + + 'crypto API, node 0.12.x or later is required ' + + 'to use DH')); + } + this._dh = crypto.createDiffieHellman( + key.part.p.data, undefined, + key.part.g.data, undefined); + this._p = key.part.p; + this._g = key.part.g; + if (this._isPriv) + this._dh.setPrivateKey(key.part.x.data); + this._dh.setPublicKey(key.part.y.data); + + } else if (key.type === 'ecdsa') { + if (!CRYPTO_HAVE_ECDH) { + if (ecdh === undefined) + ecdh = require('ecc-jsbn'); + if (ec === undefined) + ec = require('ecc-jsbn/lib/ec'); + if (jsbn === undefined) + jsbn = require('jsbn').BigInteger; + + this._ecParams = new X9ECParameters(this._curve); + + if (this._isPriv) { + this._priv = new ECPrivate( + this._ecParams, key.part.d.data); + } + return; + } + + var curve = { + 'nistp256': 'prime256v1', + 'nistp384': 'secp384r1', + 'nistp521': 'secp521r1' + }[key.curve]; + this._dh = crypto.createECDH(curve); + if (typeof (this._dh) !== 'object' || + typeof (this._dh.setPrivateKey) !== 'function') { + CRYPTO_HAVE_ECDH = false; + DiffieHellman.call(this, key); + return; + } + if (this._isPriv) + this._dh.setPrivateKey(key.part.d.data); + this._dh.setPublicKey(key.part.Q.data); + + } else if (key.type === 'curve25519') { + if (nacl === undefined) + nacl = require('tweetnacl'); + + if (this._isPriv) { + this._priv = key.part.r.data; + } + + } else { + throw (new Error('DH not supported for ' + key.type + ' keys')); + } +} + +DiffieHellman.prototype.getPublicKey = function () { + if (this._isPriv) + return (this._key.toPublic()); + return (this._key); +}; + +DiffieHellman.prototype.getPrivateKey = function () { + if (this._isPriv) + return (this._key); + else + return (undefined); +}; +DiffieHellman.prototype.getKey = DiffieHellman.prototype.getPrivateKey; + +DiffieHellman.prototype._keyCheck = function (pk, isPub) { + assert.object(pk, 'key'); + if (!isPub) + utils.assertCompatible(pk, PrivateKey, [1, 3], 'key'); + utils.assertCompatible(pk, Key, [1, 4], 'key'); + + if (pk.type !== this._algo) { + throw (new Error('A ' + pk.type + ' key cannot be used in ' + + this._algo + ' Diffie-Hellman')); + } + + if (pk.curve !== this._curve) { + throw (new Error('A key from the ' + pk.curve + ' curve ' + + 'cannot be used with a ' + this._curve + + ' Diffie-Hellman')); + } + + if (pk.type === 'dsa') { + assert.deepEqual(pk.part.p, this._p, + 'DSA key prime does not match'); + assert.deepEqual(pk.part.g, this._g, + 'DSA key generator does not match'); + } +}; + +DiffieHellman.prototype.setKey = function (pk) { + this._keyCheck(pk); + + if (pk.type === 'dsa') { + this._dh.setPrivateKey(pk.part.x.data); + this._dh.setPublicKey(pk.part.y.data); + + } else if (pk.type === 'ecdsa') { + if (CRYPTO_HAVE_ECDH) { + this._dh.setPrivateKey(pk.part.d.data); + this._dh.setPublicKey(pk.part.Q.data); + } else { + this._priv = new ECPrivate( + this._ecParams, pk.part.d.data); + } + + } else if (pk.type === 'curve25519') { + this._priv = pk.part.r.data; + if (this._priv[0] === 0x00) + this._priv = this._priv.slice(1); + this._priv = this._priv.slice(0, 32); + } + this._key = pk; + this._isPriv = true; +}; +DiffieHellman.prototype.setPrivateKey = DiffieHellman.prototype.setKey; + +DiffieHellman.prototype.computeSecret = function (otherpk) { + this._keyCheck(otherpk, true); + if (!this._isPriv) + throw (new Error('DH exchange has not been initialized with ' + + 'a private key yet')); + + var pub; + if (this._algo === 'dsa') { + return (this._dh.computeSecret( + otherpk.part.y.data)); + + } else if (this._algo === 'ecdsa') { + if (CRYPTO_HAVE_ECDH) { + return (this._dh.computeSecret( + otherpk.part.Q.data)); + } else { + pub = new ECPublic( + this._ecParams, otherpk.part.Q.data); + return (this._priv.deriveSharedSecret(pub)); + } + + } else if (this._algo === 'curve25519') { + pub = otherpk.part.R.data; + while (pub[0] === 0x00 && pub.length > 32) + pub = pub.slice(1); + assert.strictEqual(pub.length, 32); + assert.strictEqual(this._priv.length, 64); + + var priv = this._priv.slice(0, 32); + + var secret = nacl.box.before(new Uint8Array(pub), + new Uint8Array(priv)); + + return (new Buffer(secret)); + } + + throw (new Error('Invalid algorithm: ' + this._algo)); +}; + +DiffieHellman.prototype.generateKey = function () { + var parts = []; + var priv, pub; + if (this._algo === 'dsa') { + this._dh.generateKeys(); + + parts.push({name: 'p', data: this._p.data}); + parts.push({name: 'q', data: this._key.part.q.data}); + parts.push({name: 'g', data: this._g.data}); + parts.push({name: 'y', data: this._dh.getPublicKey()}); + parts.push({name: 'x', data: this._dh.getPrivateKey()}); + this._key = new PrivateKey({ + type: 'dsa', + parts: parts + }); + this._isPriv = true; + return (this._key); + + } else if (this._algo === 'ecdsa') { + if (CRYPTO_HAVE_ECDH) { + this._dh.generateKeys(); + + parts.push({name: 'curve', + data: new Buffer(this._curve)}); + parts.push({name: 'Q', data: this._dh.getPublicKey()}); + parts.push({name: 'd', data: this._dh.getPrivateKey()}); + this._key = new PrivateKey({ + type: 'ecdsa', + curve: this._curve, + parts: parts + }); + this._isPriv = true; + return (this._key); + + } else { + var n = this._ecParams.getN(); + var r = new jsbn(crypto.randomBytes(n.bitLength())); + var n1 = n.subtract(jsbn.ONE); + priv = r.mod(n1).add(jsbn.ONE); + pub = this._ecParams.getG().multiply(priv); + + priv = new Buffer(priv.toByteArray()); + pub = new Buffer(this._ecParams.getCurve(). + encodePointHex(pub), 'hex'); + + this._priv = new ECPrivate(this._ecParams, priv); + + parts.push({name: 'curve', + data: new Buffer(this._curve)}); + parts.push({name: 'Q', data: pub}); + parts.push({name: 'd', data: priv}); + + this._key = new PrivateKey({ + type: 'ecdsa', + curve: this._curve, + parts: parts + }); + this._isPriv = true; + return (this._key); + } + + } else if (this._algo === 'curve25519') { + var pair = nacl.box.keyPair(); + priv = new Buffer(pair.secretKey); + pub = new Buffer(pair.publicKey); + priv = Buffer.concat([priv, pub]); + assert.strictEqual(priv.length, 64); + assert.strictEqual(pub.length, 32); + + parts.push({name: 'R', data: pub}); + parts.push({name: 'r', data: priv}); + this._key = new PrivateKey({ + type: 'curve25519', + parts: parts + }); + this._isPriv = true; + return (this._key); + } + + throw (new Error('Invalid algorithm: ' + this._algo)); +}; +DiffieHellman.prototype.generateKeys = DiffieHellman.prototype.generateKey; + +/* These are helpers for using ecc-jsbn (for node 0.10 compatibility). */ + +function X9ECParameters(name) { + var params = algs.curves[name]; + assert.object(params); + + var p = new jsbn(params.p); + var a = new jsbn(params.a); + var b = new jsbn(params.b); + var n = new jsbn(params.n); + var h = jsbn.ONE; + var curve = new ec.ECCurveFp(p, a, b); + var G = curve.decodePointHex(params.G.toString('hex')); + + this.curve = curve; + this.g = G; + this.n = n; + this.h = h; +} +X9ECParameters.prototype.getCurve = function () { return (this.curve); }; +X9ECParameters.prototype.getG = function () { return (this.g); }; +X9ECParameters.prototype.getN = function () { return (this.n); }; +X9ECParameters.prototype.getH = function () { return (this.h); }; + +function ECPublic(params, buffer) { + this._params = params; + if (buffer[0] === 0x00) + buffer = buffer.slice(1); + this._pub = params.getCurve().decodePointHex(buffer.toString('hex')); +} + +function ECPrivate(params, buffer) { + this._params = params; + this._priv = new jsbn(utils.mpNormalize(buffer)); +} +ECPrivate.prototype.deriveSharedSecret = function (pubKey) { + assert.ok(pubKey instanceof ECPublic); + var S = pubKey._pub.multiply(this._priv); + return (new Buffer(S.getX().toBigInteger().toByteArray())); +}; + +function generateED25519() { + if (nacl === undefined) + nacl = require('tweetnacl'); + + var pair = nacl.sign.keyPair(); + var priv = new Buffer(pair.secretKey); + var pub = new Buffer(pair.publicKey); + assert.strictEqual(priv.length, 64); + assert.strictEqual(pub.length, 32); + + var parts = []; + parts.push({name: 'R', data: pub}); + parts.push({name: 'r', data: priv}); + var key = new PrivateKey({ + type: 'ed25519', + parts: parts + }); + return (key); +} + +/* Generates a new ECDSA private key on a given curve. */ +function generateECDSA(curve) { + var parts = []; + var key; + + if (CRYPTO_HAVE_ECDH) { + /* + * Node crypto doesn't expose key generation directly, but the + * ECDH instances can generate keys. It turns out this just + * calls into the OpenSSL generic key generator, and we can + * read its output happily without doing an actual DH. So we + * use that here. + */ + var osCurve = { + 'nistp256': 'prime256v1', + 'nistp384': 'secp384r1', + 'nistp521': 'secp521r1' + }[curve]; + + var dh = crypto.createECDH(osCurve); + dh.generateKeys(); + + parts.push({name: 'curve', + data: new Buffer(curve)}); + parts.push({name: 'Q', data: dh.getPublicKey()}); + parts.push({name: 'd', data: dh.getPrivateKey()}); + + key = new PrivateKey({ + type: 'ecdsa', + curve: curve, + parts: parts + }); + return (key); + + } else { + if (ecdh === undefined) + ecdh = require('ecc-jsbn'); + if (ec === undefined) + ec = require('ecc-jsbn/lib/ec'); + if (jsbn === undefined) + jsbn = require('jsbn').BigInteger; + + var ecParams = new X9ECParameters(curve); + + /* This algorithm taken from FIPS PUB 186-4 (section B.4.1) */ + var n = ecParams.getN(); + /* + * The crypto.randomBytes() function can only give us whole + * bytes, so taking a nod from X9.62, we round up. + */ + var cByteLen = Math.ceil((n.bitLength() + 64) / 8); + var c = new jsbn(crypto.randomBytes(cByteLen)); + + var n1 = n.subtract(jsbn.ONE); + var priv = c.mod(n1).add(jsbn.ONE); + var pub = ecParams.getG().multiply(priv); + + priv = new Buffer(priv.toByteArray()); + pub = new Buffer(ecParams.getCurve(). + encodePointHex(pub), 'hex'); + + parts.push({name: 'curve', data: new Buffer(curve)}); + parts.push({name: 'Q', data: pub}); + parts.push({name: 'd', data: priv}); + + key = new PrivateKey({ + type: 'ecdsa', + curve: curve, + parts: parts + }); + return (key); + } +} diff --git a/appasar/canary/node_modules/sshpk/lib/ed-compat.js b/appasar/canary/node_modules/sshpk/lib/ed-compat.js new file mode 100644 index 0000000..5365fb1 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/ed-compat.js @@ -0,0 +1,96 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + Verifier: Verifier, + Signer: Signer +}; + +var nacl; +var stream = require('stream'); +var util = require('util'); +var assert = require('assert-plus'); +var Signature = require('./signature'); + +function Verifier(key, hashAlgo) { + if (nacl === undefined) + nacl = require('tweetnacl'); + + if (hashAlgo.toLowerCase() !== 'sha512') + throw (new Error('ED25519 only supports the use of ' + + 'SHA-512 hashes')); + + this.key = key; + this.chunks = []; + + stream.Writable.call(this, {}); +} +util.inherits(Verifier, stream.Writable); + +Verifier.prototype._write = function (chunk, enc, cb) { + this.chunks.push(chunk); + cb(); +}; + +Verifier.prototype.update = function (chunk) { + if (typeof (chunk) === 'string') + chunk = new Buffer(chunk, 'binary'); + this.chunks.push(chunk); +}; + +Verifier.prototype.verify = function (signature, fmt) { + var sig; + if (Signature.isSignature(signature, [2, 0])) { + if (signature.type !== 'ed25519') + return (false); + sig = signature.toBuffer('raw'); + + } else if (typeof (signature) === 'string') { + sig = new Buffer(signature, 'base64'); + + } else if (Signature.isSignature(signature, [1, 0])) { + throw (new Error('signature was created by too old ' + + 'a version of sshpk and cannot be verified')); + } + + assert.buffer(sig); + return (nacl.sign.detached.verify( + new Uint8Array(Buffer.concat(this.chunks)), + new Uint8Array(sig), + new Uint8Array(this.key.part.R.data))); +}; + +function Signer(key, hashAlgo) { + if (nacl === undefined) + nacl = require('tweetnacl'); + + if (hashAlgo.toLowerCase() !== 'sha512') + throw (new Error('ED25519 only supports the use of ' + + 'SHA-512 hashes')); + + this.key = key; + this.chunks = []; + + stream.Writable.call(this, {}); +} +util.inherits(Signer, stream.Writable); + +Signer.prototype._write = function (chunk, enc, cb) { + this.chunks.push(chunk); + cb(); +}; + +Signer.prototype.update = function (chunk) { + if (typeof (chunk) === 'string') + chunk = new Buffer(chunk, 'binary'); + this.chunks.push(chunk); +}; + +Signer.prototype.sign = function () { + var sig = nacl.sign.detached( + new Uint8Array(Buffer.concat(this.chunks)), + new Uint8Array(this.key.part.r.data)); + var sigBuf = new Buffer(sig); + var sigObj = Signature.parse(sigBuf, 'ed25519', 'raw'); + sigObj.hashAlgorithm = 'sha512'; + return (sigObj); +}; diff --git a/appasar/canary/node_modules/sshpk/lib/errors.js b/appasar/canary/node_modules/sshpk/lib/errors.js new file mode 100644 index 0000000..1cc09ec --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/errors.js @@ -0,0 +1,84 @@ +// Copyright 2015 Joyent, Inc. + +var assert = require('assert-plus'); +var util = require('util'); + +function FingerprintFormatError(fp, format) { + if (Error.captureStackTrace) + Error.captureStackTrace(this, FingerprintFormatError); + this.name = 'FingerprintFormatError'; + this.fingerprint = fp; + this.format = format; + this.message = 'Fingerprint format is not supported, or is invalid: '; + if (fp !== undefined) + this.message += ' fingerprint = ' + fp; + if (format !== undefined) + this.message += ' format = ' + format; +} +util.inherits(FingerprintFormatError, Error); + +function InvalidAlgorithmError(alg) { + if (Error.captureStackTrace) + Error.captureStackTrace(this, InvalidAlgorithmError); + this.name = 'InvalidAlgorithmError'; + this.algorithm = alg; + this.message = 'Algorithm "' + alg + '" is not supported'; +} +util.inherits(InvalidAlgorithmError, Error); + +function KeyParseError(name, format, innerErr) { + if (Error.captureStackTrace) + Error.captureStackTrace(this, KeyParseError); + this.name = 'KeyParseError'; + this.format = format; + this.keyName = name; + this.innerErr = innerErr; + this.message = 'Failed to parse ' + name + ' as a valid ' + format + + ' format key: ' + innerErr.message; +} +util.inherits(KeyParseError, Error); + +function SignatureParseError(type, format, innerErr) { + if (Error.captureStackTrace) + Error.captureStackTrace(this, SignatureParseError); + this.name = 'SignatureParseError'; + this.type = type; + this.format = format; + this.innerErr = innerErr; + this.message = 'Failed to parse the given data as a ' + type + + ' signature in ' + format + ' format: ' + innerErr.message; +} +util.inherits(SignatureParseError, Error); + +function CertificateParseError(name, format, innerErr) { + if (Error.captureStackTrace) + Error.captureStackTrace(this, CertificateParseError); + this.name = 'CertificateParseError'; + this.format = format; + this.certName = name; + this.innerErr = innerErr; + this.message = 'Failed to parse ' + name + ' as a valid ' + format + + ' format certificate: ' + innerErr.message; +} +util.inherits(CertificateParseError, Error); + +function KeyEncryptedError(name, format) { + if (Error.captureStackTrace) + Error.captureStackTrace(this, KeyEncryptedError); + this.name = 'KeyEncryptedError'; + this.format = format; + this.keyName = name; + this.message = 'The ' + format + ' format key ' + name + ' is ' + + 'encrypted (password-protected), and no passphrase was ' + + 'provided in `options`'; +} +util.inherits(KeyEncryptedError, Error); + +module.exports = { + FingerprintFormatError: FingerprintFormatError, + InvalidAlgorithmError: InvalidAlgorithmError, + KeyParseError: KeyParseError, + SignatureParseError: SignatureParseError, + KeyEncryptedError: KeyEncryptedError, + CertificateParseError: CertificateParseError +}; diff --git a/appasar/canary/node_modules/sshpk/lib/fingerprint.js b/appasar/canary/node_modules/sshpk/lib/fingerprint.js new file mode 100644 index 0000000..7ed7e51 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/fingerprint.js @@ -0,0 +1,161 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = Fingerprint; + +var assert = require('assert-plus'); +var algs = require('./algs'); +var crypto = require('crypto'); +var errs = require('./errors'); +var Key = require('./key'); +var Certificate = require('./certificate'); +var utils = require('./utils'); + +var FingerprintFormatError = errs.FingerprintFormatError; +var InvalidAlgorithmError = errs.InvalidAlgorithmError; + +function Fingerprint(opts) { + assert.object(opts, 'options'); + assert.string(opts.type, 'options.type'); + assert.buffer(opts.hash, 'options.hash'); + assert.string(opts.algorithm, 'options.algorithm'); + + this.algorithm = opts.algorithm.toLowerCase(); + if (algs.hashAlgs[this.algorithm] !== true) + throw (new InvalidAlgorithmError(this.algorithm)); + + this.hash = opts.hash; + this.type = opts.type; +} + +Fingerprint.prototype.toString = function (format) { + if (format === undefined) { + if (this.algorithm === 'md5') + format = 'hex'; + else + format = 'base64'; + } + assert.string(format); + + switch (format) { + case 'hex': + return (addColons(this.hash.toString('hex'))); + case 'base64': + return (sshBase64Format(this.algorithm, + this.hash.toString('base64'))); + default: + throw (new FingerprintFormatError(undefined, format)); + } +}; + +Fingerprint.prototype.matches = function (other) { + assert.object(other, 'key or certificate'); + if (this.type === 'key') { + utils.assertCompatible(other, Key, [1, 0], 'key'); + } else { + utils.assertCompatible(other, Certificate, [1, 0], + 'certificate'); + } + + var theirHash = other.hash(this.algorithm); + var theirHash2 = crypto.createHash(this.algorithm). + update(theirHash).digest('base64'); + + if (this.hash2 === undefined) + this.hash2 = crypto.createHash(this.algorithm). + update(this.hash).digest('base64'); + + return (this.hash2 === theirHash2); +}; + +Fingerprint.parse = function (fp, options) { + assert.string(fp, 'fingerprint'); + + var alg, hash, enAlgs; + if (Array.isArray(options)) { + enAlgs = options; + options = {}; + } + assert.optionalObject(options, 'options'); + if (options === undefined) + options = {}; + if (options.enAlgs !== undefined) + enAlgs = options.enAlgs; + assert.optionalArrayOfString(enAlgs, 'algorithms'); + + var parts = fp.split(':'); + if (parts.length == 2) { + alg = parts[0].toLowerCase(); + /*JSSTYLED*/ + var base64RE = /^[A-Za-z0-9+\/=]+$/; + if (!base64RE.test(parts[1])) + throw (new FingerprintFormatError(fp)); + try { + hash = new Buffer(parts[1], 'base64'); + } catch (e) { + throw (new FingerprintFormatError(fp)); + } + } else if (parts.length > 2) { + alg = 'md5'; + if (parts[0].toLowerCase() === 'md5') + parts = parts.slice(1); + parts = parts.join(''); + /*JSSTYLED*/ + var md5RE = /^[a-fA-F0-9]+$/; + if (!md5RE.test(parts)) + throw (new FingerprintFormatError(fp)); + try { + hash = new Buffer(parts, 'hex'); + } catch (e) { + throw (new FingerprintFormatError(fp)); + } + } + + if (alg === undefined) + throw (new FingerprintFormatError(fp)); + + if (algs.hashAlgs[alg] === undefined) + throw (new InvalidAlgorithmError(alg)); + + if (enAlgs !== undefined) { + enAlgs = enAlgs.map(function (a) { return a.toLowerCase(); }); + if (enAlgs.indexOf(alg) === -1) + throw (new InvalidAlgorithmError(alg)); + } + + return (new Fingerprint({ + algorithm: alg, + hash: hash, + type: options.type || 'key' + })); +}; + +function addColons(s) { + /*JSSTYLED*/ + return (s.replace(/(.{2})(?=.)/g, '$1:')); +} + +function base64Strip(s) { + /*JSSTYLED*/ + return (s.replace(/=*$/, '')); +} + +function sshBase64Format(alg, h) { + return (alg.toUpperCase() + ':' + base64Strip(h)); +} + +Fingerprint.isFingerprint = function (obj, ver) { + return (utils.isCompatible(obj, Fingerprint, ver)); +}; + +/* + * API versions for Fingerprint: + * [1,0] -- initial ver + * [1,1] -- first tagged ver + */ +Fingerprint.prototype._sshpkApiVersion = [1, 1]; + +Fingerprint._oldVersionDetect = function (obj) { + assert.func(obj.toString); + assert.func(obj.matches); + return ([1, 0]); +}; diff --git a/appasar/canary/node_modules/sshpk/lib/formats/auto.js b/appasar/canary/node_modules/sshpk/lib/formats/auto.js new file mode 100644 index 0000000..973c032 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/auto.js @@ -0,0 +1,73 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + read: read, + write: write +}; + +var assert = require('assert-plus'); +var utils = require('../utils'); +var Key = require('../key'); +var PrivateKey = require('../private-key'); + +var pem = require('./pem'); +var ssh = require('./ssh'); +var rfc4253 = require('./rfc4253'); + +function read(buf, options) { + if (typeof (buf) === 'string') { + if (buf.trim().match(/^[-]+[ ]*BEGIN/)) + return (pem.read(buf, options)); + if (buf.match(/^\s*ssh-[a-z]/)) + return (ssh.read(buf, options)); + if (buf.match(/^\s*ecdsa-/)) + return (ssh.read(buf, options)); + buf = new Buffer(buf, 'binary'); + } else { + assert.buffer(buf); + if (findPEMHeader(buf)) + return (pem.read(buf, options)); + if (findSSHHeader(buf)) + return (ssh.read(buf, options)); + } + if (buf.readUInt32BE(0) < buf.length) + return (rfc4253.read(buf, options)); + throw (new Error('Failed to auto-detect format of key')); +} + +function findSSHHeader(buf) { + var offset = 0; + while (offset < buf.length && + (buf[offset] === 32 || buf[offset] === 10 || buf[offset] === 9)) + ++offset; + if (offset + 4 <= buf.length && + buf.slice(offset, offset + 4).toString('ascii') === 'ssh-') + return (true); + if (offset + 6 <= buf.length && + buf.slice(offset, offset + 6).toString('ascii') === 'ecdsa-') + return (true); + return (false); +} + +function findPEMHeader(buf) { + var offset = 0; + while (offset < buf.length && + (buf[offset] === 32 || buf[offset] === 10)) + ++offset; + if (buf[offset] !== 45) + return (false); + while (offset < buf.length && + (buf[offset] === 45)) + ++offset; + while (offset < buf.length && + (buf[offset] === 32)) + ++offset; + if (offset + 5 > buf.length || + buf.slice(offset, offset + 5).toString('ascii') !== 'BEGIN') + return (false); + return (true); +} + +function write(key, options) { + throw (new Error('"auto" format cannot be used for writing')); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/openssh-cert.js b/appasar/canary/node_modules/sshpk/lib/formats/openssh-cert.js new file mode 100644 index 0000000..b68155e --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/openssh-cert.js @@ -0,0 +1,322 @@ +// Copyright 2017 Joyent, Inc. + +module.exports = { + read: read, + verify: verify, + sign: sign, + signAsync: signAsync, + write: write, + + /* Internal private API */ + fromBuffer: fromBuffer, + toBuffer: toBuffer +}; + +var assert = require('assert-plus'); +var SSHBuffer = require('../ssh-buffer'); +var crypto = require('crypto'); +var algs = require('../algs'); +var Key = require('../key'); +var PrivateKey = require('../private-key'); +var Identity = require('../identity'); +var rfc4253 = require('./rfc4253'); +var Signature = require('../signature'); +var utils = require('../utils'); +var Certificate = require('../certificate'); + +function verify(cert, key) { + /* + * We always give an issuerKey, so if our verify() is being called then + * there was no signature. Return false. + */ + return (false); +} + +var TYPES = { + 'user': 1, + 'host': 2 +}; +Object.keys(TYPES).forEach(function (k) { TYPES[TYPES[k]] = k; }); + +var ECDSA_ALGO = /^ecdsa-sha2-([^@-]+)-cert-v01@openssh.com$/; + +function read(buf, options) { + if (Buffer.isBuffer(buf)) + buf = buf.toString('ascii'); + var parts = buf.trim().split(/[ \t\n]+/g); + if (parts.length < 2 || parts.length > 3) + throw (new Error('Not a valid SSH certificate line')); + + var algo = parts[0]; + var data = parts[1]; + + data = new Buffer(data, 'base64'); + return (fromBuffer(data, algo)); +} + +function fromBuffer(data, algo, partial) { + var sshbuf = new SSHBuffer({ buffer: data }); + var innerAlgo = sshbuf.readString(); + if (algo !== undefined && innerAlgo !== algo) + throw (new Error('SSH certificate algorithm mismatch')); + if (algo === undefined) + algo = innerAlgo; + + var cert = {}; + cert.signatures = {}; + cert.signatures.openssh = {}; + + cert.signatures.openssh.nonce = sshbuf.readBuffer(); + + var key = {}; + var parts = (key.parts = []); + key.type = getAlg(algo); + + var partCount = algs.info[key.type].parts.length; + while (parts.length < partCount) + parts.push(sshbuf.readPart()); + assert.ok(parts.length >= 1, 'key must have at least one part'); + + var algInfo = algs.info[key.type]; + if (key.type === 'ecdsa') { + var res = ECDSA_ALGO.exec(algo); + assert.ok(res !== null); + assert.strictEqual(res[1], parts[0].data.toString()); + } + + for (var i = 0; i < algInfo.parts.length; ++i) { + parts[i].name = algInfo.parts[i]; + if (parts[i].name !== 'curve' && + algInfo.normalize !== false) { + var p = parts[i]; + p.data = utils.mpNormalize(p.data); + } + } + + cert.subjectKey = new Key(key); + + cert.serial = sshbuf.readInt64(); + + var type = TYPES[sshbuf.readInt()]; + assert.string(type, 'valid cert type'); + + cert.signatures.openssh.keyId = sshbuf.readString(); + + var principals = []; + var pbuf = sshbuf.readBuffer(); + var psshbuf = new SSHBuffer({ buffer: pbuf }); + while (!psshbuf.atEnd()) + principals.push(psshbuf.readString()); + if (principals.length === 0) + principals = ['*']; + + cert.subjects = principals.map(function (pr) { + if (type === 'user') + return (Identity.forUser(pr)); + else if (type === 'host') + return (Identity.forHost(pr)); + throw (new Error('Unknown identity type ' + type)); + }); + + cert.validFrom = int64ToDate(sshbuf.readInt64()); + cert.validUntil = int64ToDate(sshbuf.readInt64()); + + cert.signatures.openssh.critical = sshbuf.readBuffer(); + cert.signatures.openssh.exts = sshbuf.readBuffer(); + + /* reserved */ + sshbuf.readBuffer(); + + var signingKeyBuf = sshbuf.readBuffer(); + cert.issuerKey = rfc4253.read(signingKeyBuf); + + /* + * OpenSSH certs don't give the identity of the issuer, just their + * public key. So, we use an Identity that matches anything. The + * isSignedBy() function will later tell you if the key matches. + */ + cert.issuer = Identity.forHost('**'); + + var sigBuf = sshbuf.readBuffer(); + cert.signatures.openssh.signature = + Signature.parse(sigBuf, cert.issuerKey.type, 'ssh'); + + if (partial !== undefined) { + partial.remainder = sshbuf.remainder(); + partial.consumed = sshbuf._offset; + } + + return (new Certificate(cert)); +} + +function int64ToDate(buf) { + var i = buf.readUInt32BE(0) * 4294967296; + i += buf.readUInt32BE(4); + var d = new Date(); + d.setTime(i * 1000); + d.sourceInt64 = buf; + return (d); +} + +function dateToInt64(date) { + if (date.sourceInt64 !== undefined) + return (date.sourceInt64); + var i = Math.round(date.getTime() / 1000); + var upper = Math.floor(i / 4294967296); + var lower = Math.floor(i % 4294967296); + var buf = new Buffer(8); + buf.writeUInt32BE(upper, 0); + buf.writeUInt32BE(lower, 4); + return (buf); +} + +function sign(cert, key) { + if (cert.signatures.openssh === undefined) + cert.signatures.openssh = {}; + try { + var blob = toBuffer(cert, true); + } catch (e) { + delete (cert.signatures.openssh); + return (false); + } + var sig = cert.signatures.openssh; + var hashAlgo = undefined; + if (key.type === 'rsa' || key.type === 'dsa') + hashAlgo = 'sha1'; + var signer = key.createSign(hashAlgo); + signer.write(blob); + sig.signature = signer.sign(); + return (true); +} + +function signAsync(cert, signer, done) { + if (cert.signatures.openssh === undefined) + cert.signatures.openssh = {}; + try { + var blob = toBuffer(cert, true); + } catch (e) { + delete (cert.signatures.openssh); + done(e); + return; + } + var sig = cert.signatures.openssh; + + signer(blob, function (err, signature) { + if (err) { + done(err); + return; + } + try { + /* + * This will throw if the signature isn't of a + * type/algo that can be used for SSH. + */ + signature.toBuffer('ssh'); + } catch (e) { + done(e); + return; + } + sig.signature = signature; + done(); + }); +} + +function write(cert, options) { + if (options === undefined) + options = {}; + + var blob = toBuffer(cert); + var out = getCertType(cert.subjectKey) + ' ' + blob.toString('base64'); + if (options.comment) + out = out + ' ' + options.comment; + return (out); +} + + +function toBuffer(cert, noSig) { + assert.object(cert.signatures.openssh, 'signature for openssh format'); + var sig = cert.signatures.openssh; + + if (sig.nonce === undefined) + sig.nonce = crypto.randomBytes(16); + var buf = new SSHBuffer({}); + buf.writeString(getCertType(cert.subjectKey)); + buf.writeBuffer(sig.nonce); + + var key = cert.subjectKey; + var algInfo = algs.info[key.type]; + algInfo.parts.forEach(function (part) { + buf.writePart(key.part[part]); + }); + + buf.writeInt64(cert.serial); + + var type = cert.subjects[0].type; + assert.notStrictEqual(type, 'unknown'); + cert.subjects.forEach(function (id) { + assert.strictEqual(id.type, type); + }); + type = TYPES[type]; + buf.writeInt(type); + + if (sig.keyId === undefined) { + sig.keyId = cert.subjects[0].type + '_' + + (cert.subjects[0].uid || cert.subjects[0].hostname); + } + buf.writeString(sig.keyId); + + var sub = new SSHBuffer({}); + cert.subjects.forEach(function (id) { + if (type === TYPES.host) + sub.writeString(id.hostname); + else if (type === TYPES.user) + sub.writeString(id.uid); + }); + buf.writeBuffer(sub.toBuffer()); + + buf.writeInt64(dateToInt64(cert.validFrom)); + buf.writeInt64(dateToInt64(cert.validUntil)); + + if (sig.critical === undefined) + sig.critical = new Buffer(0); + buf.writeBuffer(sig.critical); + + if (sig.exts === undefined) + sig.exts = new Buffer(0); + buf.writeBuffer(sig.exts); + + /* reserved */ + buf.writeBuffer(new Buffer(0)); + + sub = rfc4253.write(cert.issuerKey); + buf.writeBuffer(sub); + + if (!noSig) + buf.writeBuffer(sig.signature.toBuffer('ssh')); + + return (buf.toBuffer()); +} + +function getAlg(certType) { + if (certType === 'ssh-rsa-cert-v01@openssh.com') + return ('rsa'); + if (certType === 'ssh-dss-cert-v01@openssh.com') + return ('dsa'); + if (certType.match(ECDSA_ALGO)) + return ('ecdsa'); + if (certType === 'ssh-ed25519-cert-v01@openssh.com') + return ('ed25519'); + throw (new Error('Unsupported cert type ' + certType)); +} + +function getCertType(key) { + if (key.type === 'rsa') + return ('ssh-rsa-cert-v01@openssh.com'); + if (key.type === 'dsa') + return ('ssh-dss-cert-v01@openssh.com'); + if (key.type === 'ecdsa') + return ('ecdsa-sha2-' + key.curve + '-cert-v01@openssh.com'); + if (key.type === 'ed25519') + return ('ssh-ed25519-cert-v01@openssh.com'); + throw (new Error('Unsupported key type ' + key.type)); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/pem.js b/appasar/canary/node_modules/sshpk/lib/formats/pem.js new file mode 100644 index 0000000..c254e4e --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/pem.js @@ -0,0 +1,186 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + read: read, + write: write +}; + +var assert = require('assert-plus'); +var asn1 = require('asn1'); +var crypto = require('crypto'); +var algs = require('../algs'); +var utils = require('../utils'); +var Key = require('../key'); +var PrivateKey = require('../private-key'); + +var pkcs1 = require('./pkcs1'); +var pkcs8 = require('./pkcs8'); +var sshpriv = require('./ssh-private'); +var rfc4253 = require('./rfc4253'); + +var errors = require('../errors'); + +/* + * For reading we support both PKCS#1 and PKCS#8. If we find a private key, + * we just take the public component of it and use that. + */ +function read(buf, options, forceType) { + var input = buf; + if (typeof (buf) !== 'string') { + assert.buffer(buf, 'buf'); + buf = buf.toString('ascii'); + } + + var lines = buf.trim().split('\n'); + + var m = lines[0].match(/*JSSTYLED*/ + /[-]+[ ]*BEGIN ([A-Z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/); + assert.ok(m, 'invalid PEM header'); + + var m2 = lines[lines.length - 1].match(/*JSSTYLED*/ + /[-]+[ ]*END ([A-Z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/); + assert.ok(m2, 'invalid PEM footer'); + + /* Begin and end banners must match key type */ + assert.equal(m[2], m2[2]); + var type = m[2].toLowerCase(); + + var alg; + if (m[1]) { + /* They also must match algorithms, if given */ + assert.equal(m[1], m2[1], 'PEM header and footer mismatch'); + alg = m[1].trim(); + } + + var headers = {}; + while (true) { + lines = lines.slice(1); + m = lines[0].match(/*JSSTYLED*/ + /^([A-Za-z0-9-]+): (.+)$/); + if (!m) + break; + headers[m[1].toLowerCase()] = m[2]; + } + + var cipher, key, iv; + if (headers['proc-type']) { + var parts = headers['proc-type'].split(','); + if (parts[0] === '4' && parts[1] === 'ENCRYPTED') { + if (typeof (options.passphrase) === 'string') { + options.passphrase = new Buffer( + options.passphrase, 'utf-8'); + } + if (!Buffer.isBuffer(options.passphrase)) { + throw (new errors.KeyEncryptedError( + options.filename, 'PEM')); + } else { + parts = headers['dek-info'].split(','); + assert.ok(parts.length === 2); + cipher = parts[0].toLowerCase(); + iv = new Buffer(parts[1], 'hex'); + key = utils.opensslKeyDeriv(cipher, iv, + options.passphrase, 1).key; + } + } + } + + /* Chop off the first and last lines */ + lines = lines.slice(0, -1).join(''); + buf = new Buffer(lines, 'base64'); + + if (cipher && key && iv) { + var cipherStream = crypto.createDecipheriv(cipher, key, iv); + var chunk, chunks = []; + cipherStream.once('error', function (e) { + if (e.toString().indexOf('bad decrypt') !== -1) { + throw (new Error('Incorrect passphrase ' + + 'supplied, could not decrypt key')); + } + throw (e); + }); + cipherStream.write(buf); + cipherStream.end(); + while ((chunk = cipherStream.read()) !== null) + chunks.push(chunk); + buf = Buffer.concat(chunks); + } + + /* The new OpenSSH internal format abuses PEM headers */ + if (alg && alg.toLowerCase() === 'openssh') + return (sshpriv.readSSHPrivate(type, buf, options)); + if (alg && alg.toLowerCase() === 'ssh2') + return (rfc4253.readType(type, buf, options)); + + var der = new asn1.BerReader(buf); + der.originalInput = input; + + /* + * All of the PEM file types start with a sequence tag, so chop it + * off here + */ + der.readSequence(); + + /* PKCS#1 type keys name an algorithm in the banner explicitly */ + if (alg) { + if (forceType) + assert.strictEqual(forceType, 'pkcs1'); + return (pkcs1.readPkcs1(alg, type, der)); + } else { + if (forceType) + assert.strictEqual(forceType, 'pkcs8'); + return (pkcs8.readPkcs8(alg, type, der)); + } +} + +function write(key, options, type) { + assert.object(key); + + var alg = {'ecdsa': 'EC', 'rsa': 'RSA', 'dsa': 'DSA'}[key.type]; + var header; + + var der = new asn1.BerWriter(); + + if (PrivateKey.isPrivateKey(key)) { + if (type && type === 'pkcs8') { + header = 'PRIVATE KEY'; + pkcs8.writePkcs8(der, key); + } else { + if (type) + assert.strictEqual(type, 'pkcs1'); + header = alg + ' PRIVATE KEY'; + pkcs1.writePkcs1(der, key); + } + + } else if (Key.isKey(key)) { + if (type && type === 'pkcs1') { + header = alg + ' PUBLIC KEY'; + pkcs1.writePkcs1(der, key); + } else { + if (type) + assert.strictEqual(type, 'pkcs8'); + header = 'PUBLIC KEY'; + pkcs8.writePkcs8(der, key); + } + + } else { + throw (new Error('key is not a Key or PrivateKey')); + } + + var tmp = der.buffer.toString('base64'); + var len = tmp.length + (tmp.length / 64) + + 18 + 16 + header.length*2 + 10; + var buf = new Buffer(len); + var o = 0; + o += buf.write('-----BEGIN ' + header + '-----\n', o); + for (var i = 0; i < tmp.length; ) { + var limit = i + 64; + if (limit > tmp.length) + limit = tmp.length; + o += buf.write(tmp.slice(i, limit), o); + buf[o++] = 10; + i = limit; + } + o += buf.write('-----END ' + header + '-----\n', o); + + return (buf.slice(0, o)); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/pkcs1.js b/appasar/canary/node_modules/sshpk/lib/formats/pkcs1.js new file mode 100644 index 0000000..a5676af --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/pkcs1.js @@ -0,0 +1,320 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + read: read, + readPkcs1: readPkcs1, + write: write, + writePkcs1: writePkcs1 +}; + +var assert = require('assert-plus'); +var asn1 = require('asn1'); +var algs = require('../algs'); +var utils = require('../utils'); + +var Key = require('../key'); +var PrivateKey = require('../private-key'); +var pem = require('./pem'); + +var pkcs8 = require('./pkcs8'); +var readECDSACurve = pkcs8.readECDSACurve; + +function read(buf, options) { + return (pem.read(buf, options, 'pkcs1')); +} + +function write(key, options) { + return (pem.write(key, options, 'pkcs1')); +} + +/* Helper to read in a single mpint */ +function readMPInt(der, nm) { + assert.strictEqual(der.peek(), asn1.Ber.Integer, + nm + ' is not an Integer'); + return (utils.mpNormalize(der.readString(asn1.Ber.Integer, true))); +} + +function readPkcs1(alg, type, der) { + switch (alg) { + case 'RSA': + if (type === 'public') + return (readPkcs1RSAPublic(der)); + else if (type === 'private') + return (readPkcs1RSAPrivate(der)); + throw (new Error('Unknown key type: ' + type)); + case 'DSA': + if (type === 'public') + return (readPkcs1DSAPublic(der)); + else if (type === 'private') + return (readPkcs1DSAPrivate(der)); + throw (new Error('Unknown key type: ' + type)); + case 'EC': + case 'ECDSA': + if (type === 'private') + return (readPkcs1ECDSAPrivate(der)); + else if (type === 'public') + return (readPkcs1ECDSAPublic(der)); + throw (new Error('Unknown key type: ' + type)); + default: + throw (new Error('Unknown key algo: ' + alg)); + } +} + +function readPkcs1RSAPublic(der) { + // modulus and exponent + var n = readMPInt(der, 'modulus'); + var e = readMPInt(der, 'exponent'); + + // now, make the key + var key = { + type: 'rsa', + parts: [ + { name: 'e', data: e }, + { name: 'n', data: n } + ] + }; + + return (new Key(key)); +} + +function readPkcs1RSAPrivate(der) { + var version = readMPInt(der, 'version'); + assert.strictEqual(version[0], 0); + + // modulus then public exponent + var n = readMPInt(der, 'modulus'); + var e = readMPInt(der, 'public exponent'); + var d = readMPInt(der, 'private exponent'); + var p = readMPInt(der, 'prime1'); + var q = readMPInt(der, 'prime2'); + var dmodp = readMPInt(der, 'exponent1'); + var dmodq = readMPInt(der, 'exponent2'); + var iqmp = readMPInt(der, 'iqmp'); + + // now, make the key + var key = { + type: 'rsa', + parts: [ + { name: 'n', data: n }, + { name: 'e', data: e }, + { name: 'd', data: d }, + { name: 'iqmp', data: iqmp }, + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'dmodp', data: dmodp }, + { name: 'dmodq', data: dmodq } + ] + }; + + return (new PrivateKey(key)); +} + +function readPkcs1DSAPrivate(der) { + var version = readMPInt(der, 'version'); + assert.strictEqual(version.readUInt8(0), 0); + + var p = readMPInt(der, 'p'); + var q = readMPInt(der, 'q'); + var g = readMPInt(der, 'g'); + var y = readMPInt(der, 'y'); + var x = readMPInt(der, 'x'); + + // now, make the key + var key = { + type: 'dsa', + parts: [ + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'g', data: g }, + { name: 'y', data: y }, + { name: 'x', data: x } + ] + }; + + return (new PrivateKey(key)); +} + +function readPkcs1DSAPublic(der) { + var y = readMPInt(der, 'y'); + var p = readMPInt(der, 'p'); + var q = readMPInt(der, 'q'); + var g = readMPInt(der, 'g'); + + var key = { + type: 'dsa', + parts: [ + { name: 'y', data: y }, + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'g', data: g } + ] + }; + + return (new Key(key)); +} + +function readPkcs1ECDSAPublic(der) { + der.readSequence(); + + var oid = der.readOID(); + assert.strictEqual(oid, '1.2.840.10045.2.1', 'must be ecPublicKey'); + + var curveOid = der.readOID(); + + var curve; + var curves = Object.keys(algs.curves); + for (var j = 0; j < curves.length; ++j) { + var c = curves[j]; + var cd = algs.curves[c]; + if (cd.pkcs8oid === curveOid) { + curve = c; + break; + } + } + assert.string(curve, 'a known ECDSA named curve'); + + var Q = der.readString(asn1.Ber.BitString, true); + Q = utils.ecNormalize(Q); + + var key = { + type: 'ecdsa', + parts: [ + { name: 'curve', data: new Buffer(curve) }, + { name: 'Q', data: Q } + ] + }; + + return (new Key(key)); +} + +function readPkcs1ECDSAPrivate(der) { + var version = readMPInt(der, 'version'); + assert.strictEqual(version.readUInt8(0), 1); + + // private key + var d = der.readString(asn1.Ber.OctetString, true); + + der.readSequence(0xa0); + var curve = readECDSACurve(der); + assert.string(curve, 'a known elliptic curve'); + + der.readSequence(0xa1); + var Q = der.readString(asn1.Ber.BitString, true); + Q = utils.ecNormalize(Q); + + var key = { + type: 'ecdsa', + parts: [ + { name: 'curve', data: new Buffer(curve) }, + { name: 'Q', data: Q }, + { name: 'd', data: d } + ] + }; + + return (new PrivateKey(key)); +} + +function writePkcs1(der, key) { + der.startSequence(); + + switch (key.type) { + case 'rsa': + if (PrivateKey.isPrivateKey(key)) + writePkcs1RSAPrivate(der, key); + else + writePkcs1RSAPublic(der, key); + break; + case 'dsa': + if (PrivateKey.isPrivateKey(key)) + writePkcs1DSAPrivate(der, key); + else + writePkcs1DSAPublic(der, key); + break; + case 'ecdsa': + if (PrivateKey.isPrivateKey(key)) + writePkcs1ECDSAPrivate(der, key); + else + writePkcs1ECDSAPublic(der, key); + break; + default: + throw (new Error('Unknown key algo: ' + key.type)); + } + + der.endSequence(); +} + +function writePkcs1RSAPublic(der, key) { + der.writeBuffer(key.part.n.data, asn1.Ber.Integer); + der.writeBuffer(key.part.e.data, asn1.Ber.Integer); +} + +function writePkcs1RSAPrivate(der, key) { + var ver = new Buffer(1); + ver[0] = 0; + der.writeBuffer(ver, asn1.Ber.Integer); + + der.writeBuffer(key.part.n.data, asn1.Ber.Integer); + der.writeBuffer(key.part.e.data, asn1.Ber.Integer); + der.writeBuffer(key.part.d.data, asn1.Ber.Integer); + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + if (!key.part.dmodp || !key.part.dmodq) + utils.addRSAMissing(key); + der.writeBuffer(key.part.dmodp.data, asn1.Ber.Integer); + der.writeBuffer(key.part.dmodq.data, asn1.Ber.Integer); + der.writeBuffer(key.part.iqmp.data, asn1.Ber.Integer); +} + +function writePkcs1DSAPrivate(der, key) { + var ver = new Buffer(1); + ver[0] = 0; + der.writeBuffer(ver, asn1.Ber.Integer); + + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + der.writeBuffer(key.part.g.data, asn1.Ber.Integer); + der.writeBuffer(key.part.y.data, asn1.Ber.Integer); + der.writeBuffer(key.part.x.data, asn1.Ber.Integer); +} + +function writePkcs1DSAPublic(der, key) { + der.writeBuffer(key.part.y.data, asn1.Ber.Integer); + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + der.writeBuffer(key.part.g.data, asn1.Ber.Integer); +} + +function writePkcs1ECDSAPublic(der, key) { + der.startSequence(); + + der.writeOID('1.2.840.10045.2.1'); /* ecPublicKey */ + var curve = key.part.curve.data.toString(); + var curveOid = algs.curves[curve].pkcs8oid; + assert.string(curveOid, 'a known ECDSA named curve'); + der.writeOID(curveOid); + + der.endSequence(); + + var Q = utils.ecNormalize(key.part.Q.data, true); + der.writeBuffer(Q, asn1.Ber.BitString); +} + +function writePkcs1ECDSAPrivate(der, key) { + var ver = new Buffer(1); + ver[0] = 1; + der.writeBuffer(ver, asn1.Ber.Integer); + + der.writeBuffer(key.part.d.data, asn1.Ber.OctetString); + + der.startSequence(0xa0); + var curve = key.part.curve.data.toString(); + var curveOid = algs.curves[curve].pkcs8oid; + assert.string(curveOid, 'a known ECDSA named curve'); + der.writeOID(curveOid); + der.endSequence(); + + der.startSequence(0xa1); + var Q = utils.ecNormalize(key.part.Q.data, true); + der.writeBuffer(Q, asn1.Ber.BitString); + der.endSequence(); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/pkcs8.js b/appasar/canary/node_modules/sshpk/lib/formats/pkcs8.js new file mode 100644 index 0000000..4ccbefc --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/pkcs8.js @@ -0,0 +1,505 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + read: read, + readPkcs8: readPkcs8, + write: write, + writePkcs8: writePkcs8, + + readECDSACurve: readECDSACurve, + writeECDSACurve: writeECDSACurve +}; + +var assert = require('assert-plus'); +var asn1 = require('asn1'); +var algs = require('../algs'); +var utils = require('../utils'); +var Key = require('../key'); +var PrivateKey = require('../private-key'); +var pem = require('./pem'); + +function read(buf, options) { + return (pem.read(buf, options, 'pkcs8')); +} + +function write(key, options) { + return (pem.write(key, options, 'pkcs8')); +} + +/* Helper to read in a single mpint */ +function readMPInt(der, nm) { + assert.strictEqual(der.peek(), asn1.Ber.Integer, + nm + ' is not an Integer'); + return (utils.mpNormalize(der.readString(asn1.Ber.Integer, true))); +} + +function readPkcs8(alg, type, der) { + /* Private keys in pkcs#8 format have a weird extra int */ + if (der.peek() === asn1.Ber.Integer) { + assert.strictEqual(type, 'private', + 'unexpected Integer at start of public key'); + der.readString(asn1.Ber.Integer, true); + } + + der.readSequence(); + var next = der.offset + der.length; + + var oid = der.readOID(); + switch (oid) { + case '1.2.840.113549.1.1.1': + der._offset = next; + if (type === 'public') + return (readPkcs8RSAPublic(der)); + else + return (readPkcs8RSAPrivate(der)); + case '1.2.840.10040.4.1': + if (type === 'public') + return (readPkcs8DSAPublic(der)); + else + return (readPkcs8DSAPrivate(der)); + case '1.2.840.10045.2.1': + if (type === 'public') + return (readPkcs8ECDSAPublic(der)); + else + return (readPkcs8ECDSAPrivate(der)); + default: + throw (new Error('Unknown key type OID ' + oid)); + } +} + +function readPkcs8RSAPublic(der) { + // bit string sequence + der.readSequence(asn1.Ber.BitString); + der.readByte(); + der.readSequence(); + + // modulus + var n = readMPInt(der, 'modulus'); + var e = readMPInt(der, 'exponent'); + + // now, make the key + var key = { + type: 'rsa', + source: der.originalInput, + parts: [ + { name: 'e', data: e }, + { name: 'n', data: n } + ] + }; + + return (new Key(key)); +} + +function readPkcs8RSAPrivate(der) { + der.readSequence(asn1.Ber.OctetString); + der.readSequence(); + + var ver = readMPInt(der, 'version'); + assert.equal(ver[0], 0x0, 'unknown RSA private key version'); + + // modulus then public exponent + var n = readMPInt(der, 'modulus'); + var e = readMPInt(der, 'public exponent'); + var d = readMPInt(der, 'private exponent'); + var p = readMPInt(der, 'prime1'); + var q = readMPInt(der, 'prime2'); + var dmodp = readMPInt(der, 'exponent1'); + var dmodq = readMPInt(der, 'exponent2'); + var iqmp = readMPInt(der, 'iqmp'); + + // now, make the key + var key = { + type: 'rsa', + parts: [ + { name: 'n', data: n }, + { name: 'e', data: e }, + { name: 'd', data: d }, + { name: 'iqmp', data: iqmp }, + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'dmodp', data: dmodp }, + { name: 'dmodq', data: dmodq } + ] + }; + + return (new PrivateKey(key)); +} + +function readPkcs8DSAPublic(der) { + der.readSequence(); + + var p = readMPInt(der, 'p'); + var q = readMPInt(der, 'q'); + var g = readMPInt(der, 'g'); + + // bit string sequence + der.readSequence(asn1.Ber.BitString); + der.readByte(); + + var y = readMPInt(der, 'y'); + + // now, make the key + var key = { + type: 'dsa', + parts: [ + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'g', data: g }, + { name: 'y', data: y } + ] + }; + + return (new Key(key)); +} + +function readPkcs8DSAPrivate(der) { + der.readSequence(); + + var p = readMPInt(der, 'p'); + var q = readMPInt(der, 'q'); + var g = readMPInt(der, 'g'); + + der.readSequence(asn1.Ber.OctetString); + var x = readMPInt(der, 'x'); + + /* The pkcs#8 format does not include the public key */ + var y = utils.calculateDSAPublic(g, p, x); + + var key = { + type: 'dsa', + parts: [ + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'g', data: g }, + { name: 'y', data: y }, + { name: 'x', data: x } + ] + }; + + return (new PrivateKey(key)); +} + +function readECDSACurve(der) { + var curveName, curveNames; + var j, c, cd; + + if (der.peek() === asn1.Ber.OID) { + var oid = der.readOID(); + + curveNames = Object.keys(algs.curves); + for (j = 0; j < curveNames.length; ++j) { + c = curveNames[j]; + cd = algs.curves[c]; + if (cd.pkcs8oid === oid) { + curveName = c; + break; + } + } + + } else { + // ECParameters sequence + der.readSequence(); + var version = der.readString(asn1.Ber.Integer, true); + assert.strictEqual(version[0], 1, 'ECDSA key not version 1'); + + var curve = {}; + + // FieldID sequence + der.readSequence(); + var fieldTypeOid = der.readOID(); + assert.strictEqual(fieldTypeOid, '1.2.840.10045.1.1', + 'ECDSA key is not from a prime-field'); + var p = curve.p = utils.mpNormalize( + der.readString(asn1.Ber.Integer, true)); + /* + * p always starts with a 1 bit, so count the zeros to get its + * real size. + */ + curve.size = p.length * 8 - utils.countZeros(p); + + // Curve sequence + der.readSequence(); + curve.a = utils.mpNormalize( + der.readString(asn1.Ber.OctetString, true)); + curve.b = utils.mpNormalize( + der.readString(asn1.Ber.OctetString, true)); + if (der.peek() === asn1.Ber.BitString) + curve.s = der.readString(asn1.Ber.BitString, true); + + // Combined Gx and Gy + curve.G = der.readString(asn1.Ber.OctetString, true); + assert.strictEqual(curve.G[0], 0x4, + 'uncompressed G is required'); + + curve.n = utils.mpNormalize( + der.readString(asn1.Ber.Integer, true)); + curve.h = utils.mpNormalize( + der.readString(asn1.Ber.Integer, true)); + assert.strictEqual(curve.h[0], 0x1, 'a cofactor=1 curve is ' + + 'required'); + + curveNames = Object.keys(algs.curves); + var ks = Object.keys(curve); + for (j = 0; j < curveNames.length; ++j) { + c = curveNames[j]; + cd = algs.curves[c]; + var equal = true; + for (var i = 0; i < ks.length; ++i) { + var k = ks[i]; + if (cd[k] === undefined) + continue; + if (typeof (cd[k]) === 'object' && + cd[k].equals !== undefined) { + if (!cd[k].equals(curve[k])) { + equal = false; + break; + } + } else if (Buffer.isBuffer(cd[k])) { + if (cd[k].toString('binary') + !== curve[k].toString('binary')) { + equal = false; + break; + } + } else { + if (cd[k] !== curve[k]) { + equal = false; + break; + } + } + } + if (equal) { + curveName = c; + break; + } + } + } + return (curveName); +} + +function readPkcs8ECDSAPrivate(der) { + var curveName = readECDSACurve(der); + assert.string(curveName, 'a known elliptic curve'); + + der.readSequence(asn1.Ber.OctetString); + der.readSequence(); + + var version = readMPInt(der, 'version'); + assert.equal(version[0], 1, 'unknown version of ECDSA key'); + + var d = der.readString(asn1.Ber.OctetString, true); + der.readSequence(0xa1); + + var Q = der.readString(asn1.Ber.BitString, true); + Q = utils.ecNormalize(Q); + + var key = { + type: 'ecdsa', + parts: [ + { name: 'curve', data: new Buffer(curveName) }, + { name: 'Q', data: Q }, + { name: 'd', data: d } + ] + }; + + return (new PrivateKey(key)); +} + +function readPkcs8ECDSAPublic(der) { + var curveName = readECDSACurve(der); + assert.string(curveName, 'a known elliptic curve'); + + var Q = der.readString(asn1.Ber.BitString, true); + Q = utils.ecNormalize(Q); + + var key = { + type: 'ecdsa', + parts: [ + { name: 'curve', data: new Buffer(curveName) }, + { name: 'Q', data: Q } + ] + }; + + return (new Key(key)); +} + +function writePkcs8(der, key) { + der.startSequence(); + + if (PrivateKey.isPrivateKey(key)) { + var sillyInt = new Buffer(1); + sillyInt[0] = 0x0; + der.writeBuffer(sillyInt, asn1.Ber.Integer); + } + + der.startSequence(); + switch (key.type) { + case 'rsa': + der.writeOID('1.2.840.113549.1.1.1'); + if (PrivateKey.isPrivateKey(key)) + writePkcs8RSAPrivate(key, der); + else + writePkcs8RSAPublic(key, der); + break; + case 'dsa': + der.writeOID('1.2.840.10040.4.1'); + if (PrivateKey.isPrivateKey(key)) + writePkcs8DSAPrivate(key, der); + else + writePkcs8DSAPublic(key, der); + break; + case 'ecdsa': + der.writeOID('1.2.840.10045.2.1'); + if (PrivateKey.isPrivateKey(key)) + writePkcs8ECDSAPrivate(key, der); + else + writePkcs8ECDSAPublic(key, der); + break; + default: + throw (new Error('Unsupported key type: ' + key.type)); + } + + der.endSequence(); +} + +function writePkcs8RSAPrivate(key, der) { + der.writeNull(); + der.endSequence(); + + der.startSequence(asn1.Ber.OctetString); + der.startSequence(); + + var version = new Buffer(1); + version[0] = 0; + der.writeBuffer(version, asn1.Ber.Integer); + + der.writeBuffer(key.part.n.data, asn1.Ber.Integer); + der.writeBuffer(key.part.e.data, asn1.Ber.Integer); + der.writeBuffer(key.part.d.data, asn1.Ber.Integer); + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + if (!key.part.dmodp || !key.part.dmodq) + utils.addRSAMissing(key); + der.writeBuffer(key.part.dmodp.data, asn1.Ber.Integer); + der.writeBuffer(key.part.dmodq.data, asn1.Ber.Integer); + der.writeBuffer(key.part.iqmp.data, asn1.Ber.Integer); + + der.endSequence(); + der.endSequence(); +} + +function writePkcs8RSAPublic(key, der) { + der.writeNull(); + der.endSequence(); + + der.startSequence(asn1.Ber.BitString); + der.writeByte(0x00); + + der.startSequence(); + der.writeBuffer(key.part.n.data, asn1.Ber.Integer); + der.writeBuffer(key.part.e.data, asn1.Ber.Integer); + der.endSequence(); + + der.endSequence(); +} + +function writePkcs8DSAPrivate(key, der) { + der.startSequence(); + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + der.writeBuffer(key.part.g.data, asn1.Ber.Integer); + der.endSequence(); + + der.endSequence(); + + der.startSequence(asn1.Ber.OctetString); + der.writeBuffer(key.part.x.data, asn1.Ber.Integer); + der.endSequence(); +} + +function writePkcs8DSAPublic(key, der) { + der.startSequence(); + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + der.writeBuffer(key.part.g.data, asn1.Ber.Integer); + der.endSequence(); + der.endSequence(); + + der.startSequence(asn1.Ber.BitString); + der.writeByte(0x00); + der.writeBuffer(key.part.y.data, asn1.Ber.Integer); + der.endSequence(); +} + +function writeECDSACurve(key, der) { + var curve = algs.curves[key.curve]; + if (curve.pkcs8oid) { + /* This one has a name in pkcs#8, so just write the oid */ + der.writeOID(curve.pkcs8oid); + + } else { + // ECParameters sequence + der.startSequence(); + + var version = new Buffer(1); + version.writeUInt8(1, 0); + der.writeBuffer(version, asn1.Ber.Integer); + + // FieldID sequence + der.startSequence(); + der.writeOID('1.2.840.10045.1.1'); // prime-field + der.writeBuffer(curve.p, asn1.Ber.Integer); + der.endSequence(); + + // Curve sequence + der.startSequence(); + var a = curve.p; + if (a[0] === 0x0) + a = a.slice(1); + der.writeBuffer(a, asn1.Ber.OctetString); + der.writeBuffer(curve.b, asn1.Ber.OctetString); + der.writeBuffer(curve.s, asn1.Ber.BitString); + der.endSequence(); + + der.writeBuffer(curve.G, asn1.Ber.OctetString); + der.writeBuffer(curve.n, asn1.Ber.Integer); + var h = curve.h; + if (!h) { + h = new Buffer(1); + h[0] = 1; + } + der.writeBuffer(h, asn1.Ber.Integer); + + // ECParameters + der.endSequence(); + } +} + +function writePkcs8ECDSAPublic(key, der) { + writeECDSACurve(key, der); + der.endSequence(); + + var Q = utils.ecNormalize(key.part.Q.data, true); + der.writeBuffer(Q, asn1.Ber.BitString); +} + +function writePkcs8ECDSAPrivate(key, der) { + writeECDSACurve(key, der); + der.endSequence(); + + der.startSequence(asn1.Ber.OctetString); + der.startSequence(); + + var version = new Buffer(1); + version[0] = 1; + der.writeBuffer(version, asn1.Ber.Integer); + + der.writeBuffer(key.part.d.data, asn1.Ber.OctetString); + + der.startSequence(0xa1); + var Q = utils.ecNormalize(key.part.Q.data, true); + der.writeBuffer(Q, asn1.Ber.BitString); + der.endSequence(); + + der.endSequence(); + der.endSequence(); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/rfc4253.js b/appasar/canary/node_modules/sshpk/lib/formats/rfc4253.js new file mode 100644 index 0000000..9d436dd --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/rfc4253.js @@ -0,0 +1,146 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + read: read.bind(undefined, false, undefined), + readType: read.bind(undefined, false), + write: write, + /* semi-private api, used by sshpk-agent */ + readPartial: read.bind(undefined, true), + + /* shared with ssh format */ + readInternal: read, + keyTypeToAlg: keyTypeToAlg, + algToKeyType: algToKeyType +}; + +var assert = require('assert-plus'); +var algs = require('../algs'); +var utils = require('../utils'); +var Key = require('../key'); +var PrivateKey = require('../private-key'); +var SSHBuffer = require('../ssh-buffer'); + +function algToKeyType(alg) { + assert.string(alg); + if (alg === 'ssh-dss') + return ('dsa'); + else if (alg === 'ssh-rsa') + return ('rsa'); + else if (alg === 'ssh-ed25519') + return ('ed25519'); + else if (alg === 'ssh-curve25519') + return ('curve25519'); + else if (alg.match(/^ecdsa-sha2-/)) + return ('ecdsa'); + else + throw (new Error('Unknown algorithm ' + alg)); +} + +function keyTypeToAlg(key) { + assert.object(key); + if (key.type === 'dsa') + return ('ssh-dss'); + else if (key.type === 'rsa') + return ('ssh-rsa'); + else if (key.type === 'ed25519') + return ('ssh-ed25519'); + else if (key.type === 'curve25519') + return ('ssh-curve25519'); + else if (key.type === 'ecdsa') + return ('ecdsa-sha2-' + key.part.curve.data.toString()); + else + throw (new Error('Unknown key type ' + key.type)); +} + +function read(partial, type, buf, options) { + if (typeof (buf) === 'string') + buf = new Buffer(buf); + assert.buffer(buf, 'buf'); + + var key = {}; + + var parts = key.parts = []; + var sshbuf = new SSHBuffer({buffer: buf}); + + var alg = sshbuf.readString(); + assert.ok(!sshbuf.atEnd(), 'key must have at least one part'); + + key.type = algToKeyType(alg); + + var partCount = algs.info[key.type].parts.length; + if (type && type === 'private') + partCount = algs.privInfo[key.type].parts.length; + + while (!sshbuf.atEnd() && parts.length < partCount) + parts.push(sshbuf.readPart()); + while (!partial && !sshbuf.atEnd()) + parts.push(sshbuf.readPart()); + + assert.ok(parts.length >= 1, + 'key must have at least one part'); + assert.ok(partial || sshbuf.atEnd(), + 'leftover bytes at end of key'); + + var Constructor = Key; + var algInfo = algs.info[key.type]; + if (type === 'private' || algInfo.parts.length !== parts.length) { + algInfo = algs.privInfo[key.type]; + Constructor = PrivateKey; + } + assert.strictEqual(algInfo.parts.length, parts.length); + + if (key.type === 'ecdsa') { + var res = /^ecdsa-sha2-(.+)$/.exec(alg); + assert.ok(res !== null); + assert.strictEqual(res[1], parts[0].data.toString()); + } + + var normalized = true; + for (var i = 0; i < algInfo.parts.length; ++i) { + parts[i].name = algInfo.parts[i]; + if (parts[i].name !== 'curve' && + algInfo.normalize !== false) { + var p = parts[i]; + var nd = utils.mpNormalize(p.data); + if (nd !== p.data) { + p.data = nd; + normalized = false; + } + } + } + + if (normalized) + key._rfc4253Cache = sshbuf.toBuffer(); + + if (partial && typeof (partial) === 'object') { + partial.remainder = sshbuf.remainder(); + partial.consumed = sshbuf._offset; + } + + return (new Constructor(key)); +} + +function write(key, options) { + assert.object(key); + + var alg = keyTypeToAlg(key); + var i; + + var algInfo = algs.info[key.type]; + if (PrivateKey.isPrivateKey(key)) + algInfo = algs.privInfo[key.type]; + var parts = algInfo.parts; + + var buf = new SSHBuffer({}); + + buf.writeString(alg); + + for (i = 0; i < parts.length; ++i) { + var data = key.part[parts[i]].data; + if (algInfo.normalize !== false) + data = utils.mpNormalize(data); + buf.writeBuffer(data); + } + + return (buf.toBuffer()); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/ssh-private.js b/appasar/canary/node_modules/sshpk/lib/formats/ssh-private.js new file mode 100644 index 0000000..2fcf719 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/ssh-private.js @@ -0,0 +1,261 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + read: read, + readSSHPrivate: readSSHPrivate, + write: write +}; + +var assert = require('assert-plus'); +var asn1 = require('asn1'); +var algs = require('../algs'); +var utils = require('../utils'); +var crypto = require('crypto'); + +var Key = require('../key'); +var PrivateKey = require('../private-key'); +var pem = require('./pem'); +var rfc4253 = require('./rfc4253'); +var SSHBuffer = require('../ssh-buffer'); +var errors = require('../errors'); + +var bcrypt; + +function read(buf, options) { + return (pem.read(buf, options)); +} + +var MAGIC = 'openssh-key-v1'; + +function readSSHPrivate(type, buf, options) { + buf = new SSHBuffer({buffer: buf}); + + var magic = buf.readCString(); + assert.strictEqual(magic, MAGIC, 'bad magic string'); + + var cipher = buf.readString(); + var kdf = buf.readString(); + var kdfOpts = buf.readBuffer(); + + var nkeys = buf.readInt(); + if (nkeys !== 1) { + throw (new Error('OpenSSH-format key file contains ' + + 'multiple keys: this is unsupported.')); + } + + var pubKey = buf.readBuffer(); + + if (type === 'public') { + assert.ok(buf.atEnd(), 'excess bytes left after key'); + return (rfc4253.read(pubKey)); + } + + var privKeyBlob = buf.readBuffer(); + assert.ok(buf.atEnd(), 'excess bytes left after key'); + + var kdfOptsBuf = new SSHBuffer({ buffer: kdfOpts }); + switch (kdf) { + case 'none': + if (cipher !== 'none') { + throw (new Error('OpenSSH-format key uses KDF "none" ' + + 'but specifies a cipher other than "none"')); + } + break; + case 'bcrypt': + var salt = kdfOptsBuf.readBuffer(); + var rounds = kdfOptsBuf.readInt(); + var cinf = utils.opensshCipherInfo(cipher); + if (bcrypt === undefined) { + bcrypt = require('bcrypt-pbkdf'); + } + + if (typeof (options.passphrase) === 'string') { + options.passphrase = new Buffer(options.passphrase, + 'utf-8'); + } + if (!Buffer.isBuffer(options.passphrase)) { + throw (new errors.KeyEncryptedError( + options.filename, 'OpenSSH')); + } + + var pass = new Uint8Array(options.passphrase); + var salti = new Uint8Array(salt); + /* Use the pbkdf to derive both the key and the IV. */ + var out = new Uint8Array(cinf.keySize + cinf.blockSize); + var res = bcrypt.pbkdf(pass, pass.length, salti, salti.length, + out, out.length, rounds); + if (res !== 0) { + throw (new Error('bcrypt_pbkdf function returned ' + + 'failure, parameters invalid')); + } + out = new Buffer(out); + var ckey = out.slice(0, cinf.keySize); + var iv = out.slice(cinf.keySize, cinf.keySize + cinf.blockSize); + var cipherStream = crypto.createDecipheriv(cinf.opensslName, + ckey, iv); + cipherStream.setAutoPadding(false); + var chunk, chunks = []; + cipherStream.once('error', function (e) { + if (e.toString().indexOf('bad decrypt') !== -1) { + throw (new Error('Incorrect passphrase ' + + 'supplied, could not decrypt key')); + } + throw (e); + }); + cipherStream.write(privKeyBlob); + cipherStream.end(); + while ((chunk = cipherStream.read()) !== null) + chunks.push(chunk); + privKeyBlob = Buffer.concat(chunks); + break; + default: + throw (new Error( + 'OpenSSH-format key uses unknown KDF "' + kdf + '"')); + } + + buf = new SSHBuffer({buffer: privKeyBlob}); + + var checkInt1 = buf.readInt(); + var checkInt2 = buf.readInt(); + if (checkInt1 !== checkInt2) { + throw (new Error('Incorrect passphrase supplied, could not ' + + 'decrypt key')); + } + + var ret = {}; + var key = rfc4253.readInternal(ret, 'private', buf.remainder()); + + buf.skip(ret.consumed); + + var comment = buf.readString(); + key.comment = comment; + + return (key); +} + +function write(key, options) { + var pubKey; + if (PrivateKey.isPrivateKey(key)) + pubKey = key.toPublic(); + else + pubKey = key; + + var cipher = 'none'; + var kdf = 'none'; + var kdfopts = new Buffer(0); + var cinf = { blockSize: 8 }; + var passphrase; + if (options !== undefined) { + passphrase = options.passphrase; + if (typeof (passphrase) === 'string') + passphrase = new Buffer(passphrase, 'utf-8'); + if (passphrase !== undefined) { + assert.buffer(passphrase, 'options.passphrase'); + assert.optionalString(options.cipher, 'options.cipher'); + cipher = options.cipher; + if (cipher === undefined) + cipher = 'aes128-ctr'; + cinf = utils.opensshCipherInfo(cipher); + kdf = 'bcrypt'; + } + } + + var privBuf; + if (PrivateKey.isPrivateKey(key)) { + privBuf = new SSHBuffer({}); + var checkInt = crypto.randomBytes(4).readUInt32BE(0); + privBuf.writeInt(checkInt); + privBuf.writeInt(checkInt); + privBuf.write(key.toBuffer('rfc4253')); + privBuf.writeString(key.comment || ''); + + var n = 1; + while (privBuf._offset % cinf.blockSize !== 0) + privBuf.writeChar(n++); + privBuf = privBuf.toBuffer(); + } + + switch (kdf) { + case 'none': + break; + case 'bcrypt': + var salt = crypto.randomBytes(16); + var rounds = 16; + var kdfssh = new SSHBuffer({}); + kdfssh.writeBuffer(salt); + kdfssh.writeInt(rounds); + kdfopts = kdfssh.toBuffer(); + + if (bcrypt === undefined) { + bcrypt = require('bcrypt-pbkdf'); + } + var pass = new Uint8Array(passphrase); + var salti = new Uint8Array(salt); + /* Use the pbkdf to derive both the key and the IV. */ + var out = new Uint8Array(cinf.keySize + cinf.blockSize); + var res = bcrypt.pbkdf(pass, pass.length, salti, salti.length, + out, out.length, rounds); + if (res !== 0) { + throw (new Error('bcrypt_pbkdf function returned ' + + 'failure, parameters invalid')); + } + out = new Buffer(out); + var ckey = out.slice(0, cinf.keySize); + var iv = out.slice(cinf.keySize, cinf.keySize + cinf.blockSize); + + var cipherStream = crypto.createCipheriv(cinf.opensslName, + ckey, iv); + cipherStream.setAutoPadding(false); + var chunk, chunks = []; + cipherStream.once('error', function (e) { + throw (e); + }); + cipherStream.write(privBuf); + cipherStream.end(); + while ((chunk = cipherStream.read()) !== null) + chunks.push(chunk); + privBuf = Buffer.concat(chunks); + break; + default: + throw (new Error('Unsupported kdf ' + kdf)); + } + + var buf = new SSHBuffer({}); + + buf.writeCString(MAGIC); + buf.writeString(cipher); /* cipher */ + buf.writeString(kdf); /* kdf */ + buf.writeBuffer(kdfopts); /* kdfoptions */ + + buf.writeInt(1); /* nkeys */ + buf.writeBuffer(pubKey.toBuffer('rfc4253')); + + if (privBuf) + buf.writeBuffer(privBuf); + + buf = buf.toBuffer(); + + var header; + if (PrivateKey.isPrivateKey(key)) + header = 'OPENSSH PRIVATE KEY'; + else + header = 'OPENSSH PUBLIC KEY'; + + var tmp = buf.toString('base64'); + var len = tmp.length + (tmp.length / 70) + + 18 + 16 + header.length*2 + 10; + buf = new Buffer(len); + var o = 0; + o += buf.write('-----BEGIN ' + header + '-----\n', o); + for (var i = 0; i < tmp.length; ) { + var limit = i + 70; + if (limit > tmp.length) + limit = tmp.length; + o += buf.write(tmp.slice(i, limit), o); + buf[o++] = 10; + i = limit; + } + o += buf.write('-----END ' + header + '-----\n', o); + + return (buf.slice(0, o)); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/ssh.js b/appasar/canary/node_modules/sshpk/lib/formats/ssh.js new file mode 100644 index 0000000..655c9ea --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/ssh.js @@ -0,0 +1,114 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + read: read, + write: write +}; + +var assert = require('assert-plus'); +var rfc4253 = require('./rfc4253'); +var utils = require('../utils'); +var Key = require('../key'); +var PrivateKey = require('../private-key'); + +var sshpriv = require('./ssh-private'); + +/*JSSTYLED*/ +var SSHKEY_RE = /^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/]+[=]*)([\n \t]+([^\n]+))?$/; +/*JSSTYLED*/ +var SSHKEY_RE2 = /^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/ \t\n]+[=]*)(.*)$/; + +function read(buf, options) { + if (typeof (buf) !== 'string') { + assert.buffer(buf, 'buf'); + buf = buf.toString('ascii'); + } + + var trimmed = buf.trim().replace(/[\\\r]/g, ''); + var m = trimmed.match(SSHKEY_RE); + if (!m) + m = trimmed.match(SSHKEY_RE2); + assert.ok(m, 'key must match regex'); + + var type = rfc4253.algToKeyType(m[1]); + var kbuf = new Buffer(m[2], 'base64'); + + /* + * This is a bit tricky. If we managed to parse the key and locate the + * key comment with the regex, then do a non-partial read and assert + * that we have consumed all bytes. If we couldn't locate the key + * comment, though, there may be whitespace shenanigans going on that + * have conjoined the comment to the rest of the key. We do a partial + * read in this case to try to make the best out of a sorry situation. + */ + var key; + var ret = {}; + if (m[4]) { + try { + key = rfc4253.read(kbuf); + + } catch (e) { + m = trimmed.match(SSHKEY_RE2); + assert.ok(m, 'key must match regex'); + kbuf = new Buffer(m[2], 'base64'); + key = rfc4253.readInternal(ret, 'public', kbuf); + } + } else { + key = rfc4253.readInternal(ret, 'public', kbuf); + } + + assert.strictEqual(type, key.type); + + if (m[4] && m[4].length > 0) { + key.comment = m[4]; + + } else if (ret.consumed) { + /* + * Now the magic: trying to recover the key comment when it's + * gotten conjoined to the key or otherwise shenanigan'd. + * + * Work out how much base64 we used, then drop all non-base64 + * chars from the beginning up to this point in the the string. + * Then offset in this and try to make up for missing = chars. + */ + var data = m[2] + m[3]; + var realOffset = Math.ceil(ret.consumed / 3) * 4; + data = data.slice(0, realOffset - 2). /*JSSTYLED*/ + replace(/[^a-zA-Z0-9+\/=]/g, '') + + data.slice(realOffset - 2); + + var padding = ret.consumed % 3; + if (padding > 0 && + data.slice(realOffset - 1, realOffset) !== '=') + realOffset--; + while (data.slice(realOffset, realOffset + 1) === '=') + realOffset++; + + /* Finally, grab what we think is the comment & clean it up. */ + var trailer = data.slice(realOffset); + trailer = trailer.replace(/[\r\n]/g, ' '). + replace(/^\s+/, ''); + if (trailer.match(/^[a-zA-Z0-9]/)) + key.comment = trailer; + } + + return (key); +} + +function write(key, options) { + assert.object(key); + if (!Key.isKey(key)) + throw (new Error('Must be a public key')); + + var parts = []; + var alg = rfc4253.keyTypeToAlg(key); + parts.push(alg); + + var buf = rfc4253.write(key); + parts.push(buf.toString('base64')); + + if (key.comment) + parts.push(key.comment); + + return (new Buffer(parts.join(' '))); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/x509-pem.js b/appasar/canary/node_modules/sshpk/lib/formats/x509-pem.js new file mode 100644 index 0000000..c59c7d5 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/x509-pem.js @@ -0,0 +1,77 @@ +// Copyright 2016 Joyent, Inc. + +var x509 = require('./x509'); + +module.exports = { + read: read, + verify: x509.verify, + sign: x509.sign, + write: write +}; + +var assert = require('assert-plus'); +var asn1 = require('asn1'); +var algs = require('../algs'); +var utils = require('../utils'); +var Key = require('../key'); +var PrivateKey = require('../private-key'); +var pem = require('./pem'); +var Identity = require('../identity'); +var Signature = require('../signature'); +var Certificate = require('../certificate'); + +function read(buf, options) { + if (typeof (buf) !== 'string') { + assert.buffer(buf, 'buf'); + buf = buf.toString('ascii'); + } + + var lines = buf.trim().split(/[\r\n]+/g); + + var m = lines[0].match(/*JSSTYLED*/ + /[-]+[ ]*BEGIN CERTIFICATE[ ]*[-]+/); + assert.ok(m, 'invalid PEM header'); + + var m2 = lines[lines.length - 1].match(/*JSSTYLED*/ + /[-]+[ ]*END CERTIFICATE[ ]*[-]+/); + assert.ok(m2, 'invalid PEM footer'); + + var headers = {}; + while (true) { + lines = lines.slice(1); + m = lines[0].match(/*JSSTYLED*/ + /^([A-Za-z0-9-]+): (.+)$/); + if (!m) + break; + headers[m[1].toLowerCase()] = m[2]; + } + + /* Chop off the first and last lines */ + lines = lines.slice(0, -1).join(''); + buf = new Buffer(lines, 'base64'); + + return (x509.read(buf, options)); +} + +function write(cert, options) { + var dbuf = x509.write(cert, options); + + var header = 'CERTIFICATE'; + var tmp = dbuf.toString('base64'); + var len = tmp.length + (tmp.length / 64) + + 18 + 16 + header.length*2 + 10; + var buf = new Buffer(len); + var o = 0; + o += buf.write('-----BEGIN ' + header + '-----\n', o); + for (var i = 0; i < tmp.length; ) { + var limit = i + 64; + if (limit > tmp.length) + limit = tmp.length; + o += buf.write(tmp.slice(i, limit), o); + buf[o++] = 10; + i = limit; + } + o += buf.write('-----END ' + header + '-----\n', o); + + return (buf.slice(0, o)); +} diff --git a/appasar/canary/node_modules/sshpk/lib/formats/x509.js b/appasar/canary/node_modules/sshpk/lib/formats/x509.js new file mode 100644 index 0000000..23acd24 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/formats/x509.js @@ -0,0 +1,726 @@ +// Copyright 2017 Joyent, Inc. + +module.exports = { + read: read, + verify: verify, + sign: sign, + signAsync: signAsync, + write: write +}; + +var assert = require('assert-plus'); +var asn1 = require('asn1'); +var algs = require('../algs'); +var utils = require('../utils'); +var Key = require('../key'); +var PrivateKey = require('../private-key'); +var pem = require('./pem'); +var Identity = require('../identity'); +var Signature = require('../signature'); +var Certificate = require('../certificate'); +var pkcs8 = require('./pkcs8'); + +/* + * This file is based on RFC5280 (X.509). + */ + +/* Helper to read in a single mpint */ +function readMPInt(der, nm) { + assert.strictEqual(der.peek(), asn1.Ber.Integer, + nm + ' is not an Integer'); + return (utils.mpNormalize(der.readString(asn1.Ber.Integer, true))); +} + +function verify(cert, key) { + var sig = cert.signatures.x509; + assert.object(sig, 'x509 signature'); + + var algParts = sig.algo.split('-'); + if (algParts[0] !== key.type) + return (false); + + var blob = sig.cache; + if (blob === undefined) { + var der = new asn1.BerWriter(); + writeTBSCert(cert, der); + blob = der.buffer; + } + + var verifier = key.createVerify(algParts[1]); + verifier.write(blob); + return (verifier.verify(sig.signature)); +} + +function Local(i) { + return (asn1.Ber.Context | asn1.Ber.Constructor | i); +} + +function Context(i) { + return (asn1.Ber.Context | i); +} + +var SIGN_ALGS = { + 'rsa-md5': '1.2.840.113549.1.1.4', + 'rsa-sha1': '1.2.840.113549.1.1.5', + 'rsa-sha256': '1.2.840.113549.1.1.11', + 'rsa-sha384': '1.2.840.113549.1.1.12', + 'rsa-sha512': '1.2.840.113549.1.1.13', + 'dsa-sha1': '1.2.840.10040.4.3', + 'dsa-sha256': '2.16.840.1.101.3.4.3.2', + 'ecdsa-sha1': '1.2.840.10045.4.1', + 'ecdsa-sha256': '1.2.840.10045.4.3.2', + 'ecdsa-sha384': '1.2.840.10045.4.3.3', + 'ecdsa-sha512': '1.2.840.10045.4.3.4' +}; +Object.keys(SIGN_ALGS).forEach(function (k) { + SIGN_ALGS[SIGN_ALGS[k]] = k; +}); +SIGN_ALGS['1.3.14.3.2.3'] = 'rsa-md5'; +SIGN_ALGS['1.3.14.3.2.29'] = 'rsa-sha1'; + +var EXTS = { + 'issuerKeyId': '2.5.29.35', + 'altName': '2.5.29.17', + 'basicConstraints': '2.5.29.19', + 'keyUsage': '2.5.29.15', + 'extKeyUsage': '2.5.29.37' +}; + +function read(buf, options) { + if (typeof (buf) === 'string') { + buf = new Buffer(buf, 'binary'); + } + assert.buffer(buf, 'buf'); + + var der = new asn1.BerReader(buf); + + der.readSequence(); + if (Math.abs(der.length - der.remain) > 1) { + throw (new Error('DER sequence does not contain whole byte ' + + 'stream')); + } + + var tbsStart = der.offset; + der.readSequence(); + var sigOffset = der.offset + der.length; + var tbsEnd = sigOffset; + + if (der.peek() === Local(0)) { + der.readSequence(Local(0)); + var version = der.readInt(); + assert.ok(version <= 3, + 'only x.509 versions up to v3 supported'); + } + + var cert = {}; + cert.signatures = {}; + var sig = (cert.signatures.x509 = {}); + sig.extras = {}; + + cert.serial = readMPInt(der, 'serial'); + + der.readSequence(); + var after = der.offset + der.length; + var certAlgOid = der.readOID(); + var certAlg = SIGN_ALGS[certAlgOid]; + if (certAlg === undefined) + throw (new Error('unknown signature algorithm ' + certAlgOid)); + + der._offset = after; + cert.issuer = Identity.parseAsn1(der); + + der.readSequence(); + cert.validFrom = readDate(der); + cert.validUntil = readDate(der); + + cert.subjects = [Identity.parseAsn1(der)]; + + der.readSequence(); + after = der.offset + der.length; + cert.subjectKey = pkcs8.readPkcs8(undefined, 'public', der); + der._offset = after; + + /* issuerUniqueID */ + if (der.peek() === Local(1)) { + der.readSequence(Local(1)); + sig.extras.issuerUniqueID = + buf.slice(der.offset, der.offset + der.length); + der._offset += der.length; + } + + /* subjectUniqueID */ + if (der.peek() === Local(2)) { + der.readSequence(Local(2)); + sig.extras.subjectUniqueID = + buf.slice(der.offset, der.offset + der.length); + der._offset += der.length; + } + + /* extensions */ + if (der.peek() === Local(3)) { + der.readSequence(Local(3)); + var extEnd = der.offset + der.length; + der.readSequence(); + + while (der.offset < extEnd) + readExtension(cert, buf, der); + + assert.strictEqual(der.offset, extEnd); + } + + assert.strictEqual(der.offset, sigOffset); + + der.readSequence(); + after = der.offset + der.length; + var sigAlgOid = der.readOID(); + var sigAlg = SIGN_ALGS[sigAlgOid]; + if (sigAlg === undefined) + throw (new Error('unknown signature algorithm ' + sigAlgOid)); + der._offset = after; + + var sigData = der.readString(asn1.Ber.BitString, true); + if (sigData[0] === 0) + sigData = sigData.slice(1); + var algParts = sigAlg.split('-'); + + sig.signature = Signature.parse(sigData, algParts[0], 'asn1'); + sig.signature.hashAlgorithm = algParts[1]; + sig.algo = sigAlg; + sig.cache = buf.slice(tbsStart, tbsEnd); + + return (new Certificate(cert)); +} + +function readDate(der) { + if (der.peek() === asn1.Ber.UTCTime) { + return (utcTimeToDate(der.readString(asn1.Ber.UTCTime))); + } else if (der.peek() === asn1.Ber.GeneralizedTime) { + return (gTimeToDate(der.readString(asn1.Ber.GeneralizedTime))); + } else { + throw (new Error('Unsupported date format')); + } +} + +/* RFC5280, section 4.2.1.6 (GeneralName type) */ +var ALTNAME = { + OtherName: Local(0), + RFC822Name: Context(1), + DNSName: Context(2), + X400Address: Local(3), + DirectoryName: Local(4), + EDIPartyName: Local(5), + URI: Context(6), + IPAddress: Context(7), + OID: Context(8) +}; + +/* RFC5280, section 4.2.1.12 (KeyPurposeId) */ +var EXTPURPOSE = { + 'serverAuth': '1.3.6.1.5.5.7.3.1', + 'clientAuth': '1.3.6.1.5.5.7.3.2', + 'codeSigning': '1.3.6.1.5.5.7.3.3', + + /* See https://github.com/joyent/oid-docs/blob/master/root.md */ + 'joyentDocker': '1.3.6.1.4.1.38678.1.4.1', + 'joyentCmon': '1.3.6.1.4.1.38678.1.4.2' +}; +var EXTPURPOSE_REV = {}; +Object.keys(EXTPURPOSE).forEach(function (k) { + EXTPURPOSE_REV[EXTPURPOSE[k]] = k; +}); + +var KEYUSEBITS = [ + 'signature', 'identity', 'keyEncryption', + 'encryption', 'keyAgreement', 'ca', 'crl' +]; + +function readExtension(cert, buf, der) { + der.readSequence(); + var after = der.offset + der.length; + var extId = der.readOID(); + var id; + var sig = cert.signatures.x509; + sig.extras.exts = []; + + var critical; + if (der.peek() === asn1.Ber.Boolean) + critical = der.readBoolean(); + + switch (extId) { + case (EXTS.basicConstraints): + der.readSequence(asn1.Ber.OctetString); + der.readSequence(); + var bcEnd = der.offset + der.length; + var ca = false; + if (der.peek() === asn1.Ber.Boolean) + ca = der.readBoolean(); + if (cert.purposes === undefined) + cert.purposes = []; + if (ca === true) + cert.purposes.push('ca'); + var bc = { oid: extId, critical: critical }; + if (der.offset < bcEnd && der.peek() === asn1.Ber.Integer) + bc.pathLen = der.readInt(); + sig.extras.exts.push(bc); + break; + case (EXTS.extKeyUsage): + der.readSequence(asn1.Ber.OctetString); + der.readSequence(); + if (cert.purposes === undefined) + cert.purposes = []; + var ekEnd = der.offset + der.length; + while (der.offset < ekEnd) { + var oid = der.readOID(); + cert.purposes.push(EXTPURPOSE_REV[oid] || oid); + } + /* + * This is a bit of a hack: in the case where we have a cert + * that's only allowed to do serverAuth or clientAuth (and not + * the other), we want to make sure all our Subjects are of + * the right type. But we already parsed our Subjects and + * decided if they were hosts or users earlier (since it appears + * first in the cert). + * + * So we go through and mutate them into the right kind here if + * it doesn't match. This might not be hugely beneficial, as it + * seems that single-purpose certs are not often seen in the + * wild. + */ + if (cert.purposes.indexOf('serverAuth') !== -1 && + cert.purposes.indexOf('clientAuth') === -1) { + cert.subjects.forEach(function (ide) { + if (ide.type !== 'host') { + ide.type = 'host'; + ide.hostname = ide.uid || + ide.email || + ide.components[0].value; + } + }); + } else if (cert.purposes.indexOf('clientAuth') !== -1 && + cert.purposes.indexOf('serverAuth') === -1) { + cert.subjects.forEach(function (ide) { + if (ide.type !== 'user') { + ide.type = 'user'; + ide.uid = ide.hostname || + ide.email || + ide.components[0].value; + } + }); + } + sig.extras.exts.push({ oid: extId, critical: critical }); + break; + case (EXTS.keyUsage): + der.readSequence(asn1.Ber.OctetString); + var bits = der.readString(asn1.Ber.BitString, true); + var setBits = readBitField(bits, KEYUSEBITS); + setBits.forEach(function (bit) { + if (cert.purposes === undefined) + cert.purposes = []; + if (cert.purposes.indexOf(bit) === -1) + cert.purposes.push(bit); + }); + sig.extras.exts.push({ oid: extId, critical: critical, + bits: bits }); + break; + case (EXTS.altName): + der.readSequence(asn1.Ber.OctetString); + der.readSequence(); + var aeEnd = der.offset + der.length; + while (der.offset < aeEnd) { + switch (der.peek()) { + case ALTNAME.OtherName: + case ALTNAME.EDIPartyName: + der.readSequence(); + der._offset += der.length; + break; + case ALTNAME.OID: + der.readOID(ALTNAME.OID); + break; + case ALTNAME.RFC822Name: + /* RFC822 specifies email addresses */ + var email = der.readString(ALTNAME.RFC822Name); + id = Identity.forEmail(email); + if (!cert.subjects[0].equals(id)) + cert.subjects.push(id); + break; + case ALTNAME.DirectoryName: + der.readSequence(ALTNAME.DirectoryName); + id = Identity.parseAsn1(der); + if (!cert.subjects[0].equals(id)) + cert.subjects.push(id); + break; + case ALTNAME.DNSName: + var host = der.readString( + ALTNAME.DNSName); + id = Identity.forHost(host); + if (!cert.subjects[0].equals(id)) + cert.subjects.push(id); + break; + default: + der.readString(der.peek()); + break; + } + } + sig.extras.exts.push({ oid: extId, critical: critical }); + break; + default: + sig.extras.exts.push({ + oid: extId, + critical: critical, + data: der.readString(asn1.Ber.OctetString, true) + }); + break; + } + + der._offset = after; +} + +var UTCTIME_RE = + /^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?Z$/; +function utcTimeToDate(t) { + var m = t.match(UTCTIME_RE); + assert.ok(m, 'timestamps must be in UTC'); + var d = new Date(); + + var thisYear = d.getUTCFullYear(); + var century = Math.floor(thisYear / 100) * 100; + + var year = parseInt(m[1], 10); + if (thisYear % 100 < 50 && year >= 60) + year += (century - 1); + else + year += century; + d.setUTCFullYear(year, parseInt(m[2], 10) - 1, parseInt(m[3], 10)); + d.setUTCHours(parseInt(m[4], 10), parseInt(m[5], 10)); + if (m[6] && m[6].length > 0) + d.setUTCSeconds(parseInt(m[6], 10)); + return (d); +} + +var GTIME_RE = + /^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?Z$/; +function gTimeToDate(t) { + var m = t.match(GTIME_RE); + assert.ok(m); + var d = new Date(); + + d.setUTCFullYear(parseInt(m[1], 10), parseInt(m[2], 10) - 1, + parseInt(m[3], 10)); + d.setUTCHours(parseInt(m[4], 10), parseInt(m[5], 10)); + if (m[6] && m[6].length > 0) + d.setUTCSeconds(parseInt(m[6], 10)); + return (d); +} + +function zeroPad(n) { + var s = '' + n; + while (s.length < 2) + s = '0' + s; + return (s); +} + +function dateToUTCTime(d) { + var s = ''; + s += zeroPad(d.getUTCFullYear() % 100); + s += zeroPad(d.getUTCMonth() + 1); + s += zeroPad(d.getUTCDate()); + s += zeroPad(d.getUTCHours()); + s += zeroPad(d.getUTCMinutes()); + s += zeroPad(d.getUTCSeconds()); + s += 'Z'; + return (s); +} + +function sign(cert, key) { + if (cert.signatures.x509 === undefined) + cert.signatures.x509 = {}; + var sig = cert.signatures.x509; + + sig.algo = key.type + '-' + key.defaultHashAlgorithm(); + if (SIGN_ALGS[sig.algo] === undefined) + return (false); + + var der = new asn1.BerWriter(); + writeTBSCert(cert, der); + var blob = der.buffer; + sig.cache = blob; + + var signer = key.createSign(); + signer.write(blob); + cert.signatures.x509.signature = signer.sign(); + + return (true); +} + +function signAsync(cert, signer, done) { + if (cert.signatures.x509 === undefined) + cert.signatures.x509 = {}; + var sig = cert.signatures.x509; + + var der = new asn1.BerWriter(); + writeTBSCert(cert, der); + var blob = der.buffer; + sig.cache = blob; + + signer(blob, function (err, signature) { + if (err) { + done(err); + return; + } + sig.algo = signature.type + '-' + signature.hashAlgorithm; + if (SIGN_ALGS[sig.algo] === undefined) { + done(new Error('Invalid signing algorithm "' + + sig.algo + '"')); + return; + } + sig.signature = signature; + done(); + }); +} + +function write(cert, options) { + var sig = cert.signatures.x509; + assert.object(sig, 'x509 signature'); + + var der = new asn1.BerWriter(); + der.startSequence(); + if (sig.cache) { + der._ensure(sig.cache.length); + sig.cache.copy(der._buf, der._offset); + der._offset += sig.cache.length; + } else { + writeTBSCert(cert, der); + } + + der.startSequence(); + der.writeOID(SIGN_ALGS[sig.algo]); + if (sig.algo.match(/^rsa-/)) + der.writeNull(); + der.endSequence(); + + var sigData = sig.signature.toBuffer('asn1'); + var data = new Buffer(sigData.length + 1); + data[0] = 0; + sigData.copy(data, 1); + der.writeBuffer(data, asn1.Ber.BitString); + der.endSequence(); + + return (der.buffer); +} + +function writeTBSCert(cert, der) { + var sig = cert.signatures.x509; + assert.object(sig, 'x509 signature'); + + der.startSequence(); + + der.startSequence(Local(0)); + der.writeInt(2); + der.endSequence(); + + der.writeBuffer(utils.mpNormalize(cert.serial), asn1.Ber.Integer); + + der.startSequence(); + der.writeOID(SIGN_ALGS[sig.algo]); + der.endSequence(); + + cert.issuer.toAsn1(der); + + der.startSequence(); + der.writeString(dateToUTCTime(cert.validFrom), asn1.Ber.UTCTime); + der.writeString(dateToUTCTime(cert.validUntil), asn1.Ber.UTCTime); + der.endSequence(); + + var subject = cert.subjects[0]; + var altNames = cert.subjects.slice(1); + subject.toAsn1(der); + + pkcs8.writePkcs8(der, cert.subjectKey); + + if (sig.extras && sig.extras.issuerUniqueID) { + der.writeBuffer(sig.extras.issuerUniqueID, Local(1)); + } + + if (sig.extras && sig.extras.subjectUniqueID) { + der.writeBuffer(sig.extras.subjectUniqueID, Local(2)); + } + + if (altNames.length > 0 || subject.type === 'host' || + (cert.purposes !== undefined && cert.purposes.length > 0) || + (sig.extras && sig.extras.exts)) { + der.startSequence(Local(3)); + der.startSequence(); + + var exts = []; + if (cert.purposes !== undefined && cert.purposes.length > 0) { + exts.push({ + oid: EXTS.basicConstraints, + critical: true + }); + exts.push({ + oid: EXTS.keyUsage, + critical: true + }); + exts.push({ + oid: EXTS.extKeyUsage, + critical: true + }); + } + exts.push({ oid: EXTS.altName }); + if (sig.extras && sig.extras.exts) + exts = sig.extras.exts; + + for (var i = 0; i < exts.length; ++i) { + der.startSequence(); + der.writeOID(exts[i].oid); + + if (exts[i].critical !== undefined) + der.writeBoolean(exts[i].critical); + + if (exts[i].oid === EXTS.altName) { + der.startSequence(asn1.Ber.OctetString); + der.startSequence(); + if (subject.type === 'host') { + der.writeString(subject.hostname, + Context(2)); + } + for (var j = 0; j < altNames.length; ++j) { + if (altNames[j].type === 'host') { + der.writeString( + altNames[j].hostname, + ALTNAME.DNSName); + } else if (altNames[j].type === + 'email') { + der.writeString( + altNames[j].email, + ALTNAME.RFC822Name); + } else { + /* + * Encode anything else as a + * DN style name for now. + */ + der.startSequence( + ALTNAME.DirectoryName); + altNames[j].toAsn1(der); + der.endSequence(); + } + } + der.endSequence(); + der.endSequence(); + } else if (exts[i].oid === EXTS.basicConstraints) { + der.startSequence(asn1.Ber.OctetString); + der.startSequence(); + var ca = (cert.purposes.indexOf('ca') !== -1); + var pathLen = exts[i].pathLen; + der.writeBoolean(ca); + if (pathLen !== undefined) + der.writeInt(pathLen); + der.endSequence(); + der.endSequence(); + } else if (exts[i].oid === EXTS.extKeyUsage) { + der.startSequence(asn1.Ber.OctetString); + der.startSequence(); + cert.purposes.forEach(function (purpose) { + if (purpose === 'ca') + return; + if (KEYUSEBITS.indexOf(purpose) !== -1) + return; + var oid = purpose; + if (EXTPURPOSE[purpose] !== undefined) + oid = EXTPURPOSE[purpose]; + der.writeOID(oid); + }); + der.endSequence(); + der.endSequence(); + } else if (exts[i].oid === EXTS.keyUsage) { + der.startSequence(asn1.Ber.OctetString); + /* + * If we parsed this certificate from a byte + * stream (i.e. we didn't generate it in sshpk) + * then we'll have a ".bits" property on the + * ext with the original raw byte contents. + * + * If we have this, use it here instead of + * regenerating it. This guarantees we output + * the same data we parsed, so signatures still + * validate. + */ + if (exts[i].bits !== undefined) { + der.writeBuffer(exts[i].bits, + asn1.Ber.BitString); + } else { + var bits = writeBitField(cert.purposes, + KEYUSEBITS); + der.writeBuffer(bits, + asn1.Ber.BitString); + } + der.endSequence(); + } else { + der.writeBuffer(exts[i].data, + asn1.Ber.OctetString); + } + + der.endSequence(); + } + + der.endSequence(); + der.endSequence(); + } + + der.endSequence(); +} + +/* + * Reads an ASN.1 BER bitfield out of the Buffer produced by doing + * `BerReader#readString(asn1.Ber.BitString)`. That function gives us the raw + * contents of the BitString tag, which is a count of unused bits followed by + * the bits as a right-padded byte string. + * + * `bits` is the Buffer, `bitIndex` should contain an array of string names + * for the bits in the string, ordered starting with bit #0 in the ASN.1 spec. + * + * Returns an array of Strings, the names of the bits that were set to 1. + */ +function readBitField(bits, bitIndex) { + var bitLen = 8 * (bits.length - 1) - bits[0]; + var setBits = {}; + for (var i = 0; i < bitLen; ++i) { + var byteN = 1 + Math.floor(i / 8); + var bit = 7 - (i % 8); + var mask = 1 << bit; + var bitVal = ((bits[byteN] & mask) !== 0); + var name = bitIndex[i]; + if (bitVal && typeof (name) === 'string') { + setBits[name] = true; + } + } + return (Object.keys(setBits)); +} + +/* + * `setBits` is an array of strings, containing the names for each bit that + * sould be set to 1. `bitIndex` is same as in `readBitField()`. + * + * Returns a Buffer, ready to be written out with `BerWriter#writeString()`. + */ +function writeBitField(setBits, bitIndex) { + var bitLen = bitIndex.length; + var blen = Math.ceil(bitLen / 8); + var unused = blen * 8 - bitLen; + var bits = new Buffer(1 + blen); + bits.fill(0); + bits[0] = unused; + for (var i = 0; i < bitLen; ++i) { + var byteN = 1 + Math.floor(i / 8); + var bit = 7 - (i % 8); + var mask = 1 << bit; + var name = bitIndex[i]; + if (name === undefined) + continue; + var bitVal = (setBits.indexOf(name) !== -1); + if (bitVal) { + bits[byteN] |= mask; + } + } + return (bits); +} diff --git a/appasar/canary/node_modules/sshpk/lib/identity.js b/appasar/canary/node_modules/sshpk/lib/identity.js new file mode 100644 index 0000000..5e9021f --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/identity.js @@ -0,0 +1,277 @@ +// Copyright 2017 Joyent, Inc. + +module.exports = Identity; + +var assert = require('assert-plus'); +var algs = require('./algs'); +var crypto = require('crypto'); +var Fingerprint = require('./fingerprint'); +var Signature = require('./signature'); +var errs = require('./errors'); +var util = require('util'); +var utils = require('./utils'); +var asn1 = require('asn1'); + +/*JSSTYLED*/ +var DNS_NAME_RE = /^([*]|[a-z0-9][a-z0-9\-]{0,62})(?:\.([*]|[a-z0-9][a-z0-9\-]{0,62}))*$/i; + +var oids = {}; +oids.cn = '2.5.4.3'; +oids.o = '2.5.4.10'; +oids.ou = '2.5.4.11'; +oids.l = '2.5.4.7'; +oids.s = '2.5.4.8'; +oids.c = '2.5.4.6'; +oids.sn = '2.5.4.4'; +oids.dc = '0.9.2342.19200300.100.1.25'; +oids.uid = '0.9.2342.19200300.100.1.1'; +oids.mail = '0.9.2342.19200300.100.1.3'; + +var unoids = {}; +Object.keys(oids).forEach(function (k) { + unoids[oids[k]] = k; +}); + +function Identity(opts) { + var self = this; + assert.object(opts, 'options'); + assert.arrayOfObject(opts.components, 'options.components'); + this.components = opts.components; + this.componentLookup = {}; + this.components.forEach(function (c) { + if (c.name && !c.oid) + c.oid = oids[c.name]; + if (c.oid && !c.name) + c.name = unoids[c.oid]; + if (self.componentLookup[c.name] === undefined) + self.componentLookup[c.name] = []; + self.componentLookup[c.name].push(c); + }); + if (this.componentLookup.cn && this.componentLookup.cn.length > 0) { + this.cn = this.componentLookup.cn[0].value; + } + assert.optionalString(opts.type, 'options.type'); + if (opts.type === undefined) { + if (this.components.length === 1 && + this.componentLookup.cn && + this.componentLookup.cn.length === 1 && + this.componentLookup.cn[0].value.match(DNS_NAME_RE)) { + this.type = 'host'; + this.hostname = this.componentLookup.cn[0].value; + + } else if (this.componentLookup.dc && + this.components.length === this.componentLookup.dc.length) { + this.type = 'host'; + this.hostname = this.componentLookup.dc.map( + function (c) { + return (c.value); + }).join('.'); + + } else if (this.componentLookup.uid && + this.components.length === + this.componentLookup.uid.length) { + this.type = 'user'; + this.uid = this.componentLookup.uid[0].value; + + } else if (this.componentLookup.cn && + this.componentLookup.cn.length === 1 && + this.componentLookup.cn[0].value.match(DNS_NAME_RE)) { + this.type = 'host'; + this.hostname = this.componentLookup.cn[0].value; + + } else if (this.componentLookup.uid && + this.componentLookup.uid.length === 1) { + this.type = 'user'; + this.uid = this.componentLookup.uid[0].value; + + } else if (this.componentLookup.mail && + this.componentLookup.mail.length === 1) { + this.type = 'email'; + this.email = this.componentLookup.mail[0].value; + + } else if (this.componentLookup.cn && + this.componentLookup.cn.length === 1) { + this.type = 'user'; + this.uid = this.componentLookup.cn[0].value; + + } else { + this.type = 'unknown'; + } + } else { + this.type = opts.type; + if (this.type === 'host') + this.hostname = opts.hostname; + else if (this.type === 'user') + this.uid = opts.uid; + else if (this.type === 'email') + this.email = opts.email; + else + throw (new Error('Unknown type ' + this.type)); + } +} + +Identity.prototype.toString = function () { + return (this.components.map(function (c) { + return (c.name.toUpperCase() + '=' + c.value); + }).join(', ')); +}; + +/* + * These are from X.680 -- PrintableString allowed chars are in section 37.4 + * table 8. Spec for IA5Strings is "1,6 + SPACE + DEL" where 1 refers to + * ISO IR #001 (standard ASCII control characters) and 6 refers to ISO IR #006 + * (the basic ASCII character set). + */ +/* JSSTYLED */ +var NOT_PRINTABLE = /[^a-zA-Z0-9 '(),+.\/:=?-]/; +/* JSSTYLED */ +var NOT_IA5 = /[^\x00-\x7f]/; + +Identity.prototype.toAsn1 = function (der, tag) { + der.startSequence(tag); + this.components.forEach(function (c) { + der.startSequence(asn1.Ber.Constructor | asn1.Ber.Set); + der.startSequence(); + der.writeOID(c.oid); + /* + * If we fit in a PrintableString, use that. Otherwise use an + * IA5String or UTF8String. + */ + if (c.value.match(NOT_IA5)) { + var v = new Buffer(c.value, 'utf8'); + der.writeBuffer(v, asn1.Ber.Utf8String); + } else if (c.value.match(NOT_PRINTABLE)) { + der.writeString(c.value, asn1.Ber.IA5String); + } else { + der.writeString(c.value, asn1.Ber.PrintableString); + } + der.endSequence(); + der.endSequence(); + }); + der.endSequence(); +}; + +function globMatch(a, b) { + if (a === '**' || b === '**') + return (true); + var aParts = a.split('.'); + var bParts = b.split('.'); + if (aParts.length !== bParts.length) + return (false); + for (var i = 0; i < aParts.length; ++i) { + if (aParts[i] === '*' || bParts[i] === '*') + continue; + if (aParts[i] !== bParts[i]) + return (false); + } + return (true); +} + +Identity.prototype.equals = function (other) { + if (!Identity.isIdentity(other, [1, 0])) + return (false); + if (other.components.length !== this.components.length) + return (false); + for (var i = 0; i < this.components.length; ++i) { + if (this.components[i].oid !== other.components[i].oid) + return (false); + if (!globMatch(this.components[i].value, + other.components[i].value)) { + return (false); + } + } + return (true); +}; + +Identity.forHost = function (hostname) { + assert.string(hostname, 'hostname'); + return (new Identity({ + type: 'host', + hostname: hostname, + components: [ { name: 'cn', value: hostname } ] + })); +}; + +Identity.forUser = function (uid) { + assert.string(uid, 'uid'); + return (new Identity({ + type: 'user', + uid: uid, + components: [ { name: 'uid', value: uid } ] + })); +}; + +Identity.forEmail = function (email) { + assert.string(email, 'email'); + return (new Identity({ + type: 'email', + email: email, + components: [ { name: 'mail', value: email } ] + })); +}; + +Identity.parseDN = function (dn) { + assert.string(dn, 'dn'); + var parts = dn.split(','); + var cmps = parts.map(function (c) { + c = c.trim(); + var eqPos = c.indexOf('='); + var name = c.slice(0, eqPos).toLowerCase(); + var value = c.slice(eqPos + 1); + return ({ name: name, value: value }); + }); + return (new Identity({ components: cmps })); +}; + +Identity.parseAsn1 = function (der, top) { + var components = []; + der.readSequence(top); + var end = der.offset + der.length; + while (der.offset < end) { + der.readSequence(asn1.Ber.Constructor | asn1.Ber.Set); + var after = der.offset + der.length; + der.readSequence(); + var oid = der.readOID(); + var type = der.peek(); + var value; + switch (type) { + case asn1.Ber.PrintableString: + case asn1.Ber.IA5String: + case asn1.Ber.OctetString: + case asn1.Ber.T61String: + value = der.readString(type); + break; + case asn1.Ber.Utf8String: + value = der.readString(type, true); + value = value.toString('utf8'); + break; + case asn1.Ber.CharacterString: + case asn1.Ber.BMPString: + value = der.readString(type, true); + value = value.toString('utf16le'); + break; + default: + throw (new Error('Unknown asn1 type ' + type)); + } + components.push({ oid: oid, value: value }); + der._offset = after; + } + der._offset = end; + return (new Identity({ + components: components + })); +}; + +Identity.isIdentity = function (obj, ver) { + return (utils.isCompatible(obj, Identity, ver)); +}; + +/* + * API versions for Identity: + * [1,0] -- initial ver + */ +Identity.prototype._sshpkApiVersion = [1, 0]; + +Identity._oldVersionDetect = function (obj) { + return ([1, 0]); +}; diff --git a/appasar/canary/node_modules/sshpk/lib/index.js b/appasar/canary/node_modules/sshpk/lib/index.js new file mode 100644 index 0000000..cb8cd1a --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/index.js @@ -0,0 +1,39 @@ +// Copyright 2015 Joyent, Inc. + +var Key = require('./key'); +var Fingerprint = require('./fingerprint'); +var Signature = require('./signature'); +var PrivateKey = require('./private-key'); +var Certificate = require('./certificate'); +var Identity = require('./identity'); +var errs = require('./errors'); + +module.exports = { + /* top-level classes */ + Key: Key, + parseKey: Key.parse, + Fingerprint: Fingerprint, + parseFingerprint: Fingerprint.parse, + Signature: Signature, + parseSignature: Signature.parse, + PrivateKey: PrivateKey, + parsePrivateKey: PrivateKey.parse, + generatePrivateKey: PrivateKey.generate, + Certificate: Certificate, + parseCertificate: Certificate.parse, + createSelfSignedCertificate: Certificate.createSelfSigned, + createCertificate: Certificate.create, + Identity: Identity, + identityFromDN: Identity.parseDN, + identityForHost: Identity.forHost, + identityForUser: Identity.forUser, + identityForEmail: Identity.forEmail, + + /* errors */ + FingerprintFormatError: errs.FingerprintFormatError, + InvalidAlgorithmError: errs.InvalidAlgorithmError, + KeyParseError: errs.KeyParseError, + SignatureParseError: errs.SignatureParseError, + KeyEncryptedError: errs.KeyEncryptedError, + CertificateParseError: errs.CertificateParseError +}; diff --git a/appasar/canary/node_modules/sshpk/lib/key.js b/appasar/canary/node_modules/sshpk/lib/key.js new file mode 100644 index 0000000..64e24b4 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/key.js @@ -0,0 +1,274 @@ +// Copyright 2017 Joyent, Inc. + +module.exports = Key; + +var assert = require('assert-plus'); +var algs = require('./algs'); +var crypto = require('crypto'); +var Fingerprint = require('./fingerprint'); +var Signature = require('./signature'); +var DiffieHellman = require('./dhe').DiffieHellman; +var errs = require('./errors'); +var utils = require('./utils'); +var PrivateKey = require('./private-key'); +var edCompat; + +try { + edCompat = require('./ed-compat'); +} catch (e) { + /* Just continue through, and bail out if we try to use it. */ +} + +var InvalidAlgorithmError = errs.InvalidAlgorithmError; +var KeyParseError = errs.KeyParseError; + +var formats = {}; +formats['auto'] = require('./formats/auto'); +formats['pem'] = require('./formats/pem'); +formats['pkcs1'] = require('./formats/pkcs1'); +formats['pkcs8'] = require('./formats/pkcs8'); +formats['rfc4253'] = require('./formats/rfc4253'); +formats['ssh'] = require('./formats/ssh'); +formats['ssh-private'] = require('./formats/ssh-private'); +formats['openssh'] = formats['ssh-private']; + +function Key(opts) { + assert.object(opts, 'options'); + assert.arrayOfObject(opts.parts, 'options.parts'); + assert.string(opts.type, 'options.type'); + assert.optionalString(opts.comment, 'options.comment'); + + var algInfo = algs.info[opts.type]; + if (typeof (algInfo) !== 'object') + throw (new InvalidAlgorithmError(opts.type)); + + var partLookup = {}; + for (var i = 0; i < opts.parts.length; ++i) { + var part = opts.parts[i]; + partLookup[part.name] = part; + } + + this.type = opts.type; + this.parts = opts.parts; + this.part = partLookup; + this.comment = undefined; + this.source = opts.source; + + /* for speeding up hashing/fingerprint operations */ + this._rfc4253Cache = opts._rfc4253Cache; + this._hashCache = {}; + + var sz; + this.curve = undefined; + if (this.type === 'ecdsa') { + var curve = this.part.curve.data.toString(); + this.curve = curve; + sz = algs.curves[curve].size; + } else if (this.type === 'ed25519' || this.type === 'curve25519') { + sz = 256; + this.curve = 'curve25519'; + } else { + var szPart = this.part[algInfo.sizePart]; + sz = szPart.data.length; + sz = sz * 8 - utils.countZeros(szPart.data); + } + this.size = sz; +} + +Key.formats = formats; + +Key.prototype.toBuffer = function (format, options) { + if (format === undefined) + format = 'ssh'; + assert.string(format, 'format'); + assert.object(formats[format], 'formats[format]'); + assert.optionalObject(options, 'options'); + + if (format === 'rfc4253') { + if (this._rfc4253Cache === undefined) + this._rfc4253Cache = formats['rfc4253'].write(this); + return (this._rfc4253Cache); + } + + return (formats[format].write(this, options)); +}; + +Key.prototype.toString = function (format, options) { + return (this.toBuffer(format, options).toString()); +}; + +Key.prototype.hash = function (algo) { + assert.string(algo, 'algorithm'); + algo = algo.toLowerCase(); + if (algs.hashAlgs[algo] === undefined) + throw (new InvalidAlgorithmError(algo)); + + if (this._hashCache[algo]) + return (this._hashCache[algo]); + + var hash = crypto.createHash(algo). + update(this.toBuffer('rfc4253')).digest(); + this._hashCache[algo] = hash; + return (hash); +}; + +Key.prototype.fingerprint = function (algo) { + if (algo === undefined) + algo = 'sha256'; + assert.string(algo, 'algorithm'); + var opts = { + type: 'key', + hash: this.hash(algo), + algorithm: algo + }; + return (new Fingerprint(opts)); +}; + +Key.prototype.defaultHashAlgorithm = function () { + var hashAlgo = 'sha1'; + if (this.type === 'rsa') + hashAlgo = 'sha256'; + if (this.type === 'dsa' && this.size > 1024) + hashAlgo = 'sha256'; + if (this.type === 'ed25519') + hashAlgo = 'sha512'; + if (this.type === 'ecdsa') { + if (this.size <= 256) + hashAlgo = 'sha256'; + else if (this.size <= 384) + hashAlgo = 'sha384'; + else + hashAlgo = 'sha512'; + } + return (hashAlgo); +}; + +Key.prototype.createVerify = function (hashAlgo) { + if (hashAlgo === undefined) + hashAlgo = this.defaultHashAlgorithm(); + assert.string(hashAlgo, 'hash algorithm'); + + /* ED25519 is not supported by OpenSSL, use a javascript impl. */ + if (this.type === 'ed25519' && edCompat !== undefined) + return (new edCompat.Verifier(this, hashAlgo)); + if (this.type === 'curve25519') + throw (new Error('Curve25519 keys are not suitable for ' + + 'signing or verification')); + + var v, nm, err; + try { + nm = hashAlgo.toUpperCase(); + v = crypto.createVerify(nm); + } catch (e) { + err = e; + } + if (v === undefined || (err instanceof Error && + err.message.match(/Unknown message digest/))) { + nm = 'RSA-'; + nm += hashAlgo.toUpperCase(); + v = crypto.createVerify(nm); + } + assert.ok(v, 'failed to create verifier'); + var oldVerify = v.verify.bind(v); + var key = this.toBuffer('pkcs8'); + var curve = this.curve; + var self = this; + v.verify = function (signature, fmt) { + if (Signature.isSignature(signature, [2, 0])) { + if (signature.type !== self.type) + return (false); + if (signature.hashAlgorithm && + signature.hashAlgorithm !== hashAlgo) + return (false); + if (signature.curve && self.type === 'ecdsa' && + signature.curve !== curve) + return (false); + return (oldVerify(key, signature.toBuffer('asn1'))); + + } else if (typeof (signature) === 'string' || + Buffer.isBuffer(signature)) { + return (oldVerify(key, signature, fmt)); + + /* + * Avoid doing this on valid arguments, walking the prototype + * chain can be quite slow. + */ + } else if (Signature.isSignature(signature, [1, 0])) { + throw (new Error('signature was created by too old ' + + 'a version of sshpk and cannot be verified')); + + } else { + throw (new TypeError('signature must be a string, ' + + 'Buffer, or Signature object')); + } + }; + return (v); +}; + +Key.prototype.createDiffieHellman = function () { + if (this.type === 'rsa') + throw (new Error('RSA keys do not support Diffie-Hellman')); + + return (new DiffieHellman(this)); +}; +Key.prototype.createDH = Key.prototype.createDiffieHellman; + +Key.parse = function (data, format, options) { + if (typeof (data) !== 'string') + assert.buffer(data, 'data'); + if (format === undefined) + format = 'auto'; + assert.string(format, 'format'); + if (typeof (options) === 'string') + options = { filename: options }; + assert.optionalObject(options, 'options'); + if (options === undefined) + options = {}; + assert.optionalString(options.filename, 'options.filename'); + if (options.filename === undefined) + options.filename = '(unnamed)'; + + assert.object(formats[format], 'formats[format]'); + + try { + var k = formats[format].read(data, options); + if (k instanceof PrivateKey) + k = k.toPublic(); + if (!k.comment) + k.comment = options.filename; + return (k); + } catch (e) { + if (e.name === 'KeyEncryptedError') + throw (e); + throw (new KeyParseError(options.filename, format, e)); + } +}; + +Key.isKey = function (obj, ver) { + return (utils.isCompatible(obj, Key, ver)); +}; + +/* + * API versions for Key: + * [1,0] -- initial ver, may take Signature for createVerify or may not + * [1,1] -- added pkcs1, pkcs8 formats + * [1,2] -- added auto, ssh-private, openssh formats + * [1,3] -- added defaultHashAlgorithm + * [1,4] -- added ed support, createDH + * [1,5] -- first explicitly tagged version + */ +Key.prototype._sshpkApiVersion = [1, 5]; + +Key._oldVersionDetect = function (obj) { + assert.func(obj.toBuffer); + assert.func(obj.fingerprint); + if (obj.createDH) + return ([1, 4]); + if (obj.defaultHashAlgorithm) + return ([1, 3]); + if (obj.formats['auto']) + return ([1, 2]); + if (obj.formats['pkcs1']) + return ([1, 1]); + return ([1, 0]); +}; diff --git a/appasar/canary/node_modules/sshpk/lib/private-key.js b/appasar/canary/node_modules/sshpk/lib/private-key.js new file mode 100644 index 0000000..36b6f8c --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/private-key.js @@ -0,0 +1,254 @@ +// Copyright 2017 Joyent, Inc. + +module.exports = PrivateKey; + +var assert = require('assert-plus'); +var algs = require('./algs'); +var crypto = require('crypto'); +var Fingerprint = require('./fingerprint'); +var Signature = require('./signature'); +var errs = require('./errors'); +var util = require('util'); +var utils = require('./utils'); +var dhe = require('./dhe'); +var generateECDSA = dhe.generateECDSA; +var generateED25519 = dhe.generateED25519; +var edCompat; +var nacl; + +try { + edCompat = require('./ed-compat'); +} catch (e) { + /* Just continue through, and bail out if we try to use it. */ +} + +var Key = require('./key'); + +var InvalidAlgorithmError = errs.InvalidAlgorithmError; +var KeyParseError = errs.KeyParseError; +var KeyEncryptedError = errs.KeyEncryptedError; + +var formats = {}; +formats['auto'] = require('./formats/auto'); +formats['pem'] = require('./formats/pem'); +formats['pkcs1'] = require('./formats/pkcs1'); +formats['pkcs8'] = require('./formats/pkcs8'); +formats['rfc4253'] = require('./formats/rfc4253'); +formats['ssh-private'] = require('./formats/ssh-private'); +formats['openssh'] = formats['ssh-private']; +formats['ssh'] = formats['ssh-private']; + +function PrivateKey(opts) { + assert.object(opts, 'options'); + Key.call(this, opts); + + this._pubCache = undefined; +} +util.inherits(PrivateKey, Key); + +PrivateKey.formats = formats; + +PrivateKey.prototype.toBuffer = function (format, options) { + if (format === undefined) + format = 'pkcs1'; + assert.string(format, 'format'); + assert.object(formats[format], 'formats[format]'); + assert.optionalObject(options, 'options'); + + return (formats[format].write(this, options)); +}; + +PrivateKey.prototype.hash = function (algo) { + return (this.toPublic().hash(algo)); +}; + +PrivateKey.prototype.toPublic = function () { + if (this._pubCache) + return (this._pubCache); + + var algInfo = algs.info[this.type]; + var pubParts = []; + for (var i = 0; i < algInfo.parts.length; ++i) { + var p = algInfo.parts[i]; + pubParts.push(this.part[p]); + } + + this._pubCache = new Key({ + type: this.type, + source: this, + parts: pubParts + }); + if (this.comment) + this._pubCache.comment = this.comment; + return (this._pubCache); +}; + +PrivateKey.prototype.derive = function (newType) { + assert.string(newType, 'type'); + var priv, pub, pair; + + if (this.type === 'ed25519' && newType === 'curve25519') { + if (nacl === undefined) + nacl = require('tweetnacl'); + + priv = this.part.r.data; + if (priv[0] === 0x00) + priv = priv.slice(1); + priv = priv.slice(0, 32); + + pair = nacl.box.keyPair.fromSecretKey(new Uint8Array(priv)); + pub = new Buffer(pair.publicKey); + priv = Buffer.concat([priv, pub]); + + return (new PrivateKey({ + type: 'curve25519', + parts: [ + { name: 'R', data: utils.mpNormalize(pub) }, + { name: 'r', data: priv } + ] + })); + } else if (this.type === 'curve25519' && newType === 'ed25519') { + if (nacl === undefined) + nacl = require('tweetnacl'); + + priv = this.part.r.data; + if (priv[0] === 0x00) + priv = priv.slice(1); + priv = priv.slice(0, 32); + + pair = nacl.sign.keyPair.fromSeed(new Uint8Array(priv)); + pub = new Buffer(pair.publicKey); + priv = Buffer.concat([priv, pub]); + + return (new PrivateKey({ + type: 'ed25519', + parts: [ + { name: 'R', data: utils.mpNormalize(pub) }, + { name: 'r', data: priv } + ] + })); + } + throw (new Error('Key derivation not supported from ' + this.type + + ' to ' + newType)); +}; + +PrivateKey.prototype.createVerify = function (hashAlgo) { + return (this.toPublic().createVerify(hashAlgo)); +}; + +PrivateKey.prototype.createSign = function (hashAlgo) { + if (hashAlgo === undefined) + hashAlgo = this.defaultHashAlgorithm(); + assert.string(hashAlgo, 'hash algorithm'); + + /* ED25519 is not supported by OpenSSL, use a javascript impl. */ + if (this.type === 'ed25519' && edCompat !== undefined) + return (new edCompat.Signer(this, hashAlgo)); + if (this.type === 'curve25519') + throw (new Error('Curve25519 keys are not suitable for ' + + 'signing or verification')); + + var v, nm, err; + try { + nm = hashAlgo.toUpperCase(); + v = crypto.createSign(nm); + } catch (e) { + err = e; + } + if (v === undefined || (err instanceof Error && + err.message.match(/Unknown message digest/))) { + nm = 'RSA-'; + nm += hashAlgo.toUpperCase(); + v = crypto.createSign(nm); + } + assert.ok(v, 'failed to create verifier'); + var oldSign = v.sign.bind(v); + var key = this.toBuffer('pkcs1'); + var type = this.type; + var curve = this.curve; + v.sign = function () { + var sig = oldSign(key); + if (typeof (sig) === 'string') + sig = new Buffer(sig, 'binary'); + sig = Signature.parse(sig, type, 'asn1'); + sig.hashAlgorithm = hashAlgo; + sig.curve = curve; + return (sig); + }; + return (v); +}; + +PrivateKey.parse = function (data, format, options) { + if (typeof (data) !== 'string') + assert.buffer(data, 'data'); + if (format === undefined) + format = 'auto'; + assert.string(format, 'format'); + if (typeof (options) === 'string') + options = { filename: options }; + assert.optionalObject(options, 'options'); + if (options === undefined) + options = {}; + assert.optionalString(options.filename, 'options.filename'); + if (options.filename === undefined) + options.filename = '(unnamed)'; + + assert.object(formats[format], 'formats[format]'); + + try { + var k = formats[format].read(data, options); + assert.ok(k instanceof PrivateKey, 'key is not a private key'); + if (!k.comment) + k.comment = options.filename; + return (k); + } catch (e) { + if (e.name === 'KeyEncryptedError') + throw (e); + throw (new KeyParseError(options.filename, format, e)); + } +}; + +PrivateKey.isPrivateKey = function (obj, ver) { + return (utils.isCompatible(obj, PrivateKey, ver)); +}; + +PrivateKey.generate = function (type, options) { + if (options === undefined) + options = {}; + assert.object(options, 'options'); + + switch (type) { + case 'ecdsa': + if (options.curve === undefined) + options.curve = 'nistp256'; + assert.string(options.curve, 'options.curve'); + return (generateECDSA(options.curve)); + case 'ed25519': + return (generateED25519()); + default: + throw (new Error('Key generation not supported with key ' + + 'type "' + type + '"')); + } +}; + +/* + * API versions for PrivateKey: + * [1,0] -- initial ver + * [1,1] -- added auto, pkcs[18], openssh/ssh-private formats + * [1,2] -- added defaultHashAlgorithm + * [1,3] -- added derive, ed, createDH + * [1,4] -- first tagged version + */ +PrivateKey.prototype._sshpkApiVersion = [1, 4]; + +PrivateKey._oldVersionDetect = function (obj) { + assert.func(obj.toPublic); + assert.func(obj.createSign); + if (obj.derive) + return ([1, 3]); + if (obj.defaultHashAlgorithm) + return ([1, 2]); + if (obj.formats['auto']) + return ([1, 1]); + return ([1, 0]); +}; diff --git a/appasar/canary/node_modules/sshpk/lib/signature.js b/appasar/canary/node_modules/sshpk/lib/signature.js new file mode 100644 index 0000000..333bb5d --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/signature.js @@ -0,0 +1,313 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = Signature; + +var assert = require('assert-plus'); +var algs = require('./algs'); +var crypto = require('crypto'); +var errs = require('./errors'); +var utils = require('./utils'); +var asn1 = require('asn1'); +var SSHBuffer = require('./ssh-buffer'); + +var InvalidAlgorithmError = errs.InvalidAlgorithmError; +var SignatureParseError = errs.SignatureParseError; + +function Signature(opts) { + assert.object(opts, 'options'); + assert.arrayOfObject(opts.parts, 'options.parts'); + assert.string(opts.type, 'options.type'); + + var partLookup = {}; + for (var i = 0; i < opts.parts.length; ++i) { + var part = opts.parts[i]; + partLookup[part.name] = part; + } + + this.type = opts.type; + this.hashAlgorithm = opts.hashAlgo; + this.curve = opts.curve; + this.parts = opts.parts; + this.part = partLookup; +} + +Signature.prototype.toBuffer = function (format) { + if (format === undefined) + format = 'asn1'; + assert.string(format, 'format'); + + var buf; + var stype = 'ssh-' + this.type; + + switch (this.type) { + case 'rsa': + switch (this.hashAlgorithm) { + case 'sha256': + stype = 'rsa-sha2-256'; + break; + case 'sha512': + stype = 'rsa-sha2-512'; + break; + case 'sha1': + case undefined: + break; + default: + throw (new Error('SSH signature ' + + 'format does not support hash ' + + 'algorithm ' + this.hashAlgorithm)); + } + if (format === 'ssh') { + buf = new SSHBuffer({}); + buf.writeString(stype); + buf.writePart(this.part.sig); + return (buf.toBuffer()); + } else { + return (this.part.sig.data); + } + break; + + case 'ed25519': + if (format === 'ssh') { + buf = new SSHBuffer({}); + buf.writeString(stype); + buf.writePart(this.part.sig); + return (buf.toBuffer()); + } else { + return (this.part.sig.data); + } + break; + + case 'dsa': + case 'ecdsa': + var r, s; + if (format === 'asn1') { + var der = new asn1.BerWriter(); + der.startSequence(); + r = utils.mpNormalize(this.part.r.data); + s = utils.mpNormalize(this.part.s.data); + der.writeBuffer(r, asn1.Ber.Integer); + der.writeBuffer(s, asn1.Ber.Integer); + der.endSequence(); + return (der.buffer); + } else if (format === 'ssh' && this.type === 'dsa') { + buf = new SSHBuffer({}); + buf.writeString('ssh-dss'); + r = this.part.r.data; + if (r.length > 20 && r[0] === 0x00) + r = r.slice(1); + s = this.part.s.data; + if (s.length > 20 && s[0] === 0x00) + s = s.slice(1); + if ((this.hashAlgorithm && + this.hashAlgorithm !== 'sha1') || + r.length + s.length !== 40) { + throw (new Error('OpenSSH only supports ' + + 'DSA signatures with SHA1 hash')); + } + buf.writeBuffer(Buffer.concat([r, s])); + return (buf.toBuffer()); + } else if (format === 'ssh' && this.type === 'ecdsa') { + var inner = new SSHBuffer({}); + r = this.part.r.data; + inner.writeBuffer(r); + inner.writePart(this.part.s); + + buf = new SSHBuffer({}); + /* XXX: find a more proper way to do this? */ + var curve; + if (r[0] === 0x00) + r = r.slice(1); + var sz = r.length * 8; + if (sz === 256) + curve = 'nistp256'; + else if (sz === 384) + curve = 'nistp384'; + else if (sz === 528) + curve = 'nistp521'; + buf.writeString('ecdsa-sha2-' + curve); + buf.writeBuffer(inner.toBuffer()); + return (buf.toBuffer()); + } + throw (new Error('Invalid signature format')); + default: + throw (new Error('Invalid signature data')); + } +}; + +Signature.prototype.toString = function (format) { + assert.optionalString(format, 'format'); + return (this.toBuffer(format).toString('base64')); +}; + +Signature.parse = function (data, type, format) { + if (typeof (data) === 'string') + data = new Buffer(data, 'base64'); + assert.buffer(data, 'data'); + assert.string(format, 'format'); + assert.string(type, 'type'); + + var opts = {}; + opts.type = type.toLowerCase(); + opts.parts = []; + + try { + assert.ok(data.length > 0, 'signature must not be empty'); + switch (opts.type) { + case 'rsa': + return (parseOneNum(data, type, format, opts)); + case 'ed25519': + return (parseOneNum(data, type, format, opts)); + + case 'dsa': + case 'ecdsa': + if (format === 'asn1') + return (parseDSAasn1(data, type, format, opts)); + else if (opts.type === 'dsa') + return (parseDSA(data, type, format, opts)); + else + return (parseECDSA(data, type, format, opts)); + + default: + throw (new InvalidAlgorithmError(type)); + } + + } catch (e) { + if (e instanceof InvalidAlgorithmError) + throw (e); + throw (new SignatureParseError(type, format, e)); + } +}; + +function parseOneNum(data, type, format, opts) { + if (format === 'ssh') { + try { + var buf = new SSHBuffer({buffer: data}); + var head = buf.readString(); + } catch (e) { + /* fall through */ + } + if (buf !== undefined) { + var msg = 'SSH signature does not match expected ' + + 'type (expected ' + type + ', got ' + head + ')'; + switch (head) { + case 'ssh-rsa': + assert.strictEqual(type, 'rsa', msg); + opts.hashAlgo = 'sha1'; + break; + case 'rsa-sha2-256': + assert.strictEqual(type, 'rsa', msg); + opts.hashAlgo = 'sha256'; + break; + case 'rsa-sha2-512': + assert.strictEqual(type, 'rsa', msg); + opts.hashAlgo = 'sha512'; + break; + case 'ssh-ed25519': + assert.strictEqual(type, 'ed25519', msg); + opts.hashAlgo = 'sha512'; + break; + default: + throw (new Error('Unknown SSH signature ' + + 'type: ' + head)); + } + var sig = buf.readPart(); + assert.ok(buf.atEnd(), 'extra trailing bytes'); + sig.name = 'sig'; + opts.parts.push(sig); + return (new Signature(opts)); + } + } + opts.parts.push({name: 'sig', data: data}); + return (new Signature(opts)); +} + +function parseDSAasn1(data, type, format, opts) { + var der = new asn1.BerReader(data); + der.readSequence(); + var r = der.readString(asn1.Ber.Integer, true); + var s = der.readString(asn1.Ber.Integer, true); + + opts.parts.push({name: 'r', data: utils.mpNormalize(r)}); + opts.parts.push({name: 's', data: utils.mpNormalize(s)}); + + return (new Signature(opts)); +} + +function parseDSA(data, type, format, opts) { + if (data.length != 40) { + var buf = new SSHBuffer({buffer: data}); + var d = buf.readBuffer(); + if (d.toString('ascii') === 'ssh-dss') + d = buf.readBuffer(); + assert.ok(buf.atEnd(), 'extra trailing bytes'); + assert.strictEqual(d.length, 40, 'invalid inner length'); + data = d; + } + opts.parts.push({name: 'r', data: data.slice(0, 20)}); + opts.parts.push({name: 's', data: data.slice(20, 40)}); + return (new Signature(opts)); +} + +function parseECDSA(data, type, format, opts) { + var buf = new SSHBuffer({buffer: data}); + + var r, s; + var inner = buf.readBuffer(); + var stype = inner.toString('ascii'); + if (stype.slice(0, 6) === 'ecdsa-') { + var parts = stype.split('-'); + assert.strictEqual(parts[0], 'ecdsa'); + assert.strictEqual(parts[1], 'sha2'); + opts.curve = parts[2]; + switch (opts.curve) { + case 'nistp256': + opts.hashAlgo = 'sha256'; + break; + case 'nistp384': + opts.hashAlgo = 'sha384'; + break; + case 'nistp521': + opts.hashAlgo = 'sha512'; + break; + default: + throw (new Error('Unsupported ECDSA curve: ' + + opts.curve)); + } + inner = buf.readBuffer(); + assert.ok(buf.atEnd(), 'extra trailing bytes on outer'); + buf = new SSHBuffer({buffer: inner}); + r = buf.readPart(); + } else { + r = {data: inner}; + } + + s = buf.readPart(); + assert.ok(buf.atEnd(), 'extra trailing bytes'); + + r.name = 'r'; + s.name = 's'; + + opts.parts.push(r); + opts.parts.push(s); + return (new Signature(opts)); +} + +Signature.isSignature = function (obj, ver) { + return (utils.isCompatible(obj, Signature, ver)); +}; + +/* + * API versions for Signature: + * [1,0] -- initial ver + * [2,0] -- support for rsa in full ssh format, compat with sshpk-agent + * hashAlgorithm property + * [2,1] -- first tagged version + */ +Signature.prototype._sshpkApiVersion = [2, 1]; + +Signature._oldVersionDetect = function (obj) { + assert.func(obj.toBuffer); + if (obj.hasOwnProperty('hashAlgorithm')) + return ([2, 0]); + return ([1, 0]); +}; diff --git a/appasar/canary/node_modules/sshpk/lib/ssh-buffer.js b/appasar/canary/node_modules/sshpk/lib/ssh-buffer.js new file mode 100644 index 0000000..8fc2cb8 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/ssh-buffer.js @@ -0,0 +1,148 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = SSHBuffer; + +var assert = require('assert-plus'); + +function SSHBuffer(opts) { + assert.object(opts, 'options'); + if (opts.buffer !== undefined) + assert.buffer(opts.buffer, 'options.buffer'); + + this._size = opts.buffer ? opts.buffer.length : 1024; + this._buffer = opts.buffer || (new Buffer(this._size)); + this._offset = 0; +} + +SSHBuffer.prototype.toBuffer = function () { + return (this._buffer.slice(0, this._offset)); +}; + +SSHBuffer.prototype.atEnd = function () { + return (this._offset >= this._buffer.length); +}; + +SSHBuffer.prototype.remainder = function () { + return (this._buffer.slice(this._offset)); +}; + +SSHBuffer.prototype.skip = function (n) { + this._offset += n; +}; + +SSHBuffer.prototype.expand = function () { + this._size *= 2; + var buf = new Buffer(this._size); + this._buffer.copy(buf, 0); + this._buffer = buf; +}; + +SSHBuffer.prototype.readPart = function () { + return ({data: this.readBuffer()}); +}; + +SSHBuffer.prototype.readBuffer = function () { + var len = this._buffer.readUInt32BE(this._offset); + this._offset += 4; + assert.ok(this._offset + len <= this._buffer.length, + 'length out of bounds at +0x' + this._offset.toString(16) + + ' (data truncated?)'); + var buf = this._buffer.slice(this._offset, this._offset + len); + this._offset += len; + return (buf); +}; + +SSHBuffer.prototype.readString = function () { + return (this.readBuffer().toString()); +}; + +SSHBuffer.prototype.readCString = function () { + var offset = this._offset; + while (offset < this._buffer.length && + this._buffer[offset] !== 0x00) + offset++; + assert.ok(offset < this._buffer.length, 'c string does not terminate'); + var str = this._buffer.slice(this._offset, offset).toString(); + this._offset = offset + 1; + return (str); +}; + +SSHBuffer.prototype.readInt = function () { + var v = this._buffer.readUInt32BE(this._offset); + this._offset += 4; + return (v); +}; + +SSHBuffer.prototype.readInt64 = function () { + assert.ok(this._offset + 8 < this._buffer.length, + 'buffer not long enough to read Int64'); + var v = this._buffer.slice(this._offset, this._offset + 8); + this._offset += 8; + return (v); +}; + +SSHBuffer.prototype.readChar = function () { + var v = this._buffer[this._offset++]; + return (v); +}; + +SSHBuffer.prototype.writeBuffer = function (buf) { + while (this._offset + 4 + buf.length > this._size) + this.expand(); + this._buffer.writeUInt32BE(buf.length, this._offset); + this._offset += 4; + buf.copy(this._buffer, this._offset); + this._offset += buf.length; +}; + +SSHBuffer.prototype.writeString = function (str) { + this.writeBuffer(new Buffer(str, 'utf8')); +}; + +SSHBuffer.prototype.writeCString = function (str) { + while (this._offset + 1 + str.length > this._size) + this.expand(); + this._buffer.write(str, this._offset); + this._offset += str.length; + this._buffer[this._offset++] = 0; +}; + +SSHBuffer.prototype.writeInt = function (v) { + while (this._offset + 4 > this._size) + this.expand(); + this._buffer.writeUInt32BE(v, this._offset); + this._offset += 4; +}; + +SSHBuffer.prototype.writeInt64 = function (v) { + assert.buffer(v, 'value'); + if (v.length > 8) { + var lead = v.slice(0, v.length - 8); + for (var i = 0; i < lead.length; ++i) { + assert.strictEqual(lead[i], 0, + 'must fit in 64 bits of precision'); + } + v = v.slice(v.length - 8, v.length); + } + while (this._offset + 8 > this._size) + this.expand(); + v.copy(this._buffer, this._offset); + this._offset += 8; +}; + +SSHBuffer.prototype.writeChar = function (v) { + while (this._offset + 1 > this._size) + this.expand(); + this._buffer[this._offset++] = v; +}; + +SSHBuffer.prototype.writePart = function (p) { + this.writeBuffer(p.data); +}; + +SSHBuffer.prototype.write = function (buf) { + while (this._offset + buf.length > this._size) + this.expand(); + buf.copy(this._buffer, this._offset); + this._offset += buf.length; +}; diff --git a/appasar/canary/node_modules/sshpk/lib/utils.js b/appasar/canary/node_modules/sshpk/lib/utils.js new file mode 100644 index 0000000..466634c --- /dev/null +++ b/appasar/canary/node_modules/sshpk/lib/utils.js @@ -0,0 +1,288 @@ +// Copyright 2015 Joyent, Inc. + +module.exports = { + bufferSplit: bufferSplit, + addRSAMissing: addRSAMissing, + calculateDSAPublic: calculateDSAPublic, + mpNormalize: mpNormalize, + ecNormalize: ecNormalize, + countZeros: countZeros, + assertCompatible: assertCompatible, + isCompatible: isCompatible, + opensslKeyDeriv: opensslKeyDeriv, + opensshCipherInfo: opensshCipherInfo +}; + +var assert = require('assert-plus'); +var PrivateKey = require('./private-key'); +var crypto = require('crypto'); + +var MAX_CLASS_DEPTH = 3; + +function isCompatible(obj, klass, needVer) { + if (obj === null || typeof (obj) !== 'object') + return (false); + if (needVer === undefined) + needVer = klass.prototype._sshpkApiVersion; + if (obj instanceof klass && + klass.prototype._sshpkApiVersion[0] == needVer[0]) + return (true); + var proto = Object.getPrototypeOf(obj); + var depth = 0; + while (proto.constructor.name !== klass.name) { + proto = Object.getPrototypeOf(proto); + if (!proto || ++depth > MAX_CLASS_DEPTH) + return (false); + } + if (proto.constructor.name !== klass.name) + return (false); + var ver = proto._sshpkApiVersion; + if (ver === undefined) + ver = klass._oldVersionDetect(obj); + if (ver[0] != needVer[0] || ver[1] < needVer[1]) + return (false); + return (true); +} + +function assertCompatible(obj, klass, needVer, name) { + if (name === undefined) + name = 'object'; + assert.ok(obj, name + ' must not be null'); + assert.object(obj, name + ' must be an object'); + if (needVer === undefined) + needVer = klass.prototype._sshpkApiVersion; + if (obj instanceof klass && + klass.prototype._sshpkApiVersion[0] == needVer[0]) + return; + var proto = Object.getPrototypeOf(obj); + var depth = 0; + while (proto.constructor.name !== klass.name) { + proto = Object.getPrototypeOf(proto); + assert.ok(proto && ++depth <= MAX_CLASS_DEPTH, + name + ' must be a ' + klass.name + ' instance'); + } + assert.strictEqual(proto.constructor.name, klass.name, + name + ' must be a ' + klass.name + ' instance'); + var ver = proto._sshpkApiVersion; + if (ver === undefined) + ver = klass._oldVersionDetect(obj); + assert.ok(ver[0] == needVer[0] && ver[1] >= needVer[1], + name + ' must be compatible with ' + klass.name + ' klass ' + + 'version ' + needVer[0] + '.' + needVer[1]); +} + +var CIPHER_LEN = { + 'des-ede3-cbc': { key: 7, iv: 8 }, + 'aes-128-cbc': { key: 16, iv: 16 } +}; +var PKCS5_SALT_LEN = 8; + +function opensslKeyDeriv(cipher, salt, passphrase, count) { + assert.buffer(salt, 'salt'); + assert.buffer(passphrase, 'passphrase'); + assert.number(count, 'iteration count'); + + var clen = CIPHER_LEN[cipher]; + assert.object(clen, 'supported cipher'); + + salt = salt.slice(0, PKCS5_SALT_LEN); + + var D, D_prev, bufs; + var material = new Buffer(0); + while (material.length < clen.key + clen.iv) { + bufs = []; + if (D_prev) + bufs.push(D_prev); + bufs.push(passphrase); + bufs.push(salt); + D = Buffer.concat(bufs); + for (var j = 0; j < count; ++j) + D = crypto.createHash('md5').update(D).digest(); + material = Buffer.concat([material, D]); + D_prev = D; + } + + return ({ + key: material.slice(0, clen.key), + iv: material.slice(clen.key, clen.key + clen.iv) + }); +} + +/* Count leading zero bits on a buffer */ +function countZeros(buf) { + var o = 0, obit = 8; + while (o < buf.length) { + var mask = (1 << obit); + if ((buf[o] & mask) === mask) + break; + obit--; + if (obit < 0) { + o++; + obit = 8; + } + } + return (o*8 + (8 - obit) - 1); +} + +function bufferSplit(buf, chr) { + assert.buffer(buf); + assert.string(chr); + + var parts = []; + var lastPart = 0; + var matches = 0; + for (var i = 0; i < buf.length; ++i) { + if (buf[i] === chr.charCodeAt(matches)) + ++matches; + else if (buf[i] === chr.charCodeAt(0)) + matches = 1; + else + matches = 0; + + if (matches >= chr.length) { + var newPart = i + 1; + parts.push(buf.slice(lastPart, newPart - matches)); + lastPart = newPart; + matches = 0; + } + } + if (lastPart <= buf.length) + parts.push(buf.slice(lastPart, buf.length)); + + return (parts); +} + +function ecNormalize(buf, addZero) { + assert.buffer(buf); + if (buf[0] === 0x00 && buf[1] === 0x04) { + if (addZero) + return (buf); + return (buf.slice(1)); + } else if (buf[0] === 0x04) { + if (!addZero) + return (buf); + } else { + while (buf[0] === 0x00) + buf = buf.slice(1); + if (buf[0] === 0x02 || buf[0] === 0x03) + throw (new Error('Compressed elliptic curve points ' + + 'are not supported')); + if (buf[0] !== 0x04) + throw (new Error('Not a valid elliptic curve point')); + if (!addZero) + return (buf); + } + var b = new Buffer(buf.length + 1); + b[0] = 0x0; + buf.copy(b, 1); + return (b); +} + +function mpNormalize(buf) { + assert.buffer(buf); + while (buf.length > 1 && buf[0] === 0x00 && (buf[1] & 0x80) === 0x00) + buf = buf.slice(1); + if ((buf[0] & 0x80) === 0x80) { + var b = new Buffer(buf.length + 1); + b[0] = 0x00; + buf.copy(b, 1); + buf = b; + } + return (buf); +} + +function bigintToMpBuf(bigint) { + var buf = new Buffer(bigint.toByteArray()); + buf = mpNormalize(buf); + return (buf); +} + +function calculateDSAPublic(g, p, x) { + assert.buffer(g); + assert.buffer(p); + assert.buffer(x); + try { + var bigInt = require('jsbn').BigInteger; + } catch (e) { + throw (new Error('To load a PKCS#8 format DSA private key, ' + + 'the node jsbn library is required.')); + } + g = new bigInt(g); + p = new bigInt(p); + x = new bigInt(x); + var y = g.modPow(x, p); + var ybuf = bigintToMpBuf(y); + return (ybuf); +} + +function addRSAMissing(key) { + assert.object(key); + assertCompatible(key, PrivateKey, [1, 1]); + try { + var bigInt = require('jsbn').BigInteger; + } catch (e) { + throw (new Error('To write a PEM private key from ' + + 'this source, the node jsbn lib is required.')); + } + + var d = new bigInt(key.part.d.data); + var buf; + + if (!key.part.dmodp) { + var p = new bigInt(key.part.p.data); + var dmodp = d.mod(p.subtract(1)); + + buf = bigintToMpBuf(dmodp); + key.part.dmodp = {name: 'dmodp', data: buf}; + key.parts.push(key.part.dmodp); + } + if (!key.part.dmodq) { + var q = new bigInt(key.part.q.data); + var dmodq = d.mod(q.subtract(1)); + + buf = bigintToMpBuf(dmodq); + key.part.dmodq = {name: 'dmodq', data: buf}; + key.parts.push(key.part.dmodq); + } +} + +function opensshCipherInfo(cipher) { + var inf = {}; + switch (cipher) { + case '3des-cbc': + inf.keySize = 24; + inf.blockSize = 8; + inf.opensslName = 'des-ede3-cbc'; + break; + case 'blowfish-cbc': + inf.keySize = 16; + inf.blockSize = 8; + inf.opensslName = 'bf-cbc'; + break; + case 'aes128-cbc': + case 'aes128-ctr': + case 'aes128-gcm@openssh.com': + inf.keySize = 16; + inf.blockSize = 16; + inf.opensslName = 'aes-128-' + cipher.slice(7, 10); + break; + case 'aes192-cbc': + case 'aes192-ctr': + case 'aes192-gcm@openssh.com': + inf.keySize = 24; + inf.blockSize = 16; + inf.opensslName = 'aes-192-' + cipher.slice(7, 10); + break; + case 'aes256-cbc': + case 'aes256-ctr': + case 'aes256-gcm@openssh.com': + inf.keySize = 32; + inf.blockSize = 16; + inf.opensslName = 'aes-256-' + cipher.slice(7, 10); + break; + default: + throw (new Error( + 'Unsupported openssl cipher "' + cipher + '"')); + } + return (inf); +} diff --git a/appasar/canary/node_modules/sshpk/man/man1/sshpk-conv.1 b/appasar/canary/node_modules/sshpk/man/man1/sshpk-conv.1 new file mode 100644 index 0000000..0887dce --- /dev/null +++ b/appasar/canary/node_modules/sshpk/man/man1/sshpk-conv.1 @@ -0,0 +1,135 @@ +.TH sshpk\-conv 1 "Jan 2016" sshpk "sshpk Commands" +.SH NAME +.PP +sshpk\-conv \- convert between key formats +.SH SYNOPSYS +.PP +\fB\fCsshpk\-conv\fR \-t FORMAT [FILENAME] [OPTIONS...] +.PP +\fB\fCsshpk\-conv\fR \-i [FILENAME] [OPTIONS...] +.SH DESCRIPTION +.PP +Reads in a public or private key and converts it between different formats, +particularly formats used in the SSH protocol and the well\-known PEM PKCS#1/7 +formats. +.PP +In the second form, with the \fB\fC\-i\fR option given, identifies a key and prints to +stderr information about its nature, size and fingerprint. +.SH EXAMPLES +.PP +Assume the following SSH\-format public key in \fB\fCid_ecdsa.pub\fR: +.PP +.RS +.nf +ecdsa\-sha2\-nistp256 AAAAE2VjZHNhLXNoYTI...9M/4c4= user@host +.fi +.RE +.PP +Identify it with \fB\fC\-i\fR: +.PP +.RS +.nf +$ sshpk\-conv \-i id_ecdsa.pub +id_ecdsa: a 256 bit ECDSA public key +ECDSA curve: nistp256 +Comment: user@host +Fingerprint: + SHA256:vCNX7eUkdvqqW0m4PoxQAZRv+CM4P4fS8+CbliAvS4k + 81:ad:d5:57:e5:6f:7d:a2:93:79:56:af:d7:c0:38:51 +.fi +.RE +.PP +Convert it to \fB\fCpkcs8\fR format, for use with e.g. OpenSSL: +.PP +.RS +.nf +$ sshpk\-conv \-t pkcs8 id_ecdsa +\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEAsA4R6N6AS3gzaPBeLjG2ObSgUsR +zOt+kWJoijLnw3ZMYUKmAx+lD0I5XUxdrPcs1vH5f3cn9TvRvO9L0z/hzg== +\-\-\-\-\-END PUBLIC KEY\-\-\-\-\- +.fi +.RE +.PP +Retrieve the public half of a private key: +.PP +.RS +.nf +$ openssl genrsa 2048 | sshpk\-conv \-t ssh \-c foo@bar +ssh\-rsa AAAAB3NzaC1yc2EAAA...koK7 foo@bar +.fi +.RE +.PP +Convert a private key to PKCS#1 (OpenSSL) format from a new\-style OpenSSH key +format (the \fB\fCssh\-keygen \-o\fR format): +.PP +.RS +.nf +$ ssh\-keygen \-o \-f foobar +\&... +$ sshpk\-conv \-p \-t pkcs1 foobar +\-\-\-\-\-BEGIN RSA PRIVATE KEY\-\-\-\-\- +MIIDpAIBAAKCAQEA6T/GYJndb1TRH3+NL.... +\-\-\-\-\-END RSA PRIVATE KEY\-\-\-\-\- +.fi +.RE +.SH OPTIONS +.TP +\fB\fC\-i, \-\-identify\fR +Instead of converting the key, output identifying information about it to +stderr, including its type, size and fingerprints. +.TP +\fB\fC\-p, \-\-private\fR +Treat the key as a private key instead of a public key (the default). If you +supply \fB\fCsshpk\-conv\fR with a private key and do not give this option, it will +extract only the public half of the key from it and work with that. +.TP +\fB\fC\-f PATH, \-\-file=PATH\fR +Input file to take the key from instead of stdin. If a filename is supplied +as a positional argument, it is equivalent to using this option. +.TP +\fB\fC\-o PATH, \-\-out=PATH\fR +Output file name to use instead of stdout. +.PP +\fB\fC\-T FORMAT, \-\-informat=FORMAT\fR +.TP +\fB\fC\-t FORMAT, \-\-outformat=FORMAT\fR +Selects the input and output formats to be used (see FORMATS, below). +.TP +\fB\fC\-c TEXT, \-\-comment=TEXT\fR +Sets the key comment for the output file, if supported. +.SH FORMATS +.PP +Currently supported formats: +.TP +\fB\fCpem, pkcs1\fR +The standard PEM format used by older OpenSSH and most TLS libraries such as +OpenSSL. The classic \fB\fCid_rsa\fR file is usually in this format. It is an ASN.1 +encoded structure, base64\-encoded and placed between PEM headers. +.TP +\fB\fCssh\fR +The SSH public key text format (the format of an \fB\fCid_rsa.pub\fR file). A single +line, containing 3 space separated parts: the key type, key body and optional +key comment. +.TP +\fB\fCpkcs8\fR +A newer PEM format, usually used only for public keys by TLS libraries such +as OpenSSL. The ASN.1 structure is more generic than that of \fB\fCpkcs1\fR\&. +.TP +\fB\fCopenssh\fR +The new \fB\fCssh\-keygen \-o\fR format from OpenSSH. This can be mistaken for a PEM +encoding but is actually an OpenSSH internal format. +.TP +\fB\fCrfc4253\fR +The internal binary format of keys when sent over the wire in the SSH +protocol. This is also the format that the \fB\fCssh\-agent\fR uses in its protocol. +.SH SEE ALSO +.PP +.BR ssh-keygen (1), +.BR openssl (1) +.SH BUGS +.PP +Encrypted (password\-protected) keys are not supported. +.PP +Report bugs at Github +\[la]https://github.com/arekinath/node-sshpk/issues\[ra] diff --git a/appasar/canary/node_modules/sshpk/man/man1/sshpk-sign.1 b/appasar/canary/node_modules/sshpk/man/man1/sshpk-sign.1 new file mode 100644 index 0000000..749916b --- /dev/null +++ b/appasar/canary/node_modules/sshpk/man/man1/sshpk-sign.1 @@ -0,0 +1,81 @@ +.TH sshpk\-sign 1 "Jan 2016" sshpk "sshpk Commands" +.SH NAME +.PP +sshpk\-sign \- sign data using an SSH key +.SH SYNOPSYS +.PP +\fB\fCsshpk\-sign\fR \-i KEYPATH [OPTION...] +.SH DESCRIPTION +.PP +Takes in arbitrary bytes, and signs them using an SSH private key. The key can +be of any type or format supported by the \fB\fCsshpk\fR library, including the +standard OpenSSH formats, as well as PEM PKCS#1 and PKCS#8. +.PP +The signature is printed out in Base64 encoding, unless the \fB\fC\-\-binary\fR or \fB\fC\-b\fR +option is given. +.SH EXAMPLES +.PP +Signing with default settings: +.PP +.RS +.nf +$ printf 'foo' | sshpk\-sign \-i ~/.ssh/id_ecdsa +MEUCIAMdLS/vXrrtWFepwe... +.fi +.RE +.PP +Signing in SSH (RFC 4253) format (rather than the default ASN.1): +.PP +.RS +.nf +$ printf 'foo' | sshpk\-sign \-i ~/.ssh/id_ecdsa \-t ssh +AAAAFGVjZHNhLXNoYTIt... +.fi +.RE +.PP +Saving the binary signature to a file: +.PP +.RS +.nf +$ printf 'foo' | sshpk\-sign \-i ~/.ssh/id_ecdsa \\ + \-o signature.bin \-b +$ cat signature.bin | base64 +MEUCIAMdLS/vXrrtWFepwe... +.fi +.RE +.SH OPTIONS +.TP +\fB\fC\-v, \-\-verbose\fR +Print extra information about the key and signature to stderr when signing. +.TP +\fB\fC\-b, \-\-binary\fR +Don't base64\-encode the signature before outputting it. +.TP +\fB\fC\-i KEY, \-\-identity=KEY\fR +Select the key to be used for signing. \fB\fCKEY\fR must be a relative or absolute +filesystem path to the key file. Any format supported by the \fB\fCsshpk\fR library +is supported, including OpenSSH formats and standard PEM PKCS. +.TP +\fB\fC\-f PATH, \-\-file=PATH\fR +Input file to sign instead of stdin. +.TP +\fB\fC\-o PATH, \-\-out=PATH\fR +Output file to save signature in instead of stdout. +.TP +\fB\fC\-H HASH, \-\-hash=HASH\fR +Set the hash algorithm to be used for signing. This should be one of \fB\fCsha1\fR, +\fB\fCsha256\fR or \fB\fCsha512\fR\&. Some key types may place restrictions on which hash +algorithms may be used (e.g. ED25519 keys can only use SHA\-512). +.TP +\fB\fC\-t FORMAT, \-\-format=FORMAT\fR +Choose the signature format to use, from \fB\fCasn1\fR, \fB\fCssh\fR or \fB\fCraw\fR (only for +ED25519 signatures). The \fB\fCasn1\fR format is the default, as it is the format +used with TLS and typically the standard in most non\-SSH libraries (e.g. +OpenSSL). The \fB\fCssh\fR format is used in the SSH protocol and by the ssh\-agent. +.SH SEE ALSO +.PP +.BR sshpk-verify (1) +.SH BUGS +.PP +Report bugs at Github +\[la]https://github.com/arekinath/node-sshpk/issues\[ra] diff --git a/appasar/canary/node_modules/sshpk/man/man1/sshpk-verify.1 b/appasar/canary/node_modules/sshpk/man/man1/sshpk-verify.1 new file mode 100644 index 0000000..f79169d --- /dev/null +++ b/appasar/canary/node_modules/sshpk/man/man1/sshpk-verify.1 @@ -0,0 +1,68 @@ +.TH sshpk\-verify 1 "Jan 2016" sshpk "sshpk Commands" +.SH NAME +.PP +sshpk\-verify \- verify a signature on data using an SSH key +.SH SYNOPSYS +.PP +\fB\fCsshpk\-verify\fR \-i KEYPATH \-s SIGNATURE [OPTION...] +.SH DESCRIPTION +.PP +Takes in arbitrary bytes and a Base64\-encoded signature, and verifies that the +signature was produced by the private half of the given SSH public key. +.SH EXAMPLES +.PP +.RS +.nf +$ printf 'foo' | sshpk\-verify \-i ~/.ssh/id_ecdsa \-s MEUCIQCYp... +OK +$ printf 'foo' | sshpk\-verify \-i ~/.ssh/id_ecdsa \-s GARBAGE... +NOT OK +.fi +.RE +.SH EXIT STATUS +.TP +\fB\fC0\fR +Signature validates and matches the key. +.TP +\fB\fC1\fR +Signature is parseable and the correct length but does not match the key or +otherwise is invalid. +.TP +\fB\fC2\fR +The signature or key could not be parsed. +.TP +\fB\fC3\fR +Invalid commandline options were supplied. +.SH OPTIONS +.TP +\fB\fC\-v, \-\-verbose\fR +Print extra information about the key and signature to stderr when verifying. +.TP +\fB\fC\-i KEY, \-\-identity=KEY\fR +Select the key to be used for verification. \fB\fCKEY\fR must be a relative or +absolute filesystem path to the key file. Any format supported by the \fB\fCsshpk\fR +library is supported, including OpenSSH formats and standard PEM PKCS. +.TP +\fB\fC\-s BASE64, \-\-signature=BASE64\fR +Supplies the base64\-encoded signature to be verified. +.TP +\fB\fC\-f PATH, \-\-file=PATH\fR +Input file to verify instead of stdin. +.TP +\fB\fC\-H HASH, \-\-hash=HASH\fR +Set the hash algorithm to be used for signing. This should be one of \fB\fCsha1\fR, +\fB\fCsha256\fR or \fB\fCsha512\fR\&. Some key types may place restrictions on which hash +algorithms may be used (e.g. ED25519 keys can only use SHA\-512). +.TP +\fB\fC\-t FORMAT, \-\-format=FORMAT\fR +Choose the signature format to use, from \fB\fCasn1\fR, \fB\fCssh\fR or \fB\fCraw\fR (only for +ED25519 signatures). The \fB\fCasn1\fR format is the default, as it is the format +used with TLS and typically the standard in most non\-SSH libraries (e.g. +OpenSSL). The \fB\fCssh\fR format is used in the SSH protocol and by the ssh\-agent. +.SH SEE ALSO +.PP +.BR sshpk-sign (1) +.SH BUGS +.PP +Report bugs at Github +\[la]https://github.com/arekinath/node-sshpk/issues\[ra] diff --git a/appasar/canary/node_modules/sshpk/package.json b/appasar/canary/node_modules/sshpk/package.json new file mode 100644 index 0000000..a553c66 --- /dev/null +++ b/appasar/canary/node_modules/sshpk/package.json @@ -0,0 +1,59 @@ +{ + "name": "sshpk", + "version": "1.13.1", + "description": "A library for finding and using SSH public keys", + "main": "lib/index.js", + "scripts": { + "test": "tape test/*.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/arekinath/node-sshpk.git" + }, + "author": "Joyent, Inc", + "contributors": [ + { + "name": "Dave Eddy", + "email": "dave@daveeddy.com" + }, + { + "name": "Mark Cavage", + "email": "mcavage@gmail.com" + }, + { + "name": "Alex Wilson", + "email": "alex@cooperi.net" + } + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/arekinath/node-sshpk/issues" + }, + "engines": { + "node": ">=0.10.0" + }, + "directories": { + "bin": "./bin", + "lib": "./lib", + "man": "./man/man1" + }, + "homepage": "https://github.com/arekinath/node-sshpk#readme", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "dashdash": "^1.12.0", + "getpass": "^0.1.1" + }, + "optionalDependencies": { + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0", + "ecc-jsbn": "~0.1.1", + "bcrypt-pbkdf": "^1.0.0" + }, + "devDependencies": { + "tape": "^3.5.0", + "benchmark": "^1.0.0", + "sinon": "^1.17.2", + "temp": "^0.8.2" + } +} diff --git a/appasar/canary/node_modules/stringstream/.npmignore b/appasar/canary/node_modules/stringstream/.npmignore new file mode 100644 index 0000000..7dccd97 --- /dev/null +++ b/appasar/canary/node_modules/stringstream/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +node_modules +npm-debug.log \ No newline at end of file diff --git a/appasar/canary/node_modules/stringstream/.travis.yml b/appasar/canary/node_modules/stringstream/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/appasar/canary/node_modules/stringstream/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/appasar/canary/node_modules/stringstream/LICENSE.txt b/appasar/canary/node_modules/stringstream/LICENSE.txt new file mode 100644 index 0000000..ab861ac --- /dev/null +++ b/appasar/canary/node_modules/stringstream/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2012 Michael Hart (michael.hart.au@gmail.com) + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/appasar/canary/node_modules/stringstream/README.md b/appasar/canary/node_modules/stringstream/README.md new file mode 100644 index 0000000..32fc982 --- /dev/null +++ b/appasar/canary/node_modules/stringstream/README.md @@ -0,0 +1,38 @@ +# Decode streams into strings The Right Way(tm) + +```javascript +var fs = require('fs') +var zlib = require('zlib') +var strs = require('stringstream') + +var utf8Stream = fs.createReadStream('massiveLogFile.gz') + .pipe(zlib.createGunzip()) + .pipe(strs('utf8')) +``` + +No need to deal with `setEncoding()` weirdness, just compose streams +like they were supposed to be! + +Handles input and output encoding: + +```javascript +// Stream from utf8 to hex to base64... Why not, ay. +var hex64Stream = fs.createReadStream('myFile') + .pipe(strs('utf8', 'hex')) + .pipe(strs('hex', 'base64')) +``` + +Also deals with `base64` output correctly by aligning each emitted data +chunk so that there are no dangling `=` characters: + +```javascript +var stream = fs.createReadStream('myFile').pipe(strs('base64')) + +var base64Str = '' + +stream.on('data', function(data) { base64Str += data }) +stream.on('end', function() { + console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding() + console.log('Original file is: ' + new Buffer(base64Str, 'base64')) +}) +``` diff --git a/appasar/canary/node_modules/stringstream/example.js b/appasar/canary/node_modules/stringstream/example.js new file mode 100644 index 0000000..f82b85e --- /dev/null +++ b/appasar/canary/node_modules/stringstream/example.js @@ -0,0 +1,27 @@ +var fs = require('fs') +var zlib = require('zlib') +var strs = require('stringstream') + +var utf8Stream = fs.createReadStream('massiveLogFile.gz') + .pipe(zlib.createGunzip()) + .pipe(strs('utf8')) + +utf8Stream.pipe(process.stdout) + +// Stream from utf8 to hex to base64... Why not, ay. +var hex64Stream = fs.createReadStream('myFile') + .pipe(strs('utf8', 'hex')) + .pipe(strs('hex', 'base64')) + +hex64Stream.pipe(process.stdout) + +// Deals with base64 correctly by aligning chunks +var stream = fs.createReadStream('myFile').pipe(strs('base64')) + +var base64Str = '' + +stream.on('data', function(data) { base64Str += data }) +stream.on('end', function() { + console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding() + console.log('Original file is: ' + new Buffer(base64Str, 'base64')) +}) diff --git a/appasar/canary/node_modules/stringstream/package.json b/appasar/canary/node_modules/stringstream/package.json new file mode 100644 index 0000000..e6f9019 --- /dev/null +++ b/appasar/canary/node_modules/stringstream/package.json @@ -0,0 +1,18 @@ +{ + "name": "stringstream", + "version": "0.0.5", + "description": "Encode and decode streams into string streams", + "author": "Michael Hart (http://github.com/mhart)", + "main": "stringstream.js", + "keywords": [ + "string", + "stream", + "base64", + "gzip" + ], + "repository": { + "type": "git", + "url": "https://github.com/mhart/StringStream.git" + }, + "license": "MIT" +} diff --git a/appasar/canary/node_modules/stringstream/stringstream.js b/appasar/canary/node_modules/stringstream/stringstream.js new file mode 100644 index 0000000..4ece127 --- /dev/null +++ b/appasar/canary/node_modules/stringstream/stringstream.js @@ -0,0 +1,102 @@ +var util = require('util') +var Stream = require('stream') +var StringDecoder = require('string_decoder').StringDecoder + +module.exports = StringStream +module.exports.AlignedStringDecoder = AlignedStringDecoder + +function StringStream(from, to) { + if (!(this instanceof StringStream)) return new StringStream(from, to) + + Stream.call(this) + + if (from == null) from = 'utf8' + + this.readable = this.writable = true + this.paused = false + this.toEncoding = (to == null ? from : to) + this.fromEncoding = (to == null ? '' : from) + this.decoder = new AlignedStringDecoder(this.toEncoding) +} +util.inherits(StringStream, Stream) + +StringStream.prototype.write = function(data) { + if (!this.writable) { + var err = new Error('stream not writable') + err.code = 'EPIPE' + this.emit('error', err) + return false + } + if (this.fromEncoding) { + if (Buffer.isBuffer(data)) data = data.toString() + data = new Buffer(data, this.fromEncoding) + } + var string = this.decoder.write(data) + if (string.length) this.emit('data', string) + return !this.paused +} + +StringStream.prototype.flush = function() { + if (this.decoder.flush) { + var string = this.decoder.flush() + if (string.length) this.emit('data', string) + } +} + +StringStream.prototype.end = function() { + if (!this.writable && !this.readable) return + this.flush() + this.emit('end') + this.writable = this.readable = false + this.destroy() +} + +StringStream.prototype.destroy = function() { + this.decoder = null + this.writable = this.readable = false + this.emit('close') +} + +StringStream.prototype.pause = function() { + this.paused = true +} + +StringStream.prototype.resume = function () { + if (this.paused) this.emit('drain') + this.paused = false +} + +function AlignedStringDecoder(encoding) { + StringDecoder.call(this, encoding) + + switch (this.encoding) { + case 'base64': + this.write = alignedWrite + this.alignedBuffer = new Buffer(3) + this.alignedBytes = 0 + break + } +} +util.inherits(AlignedStringDecoder, StringDecoder) + +AlignedStringDecoder.prototype.flush = function() { + if (!this.alignedBuffer || !this.alignedBytes) return '' + var leftover = this.alignedBuffer.toString(this.encoding, 0, this.alignedBytes) + this.alignedBytes = 0 + return leftover +} + +function alignedWrite(buffer) { + var rem = (this.alignedBytes + buffer.length) % this.alignedBuffer.length + if (!rem && !this.alignedBytes) return buffer.toString(this.encoding) + + var returnBuffer = new Buffer(this.alignedBytes + buffer.length - rem) + + this.alignedBuffer.copy(returnBuffer, 0, 0, this.alignedBytes) + buffer.copy(returnBuffer, this.alignedBytes, 0, buffer.length - rem) + + buffer.copy(this.alignedBuffer, 0, buffer.length - rem, buffer.length) + this.alignedBytes = rem + + return returnBuffer.toString(this.encoding) +} diff --git a/appasar/canary/node_modules/tough-cookie/LICENSE b/appasar/canary/node_modules/tough-cookie/LICENSE new file mode 100644 index 0000000..1bc286f --- /dev/null +++ b/appasar/canary/node_modules/tough-cookie/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2015, Salesforce.com, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=== + +The following exceptions apply: + +=== + +`public_suffix_list.dat` was obtained from + via +. The license for this file is MPL/2.0. The header of +that file reads as follows: + + // This Source Code Form is subject to the terms of the Mozilla Public + // License, v. 2.0. If a copy of the MPL was not distributed with this + // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/appasar/canary/node_modules/tough-cookie/README.md b/appasar/canary/node_modules/tough-cookie/README.md new file mode 100644 index 0000000..7c04e0a --- /dev/null +++ b/appasar/canary/node_modules/tough-cookie/README.md @@ -0,0 +1,509 @@ +[RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js + +[![npm package](https://nodei.co/npm/tough-cookie.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/tough-cookie/) + +[![Build Status](https://travis-ci.org/salesforce/tough-cookie.png?branch=master)](https://travis-ci.org/salesforce/tough-cookie) + +# Synopsis + +``` javascript +var tough = require('tough-cookie'); +var Cookie = tough.Cookie; +var cookie = Cookie.parse(header); +cookie.value = 'somethingdifferent'; +header = cookie.toString(); + +var cookiejar = new tough.CookieJar(); +cookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb); +// ... +cookiejar.getCookies('http://example.com/otherpath',function(err,cookies) { + res.headers['cookie'] = cookies.join('; '); +}); +``` + +# Installation + +It's _so_ easy! + +`npm install tough-cookie` + +Why the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken. + +## Version Support + +Support for versions of node.js will follow that of the [request](https://www.npmjs.com/package/request) module. + +# API + +## tough + +Functions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be "bound". + +**Note**: prior to 1.0.x, several of these functions took a `strict` parameter. This has since been removed from the API as it was no longer necessary. + +### `parseDate(string)` + +Parse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`. + +### `formatDate(date)` + +Format a Date into a RFC1123 string (the RFC6265-recommended format). + +### `canonicalDomain(str)` + +Transforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects). + +### `domainMatch(str,domStr[,canonicalize=true])` + +Answers "does this real domain match the domain in a cookie?". The `str` is the "current" domain-name and the `domStr` is the "cookie" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match". + +The `canonicalize` parameter will run the other two paramters through `canonicalDomain` or not. + +### `defaultPath(path)` + +Given a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by Section 5.1.4 of the RFC. + +The `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output. + +### `pathMatch(reqPath,cookiePath)` + +Answers "does the request-path path-match a given cookie-path?" as per RFC6265 Section 5.1.4. Returns a boolean. + +This is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`. + +### `parse(cookieString[, options])` + +alias for `Cookie.parse(cookieString[, options])` + +### `fromJSON(string)` + +alias for `Cookie.fromJSON(string)` + +### `getPublicSuffix(hostname)` + +Returns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it. + +For example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`. + +For further information, see http://publicsuffix.org/. This module derives its list from that site. + +### `cookieCompare(a,b)` + +For use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). The sort algorithm is, in order of precedence: + +* Longest `.path` +* oldest `.creation` (which has a 1ms precision, same as `Date`) +* lowest `.creationIndex` (to get beyond the 1ms precision) + +``` javascript +var cookies = [ /* unsorted array of Cookie objects */ ]; +cookies = cookies.sort(cookieCompare); +``` + +**Note**: Since JavaScript's `Date` is limited to a 1ms precision, cookies within the same milisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`. This preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore`, since `Set-Cookie` headers are parsed in order, but may not be so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ such that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`. + +### `permuteDomain(domain)` + +Generates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores. + +### `permutePath(path)` + +Generates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores. + + +## Cookie + +Exported via `tough.Cookie`. + +### `Cookie.parse(cookieString[, options])` + +Parses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed. + +The options parameter is not required and currently has only one property: + + * _loose_ - boolean - if `true` enable parsing of key-less cookies like `=abc` and `=`, which are not RFC-compliant. + +If options is not an object, it is ignored, which means you can use `Array#map` with it. + +Here's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response: + +``` javascript +if (res.headers['set-cookie'] instanceof Array) + cookies = res.headers['set-cookie'].map(Cookie.parse); +else + cookies = [Cookie.parse(res.headers['set-cookie'])]; +``` + +_Note:_ in version 2.3.3, tough-cookie limited the number of spaces before the `=` to 256 characters. This limitation has since been removed. +See [Issue 92](https://github.com/salesforce/tough-cookie/issues/92) + +### Properties + +Cookie object properties: + + * _key_ - string - the name or key of the cookie (default "") + * _value_ - string - the value of the cookie (default "") + * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `"Infinity"`). See `setExpires()` + * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `"Infinity"` and `"-Infinity"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()` + * _domain_ - string - the `Domain=` attribute of the cookie + * _path_ - string - the `Path=` of the cookie + * _secure_ - boolean - the `Secure` cookie flag + * _httpOnly_ - boolean - the `HttpOnly` cookie flag + * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside) + * _creation_ - `Date` - when this cookie was constructed + * _creationIndex_ - number - set at construction, used to provide greater sort precision (please see `cookieCompare(a,b)` for a full explanation) + +After a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes: + + * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied) + * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one. + * _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar + * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute. + +### `Cookie([{properties}])` + +Receives an options object that can contain any of the above Cookie properties, uses the default for unspecified properties. + +### `.toString()` + +encode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`. + +### `.cookieString()` + +encode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '='). + +### `.setExpires(String)` + +sets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `"Infinity"` (a string) is set. + +### `.setMaxAge(number)` + +sets the maxAge in seconds. Coerces `-Infinity` to `"-Infinity"` and `Infinity` to `"Infinity"` so it JSON serializes correctly. + +### `.expiryTime([now=Date.now()])` + +### `.expiryDate([now=Date.now()])` + +expiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds. + +Max-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` paramter -- is used to offset the `.maxAge` attribute. + +If Expires (`.expires`) is set, that's returned. + +Otherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for "Tue, 19 Jan 2038 03:14:07 GMT" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents). + +### `.TTL([now=Date.now()])` + +compute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply. + +The "number" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned. + +### `.canonicalizedDoman()` + +### `.cdomain()` + +return the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters. + +### `.toJSON()` + +For convenience in using `JSON.serialize(cookie)`. Returns a plain-old `Object` that can be JSON-serialized. + +Any `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`). + +**NOTE**: Custom `Cookie` properties will be discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array. + +### `Cookie.fromJSON(strOrObj)` + +Does the reverse of `cookie.toJSON()`. If passed a string, will `JSON.parse()` that first. + +Any `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are parsed via `Date.parse()`, not the tough-cookie `parseDate`, since it's JavaScript/JSON-y timestamps being handled at this layer. + +Returns `null` upon JSON parsing error. + +### `.clone()` + +Does a deep clone of this cookie, exactly implemented as `Cookie.fromJSON(cookie.toJSON())`. + +### `.validate()` + +Status: *IN PROGRESS*. Works for a few things, but is by no means comprehensive. + +validates cookie attributes for semantic correctness. Useful for "lint" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct: + +``` javascript +if (cookie.validate() === true) { + // it's tasty +} else { + // yuck! +} +``` + + +## CookieJar + +Exported via `tough.CookieJar`. + +### `CookieJar([store],[options])` + +Simply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used. + +The `options` object can be omitted and can have the following properties: + + * _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like "com" and "co.uk" + * _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name. + This is not in the standard, but is used sometimes on the web and is accepted by (most) browsers. + +Since eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods. + +### `.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))` + +Attempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.creation`, `.lastAccessed` and `.hostOnly` properties. + +The `options` object can be omitted and can have the following properties: + + * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies. + * _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`. + * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies + * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option. + +As per the RFC, the `.hostOnly` property is set if there was no "Domain=" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual). + +### `.setCookieSync(cookieOrString, currentUrl, [{options}])` + +Synchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`). + +### `.getCookies(currentUrl, [{options},] cb(err,cookies))` + +Retrieve the list of cookies that can be sent in a Cookie header for the current url. + +If an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given. + +The `options` object can be omitted and can have the following properties: + + * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies. + * _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`. + * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies + * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially). + * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it). + +The `.lastAccessed` property of the returned cookies will have been updated. + +### `.getCookiesSync(currentUrl, [{options}])` + +Synchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`). + +### `.getCookieString(...)` + +Accepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`. + +### `.getCookieStringSync(...)` + +Synchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`). + +### `.getSetCookieStrings(...)` + +Returns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`. + +### `.getSetCookieStringsSync(...)` + +Synchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`). + +### `.serialize(cb(err,serializedObject))` + +Serialize the Jar if the underlying store supports `.getAllCookies`. + +**NOTE**: Custom `Cookie` properties will be discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array. + +See [Serialization Format]. + +### `.serializeSync()` + +Sync version of .serialize + +### `.toJSON()` + +Alias of .serializeSync() for the convenience of `JSON.stringify(cookiejar)`. + +### `CookieJar.deserialize(serialized, [store], cb(err,object))` + +A new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization. + +The `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. + +As a convenience, if `serialized` is a string, it is passed through `JSON.parse` first. If that throws an error, this is passed to the callback. + +### `CookieJar.deserializeSync(serialized, [store])` + +Sync version of `.deserialize`. _Note_ that the `store` must be synchronous for this to work. + +### `CookieJar.fromJSON(string)` + +Alias of `.deserializeSync` to provide consistency with `Cookie.fromJSON()`. + +### `.clone([store,]cb(err,newJar))` + +Produces a deep clone of this jar. Modifications to the original won't affect the clone, and vice versa. + +The `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. Transferring between store types is supported so long as the source implements `.getAllCookies()` and the destination implements `.putCookie()`. + +### `.cloneSync([store])` + +Synchronous version of `.clone`, returning a new `CookieJar` instance. + +The `store` argument is optional, but must be a _synchronous_ `Store` instance if specified. If not passed, a new instance of `MemoryCookieStore` is used. + +The _source_ and _destination_ must both be synchronous `Store`s. If one or both stores are asynchronous, use `.clone` instead. Recall that `MemoryCookieStore` supports both synchronous and asynchronous API calls. + +## Store + +Base class for CookieJar stores. Available as `tough.Store`. + +## Store API + +The storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores. + +Stores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`. + +Stores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods on the of the containing `CookieJar` can be used (however, the continuation-passing style + +All `domain` parameters will have been normalized before calling. + +The Cookie store must have all of the following methods. + +### `store.findCookie(domain, path, key, cb(err,cookie))` + +Retrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned. + +Callback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error). + +### `store.findCookies(domain, path, cb(err,cookies))` + +Locates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above. + +If no cookies are found, the callback MUST be passed an empty array. + +The resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done. + +As of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only). + +### `store.putCookie(cookie, cb(err))` + +Adds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur. + +The `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties. + +Pass an error if the cookie cannot be stored. + +### `store.updateCookie(oldCookie, newCookie, cb(err))` + +Update an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store. + +The `.lastAccessed` property will always be different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (e.g., least-recently-used, which is up to the store to implement). + +Stores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object. + +The `newCookie` and `oldCookie` objects MUST NOT be modified. + +Pass an error if the newCookie cannot be stored. + +### `store.removeCookie(domain, path, key, cb(err))` + +Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint). + +The implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie. + +### `store.removeCookies(domain, path, cb(err))` + +Removes matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed. + +Pass an error ONLY if removing any existing cookies failed. + +### `store.getAllCookies(cb(err, cookies))` + +Produces an `Array` of all cookies during `jar.serialize()`. The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format] data structure. + +Cookies SHOULD be returned in creation order to preserve sorting via `compareCookies()`. For reference, `MemoryCookieStore` will sort by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1ms. See `compareCookies` for more detail. + +Pass an error if retrieval fails. + +## MemoryCookieStore + +Inherits from `Store`. + +A just-in-memory CookieJar synchronous store implementation, used by default. Despite being a synchronous implementation, it's usable with both the synchronous and asynchronous forms of the `CookieJar` API. + +## Community Cookie Stores + +These are some Store implementations authored and maintained by the community. They aren't official and we don't vouch for them but you may be interested to have a look: + +- [`db-cookie-store`](https://github.com/JSBizon/db-cookie-store): SQL including SQLite-based databases +- [`file-cookie-store`](https://github.com/JSBizon/file-cookie-store): Netscape cookie file format on disk +- [`redis-cookie-store`](https://github.com/benkroeger/redis-cookie-store): Redis +- [`tough-cookie-filestore`](https://github.com/mitsuru/tough-cookie-filestore): JSON on disk +- [`tough-cookie-web-storage-store`](https://github.com/exponentjs/tough-cookie-web-storage-store): DOM localStorage and sessionStorage + + +# Serialization Format + +**NOTE**: if you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`. + +```js + { + // The version of tough-cookie that serialized this jar. + version: 'tough-cookie@1.x.y', + + // add the store type, to make humans happy: + storeType: 'MemoryCookieStore', + + // CookieJar configuration: + rejectPublicSuffixes: true, + // ... future items go here + + // Gets filled from jar.store.getAllCookies(): + cookies: [ + { + key: 'string', + value: 'string', + // ... + /* other Cookie.serializableProperties go here */ + } + ] + } +``` + +# Copyright and License + +(tl;dr: BSD-3-Clause with some MPL/2.0) + +```text + Copyright (c) 2015, Salesforce.com, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of Salesforce.com nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +``` + +Portions may be licensed under different licenses (in particular `public_suffix_list.dat` is MPL/2.0); please read that file and the LICENSE file for full details. diff --git a/appasar/canary/node_modules/tough-cookie/lib/cookie.js b/appasar/canary/node_modules/tough-cookie/lib/cookie.js new file mode 100644 index 0000000..9f1afa1 --- /dev/null +++ b/appasar/canary/node_modules/tough-cookie/lib/cookie.js @@ -0,0 +1,1426 @@ +/*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +'use strict'; +var net = require('net'); +var urlParse = require('url').parse; +var pubsuffix = require('./pubsuffix'); +var Store = require('./store').Store; +var MemoryCookieStore = require('./memstore').MemoryCookieStore; +var pathMatch = require('./pathMatch').pathMatch; +var VERSION = require('../package.json').version; + +var punycode; +try { + punycode = require('punycode'); +} catch(e) { + console.warn("cookie: can't load punycode; won't use punycode for domain normalization"); +} + +// From RFC6265 S4.1.1 +// note that it excludes \x3B ";" +var COOKIE_OCTETS = /^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/; + +var CONTROL_CHARS = /[\x00-\x1F]/; + +// From Chromium // '\r', '\n' and '\0' should be treated as a terminator in +// the "relaxed" mode, see: +// https://github.com/ChromiumWebApps/chromium/blob/b3d3b4da8bb94c1b2e061600df106d590fda3620/net/cookies/parsed_cookie.cc#L60 +var TERMINATORS = ['\n', '\r', '\0']; + +// RFC6265 S4.1.1 defines path value as 'any CHAR except CTLs or ";"' +// Note ';' is \x3B +var PATH_VALUE = /[\x20-\x3A\x3C-\x7E]+/; + +// date-time parsing constants (RFC6265 S5.1.1) + +var DATE_DELIM = /[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/; + +var MONTH_TO_NUM = { + jan:0, feb:1, mar:2, apr:3, may:4, jun:5, + jul:6, aug:7, sep:8, oct:9, nov:10, dec:11 +}; +var NUM_TO_MONTH = [ + 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' +]; +var NUM_TO_DAY = [ + 'Sun','Mon','Tue','Wed','Thu','Fri','Sat' +]; + +var MAX_TIME = 2147483647000; // 31-bit max +var MIN_TIME = 0; // 31-bit min + +/* + * Parses a Natural number (i.e., non-negative integer) with either the + * *DIGIT ( non-digit *OCTET ) + * or + * *DIGIT + * grammar (RFC6265 S5.1.1). + * + * The "trailingOK" boolean controls if the grammar accepts a + * "( non-digit *OCTET )" trailer. + */ +function parseDigits(token, minDigits, maxDigits, trailingOK) { + var count = 0; + while (count < token.length) { + var c = token.charCodeAt(count); + // "non-digit = %x00-2F / %x3A-FF" + if (c <= 0x2F || c >= 0x3A) { + break; + } + count++; + } + + // constrain to a minimum and maximum number of digits. + if (count < minDigits || count > maxDigits) { + return null; + } + + if (!trailingOK && count != token.length) { + return null; + } + + return parseInt(token.substr(0,count), 10); +} + +function parseTime(token) { + var parts = token.split(':'); + var result = [0,0,0]; + + /* RF6256 S5.1.1: + * time = hms-time ( non-digit *OCTET ) + * hms-time = time-field ":" time-field ":" time-field + * time-field = 1*2DIGIT + */ + + if (parts.length !== 3) { + return null; + } + + for (var i = 0; i < 3; i++) { + // "time-field" must be strictly "1*2DIGIT", HOWEVER, "hms-time" can be + // followed by "( non-digit *OCTET )" so therefore the last time-field can + // have a trailer + var trailingOK = (i == 2); + var num = parseDigits(parts[i], 1, 2, trailingOK); + if (num === null) { + return null; + } + result[i] = num; + } + + return result; +} + +function parseMonth(token) { + token = String(token).substr(0,3).toLowerCase(); + var num = MONTH_TO_NUM[token]; + return num >= 0 ? num : null; +} + +/* + * RFC6265 S5.1.1 date parser (see RFC for full grammar) + */ +function parseDate(str) { + if (!str) { + return; + } + + /* RFC6265 S5.1.1: + * 2. Process each date-token sequentially in the order the date-tokens + * appear in the cookie-date + */ + var tokens = str.split(DATE_DELIM); + if (!tokens) { + return; + } + + var hour = null; + var minute = null; + var second = null; + var dayOfMonth = null; + var month = null; + var year = null; + + for (var i=0; i= 70 && year <= 99) { + year += 1900; + } else if (year >= 0 && year <= 69) { + year += 2000; + } + } + } + } + + /* RFC 6265 S5.1.1 + * "5. Abort these steps and fail to parse the cookie-date if: + * * at least one of the found-day-of-month, found-month, found- + * year, or found-time flags is not set, + * * the day-of-month-value is less than 1 or greater than 31, + * * the year-value is less than 1601, + * * the hour-value is greater than 23, + * * the minute-value is greater than 59, or + * * the second-value is greater than 59. + * (Note that leap seconds cannot be represented in this syntax.)" + * + * So, in order as above: + */ + if ( + dayOfMonth === null || month === null || year === null || second === null || + dayOfMonth < 1 || dayOfMonth > 31 || + year < 1601 || + hour > 23 || + minute > 59 || + second > 59 + ) { + return; + } + + return new Date(Date.UTC(year, month, dayOfMonth, hour, minute, second)); +} + +function formatDate(date) { + var d = date.getUTCDate(); d = d >= 10 ? d : '0'+d; + var h = date.getUTCHours(); h = h >= 10 ? h : '0'+h; + var m = date.getUTCMinutes(); m = m >= 10 ? m : '0'+m; + var s = date.getUTCSeconds(); s = s >= 10 ? s : '0'+s; + return NUM_TO_DAY[date.getUTCDay()] + ', ' + + d+' '+ NUM_TO_MONTH[date.getUTCMonth()] +' '+ date.getUTCFullYear() +' '+ + h+':'+m+':'+s+' GMT'; +} + +// S5.1.2 Canonicalized Host Names +function canonicalDomain(str) { + if (str == null) { + return null; + } + str = str.trim().replace(/^\./,''); // S4.1.2.3 & S5.2.3: ignore leading . + + // convert to IDN if any non-ASCII characters + if (punycode && /[^\u0001-\u007f]/.test(str)) { + str = punycode.toASCII(str); + } + + return str.toLowerCase(); +} + +// S5.1.3 Domain Matching +function domainMatch(str, domStr, canonicalize) { + if (str == null || domStr == null) { + return null; + } + if (canonicalize !== false) { + str = canonicalDomain(str); + domStr = canonicalDomain(domStr); + } + + /* + * "The domain string and the string are identical. (Note that both the + * domain string and the string will have been canonicalized to lower case at + * this point)" + */ + if (str == domStr) { + return true; + } + + /* "All of the following [three] conditions hold:" (order adjusted from the RFC) */ + + /* "* The string is a host name (i.e., not an IP address)." */ + if (net.isIP(str)) { + return false; + } + + /* "* The domain string is a suffix of the string" */ + var idx = str.indexOf(domStr); + if (idx <= 0) { + return false; // it's a non-match (-1) or prefix (0) + } + + // e.g "a.b.c".indexOf("b.c") === 2 + // 5 === 3+2 + if (str.length !== domStr.length + idx) { // it's not a suffix + return false; + } + + /* "* The last character of the string that is not included in the domain + * string is a %x2E (".") character." */ + if (str.substr(idx-1,1) !== '.') { + return false; + } + + return true; +} + + +// RFC6265 S5.1.4 Paths and Path-Match + +/* + * "The user agent MUST use an algorithm equivalent to the following algorithm + * to compute the default-path of a cookie:" + * + * Assumption: the path (and not query part or absolute uri) is passed in. + */ +function defaultPath(path) { + // "2. If the uri-path is empty or if the first character of the uri-path is not + // a %x2F ("/") character, output %x2F ("/") and skip the remaining steps. + if (!path || path.substr(0,1) !== "/") { + return "/"; + } + + // "3. If the uri-path contains no more than one %x2F ("/") character, output + // %x2F ("/") and skip the remaining step." + if (path === "/") { + return path; + } + + var rightSlash = path.lastIndexOf("/"); + if (rightSlash === 0) { + return "/"; + } + + // "4. Output the characters of the uri-path from the first character up to, + // but not including, the right-most %x2F ("/")." + return path.slice(0, rightSlash); +} + +function trimTerminator(str) { + for (var t = 0; t < TERMINATORS.length; t++) { + var terminatorIdx = str.indexOf(TERMINATORS[t]); + if (terminatorIdx !== -1) { + str = str.substr(0,terminatorIdx); + } + } + + return str; +} + +function parseCookiePair(cookiePair, looseMode) { + cookiePair = trimTerminator(cookiePair); + + var firstEq = cookiePair.indexOf('='); + if (looseMode) { + if (firstEq === 0) { // '=' is immediately at start + cookiePair = cookiePair.substr(1); + firstEq = cookiePair.indexOf('='); // might still need to split on '=' + } + } else { // non-loose mode + if (firstEq <= 0) { // no '=' or is at start + return; // needs to have non-empty "cookie-name" + } + } + + var cookieName, cookieValue; + if (firstEq <= 0) { + cookieName = ""; + cookieValue = cookiePair.trim(); + } else { + cookieName = cookiePair.substr(0, firstEq).trim(); + cookieValue = cookiePair.substr(firstEq+1).trim(); + } + + if (CONTROL_CHARS.test(cookieName) || CONTROL_CHARS.test(cookieValue)) { + return; + } + + var c = new Cookie(); + c.key = cookieName; + c.value = cookieValue; + return c; +} + +function parse(str, options) { + if (!options || typeof options !== 'object') { + options = {}; + } + str = str.trim(); + + // We use a regex to parse the "name-value-pair" part of S5.2 + var firstSemi = str.indexOf(';'); // S5.2 step 1 + var cookiePair = (firstSemi === -1) ? str : str.substr(0, firstSemi); + var c = parseCookiePair(cookiePair, !!options.loose); + if (!c) { + return; + } + + if (firstSemi === -1) { + return c; + } + + // S5.2.3 "unparsed-attributes consist of the remainder of the set-cookie-string + // (including the %x3B (";") in question)." plus later on in the same section + // "discard the first ";" and trim". + var unparsed = str.slice(firstSemi + 1).trim(); + + // "If the unparsed-attributes string is empty, skip the rest of these + // steps." + if (unparsed.length === 0) { + return c; + } + + /* + * S5.2 says that when looping over the items "[p]rocess the attribute-name + * and attribute-value according to the requirements in the following + * subsections" for every item. Plus, for many of the individual attributes + * in S5.3 it says to use the "attribute-value of the last attribute in the + * cookie-attribute-list". Therefore, in this implementation, we overwrite + * the previous value. + */ + var cookie_avs = unparsed.split(';'); + while (cookie_avs.length) { + var av = cookie_avs.shift().trim(); + if (av.length === 0) { // happens if ";;" appears + continue; + } + var av_sep = av.indexOf('='); + var av_key, av_value; + + if (av_sep === -1) { + av_key = av; + av_value = null; + } else { + av_key = av.substr(0,av_sep); + av_value = av.substr(av_sep+1); + } + + av_key = av_key.trim().toLowerCase(); + + if (av_value) { + av_value = av_value.trim(); + } + + switch(av_key) { + case 'expires': // S5.2.1 + if (av_value) { + var exp = parseDate(av_value); + // "If the attribute-value failed to parse as a cookie date, ignore the + // cookie-av." + if (exp) { + // over and underflow not realistically a concern: V8's getTime() seems to + // store something larger than a 32-bit time_t (even with 32-bit node) + c.expires = exp; + } + } + break; + + case 'max-age': // S5.2.2 + if (av_value) { + // "If the first character of the attribute-value is not a DIGIT or a "-" + // character ...[or]... If the remainder of attribute-value contains a + // non-DIGIT character, ignore the cookie-av." + if (/^-?[0-9]+$/.test(av_value)) { + var delta = parseInt(av_value, 10); + // "If delta-seconds is less than or equal to zero (0), let expiry-time + // be the earliest representable date and time." + c.setMaxAge(delta); + } + } + break; + + case 'domain': // S5.2.3 + // "If the attribute-value is empty, the behavior is undefined. However, + // the user agent SHOULD ignore the cookie-av entirely." + if (av_value) { + // S5.2.3 "Let cookie-domain be the attribute-value without the leading %x2E + // (".") character." + var domain = av_value.trim().replace(/^\./, ''); + if (domain) { + // "Convert the cookie-domain to lower case." + c.domain = domain.toLowerCase(); + } + } + break; + + case 'path': // S5.2.4 + /* + * "If the attribute-value is empty or if the first character of the + * attribute-value is not %x2F ("/"): + * Let cookie-path be the default-path. + * Otherwise: + * Let cookie-path be the attribute-value." + * + * We'll represent the default-path as null since it depends on the + * context of the parsing. + */ + c.path = av_value && av_value[0] === "/" ? av_value : null; + break; + + case 'secure': // S5.2.5 + /* + * "If the attribute-name case-insensitively matches the string "Secure", + * the user agent MUST append an attribute to the cookie-attribute-list + * with an attribute-name of Secure and an empty attribute-value." + */ + c.secure = true; + break; + + case 'httponly': // S5.2.6 -- effectively the same as 'secure' + c.httpOnly = true; + break; + + default: + c.extensions = c.extensions || []; + c.extensions.push(av); + break; + } + } + + return c; +} + +// avoid the V8 deoptimization monster! +function jsonParse(str) { + var obj; + try { + obj = JSON.parse(str); + } catch (e) { + return e; + } + return obj; +} + +function fromJSON(str) { + if (!str) { + return null; + } + + var obj; + if (typeof str === 'string') { + obj = jsonParse(str); + if (obj instanceof Error) { + return null; + } + } else { + // assume it's an Object + obj = str; + } + + var c = new Cookie(); + for (var i=0; i 1) { + var lindex = path.lastIndexOf('/'); + if (lindex === 0) { + break; + } + path = path.substr(0,lindex); + permutations.push(path); + } + permutations.push('/'); + return permutations; +} + +function getCookieContext(url) { + if (url instanceof Object) { + return url; + } + // NOTE: decodeURI will throw on malformed URIs (see GH-32). + // Therefore, we will just skip decoding for such URIs. + try { + url = decodeURI(url); + } + catch(err) { + // Silently swallow error + } + + return urlParse(url); +} + +function Cookie(options) { + options = options || {}; + + Object.keys(options).forEach(function(prop) { + if (Cookie.prototype.hasOwnProperty(prop) && + Cookie.prototype[prop] !== options[prop] && + prop.substr(0,1) !== '_') + { + this[prop] = options[prop]; + } + }, this); + + this.creation = this.creation || new Date(); + + // used to break creation ties in cookieCompare(): + Object.defineProperty(this, 'creationIndex', { + configurable: false, + enumerable: false, // important for assert.deepEqual checks + writable: true, + value: ++Cookie.cookiesCreated + }); +} + +Cookie.cookiesCreated = 0; // incremented each time a cookie is created + +Cookie.parse = parse; +Cookie.fromJSON = fromJSON; + +Cookie.prototype.key = ""; +Cookie.prototype.value = ""; + +// the order in which the RFC has them: +Cookie.prototype.expires = "Infinity"; // coerces to literal Infinity +Cookie.prototype.maxAge = null; // takes precedence over expires for TTL +Cookie.prototype.domain = null; +Cookie.prototype.path = null; +Cookie.prototype.secure = false; +Cookie.prototype.httpOnly = false; +Cookie.prototype.extensions = null; + +// set by the CookieJar: +Cookie.prototype.hostOnly = null; // boolean when set +Cookie.prototype.pathIsDefault = null; // boolean when set +Cookie.prototype.creation = null; // Date when set; defaulted by Cookie.parse +Cookie.prototype.lastAccessed = null; // Date when set +Object.defineProperty(Cookie.prototype, 'creationIndex', { + configurable: true, + enumerable: false, + writable: true, + value: 0 +}); + +Cookie.serializableProperties = Object.keys(Cookie.prototype) + .filter(function(prop) { + return !( + Cookie.prototype[prop] instanceof Function || + prop === 'creationIndex' || + prop.substr(0,1) === '_' + ); + }); + +Cookie.prototype.inspect = function inspect() { + var now = Date.now(); + return 'Cookie="'+this.toString() + + '; hostOnly='+(this.hostOnly != null ? this.hostOnly : '?') + + '; aAge='+(this.lastAccessed ? (now-this.lastAccessed.getTime())+'ms' : '?') + + '; cAge='+(this.creation ? (now-this.creation.getTime())+'ms' : '?') + + '"'; +}; + +Cookie.prototype.toJSON = function() { + var obj = {}; + + var props = Cookie.serializableProperties; + for (var i=0; i suffixLen) { + var publicSuffix = parts.slice(0,suffixLen+1).reverse().join('.'); + return converted ? punycode.toUnicode(publicSuffix) : publicSuffix; + } + + return null; +}; + +// The following generated structure is used under the MPL version 2.0 +// See public-suffix.txt for more information + +var index = module.exports.index = Object.freeze( +{"ac":true,"com.ac":true,"edu.ac":true,"gov.ac":true,"net.ac":true,"mil.ac":true,"org.ac":true,"ad":true,"nom.ad":true,"ae":true,"co.ae":true,"net.ae":true,"org.ae":true,"sch.ae":true,"ac.ae":true,"gov.ae":true,"mil.ae":true,"aero":true,"accident-investigation.aero":true,"accident-prevention.aero":true,"aerobatic.aero":true,"aeroclub.aero":true,"aerodrome.aero":true,"agents.aero":true,"aircraft.aero":true,"airline.aero":true,"airport.aero":true,"air-surveillance.aero":true,"airtraffic.aero":true,"air-traffic-control.aero":true,"ambulance.aero":true,"amusement.aero":true,"association.aero":true,"author.aero":true,"ballooning.aero":true,"broker.aero":true,"caa.aero":true,"cargo.aero":true,"catering.aero":true,"certification.aero":true,"championship.aero":true,"charter.aero":true,"civilaviation.aero":true,"club.aero":true,"conference.aero":true,"consultant.aero":true,"consulting.aero":true,"control.aero":true,"council.aero":true,"crew.aero":true,"design.aero":true,"dgca.aero":true,"educator.aero":true,"emergency.aero":true,"engine.aero":true,"engineer.aero":true,"entertainment.aero":true,"equipment.aero":true,"exchange.aero":true,"express.aero":true,"federation.aero":true,"flight.aero":true,"freight.aero":true,"fuel.aero":true,"gliding.aero":true,"government.aero":true,"groundhandling.aero":true,"group.aero":true,"hanggliding.aero":true,"homebuilt.aero":true,"insurance.aero":true,"journal.aero":true,"journalist.aero":true,"leasing.aero":true,"logistics.aero":true,"magazine.aero":true,"maintenance.aero":true,"media.aero":true,"microlight.aero":true,"modelling.aero":true,"navigation.aero":true,"parachuting.aero":true,"paragliding.aero":true,"passenger-association.aero":true,"pilot.aero":true,"press.aero":true,"production.aero":true,"recreation.aero":true,"repbody.aero":true,"res.aero":true,"research.aero":true,"rotorcraft.aero":true,"safety.aero":true,"scientist.aero":true,"services.aero":true,"show.aero":true,"skydiving.aero":true,"software.aero":true,"student.aero":true,"trader.aero":true,"trading.aero":true,"trainer.aero":true,"union.aero":true,"workinggroup.aero":true,"works.aero":true,"af":true,"gov.af":true,"com.af":true,"org.af":true,"net.af":true,"edu.af":true,"ag":true,"com.ag":true,"org.ag":true,"net.ag":true,"co.ag":true,"nom.ag":true,"ai":true,"off.ai":true,"com.ai":true,"net.ai":true,"org.ai":true,"al":true,"com.al":true,"edu.al":true,"gov.al":true,"mil.al":true,"net.al":true,"org.al":true,"am":true,"ao":true,"ed.ao":true,"gv.ao":true,"og.ao":true,"co.ao":true,"pb.ao":true,"it.ao":true,"aq":true,"ar":true,"com.ar":true,"edu.ar":true,"gob.ar":true,"gov.ar":true,"int.ar":true,"mil.ar":true,"musica.ar":true,"net.ar":true,"org.ar":true,"tur.ar":true,"arpa":true,"e164.arpa":true,"in-addr.arpa":true,"ip6.arpa":true,"iris.arpa":true,"uri.arpa":true,"urn.arpa":true,"as":true,"gov.as":true,"asia":true,"at":true,"ac.at":true,"co.at":true,"gv.at":true,"or.at":true,"au":true,"com.au":true,"net.au":true,"org.au":true,"edu.au":true,"gov.au":true,"asn.au":true,"id.au":true,"info.au":true,"conf.au":true,"oz.au":true,"act.au":true,"nsw.au":true,"nt.au":true,"qld.au":true,"sa.au":true,"tas.au":true,"vic.au":true,"wa.au":true,"act.edu.au":true,"nsw.edu.au":true,"nt.edu.au":true,"qld.edu.au":true,"sa.edu.au":true,"tas.edu.au":true,"vic.edu.au":true,"wa.edu.au":true,"qld.gov.au":true,"sa.gov.au":true,"tas.gov.au":true,"vic.gov.au":true,"wa.gov.au":true,"aw":true,"com.aw":true,"ax":true,"az":true,"com.az":true,"net.az":true,"int.az":true,"gov.az":true,"org.az":true,"edu.az":true,"info.az":true,"pp.az":true,"mil.az":true,"name.az":true,"pro.az":true,"biz.az":true,"ba":true,"com.ba":true,"edu.ba":true,"gov.ba":true,"mil.ba":true,"net.ba":true,"org.ba":true,"bb":true,"biz.bb":true,"co.bb":true,"com.bb":true,"edu.bb":true,"gov.bb":true,"info.bb":true,"net.bb":true,"org.bb":true,"store.bb":true,"tv.bb":true,"*.bd":true,"be":true,"ac.be":true,"bf":true,"gov.bf":true,"bg":true,"a.bg":true,"b.bg":true,"c.bg":true,"d.bg":true,"e.bg":true,"f.bg":true,"g.bg":true,"h.bg":true,"i.bg":true,"j.bg":true,"k.bg":true,"l.bg":true,"m.bg":true,"n.bg":true,"o.bg":true,"p.bg":true,"q.bg":true,"r.bg":true,"s.bg":true,"t.bg":true,"u.bg":true,"v.bg":true,"w.bg":true,"x.bg":true,"y.bg":true,"z.bg":true,"0.bg":true,"1.bg":true,"2.bg":true,"3.bg":true,"4.bg":true,"5.bg":true,"6.bg":true,"7.bg":true,"8.bg":true,"9.bg":true,"bh":true,"com.bh":true,"edu.bh":true,"net.bh":true,"org.bh":true,"gov.bh":true,"bi":true,"co.bi":true,"com.bi":true,"edu.bi":true,"or.bi":true,"org.bi":true,"biz":true,"bj":true,"asso.bj":true,"barreau.bj":true,"gouv.bj":true,"bm":true,"com.bm":true,"edu.bm":true,"gov.bm":true,"net.bm":true,"org.bm":true,"*.bn":true,"bo":true,"com.bo":true,"edu.bo":true,"gob.bo":true,"int.bo":true,"org.bo":true,"net.bo":true,"mil.bo":true,"tv.bo":true,"web.bo":true,"academia.bo":true,"agro.bo":true,"arte.bo":true,"blog.bo":true,"bolivia.bo":true,"ciencia.bo":true,"cooperativa.bo":true,"democracia.bo":true,"deporte.bo":true,"ecologia.bo":true,"economia.bo":true,"empresa.bo":true,"indigena.bo":true,"industria.bo":true,"info.bo":true,"medicina.bo":true,"movimiento.bo":true,"musica.bo":true,"natural.bo":true,"nombre.bo":true,"noticias.bo":true,"patria.bo":true,"politica.bo":true,"profesional.bo":true,"plurinacional.bo":true,"pueblo.bo":true,"revista.bo":true,"salud.bo":true,"tecnologia.bo":true,"tksat.bo":true,"transporte.bo":true,"wiki.bo":true,"br":true,"9guacu.br":true,"abc.br":true,"adm.br":true,"adv.br":true,"agr.br":true,"aju.br":true,"am.br":true,"anani.br":true,"aparecida.br":true,"arq.br":true,"art.br":true,"ato.br":true,"b.br":true,"belem.br":true,"bhz.br":true,"bio.br":true,"blog.br":true,"bmd.br":true,"boavista.br":true,"bsb.br":true,"campinagrande.br":true,"campinas.br":true,"caxias.br":true,"cim.br":true,"cng.br":true,"cnt.br":true,"com.br":true,"contagem.br":true,"coop.br":true,"cri.br":true,"cuiaba.br":true,"curitiba.br":true,"def.br":true,"ecn.br":true,"eco.br":true,"edu.br":true,"emp.br":true,"eng.br":true,"esp.br":true,"etc.br":true,"eti.br":true,"far.br":true,"feira.br":true,"flog.br":true,"floripa.br":true,"fm.br":true,"fnd.br":true,"fortal.br":true,"fot.br":true,"foz.br":true,"fst.br":true,"g12.br":true,"ggf.br":true,"goiania.br":true,"gov.br":true,"ac.gov.br":true,"al.gov.br":true,"am.gov.br":true,"ap.gov.br":true,"ba.gov.br":true,"ce.gov.br":true,"df.gov.br":true,"es.gov.br":true,"go.gov.br":true,"ma.gov.br":true,"mg.gov.br":true,"ms.gov.br":true,"mt.gov.br":true,"pa.gov.br":true,"pb.gov.br":true,"pe.gov.br":true,"pi.gov.br":true,"pr.gov.br":true,"rj.gov.br":true,"rn.gov.br":true,"ro.gov.br":true,"rr.gov.br":true,"rs.gov.br":true,"sc.gov.br":true,"se.gov.br":true,"sp.gov.br":true,"to.gov.br":true,"gru.br":true,"imb.br":true,"ind.br":true,"inf.br":true,"jab.br":true,"jampa.br":true,"jdf.br":true,"joinville.br":true,"jor.br":true,"jus.br":true,"leg.br":true,"lel.br":true,"londrina.br":true,"macapa.br":true,"maceio.br":true,"manaus.br":true,"maringa.br":true,"mat.br":true,"med.br":true,"mil.br":true,"morena.br":true,"mp.br":true,"mus.br":true,"natal.br":true,"net.br":true,"niteroi.br":true,"*.nom.br":true,"not.br":true,"ntr.br":true,"odo.br":true,"org.br":true,"osasco.br":true,"palmas.br":true,"poa.br":true,"ppg.br":true,"pro.br":true,"psc.br":true,"psi.br":true,"pvh.br":true,"qsl.br":true,"radio.br":true,"rec.br":true,"recife.br":true,"ribeirao.br":true,"rio.br":true,"riobranco.br":true,"riopreto.br":true,"salvador.br":true,"sampa.br":true,"santamaria.br":true,"santoandre.br":true,"saobernardo.br":true,"saogonca.br":true,"sjc.br":true,"slg.br":true,"slz.br":true,"sorocaba.br":true,"srv.br":true,"taxi.br":true,"teo.br":true,"the.br":true,"tmp.br":true,"trd.br":true,"tur.br":true,"tv.br":true,"udi.br":true,"vet.br":true,"vix.br":true,"vlog.br":true,"wiki.br":true,"zlg.br":true,"bs":true,"com.bs":true,"net.bs":true,"org.bs":true,"edu.bs":true,"gov.bs":true,"bt":true,"com.bt":true,"edu.bt":true,"gov.bt":true,"net.bt":true,"org.bt":true,"bv":true,"bw":true,"co.bw":true,"org.bw":true,"by":true,"gov.by":true,"mil.by":true,"com.by":true,"of.by":true,"bz":true,"com.bz":true,"net.bz":true,"org.bz":true,"edu.bz":true,"gov.bz":true,"ca":true,"ab.ca":true,"bc.ca":true,"mb.ca":true,"nb.ca":true,"nf.ca":true,"nl.ca":true,"ns.ca":true,"nt.ca":true,"nu.ca":true,"on.ca":true,"pe.ca":true,"qc.ca":true,"sk.ca":true,"yk.ca":true,"gc.ca":true,"cat":true,"cc":true,"cd":true,"gov.cd":true,"cf":true,"cg":true,"ch":true,"ci":true,"org.ci":true,"or.ci":true,"com.ci":true,"co.ci":true,"edu.ci":true,"ed.ci":true,"ac.ci":true,"net.ci":true,"go.ci":true,"asso.ci":true,"xn--aroport-bya.ci":true,"int.ci":true,"presse.ci":true,"md.ci":true,"gouv.ci":true,"*.ck":true,"www.ck":false,"cl":true,"gov.cl":true,"gob.cl":true,"co.cl":true,"mil.cl":true,"cm":true,"co.cm":true,"com.cm":true,"gov.cm":true,"net.cm":true,"cn":true,"ac.cn":true,"com.cn":true,"edu.cn":true,"gov.cn":true,"net.cn":true,"org.cn":true,"mil.cn":true,"xn--55qx5d.cn":true,"xn--io0a7i.cn":true,"xn--od0alg.cn":true,"ah.cn":true,"bj.cn":true,"cq.cn":true,"fj.cn":true,"gd.cn":true,"gs.cn":true,"gz.cn":true,"gx.cn":true,"ha.cn":true,"hb.cn":true,"he.cn":true,"hi.cn":true,"hl.cn":true,"hn.cn":true,"jl.cn":true,"js.cn":true,"jx.cn":true,"ln.cn":true,"nm.cn":true,"nx.cn":true,"qh.cn":true,"sc.cn":true,"sd.cn":true,"sh.cn":true,"sn.cn":true,"sx.cn":true,"tj.cn":true,"xj.cn":true,"xz.cn":true,"yn.cn":true,"zj.cn":true,"hk.cn":true,"mo.cn":true,"tw.cn":true,"co":true,"arts.co":true,"com.co":true,"edu.co":true,"firm.co":true,"gov.co":true,"info.co":true,"int.co":true,"mil.co":true,"net.co":true,"nom.co":true,"org.co":true,"rec.co":true,"web.co":true,"com":true,"coop":true,"cr":true,"ac.cr":true,"co.cr":true,"ed.cr":true,"fi.cr":true,"go.cr":true,"or.cr":true,"sa.cr":true,"cu":true,"com.cu":true,"edu.cu":true,"org.cu":true,"net.cu":true,"gov.cu":true,"inf.cu":true,"cv":true,"cw":true,"com.cw":true,"edu.cw":true,"net.cw":true,"org.cw":true,"cx":true,"gov.cx":true,"cy":true,"ac.cy":true,"biz.cy":true,"com.cy":true,"ekloges.cy":true,"gov.cy":true,"ltd.cy":true,"name.cy":true,"net.cy":true,"org.cy":true,"parliament.cy":true,"press.cy":true,"pro.cy":true,"tm.cy":true,"cz":true,"de":true,"dj":true,"dk":true,"dm":true,"com.dm":true,"net.dm":true,"org.dm":true,"edu.dm":true,"gov.dm":true,"do":true,"art.do":true,"com.do":true,"edu.do":true,"gob.do":true,"gov.do":true,"mil.do":true,"net.do":true,"org.do":true,"sld.do":true,"web.do":true,"dz":true,"com.dz":true,"org.dz":true,"net.dz":true,"gov.dz":true,"edu.dz":true,"asso.dz":true,"pol.dz":true,"art.dz":true,"ec":true,"com.ec":true,"info.ec":true,"net.ec":true,"fin.ec":true,"k12.ec":true,"med.ec":true,"pro.ec":true,"org.ec":true,"edu.ec":true,"gov.ec":true,"gob.ec":true,"mil.ec":true,"edu":true,"ee":true,"edu.ee":true,"gov.ee":true,"riik.ee":true,"lib.ee":true,"med.ee":true,"com.ee":true,"pri.ee":true,"aip.ee":true,"org.ee":true,"fie.ee":true,"eg":true,"com.eg":true,"edu.eg":true,"eun.eg":true,"gov.eg":true,"mil.eg":true,"name.eg":true,"net.eg":true,"org.eg":true,"sci.eg":true,"*.er":true,"es":true,"com.es":true,"nom.es":true,"org.es":true,"gob.es":true,"edu.es":true,"et":true,"com.et":true,"gov.et":true,"org.et":true,"edu.et":true,"biz.et":true,"name.et":true,"info.et":true,"net.et":true,"eu":true,"fi":true,"aland.fi":true,"*.fj":true,"*.fk":true,"fm":true,"fo":true,"fr":true,"com.fr":true,"asso.fr":true,"nom.fr":true,"prd.fr":true,"presse.fr":true,"tm.fr":true,"aeroport.fr":true,"assedic.fr":true,"avocat.fr":true,"avoues.fr":true,"cci.fr":true,"chambagri.fr":true,"chirurgiens-dentistes.fr":true,"experts-comptables.fr":true,"geometre-expert.fr":true,"gouv.fr":true,"greta.fr":true,"huissier-justice.fr":true,"medecin.fr":true,"notaires.fr":true,"pharmacien.fr":true,"port.fr":true,"veterinaire.fr":true,"ga":true,"gb":true,"gd":true,"ge":true,"com.ge":true,"edu.ge":true,"gov.ge":true,"org.ge":true,"mil.ge":true,"net.ge":true,"pvt.ge":true,"gf":true,"gg":true,"co.gg":true,"net.gg":true,"org.gg":true,"gh":true,"com.gh":true,"edu.gh":true,"gov.gh":true,"org.gh":true,"mil.gh":true,"gi":true,"com.gi":true,"ltd.gi":true,"gov.gi":true,"mod.gi":true,"edu.gi":true,"org.gi":true,"gl":true,"co.gl":true,"com.gl":true,"edu.gl":true,"net.gl":true,"org.gl":true,"gm":true,"gn":true,"ac.gn":true,"com.gn":true,"edu.gn":true,"gov.gn":true,"org.gn":true,"net.gn":true,"gov":true,"gp":true,"com.gp":true,"net.gp":true,"mobi.gp":true,"edu.gp":true,"org.gp":true,"asso.gp":true,"gq":true,"gr":true,"com.gr":true,"edu.gr":true,"net.gr":true,"org.gr":true,"gov.gr":true,"gs":true,"gt":true,"com.gt":true,"edu.gt":true,"gob.gt":true,"ind.gt":true,"mil.gt":true,"net.gt":true,"org.gt":true,"*.gu":true,"gw":true,"gy":true,"co.gy":true,"com.gy":true,"edu.gy":true,"gov.gy":true,"net.gy":true,"org.gy":true,"hk":true,"com.hk":true,"edu.hk":true,"gov.hk":true,"idv.hk":true,"net.hk":true,"org.hk":true,"xn--55qx5d.hk":true,"xn--wcvs22d.hk":true,"xn--lcvr32d.hk":true,"xn--mxtq1m.hk":true,"xn--gmqw5a.hk":true,"xn--ciqpn.hk":true,"xn--gmq050i.hk":true,"xn--zf0avx.hk":true,"xn--io0a7i.hk":true,"xn--mk0axi.hk":true,"xn--od0alg.hk":true,"xn--od0aq3b.hk":true,"xn--tn0ag.hk":true,"xn--uc0atv.hk":true,"xn--uc0ay4a.hk":true,"hm":true,"hn":true,"com.hn":true,"edu.hn":true,"org.hn":true,"net.hn":true,"mil.hn":true,"gob.hn":true,"hr":true,"iz.hr":true,"from.hr":true,"name.hr":true,"com.hr":true,"ht":true,"com.ht":true,"shop.ht":true,"firm.ht":true,"info.ht":true,"adult.ht":true,"net.ht":true,"pro.ht":true,"org.ht":true,"med.ht":true,"art.ht":true,"coop.ht":true,"pol.ht":true,"asso.ht":true,"edu.ht":true,"rel.ht":true,"gouv.ht":true,"perso.ht":true,"hu":true,"co.hu":true,"info.hu":true,"org.hu":true,"priv.hu":true,"sport.hu":true,"tm.hu":true,"2000.hu":true,"agrar.hu":true,"bolt.hu":true,"casino.hu":true,"city.hu":true,"erotica.hu":true,"erotika.hu":true,"film.hu":true,"forum.hu":true,"games.hu":true,"hotel.hu":true,"ingatlan.hu":true,"jogasz.hu":true,"konyvelo.hu":true,"lakas.hu":true,"media.hu":true,"news.hu":true,"reklam.hu":true,"sex.hu":true,"shop.hu":true,"suli.hu":true,"szex.hu":true,"tozsde.hu":true,"utazas.hu":true,"video.hu":true,"id":true,"ac.id":true,"biz.id":true,"co.id":true,"desa.id":true,"go.id":true,"mil.id":true,"my.id":true,"net.id":true,"or.id":true,"sch.id":true,"web.id":true,"ie":true,"gov.ie":true,"il":true,"ac.il":true,"co.il":true,"gov.il":true,"idf.il":true,"k12.il":true,"muni.il":true,"net.il":true,"org.il":true,"im":true,"ac.im":true,"co.im":true,"com.im":true,"ltd.co.im":true,"net.im":true,"org.im":true,"plc.co.im":true,"tt.im":true,"tv.im":true,"in":true,"co.in":true,"firm.in":true,"net.in":true,"org.in":true,"gen.in":true,"ind.in":true,"nic.in":true,"ac.in":true,"edu.in":true,"res.in":true,"gov.in":true,"mil.in":true,"info":true,"int":true,"eu.int":true,"io":true,"com.io":true,"iq":true,"gov.iq":true,"edu.iq":true,"mil.iq":true,"com.iq":true,"org.iq":true,"net.iq":true,"ir":true,"ac.ir":true,"co.ir":true,"gov.ir":true,"id.ir":true,"net.ir":true,"org.ir":true,"sch.ir":true,"xn--mgba3a4f16a.ir":true,"xn--mgba3a4fra.ir":true,"is":true,"net.is":true,"com.is":true,"edu.is":true,"gov.is":true,"org.is":true,"int.is":true,"it":true,"gov.it":true,"edu.it":true,"abr.it":true,"abruzzo.it":true,"aosta-valley.it":true,"aostavalley.it":true,"bas.it":true,"basilicata.it":true,"cal.it":true,"calabria.it":true,"cam.it":true,"campania.it":true,"emilia-romagna.it":true,"emiliaromagna.it":true,"emr.it":true,"friuli-v-giulia.it":true,"friuli-ve-giulia.it":true,"friuli-vegiulia.it":true,"friuli-venezia-giulia.it":true,"friuli-veneziagiulia.it":true,"friuli-vgiulia.it":true,"friuliv-giulia.it":true,"friulive-giulia.it":true,"friulivegiulia.it":true,"friulivenezia-giulia.it":true,"friuliveneziagiulia.it":true,"friulivgiulia.it":true,"fvg.it":true,"laz.it":true,"lazio.it":true,"lig.it":true,"liguria.it":true,"lom.it":true,"lombardia.it":true,"lombardy.it":true,"lucania.it":true,"mar.it":true,"marche.it":true,"mol.it":true,"molise.it":true,"piedmont.it":true,"piemonte.it":true,"pmn.it":true,"pug.it":true,"puglia.it":true,"sar.it":true,"sardegna.it":true,"sardinia.it":true,"sic.it":true,"sicilia.it":true,"sicily.it":true,"taa.it":true,"tos.it":true,"toscana.it":true,"trentino-a-adige.it":true,"trentino-aadige.it":true,"trentino-alto-adige.it":true,"trentino-altoadige.it":true,"trentino-s-tirol.it":true,"trentino-stirol.it":true,"trentino-sud-tirol.it":true,"trentino-sudtirol.it":true,"trentino-sued-tirol.it":true,"trentino-suedtirol.it":true,"trentinoa-adige.it":true,"trentinoaadige.it":true,"trentinoalto-adige.it":true,"trentinoaltoadige.it":true,"trentinos-tirol.it":true,"trentinostirol.it":true,"trentinosud-tirol.it":true,"trentinosudtirol.it":true,"trentinosued-tirol.it":true,"trentinosuedtirol.it":true,"tuscany.it":true,"umb.it":true,"umbria.it":true,"val-d-aosta.it":true,"val-daosta.it":true,"vald-aosta.it":true,"valdaosta.it":true,"valle-aosta.it":true,"valle-d-aosta.it":true,"valle-daosta.it":true,"valleaosta.it":true,"valled-aosta.it":true,"valledaosta.it":true,"vallee-aoste.it":true,"valleeaoste.it":true,"vao.it":true,"vda.it":true,"ven.it":true,"veneto.it":true,"ag.it":true,"agrigento.it":true,"al.it":true,"alessandria.it":true,"alto-adige.it":true,"altoadige.it":true,"an.it":true,"ancona.it":true,"andria-barletta-trani.it":true,"andria-trani-barletta.it":true,"andriabarlettatrani.it":true,"andriatranibarletta.it":true,"ao.it":true,"aosta.it":true,"aoste.it":true,"ap.it":true,"aq.it":true,"aquila.it":true,"ar.it":true,"arezzo.it":true,"ascoli-piceno.it":true,"ascolipiceno.it":true,"asti.it":true,"at.it":true,"av.it":true,"avellino.it":true,"ba.it":true,"balsan.it":true,"bari.it":true,"barletta-trani-andria.it":true,"barlettatraniandria.it":true,"belluno.it":true,"benevento.it":true,"bergamo.it":true,"bg.it":true,"bi.it":true,"biella.it":true,"bl.it":true,"bn.it":true,"bo.it":true,"bologna.it":true,"bolzano.it":true,"bozen.it":true,"br.it":true,"brescia.it":true,"brindisi.it":true,"bs.it":true,"bt.it":true,"bz.it":true,"ca.it":true,"cagliari.it":true,"caltanissetta.it":true,"campidano-medio.it":true,"campidanomedio.it":true,"campobasso.it":true,"carbonia-iglesias.it":true,"carboniaiglesias.it":true,"carrara-massa.it":true,"carraramassa.it":true,"caserta.it":true,"catania.it":true,"catanzaro.it":true,"cb.it":true,"ce.it":true,"cesena-forli.it":true,"cesenaforli.it":true,"ch.it":true,"chieti.it":true,"ci.it":true,"cl.it":true,"cn.it":true,"co.it":true,"como.it":true,"cosenza.it":true,"cr.it":true,"cremona.it":true,"crotone.it":true,"cs.it":true,"ct.it":true,"cuneo.it":true,"cz.it":true,"dell-ogliastra.it":true,"dellogliastra.it":true,"en.it":true,"enna.it":true,"fc.it":true,"fe.it":true,"fermo.it":true,"ferrara.it":true,"fg.it":true,"fi.it":true,"firenze.it":true,"florence.it":true,"fm.it":true,"foggia.it":true,"forli-cesena.it":true,"forlicesena.it":true,"fr.it":true,"frosinone.it":true,"ge.it":true,"genoa.it":true,"genova.it":true,"go.it":true,"gorizia.it":true,"gr.it":true,"grosseto.it":true,"iglesias-carbonia.it":true,"iglesiascarbonia.it":true,"im.it":true,"imperia.it":true,"is.it":true,"isernia.it":true,"kr.it":true,"la-spezia.it":true,"laquila.it":true,"laspezia.it":true,"latina.it":true,"lc.it":true,"le.it":true,"lecce.it":true,"lecco.it":true,"li.it":true,"livorno.it":true,"lo.it":true,"lodi.it":true,"lt.it":true,"lu.it":true,"lucca.it":true,"macerata.it":true,"mantova.it":true,"massa-carrara.it":true,"massacarrara.it":true,"matera.it":true,"mb.it":true,"mc.it":true,"me.it":true,"medio-campidano.it":true,"mediocampidano.it":true,"messina.it":true,"mi.it":true,"milan.it":true,"milano.it":true,"mn.it":true,"mo.it":true,"modena.it":true,"monza-brianza.it":true,"monza-e-della-brianza.it":true,"monza.it":true,"monzabrianza.it":true,"monzaebrianza.it":true,"monzaedellabrianza.it":true,"ms.it":true,"mt.it":true,"na.it":true,"naples.it":true,"napoli.it":true,"no.it":true,"novara.it":true,"nu.it":true,"nuoro.it":true,"og.it":true,"ogliastra.it":true,"olbia-tempio.it":true,"olbiatempio.it":true,"or.it":true,"oristano.it":true,"ot.it":true,"pa.it":true,"padova.it":true,"padua.it":true,"palermo.it":true,"parma.it":true,"pavia.it":true,"pc.it":true,"pd.it":true,"pe.it":true,"perugia.it":true,"pesaro-urbino.it":true,"pesarourbino.it":true,"pescara.it":true,"pg.it":true,"pi.it":true,"piacenza.it":true,"pisa.it":true,"pistoia.it":true,"pn.it":true,"po.it":true,"pordenone.it":true,"potenza.it":true,"pr.it":true,"prato.it":true,"pt.it":true,"pu.it":true,"pv.it":true,"pz.it":true,"ra.it":true,"ragusa.it":true,"ravenna.it":true,"rc.it":true,"re.it":true,"reggio-calabria.it":true,"reggio-emilia.it":true,"reggiocalabria.it":true,"reggioemilia.it":true,"rg.it":true,"ri.it":true,"rieti.it":true,"rimini.it":true,"rm.it":true,"rn.it":true,"ro.it":true,"roma.it":true,"rome.it":true,"rovigo.it":true,"sa.it":true,"salerno.it":true,"sassari.it":true,"savona.it":true,"si.it":true,"siena.it":true,"siracusa.it":true,"so.it":true,"sondrio.it":true,"sp.it":true,"sr.it":true,"ss.it":true,"suedtirol.it":true,"sv.it":true,"ta.it":true,"taranto.it":true,"te.it":true,"tempio-olbia.it":true,"tempioolbia.it":true,"teramo.it":true,"terni.it":true,"tn.it":true,"to.it":true,"torino.it":true,"tp.it":true,"tr.it":true,"trani-andria-barletta.it":true,"trani-barletta-andria.it":true,"traniandriabarletta.it":true,"tranibarlettaandria.it":true,"trapani.it":true,"trentino.it":true,"trento.it":true,"treviso.it":true,"trieste.it":true,"ts.it":true,"turin.it":true,"tv.it":true,"ud.it":true,"udine.it":true,"urbino-pesaro.it":true,"urbinopesaro.it":true,"va.it":true,"varese.it":true,"vb.it":true,"vc.it":true,"ve.it":true,"venezia.it":true,"venice.it":true,"verbania.it":true,"vercelli.it":true,"verona.it":true,"vi.it":true,"vibo-valentia.it":true,"vibovalentia.it":true,"vicenza.it":true,"viterbo.it":true,"vr.it":true,"vs.it":true,"vt.it":true,"vv.it":true,"je":true,"co.je":true,"net.je":true,"org.je":true,"*.jm":true,"jo":true,"com.jo":true,"org.jo":true,"net.jo":true,"edu.jo":true,"sch.jo":true,"gov.jo":true,"mil.jo":true,"name.jo":true,"jobs":true,"jp":true,"ac.jp":true,"ad.jp":true,"co.jp":true,"ed.jp":true,"go.jp":true,"gr.jp":true,"lg.jp":true,"ne.jp":true,"or.jp":true,"aichi.jp":true,"akita.jp":true,"aomori.jp":true,"chiba.jp":true,"ehime.jp":true,"fukui.jp":true,"fukuoka.jp":true,"fukushima.jp":true,"gifu.jp":true,"gunma.jp":true,"hiroshima.jp":true,"hokkaido.jp":true,"hyogo.jp":true,"ibaraki.jp":true,"ishikawa.jp":true,"iwate.jp":true,"kagawa.jp":true,"kagoshima.jp":true,"kanagawa.jp":true,"kochi.jp":true,"kumamoto.jp":true,"kyoto.jp":true,"mie.jp":true,"miyagi.jp":true,"miyazaki.jp":true,"nagano.jp":true,"nagasaki.jp":true,"nara.jp":true,"niigata.jp":true,"oita.jp":true,"okayama.jp":true,"okinawa.jp":true,"osaka.jp":true,"saga.jp":true,"saitama.jp":true,"shiga.jp":true,"shimane.jp":true,"shizuoka.jp":true,"tochigi.jp":true,"tokushima.jp":true,"tokyo.jp":true,"tottori.jp":true,"toyama.jp":true,"wakayama.jp":true,"yamagata.jp":true,"yamaguchi.jp":true,"yamanashi.jp":true,"xn--4pvxs.jp":true,"xn--vgu402c.jp":true,"xn--c3s14m.jp":true,"xn--f6qx53a.jp":true,"xn--8pvr4u.jp":true,"xn--uist22h.jp":true,"xn--djrs72d6uy.jp":true,"xn--mkru45i.jp":true,"xn--0trq7p7nn.jp":true,"xn--8ltr62k.jp":true,"xn--2m4a15e.jp":true,"xn--efvn9s.jp":true,"xn--32vp30h.jp":true,"xn--4it797k.jp":true,"xn--1lqs71d.jp":true,"xn--5rtp49c.jp":true,"xn--5js045d.jp":true,"xn--ehqz56n.jp":true,"xn--1lqs03n.jp":true,"xn--qqqt11m.jp":true,"xn--kbrq7o.jp":true,"xn--pssu33l.jp":true,"xn--ntsq17g.jp":true,"xn--uisz3g.jp":true,"xn--6btw5a.jp":true,"xn--1ctwo.jp":true,"xn--6orx2r.jp":true,"xn--rht61e.jp":true,"xn--rht27z.jp":true,"xn--djty4k.jp":true,"xn--nit225k.jp":true,"xn--rht3d.jp":true,"xn--klty5x.jp":true,"xn--kltx9a.jp":true,"xn--kltp7d.jp":true,"xn--uuwu58a.jp":true,"xn--zbx025d.jp":true,"xn--ntso0iqx3a.jp":true,"xn--elqq16h.jp":true,"xn--4it168d.jp":true,"xn--klt787d.jp":true,"xn--rny31h.jp":true,"xn--7t0a264c.jp":true,"xn--5rtq34k.jp":true,"xn--k7yn95e.jp":true,"xn--tor131o.jp":true,"xn--d5qv7z876c.jp":true,"*.kawasaki.jp":true,"*.kitakyushu.jp":true,"*.kobe.jp":true,"*.nagoya.jp":true,"*.sapporo.jp":true,"*.sendai.jp":true,"*.yokohama.jp":true,"city.kawasaki.jp":false,"city.kitakyushu.jp":false,"city.kobe.jp":false,"city.nagoya.jp":false,"city.sapporo.jp":false,"city.sendai.jp":false,"city.yokohama.jp":false,"aisai.aichi.jp":true,"ama.aichi.jp":true,"anjo.aichi.jp":true,"asuke.aichi.jp":true,"chiryu.aichi.jp":true,"chita.aichi.jp":true,"fuso.aichi.jp":true,"gamagori.aichi.jp":true,"handa.aichi.jp":true,"hazu.aichi.jp":true,"hekinan.aichi.jp":true,"higashiura.aichi.jp":true,"ichinomiya.aichi.jp":true,"inazawa.aichi.jp":true,"inuyama.aichi.jp":true,"isshiki.aichi.jp":true,"iwakura.aichi.jp":true,"kanie.aichi.jp":true,"kariya.aichi.jp":true,"kasugai.aichi.jp":true,"kira.aichi.jp":true,"kiyosu.aichi.jp":true,"komaki.aichi.jp":true,"konan.aichi.jp":true,"kota.aichi.jp":true,"mihama.aichi.jp":true,"miyoshi.aichi.jp":true,"nishio.aichi.jp":true,"nisshin.aichi.jp":true,"obu.aichi.jp":true,"oguchi.aichi.jp":true,"oharu.aichi.jp":true,"okazaki.aichi.jp":true,"owariasahi.aichi.jp":true,"seto.aichi.jp":true,"shikatsu.aichi.jp":true,"shinshiro.aichi.jp":true,"shitara.aichi.jp":true,"tahara.aichi.jp":true,"takahama.aichi.jp":true,"tobishima.aichi.jp":true,"toei.aichi.jp":true,"togo.aichi.jp":true,"tokai.aichi.jp":true,"tokoname.aichi.jp":true,"toyoake.aichi.jp":true,"toyohashi.aichi.jp":true,"toyokawa.aichi.jp":true,"toyone.aichi.jp":true,"toyota.aichi.jp":true,"tsushima.aichi.jp":true,"yatomi.aichi.jp":true,"akita.akita.jp":true,"daisen.akita.jp":true,"fujisato.akita.jp":true,"gojome.akita.jp":true,"hachirogata.akita.jp":true,"happou.akita.jp":true,"higashinaruse.akita.jp":true,"honjo.akita.jp":true,"honjyo.akita.jp":true,"ikawa.akita.jp":true,"kamikoani.akita.jp":true,"kamioka.akita.jp":true,"katagami.akita.jp":true,"kazuno.akita.jp":true,"kitaakita.akita.jp":true,"kosaka.akita.jp":true,"kyowa.akita.jp":true,"misato.akita.jp":true,"mitane.akita.jp":true,"moriyoshi.akita.jp":true,"nikaho.akita.jp":true,"noshiro.akita.jp":true,"odate.akita.jp":true,"oga.akita.jp":true,"ogata.akita.jp":true,"semboku.akita.jp":true,"yokote.akita.jp":true,"yurihonjo.akita.jp":true,"aomori.aomori.jp":true,"gonohe.aomori.jp":true,"hachinohe.aomori.jp":true,"hashikami.aomori.jp":true,"hiranai.aomori.jp":true,"hirosaki.aomori.jp":true,"itayanagi.aomori.jp":true,"kuroishi.aomori.jp":true,"misawa.aomori.jp":true,"mutsu.aomori.jp":true,"nakadomari.aomori.jp":true,"noheji.aomori.jp":true,"oirase.aomori.jp":true,"owani.aomori.jp":true,"rokunohe.aomori.jp":true,"sannohe.aomori.jp":true,"shichinohe.aomori.jp":true,"shingo.aomori.jp":true,"takko.aomori.jp":true,"towada.aomori.jp":true,"tsugaru.aomori.jp":true,"tsuruta.aomori.jp":true,"abiko.chiba.jp":true,"asahi.chiba.jp":true,"chonan.chiba.jp":true,"chosei.chiba.jp":true,"choshi.chiba.jp":true,"chuo.chiba.jp":true,"funabashi.chiba.jp":true,"futtsu.chiba.jp":true,"hanamigawa.chiba.jp":true,"ichihara.chiba.jp":true,"ichikawa.chiba.jp":true,"ichinomiya.chiba.jp":true,"inzai.chiba.jp":true,"isumi.chiba.jp":true,"kamagaya.chiba.jp":true,"kamogawa.chiba.jp":true,"kashiwa.chiba.jp":true,"katori.chiba.jp":true,"katsuura.chiba.jp":true,"kimitsu.chiba.jp":true,"kisarazu.chiba.jp":true,"kozaki.chiba.jp":true,"kujukuri.chiba.jp":true,"kyonan.chiba.jp":true,"matsudo.chiba.jp":true,"midori.chiba.jp":true,"mihama.chiba.jp":true,"minamiboso.chiba.jp":true,"mobara.chiba.jp":true,"mutsuzawa.chiba.jp":true,"nagara.chiba.jp":true,"nagareyama.chiba.jp":true,"narashino.chiba.jp":true,"narita.chiba.jp":true,"noda.chiba.jp":true,"oamishirasato.chiba.jp":true,"omigawa.chiba.jp":true,"onjuku.chiba.jp":true,"otaki.chiba.jp":true,"sakae.chiba.jp":true,"sakura.chiba.jp":true,"shimofusa.chiba.jp":true,"shirako.chiba.jp":true,"shiroi.chiba.jp":true,"shisui.chiba.jp":true,"sodegaura.chiba.jp":true,"sosa.chiba.jp":true,"tako.chiba.jp":true,"tateyama.chiba.jp":true,"togane.chiba.jp":true,"tohnosho.chiba.jp":true,"tomisato.chiba.jp":true,"urayasu.chiba.jp":true,"yachimata.chiba.jp":true,"yachiyo.chiba.jp":true,"yokaichiba.chiba.jp":true,"yokoshibahikari.chiba.jp":true,"yotsukaido.chiba.jp":true,"ainan.ehime.jp":true,"honai.ehime.jp":true,"ikata.ehime.jp":true,"imabari.ehime.jp":true,"iyo.ehime.jp":true,"kamijima.ehime.jp":true,"kihoku.ehime.jp":true,"kumakogen.ehime.jp":true,"masaki.ehime.jp":true,"matsuno.ehime.jp":true,"matsuyama.ehime.jp":true,"namikata.ehime.jp":true,"niihama.ehime.jp":true,"ozu.ehime.jp":true,"saijo.ehime.jp":true,"seiyo.ehime.jp":true,"shikokuchuo.ehime.jp":true,"tobe.ehime.jp":true,"toon.ehime.jp":true,"uchiko.ehime.jp":true,"uwajima.ehime.jp":true,"yawatahama.ehime.jp":true,"echizen.fukui.jp":true,"eiheiji.fukui.jp":true,"fukui.fukui.jp":true,"ikeda.fukui.jp":true,"katsuyama.fukui.jp":true,"mihama.fukui.jp":true,"minamiechizen.fukui.jp":true,"obama.fukui.jp":true,"ohi.fukui.jp":true,"ono.fukui.jp":true,"sabae.fukui.jp":true,"sakai.fukui.jp":true,"takahama.fukui.jp":true,"tsuruga.fukui.jp":true,"wakasa.fukui.jp":true,"ashiya.fukuoka.jp":true,"buzen.fukuoka.jp":true,"chikugo.fukuoka.jp":true,"chikuho.fukuoka.jp":true,"chikujo.fukuoka.jp":true,"chikushino.fukuoka.jp":true,"chikuzen.fukuoka.jp":true,"chuo.fukuoka.jp":true,"dazaifu.fukuoka.jp":true,"fukuchi.fukuoka.jp":true,"hakata.fukuoka.jp":true,"higashi.fukuoka.jp":true,"hirokawa.fukuoka.jp":true,"hisayama.fukuoka.jp":true,"iizuka.fukuoka.jp":true,"inatsuki.fukuoka.jp":true,"kaho.fukuoka.jp":true,"kasuga.fukuoka.jp":true,"kasuya.fukuoka.jp":true,"kawara.fukuoka.jp":true,"keisen.fukuoka.jp":true,"koga.fukuoka.jp":true,"kurate.fukuoka.jp":true,"kurogi.fukuoka.jp":true,"kurume.fukuoka.jp":true,"minami.fukuoka.jp":true,"miyako.fukuoka.jp":true,"miyama.fukuoka.jp":true,"miyawaka.fukuoka.jp":true,"mizumaki.fukuoka.jp":true,"munakata.fukuoka.jp":true,"nakagawa.fukuoka.jp":true,"nakama.fukuoka.jp":true,"nishi.fukuoka.jp":true,"nogata.fukuoka.jp":true,"ogori.fukuoka.jp":true,"okagaki.fukuoka.jp":true,"okawa.fukuoka.jp":true,"oki.fukuoka.jp":true,"omuta.fukuoka.jp":true,"onga.fukuoka.jp":true,"onojo.fukuoka.jp":true,"oto.fukuoka.jp":true,"saigawa.fukuoka.jp":true,"sasaguri.fukuoka.jp":true,"shingu.fukuoka.jp":true,"shinyoshitomi.fukuoka.jp":true,"shonai.fukuoka.jp":true,"soeda.fukuoka.jp":true,"sue.fukuoka.jp":true,"tachiarai.fukuoka.jp":true,"tagawa.fukuoka.jp":true,"takata.fukuoka.jp":true,"toho.fukuoka.jp":true,"toyotsu.fukuoka.jp":true,"tsuiki.fukuoka.jp":true,"ukiha.fukuoka.jp":true,"umi.fukuoka.jp":true,"usui.fukuoka.jp":true,"yamada.fukuoka.jp":true,"yame.fukuoka.jp":true,"yanagawa.fukuoka.jp":true,"yukuhashi.fukuoka.jp":true,"aizubange.fukushima.jp":true,"aizumisato.fukushima.jp":true,"aizuwakamatsu.fukushima.jp":true,"asakawa.fukushima.jp":true,"bandai.fukushima.jp":true,"date.fukushima.jp":true,"fukushima.fukushima.jp":true,"furudono.fukushima.jp":true,"futaba.fukushima.jp":true,"hanawa.fukushima.jp":true,"higashi.fukushima.jp":true,"hirata.fukushima.jp":true,"hirono.fukushima.jp":true,"iitate.fukushima.jp":true,"inawashiro.fukushima.jp":true,"ishikawa.fukushima.jp":true,"iwaki.fukushima.jp":true,"izumizaki.fukushima.jp":true,"kagamiishi.fukushima.jp":true,"kaneyama.fukushima.jp":true,"kawamata.fukushima.jp":true,"kitakata.fukushima.jp":true,"kitashiobara.fukushima.jp":true,"koori.fukushima.jp":true,"koriyama.fukushima.jp":true,"kunimi.fukushima.jp":true,"miharu.fukushima.jp":true,"mishima.fukushima.jp":true,"namie.fukushima.jp":true,"nango.fukushima.jp":true,"nishiaizu.fukushima.jp":true,"nishigo.fukushima.jp":true,"okuma.fukushima.jp":true,"omotego.fukushima.jp":true,"ono.fukushima.jp":true,"otama.fukushima.jp":true,"samegawa.fukushima.jp":true,"shimogo.fukushima.jp":true,"shirakawa.fukushima.jp":true,"showa.fukushima.jp":true,"soma.fukushima.jp":true,"sukagawa.fukushima.jp":true,"taishin.fukushima.jp":true,"tamakawa.fukushima.jp":true,"tanagura.fukushima.jp":true,"tenei.fukushima.jp":true,"yabuki.fukushima.jp":true,"yamato.fukushima.jp":true,"yamatsuri.fukushima.jp":true,"yanaizu.fukushima.jp":true,"yugawa.fukushima.jp":true,"anpachi.gifu.jp":true,"ena.gifu.jp":true,"gifu.gifu.jp":true,"ginan.gifu.jp":true,"godo.gifu.jp":true,"gujo.gifu.jp":true,"hashima.gifu.jp":true,"hichiso.gifu.jp":true,"hida.gifu.jp":true,"higashishirakawa.gifu.jp":true,"ibigawa.gifu.jp":true,"ikeda.gifu.jp":true,"kakamigahara.gifu.jp":true,"kani.gifu.jp":true,"kasahara.gifu.jp":true,"kasamatsu.gifu.jp":true,"kawaue.gifu.jp":true,"kitagata.gifu.jp":true,"mino.gifu.jp":true,"minokamo.gifu.jp":true,"mitake.gifu.jp":true,"mizunami.gifu.jp":true,"motosu.gifu.jp":true,"nakatsugawa.gifu.jp":true,"ogaki.gifu.jp":true,"sakahogi.gifu.jp":true,"seki.gifu.jp":true,"sekigahara.gifu.jp":true,"shirakawa.gifu.jp":true,"tajimi.gifu.jp":true,"takayama.gifu.jp":true,"tarui.gifu.jp":true,"toki.gifu.jp":true,"tomika.gifu.jp":true,"wanouchi.gifu.jp":true,"yamagata.gifu.jp":true,"yaotsu.gifu.jp":true,"yoro.gifu.jp":true,"annaka.gunma.jp":true,"chiyoda.gunma.jp":true,"fujioka.gunma.jp":true,"higashiagatsuma.gunma.jp":true,"isesaki.gunma.jp":true,"itakura.gunma.jp":true,"kanna.gunma.jp":true,"kanra.gunma.jp":true,"katashina.gunma.jp":true,"kawaba.gunma.jp":true,"kiryu.gunma.jp":true,"kusatsu.gunma.jp":true,"maebashi.gunma.jp":true,"meiwa.gunma.jp":true,"midori.gunma.jp":true,"minakami.gunma.jp":true,"naganohara.gunma.jp":true,"nakanojo.gunma.jp":true,"nanmoku.gunma.jp":true,"numata.gunma.jp":true,"oizumi.gunma.jp":true,"ora.gunma.jp":true,"ota.gunma.jp":true,"shibukawa.gunma.jp":true,"shimonita.gunma.jp":true,"shinto.gunma.jp":true,"showa.gunma.jp":true,"takasaki.gunma.jp":true,"takayama.gunma.jp":true,"tamamura.gunma.jp":true,"tatebayashi.gunma.jp":true,"tomioka.gunma.jp":true,"tsukiyono.gunma.jp":true,"tsumagoi.gunma.jp":true,"ueno.gunma.jp":true,"yoshioka.gunma.jp":true,"asaminami.hiroshima.jp":true,"daiwa.hiroshima.jp":true,"etajima.hiroshima.jp":true,"fuchu.hiroshima.jp":true,"fukuyama.hiroshima.jp":true,"hatsukaichi.hiroshima.jp":true,"higashihiroshima.hiroshima.jp":true,"hongo.hiroshima.jp":true,"jinsekikogen.hiroshima.jp":true,"kaita.hiroshima.jp":true,"kui.hiroshima.jp":true,"kumano.hiroshima.jp":true,"kure.hiroshima.jp":true,"mihara.hiroshima.jp":true,"miyoshi.hiroshima.jp":true,"naka.hiroshima.jp":true,"onomichi.hiroshima.jp":true,"osakikamijima.hiroshima.jp":true,"otake.hiroshima.jp":true,"saka.hiroshima.jp":true,"sera.hiroshima.jp":true,"seranishi.hiroshima.jp":true,"shinichi.hiroshima.jp":true,"shobara.hiroshima.jp":true,"takehara.hiroshima.jp":true,"abashiri.hokkaido.jp":true,"abira.hokkaido.jp":true,"aibetsu.hokkaido.jp":true,"akabira.hokkaido.jp":true,"akkeshi.hokkaido.jp":true,"asahikawa.hokkaido.jp":true,"ashibetsu.hokkaido.jp":true,"ashoro.hokkaido.jp":true,"assabu.hokkaido.jp":true,"atsuma.hokkaido.jp":true,"bibai.hokkaido.jp":true,"biei.hokkaido.jp":true,"bifuka.hokkaido.jp":true,"bihoro.hokkaido.jp":true,"biratori.hokkaido.jp":true,"chippubetsu.hokkaido.jp":true,"chitose.hokkaido.jp":true,"date.hokkaido.jp":true,"ebetsu.hokkaido.jp":true,"embetsu.hokkaido.jp":true,"eniwa.hokkaido.jp":true,"erimo.hokkaido.jp":true,"esan.hokkaido.jp":true,"esashi.hokkaido.jp":true,"fukagawa.hokkaido.jp":true,"fukushima.hokkaido.jp":true,"furano.hokkaido.jp":true,"furubira.hokkaido.jp":true,"haboro.hokkaido.jp":true,"hakodate.hokkaido.jp":true,"hamatonbetsu.hokkaido.jp":true,"hidaka.hokkaido.jp":true,"higashikagura.hokkaido.jp":true,"higashikawa.hokkaido.jp":true,"hiroo.hokkaido.jp":true,"hokuryu.hokkaido.jp":true,"hokuto.hokkaido.jp":true,"honbetsu.hokkaido.jp":true,"horokanai.hokkaido.jp":true,"horonobe.hokkaido.jp":true,"ikeda.hokkaido.jp":true,"imakane.hokkaido.jp":true,"ishikari.hokkaido.jp":true,"iwamizawa.hokkaido.jp":true,"iwanai.hokkaido.jp":true,"kamifurano.hokkaido.jp":true,"kamikawa.hokkaido.jp":true,"kamishihoro.hokkaido.jp":true,"kamisunagawa.hokkaido.jp":true,"kamoenai.hokkaido.jp":true,"kayabe.hokkaido.jp":true,"kembuchi.hokkaido.jp":true,"kikonai.hokkaido.jp":true,"kimobetsu.hokkaido.jp":true,"kitahiroshima.hokkaido.jp":true,"kitami.hokkaido.jp":true,"kiyosato.hokkaido.jp":true,"koshimizu.hokkaido.jp":true,"kunneppu.hokkaido.jp":true,"kuriyama.hokkaido.jp":true,"kuromatsunai.hokkaido.jp":true,"kushiro.hokkaido.jp":true,"kutchan.hokkaido.jp":true,"kyowa.hokkaido.jp":true,"mashike.hokkaido.jp":true,"matsumae.hokkaido.jp":true,"mikasa.hokkaido.jp":true,"minamifurano.hokkaido.jp":true,"mombetsu.hokkaido.jp":true,"moseushi.hokkaido.jp":true,"mukawa.hokkaido.jp":true,"muroran.hokkaido.jp":true,"naie.hokkaido.jp":true,"nakagawa.hokkaido.jp":true,"nakasatsunai.hokkaido.jp":true,"nakatombetsu.hokkaido.jp":true,"nanae.hokkaido.jp":true,"nanporo.hokkaido.jp":true,"nayoro.hokkaido.jp":true,"nemuro.hokkaido.jp":true,"niikappu.hokkaido.jp":true,"niki.hokkaido.jp":true,"nishiokoppe.hokkaido.jp":true,"noboribetsu.hokkaido.jp":true,"numata.hokkaido.jp":true,"obihiro.hokkaido.jp":true,"obira.hokkaido.jp":true,"oketo.hokkaido.jp":true,"okoppe.hokkaido.jp":true,"otaru.hokkaido.jp":true,"otobe.hokkaido.jp":true,"otofuke.hokkaido.jp":true,"otoineppu.hokkaido.jp":true,"oumu.hokkaido.jp":true,"ozora.hokkaido.jp":true,"pippu.hokkaido.jp":true,"rankoshi.hokkaido.jp":true,"rebun.hokkaido.jp":true,"rikubetsu.hokkaido.jp":true,"rishiri.hokkaido.jp":true,"rishirifuji.hokkaido.jp":true,"saroma.hokkaido.jp":true,"sarufutsu.hokkaido.jp":true,"shakotan.hokkaido.jp":true,"shari.hokkaido.jp":true,"shibecha.hokkaido.jp":true,"shibetsu.hokkaido.jp":true,"shikabe.hokkaido.jp":true,"shikaoi.hokkaido.jp":true,"shimamaki.hokkaido.jp":true,"shimizu.hokkaido.jp":true,"shimokawa.hokkaido.jp":true,"shinshinotsu.hokkaido.jp":true,"shintoku.hokkaido.jp":true,"shiranuka.hokkaido.jp":true,"shiraoi.hokkaido.jp":true,"shiriuchi.hokkaido.jp":true,"sobetsu.hokkaido.jp":true,"sunagawa.hokkaido.jp":true,"taiki.hokkaido.jp":true,"takasu.hokkaido.jp":true,"takikawa.hokkaido.jp":true,"takinoue.hokkaido.jp":true,"teshikaga.hokkaido.jp":true,"tobetsu.hokkaido.jp":true,"tohma.hokkaido.jp":true,"tomakomai.hokkaido.jp":true,"tomari.hokkaido.jp":true,"toya.hokkaido.jp":true,"toyako.hokkaido.jp":true,"toyotomi.hokkaido.jp":true,"toyoura.hokkaido.jp":true,"tsubetsu.hokkaido.jp":true,"tsukigata.hokkaido.jp":true,"urakawa.hokkaido.jp":true,"urausu.hokkaido.jp":true,"uryu.hokkaido.jp":true,"utashinai.hokkaido.jp":true,"wakkanai.hokkaido.jp":true,"wassamu.hokkaido.jp":true,"yakumo.hokkaido.jp":true,"yoichi.hokkaido.jp":true,"aioi.hyogo.jp":true,"akashi.hyogo.jp":true,"ako.hyogo.jp":true,"amagasaki.hyogo.jp":true,"aogaki.hyogo.jp":true,"asago.hyogo.jp":true,"ashiya.hyogo.jp":true,"awaji.hyogo.jp":true,"fukusaki.hyogo.jp":true,"goshiki.hyogo.jp":true,"harima.hyogo.jp":true,"himeji.hyogo.jp":true,"ichikawa.hyogo.jp":true,"inagawa.hyogo.jp":true,"itami.hyogo.jp":true,"kakogawa.hyogo.jp":true,"kamigori.hyogo.jp":true,"kamikawa.hyogo.jp":true,"kasai.hyogo.jp":true,"kasuga.hyogo.jp":true,"kawanishi.hyogo.jp":true,"miki.hyogo.jp":true,"minamiawaji.hyogo.jp":true,"nishinomiya.hyogo.jp":true,"nishiwaki.hyogo.jp":true,"ono.hyogo.jp":true,"sanda.hyogo.jp":true,"sannan.hyogo.jp":true,"sasayama.hyogo.jp":true,"sayo.hyogo.jp":true,"shingu.hyogo.jp":true,"shinonsen.hyogo.jp":true,"shiso.hyogo.jp":true,"sumoto.hyogo.jp":true,"taishi.hyogo.jp":true,"taka.hyogo.jp":true,"takarazuka.hyogo.jp":true,"takasago.hyogo.jp":true,"takino.hyogo.jp":true,"tamba.hyogo.jp":true,"tatsuno.hyogo.jp":true,"toyooka.hyogo.jp":true,"yabu.hyogo.jp":true,"yashiro.hyogo.jp":true,"yoka.hyogo.jp":true,"yokawa.hyogo.jp":true,"ami.ibaraki.jp":true,"asahi.ibaraki.jp":true,"bando.ibaraki.jp":true,"chikusei.ibaraki.jp":true,"daigo.ibaraki.jp":true,"fujishiro.ibaraki.jp":true,"hitachi.ibaraki.jp":true,"hitachinaka.ibaraki.jp":true,"hitachiomiya.ibaraki.jp":true,"hitachiota.ibaraki.jp":true,"ibaraki.ibaraki.jp":true,"ina.ibaraki.jp":true,"inashiki.ibaraki.jp":true,"itako.ibaraki.jp":true,"iwama.ibaraki.jp":true,"joso.ibaraki.jp":true,"kamisu.ibaraki.jp":true,"kasama.ibaraki.jp":true,"kashima.ibaraki.jp":true,"kasumigaura.ibaraki.jp":true,"koga.ibaraki.jp":true,"miho.ibaraki.jp":true,"mito.ibaraki.jp":true,"moriya.ibaraki.jp":true,"naka.ibaraki.jp":true,"namegata.ibaraki.jp":true,"oarai.ibaraki.jp":true,"ogawa.ibaraki.jp":true,"omitama.ibaraki.jp":true,"ryugasaki.ibaraki.jp":true,"sakai.ibaraki.jp":true,"sakuragawa.ibaraki.jp":true,"shimodate.ibaraki.jp":true,"shimotsuma.ibaraki.jp":true,"shirosato.ibaraki.jp":true,"sowa.ibaraki.jp":true,"suifu.ibaraki.jp":true,"takahagi.ibaraki.jp":true,"tamatsukuri.ibaraki.jp":true,"tokai.ibaraki.jp":true,"tomobe.ibaraki.jp":true,"tone.ibaraki.jp":true,"toride.ibaraki.jp":true,"tsuchiura.ibaraki.jp":true,"tsukuba.ibaraki.jp":true,"uchihara.ibaraki.jp":true,"ushiku.ibaraki.jp":true,"yachiyo.ibaraki.jp":true,"yamagata.ibaraki.jp":true,"yawara.ibaraki.jp":true,"yuki.ibaraki.jp":true,"anamizu.ishikawa.jp":true,"hakui.ishikawa.jp":true,"hakusan.ishikawa.jp":true,"kaga.ishikawa.jp":true,"kahoku.ishikawa.jp":true,"kanazawa.ishikawa.jp":true,"kawakita.ishikawa.jp":true,"komatsu.ishikawa.jp":true,"nakanoto.ishikawa.jp":true,"nanao.ishikawa.jp":true,"nomi.ishikawa.jp":true,"nonoichi.ishikawa.jp":true,"noto.ishikawa.jp":true,"shika.ishikawa.jp":true,"suzu.ishikawa.jp":true,"tsubata.ishikawa.jp":true,"tsurugi.ishikawa.jp":true,"uchinada.ishikawa.jp":true,"wajima.ishikawa.jp":true,"fudai.iwate.jp":true,"fujisawa.iwate.jp":true,"hanamaki.iwate.jp":true,"hiraizumi.iwate.jp":true,"hirono.iwate.jp":true,"ichinohe.iwate.jp":true,"ichinoseki.iwate.jp":true,"iwaizumi.iwate.jp":true,"iwate.iwate.jp":true,"joboji.iwate.jp":true,"kamaishi.iwate.jp":true,"kanegasaki.iwate.jp":true,"karumai.iwate.jp":true,"kawai.iwate.jp":true,"kitakami.iwate.jp":true,"kuji.iwate.jp":true,"kunohe.iwate.jp":true,"kuzumaki.iwate.jp":true,"miyako.iwate.jp":true,"mizusawa.iwate.jp":true,"morioka.iwate.jp":true,"ninohe.iwate.jp":true,"noda.iwate.jp":true,"ofunato.iwate.jp":true,"oshu.iwate.jp":true,"otsuchi.iwate.jp":true,"rikuzentakata.iwate.jp":true,"shiwa.iwate.jp":true,"shizukuishi.iwate.jp":true,"sumita.iwate.jp":true,"tanohata.iwate.jp":true,"tono.iwate.jp":true,"yahaba.iwate.jp":true,"yamada.iwate.jp":true,"ayagawa.kagawa.jp":true,"higashikagawa.kagawa.jp":true,"kanonji.kagawa.jp":true,"kotohira.kagawa.jp":true,"manno.kagawa.jp":true,"marugame.kagawa.jp":true,"mitoyo.kagawa.jp":true,"naoshima.kagawa.jp":true,"sanuki.kagawa.jp":true,"tadotsu.kagawa.jp":true,"takamatsu.kagawa.jp":true,"tonosho.kagawa.jp":true,"uchinomi.kagawa.jp":true,"utazu.kagawa.jp":true,"zentsuji.kagawa.jp":true,"akune.kagoshima.jp":true,"amami.kagoshima.jp":true,"hioki.kagoshima.jp":true,"isa.kagoshima.jp":true,"isen.kagoshima.jp":true,"izumi.kagoshima.jp":true,"kagoshima.kagoshima.jp":true,"kanoya.kagoshima.jp":true,"kawanabe.kagoshima.jp":true,"kinko.kagoshima.jp":true,"kouyama.kagoshima.jp":true,"makurazaki.kagoshima.jp":true,"matsumoto.kagoshima.jp":true,"minamitane.kagoshima.jp":true,"nakatane.kagoshima.jp":true,"nishinoomote.kagoshima.jp":true,"satsumasendai.kagoshima.jp":true,"soo.kagoshima.jp":true,"tarumizu.kagoshima.jp":true,"yusui.kagoshima.jp":true,"aikawa.kanagawa.jp":true,"atsugi.kanagawa.jp":true,"ayase.kanagawa.jp":true,"chigasaki.kanagawa.jp":true,"ebina.kanagawa.jp":true,"fujisawa.kanagawa.jp":true,"hadano.kanagawa.jp":true,"hakone.kanagawa.jp":true,"hiratsuka.kanagawa.jp":true,"isehara.kanagawa.jp":true,"kaisei.kanagawa.jp":true,"kamakura.kanagawa.jp":true,"kiyokawa.kanagawa.jp":true,"matsuda.kanagawa.jp":true,"minamiashigara.kanagawa.jp":true,"miura.kanagawa.jp":true,"nakai.kanagawa.jp":true,"ninomiya.kanagawa.jp":true,"odawara.kanagawa.jp":true,"oi.kanagawa.jp":true,"oiso.kanagawa.jp":true,"sagamihara.kanagawa.jp":true,"samukawa.kanagawa.jp":true,"tsukui.kanagawa.jp":true,"yamakita.kanagawa.jp":true,"yamato.kanagawa.jp":true,"yokosuka.kanagawa.jp":true,"yugawara.kanagawa.jp":true,"zama.kanagawa.jp":true,"zushi.kanagawa.jp":true,"aki.kochi.jp":true,"geisei.kochi.jp":true,"hidaka.kochi.jp":true,"higashitsuno.kochi.jp":true,"ino.kochi.jp":true,"kagami.kochi.jp":true,"kami.kochi.jp":true,"kitagawa.kochi.jp":true,"kochi.kochi.jp":true,"mihara.kochi.jp":true,"motoyama.kochi.jp":true,"muroto.kochi.jp":true,"nahari.kochi.jp":true,"nakamura.kochi.jp":true,"nankoku.kochi.jp":true,"nishitosa.kochi.jp":true,"niyodogawa.kochi.jp":true,"ochi.kochi.jp":true,"okawa.kochi.jp":true,"otoyo.kochi.jp":true,"otsuki.kochi.jp":true,"sakawa.kochi.jp":true,"sukumo.kochi.jp":true,"susaki.kochi.jp":true,"tosa.kochi.jp":true,"tosashimizu.kochi.jp":true,"toyo.kochi.jp":true,"tsuno.kochi.jp":true,"umaji.kochi.jp":true,"yasuda.kochi.jp":true,"yusuhara.kochi.jp":true,"amakusa.kumamoto.jp":true,"arao.kumamoto.jp":true,"aso.kumamoto.jp":true,"choyo.kumamoto.jp":true,"gyokuto.kumamoto.jp":true,"kamiamakusa.kumamoto.jp":true,"kikuchi.kumamoto.jp":true,"kumamoto.kumamoto.jp":true,"mashiki.kumamoto.jp":true,"mifune.kumamoto.jp":true,"minamata.kumamoto.jp":true,"minamioguni.kumamoto.jp":true,"nagasu.kumamoto.jp":true,"nishihara.kumamoto.jp":true,"oguni.kumamoto.jp":true,"ozu.kumamoto.jp":true,"sumoto.kumamoto.jp":true,"takamori.kumamoto.jp":true,"uki.kumamoto.jp":true,"uto.kumamoto.jp":true,"yamaga.kumamoto.jp":true,"yamato.kumamoto.jp":true,"yatsushiro.kumamoto.jp":true,"ayabe.kyoto.jp":true,"fukuchiyama.kyoto.jp":true,"higashiyama.kyoto.jp":true,"ide.kyoto.jp":true,"ine.kyoto.jp":true,"joyo.kyoto.jp":true,"kameoka.kyoto.jp":true,"kamo.kyoto.jp":true,"kita.kyoto.jp":true,"kizu.kyoto.jp":true,"kumiyama.kyoto.jp":true,"kyotamba.kyoto.jp":true,"kyotanabe.kyoto.jp":true,"kyotango.kyoto.jp":true,"maizuru.kyoto.jp":true,"minami.kyoto.jp":true,"minamiyamashiro.kyoto.jp":true,"miyazu.kyoto.jp":true,"muko.kyoto.jp":true,"nagaokakyo.kyoto.jp":true,"nakagyo.kyoto.jp":true,"nantan.kyoto.jp":true,"oyamazaki.kyoto.jp":true,"sakyo.kyoto.jp":true,"seika.kyoto.jp":true,"tanabe.kyoto.jp":true,"uji.kyoto.jp":true,"ujitawara.kyoto.jp":true,"wazuka.kyoto.jp":true,"yamashina.kyoto.jp":true,"yawata.kyoto.jp":true,"asahi.mie.jp":true,"inabe.mie.jp":true,"ise.mie.jp":true,"kameyama.mie.jp":true,"kawagoe.mie.jp":true,"kiho.mie.jp":true,"kisosaki.mie.jp":true,"kiwa.mie.jp":true,"komono.mie.jp":true,"kumano.mie.jp":true,"kuwana.mie.jp":true,"matsusaka.mie.jp":true,"meiwa.mie.jp":true,"mihama.mie.jp":true,"minamiise.mie.jp":true,"misugi.mie.jp":true,"miyama.mie.jp":true,"nabari.mie.jp":true,"shima.mie.jp":true,"suzuka.mie.jp":true,"tado.mie.jp":true,"taiki.mie.jp":true,"taki.mie.jp":true,"tamaki.mie.jp":true,"toba.mie.jp":true,"tsu.mie.jp":true,"udono.mie.jp":true,"ureshino.mie.jp":true,"watarai.mie.jp":true,"yokkaichi.mie.jp":true,"furukawa.miyagi.jp":true,"higashimatsushima.miyagi.jp":true,"ishinomaki.miyagi.jp":true,"iwanuma.miyagi.jp":true,"kakuda.miyagi.jp":true,"kami.miyagi.jp":true,"kawasaki.miyagi.jp":true,"marumori.miyagi.jp":true,"matsushima.miyagi.jp":true,"minamisanriku.miyagi.jp":true,"misato.miyagi.jp":true,"murata.miyagi.jp":true,"natori.miyagi.jp":true,"ogawara.miyagi.jp":true,"ohira.miyagi.jp":true,"onagawa.miyagi.jp":true,"osaki.miyagi.jp":true,"rifu.miyagi.jp":true,"semine.miyagi.jp":true,"shibata.miyagi.jp":true,"shichikashuku.miyagi.jp":true,"shikama.miyagi.jp":true,"shiogama.miyagi.jp":true,"shiroishi.miyagi.jp":true,"tagajo.miyagi.jp":true,"taiwa.miyagi.jp":true,"tome.miyagi.jp":true,"tomiya.miyagi.jp":true,"wakuya.miyagi.jp":true,"watari.miyagi.jp":true,"yamamoto.miyagi.jp":true,"zao.miyagi.jp":true,"aya.miyazaki.jp":true,"ebino.miyazaki.jp":true,"gokase.miyazaki.jp":true,"hyuga.miyazaki.jp":true,"kadogawa.miyazaki.jp":true,"kawaminami.miyazaki.jp":true,"kijo.miyazaki.jp":true,"kitagawa.miyazaki.jp":true,"kitakata.miyazaki.jp":true,"kitaura.miyazaki.jp":true,"kobayashi.miyazaki.jp":true,"kunitomi.miyazaki.jp":true,"kushima.miyazaki.jp":true,"mimata.miyazaki.jp":true,"miyakonojo.miyazaki.jp":true,"miyazaki.miyazaki.jp":true,"morotsuka.miyazaki.jp":true,"nichinan.miyazaki.jp":true,"nishimera.miyazaki.jp":true,"nobeoka.miyazaki.jp":true,"saito.miyazaki.jp":true,"shiiba.miyazaki.jp":true,"shintomi.miyazaki.jp":true,"takaharu.miyazaki.jp":true,"takanabe.miyazaki.jp":true,"takazaki.miyazaki.jp":true,"tsuno.miyazaki.jp":true,"achi.nagano.jp":true,"agematsu.nagano.jp":true,"anan.nagano.jp":true,"aoki.nagano.jp":true,"asahi.nagano.jp":true,"azumino.nagano.jp":true,"chikuhoku.nagano.jp":true,"chikuma.nagano.jp":true,"chino.nagano.jp":true,"fujimi.nagano.jp":true,"hakuba.nagano.jp":true,"hara.nagano.jp":true,"hiraya.nagano.jp":true,"iida.nagano.jp":true,"iijima.nagano.jp":true,"iiyama.nagano.jp":true,"iizuna.nagano.jp":true,"ikeda.nagano.jp":true,"ikusaka.nagano.jp":true,"ina.nagano.jp":true,"karuizawa.nagano.jp":true,"kawakami.nagano.jp":true,"kiso.nagano.jp":true,"kisofukushima.nagano.jp":true,"kitaaiki.nagano.jp":true,"komagane.nagano.jp":true,"komoro.nagano.jp":true,"matsukawa.nagano.jp":true,"matsumoto.nagano.jp":true,"miasa.nagano.jp":true,"minamiaiki.nagano.jp":true,"minamimaki.nagano.jp":true,"minamiminowa.nagano.jp":true,"minowa.nagano.jp":true,"miyada.nagano.jp":true,"miyota.nagano.jp":true,"mochizuki.nagano.jp":true,"nagano.nagano.jp":true,"nagawa.nagano.jp":true,"nagiso.nagano.jp":true,"nakagawa.nagano.jp":true,"nakano.nagano.jp":true,"nozawaonsen.nagano.jp":true,"obuse.nagano.jp":true,"ogawa.nagano.jp":true,"okaya.nagano.jp":true,"omachi.nagano.jp":true,"omi.nagano.jp":true,"ookuwa.nagano.jp":true,"ooshika.nagano.jp":true,"otaki.nagano.jp":true,"otari.nagano.jp":true,"sakae.nagano.jp":true,"sakaki.nagano.jp":true,"saku.nagano.jp":true,"sakuho.nagano.jp":true,"shimosuwa.nagano.jp":true,"shinanomachi.nagano.jp":true,"shiojiri.nagano.jp":true,"suwa.nagano.jp":true,"suzaka.nagano.jp":true,"takagi.nagano.jp":true,"takamori.nagano.jp":true,"takayama.nagano.jp":true,"tateshina.nagano.jp":true,"tatsuno.nagano.jp":true,"togakushi.nagano.jp":true,"togura.nagano.jp":true,"tomi.nagano.jp":true,"ueda.nagano.jp":true,"wada.nagano.jp":true,"yamagata.nagano.jp":true,"yamanouchi.nagano.jp":true,"yasaka.nagano.jp":true,"yasuoka.nagano.jp":true,"chijiwa.nagasaki.jp":true,"futsu.nagasaki.jp":true,"goto.nagasaki.jp":true,"hasami.nagasaki.jp":true,"hirado.nagasaki.jp":true,"iki.nagasaki.jp":true,"isahaya.nagasaki.jp":true,"kawatana.nagasaki.jp":true,"kuchinotsu.nagasaki.jp":true,"matsuura.nagasaki.jp":true,"nagasaki.nagasaki.jp":true,"obama.nagasaki.jp":true,"omura.nagasaki.jp":true,"oseto.nagasaki.jp":true,"saikai.nagasaki.jp":true,"sasebo.nagasaki.jp":true,"seihi.nagasaki.jp":true,"shimabara.nagasaki.jp":true,"shinkamigoto.nagasaki.jp":true,"togitsu.nagasaki.jp":true,"tsushima.nagasaki.jp":true,"unzen.nagasaki.jp":true,"ando.nara.jp":true,"gose.nara.jp":true,"heguri.nara.jp":true,"higashiyoshino.nara.jp":true,"ikaruga.nara.jp":true,"ikoma.nara.jp":true,"kamikitayama.nara.jp":true,"kanmaki.nara.jp":true,"kashiba.nara.jp":true,"kashihara.nara.jp":true,"katsuragi.nara.jp":true,"kawai.nara.jp":true,"kawakami.nara.jp":true,"kawanishi.nara.jp":true,"koryo.nara.jp":true,"kurotaki.nara.jp":true,"mitsue.nara.jp":true,"miyake.nara.jp":true,"nara.nara.jp":true,"nosegawa.nara.jp":true,"oji.nara.jp":true,"ouda.nara.jp":true,"oyodo.nara.jp":true,"sakurai.nara.jp":true,"sango.nara.jp":true,"shimoichi.nara.jp":true,"shimokitayama.nara.jp":true,"shinjo.nara.jp":true,"soni.nara.jp":true,"takatori.nara.jp":true,"tawaramoto.nara.jp":true,"tenkawa.nara.jp":true,"tenri.nara.jp":true,"uda.nara.jp":true,"yamatokoriyama.nara.jp":true,"yamatotakada.nara.jp":true,"yamazoe.nara.jp":true,"yoshino.nara.jp":true,"aga.niigata.jp":true,"agano.niigata.jp":true,"gosen.niigata.jp":true,"itoigawa.niigata.jp":true,"izumozaki.niigata.jp":true,"joetsu.niigata.jp":true,"kamo.niigata.jp":true,"kariwa.niigata.jp":true,"kashiwazaki.niigata.jp":true,"minamiuonuma.niigata.jp":true,"mitsuke.niigata.jp":true,"muika.niigata.jp":true,"murakami.niigata.jp":true,"myoko.niigata.jp":true,"nagaoka.niigata.jp":true,"niigata.niigata.jp":true,"ojiya.niigata.jp":true,"omi.niigata.jp":true,"sado.niigata.jp":true,"sanjo.niigata.jp":true,"seiro.niigata.jp":true,"seirou.niigata.jp":true,"sekikawa.niigata.jp":true,"shibata.niigata.jp":true,"tagami.niigata.jp":true,"tainai.niigata.jp":true,"tochio.niigata.jp":true,"tokamachi.niigata.jp":true,"tsubame.niigata.jp":true,"tsunan.niigata.jp":true,"uonuma.niigata.jp":true,"yahiko.niigata.jp":true,"yoita.niigata.jp":true,"yuzawa.niigata.jp":true,"beppu.oita.jp":true,"bungoono.oita.jp":true,"bungotakada.oita.jp":true,"hasama.oita.jp":true,"hiji.oita.jp":true,"himeshima.oita.jp":true,"hita.oita.jp":true,"kamitsue.oita.jp":true,"kokonoe.oita.jp":true,"kuju.oita.jp":true,"kunisaki.oita.jp":true,"kusu.oita.jp":true,"oita.oita.jp":true,"saiki.oita.jp":true,"taketa.oita.jp":true,"tsukumi.oita.jp":true,"usa.oita.jp":true,"usuki.oita.jp":true,"yufu.oita.jp":true,"akaiwa.okayama.jp":true,"asakuchi.okayama.jp":true,"bizen.okayama.jp":true,"hayashima.okayama.jp":true,"ibara.okayama.jp":true,"kagamino.okayama.jp":true,"kasaoka.okayama.jp":true,"kibichuo.okayama.jp":true,"kumenan.okayama.jp":true,"kurashiki.okayama.jp":true,"maniwa.okayama.jp":true,"misaki.okayama.jp":true,"nagi.okayama.jp":true,"niimi.okayama.jp":true,"nishiawakura.okayama.jp":true,"okayama.okayama.jp":true,"satosho.okayama.jp":true,"setouchi.okayama.jp":true,"shinjo.okayama.jp":true,"shoo.okayama.jp":true,"soja.okayama.jp":true,"takahashi.okayama.jp":true,"tamano.okayama.jp":true,"tsuyama.okayama.jp":true,"wake.okayama.jp":true,"yakage.okayama.jp":true,"aguni.okinawa.jp":true,"ginowan.okinawa.jp":true,"ginoza.okinawa.jp":true,"gushikami.okinawa.jp":true,"haebaru.okinawa.jp":true,"higashi.okinawa.jp":true,"hirara.okinawa.jp":true,"iheya.okinawa.jp":true,"ishigaki.okinawa.jp":true,"ishikawa.okinawa.jp":true,"itoman.okinawa.jp":true,"izena.okinawa.jp":true,"kadena.okinawa.jp":true,"kin.okinawa.jp":true,"kitadaito.okinawa.jp":true,"kitanakagusuku.okinawa.jp":true,"kumejima.okinawa.jp":true,"kunigami.okinawa.jp":true,"minamidaito.okinawa.jp":true,"motobu.okinawa.jp":true,"nago.okinawa.jp":true,"naha.okinawa.jp":true,"nakagusuku.okinawa.jp":true,"nakijin.okinawa.jp":true,"nanjo.okinawa.jp":true,"nishihara.okinawa.jp":true,"ogimi.okinawa.jp":true,"okinawa.okinawa.jp":true,"onna.okinawa.jp":true,"shimoji.okinawa.jp":true,"taketomi.okinawa.jp":true,"tarama.okinawa.jp":true,"tokashiki.okinawa.jp":true,"tomigusuku.okinawa.jp":true,"tonaki.okinawa.jp":true,"urasoe.okinawa.jp":true,"uruma.okinawa.jp":true,"yaese.okinawa.jp":true,"yomitan.okinawa.jp":true,"yonabaru.okinawa.jp":true,"yonaguni.okinawa.jp":true,"zamami.okinawa.jp":true,"abeno.osaka.jp":true,"chihayaakasaka.osaka.jp":true,"chuo.osaka.jp":true,"daito.osaka.jp":true,"fujiidera.osaka.jp":true,"habikino.osaka.jp":true,"hannan.osaka.jp":true,"higashiosaka.osaka.jp":true,"higashisumiyoshi.osaka.jp":true,"higashiyodogawa.osaka.jp":true,"hirakata.osaka.jp":true,"ibaraki.osaka.jp":true,"ikeda.osaka.jp":true,"izumi.osaka.jp":true,"izumiotsu.osaka.jp":true,"izumisano.osaka.jp":true,"kadoma.osaka.jp":true,"kaizuka.osaka.jp":true,"kanan.osaka.jp":true,"kashiwara.osaka.jp":true,"katano.osaka.jp":true,"kawachinagano.osaka.jp":true,"kishiwada.osaka.jp":true,"kita.osaka.jp":true,"kumatori.osaka.jp":true,"matsubara.osaka.jp":true,"minato.osaka.jp":true,"minoh.osaka.jp":true,"misaki.osaka.jp":true,"moriguchi.osaka.jp":true,"neyagawa.osaka.jp":true,"nishi.osaka.jp":true,"nose.osaka.jp":true,"osakasayama.osaka.jp":true,"sakai.osaka.jp":true,"sayama.osaka.jp":true,"sennan.osaka.jp":true,"settsu.osaka.jp":true,"shijonawate.osaka.jp":true,"shimamoto.osaka.jp":true,"suita.osaka.jp":true,"tadaoka.osaka.jp":true,"taishi.osaka.jp":true,"tajiri.osaka.jp":true,"takaishi.osaka.jp":true,"takatsuki.osaka.jp":true,"tondabayashi.osaka.jp":true,"toyonaka.osaka.jp":true,"toyono.osaka.jp":true,"yao.osaka.jp":true,"ariake.saga.jp":true,"arita.saga.jp":true,"fukudomi.saga.jp":true,"genkai.saga.jp":true,"hamatama.saga.jp":true,"hizen.saga.jp":true,"imari.saga.jp":true,"kamimine.saga.jp":true,"kanzaki.saga.jp":true,"karatsu.saga.jp":true,"kashima.saga.jp":true,"kitagata.saga.jp":true,"kitahata.saga.jp":true,"kiyama.saga.jp":true,"kouhoku.saga.jp":true,"kyuragi.saga.jp":true,"nishiarita.saga.jp":true,"ogi.saga.jp":true,"omachi.saga.jp":true,"ouchi.saga.jp":true,"saga.saga.jp":true,"shiroishi.saga.jp":true,"taku.saga.jp":true,"tara.saga.jp":true,"tosu.saga.jp":true,"yoshinogari.saga.jp":true,"arakawa.saitama.jp":true,"asaka.saitama.jp":true,"chichibu.saitama.jp":true,"fujimi.saitama.jp":true,"fujimino.saitama.jp":true,"fukaya.saitama.jp":true,"hanno.saitama.jp":true,"hanyu.saitama.jp":true,"hasuda.saitama.jp":true,"hatogaya.saitama.jp":true,"hatoyama.saitama.jp":true,"hidaka.saitama.jp":true,"higashichichibu.saitama.jp":true,"higashimatsuyama.saitama.jp":true,"honjo.saitama.jp":true,"ina.saitama.jp":true,"iruma.saitama.jp":true,"iwatsuki.saitama.jp":true,"kamiizumi.saitama.jp":true,"kamikawa.saitama.jp":true,"kamisato.saitama.jp":true,"kasukabe.saitama.jp":true,"kawagoe.saitama.jp":true,"kawaguchi.saitama.jp":true,"kawajima.saitama.jp":true,"kazo.saitama.jp":true,"kitamoto.saitama.jp":true,"koshigaya.saitama.jp":true,"kounosu.saitama.jp":true,"kuki.saitama.jp":true,"kumagaya.saitama.jp":true,"matsubushi.saitama.jp":true,"minano.saitama.jp":true,"misato.saitama.jp":true,"miyashiro.saitama.jp":true,"miyoshi.saitama.jp":true,"moroyama.saitama.jp":true,"nagatoro.saitama.jp":true,"namegawa.saitama.jp":true,"niiza.saitama.jp":true,"ogano.saitama.jp":true,"ogawa.saitama.jp":true,"ogose.saitama.jp":true,"okegawa.saitama.jp":true,"omiya.saitama.jp":true,"otaki.saitama.jp":true,"ranzan.saitama.jp":true,"ryokami.saitama.jp":true,"saitama.saitama.jp":true,"sakado.saitama.jp":true,"satte.saitama.jp":true,"sayama.saitama.jp":true,"shiki.saitama.jp":true,"shiraoka.saitama.jp":true,"soka.saitama.jp":true,"sugito.saitama.jp":true,"toda.saitama.jp":true,"tokigawa.saitama.jp":true,"tokorozawa.saitama.jp":true,"tsurugashima.saitama.jp":true,"urawa.saitama.jp":true,"warabi.saitama.jp":true,"yashio.saitama.jp":true,"yokoze.saitama.jp":true,"yono.saitama.jp":true,"yorii.saitama.jp":true,"yoshida.saitama.jp":true,"yoshikawa.saitama.jp":true,"yoshimi.saitama.jp":true,"aisho.shiga.jp":true,"gamo.shiga.jp":true,"higashiomi.shiga.jp":true,"hikone.shiga.jp":true,"koka.shiga.jp":true,"konan.shiga.jp":true,"kosei.shiga.jp":true,"koto.shiga.jp":true,"kusatsu.shiga.jp":true,"maibara.shiga.jp":true,"moriyama.shiga.jp":true,"nagahama.shiga.jp":true,"nishiazai.shiga.jp":true,"notogawa.shiga.jp":true,"omihachiman.shiga.jp":true,"otsu.shiga.jp":true,"ritto.shiga.jp":true,"ryuoh.shiga.jp":true,"takashima.shiga.jp":true,"takatsuki.shiga.jp":true,"torahime.shiga.jp":true,"toyosato.shiga.jp":true,"yasu.shiga.jp":true,"akagi.shimane.jp":true,"ama.shimane.jp":true,"gotsu.shimane.jp":true,"hamada.shimane.jp":true,"higashiizumo.shimane.jp":true,"hikawa.shimane.jp":true,"hikimi.shimane.jp":true,"izumo.shimane.jp":true,"kakinoki.shimane.jp":true,"masuda.shimane.jp":true,"matsue.shimane.jp":true,"misato.shimane.jp":true,"nishinoshima.shimane.jp":true,"ohda.shimane.jp":true,"okinoshima.shimane.jp":true,"okuizumo.shimane.jp":true,"shimane.shimane.jp":true,"tamayu.shimane.jp":true,"tsuwano.shimane.jp":true,"unnan.shimane.jp":true,"yakumo.shimane.jp":true,"yasugi.shimane.jp":true,"yatsuka.shimane.jp":true,"arai.shizuoka.jp":true,"atami.shizuoka.jp":true,"fuji.shizuoka.jp":true,"fujieda.shizuoka.jp":true,"fujikawa.shizuoka.jp":true,"fujinomiya.shizuoka.jp":true,"fukuroi.shizuoka.jp":true,"gotemba.shizuoka.jp":true,"haibara.shizuoka.jp":true,"hamamatsu.shizuoka.jp":true,"higashiizu.shizuoka.jp":true,"ito.shizuoka.jp":true,"iwata.shizuoka.jp":true,"izu.shizuoka.jp":true,"izunokuni.shizuoka.jp":true,"kakegawa.shizuoka.jp":true,"kannami.shizuoka.jp":true,"kawanehon.shizuoka.jp":true,"kawazu.shizuoka.jp":true,"kikugawa.shizuoka.jp":true,"kosai.shizuoka.jp":true,"makinohara.shizuoka.jp":true,"matsuzaki.shizuoka.jp":true,"minamiizu.shizuoka.jp":true,"mishima.shizuoka.jp":true,"morimachi.shizuoka.jp":true,"nishiizu.shizuoka.jp":true,"numazu.shizuoka.jp":true,"omaezaki.shizuoka.jp":true,"shimada.shizuoka.jp":true,"shimizu.shizuoka.jp":true,"shimoda.shizuoka.jp":true,"shizuoka.shizuoka.jp":true,"susono.shizuoka.jp":true,"yaizu.shizuoka.jp":true,"yoshida.shizuoka.jp":true,"ashikaga.tochigi.jp":true,"bato.tochigi.jp":true,"haga.tochigi.jp":true,"ichikai.tochigi.jp":true,"iwafune.tochigi.jp":true,"kaminokawa.tochigi.jp":true,"kanuma.tochigi.jp":true,"karasuyama.tochigi.jp":true,"kuroiso.tochigi.jp":true,"mashiko.tochigi.jp":true,"mibu.tochigi.jp":true,"moka.tochigi.jp":true,"motegi.tochigi.jp":true,"nasu.tochigi.jp":true,"nasushiobara.tochigi.jp":true,"nikko.tochigi.jp":true,"nishikata.tochigi.jp":true,"nogi.tochigi.jp":true,"ohira.tochigi.jp":true,"ohtawara.tochigi.jp":true,"oyama.tochigi.jp":true,"sakura.tochigi.jp":true,"sano.tochigi.jp":true,"shimotsuke.tochigi.jp":true,"shioya.tochigi.jp":true,"takanezawa.tochigi.jp":true,"tochigi.tochigi.jp":true,"tsuga.tochigi.jp":true,"ujiie.tochigi.jp":true,"utsunomiya.tochigi.jp":true,"yaita.tochigi.jp":true,"aizumi.tokushima.jp":true,"anan.tokushima.jp":true,"ichiba.tokushima.jp":true,"itano.tokushima.jp":true,"kainan.tokushima.jp":true,"komatsushima.tokushima.jp":true,"matsushige.tokushima.jp":true,"mima.tokushima.jp":true,"minami.tokushima.jp":true,"miyoshi.tokushima.jp":true,"mugi.tokushima.jp":true,"nakagawa.tokushima.jp":true,"naruto.tokushima.jp":true,"sanagochi.tokushima.jp":true,"shishikui.tokushima.jp":true,"tokushima.tokushima.jp":true,"wajiki.tokushima.jp":true,"adachi.tokyo.jp":true,"akiruno.tokyo.jp":true,"akishima.tokyo.jp":true,"aogashima.tokyo.jp":true,"arakawa.tokyo.jp":true,"bunkyo.tokyo.jp":true,"chiyoda.tokyo.jp":true,"chofu.tokyo.jp":true,"chuo.tokyo.jp":true,"edogawa.tokyo.jp":true,"fuchu.tokyo.jp":true,"fussa.tokyo.jp":true,"hachijo.tokyo.jp":true,"hachioji.tokyo.jp":true,"hamura.tokyo.jp":true,"higashikurume.tokyo.jp":true,"higashimurayama.tokyo.jp":true,"higashiyamato.tokyo.jp":true,"hino.tokyo.jp":true,"hinode.tokyo.jp":true,"hinohara.tokyo.jp":true,"inagi.tokyo.jp":true,"itabashi.tokyo.jp":true,"katsushika.tokyo.jp":true,"kita.tokyo.jp":true,"kiyose.tokyo.jp":true,"kodaira.tokyo.jp":true,"koganei.tokyo.jp":true,"kokubunji.tokyo.jp":true,"komae.tokyo.jp":true,"koto.tokyo.jp":true,"kouzushima.tokyo.jp":true,"kunitachi.tokyo.jp":true,"machida.tokyo.jp":true,"meguro.tokyo.jp":true,"minato.tokyo.jp":true,"mitaka.tokyo.jp":true,"mizuho.tokyo.jp":true,"musashimurayama.tokyo.jp":true,"musashino.tokyo.jp":true,"nakano.tokyo.jp":true,"nerima.tokyo.jp":true,"ogasawara.tokyo.jp":true,"okutama.tokyo.jp":true,"ome.tokyo.jp":true,"oshima.tokyo.jp":true,"ota.tokyo.jp":true,"setagaya.tokyo.jp":true,"shibuya.tokyo.jp":true,"shinagawa.tokyo.jp":true,"shinjuku.tokyo.jp":true,"suginami.tokyo.jp":true,"sumida.tokyo.jp":true,"tachikawa.tokyo.jp":true,"taito.tokyo.jp":true,"tama.tokyo.jp":true,"toshima.tokyo.jp":true,"chizu.tottori.jp":true,"hino.tottori.jp":true,"kawahara.tottori.jp":true,"koge.tottori.jp":true,"kotoura.tottori.jp":true,"misasa.tottori.jp":true,"nanbu.tottori.jp":true,"nichinan.tottori.jp":true,"sakaiminato.tottori.jp":true,"tottori.tottori.jp":true,"wakasa.tottori.jp":true,"yazu.tottori.jp":true,"yonago.tottori.jp":true,"asahi.toyama.jp":true,"fuchu.toyama.jp":true,"fukumitsu.toyama.jp":true,"funahashi.toyama.jp":true,"himi.toyama.jp":true,"imizu.toyama.jp":true,"inami.toyama.jp":true,"johana.toyama.jp":true,"kamiichi.toyama.jp":true,"kurobe.toyama.jp":true,"nakaniikawa.toyama.jp":true,"namerikawa.toyama.jp":true,"nanto.toyama.jp":true,"nyuzen.toyama.jp":true,"oyabe.toyama.jp":true,"taira.toyama.jp":true,"takaoka.toyama.jp":true,"tateyama.toyama.jp":true,"toga.toyama.jp":true,"tonami.toyama.jp":true,"toyama.toyama.jp":true,"unazuki.toyama.jp":true,"uozu.toyama.jp":true,"yamada.toyama.jp":true,"arida.wakayama.jp":true,"aridagawa.wakayama.jp":true,"gobo.wakayama.jp":true,"hashimoto.wakayama.jp":true,"hidaka.wakayama.jp":true,"hirogawa.wakayama.jp":true,"inami.wakayama.jp":true,"iwade.wakayama.jp":true,"kainan.wakayama.jp":true,"kamitonda.wakayama.jp":true,"katsuragi.wakayama.jp":true,"kimino.wakayama.jp":true,"kinokawa.wakayama.jp":true,"kitayama.wakayama.jp":true,"koya.wakayama.jp":true,"koza.wakayama.jp":true,"kozagawa.wakayama.jp":true,"kudoyama.wakayama.jp":true,"kushimoto.wakayama.jp":true,"mihama.wakayama.jp":true,"misato.wakayama.jp":true,"nachikatsuura.wakayama.jp":true,"shingu.wakayama.jp":true,"shirahama.wakayama.jp":true,"taiji.wakayama.jp":true,"tanabe.wakayama.jp":true,"wakayama.wakayama.jp":true,"yuasa.wakayama.jp":true,"yura.wakayama.jp":true,"asahi.yamagata.jp":true,"funagata.yamagata.jp":true,"higashine.yamagata.jp":true,"iide.yamagata.jp":true,"kahoku.yamagata.jp":true,"kaminoyama.yamagata.jp":true,"kaneyama.yamagata.jp":true,"kawanishi.yamagata.jp":true,"mamurogawa.yamagata.jp":true,"mikawa.yamagata.jp":true,"murayama.yamagata.jp":true,"nagai.yamagata.jp":true,"nakayama.yamagata.jp":true,"nanyo.yamagata.jp":true,"nishikawa.yamagata.jp":true,"obanazawa.yamagata.jp":true,"oe.yamagata.jp":true,"oguni.yamagata.jp":true,"ohkura.yamagata.jp":true,"oishida.yamagata.jp":true,"sagae.yamagata.jp":true,"sakata.yamagata.jp":true,"sakegawa.yamagata.jp":true,"shinjo.yamagata.jp":true,"shirataka.yamagata.jp":true,"shonai.yamagata.jp":true,"takahata.yamagata.jp":true,"tendo.yamagata.jp":true,"tozawa.yamagata.jp":true,"tsuruoka.yamagata.jp":true,"yamagata.yamagata.jp":true,"yamanobe.yamagata.jp":true,"yonezawa.yamagata.jp":true,"yuza.yamagata.jp":true,"abu.yamaguchi.jp":true,"hagi.yamaguchi.jp":true,"hikari.yamaguchi.jp":true,"hofu.yamaguchi.jp":true,"iwakuni.yamaguchi.jp":true,"kudamatsu.yamaguchi.jp":true,"mitou.yamaguchi.jp":true,"nagato.yamaguchi.jp":true,"oshima.yamaguchi.jp":true,"shimonoseki.yamaguchi.jp":true,"shunan.yamaguchi.jp":true,"tabuse.yamaguchi.jp":true,"tokuyama.yamaguchi.jp":true,"toyota.yamaguchi.jp":true,"ube.yamaguchi.jp":true,"yuu.yamaguchi.jp":true,"chuo.yamanashi.jp":true,"doshi.yamanashi.jp":true,"fuefuki.yamanashi.jp":true,"fujikawa.yamanashi.jp":true,"fujikawaguchiko.yamanashi.jp":true,"fujiyoshida.yamanashi.jp":true,"hayakawa.yamanashi.jp":true,"hokuto.yamanashi.jp":true,"ichikawamisato.yamanashi.jp":true,"kai.yamanashi.jp":true,"kofu.yamanashi.jp":true,"koshu.yamanashi.jp":true,"kosuge.yamanashi.jp":true,"minami-alps.yamanashi.jp":true,"minobu.yamanashi.jp":true,"nakamichi.yamanashi.jp":true,"nanbu.yamanashi.jp":true,"narusawa.yamanashi.jp":true,"nirasaki.yamanashi.jp":true,"nishikatsura.yamanashi.jp":true,"oshino.yamanashi.jp":true,"otsuki.yamanashi.jp":true,"showa.yamanashi.jp":true,"tabayama.yamanashi.jp":true,"tsuru.yamanashi.jp":true,"uenohara.yamanashi.jp":true,"yamanakako.yamanashi.jp":true,"yamanashi.yamanashi.jp":true,"ke":true,"ac.ke":true,"co.ke":true,"go.ke":true,"info.ke":true,"me.ke":true,"mobi.ke":true,"ne.ke":true,"or.ke":true,"sc.ke":true,"kg":true,"org.kg":true,"net.kg":true,"com.kg":true,"edu.kg":true,"gov.kg":true,"mil.kg":true,"*.kh":true,"ki":true,"edu.ki":true,"biz.ki":true,"net.ki":true,"org.ki":true,"gov.ki":true,"info.ki":true,"com.ki":true,"km":true,"org.km":true,"nom.km":true,"gov.km":true,"prd.km":true,"tm.km":true,"edu.km":true,"mil.km":true,"ass.km":true,"com.km":true,"coop.km":true,"asso.km":true,"presse.km":true,"medecin.km":true,"notaires.km":true,"pharmaciens.km":true,"veterinaire.km":true,"gouv.km":true,"kn":true,"net.kn":true,"org.kn":true,"edu.kn":true,"gov.kn":true,"kp":true,"com.kp":true,"edu.kp":true,"gov.kp":true,"org.kp":true,"rep.kp":true,"tra.kp":true,"kr":true,"ac.kr":true,"co.kr":true,"es.kr":true,"go.kr":true,"hs.kr":true,"kg.kr":true,"mil.kr":true,"ms.kr":true,"ne.kr":true,"or.kr":true,"pe.kr":true,"re.kr":true,"sc.kr":true,"busan.kr":true,"chungbuk.kr":true,"chungnam.kr":true,"daegu.kr":true,"daejeon.kr":true,"gangwon.kr":true,"gwangju.kr":true,"gyeongbuk.kr":true,"gyeonggi.kr":true,"gyeongnam.kr":true,"incheon.kr":true,"jeju.kr":true,"jeonbuk.kr":true,"jeonnam.kr":true,"seoul.kr":true,"ulsan.kr":true,"*.kw":true,"ky":true,"edu.ky":true,"gov.ky":true,"com.ky":true,"org.ky":true,"net.ky":true,"kz":true,"org.kz":true,"edu.kz":true,"net.kz":true,"gov.kz":true,"mil.kz":true,"com.kz":true,"la":true,"int.la":true,"net.la":true,"info.la":true,"edu.la":true,"gov.la":true,"per.la":true,"com.la":true,"org.la":true,"lb":true,"com.lb":true,"edu.lb":true,"gov.lb":true,"net.lb":true,"org.lb":true,"lc":true,"com.lc":true,"net.lc":true,"co.lc":true,"org.lc":true,"edu.lc":true,"gov.lc":true,"li":true,"lk":true,"gov.lk":true,"sch.lk":true,"net.lk":true,"int.lk":true,"com.lk":true,"org.lk":true,"edu.lk":true,"ngo.lk":true,"soc.lk":true,"web.lk":true,"ltd.lk":true,"assn.lk":true,"grp.lk":true,"hotel.lk":true,"ac.lk":true,"lr":true,"com.lr":true,"edu.lr":true,"gov.lr":true,"org.lr":true,"net.lr":true,"ls":true,"co.ls":true,"org.ls":true,"lt":true,"gov.lt":true,"lu":true,"lv":true,"com.lv":true,"edu.lv":true,"gov.lv":true,"org.lv":true,"mil.lv":true,"id.lv":true,"net.lv":true,"asn.lv":true,"conf.lv":true,"ly":true,"com.ly":true,"net.ly":true,"gov.ly":true,"plc.ly":true,"edu.ly":true,"sch.ly":true,"med.ly":true,"org.ly":true,"id.ly":true,"ma":true,"co.ma":true,"net.ma":true,"gov.ma":true,"org.ma":true,"ac.ma":true,"press.ma":true,"mc":true,"tm.mc":true,"asso.mc":true,"md":true,"me":true,"co.me":true,"net.me":true,"org.me":true,"edu.me":true,"ac.me":true,"gov.me":true,"its.me":true,"priv.me":true,"mg":true,"org.mg":true,"nom.mg":true,"gov.mg":true,"prd.mg":true,"tm.mg":true,"edu.mg":true,"mil.mg":true,"com.mg":true,"co.mg":true,"mh":true,"mil":true,"mk":true,"com.mk":true,"org.mk":true,"net.mk":true,"edu.mk":true,"gov.mk":true,"inf.mk":true,"name.mk":true,"ml":true,"com.ml":true,"edu.ml":true,"gouv.ml":true,"gov.ml":true,"net.ml":true,"org.ml":true,"presse.ml":true,"*.mm":true,"mn":true,"gov.mn":true,"edu.mn":true,"org.mn":true,"mo":true,"com.mo":true,"net.mo":true,"org.mo":true,"edu.mo":true,"gov.mo":true,"mobi":true,"mp":true,"mq":true,"mr":true,"gov.mr":true,"ms":true,"com.ms":true,"edu.ms":true,"gov.ms":true,"net.ms":true,"org.ms":true,"mt":true,"com.mt":true,"edu.mt":true,"net.mt":true,"org.mt":true,"mu":true,"com.mu":true,"net.mu":true,"org.mu":true,"gov.mu":true,"ac.mu":true,"co.mu":true,"or.mu":true,"museum":true,"academy.museum":true,"agriculture.museum":true,"air.museum":true,"airguard.museum":true,"alabama.museum":true,"alaska.museum":true,"amber.museum":true,"ambulance.museum":true,"american.museum":true,"americana.museum":true,"americanantiques.museum":true,"americanart.museum":true,"amsterdam.museum":true,"and.museum":true,"annefrank.museum":true,"anthro.museum":true,"anthropology.museum":true,"antiques.museum":true,"aquarium.museum":true,"arboretum.museum":true,"archaeological.museum":true,"archaeology.museum":true,"architecture.museum":true,"art.museum":true,"artanddesign.museum":true,"artcenter.museum":true,"artdeco.museum":true,"arteducation.museum":true,"artgallery.museum":true,"arts.museum":true,"artsandcrafts.museum":true,"asmatart.museum":true,"assassination.museum":true,"assisi.museum":true,"association.museum":true,"astronomy.museum":true,"atlanta.museum":true,"austin.museum":true,"australia.museum":true,"automotive.museum":true,"aviation.museum":true,"axis.museum":true,"badajoz.museum":true,"baghdad.museum":true,"bahn.museum":true,"bale.museum":true,"baltimore.museum":true,"barcelona.museum":true,"baseball.museum":true,"basel.museum":true,"baths.museum":true,"bauern.museum":true,"beauxarts.museum":true,"beeldengeluid.museum":true,"bellevue.museum":true,"bergbau.museum":true,"berkeley.museum":true,"berlin.museum":true,"bern.museum":true,"bible.museum":true,"bilbao.museum":true,"bill.museum":true,"birdart.museum":true,"birthplace.museum":true,"bonn.museum":true,"boston.museum":true,"botanical.museum":true,"botanicalgarden.museum":true,"botanicgarden.museum":true,"botany.museum":true,"brandywinevalley.museum":true,"brasil.museum":true,"bristol.museum":true,"british.museum":true,"britishcolumbia.museum":true,"broadcast.museum":true,"brunel.museum":true,"brussel.museum":true,"brussels.museum":true,"bruxelles.museum":true,"building.museum":true,"burghof.museum":true,"bus.museum":true,"bushey.museum":true,"cadaques.museum":true,"california.museum":true,"cambridge.museum":true,"can.museum":true,"canada.museum":true,"capebreton.museum":true,"carrier.museum":true,"cartoonart.museum":true,"casadelamoneda.museum":true,"castle.museum":true,"castres.museum":true,"celtic.museum":true,"center.museum":true,"chattanooga.museum":true,"cheltenham.museum":true,"chesapeakebay.museum":true,"chicago.museum":true,"children.museum":true,"childrens.museum":true,"childrensgarden.museum":true,"chiropractic.museum":true,"chocolate.museum":true,"christiansburg.museum":true,"cincinnati.museum":true,"cinema.museum":true,"circus.museum":true,"civilisation.museum":true,"civilization.museum":true,"civilwar.museum":true,"clinton.museum":true,"clock.museum":true,"coal.museum":true,"coastaldefence.museum":true,"cody.museum":true,"coldwar.museum":true,"collection.museum":true,"colonialwilliamsburg.museum":true,"coloradoplateau.museum":true,"columbia.museum":true,"columbus.museum":true,"communication.museum":true,"communications.museum":true,"community.museum":true,"computer.museum":true,"computerhistory.museum":true,"xn--comunicaes-v6a2o.museum":true,"contemporary.museum":true,"contemporaryart.museum":true,"convent.museum":true,"copenhagen.museum":true,"corporation.museum":true,"xn--correios-e-telecomunicaes-ghc29a.museum":true,"corvette.museum":true,"costume.museum":true,"countryestate.museum":true,"county.museum":true,"crafts.museum":true,"cranbrook.museum":true,"creation.museum":true,"cultural.museum":true,"culturalcenter.museum":true,"culture.museum":true,"cyber.museum":true,"cymru.museum":true,"dali.museum":true,"dallas.museum":true,"database.museum":true,"ddr.museum":true,"decorativearts.museum":true,"delaware.museum":true,"delmenhorst.museum":true,"denmark.museum":true,"depot.museum":true,"design.museum":true,"detroit.museum":true,"dinosaur.museum":true,"discovery.museum":true,"dolls.museum":true,"donostia.museum":true,"durham.museum":true,"eastafrica.museum":true,"eastcoast.museum":true,"education.museum":true,"educational.museum":true,"egyptian.museum":true,"eisenbahn.museum":true,"elburg.museum":true,"elvendrell.museum":true,"embroidery.museum":true,"encyclopedic.museum":true,"england.museum":true,"entomology.museum":true,"environment.museum":true,"environmentalconservation.museum":true,"epilepsy.museum":true,"essex.museum":true,"estate.museum":true,"ethnology.museum":true,"exeter.museum":true,"exhibition.museum":true,"family.museum":true,"farm.museum":true,"farmequipment.museum":true,"farmers.museum":true,"farmstead.museum":true,"field.museum":true,"figueres.museum":true,"filatelia.museum":true,"film.museum":true,"fineart.museum":true,"finearts.museum":true,"finland.museum":true,"flanders.museum":true,"florida.museum":true,"force.museum":true,"fortmissoula.museum":true,"fortworth.museum":true,"foundation.museum":true,"francaise.museum":true,"frankfurt.museum":true,"franziskaner.museum":true,"freemasonry.museum":true,"freiburg.museum":true,"fribourg.museum":true,"frog.museum":true,"fundacio.museum":true,"furniture.museum":true,"gallery.museum":true,"garden.museum":true,"gateway.museum":true,"geelvinck.museum":true,"gemological.museum":true,"geology.museum":true,"georgia.museum":true,"giessen.museum":true,"glas.museum":true,"glass.museum":true,"gorge.museum":true,"grandrapids.museum":true,"graz.museum":true,"guernsey.museum":true,"halloffame.museum":true,"hamburg.museum":true,"handson.museum":true,"harvestcelebration.museum":true,"hawaii.museum":true,"health.museum":true,"heimatunduhren.museum":true,"hellas.museum":true,"helsinki.museum":true,"hembygdsforbund.museum":true,"heritage.museum":true,"histoire.museum":true,"historical.museum":true,"historicalsociety.museum":true,"historichouses.museum":true,"historisch.museum":true,"historisches.museum":true,"history.museum":true,"historyofscience.museum":true,"horology.museum":true,"house.museum":true,"humanities.museum":true,"illustration.museum":true,"imageandsound.museum":true,"indian.museum":true,"indiana.museum":true,"indianapolis.museum":true,"indianmarket.museum":true,"intelligence.museum":true,"interactive.museum":true,"iraq.museum":true,"iron.museum":true,"isleofman.museum":true,"jamison.museum":true,"jefferson.museum":true,"jerusalem.museum":true,"jewelry.museum":true,"jewish.museum":true,"jewishart.museum":true,"jfk.museum":true,"journalism.museum":true,"judaica.museum":true,"judygarland.museum":true,"juedisches.museum":true,"juif.museum":true,"karate.museum":true,"karikatur.museum":true,"kids.museum":true,"koebenhavn.museum":true,"koeln.museum":true,"kunst.museum":true,"kunstsammlung.museum":true,"kunstunddesign.museum":true,"labor.museum":true,"labour.museum":true,"lajolla.museum":true,"lancashire.museum":true,"landes.museum":true,"lans.museum":true,"xn--lns-qla.museum":true,"larsson.museum":true,"lewismiller.museum":true,"lincoln.museum":true,"linz.museum":true,"living.museum":true,"livinghistory.museum":true,"localhistory.museum":true,"london.museum":true,"losangeles.museum":true,"louvre.museum":true,"loyalist.museum":true,"lucerne.museum":true,"luxembourg.museum":true,"luzern.museum":true,"mad.museum":true,"madrid.museum":true,"mallorca.museum":true,"manchester.museum":true,"mansion.museum":true,"mansions.museum":true,"manx.museum":true,"marburg.museum":true,"maritime.museum":true,"maritimo.museum":true,"maryland.museum":true,"marylhurst.museum":true,"media.museum":true,"medical.museum":true,"medizinhistorisches.museum":true,"meeres.museum":true,"memorial.museum":true,"mesaverde.museum":true,"michigan.museum":true,"midatlantic.museum":true,"military.museum":true,"mill.museum":true,"miners.museum":true,"mining.museum":true,"minnesota.museum":true,"missile.museum":true,"missoula.museum":true,"modern.museum":true,"moma.museum":true,"money.museum":true,"monmouth.museum":true,"monticello.museum":true,"montreal.museum":true,"moscow.museum":true,"motorcycle.museum":true,"muenchen.museum":true,"muenster.museum":true,"mulhouse.museum":true,"muncie.museum":true,"museet.museum":true,"museumcenter.museum":true,"museumvereniging.museum":true,"music.museum":true,"national.museum":true,"nationalfirearms.museum":true,"nationalheritage.museum":true,"nativeamerican.museum":true,"naturalhistory.museum":true,"naturalhistorymuseum.museum":true,"naturalsciences.museum":true,"nature.museum":true,"naturhistorisches.museum":true,"natuurwetenschappen.museum":true,"naumburg.museum":true,"naval.museum":true,"nebraska.museum":true,"neues.museum":true,"newhampshire.museum":true,"newjersey.museum":true,"newmexico.museum":true,"newport.museum":true,"newspaper.museum":true,"newyork.museum":true,"niepce.museum":true,"norfolk.museum":true,"north.museum":true,"nrw.museum":true,"nuernberg.museum":true,"nuremberg.museum":true,"nyc.museum":true,"nyny.museum":true,"oceanographic.museum":true,"oceanographique.museum":true,"omaha.museum":true,"online.museum":true,"ontario.museum":true,"openair.museum":true,"oregon.museum":true,"oregontrail.museum":true,"otago.museum":true,"oxford.museum":true,"pacific.museum":true,"paderborn.museum":true,"palace.museum":true,"paleo.museum":true,"palmsprings.museum":true,"panama.museum":true,"paris.museum":true,"pasadena.museum":true,"pharmacy.museum":true,"philadelphia.museum":true,"philadelphiaarea.museum":true,"philately.museum":true,"phoenix.museum":true,"photography.museum":true,"pilots.museum":true,"pittsburgh.museum":true,"planetarium.museum":true,"plantation.museum":true,"plants.museum":true,"plaza.museum":true,"portal.museum":true,"portland.museum":true,"portlligat.museum":true,"posts-and-telecommunications.museum":true,"preservation.museum":true,"presidio.museum":true,"press.museum":true,"project.museum":true,"public.museum":true,"pubol.museum":true,"quebec.museum":true,"railroad.museum":true,"railway.museum":true,"research.museum":true,"resistance.museum":true,"riodejaneiro.museum":true,"rochester.museum":true,"rockart.museum":true,"roma.museum":true,"russia.museum":true,"saintlouis.museum":true,"salem.museum":true,"salvadordali.museum":true,"salzburg.museum":true,"sandiego.museum":true,"sanfrancisco.museum":true,"santabarbara.museum":true,"santacruz.museum":true,"santafe.museum":true,"saskatchewan.museum":true,"satx.museum":true,"savannahga.museum":true,"schlesisches.museum":true,"schoenbrunn.museum":true,"schokoladen.museum":true,"school.museum":true,"schweiz.museum":true,"science.museum":true,"scienceandhistory.museum":true,"scienceandindustry.museum":true,"sciencecenter.museum":true,"sciencecenters.museum":true,"science-fiction.museum":true,"sciencehistory.museum":true,"sciences.museum":true,"sciencesnaturelles.museum":true,"scotland.museum":true,"seaport.museum":true,"settlement.museum":true,"settlers.museum":true,"shell.museum":true,"sherbrooke.museum":true,"sibenik.museum":true,"silk.museum":true,"ski.museum":true,"skole.museum":true,"society.museum":true,"sologne.museum":true,"soundandvision.museum":true,"southcarolina.museum":true,"southwest.museum":true,"space.museum":true,"spy.museum":true,"square.museum":true,"stadt.museum":true,"stalbans.museum":true,"starnberg.museum":true,"state.museum":true,"stateofdelaware.museum":true,"station.museum":true,"steam.museum":true,"steiermark.museum":true,"stjohn.museum":true,"stockholm.museum":true,"stpetersburg.museum":true,"stuttgart.museum":true,"suisse.museum":true,"surgeonshall.museum":true,"surrey.museum":true,"svizzera.museum":true,"sweden.museum":true,"sydney.museum":true,"tank.museum":true,"tcm.museum":true,"technology.museum":true,"telekommunikation.museum":true,"television.museum":true,"texas.museum":true,"textile.museum":true,"theater.museum":true,"time.museum":true,"timekeeping.museum":true,"topology.museum":true,"torino.museum":true,"touch.museum":true,"town.museum":true,"transport.museum":true,"tree.museum":true,"trolley.museum":true,"trust.museum":true,"trustee.museum":true,"uhren.museum":true,"ulm.museum":true,"undersea.museum":true,"university.museum":true,"usa.museum":true,"usantiques.museum":true,"usarts.museum":true,"uscountryestate.museum":true,"usculture.museum":true,"usdecorativearts.museum":true,"usgarden.museum":true,"ushistory.museum":true,"ushuaia.museum":true,"uslivinghistory.museum":true,"utah.museum":true,"uvic.museum":true,"valley.museum":true,"vantaa.museum":true,"versailles.museum":true,"viking.museum":true,"village.museum":true,"virginia.museum":true,"virtual.museum":true,"virtuel.museum":true,"vlaanderen.museum":true,"volkenkunde.museum":true,"wales.museum":true,"wallonie.museum":true,"war.museum":true,"washingtondc.museum":true,"watchandclock.museum":true,"watch-and-clock.museum":true,"western.museum":true,"westfalen.museum":true,"whaling.museum":true,"wildlife.museum":true,"williamsburg.museum":true,"windmill.museum":true,"workshop.museum":true,"york.museum":true,"yorkshire.museum":true,"yosemite.museum":true,"youth.museum":true,"zoological.museum":true,"zoology.museum":true,"xn--9dbhblg6di.museum":true,"xn--h1aegh.museum":true,"mv":true,"aero.mv":true,"biz.mv":true,"com.mv":true,"coop.mv":true,"edu.mv":true,"gov.mv":true,"info.mv":true,"int.mv":true,"mil.mv":true,"museum.mv":true,"name.mv":true,"net.mv":true,"org.mv":true,"pro.mv":true,"mw":true,"ac.mw":true,"biz.mw":true,"co.mw":true,"com.mw":true,"coop.mw":true,"edu.mw":true,"gov.mw":true,"int.mw":true,"museum.mw":true,"net.mw":true,"org.mw":true,"mx":true,"com.mx":true,"org.mx":true,"gob.mx":true,"edu.mx":true,"net.mx":true,"my":true,"com.my":true,"net.my":true,"org.my":true,"gov.my":true,"edu.my":true,"mil.my":true,"name.my":true,"mz":true,"ac.mz":true,"adv.mz":true,"co.mz":true,"edu.mz":true,"gov.mz":true,"mil.mz":true,"net.mz":true,"org.mz":true,"na":true,"info.na":true,"pro.na":true,"name.na":true,"school.na":true,"or.na":true,"dr.na":true,"us.na":true,"mx.na":true,"ca.na":true,"in.na":true,"cc.na":true,"tv.na":true,"ws.na":true,"mobi.na":true,"co.na":true,"com.na":true,"org.na":true,"name":true,"nc":true,"asso.nc":true,"nom.nc":true,"ne":true,"net":true,"nf":true,"com.nf":true,"net.nf":true,"per.nf":true,"rec.nf":true,"web.nf":true,"arts.nf":true,"firm.nf":true,"info.nf":true,"other.nf":true,"store.nf":true,"ng":true,"com.ng":true,"edu.ng":true,"gov.ng":true,"i.ng":true,"mil.ng":true,"mobi.ng":true,"name.ng":true,"net.ng":true,"org.ng":true,"sch.ng":true,"ni":true,"ac.ni":true,"biz.ni":true,"co.ni":true,"com.ni":true,"edu.ni":true,"gob.ni":true,"in.ni":true,"info.ni":true,"int.ni":true,"mil.ni":true,"net.ni":true,"nom.ni":true,"org.ni":true,"web.ni":true,"nl":true,"bv.nl":true,"no":true,"fhs.no":true,"vgs.no":true,"fylkesbibl.no":true,"folkebibl.no":true,"museum.no":true,"idrett.no":true,"priv.no":true,"mil.no":true,"stat.no":true,"dep.no":true,"kommune.no":true,"herad.no":true,"aa.no":true,"ah.no":true,"bu.no":true,"fm.no":true,"hl.no":true,"hm.no":true,"jan-mayen.no":true,"mr.no":true,"nl.no":true,"nt.no":true,"of.no":true,"ol.no":true,"oslo.no":true,"rl.no":true,"sf.no":true,"st.no":true,"svalbard.no":true,"tm.no":true,"tr.no":true,"va.no":true,"vf.no":true,"gs.aa.no":true,"gs.ah.no":true,"gs.bu.no":true,"gs.fm.no":true,"gs.hl.no":true,"gs.hm.no":true,"gs.jan-mayen.no":true,"gs.mr.no":true,"gs.nl.no":true,"gs.nt.no":true,"gs.of.no":true,"gs.ol.no":true,"gs.oslo.no":true,"gs.rl.no":true,"gs.sf.no":true,"gs.st.no":true,"gs.svalbard.no":true,"gs.tm.no":true,"gs.tr.no":true,"gs.va.no":true,"gs.vf.no":true,"akrehamn.no":true,"xn--krehamn-dxa.no":true,"algard.no":true,"xn--lgrd-poac.no":true,"arna.no":true,"brumunddal.no":true,"bryne.no":true,"bronnoysund.no":true,"xn--brnnysund-m8ac.no":true,"drobak.no":true,"xn--drbak-wua.no":true,"egersund.no":true,"fetsund.no":true,"floro.no":true,"xn--flor-jra.no":true,"fredrikstad.no":true,"hokksund.no":true,"honefoss.no":true,"xn--hnefoss-q1a.no":true,"jessheim.no":true,"jorpeland.no":true,"xn--jrpeland-54a.no":true,"kirkenes.no":true,"kopervik.no":true,"krokstadelva.no":true,"langevag.no":true,"xn--langevg-jxa.no":true,"leirvik.no":true,"mjondalen.no":true,"xn--mjndalen-64a.no":true,"mo-i-rana.no":true,"mosjoen.no":true,"xn--mosjen-eya.no":true,"nesoddtangen.no":true,"orkanger.no":true,"osoyro.no":true,"xn--osyro-wua.no":true,"raholt.no":true,"xn--rholt-mra.no":true,"sandnessjoen.no":true,"xn--sandnessjen-ogb.no":true,"skedsmokorset.no":true,"slattum.no":true,"spjelkavik.no":true,"stathelle.no":true,"stavern.no":true,"stjordalshalsen.no":true,"xn--stjrdalshalsen-sqb.no":true,"tananger.no":true,"tranby.no":true,"vossevangen.no":true,"afjord.no":true,"xn--fjord-lra.no":true,"agdenes.no":true,"al.no":true,"xn--l-1fa.no":true,"alesund.no":true,"xn--lesund-hua.no":true,"alstahaug.no":true,"alta.no":true,"xn--lt-liac.no":true,"alaheadju.no":true,"xn--laheadju-7ya.no":true,"alvdal.no":true,"amli.no":true,"xn--mli-tla.no":true,"amot.no":true,"xn--mot-tla.no":true,"andebu.no":true,"andoy.no":true,"xn--andy-ira.no":true,"andasuolo.no":true,"ardal.no":true,"xn--rdal-poa.no":true,"aremark.no":true,"arendal.no":true,"xn--s-1fa.no":true,"aseral.no":true,"xn--seral-lra.no":true,"asker.no":true,"askim.no":true,"askvoll.no":true,"askoy.no":true,"xn--asky-ira.no":true,"asnes.no":true,"xn--snes-poa.no":true,"audnedaln.no":true,"aukra.no":true,"aure.no":true,"aurland.no":true,"aurskog-holand.no":true,"xn--aurskog-hland-jnb.no":true,"austevoll.no":true,"austrheim.no":true,"averoy.no":true,"xn--avery-yua.no":true,"balestrand.no":true,"ballangen.no":true,"balat.no":true,"xn--blt-elab.no":true,"balsfjord.no":true,"bahccavuotna.no":true,"xn--bhccavuotna-k7a.no":true,"bamble.no":true,"bardu.no":true,"beardu.no":true,"beiarn.no":true,"bajddar.no":true,"xn--bjddar-pta.no":true,"baidar.no":true,"xn--bidr-5nac.no":true,"berg.no":true,"bergen.no":true,"berlevag.no":true,"xn--berlevg-jxa.no":true,"bearalvahki.no":true,"xn--bearalvhki-y4a.no":true,"bindal.no":true,"birkenes.no":true,"bjarkoy.no":true,"xn--bjarky-fya.no":true,"bjerkreim.no":true,"bjugn.no":true,"bodo.no":true,"xn--bod-2na.no":true,"badaddja.no":true,"xn--bdddj-mrabd.no":true,"budejju.no":true,"bokn.no":true,"bremanger.no":true,"bronnoy.no":true,"xn--brnny-wuac.no":true,"bygland.no":true,"bykle.no":true,"barum.no":true,"xn--brum-voa.no":true,"bo.telemark.no":true,"xn--b-5ga.telemark.no":true,"bo.nordland.no":true,"xn--b-5ga.nordland.no":true,"bievat.no":true,"xn--bievt-0qa.no":true,"bomlo.no":true,"xn--bmlo-gra.no":true,"batsfjord.no":true,"xn--btsfjord-9za.no":true,"bahcavuotna.no":true,"xn--bhcavuotna-s4a.no":true,"dovre.no":true,"drammen.no":true,"drangedal.no":true,"dyroy.no":true,"xn--dyry-ira.no":true,"donna.no":true,"xn--dnna-gra.no":true,"eid.no":true,"eidfjord.no":true,"eidsberg.no":true,"eidskog.no":true,"eidsvoll.no":true,"eigersund.no":true,"elverum.no":true,"enebakk.no":true,"engerdal.no":true,"etne.no":true,"etnedal.no":true,"evenes.no":true,"evenassi.no":true,"xn--eveni-0qa01ga.no":true,"evje-og-hornnes.no":true,"farsund.no":true,"fauske.no":true,"fuossko.no":true,"fuoisku.no":true,"fedje.no":true,"fet.no":true,"finnoy.no":true,"xn--finny-yua.no":true,"fitjar.no":true,"fjaler.no":true,"fjell.no":true,"flakstad.no":true,"flatanger.no":true,"flekkefjord.no":true,"flesberg.no":true,"flora.no":true,"fla.no":true,"xn--fl-zia.no":true,"folldal.no":true,"forsand.no":true,"fosnes.no":true,"frei.no":true,"frogn.no":true,"froland.no":true,"frosta.no":true,"frana.no":true,"xn--frna-woa.no":true,"froya.no":true,"xn--frya-hra.no":true,"fusa.no":true,"fyresdal.no":true,"forde.no":true,"xn--frde-gra.no":true,"gamvik.no":true,"gangaviika.no":true,"xn--ggaviika-8ya47h.no":true,"gaular.no":true,"gausdal.no":true,"gildeskal.no":true,"xn--gildeskl-g0a.no":true,"giske.no":true,"gjemnes.no":true,"gjerdrum.no":true,"gjerstad.no":true,"gjesdal.no":true,"gjovik.no":true,"xn--gjvik-wua.no":true,"gloppen.no":true,"gol.no":true,"gran.no":true,"grane.no":true,"granvin.no":true,"gratangen.no":true,"grimstad.no":true,"grong.no":true,"kraanghke.no":true,"xn--kranghke-b0a.no":true,"grue.no":true,"gulen.no":true,"hadsel.no":true,"halden.no":true,"halsa.no":true,"hamar.no":true,"hamaroy.no":true,"habmer.no":true,"xn--hbmer-xqa.no":true,"hapmir.no":true,"xn--hpmir-xqa.no":true,"hammerfest.no":true,"hammarfeasta.no":true,"xn--hmmrfeasta-s4ac.no":true,"haram.no":true,"hareid.no":true,"harstad.no":true,"hasvik.no":true,"aknoluokta.no":true,"xn--koluokta-7ya57h.no":true,"hattfjelldal.no":true,"aarborte.no":true,"haugesund.no":true,"hemne.no":true,"hemnes.no":true,"hemsedal.no":true,"heroy.more-og-romsdal.no":true,"xn--hery-ira.xn--mre-og-romsdal-qqb.no":true,"heroy.nordland.no":true,"xn--hery-ira.nordland.no":true,"hitra.no":true,"hjartdal.no":true,"hjelmeland.no":true,"hobol.no":true,"xn--hobl-ira.no":true,"hof.no":true,"hol.no":true,"hole.no":true,"holmestrand.no":true,"holtalen.no":true,"xn--holtlen-hxa.no":true,"hornindal.no":true,"horten.no":true,"hurdal.no":true,"hurum.no":true,"hvaler.no":true,"hyllestad.no":true,"hagebostad.no":true,"xn--hgebostad-g3a.no":true,"hoyanger.no":true,"xn--hyanger-q1a.no":true,"hoylandet.no":true,"xn--hylandet-54a.no":true,"ha.no":true,"xn--h-2fa.no":true,"ibestad.no":true,"inderoy.no":true,"xn--indery-fya.no":true,"iveland.no":true,"jevnaker.no":true,"jondal.no":true,"jolster.no":true,"xn--jlster-bya.no":true,"karasjok.no":true,"karasjohka.no":true,"xn--krjohka-hwab49j.no":true,"karlsoy.no":true,"galsa.no":true,"xn--gls-elac.no":true,"karmoy.no":true,"xn--karmy-yua.no":true,"kautokeino.no":true,"guovdageaidnu.no":true,"klepp.no":true,"klabu.no":true,"xn--klbu-woa.no":true,"kongsberg.no":true,"kongsvinger.no":true,"kragero.no":true,"xn--krager-gya.no":true,"kristiansand.no":true,"kristiansund.no":true,"krodsherad.no":true,"xn--krdsherad-m8a.no":true,"kvalsund.no":true,"rahkkeravju.no":true,"xn--rhkkervju-01af.no":true,"kvam.no":true,"kvinesdal.no":true,"kvinnherad.no":true,"kviteseid.no":true,"kvitsoy.no":true,"xn--kvitsy-fya.no":true,"kvafjord.no":true,"xn--kvfjord-nxa.no":true,"giehtavuoatna.no":true,"kvanangen.no":true,"xn--kvnangen-k0a.no":true,"navuotna.no":true,"xn--nvuotna-hwa.no":true,"kafjord.no":true,"xn--kfjord-iua.no":true,"gaivuotna.no":true,"xn--givuotna-8ya.no":true,"larvik.no":true,"lavangen.no":true,"lavagis.no":true,"loabat.no":true,"xn--loabt-0qa.no":true,"lebesby.no":true,"davvesiida.no":true,"leikanger.no":true,"leirfjord.no":true,"leka.no":true,"leksvik.no":true,"lenvik.no":true,"leangaviika.no":true,"xn--leagaviika-52b.no":true,"lesja.no":true,"levanger.no":true,"lier.no":true,"lierne.no":true,"lillehammer.no":true,"lillesand.no":true,"lindesnes.no":true,"lindas.no":true,"xn--linds-pra.no":true,"lom.no":true,"loppa.no":true,"lahppi.no":true,"xn--lhppi-xqa.no":true,"lund.no":true,"lunner.no":true,"luroy.no":true,"xn--lury-ira.no":true,"luster.no":true,"lyngdal.no":true,"lyngen.no":true,"ivgu.no":true,"lardal.no":true,"lerdal.no":true,"xn--lrdal-sra.no":true,"lodingen.no":true,"xn--ldingen-q1a.no":true,"lorenskog.no":true,"xn--lrenskog-54a.no":true,"loten.no":true,"xn--lten-gra.no":true,"malvik.no":true,"masoy.no":true,"xn--msy-ula0h.no":true,"muosat.no":true,"xn--muost-0qa.no":true,"mandal.no":true,"marker.no":true,"marnardal.no":true,"masfjorden.no":true,"meland.no":true,"meldal.no":true,"melhus.no":true,"meloy.no":true,"xn--mely-ira.no":true,"meraker.no":true,"xn--merker-kua.no":true,"moareke.no":true,"xn--moreke-jua.no":true,"midsund.no":true,"midtre-gauldal.no":true,"modalen.no":true,"modum.no":true,"molde.no":true,"moskenes.no":true,"moss.no":true,"mosvik.no":true,"malselv.no":true,"xn--mlselv-iua.no":true,"malatvuopmi.no":true,"xn--mlatvuopmi-s4a.no":true,"namdalseid.no":true,"aejrie.no":true,"namsos.no":true,"namsskogan.no":true,"naamesjevuemie.no":true,"xn--nmesjevuemie-tcba.no":true,"laakesvuemie.no":true,"nannestad.no":true,"narvik.no":true,"narviika.no":true,"naustdal.no":true,"nedre-eiker.no":true,"nes.akershus.no":true,"nes.buskerud.no":true,"nesna.no":true,"nesodden.no":true,"nesseby.no":true,"unjarga.no":true,"xn--unjrga-rta.no":true,"nesset.no":true,"nissedal.no":true,"nittedal.no":true,"nord-aurdal.no":true,"nord-fron.no":true,"nord-odal.no":true,"norddal.no":true,"nordkapp.no":true,"davvenjarga.no":true,"xn--davvenjrga-y4a.no":true,"nordre-land.no":true,"nordreisa.no":true,"raisa.no":true,"xn--risa-5na.no":true,"nore-og-uvdal.no":true,"notodden.no":true,"naroy.no":true,"xn--nry-yla5g.no":true,"notteroy.no":true,"xn--nttery-byae.no":true,"odda.no":true,"oksnes.no":true,"xn--ksnes-uua.no":true,"oppdal.no":true,"oppegard.no":true,"xn--oppegrd-ixa.no":true,"orkdal.no":true,"orland.no":true,"xn--rland-uua.no":true,"orskog.no":true,"xn--rskog-uua.no":true,"orsta.no":true,"xn--rsta-fra.no":true,"os.hedmark.no":true,"os.hordaland.no":true,"osen.no":true,"osteroy.no":true,"xn--ostery-fya.no":true,"ostre-toten.no":true,"xn--stre-toten-zcb.no":true,"overhalla.no":true,"ovre-eiker.no":true,"xn--vre-eiker-k8a.no":true,"oyer.no":true,"xn--yer-zna.no":true,"oygarden.no":true,"xn--ygarden-p1a.no":true,"oystre-slidre.no":true,"xn--ystre-slidre-ujb.no":true,"porsanger.no":true,"porsangu.no":true,"xn--porsgu-sta26f.no":true,"porsgrunn.no":true,"radoy.no":true,"xn--rady-ira.no":true,"rakkestad.no":true,"rana.no":true,"ruovat.no":true,"randaberg.no":true,"rauma.no":true,"rendalen.no":true,"rennebu.no":true,"rennesoy.no":true,"xn--rennesy-v1a.no":true,"rindal.no":true,"ringebu.no":true,"ringerike.no":true,"ringsaker.no":true,"rissa.no":true,"risor.no":true,"xn--risr-ira.no":true,"roan.no":true,"rollag.no":true,"rygge.no":true,"ralingen.no":true,"xn--rlingen-mxa.no":true,"rodoy.no":true,"xn--rdy-0nab.no":true,"romskog.no":true,"xn--rmskog-bya.no":true,"roros.no":true,"xn--rros-gra.no":true,"rost.no":true,"xn--rst-0na.no":true,"royken.no":true,"xn--ryken-vua.no":true,"royrvik.no":true,"xn--ryrvik-bya.no":true,"rade.no":true,"xn--rde-ula.no":true,"salangen.no":true,"siellak.no":true,"saltdal.no":true,"salat.no":true,"xn--slt-elab.no":true,"xn--slat-5na.no":true,"samnanger.no":true,"sande.more-og-romsdal.no":true,"sande.xn--mre-og-romsdal-qqb.no":true,"sande.vestfold.no":true,"sandefjord.no":true,"sandnes.no":true,"sandoy.no":true,"xn--sandy-yua.no":true,"sarpsborg.no":true,"sauda.no":true,"sauherad.no":true,"sel.no":true,"selbu.no":true,"selje.no":true,"seljord.no":true,"sigdal.no":true,"siljan.no":true,"sirdal.no":true,"skaun.no":true,"skedsmo.no":true,"ski.no":true,"skien.no":true,"skiptvet.no":true,"skjervoy.no":true,"xn--skjervy-v1a.no":true,"skierva.no":true,"xn--skierv-uta.no":true,"skjak.no":true,"xn--skjk-soa.no":true,"skodje.no":true,"skanland.no":true,"xn--sknland-fxa.no":true,"skanit.no":true,"xn--sknit-yqa.no":true,"smola.no":true,"xn--smla-hra.no":true,"snillfjord.no":true,"snasa.no":true,"xn--snsa-roa.no":true,"snoasa.no":true,"snaase.no":true,"xn--snase-nra.no":true,"sogndal.no":true,"sokndal.no":true,"sola.no":true,"solund.no":true,"songdalen.no":true,"sortland.no":true,"spydeberg.no":true,"stange.no":true,"stavanger.no":true,"steigen.no":true,"steinkjer.no":true,"stjordal.no":true,"xn--stjrdal-s1a.no":true,"stokke.no":true,"stor-elvdal.no":true,"stord.no":true,"stordal.no":true,"storfjord.no":true,"omasvuotna.no":true,"strand.no":true,"stranda.no":true,"stryn.no":true,"sula.no":true,"suldal.no":true,"sund.no":true,"sunndal.no":true,"surnadal.no":true,"sveio.no":true,"svelvik.no":true,"sykkylven.no":true,"sogne.no":true,"xn--sgne-gra.no":true,"somna.no":true,"xn--smna-gra.no":true,"sondre-land.no":true,"xn--sndre-land-0cb.no":true,"sor-aurdal.no":true,"xn--sr-aurdal-l8a.no":true,"sor-fron.no":true,"xn--sr-fron-q1a.no":true,"sor-odal.no":true,"xn--sr-odal-q1a.no":true,"sor-varanger.no":true,"xn--sr-varanger-ggb.no":true,"matta-varjjat.no":true,"xn--mtta-vrjjat-k7af.no":true,"sorfold.no":true,"xn--srfold-bya.no":true,"sorreisa.no":true,"xn--srreisa-q1a.no":true,"sorum.no":true,"xn--srum-gra.no":true,"tana.no":true,"deatnu.no":true,"time.no":true,"tingvoll.no":true,"tinn.no":true,"tjeldsund.no":true,"dielddanuorri.no":true,"tjome.no":true,"xn--tjme-hra.no":true,"tokke.no":true,"tolga.no":true,"torsken.no":true,"tranoy.no":true,"xn--trany-yua.no":true,"tromso.no":true,"xn--troms-zua.no":true,"tromsa.no":true,"romsa.no":true,"trondheim.no":true,"troandin.no":true,"trysil.no":true,"trana.no":true,"xn--trna-woa.no":true,"trogstad.no":true,"xn--trgstad-r1a.no":true,"tvedestrand.no":true,"tydal.no":true,"tynset.no":true,"tysfjord.no":true,"divtasvuodna.no":true,"divttasvuotna.no":true,"tysnes.no":true,"tysvar.no":true,"xn--tysvr-vra.no":true,"tonsberg.no":true,"xn--tnsberg-q1a.no":true,"ullensaker.no":true,"ullensvang.no":true,"ulvik.no":true,"utsira.no":true,"vadso.no":true,"xn--vads-jra.no":true,"cahcesuolo.no":true,"xn--hcesuolo-7ya35b.no":true,"vaksdal.no":true,"valle.no":true,"vang.no":true,"vanylven.no":true,"vardo.no":true,"xn--vard-jra.no":true,"varggat.no":true,"xn--vrggt-xqad.no":true,"vefsn.no":true,"vaapste.no":true,"vega.no":true,"vegarshei.no":true,"xn--vegrshei-c0a.no":true,"vennesla.no":true,"verdal.no":true,"verran.no":true,"vestby.no":true,"vestnes.no":true,"vestre-slidre.no":true,"vestre-toten.no":true,"vestvagoy.no":true,"xn--vestvgy-ixa6o.no":true,"vevelstad.no":true,"vik.no":true,"vikna.no":true,"vindafjord.no":true,"volda.no":true,"voss.no":true,"varoy.no":true,"xn--vry-yla5g.no":true,"vagan.no":true,"xn--vgan-qoa.no":true,"voagat.no":true,"vagsoy.no":true,"xn--vgsy-qoa0j.no":true,"vaga.no":true,"xn--vg-yiab.no":true,"valer.ostfold.no":true,"xn--vler-qoa.xn--stfold-9xa.no":true,"valer.hedmark.no":true,"xn--vler-qoa.hedmark.no":true,"*.np":true,"nr":true,"biz.nr":true,"info.nr":true,"gov.nr":true,"edu.nr":true,"org.nr":true,"net.nr":true,"com.nr":true,"nu":true,"nz":true,"ac.nz":true,"co.nz":true,"cri.nz":true,"geek.nz":true,"gen.nz":true,"govt.nz":true,"health.nz":true,"iwi.nz":true,"kiwi.nz":true,"maori.nz":true,"mil.nz":true,"xn--mori-qsa.nz":true,"net.nz":true,"org.nz":true,"parliament.nz":true,"school.nz":true,"om":true,"co.om":true,"com.om":true,"edu.om":true,"gov.om":true,"med.om":true,"museum.om":true,"net.om":true,"org.om":true,"pro.om":true,"onion":true,"org":true,"pa":true,"ac.pa":true,"gob.pa":true,"com.pa":true,"org.pa":true,"sld.pa":true,"edu.pa":true,"net.pa":true,"ing.pa":true,"abo.pa":true,"med.pa":true,"nom.pa":true,"pe":true,"edu.pe":true,"gob.pe":true,"nom.pe":true,"mil.pe":true,"org.pe":true,"com.pe":true,"net.pe":true,"pf":true,"com.pf":true,"org.pf":true,"edu.pf":true,"*.pg":true,"ph":true,"com.ph":true,"net.ph":true,"org.ph":true,"gov.ph":true,"edu.ph":true,"ngo.ph":true,"mil.ph":true,"i.ph":true,"pk":true,"com.pk":true,"net.pk":true,"edu.pk":true,"org.pk":true,"fam.pk":true,"biz.pk":true,"web.pk":true,"gov.pk":true,"gob.pk":true,"gok.pk":true,"gon.pk":true,"gop.pk":true,"gos.pk":true,"info.pk":true,"pl":true,"com.pl":true,"net.pl":true,"org.pl":true,"aid.pl":true,"agro.pl":true,"atm.pl":true,"auto.pl":true,"biz.pl":true,"edu.pl":true,"gmina.pl":true,"gsm.pl":true,"info.pl":true,"mail.pl":true,"miasta.pl":true,"media.pl":true,"mil.pl":true,"nieruchomosci.pl":true,"nom.pl":true,"pc.pl":true,"powiat.pl":true,"priv.pl":true,"realestate.pl":true,"rel.pl":true,"sex.pl":true,"shop.pl":true,"sklep.pl":true,"sos.pl":true,"szkola.pl":true,"targi.pl":true,"tm.pl":true,"tourism.pl":true,"travel.pl":true,"turystyka.pl":true,"gov.pl":true,"ap.gov.pl":true,"ic.gov.pl":true,"is.gov.pl":true,"us.gov.pl":true,"kmpsp.gov.pl":true,"kppsp.gov.pl":true,"kwpsp.gov.pl":true,"psp.gov.pl":true,"wskr.gov.pl":true,"kwp.gov.pl":true,"mw.gov.pl":true,"ug.gov.pl":true,"um.gov.pl":true,"umig.gov.pl":true,"ugim.gov.pl":true,"upow.gov.pl":true,"uw.gov.pl":true,"starostwo.gov.pl":true,"pa.gov.pl":true,"po.gov.pl":true,"psse.gov.pl":true,"pup.gov.pl":true,"rzgw.gov.pl":true,"sa.gov.pl":true,"so.gov.pl":true,"sr.gov.pl":true,"wsa.gov.pl":true,"sko.gov.pl":true,"uzs.gov.pl":true,"wiih.gov.pl":true,"winb.gov.pl":true,"pinb.gov.pl":true,"wios.gov.pl":true,"witd.gov.pl":true,"wzmiuw.gov.pl":true,"piw.gov.pl":true,"wiw.gov.pl":true,"griw.gov.pl":true,"wif.gov.pl":true,"oum.gov.pl":true,"sdn.gov.pl":true,"zp.gov.pl":true,"uppo.gov.pl":true,"mup.gov.pl":true,"wuoz.gov.pl":true,"konsulat.gov.pl":true,"oirm.gov.pl":true,"augustow.pl":true,"babia-gora.pl":true,"bedzin.pl":true,"beskidy.pl":true,"bialowieza.pl":true,"bialystok.pl":true,"bielawa.pl":true,"bieszczady.pl":true,"boleslawiec.pl":true,"bydgoszcz.pl":true,"bytom.pl":true,"cieszyn.pl":true,"czeladz.pl":true,"czest.pl":true,"dlugoleka.pl":true,"elblag.pl":true,"elk.pl":true,"glogow.pl":true,"gniezno.pl":true,"gorlice.pl":true,"grajewo.pl":true,"ilawa.pl":true,"jaworzno.pl":true,"jelenia-gora.pl":true,"jgora.pl":true,"kalisz.pl":true,"kazimierz-dolny.pl":true,"karpacz.pl":true,"kartuzy.pl":true,"kaszuby.pl":true,"katowice.pl":true,"kepno.pl":true,"ketrzyn.pl":true,"klodzko.pl":true,"kobierzyce.pl":true,"kolobrzeg.pl":true,"konin.pl":true,"konskowola.pl":true,"kutno.pl":true,"lapy.pl":true,"lebork.pl":true,"legnica.pl":true,"lezajsk.pl":true,"limanowa.pl":true,"lomza.pl":true,"lowicz.pl":true,"lubin.pl":true,"lukow.pl":true,"malbork.pl":true,"malopolska.pl":true,"mazowsze.pl":true,"mazury.pl":true,"mielec.pl":true,"mielno.pl":true,"mragowo.pl":true,"naklo.pl":true,"nowaruda.pl":true,"nysa.pl":true,"olawa.pl":true,"olecko.pl":true,"olkusz.pl":true,"olsztyn.pl":true,"opoczno.pl":true,"opole.pl":true,"ostroda.pl":true,"ostroleka.pl":true,"ostrowiec.pl":true,"ostrowwlkp.pl":true,"pila.pl":true,"pisz.pl":true,"podhale.pl":true,"podlasie.pl":true,"polkowice.pl":true,"pomorze.pl":true,"pomorskie.pl":true,"prochowice.pl":true,"pruszkow.pl":true,"przeworsk.pl":true,"pulawy.pl":true,"radom.pl":true,"rawa-maz.pl":true,"rybnik.pl":true,"rzeszow.pl":true,"sanok.pl":true,"sejny.pl":true,"slask.pl":true,"slupsk.pl":true,"sosnowiec.pl":true,"stalowa-wola.pl":true,"skoczow.pl":true,"starachowice.pl":true,"stargard.pl":true,"suwalki.pl":true,"swidnica.pl":true,"swiebodzin.pl":true,"swinoujscie.pl":true,"szczecin.pl":true,"szczytno.pl":true,"tarnobrzeg.pl":true,"tgory.pl":true,"turek.pl":true,"tychy.pl":true,"ustka.pl":true,"walbrzych.pl":true,"warmia.pl":true,"warszawa.pl":true,"waw.pl":true,"wegrow.pl":true,"wielun.pl":true,"wlocl.pl":true,"wloclawek.pl":true,"wodzislaw.pl":true,"wolomin.pl":true,"wroclaw.pl":true,"zachpomor.pl":true,"zagan.pl":true,"zarow.pl":true,"zgora.pl":true,"zgorzelec.pl":true,"pm":true,"pn":true,"gov.pn":true,"co.pn":true,"org.pn":true,"edu.pn":true,"net.pn":true,"post":true,"pr":true,"com.pr":true,"net.pr":true,"org.pr":true,"gov.pr":true,"edu.pr":true,"isla.pr":true,"pro.pr":true,"biz.pr":true,"info.pr":true,"name.pr":true,"est.pr":true,"prof.pr":true,"ac.pr":true,"pro":true,"aaa.pro":true,"aca.pro":true,"acct.pro":true,"avocat.pro":true,"bar.pro":true,"cpa.pro":true,"eng.pro":true,"jur.pro":true,"law.pro":true,"med.pro":true,"recht.pro":true,"ps":true,"edu.ps":true,"gov.ps":true,"sec.ps":true,"plo.ps":true,"com.ps":true,"org.ps":true,"net.ps":true,"pt":true,"net.pt":true,"gov.pt":true,"org.pt":true,"edu.pt":true,"int.pt":true,"publ.pt":true,"com.pt":true,"nome.pt":true,"pw":true,"co.pw":true,"ne.pw":true,"or.pw":true,"ed.pw":true,"go.pw":true,"belau.pw":true,"py":true,"com.py":true,"coop.py":true,"edu.py":true,"gov.py":true,"mil.py":true,"net.py":true,"org.py":true,"qa":true,"com.qa":true,"edu.qa":true,"gov.qa":true,"mil.qa":true,"name.qa":true,"net.qa":true,"org.qa":true,"sch.qa":true,"re":true,"asso.re":true,"com.re":true,"nom.re":true,"ro":true,"arts.ro":true,"com.ro":true,"firm.ro":true,"info.ro":true,"nom.ro":true,"nt.ro":true,"org.ro":true,"rec.ro":true,"store.ro":true,"tm.ro":true,"www.ro":true,"rs":true,"ac.rs":true,"co.rs":true,"edu.rs":true,"gov.rs":true,"in.rs":true,"org.rs":true,"ru":true,"ac.ru":true,"edu.ru":true,"gov.ru":true,"int.ru":true,"mil.ru":true,"test.ru":true,"rw":true,"gov.rw":true,"net.rw":true,"edu.rw":true,"ac.rw":true,"com.rw":true,"co.rw":true,"int.rw":true,"mil.rw":true,"gouv.rw":true,"sa":true,"com.sa":true,"net.sa":true,"org.sa":true,"gov.sa":true,"med.sa":true,"pub.sa":true,"edu.sa":true,"sch.sa":true,"sb":true,"com.sb":true,"edu.sb":true,"gov.sb":true,"net.sb":true,"org.sb":true,"sc":true,"com.sc":true,"gov.sc":true,"net.sc":true,"org.sc":true,"edu.sc":true,"sd":true,"com.sd":true,"net.sd":true,"org.sd":true,"edu.sd":true,"med.sd":true,"tv.sd":true,"gov.sd":true,"info.sd":true,"se":true,"a.se":true,"ac.se":true,"b.se":true,"bd.se":true,"brand.se":true,"c.se":true,"d.se":true,"e.se":true,"f.se":true,"fh.se":true,"fhsk.se":true,"fhv.se":true,"g.se":true,"h.se":true,"i.se":true,"k.se":true,"komforb.se":true,"kommunalforbund.se":true,"komvux.se":true,"l.se":true,"lanbib.se":true,"m.se":true,"n.se":true,"naturbruksgymn.se":true,"o.se":true,"org.se":true,"p.se":true,"parti.se":true,"pp.se":true,"press.se":true,"r.se":true,"s.se":true,"t.se":true,"tm.se":true,"u.se":true,"w.se":true,"x.se":true,"y.se":true,"z.se":true,"sg":true,"com.sg":true,"net.sg":true,"org.sg":true,"gov.sg":true,"edu.sg":true,"per.sg":true,"sh":true,"com.sh":true,"net.sh":true,"gov.sh":true,"org.sh":true,"mil.sh":true,"si":true,"sj":true,"sk":true,"sl":true,"com.sl":true,"net.sl":true,"edu.sl":true,"gov.sl":true,"org.sl":true,"sm":true,"sn":true,"art.sn":true,"com.sn":true,"edu.sn":true,"gouv.sn":true,"org.sn":true,"perso.sn":true,"univ.sn":true,"so":true,"com.so":true,"net.so":true,"org.so":true,"sr":true,"st":true,"co.st":true,"com.st":true,"consulado.st":true,"edu.st":true,"embaixada.st":true,"gov.st":true,"mil.st":true,"net.st":true,"org.st":true,"principe.st":true,"saotome.st":true,"store.st":true,"su":true,"sv":true,"com.sv":true,"edu.sv":true,"gob.sv":true,"org.sv":true,"red.sv":true,"sx":true,"gov.sx":true,"sy":true,"edu.sy":true,"gov.sy":true,"net.sy":true,"mil.sy":true,"com.sy":true,"org.sy":true,"sz":true,"co.sz":true,"ac.sz":true,"org.sz":true,"tc":true,"td":true,"tel":true,"tf":true,"tg":true,"th":true,"ac.th":true,"co.th":true,"go.th":true,"in.th":true,"mi.th":true,"net.th":true,"or.th":true,"tj":true,"ac.tj":true,"biz.tj":true,"co.tj":true,"com.tj":true,"edu.tj":true,"go.tj":true,"gov.tj":true,"int.tj":true,"mil.tj":true,"name.tj":true,"net.tj":true,"nic.tj":true,"org.tj":true,"test.tj":true,"web.tj":true,"tk":true,"tl":true,"gov.tl":true,"tm":true,"com.tm":true,"co.tm":true,"org.tm":true,"net.tm":true,"nom.tm":true,"gov.tm":true,"mil.tm":true,"edu.tm":true,"tn":true,"com.tn":true,"ens.tn":true,"fin.tn":true,"gov.tn":true,"ind.tn":true,"intl.tn":true,"nat.tn":true,"net.tn":true,"org.tn":true,"info.tn":true,"perso.tn":true,"tourism.tn":true,"edunet.tn":true,"rnrt.tn":true,"rns.tn":true,"rnu.tn":true,"mincom.tn":true,"agrinet.tn":true,"defense.tn":true,"turen.tn":true,"to":true,"com.to":true,"gov.to":true,"net.to":true,"org.to":true,"edu.to":true,"mil.to":true,"tr":true,"com.tr":true,"info.tr":true,"biz.tr":true,"net.tr":true,"org.tr":true,"web.tr":true,"gen.tr":true,"tv.tr":true,"av.tr":true,"dr.tr":true,"bbs.tr":true,"name.tr":true,"tel.tr":true,"gov.tr":true,"bel.tr":true,"pol.tr":true,"mil.tr":true,"k12.tr":true,"edu.tr":true,"kep.tr":true,"nc.tr":true,"gov.nc.tr":true,"travel":true,"tt":true,"co.tt":true,"com.tt":true,"org.tt":true,"net.tt":true,"biz.tt":true,"info.tt":true,"pro.tt":true,"int.tt":true,"coop.tt":true,"jobs.tt":true,"mobi.tt":true,"travel.tt":true,"museum.tt":true,"aero.tt":true,"name.tt":true,"gov.tt":true,"edu.tt":true,"tv":true,"tw":true,"edu.tw":true,"gov.tw":true,"mil.tw":true,"com.tw":true,"net.tw":true,"org.tw":true,"idv.tw":true,"game.tw":true,"ebiz.tw":true,"club.tw":true,"xn--zf0ao64a.tw":true,"xn--uc0atv.tw":true,"xn--czrw28b.tw":true,"tz":true,"ac.tz":true,"co.tz":true,"go.tz":true,"hotel.tz":true,"info.tz":true,"me.tz":true,"mil.tz":true,"mobi.tz":true,"ne.tz":true,"or.tz":true,"sc.tz":true,"tv.tz":true,"ua":true,"com.ua":true,"edu.ua":true,"gov.ua":true,"in.ua":true,"net.ua":true,"org.ua":true,"cherkassy.ua":true,"cherkasy.ua":true,"chernigov.ua":true,"chernihiv.ua":true,"chernivtsi.ua":true,"chernovtsy.ua":true,"ck.ua":true,"cn.ua":true,"cr.ua":true,"crimea.ua":true,"cv.ua":true,"dn.ua":true,"dnepropetrovsk.ua":true,"dnipropetrovsk.ua":true,"dominic.ua":true,"donetsk.ua":true,"dp.ua":true,"if.ua":true,"ivano-frankivsk.ua":true,"kh.ua":true,"kharkiv.ua":true,"kharkov.ua":true,"kherson.ua":true,"khmelnitskiy.ua":true,"khmelnytskyi.ua":true,"kiev.ua":true,"kirovograd.ua":true,"km.ua":true,"kr.ua":true,"krym.ua":true,"ks.ua":true,"kv.ua":true,"kyiv.ua":true,"lg.ua":true,"lt.ua":true,"lugansk.ua":true,"lutsk.ua":true,"lv.ua":true,"lviv.ua":true,"mk.ua":true,"mykolaiv.ua":true,"nikolaev.ua":true,"od.ua":true,"odesa.ua":true,"odessa.ua":true,"pl.ua":true,"poltava.ua":true,"rivne.ua":true,"rovno.ua":true,"rv.ua":true,"sb.ua":true,"sebastopol.ua":true,"sevastopol.ua":true,"sm.ua":true,"sumy.ua":true,"te.ua":true,"ternopil.ua":true,"uz.ua":true,"uzhgorod.ua":true,"vinnica.ua":true,"vinnytsia.ua":true,"vn.ua":true,"volyn.ua":true,"yalta.ua":true,"zaporizhzhe.ua":true,"zaporizhzhia.ua":true,"zhitomir.ua":true,"zhytomyr.ua":true,"zp.ua":true,"zt.ua":true,"ug":true,"co.ug":true,"or.ug":true,"ac.ug":true,"sc.ug":true,"go.ug":true,"ne.ug":true,"com.ug":true,"org.ug":true,"uk":true,"ac.uk":true,"co.uk":true,"gov.uk":true,"ltd.uk":true,"me.uk":true,"net.uk":true,"nhs.uk":true,"org.uk":true,"plc.uk":true,"police.uk":true,"*.sch.uk":true,"us":true,"dni.us":true,"fed.us":true,"isa.us":true,"kids.us":true,"nsn.us":true,"ak.us":true,"al.us":true,"ar.us":true,"as.us":true,"az.us":true,"ca.us":true,"co.us":true,"ct.us":true,"dc.us":true,"de.us":true,"fl.us":true,"ga.us":true,"gu.us":true,"hi.us":true,"ia.us":true,"id.us":true,"il.us":true,"in.us":true,"ks.us":true,"ky.us":true,"la.us":true,"ma.us":true,"md.us":true,"me.us":true,"mi.us":true,"mn.us":true,"mo.us":true,"ms.us":true,"mt.us":true,"nc.us":true,"nd.us":true,"ne.us":true,"nh.us":true,"nj.us":true,"nm.us":true,"nv.us":true,"ny.us":true,"oh.us":true,"ok.us":true,"or.us":true,"pa.us":true,"pr.us":true,"ri.us":true,"sc.us":true,"sd.us":true,"tn.us":true,"tx.us":true,"ut.us":true,"vi.us":true,"vt.us":true,"va.us":true,"wa.us":true,"wi.us":true,"wv.us":true,"wy.us":true,"k12.ak.us":true,"k12.al.us":true,"k12.ar.us":true,"k12.as.us":true,"k12.az.us":true,"k12.ca.us":true,"k12.co.us":true,"k12.ct.us":true,"k12.dc.us":true,"k12.de.us":true,"k12.fl.us":true,"k12.ga.us":true,"k12.gu.us":true,"k12.ia.us":true,"k12.id.us":true,"k12.il.us":true,"k12.in.us":true,"k12.ks.us":true,"k12.ky.us":true,"k12.la.us":true,"k12.ma.us":true,"k12.md.us":true,"k12.me.us":true,"k12.mi.us":true,"k12.mn.us":true,"k12.mo.us":true,"k12.ms.us":true,"k12.mt.us":true,"k12.nc.us":true,"k12.ne.us":true,"k12.nh.us":true,"k12.nj.us":true,"k12.nm.us":true,"k12.nv.us":true,"k12.ny.us":true,"k12.oh.us":true,"k12.ok.us":true,"k12.or.us":true,"k12.pa.us":true,"k12.pr.us":true,"k12.ri.us":true,"k12.sc.us":true,"k12.tn.us":true,"k12.tx.us":true,"k12.ut.us":true,"k12.vi.us":true,"k12.vt.us":true,"k12.va.us":true,"k12.wa.us":true,"k12.wi.us":true,"k12.wy.us":true,"cc.ak.us":true,"cc.al.us":true,"cc.ar.us":true,"cc.as.us":true,"cc.az.us":true,"cc.ca.us":true,"cc.co.us":true,"cc.ct.us":true,"cc.dc.us":true,"cc.de.us":true,"cc.fl.us":true,"cc.ga.us":true,"cc.gu.us":true,"cc.hi.us":true,"cc.ia.us":true,"cc.id.us":true,"cc.il.us":true,"cc.in.us":true,"cc.ks.us":true,"cc.ky.us":true,"cc.la.us":true,"cc.ma.us":true,"cc.md.us":true,"cc.me.us":true,"cc.mi.us":true,"cc.mn.us":true,"cc.mo.us":true,"cc.ms.us":true,"cc.mt.us":true,"cc.nc.us":true,"cc.nd.us":true,"cc.ne.us":true,"cc.nh.us":true,"cc.nj.us":true,"cc.nm.us":true,"cc.nv.us":true,"cc.ny.us":true,"cc.oh.us":true,"cc.ok.us":true,"cc.or.us":true,"cc.pa.us":true,"cc.pr.us":true,"cc.ri.us":true,"cc.sc.us":true,"cc.sd.us":true,"cc.tn.us":true,"cc.tx.us":true,"cc.ut.us":true,"cc.vi.us":true,"cc.vt.us":true,"cc.va.us":true,"cc.wa.us":true,"cc.wi.us":true,"cc.wv.us":true,"cc.wy.us":true,"lib.ak.us":true,"lib.al.us":true,"lib.ar.us":true,"lib.as.us":true,"lib.az.us":true,"lib.ca.us":true,"lib.co.us":true,"lib.ct.us":true,"lib.dc.us":true,"lib.fl.us":true,"lib.ga.us":true,"lib.gu.us":true,"lib.hi.us":true,"lib.ia.us":true,"lib.id.us":true,"lib.il.us":true,"lib.in.us":true,"lib.ks.us":true,"lib.ky.us":true,"lib.la.us":true,"lib.ma.us":true,"lib.md.us":true,"lib.me.us":true,"lib.mi.us":true,"lib.mn.us":true,"lib.mo.us":true,"lib.ms.us":true,"lib.mt.us":true,"lib.nc.us":true,"lib.nd.us":true,"lib.ne.us":true,"lib.nh.us":true,"lib.nj.us":true,"lib.nm.us":true,"lib.nv.us":true,"lib.ny.us":true,"lib.oh.us":true,"lib.ok.us":true,"lib.or.us":true,"lib.pa.us":true,"lib.pr.us":true,"lib.ri.us":true,"lib.sc.us":true,"lib.sd.us":true,"lib.tn.us":true,"lib.tx.us":true,"lib.ut.us":true,"lib.vi.us":true,"lib.vt.us":true,"lib.va.us":true,"lib.wa.us":true,"lib.wi.us":true,"lib.wy.us":true,"pvt.k12.ma.us":true,"chtr.k12.ma.us":true,"paroch.k12.ma.us":true,"ann-arbor.mi.us":true,"cog.mi.us":true,"dst.mi.us":true,"eaton.mi.us":true,"gen.mi.us":true,"mus.mi.us":true,"tec.mi.us":true,"washtenaw.mi.us":true,"uy":true,"com.uy":true,"edu.uy":true,"gub.uy":true,"mil.uy":true,"net.uy":true,"org.uy":true,"uz":true,"co.uz":true,"com.uz":true,"net.uz":true,"org.uz":true,"va":true,"vc":true,"com.vc":true,"net.vc":true,"org.vc":true,"gov.vc":true,"mil.vc":true,"edu.vc":true,"ve":true,"arts.ve":true,"co.ve":true,"com.ve":true,"e12.ve":true,"edu.ve":true,"firm.ve":true,"gob.ve":true,"gov.ve":true,"info.ve":true,"int.ve":true,"mil.ve":true,"net.ve":true,"org.ve":true,"rec.ve":true,"store.ve":true,"tec.ve":true,"web.ve":true,"vg":true,"vi":true,"co.vi":true,"com.vi":true,"k12.vi":true,"net.vi":true,"org.vi":true,"vn":true,"com.vn":true,"net.vn":true,"org.vn":true,"edu.vn":true,"gov.vn":true,"int.vn":true,"ac.vn":true,"biz.vn":true,"info.vn":true,"name.vn":true,"pro.vn":true,"health.vn":true,"vu":true,"com.vu":true,"edu.vu":true,"net.vu":true,"org.vu":true,"wf":true,"ws":true,"com.ws":true,"net.ws":true,"org.ws":true,"gov.ws":true,"edu.ws":true,"yt":true,"xn--mgbaam7a8h":true,"xn--y9a3aq":true,"xn--54b7fta0cc":true,"xn--90ae":true,"xn--90ais":true,"xn--fiqs8s":true,"xn--fiqz9s":true,"xn--lgbbat1ad8j":true,"xn--wgbh1c":true,"xn--e1a4c":true,"xn--node":true,"xn--qxam":true,"xn--j6w193g":true,"xn--2scrj9c":true,"xn--3hcrj9c":true,"xn--45br5cyl":true,"xn--h2breg3eve":true,"xn--h2brj9c8c":true,"xn--mgbgu82a":true,"xn--rvc1e0am3e":true,"xn--h2brj9c":true,"xn--mgbbh1a71e":true,"xn--fpcrj9c3d":true,"xn--gecrj9c":true,"xn--s9brj9c":true,"xn--45brj9c":true,"xn--xkc2dl3a5ee0h":true,"xn--mgba3a4f16a":true,"xn--mgba3a4fra":true,"xn--mgbtx2b":true,"xn--mgbayh7gpa":true,"xn--3e0b707e":true,"xn--80ao21a":true,"xn--fzc2c9e2c":true,"xn--xkc2al3hye2a":true,"xn--mgbc0a9azcg":true,"xn--d1alf":true,"xn--l1acc":true,"xn--mix891f":true,"xn--mix082f":true,"xn--mgbx4cd0ab":true,"xn--mgb9awbf":true,"xn--mgbai9azgqp6j":true,"xn--mgbai9a5eva00b":true,"xn--ygbi2ammx":true,"xn--90a3ac":true,"xn--o1ac.xn--90a3ac":true,"xn--c1avg.xn--90a3ac":true,"xn--90azh.xn--90a3ac":true,"xn--d1at.xn--90a3ac":true,"xn--o1ach.xn--90a3ac":true,"xn--80au.xn--90a3ac":true,"xn--p1ai":true,"xn--wgbl6a":true,"xn--mgberp4a5d4ar":true,"xn--mgberp4a5d4a87g":true,"xn--mgbqly7c0a67fbc":true,"xn--mgbqly7cvafr":true,"xn--mgbpl2fh":true,"xn--yfro4i67o":true,"xn--clchc0ea0b2g2a9gcd":true,"xn--ogbpf8fl":true,"xn--mgbtf8fl":true,"xn--o3cw4h":true,"xn--12c1fe0br.xn--o3cw4h":true,"xn--12co0c3b4eva.xn--o3cw4h":true,"xn--h3cuzk1di.xn--o3cw4h":true,"xn--o3cyx2a.xn--o3cw4h":true,"xn--m3ch0j3a.xn--o3cw4h":true,"xn--12cfi8ixb8l.xn--o3cw4h":true,"xn--pgbs0dh":true,"xn--kpry57d":true,"xn--kprw13d":true,"xn--nnx388a":true,"xn--j1amh":true,"xn--mgb2ddes":true,"xxx":true,"*.ye":true,"ac.za":true,"agric.za":true,"alt.za":true,"co.za":true,"edu.za":true,"gov.za":true,"grondar.za":true,"law.za":true,"mil.za":true,"net.za":true,"ngo.za":true,"nis.za":true,"nom.za":true,"org.za":true,"school.za":true,"tm.za":true,"web.za":true,"zm":true,"ac.zm":true,"biz.zm":true,"co.zm":true,"com.zm":true,"edu.zm":true,"gov.zm":true,"info.zm":true,"mil.zm":true,"net.zm":true,"org.zm":true,"sch.zm":true,"zw":true,"ac.zw":true,"co.zw":true,"gov.zw":true,"mil.zw":true,"org.zw":true,"aaa":true,"aarp":true,"abarth":true,"abb":true,"abbott":true,"abbvie":true,"abc":true,"able":true,"abogado":true,"abudhabi":true,"academy":true,"accenture":true,"accountant":true,"accountants":true,"aco":true,"active":true,"actor":true,"adac":true,"ads":true,"adult":true,"aeg":true,"aetna":true,"afamilycompany":true,"afl":true,"africa":true,"agakhan":true,"agency":true,"aig":true,"aigo":true,"airbus":true,"airforce":true,"airtel":true,"akdn":true,"alfaromeo":true,"alibaba":true,"alipay":true,"allfinanz":true,"allstate":true,"ally":true,"alsace":true,"alstom":true,"americanexpress":true,"americanfamily":true,"amex":true,"amfam":true,"amica":true,"amsterdam":true,"analytics":true,"android":true,"anquan":true,"anz":true,"aol":true,"apartments":true,"app":true,"apple":true,"aquarelle":true,"arab":true,"aramco":true,"archi":true,"army":true,"art":true,"arte":true,"asda":true,"associates":true,"athleta":true,"attorney":true,"auction":true,"audi":true,"audible":true,"audio":true,"auspost":true,"author":true,"auto":true,"autos":true,"avianca":true,"aws":true,"axa":true,"azure":true,"baby":true,"baidu":true,"banamex":true,"bananarepublic":true,"band":true,"bank":true,"bar":true,"barcelona":true,"barclaycard":true,"barclays":true,"barefoot":true,"bargains":true,"baseball":true,"basketball":true,"bauhaus":true,"bayern":true,"bbc":true,"bbt":true,"bbva":true,"bcg":true,"bcn":true,"beats":true,"beauty":true,"beer":true,"bentley":true,"berlin":true,"best":true,"bestbuy":true,"bet":true,"bharti":true,"bible":true,"bid":true,"bike":true,"bing":true,"bingo":true,"bio":true,"black":true,"blackfriday":true,"blanco":true,"blockbuster":true,"blog":true,"bloomberg":true,"blue":true,"bms":true,"bmw":true,"bnl":true,"bnpparibas":true,"boats":true,"boehringer":true,"bofa":true,"bom":true,"bond":true,"boo":true,"book":true,"booking":true,"boots":true,"bosch":true,"bostik":true,"boston":true,"bot":true,"boutique":true,"box":true,"bradesco":true,"bridgestone":true,"broadway":true,"broker":true,"brother":true,"brussels":true,"budapest":true,"bugatti":true,"build":true,"builders":true,"business":true,"buy":true,"buzz":true,"bzh":true,"cab":true,"cafe":true,"cal":true,"call":true,"calvinklein":true,"cam":true,"camera":true,"camp":true,"cancerresearch":true,"canon":true,"capetown":true,"capital":true,"capitalone":true,"car":true,"caravan":true,"cards":true,"care":true,"career":true,"careers":true,"cars":true,"cartier":true,"casa":true,"case":true,"caseih":true,"cash":true,"casino":true,"catering":true,"catholic":true,"cba":true,"cbn":true,"cbre":true,"cbs":true,"ceb":true,"center":true,"ceo":true,"cern":true,"cfa":true,"cfd":true,"chanel":true,"channel":true,"chase":true,"chat":true,"cheap":true,"chintai":true,"christmas":true,"chrome":true,"chrysler":true,"church":true,"cipriani":true,"circle":true,"cisco":true,"citadel":true,"citi":true,"citic":true,"city":true,"cityeats":true,"claims":true,"cleaning":true,"click":true,"clinic":true,"clinique":true,"clothing":true,"cloud":true,"club":true,"clubmed":true,"coach":true,"codes":true,"coffee":true,"college":true,"cologne":true,"comcast":true,"commbank":true,"community":true,"company":true,"compare":true,"computer":true,"comsec":true,"condos":true,"construction":true,"consulting":true,"contact":true,"contractors":true,"cooking":true,"cookingchannel":true,"cool":true,"corsica":true,"country":true,"coupon":true,"coupons":true,"courses":true,"credit":true,"creditcard":true,"creditunion":true,"cricket":true,"crown":true,"crs":true,"cruise":true,"cruises":true,"csc":true,"cuisinella":true,"cymru":true,"cyou":true,"dabur":true,"dad":true,"dance":true,"data":true,"date":true,"dating":true,"datsun":true,"day":true,"dclk":true,"dds":true,"deal":true,"dealer":true,"deals":true,"degree":true,"delivery":true,"dell":true,"deloitte":true,"delta":true,"democrat":true,"dental":true,"dentist":true,"desi":true,"design":true,"dev":true,"dhl":true,"diamonds":true,"diet":true,"digital":true,"direct":true,"directory":true,"discount":true,"discover":true,"dish":true,"diy":true,"dnp":true,"docs":true,"doctor":true,"dodge":true,"dog":true,"doha":true,"domains":true,"dot":true,"download":true,"drive":true,"dtv":true,"dubai":true,"duck":true,"dunlop":true,"duns":true,"dupont":true,"durban":true,"dvag":true,"dvr":true,"earth":true,"eat":true,"eco":true,"edeka":true,"education":true,"email":true,"emerck":true,"energy":true,"engineer":true,"engineering":true,"enterprises":true,"epost":true,"epson":true,"equipment":true,"ericsson":true,"erni":true,"esq":true,"estate":true,"esurance":true,"etisalat":true,"eurovision":true,"eus":true,"events":true,"everbank":true,"exchange":true,"expert":true,"exposed":true,"express":true,"extraspace":true,"fage":true,"fail":true,"fairwinds":true,"faith":true,"family":true,"fan":true,"fans":true,"farm":true,"farmers":true,"fashion":true,"fast":true,"fedex":true,"feedback":true,"ferrari":true,"ferrero":true,"fiat":true,"fidelity":true,"fido":true,"film":true,"final":true,"finance":true,"financial":true,"fire":true,"firestone":true,"firmdale":true,"fish":true,"fishing":true,"fit":true,"fitness":true,"flickr":true,"flights":true,"flir":true,"florist":true,"flowers":true,"fly":true,"foo":true,"food":true,"foodnetwork":true,"football":true,"ford":true,"forex":true,"forsale":true,"forum":true,"foundation":true,"fox":true,"free":true,"fresenius":true,"frl":true,"frogans":true,"frontdoor":true,"frontier":true,"ftr":true,"fujitsu":true,"fujixerox":true,"fun":true,"fund":true,"furniture":true,"futbol":true,"fyi":true,"gal":true,"gallery":true,"gallo":true,"gallup":true,"game":true,"games":true,"gap":true,"garden":true,"gbiz":true,"gdn":true,"gea":true,"gent":true,"genting":true,"george":true,"ggee":true,"gift":true,"gifts":true,"gives":true,"giving":true,"glade":true,"glass":true,"gle":true,"global":true,"globo":true,"gmail":true,"gmbh":true,"gmo":true,"gmx":true,"godaddy":true,"gold":true,"goldpoint":true,"golf":true,"goo":true,"goodhands":true,"goodyear":true,"goog":true,"google":true,"gop":true,"got":true,"grainger":true,"graphics":true,"gratis":true,"green":true,"gripe":true,"grocery":true,"group":true,"guardian":true,"gucci":true,"guge":true,"guide":true,"guitars":true,"guru":true,"hair":true,"hamburg":true,"hangout":true,"haus":true,"hbo":true,"hdfc":true,"hdfcbank":true,"health":true,"healthcare":true,"help":true,"helsinki":true,"here":true,"hermes":true,"hgtv":true,"hiphop":true,"hisamitsu":true,"hitachi":true,"hiv":true,"hkt":true,"hockey":true,"holdings":true,"holiday":true,"homedepot":true,"homegoods":true,"homes":true,"homesense":true,"honda":true,"honeywell":true,"horse":true,"hospital":true,"host":true,"hosting":true,"hot":true,"hoteles":true,"hotels":true,"hotmail":true,"house":true,"how":true,"hsbc":true,"hughes":true,"hyatt":true,"hyundai":true,"ibm":true,"icbc":true,"ice":true,"icu":true,"ieee":true,"ifm":true,"ikano":true,"imamat":true,"imdb":true,"immo":true,"immobilien":true,"industries":true,"infiniti":true,"ing":true,"ink":true,"institute":true,"insurance":true,"insure":true,"intel":true,"international":true,"intuit":true,"investments":true,"ipiranga":true,"irish":true,"iselect":true,"ismaili":true,"ist":true,"istanbul":true,"itau":true,"itv":true,"iveco":true,"iwc":true,"jaguar":true,"java":true,"jcb":true,"jcp":true,"jeep":true,"jetzt":true,"jewelry":true,"jio":true,"jlc":true,"jll":true,"jmp":true,"jnj":true,"joburg":true,"jot":true,"joy":true,"jpmorgan":true,"jprs":true,"juegos":true,"juniper":true,"kaufen":true,"kddi":true,"kerryhotels":true,"kerrylogistics":true,"kerryproperties":true,"kfh":true,"kia":true,"kim":true,"kinder":true,"kindle":true,"kitchen":true,"kiwi":true,"koeln":true,"komatsu":true,"kosher":true,"kpmg":true,"kpn":true,"krd":true,"kred":true,"kuokgroup":true,"kyoto":true,"lacaixa":true,"ladbrokes":true,"lamborghini":true,"lamer":true,"lancaster":true,"lancia":true,"lancome":true,"land":true,"landrover":true,"lanxess":true,"lasalle":true,"lat":true,"latino":true,"latrobe":true,"law":true,"lawyer":true,"lds":true,"lease":true,"leclerc":true,"lefrak":true,"legal":true,"lego":true,"lexus":true,"lgbt":true,"liaison":true,"lidl":true,"life":true,"lifeinsurance":true,"lifestyle":true,"lighting":true,"like":true,"lilly":true,"limited":true,"limo":true,"lincoln":true,"linde":true,"link":true,"lipsy":true,"live":true,"living":true,"lixil":true,"loan":true,"loans":true,"locker":true,"locus":true,"loft":true,"lol":true,"london":true,"lotte":true,"lotto":true,"love":true,"lpl":true,"lplfinancial":true,"ltd":true,"ltda":true,"lundbeck":true,"lupin":true,"luxe":true,"luxury":true,"macys":true,"madrid":true,"maif":true,"maison":true,"makeup":true,"man":true,"management":true,"mango":true,"map":true,"market":true,"marketing":true,"markets":true,"marriott":true,"marshalls":true,"maserati":true,"mattel":true,"mba":true,"mckinsey":true,"med":true,"media":true,"meet":true,"melbourne":true,"meme":true,"memorial":true,"men":true,"menu":true,"meo":true,"merckmsd":true,"metlife":true,"miami":true,"microsoft":true,"mini":true,"mint":true,"mit":true,"mitsubishi":true,"mlb":true,"mls":true,"mma":true,"mobile":true,"mobily":true,"moda":true,"moe":true,"moi":true,"mom":true,"monash":true,"money":true,"monster":true,"mopar":true,"mormon":true,"mortgage":true,"moscow":true,"moto":true,"motorcycles":true,"mov":true,"movie":true,"movistar":true,"msd":true,"mtn":true,"mtpc":true,"mtr":true,"mutual":true,"nab":true,"nadex":true,"nagoya":true,"nationwide":true,"natura":true,"navy":true,"nba":true,"nec":true,"netbank":true,"netflix":true,"network":true,"neustar":true,"new":true,"newholland":true,"news":true,"next":true,"nextdirect":true,"nexus":true,"nfl":true,"ngo":true,"nhk":true,"nico":true,"nike":true,"nikon":true,"ninja":true,"nissan":true,"nissay":true,"nokia":true,"northwesternmutual":true,"norton":true,"now":true,"nowruz":true,"nowtv":true,"nra":true,"nrw":true,"ntt":true,"nyc":true,"obi":true,"observer":true,"off":true,"office":true,"okinawa":true,"olayan":true,"olayangroup":true,"oldnavy":true,"ollo":true,"omega":true,"one":true,"ong":true,"onl":true,"online":true,"onyourside":true,"ooo":true,"open":true,"oracle":true,"orange":true,"organic":true,"origins":true,"osaka":true,"otsuka":true,"ott":true,"ovh":true,"page":true,"panasonic":true,"panerai":true,"paris":true,"pars":true,"partners":true,"parts":true,"party":true,"passagens":true,"pay":true,"pccw":true,"pet":true,"pfizer":true,"pharmacy":true,"phd":true,"philips":true,"phone":true,"photo":true,"photography":true,"photos":true,"physio":true,"piaget":true,"pics":true,"pictet":true,"pictures":true,"pid":true,"pin":true,"ping":true,"pink":true,"pioneer":true,"pizza":true,"place":true,"play":true,"playstation":true,"plumbing":true,"plus":true,"pnc":true,"pohl":true,"poker":true,"politie":true,"porn":true,"pramerica":true,"praxi":true,"press":true,"prime":true,"prod":true,"productions":true,"prof":true,"progressive":true,"promo":true,"properties":true,"property":true,"protection":true,"pru":true,"prudential":true,"pub":true,"pwc":true,"qpon":true,"quebec":true,"quest":true,"qvc":true,"racing":true,"radio":true,"raid":true,"read":true,"realestate":true,"realtor":true,"realty":true,"recipes":true,"red":true,"redstone":true,"redumbrella":true,"rehab":true,"reise":true,"reisen":true,"reit":true,"reliance":true,"ren":true,"rent":true,"rentals":true,"repair":true,"report":true,"republican":true,"rest":true,"restaurant":true,"review":true,"reviews":true,"rexroth":true,"rich":true,"richardli":true,"ricoh":true,"rightathome":true,"ril":true,"rio":true,"rip":true,"rmit":true,"rocher":true,"rocks":true,"rodeo":true,"rogers":true,"room":true,"rsvp":true,"rugby":true,"ruhr":true,"run":true,"rwe":true,"ryukyu":true,"saarland":true,"safe":true,"safety":true,"sakura":true,"sale":true,"salon":true,"samsclub":true,"samsung":true,"sandvik":true,"sandvikcoromant":true,"sanofi":true,"sap":true,"sapo":true,"sarl":true,"sas":true,"save":true,"saxo":true,"sbi":true,"sbs":true,"sca":true,"scb":true,"schaeffler":true,"schmidt":true,"scholarships":true,"school":true,"schule":true,"schwarz":true,"science":true,"scjohnson":true,"scor":true,"scot":true,"search":true,"seat":true,"secure":true,"security":true,"seek":true,"select":true,"sener":true,"services":true,"ses":true,"seven":true,"sew":true,"sex":true,"sexy":true,"sfr":true,"shangrila":true,"sharp":true,"shaw":true,"shell":true,"shia":true,"shiksha":true,"shoes":true,"shop":true,"shopping":true,"shouji":true,"show":true,"showtime":true,"shriram":true,"silk":true,"sina":true,"singles":true,"site":true,"ski":true,"skin":true,"sky":true,"skype":true,"sling":true,"smart":true,"smile":true,"sncf":true,"soccer":true,"social":true,"softbank":true,"software":true,"sohu":true,"solar":true,"solutions":true,"song":true,"sony":true,"soy":true,"space":true,"spiegel":true,"spot":true,"spreadbetting":true,"srl":true,"srt":true,"stada":true,"staples":true,"star":true,"starhub":true,"statebank":true,"statefarm":true,"statoil":true,"stc":true,"stcgroup":true,"stockholm":true,"storage":true,"store":true,"stream":true,"studio":true,"study":true,"style":true,"sucks":true,"supplies":true,"supply":true,"support":true,"surf":true,"surgery":true,"suzuki":true,"swatch":true,"swiftcover":true,"swiss":true,"sydney":true,"symantec":true,"systems":true,"tab":true,"taipei":true,"talk":true,"taobao":true,"target":true,"tatamotors":true,"tatar":true,"tattoo":true,"tax":true,"taxi":true,"tci":true,"tdk":true,"team":true,"tech":true,"technology":true,"telecity":true,"telefonica":true,"temasek":true,"tennis":true,"teva":true,"thd":true,"theater":true,"theatre":true,"tiaa":true,"tickets":true,"tienda":true,"tiffany":true,"tips":true,"tires":true,"tirol":true,"tjmaxx":true,"tjx":true,"tkmaxx":true,"tmall":true,"today":true,"tokyo":true,"tools":true,"top":true,"toray":true,"toshiba":true,"total":true,"tours":true,"town":true,"toyota":true,"toys":true,"trade":true,"trading":true,"training":true,"travelchannel":true,"travelers":true,"travelersinsurance":true,"trust":true,"trv":true,"tube":true,"tui":true,"tunes":true,"tushu":true,"tvs":true,"ubank":true,"ubs":true,"uconnect":true,"unicom":true,"university":true,"uno":true,"uol":true,"ups":true,"vacations":true,"vana":true,"vanguard":true,"vegas":true,"ventures":true,"verisign":true,"versicherung":true,"vet":true,"viajes":true,"video":true,"vig":true,"viking":true,"villas":true,"vin":true,"vip":true,"virgin":true,"visa":true,"vision":true,"vista":true,"vistaprint":true,"viva":true,"vivo":true,"vlaanderen":true,"vodka":true,"volkswagen":true,"volvo":true,"vote":true,"voting":true,"voto":true,"voyage":true,"vuelos":true,"wales":true,"walmart":true,"walter":true,"wang":true,"wanggou":true,"warman":true,"watch":true,"watches":true,"weather":true,"weatherchannel":true,"webcam":true,"weber":true,"website":true,"wed":true,"wedding":true,"weibo":true,"weir":true,"whoswho":true,"wien":true,"wiki":true,"williamhill":true,"win":true,"windows":true,"wine":true,"winners":true,"wme":true,"wolterskluwer":true,"woodside":true,"work":true,"works":true,"world":true,"wow":true,"wtc":true,"wtf":true,"xbox":true,"xerox":true,"xfinity":true,"xihuan":true,"xin":true,"xn--11b4c3d":true,"xn--1ck2e1b":true,"xn--1qqw23a":true,"xn--30rr7y":true,"xn--3bst00m":true,"xn--3ds443g":true,"xn--3oq18vl8pn36a":true,"xn--3pxu8k":true,"xn--42c2d9a":true,"xn--45q11c":true,"xn--4gbrim":true,"xn--55qw42g":true,"xn--55qx5d":true,"xn--5su34j936bgsg":true,"xn--5tzm5g":true,"xn--6frz82g":true,"xn--6qq986b3xl":true,"xn--80adxhks":true,"xn--80aqecdr1a":true,"xn--80asehdb":true,"xn--80aswg":true,"xn--8y0a063a":true,"xn--9dbq2a":true,"xn--9et52u":true,"xn--9krt00a":true,"xn--b4w605ferd":true,"xn--bck1b9a5dre4c":true,"xn--c1avg":true,"xn--c2br7g":true,"xn--cck2b3b":true,"xn--cg4bki":true,"xn--czr694b":true,"xn--czrs0t":true,"xn--czru2d":true,"xn--d1acj3b":true,"xn--eckvdtc9d":true,"xn--efvy88h":true,"xn--estv75g":true,"xn--fct429k":true,"xn--fhbei":true,"xn--fiq228c5hs":true,"xn--fiq64b":true,"xn--fjq720a":true,"xn--flw351e":true,"xn--fzys8d69uvgm":true,"xn--g2xx48c":true,"xn--gckr3f0f":true,"xn--gk3at1e":true,"xn--hxt814e":true,"xn--i1b6b1a6a2e":true,"xn--imr513n":true,"xn--io0a7i":true,"xn--j1aef":true,"xn--jlq61u9w7b":true,"xn--jvr189m":true,"xn--kcrx77d1x4a":true,"xn--kpu716f":true,"xn--kput3i":true,"xn--mgba3a3ejt":true,"xn--mgba7c0bbn0a":true,"xn--mgbaakc7dvf":true,"xn--mgbab2bd":true,"xn--mgbb9fbpob":true,"xn--mgbca7dzdo":true,"xn--mgbi4ecexp":true,"xn--mgbt3dhd":true,"xn--mk1bu44c":true,"xn--mxtq1m":true,"xn--ngbc5azd":true,"xn--ngbe9e0a":true,"xn--ngbrx":true,"xn--nqv7f":true,"xn--nqv7fs00ema":true,"xn--nyqy26a":true,"xn--p1acf":true,"xn--pbt977c":true,"xn--pssy2u":true,"xn--q9jyb4c":true,"xn--qcka1pmc":true,"xn--rhqv96g":true,"xn--rovu88b":true,"xn--ses554g":true,"xn--t60b56a":true,"xn--tckwe":true,"xn--tiq49xqyj":true,"xn--unup4y":true,"xn--vermgensberater-ctb":true,"xn--vermgensberatung-pwb":true,"xn--vhquv":true,"xn--vuq861b":true,"xn--w4r85el8fhu5dnra":true,"xn--w4rs40l":true,"xn--xhq521b":true,"xn--zfr164b":true,"xperia":true,"xyz":true,"yachts":true,"yahoo":true,"yamaxun":true,"yandex":true,"yodobashi":true,"yoga":true,"yokohama":true,"you":true,"youtube":true,"yun":true,"zappos":true,"zara":true,"zero":true,"zip":true,"zippo":true,"zone":true,"zuerich":true,"cc.ua":true,"inf.ua":true,"ltd.ua":true,"1password.ca":true,"1password.com":true,"1password.eu":true,"beep.pl":true,"*.compute.estate":true,"*.alces.network":true,"alwaysdata.net":true,"cloudfront.net":true,"*.compute.amazonaws.com":true,"*.compute-1.amazonaws.com":true,"*.compute.amazonaws.com.cn":true,"us-east-1.amazonaws.com":true,"cn-north-1.eb.amazonaws.com.cn":true,"elasticbeanstalk.com":true,"ap-northeast-1.elasticbeanstalk.com":true,"ap-northeast-2.elasticbeanstalk.com":true,"ap-south-1.elasticbeanstalk.com":true,"ap-southeast-1.elasticbeanstalk.com":true,"ap-southeast-2.elasticbeanstalk.com":true,"ca-central-1.elasticbeanstalk.com":true,"eu-central-1.elasticbeanstalk.com":true,"eu-west-1.elasticbeanstalk.com":true,"eu-west-2.elasticbeanstalk.com":true,"eu-west-3.elasticbeanstalk.com":true,"sa-east-1.elasticbeanstalk.com":true,"us-east-1.elasticbeanstalk.com":true,"us-east-2.elasticbeanstalk.com":true,"us-gov-west-1.elasticbeanstalk.com":true,"us-west-1.elasticbeanstalk.com":true,"us-west-2.elasticbeanstalk.com":true,"*.elb.amazonaws.com":true,"*.elb.amazonaws.com.cn":true,"s3.amazonaws.com":true,"s3-ap-northeast-1.amazonaws.com":true,"s3-ap-northeast-2.amazonaws.com":true,"s3-ap-south-1.amazonaws.com":true,"s3-ap-southeast-1.amazonaws.com":true,"s3-ap-southeast-2.amazonaws.com":true,"s3-ca-central-1.amazonaws.com":true,"s3-eu-central-1.amazonaws.com":true,"s3-eu-west-1.amazonaws.com":true,"s3-eu-west-2.amazonaws.com":true,"s3-eu-west-3.amazonaws.com":true,"s3-external-1.amazonaws.com":true,"s3-fips-us-gov-west-1.amazonaws.com":true,"s3-sa-east-1.amazonaws.com":true,"s3-us-gov-west-1.amazonaws.com":true,"s3-us-east-2.amazonaws.com":true,"s3-us-west-1.amazonaws.com":true,"s3-us-west-2.amazonaws.com":true,"s3.ap-northeast-2.amazonaws.com":true,"s3.ap-south-1.amazonaws.com":true,"s3.cn-north-1.amazonaws.com.cn":true,"s3.ca-central-1.amazonaws.com":true,"s3.eu-central-1.amazonaws.com":true,"s3.eu-west-2.amazonaws.com":true,"s3.eu-west-3.amazonaws.com":true,"s3.us-east-2.amazonaws.com":true,"s3.dualstack.ap-northeast-1.amazonaws.com":true,"s3.dualstack.ap-northeast-2.amazonaws.com":true,"s3.dualstack.ap-south-1.amazonaws.com":true,"s3.dualstack.ap-southeast-1.amazonaws.com":true,"s3.dualstack.ap-southeast-2.amazonaws.com":true,"s3.dualstack.ca-central-1.amazonaws.com":true,"s3.dualstack.eu-central-1.amazonaws.com":true,"s3.dualstack.eu-west-1.amazonaws.com":true,"s3.dualstack.eu-west-2.amazonaws.com":true,"s3.dualstack.eu-west-3.amazonaws.com":true,"s3.dualstack.sa-east-1.amazonaws.com":true,"s3.dualstack.us-east-1.amazonaws.com":true,"s3.dualstack.us-east-2.amazonaws.com":true,"s3-website-us-east-1.amazonaws.com":true,"s3-website-us-west-1.amazonaws.com":true,"s3-website-us-west-2.amazonaws.com":true,"s3-website-ap-northeast-1.amazonaws.com":true,"s3-website-ap-southeast-1.amazonaws.com":true,"s3-website-ap-southeast-2.amazonaws.com":true,"s3-website-eu-west-1.amazonaws.com":true,"s3-website-sa-east-1.amazonaws.com":true,"s3-website.ap-northeast-2.amazonaws.com":true,"s3-website.ap-south-1.amazonaws.com":true,"s3-website.ca-central-1.amazonaws.com":true,"s3-website.eu-central-1.amazonaws.com":true,"s3-website.eu-west-2.amazonaws.com":true,"s3-website.eu-west-3.amazonaws.com":true,"s3-website.us-east-2.amazonaws.com":true,"t3l3p0rt.net":true,"tele.amune.org":true,"on-aptible.com":true,"user.party.eus":true,"pimienta.org":true,"poivron.org":true,"potager.org":true,"sweetpepper.org":true,"myasustor.com":true,"myfritz.net":true,"*.awdev.ca":true,"*.advisor.ws":true,"backplaneapp.io":true,"betainabox.com":true,"bnr.la":true,"boomla.net":true,"boxfuse.io":true,"square7.ch":true,"bplaced.com":true,"bplaced.de":true,"square7.de":true,"bplaced.net":true,"square7.net":true,"browsersafetymark.io":true,"mycd.eu":true,"ae.org":true,"ar.com":true,"br.com":true,"cn.com":true,"com.de":true,"com.se":true,"de.com":true,"eu.com":true,"gb.com":true,"gb.net":true,"hu.com":true,"hu.net":true,"jp.net":true,"jpn.com":true,"kr.com":true,"mex.com":true,"no.com":true,"qc.com":true,"ru.com":true,"sa.com":true,"se.com":true,"se.net":true,"uk.com":true,"uk.net":true,"us.com":true,"uy.com":true,"za.bz":true,"za.com":true,"africa.com":true,"gr.com":true,"in.net":true,"us.org":true,"co.com":true,"c.la":true,"certmgr.org":true,"xenapponazure.com":true,"virtueeldomein.nl":true,"c66.me":true,"cloud66.ws":true,"jdevcloud.com":true,"wpdevcloud.com":true,"cloudaccess.host":true,"freesite.host":true,"cloudaccess.net":true,"cloudcontrolled.com":true,"cloudcontrolapp.com":true,"co.ca":true,"co.cz":true,"c.cdn77.org":true,"cdn77-ssl.net":true,"r.cdn77.net":true,"rsc.cdn77.org":true,"ssl.origin.cdn77-secure.org":true,"cloudns.asia":true,"cloudns.biz":true,"cloudns.club":true,"cloudns.cc":true,"cloudns.eu":true,"cloudns.in":true,"cloudns.info":true,"cloudns.org":true,"cloudns.pro":true,"cloudns.pw":true,"cloudns.us":true,"co.nl":true,"co.no":true,"webhosting.be":true,"hosting-cluster.nl":true,"dyn.cosidns.de":true,"dynamisches-dns.de":true,"dnsupdater.de":true,"internet-dns.de":true,"l-o-g-i-n.de":true,"dynamic-dns.info":true,"feste-ip.net":true,"knx-server.net":true,"static-access.net":true,"realm.cz":true,"*.cryptonomic.net":true,"cupcake.is":true,"cyon.link":true,"cyon.site":true,"daplie.me":true,"localhost.daplie.me":true,"biz.dk":true,"co.dk":true,"firm.dk":true,"reg.dk":true,"store.dk":true,"debian.net":true,"dedyn.io":true,"dnshome.de":true,"drayddns.com":true,"dreamhosters.com":true,"mydrobo.com":true,"drud.io":true,"drud.us":true,"duckdns.org":true,"dy.fi":true,"tunk.org":true,"dyndns-at-home.com":true,"dyndns-at-work.com":true,"dyndns-blog.com":true,"dyndns-free.com":true,"dyndns-home.com":true,"dyndns-ip.com":true,"dyndns-mail.com":true,"dyndns-office.com":true,"dyndns-pics.com":true,"dyndns-remote.com":true,"dyndns-server.com":true,"dyndns-web.com":true,"dyndns-wiki.com":true,"dyndns-work.com":true,"dyndns.biz":true,"dyndns.info":true,"dyndns.org":true,"dyndns.tv":true,"at-band-camp.net":true,"ath.cx":true,"barrel-of-knowledge.info":true,"barrell-of-knowledge.info":true,"better-than.tv":true,"blogdns.com":true,"blogdns.net":true,"blogdns.org":true,"blogsite.org":true,"boldlygoingnowhere.org":true,"broke-it.net":true,"buyshouses.net":true,"cechire.com":true,"dnsalias.com":true,"dnsalias.net":true,"dnsalias.org":true,"dnsdojo.com":true,"dnsdojo.net":true,"dnsdojo.org":true,"does-it.net":true,"doesntexist.com":true,"doesntexist.org":true,"dontexist.com":true,"dontexist.net":true,"dontexist.org":true,"doomdns.com":true,"doomdns.org":true,"dvrdns.org":true,"dyn-o-saur.com":true,"dynalias.com":true,"dynalias.net":true,"dynalias.org":true,"dynathome.net":true,"dyndns.ws":true,"endofinternet.net":true,"endofinternet.org":true,"endoftheinternet.org":true,"est-a-la-maison.com":true,"est-a-la-masion.com":true,"est-le-patron.com":true,"est-mon-blogueur.com":true,"for-better.biz":true,"for-more.biz":true,"for-our.info":true,"for-some.biz":true,"for-the.biz":true,"forgot.her.name":true,"forgot.his.name":true,"from-ak.com":true,"from-al.com":true,"from-ar.com":true,"from-az.net":true,"from-ca.com":true,"from-co.net":true,"from-ct.com":true,"from-dc.com":true,"from-de.com":true,"from-fl.com":true,"from-ga.com":true,"from-hi.com":true,"from-ia.com":true,"from-id.com":true,"from-il.com":true,"from-in.com":true,"from-ks.com":true,"from-ky.com":true,"from-la.net":true,"from-ma.com":true,"from-md.com":true,"from-me.org":true,"from-mi.com":true,"from-mn.com":true,"from-mo.com":true,"from-ms.com":true,"from-mt.com":true,"from-nc.com":true,"from-nd.com":true,"from-ne.com":true,"from-nh.com":true,"from-nj.com":true,"from-nm.com":true,"from-nv.com":true,"from-ny.net":true,"from-oh.com":true,"from-ok.com":true,"from-or.com":true,"from-pa.com":true,"from-pr.com":true,"from-ri.com":true,"from-sc.com":true,"from-sd.com":true,"from-tn.com":true,"from-tx.com":true,"from-ut.com":true,"from-va.com":true,"from-vt.com":true,"from-wa.com":true,"from-wi.com":true,"from-wv.com":true,"from-wy.com":true,"ftpaccess.cc":true,"fuettertdasnetz.de":true,"game-host.org":true,"game-server.cc":true,"getmyip.com":true,"gets-it.net":true,"go.dyndns.org":true,"gotdns.com":true,"gotdns.org":true,"groks-the.info":true,"groks-this.info":true,"ham-radio-op.net":true,"here-for-more.info":true,"hobby-site.com":true,"hobby-site.org":true,"home.dyndns.org":true,"homedns.org":true,"homeftp.net":true,"homeftp.org":true,"homeip.net":true,"homelinux.com":true,"homelinux.net":true,"homelinux.org":true,"homeunix.com":true,"homeunix.net":true,"homeunix.org":true,"iamallama.com":true,"in-the-band.net":true,"is-a-anarchist.com":true,"is-a-blogger.com":true,"is-a-bookkeeper.com":true,"is-a-bruinsfan.org":true,"is-a-bulls-fan.com":true,"is-a-candidate.org":true,"is-a-caterer.com":true,"is-a-celticsfan.org":true,"is-a-chef.com":true,"is-a-chef.net":true,"is-a-chef.org":true,"is-a-conservative.com":true,"is-a-cpa.com":true,"is-a-cubicle-slave.com":true,"is-a-democrat.com":true,"is-a-designer.com":true,"is-a-doctor.com":true,"is-a-financialadvisor.com":true,"is-a-geek.com":true,"is-a-geek.net":true,"is-a-geek.org":true,"is-a-green.com":true,"is-a-guru.com":true,"is-a-hard-worker.com":true,"is-a-hunter.com":true,"is-a-knight.org":true,"is-a-landscaper.com":true,"is-a-lawyer.com":true,"is-a-liberal.com":true,"is-a-libertarian.com":true,"is-a-linux-user.org":true,"is-a-llama.com":true,"is-a-musician.com":true,"is-a-nascarfan.com":true,"is-a-nurse.com":true,"is-a-painter.com":true,"is-a-patsfan.org":true,"is-a-personaltrainer.com":true,"is-a-photographer.com":true,"is-a-player.com":true,"is-a-republican.com":true,"is-a-rockstar.com":true,"is-a-socialist.com":true,"is-a-soxfan.org":true,"is-a-student.com":true,"is-a-teacher.com":true,"is-a-techie.com":true,"is-a-therapist.com":true,"is-an-accountant.com":true,"is-an-actor.com":true,"is-an-actress.com":true,"is-an-anarchist.com":true,"is-an-artist.com":true,"is-an-engineer.com":true,"is-an-entertainer.com":true,"is-by.us":true,"is-certified.com":true,"is-found.org":true,"is-gone.com":true,"is-into-anime.com":true,"is-into-cars.com":true,"is-into-cartoons.com":true,"is-into-games.com":true,"is-leet.com":true,"is-lost.org":true,"is-not-certified.com":true,"is-saved.org":true,"is-slick.com":true,"is-uberleet.com":true,"is-very-bad.org":true,"is-very-evil.org":true,"is-very-good.org":true,"is-very-nice.org":true,"is-very-sweet.org":true,"is-with-theband.com":true,"isa-geek.com":true,"isa-geek.net":true,"isa-geek.org":true,"isa-hockeynut.com":true,"issmarterthanyou.com":true,"isteingeek.de":true,"istmein.de":true,"kicks-ass.net":true,"kicks-ass.org":true,"knowsitall.info":true,"land-4-sale.us":true,"lebtimnetz.de":true,"leitungsen.de":true,"likes-pie.com":true,"likescandy.com":true,"merseine.nu":true,"mine.nu":true,"misconfused.org":true,"mypets.ws":true,"myphotos.cc":true,"neat-url.com":true,"office-on-the.net":true,"on-the-web.tv":true,"podzone.net":true,"podzone.org":true,"readmyblog.org":true,"saves-the-whales.com":true,"scrapper-site.net":true,"scrapping.cc":true,"selfip.biz":true,"selfip.com":true,"selfip.info":true,"selfip.net":true,"selfip.org":true,"sells-for-less.com":true,"sells-for-u.com":true,"sells-it.net":true,"sellsyourhome.org":true,"servebbs.com":true,"servebbs.net":true,"servebbs.org":true,"serveftp.net":true,"serveftp.org":true,"servegame.org":true,"shacknet.nu":true,"simple-url.com":true,"space-to-rent.com":true,"stuff-4-sale.org":true,"stuff-4-sale.us":true,"teaches-yoga.com":true,"thruhere.net":true,"traeumtgerade.de":true,"webhop.biz":true,"webhop.info":true,"webhop.net":true,"webhop.org":true,"worse-than.tv":true,"writesthisblog.com":true,"ddnss.de":true,"dyn.ddnss.de":true,"dyndns.ddnss.de":true,"dyndns1.de":true,"dyn-ip24.de":true,"home-webserver.de":true,"dyn.home-webserver.de":true,"myhome-server.de":true,"ddnss.org":true,"definima.net":true,"definima.io":true,"ddnsfree.com":true,"ddnsgeek.com":true,"giize.com":true,"gleeze.com":true,"kozow.com":true,"loseyourip.com":true,"ooguy.com":true,"theworkpc.com":true,"casacam.net":true,"dynu.net":true,"accesscam.org":true,"camdvr.org":true,"freeddns.org":true,"mywire.org":true,"webredirect.org":true,"myddns.rocks":true,"blogsite.xyz":true,"dynv6.net":true,"e4.cz":true,"mytuleap.com":true,"enonic.io":true,"customer.enonic.io":true,"eu.org":true,"al.eu.org":true,"asso.eu.org":true,"at.eu.org":true,"au.eu.org":true,"be.eu.org":true,"bg.eu.org":true,"ca.eu.org":true,"cd.eu.org":true,"ch.eu.org":true,"cn.eu.org":true,"cy.eu.org":true,"cz.eu.org":true,"de.eu.org":true,"dk.eu.org":true,"edu.eu.org":true,"ee.eu.org":true,"es.eu.org":true,"fi.eu.org":true,"fr.eu.org":true,"gr.eu.org":true,"hr.eu.org":true,"hu.eu.org":true,"ie.eu.org":true,"il.eu.org":true,"in.eu.org":true,"int.eu.org":true,"is.eu.org":true,"it.eu.org":true,"jp.eu.org":true,"kr.eu.org":true,"lt.eu.org":true,"lu.eu.org":true,"lv.eu.org":true,"mc.eu.org":true,"me.eu.org":true,"mk.eu.org":true,"mt.eu.org":true,"my.eu.org":true,"net.eu.org":true,"ng.eu.org":true,"nl.eu.org":true,"no.eu.org":true,"nz.eu.org":true,"paris.eu.org":true,"pl.eu.org":true,"pt.eu.org":true,"q-a.eu.org":true,"ro.eu.org":true,"ru.eu.org":true,"se.eu.org":true,"si.eu.org":true,"sk.eu.org":true,"tr.eu.org":true,"uk.eu.org":true,"us.eu.org":true,"eu-1.evennode.com":true,"eu-2.evennode.com":true,"eu-3.evennode.com":true,"eu-4.evennode.com":true,"us-1.evennode.com":true,"us-2.evennode.com":true,"us-3.evennode.com":true,"us-4.evennode.com":true,"twmail.cc":true,"twmail.net":true,"twmail.org":true,"mymailer.com.tw":true,"url.tw":true,"apps.fbsbx.com":true,"ru.net":true,"adygeya.ru":true,"bashkiria.ru":true,"bir.ru":true,"cbg.ru":true,"com.ru":true,"dagestan.ru":true,"grozny.ru":true,"kalmykia.ru":true,"kustanai.ru":true,"marine.ru":true,"mordovia.ru":true,"msk.ru":true,"mytis.ru":true,"nalchik.ru":true,"nov.ru":true,"pyatigorsk.ru":true,"spb.ru":true,"vladikavkaz.ru":true,"vladimir.ru":true,"abkhazia.su":true,"adygeya.su":true,"aktyubinsk.su":true,"arkhangelsk.su":true,"armenia.su":true,"ashgabad.su":true,"azerbaijan.su":true,"balashov.su":true,"bashkiria.su":true,"bryansk.su":true,"bukhara.su":true,"chimkent.su":true,"dagestan.su":true,"east-kazakhstan.su":true,"exnet.su":true,"georgia.su":true,"grozny.su":true,"ivanovo.su":true,"jambyl.su":true,"kalmykia.su":true,"kaluga.su":true,"karacol.su":true,"karaganda.su":true,"karelia.su":true,"khakassia.su":true,"krasnodar.su":true,"kurgan.su":true,"kustanai.su":true,"lenug.su":true,"mangyshlak.su":true,"mordovia.su":true,"msk.su":true,"murmansk.su":true,"nalchik.su":true,"navoi.su":true,"north-kazakhstan.su":true,"nov.su":true,"obninsk.su":true,"penza.su":true,"pokrovsk.su":true,"sochi.su":true,"spb.su":true,"tashkent.su":true,"termez.su":true,"togliatti.su":true,"troitsk.su":true,"tselinograd.su":true,"tula.su":true,"tuva.su":true,"vladikavkaz.su":true,"vladimir.su":true,"vologda.su":true,"channelsdvr.net":true,"fastlylb.net":true,"map.fastlylb.net":true,"freetls.fastly.net":true,"map.fastly.net":true,"a.prod.fastly.net":true,"global.prod.fastly.net":true,"a.ssl.fastly.net":true,"b.ssl.fastly.net":true,"global.ssl.fastly.net":true,"fhapp.xyz":true,"fedorainfracloud.org":true,"fedorapeople.org":true,"cloud.fedoraproject.org":true,"app.os.fedoraproject.org":true,"app.os.stg.fedoraproject.org":true,"filegear.me":true,"firebaseapp.com":true,"flynnhub.com":true,"flynnhosting.net":true,"freebox-os.com":true,"freeboxos.com":true,"fbx-os.fr":true,"fbxos.fr":true,"freebox-os.fr":true,"freeboxos.fr":true,"*.futurecms.at":true,"futurehosting.at":true,"futuremailing.at":true,"*.ex.ortsinfo.at":true,"*.kunden.ortsinfo.at":true,"*.statics.cloud":true,"service.gov.uk":true,"github.io":true,"githubusercontent.com":true,"gitlab.io":true,"homeoffice.gov.uk":true,"ro.im":true,"shop.ro":true,"goip.de":true,"*.0emm.com":true,"appspot.com":true,"blogspot.ae":true,"blogspot.al":true,"blogspot.am":true,"blogspot.ba":true,"blogspot.be":true,"blogspot.bg":true,"blogspot.bj":true,"blogspot.ca":true,"blogspot.cf":true,"blogspot.ch":true,"blogspot.cl":true,"blogspot.co.at":true,"blogspot.co.id":true,"blogspot.co.il":true,"blogspot.co.ke":true,"blogspot.co.nz":true,"blogspot.co.uk":true,"blogspot.co.za":true,"blogspot.com":true,"blogspot.com.ar":true,"blogspot.com.au":true,"blogspot.com.br":true,"blogspot.com.by":true,"blogspot.com.co":true,"blogspot.com.cy":true,"blogspot.com.ee":true,"blogspot.com.eg":true,"blogspot.com.es":true,"blogspot.com.mt":true,"blogspot.com.ng":true,"blogspot.com.tr":true,"blogspot.com.uy":true,"blogspot.cv":true,"blogspot.cz":true,"blogspot.de":true,"blogspot.dk":true,"blogspot.fi":true,"blogspot.fr":true,"blogspot.gr":true,"blogspot.hk":true,"blogspot.hr":true,"blogspot.hu":true,"blogspot.ie":true,"blogspot.in":true,"blogspot.is":true,"blogspot.it":true,"blogspot.jp":true,"blogspot.kr":true,"blogspot.li":true,"blogspot.lt":true,"blogspot.lu":true,"blogspot.md":true,"blogspot.mk":true,"blogspot.mr":true,"blogspot.mx":true,"blogspot.my":true,"blogspot.nl":true,"blogspot.no":true,"blogspot.pe":true,"blogspot.pt":true,"blogspot.qa":true,"blogspot.re":true,"blogspot.ro":true,"blogspot.rs":true,"blogspot.ru":true,"blogspot.se":true,"blogspot.sg":true,"blogspot.si":true,"blogspot.sk":true,"blogspot.sn":true,"blogspot.td":true,"blogspot.tw":true,"blogspot.ug":true,"blogspot.vn":true,"cloudfunctions.net":true,"cloud.goog":true,"codespot.com":true,"googleapis.com":true,"googlecode.com":true,"pagespeedmobilizer.com":true,"publishproxy.com":true,"withgoogle.com":true,"withyoutube.com":true,"hashbang.sh":true,"hasura-app.io":true,"hepforge.org":true,"herokuapp.com":true,"herokussl.com":true,"moonscale.net":true,"iki.fi":true,"biz.at":true,"info.at":true,"info.cx":true,"ac.leg.br":true,"al.leg.br":true,"am.leg.br":true,"ap.leg.br":true,"ba.leg.br":true,"ce.leg.br":true,"df.leg.br":true,"es.leg.br":true,"go.leg.br":true,"ma.leg.br":true,"mg.leg.br":true,"ms.leg.br":true,"mt.leg.br":true,"pa.leg.br":true,"pb.leg.br":true,"pe.leg.br":true,"pi.leg.br":true,"pr.leg.br":true,"rj.leg.br":true,"rn.leg.br":true,"ro.leg.br":true,"rr.leg.br":true,"rs.leg.br":true,"sc.leg.br":true,"se.leg.br":true,"sp.leg.br":true,"to.leg.br":true,"pixolino.com":true,"ipifony.net":true,"*.triton.zone":true,"*.cns.joyent.com":true,"js.org":true,"keymachine.de":true,"knightpoint.systems":true,"co.krd":true,"edu.krd":true,"git-repos.de":true,"lcube-server.de":true,"svn-repos.de":true,"linkyard.cloud":true,"linkyard-cloud.ch":true,"we.bs":true,"barsy.bg":true,"barsyonline.com":true,"barsy.de":true,"barsy.eu":true,"barsy.in":true,"barsy.net":true,"barsy.online":true,"barsy.support":true,"*.magentosite.cloud":true,"hb.cldmail.ru":true,"cloud.metacentrum.cz":true,"custom.metacentrum.cz":true,"meteorapp.com":true,"eu.meteorapp.com":true,"co.pl":true,"azurewebsites.net":true,"azure-mobile.net":true,"cloudapp.net":true,"mozilla-iot.org":true,"bmoattachments.org":true,"net.ru":true,"org.ru":true,"pp.ru":true,"bitballoon.com":true,"netlify.com":true,"4u.com":true,"ngrok.io":true,"nh-serv.co.uk":true,"nfshost.com":true,"nsupdate.info":true,"nerdpol.ovh":true,"blogsyte.com":true,"brasilia.me":true,"cable-modem.org":true,"ciscofreak.com":true,"collegefan.org":true,"couchpotatofries.org":true,"damnserver.com":true,"ddns.me":true,"ditchyourip.com":true,"dnsfor.me":true,"dnsiskinky.com":true,"dvrcam.info":true,"dynns.com":true,"eating-organic.net":true,"fantasyleague.cc":true,"geekgalaxy.com":true,"golffan.us":true,"health-carereform.com":true,"homesecuritymac.com":true,"homesecuritypc.com":true,"hopto.me":true,"ilovecollege.info":true,"loginto.me":true,"mlbfan.org":true,"mmafan.biz":true,"myactivedirectory.com":true,"mydissent.net":true,"myeffect.net":true,"mymediapc.net":true,"mypsx.net":true,"mysecuritycamera.com":true,"mysecuritycamera.net":true,"mysecuritycamera.org":true,"net-freaks.com":true,"nflfan.org":true,"nhlfan.net":true,"no-ip.ca":true,"no-ip.co.uk":true,"no-ip.net":true,"noip.us":true,"onthewifi.com":true,"pgafan.net":true,"point2this.com":true,"pointto.us":true,"privatizehealthinsurance.net":true,"quicksytes.com":true,"read-books.org":true,"securitytactics.com":true,"serveexchange.com":true,"servehumour.com":true,"servep2p.com":true,"servesarcasm.com":true,"stufftoread.com":true,"ufcfan.org":true,"unusualperson.com":true,"workisboring.com":true,"3utilities.com":true,"bounceme.net":true,"ddns.net":true,"ddnsking.com":true,"gotdns.ch":true,"hopto.org":true,"myftp.biz":true,"myftp.org":true,"myvnc.com":true,"no-ip.biz":true,"no-ip.info":true,"no-ip.org":true,"noip.me":true,"redirectme.net":true,"servebeer.com":true,"serveblog.net":true,"servecounterstrike.com":true,"serveftp.com":true,"servegame.com":true,"servehalflife.com":true,"servehttp.com":true,"serveirc.com":true,"serveminecraft.net":true,"servemp3.com":true,"servepics.com":true,"servequake.com":true,"sytes.net":true,"webhop.me":true,"zapto.org":true,"stage.nodeart.io":true,"nodum.co":true,"nodum.io":true,"nyc.mn":true,"nom.ae":true,"nom.ai":true,"nom.al":true,"nym.by":true,"nym.bz":true,"nom.cl":true,"nom.gd":true,"nom.gl":true,"nym.gr":true,"nom.gt":true,"nom.hn":true,"nom.im":true,"nym.kz":true,"nym.la":true,"nom.li":true,"nym.li":true,"nym.lt":true,"nym.lu":true,"nym.me":true,"nom.mk":true,"nym.mx":true,"nom.nu":true,"nym.nz":true,"nym.pe":true,"nym.pt":true,"nom.pw":true,"nom.qa":true,"nom.rs":true,"nom.si":true,"nym.sk":true,"nym.su":true,"nym.sx":true,"nym.tw":true,"nom.ug":true,"nom.uy":true,"nom.vc":true,"nom.vg":true,"cya.gg":true,"nid.io":true,"opencraft.hosting":true,"operaunite.com":true,"outsystemscloud.com":true,"ownprovider.com":true,"oy.lc":true,"pgfog.com":true,"pagefrontapp.com":true,"art.pl":true,"gliwice.pl":true,"krakow.pl":true,"poznan.pl":true,"wroc.pl":true,"zakopane.pl":true,"pantheonsite.io":true,"gotpantheon.com":true,"mypep.link":true,"on-web.fr":true,"*.platform.sh":true,"*.platformsh.site":true,"xen.prgmr.com":true,"priv.at":true,"protonet.io":true,"chirurgiens-dentistes-en-france.fr":true,"byen.site":true,"qa2.com":true,"dev-myqnapcloud.com":true,"alpha-myqnapcloud.com":true,"myqnapcloud.com":true,"*.quipelements.com":true,"vapor.cloud":true,"vaporcloud.io":true,"rackmaze.com":true,"rackmaze.net":true,"rhcloud.com":true,"resindevice.io":true,"devices.resinstaging.io":true,"hzc.io":true,"wellbeingzone.eu":true,"ptplus.fit":true,"wellbeingzone.co.uk":true,"sandcats.io":true,"logoip.de":true,"logoip.com":true,"schokokeks.net":true,"scrysec.com":true,"firewall-gateway.com":true,"firewall-gateway.de":true,"my-gateway.de":true,"my-router.de":true,"spdns.de":true,"spdns.eu":true,"firewall-gateway.net":true,"my-firewall.org":true,"myfirewall.org":true,"spdns.org":true,"*.s5y.io":true,"*.sensiosite.cloud":true,"biz.ua":true,"co.ua":true,"pp.ua":true,"shiftedit.io":true,"myshopblocks.com":true,"1kapp.com":true,"appchizi.com":true,"applinzi.com":true,"sinaapp.com":true,"vipsinaapp.com":true,"bounty-full.com":true,"alpha.bounty-full.com":true,"beta.bounty-full.com":true,"static.land":true,"dev.static.land":true,"sites.static.land":true,"apps.lair.io":true,"*.stolos.io":true,"spacekit.io":true,"stackspace.space":true,"storj.farm":true,"temp-dns.com":true,"diskstation.me":true,"dscloud.biz":true,"dscloud.me":true,"dscloud.mobi":true,"dsmynas.com":true,"dsmynas.net":true,"dsmynas.org":true,"familyds.com":true,"familyds.net":true,"familyds.org":true,"i234.me":true,"myds.me":true,"synology.me":true,"vpnplus.to":true,"taifun-dns.de":true,"gda.pl":true,"gdansk.pl":true,"gdynia.pl":true,"med.pl":true,"sopot.pl":true,"cust.dev.thingdust.io":true,"cust.disrec.thingdust.io":true,"cust.prod.thingdust.io":true,"cust.testing.thingdust.io":true,"bloxcms.com":true,"townnews-staging.com":true,"12hp.at":true,"2ix.at":true,"4lima.at":true,"lima-city.at":true,"12hp.ch":true,"2ix.ch":true,"4lima.ch":true,"lima-city.ch":true,"trafficplex.cloud":true,"de.cool":true,"12hp.de":true,"2ix.de":true,"4lima.de":true,"lima-city.de":true,"1337.pictures":true,"clan.rip":true,"lima-city.rocks":true,"webspace.rocks":true,"lima.zone":true,"*.transurl.be":true,"*.transurl.eu":true,"*.transurl.nl":true,"tuxfamily.org":true,"dd-dns.de":true,"diskstation.eu":true,"diskstation.org":true,"dray-dns.de":true,"draydns.de":true,"dyn-vpn.de":true,"dynvpn.de":true,"mein-vigor.de":true,"my-vigor.de":true,"my-wan.de":true,"syno-ds.de":true,"synology-diskstation.de":true,"synology-ds.de":true,"uber.space":true,"hk.com":true,"hk.org":true,"ltd.hk":true,"inc.hk":true,"lib.de.us":true,"2038.io":true,"router.management":true,"v-info.info":true,"wedeploy.io":true,"wedeploy.me":true,"wedeploy.sh":true,"remotewd.com":true,"wmflabs.org":true,"cistron.nl":true,"demon.nl":true,"xs4all.space":true,"official.academy":true,"yolasite.com":true,"ybo.faith":true,"yombo.me":true,"homelink.one":true,"ybo.party":true,"ybo.review":true,"ybo.science":true,"ybo.trade":true,"za.net":true,"za.org":true,"now.sh":true}); + +// END of automatically generated file diff --git a/appasar/canary/node_modules/tough-cookie/lib/store.js b/appasar/canary/node_modules/tough-cookie/lib/store.js new file mode 100644 index 0000000..bce5292 --- /dev/null +++ b/appasar/canary/node_modules/tough-cookie/lib/store.js @@ -0,0 +1,71 @@ +/*! + * Copyright (c) 2015, Salesforce.com, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of Salesforce.com nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +'use strict'; +/*jshint unused:false */ + +function Store() { +} +exports.Store = Store; + +// Stores may be synchronous, but are still required to use a +// Continuation-Passing Style API. The CookieJar itself will expose a "*Sync" +// API that converts from synchronous-callbacks to imperative style. +Store.prototype.synchronous = false; + +Store.prototype.findCookie = function(domain, path, key, cb) { + throw new Error('findCookie is not implemented'); +}; + +Store.prototype.findCookies = function(domain, path, cb) { + throw new Error('findCookies is not implemented'); +}; + +Store.prototype.putCookie = function(cookie, cb) { + throw new Error('putCookie is not implemented'); +}; + +Store.prototype.updateCookie = function(oldCookie, newCookie, cb) { + // recommended default implementation: + // return this.putCookie(newCookie, cb); + throw new Error('updateCookie is not implemented'); +}; + +Store.prototype.removeCookie = function(domain, path, key, cb) { + throw new Error('removeCookie is not implemented'); +}; + +Store.prototype.removeCookies = function(domain, path, cb) { + throw new Error('removeCookies is not implemented'); +}; + +Store.prototype.getAllCookies = function(cb) { + throw new Error('getAllCookies is not implemented (therefore jar cannot be serialized)'); +}; diff --git a/appasar/canary/node_modules/tough-cookie/package.json b/appasar/canary/node_modules/tough-cookie/package.json new file mode 100644 index 0000000..3500b6c --- /dev/null +++ b/appasar/canary/node_modules/tough-cookie/package.json @@ -0,0 +1,74 @@ +{ + "author": { + "name": "Jeremy Stashewsky", + "email": "jstashewsky@salesforce.com", + "website": "https://github.com/stash" + }, + "contributors": [ + { + "name": "Alexander Savin", + "website": "https://github.com/apsavin" + }, + { + "name": "Ian Livingstone", + "website": "https://github.com/ianlivingstone" + }, + { + "name": "Ivan Nikulin", + "website": "https://github.com/inikulin" + }, + { + "name": "Lalit Kapoor", + "website": "https://github.com/lalitkapoor" + }, + { + "name": "Sam Thompson", + "website": "https://github.com/sambthompson" + }, + { + "name": "Sebastian Mayr", + "website": "https://github.com/Sebmaster" + } + ], + "license": "BSD-3-Clause", + "name": "tough-cookie", + "description": "RFC6265 Cookies and Cookie Jar for node.js", + "keywords": [ + "HTTP", + "cookie", + "cookies", + "set-cookie", + "cookiejar", + "jar", + "RFC6265", + "RFC2965" + ], + "version": "2.3.4", + "homepage": "https://github.com/salesforce/tough-cookie", + "repository": { + "type": "git", + "url": "git://github.com/salesforce/tough-cookie.git" + }, + "bugs": { + "url": "https://github.com/salesforce/tough-cookie/issues" + }, + "main": "./lib/cookie", + "files": [ + "lib" + ], + "scripts": { + "suffixup": "curl -o public_suffix_list.dat https://publicsuffix.org/list/public_suffix_list.dat && ./generate-pubsuffix.js", + "test": "vows test/*_test.js" + }, + "engines": { + "node": ">=0.8" + }, + "devDependencies": { + "async": "^1.4.2", + "string.prototype.repeat": "^0.2.0", + "vows": "^0.8.1" + }, + "dependencies": { + "punycode": "^1.4.1" + } +} diff --git a/appasar/canary/node_modules/tunnel-agent/LICENSE b/appasar/canary/node_modules/tunnel-agent/LICENSE new file mode 100644 index 0000000..a4a9aee --- /dev/null +++ b/appasar/canary/node_modules/tunnel-agent/LICENSE @@ -0,0 +1,55 @@ +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/appasar/canary/node_modules/tunnel-agent/README.md b/appasar/canary/node_modules/tunnel-agent/README.md new file mode 100644 index 0000000..bb533d5 --- /dev/null +++ b/appasar/canary/node_modules/tunnel-agent/README.md @@ -0,0 +1,4 @@ +tunnel-agent +============ + +HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module. diff --git a/appasar/canary/node_modules/tunnel-agent/index.js b/appasar/canary/node_modules/tunnel-agent/index.js new file mode 100644 index 0000000..3ee9abc --- /dev/null +++ b/appasar/canary/node_modules/tunnel-agent/index.js @@ -0,0 +1,244 @@ +'use strict' + +var net = require('net') + , tls = require('tls') + , http = require('http') + , https = require('https') + , events = require('events') + , assert = require('assert') + , util = require('util') + , Buffer = require('safe-buffer').Buffer + ; + +exports.httpOverHttp = httpOverHttp +exports.httpsOverHttp = httpsOverHttp +exports.httpOverHttps = httpOverHttps +exports.httpsOverHttps = httpsOverHttps + + +function httpOverHttp(options) { + var agent = new TunnelingAgent(options) + agent.request = http.request + return agent +} + +function httpsOverHttp(options) { + var agent = new TunnelingAgent(options) + agent.request = http.request + agent.createSocket = createSecureSocket + agent.defaultPort = 443 + return agent +} + +function httpOverHttps(options) { + var agent = new TunnelingAgent(options) + agent.request = https.request + return agent +} + +function httpsOverHttps(options) { + var agent = new TunnelingAgent(options) + agent.request = https.request + agent.createSocket = createSecureSocket + agent.defaultPort = 443 + return agent +} + + +function TunnelingAgent(options) { + var self = this + self.options = options || {} + self.proxyOptions = self.options.proxy || {} + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets + self.requests = [] + self.sockets = [] + + self.on('free', function onFree(socket, host, port) { + for (var i = 0, len = self.requests.length; i < len; ++i) { + var pending = self.requests[i] + if (pending.host === host && pending.port === port) { + // Detect the request to connect same origin server, + // reuse the connection. + self.requests.splice(i, 1) + pending.request.onSocket(socket) + return + } + } + socket.destroy() + self.removeSocket(socket) + }) +} +util.inherits(TunnelingAgent, events.EventEmitter) + +TunnelingAgent.prototype.addRequest = function addRequest(req, options) { + var self = this + + // Legacy API: addRequest(req, host, port, path) + if (typeof options === 'string') { + options = { + host: options, + port: arguments[2], + path: arguments[3] + }; + } + + if (self.sockets.length >= this.maxSockets) { + // We are over limit so we'll add it to the queue. + self.requests.push({host: options.host, port: options.port, request: req}) + return + } + + // If we are under maxSockets create a new one. + self.createConnection({host: options.host, port: options.port, request: req}) +} + +TunnelingAgent.prototype.createConnection = function createConnection(pending) { + var self = this + + self.createSocket(pending, function(socket) { + socket.on('free', onFree) + socket.on('close', onCloseOrRemove) + socket.on('agentRemove', onCloseOrRemove) + pending.request.onSocket(socket) + + function onFree() { + self.emit('free', socket, pending.host, pending.port) + } + + function onCloseOrRemove(err) { + self.removeSocket(socket) + socket.removeListener('free', onFree) + socket.removeListener('close', onCloseOrRemove) + socket.removeListener('agentRemove', onCloseOrRemove) + } + }) +} + +TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + var self = this + var placeholder = {} + self.sockets.push(placeholder) + + var connectOptions = mergeOptions({}, self.proxyOptions, + { method: 'CONNECT' + , path: options.host + ':' + options.port + , agent: false + } + ) + if (connectOptions.proxyAuth) { + connectOptions.headers = connectOptions.headers || {} + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + + Buffer.from(connectOptions.proxyAuth).toString('base64') + } + + debug('making CONNECT request') + var connectReq = self.request(connectOptions) + connectReq.useChunkedEncodingByDefault = false // for v0.6 + connectReq.once('response', onResponse) // for v0.6 + connectReq.once('upgrade', onUpgrade) // for v0.6 + connectReq.once('connect', onConnect) // for v0.7 or later + connectReq.once('error', onError) + connectReq.end() + + function onResponse(res) { + // Very hacky. This is necessary to avoid http-parser leaks. + res.upgrade = true + } + + function onUpgrade(res, socket, head) { + // Hacky. + process.nextTick(function() { + onConnect(res, socket, head) + }) + } + + function onConnect(res, socket, head) { + connectReq.removeAllListeners() + socket.removeAllListeners() + + if (res.statusCode === 200) { + assert.equal(head.length, 0) + debug('tunneling connection has established') + self.sockets[self.sockets.indexOf(placeholder)] = socket + cb(socket) + } else { + debug('tunneling socket could not be established, statusCode=%d', res.statusCode) + var error = new Error('tunneling socket could not be established, ' + 'statusCode=' + res.statusCode) + error.code = 'ECONNRESET' + options.request.emit('error', error) + self.removeSocket(placeholder) + } + } + + function onError(cause) { + connectReq.removeAllListeners() + + debug('tunneling socket could not be established, cause=%s\n', cause.message, cause.stack) + var error = new Error('tunneling socket could not be established, ' + 'cause=' + cause.message) + error.code = 'ECONNRESET' + options.request.emit('error', error) + self.removeSocket(placeholder) + } +} + +TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { + var pos = this.sockets.indexOf(socket) + if (pos === -1) return + + this.sockets.splice(pos, 1) + + var pending = this.requests.shift() + if (pending) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createConnection(pending) + } +} + +function createSecureSocket(options, cb) { + var self = this + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { + // 0 is dummy port for v0.6 + var secureSocket = tls.connect(0, mergeOptions({}, self.options, + { servername: options.host + , socket: socket + } + )) + self.sockets[self.sockets.indexOf(socket)] = secureSocket + cb(secureSocket) + }) +} + + +function mergeOptions(target) { + for (var i = 1, len = arguments.length; i < len; ++i) { + var overrides = arguments[i] + if (typeof overrides === 'object') { + var keys = Object.keys(overrides) + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { + var k = keys[j] + if (overrides[k] !== undefined) { + target[k] = overrides[k] + } + } + } + } + return target +} + + +var debug +if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { + debug = function() { + var args = Array.prototype.slice.call(arguments) + if (typeof args[0] === 'string') { + args[0] = 'TUNNEL: ' + args[0] + } else { + args.unshift('TUNNEL:') + } + console.error.apply(console, args) + } +} else { + debug = function() {} +} +exports.debug = debug // for test diff --git a/appasar/canary/node_modules/tunnel-agent/package.json b/appasar/canary/node_modules/tunnel-agent/package.json new file mode 100644 index 0000000..a271fda --- /dev/null +++ b/appasar/canary/node_modules/tunnel-agent/package.json @@ -0,0 +1,22 @@ +{ + "author": "Mikeal Rogers (http://www.futurealoof.com)", + "name": "tunnel-agent", + "license": "Apache-2.0", + "description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.", + "version": "0.6.0", + "repository": { + "url": "https://github.com/mikeal/tunnel-agent" + }, + "main": "index.js", + "files": [ + "index.js" + ], + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "devDependencies": {}, + "optionalDependencies": {}, + "engines": { + "node": "*" + } +} diff --git a/appasar/canary/node_modules/tweetnacl/.npmignore b/appasar/canary/node_modules/tweetnacl/.npmignore new file mode 100644 index 0000000..7d98dcb --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/.npmignore @@ -0,0 +1,4 @@ +.eslintrc +.travis.yml +bower.json +test diff --git a/appasar/canary/node_modules/tweetnacl/AUTHORS.md b/appasar/canary/node_modules/tweetnacl/AUTHORS.md new file mode 100644 index 0000000..6d74d40 --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/AUTHORS.md @@ -0,0 +1,28 @@ +List of TweetNaCl.js authors +============================ + + Alphabetical order by first name. + Format: Name (GitHub username or URL) + +* AndSDev (@AndSDev) +* Devi Mandiri (@devi) +* Dmitry Chestnykh (@dchest) + +List of authors of third-party public domain code from which TweetNaCl.js code was derived +========================================================================================== + +[TweetNaCl](http://tweetnacl.cr.yp.to/) +-------------------------------------- + +* Bernard van Gastel +* Daniel J. Bernstein +* Peter Schwabe +* Sjaak Smetsers +* Tanja Lange +* Wesley Janssen + + +[Poly1305-donna](https://github.com/floodyberry/poly1305-donna) +-------------------------------------------------------------- + +* Andrew Moon (@floodyberry) diff --git a/appasar/canary/node_modules/tweetnacl/CHANGELOG.md b/appasar/canary/node_modules/tweetnacl/CHANGELOG.md new file mode 100644 index 0000000..92a4fdc --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/CHANGELOG.md @@ -0,0 +1,221 @@ +TweetNaCl.js Changelog +====================== + + +v0.14.5 +------- + +* Fixed incomplete return types in TypeScript typings. +* Replaced COPYING.txt with LICENSE file, which now has public domain dedication + text from The Unlicense. License fields in package.json and bower.json have + been set to "Unlicense". The project was and will be in the public domain -- + this change just makes it easier for automated tools to know about this fact by + using the widely recognized and SPDX-compatible template for public domain + dedication. + + +v0.14.4 +------- + +* Added TypeScript type definitions (contributed by @AndSDev). +* Improved benchmarking code. + + +v0.14.3 +------- + +Fixed a bug in the fast version of Poly1305 and brought it back. + +Thanks to @floodyberry for promptly responding and fixing the original C code: + +> "The issue was not properly detecting if st->h was >= 2^130 - 5, coupled with +> [testing mistake] not catching the failure. The chance of the bug affecting +> anything in the real world is essentially zero luckily, but it's good to have +> it fixed." + +https://github.com/floodyberry/poly1305-donna/issues/2#issuecomment-202698577 + + +v0.14.2 +------- + +Switched Poly1305 fast version back to original (slow) version due to a bug. + + +v0.14.1 +------- + +No code changes, just tweaked packaging and added COPYING.txt. + + +v0.14.0 +------- + +* **Breaking change!** All functions from `nacl.util` have been removed. These + functions are no longer available: + + nacl.util.decodeUTF8 + nacl.util.encodeUTF8 + nacl.util.decodeBase64 + nacl.util.encodeBase64 + + If want to continue using them, you can include + package: + + + + + or + + var nacl = require('tweetnacl'); + nacl.util = require('tweetnacl-util'); + + However it is recommended to use better packages that have wider + compatibility and better performance. Functions from `nacl.util` were never + intended to be robust solution for string conversion and were included for + convenience: cryptography library is not the right place for them. + + Currently calling these functions will throw error pointing to + `tweetnacl-util-js` (in the next version this error message will be removed). + +* Improved detection of available random number generators, making it possible + to use `nacl.randomBytes` and related functions in Web Workers without + changes. + +* Changes to testing (see README). + + +v0.13.3 +------- + +No code changes. + +* Reverted license field in package.json to "Public domain". + +* Fixed typo in README. + + +v0.13.2 +------- + +* Fixed undefined variable bug in fast version of Poly1305. No worries, this + bug was *never* triggered. + +* Specified CC0 public domain dedication. + +* Updated development dependencies. + + +v0.13.1 +------- + +* Exclude `crypto` and `buffer` modules from browserify builds. + + +v0.13.0 +------- + +* Made `nacl-fast` the default version in NPM package. Now + `require("tweetnacl")` will use fast version; to get the original version, + use `require("tweetnacl/nacl.js")`. + +* Cleanup temporary array after generating random bytes. + + +v0.12.2 +------- + +* Improved performance of curve operations, making `nacl.scalarMult`, `nacl.box`, + `nacl.sign` and related functions up to 3x faster in `nacl-fast` version. + + +v0.12.1 +------- + +* Significantly improved performance of Salsa20 (~1.5x faster) and + Poly1305 (~3.5x faster) in `nacl-fast` version. + + +v0.12.0 +------- + +* Instead of using the given secret key directly, TweetNaCl.js now copies it to + a new array in `nacl.box.keyPair.fromSecretKey` and + `nacl.sign.keyPair.fromSecretKey`. + + +v0.11.2 +------- + +* Added new constant: `nacl.sign.seedLength`. + + +v0.11.1 +------- + +* Even faster hash for both short and long inputs (in `nacl-fast`). + + +v0.11.0 +------- + +* Implement `nacl.sign.keyPair.fromSeed` to enable creation of sign key pairs + deterministically from a 32-byte seed. (It behaves like + [libsodium's](http://doc.libsodium.org/public-key_cryptography/public-key_signatures.html) + `crypto_sign_seed_keypair`: the seed becomes a secret part of the secret key.) + +* Fast version now has an improved hash implementation that is 2x-5x faster. + +* Fixed benchmarks, which may have produced incorrect measurements. + + +v0.10.1 +------- + +* Exported undocumented `nacl.lowlevel.crypto_core_hsalsa20`. + + +v0.10.0 +------- + +* **Signature API breaking change!** `nacl.sign` and `nacl.sign.open` now deal + with signed messages, and new `nacl.sign.detached` and + `nacl.sign.detached.verify` are available. + + Previously, `nacl.sign` returned a signature, and `nacl.sign.open` accepted a + message and "detached" signature. This was unlike NaCl's API, which dealt with + signed messages (concatenation of signature and message). + + The new API is: + + nacl.sign(message, secretKey) -> signedMessage + nacl.sign.open(signedMessage, publicKey) -> message | null + + Since detached signatures are common, two new API functions were introduced: + + nacl.sign.detached(message, secretKey) -> signature + nacl.sign.detached.verify(message, signature, publicKey) -> true | false + + (Note that it's `verify`, not `open`, and it returns a boolean value, unlike + `open`, which returns an "unsigned" message.) + +* NPM package now comes without `test` directory to keep it small. + + +v0.9.2 +------ + +* Improved documentation. +* Fast version: increased theoretical message size limit from 2^32-1 to 2^52 + bytes in Poly1305 (and thus, secretbox and box). However this has no impact + in practice since JavaScript arrays or ArrayBuffers are limited to 32-bit + indexes, and most implementations won't allocate more than a gigabyte or so. + (Obviously, there are no tests for the correctness of implementation.) Also, + it's not recommended to use messages that large without splitting them into + smaller packets anyway. + + +v0.9.1 +------ + +* Initial release diff --git a/appasar/canary/node_modules/tweetnacl/LICENSE b/appasar/canary/node_modules/tweetnacl/LICENSE new file mode 100644 index 0000000..cf1ab25 --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/appasar/canary/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md b/appasar/canary/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a8eb4a9 --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ +# Important! + +If your contribution is not trivial (not a typo fix, etc.), we can only accept +it if you dedicate your copyright for the contribution to the public domain. +Make sure you understand what it means (see http://unlicense.org/)! If you +agree, please add yourself to AUTHORS.md file, and include the following text +to your pull request description or a comment in it: + +------------------------------------------------------------------------------ + + I dedicate any and all copyright interest in this software to the + public domain. I make this dedication for the benefit of the public at + large and to the detriment of my heirs and successors. I intend this + dedication to be an overt act of relinquishment in perpetuity of all + present and future rights to this software under copyright law. + + Anyone is free to copy, modify, publish, use, compile, sell, or + distribute this software, either in source code form or as a compiled + binary, for any purpose, commercial or non-commercial, and by any + means. diff --git a/appasar/canary/node_modules/tweetnacl/README.md b/appasar/canary/node_modules/tweetnacl/README.md new file mode 100644 index 0000000..ffb6871 --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/README.md @@ -0,0 +1,459 @@ +TweetNaCl.js +============ + +Port of [TweetNaCl](http://tweetnacl.cr.yp.to) / [NaCl](http://nacl.cr.yp.to/) +to JavaScript for modern browsers and Node.js. Public domain. + +[![Build Status](https://travis-ci.org/dchest/tweetnacl-js.svg?branch=master) +](https://travis-ci.org/dchest/tweetnacl-js) + +Demo: + +**:warning: The library is stable and API is frozen, however it has not been +independently reviewed. If you can help reviewing it, please [contact +me](mailto:dmitry@codingrobots.com).** + +Documentation +============= + +* [Overview](#overview) +* [Installation](#installation) +* [Usage](#usage) + * [Public-key authenticated encryption (box)](#public-key-authenticated-encryption-box) + * [Secret-key authenticated encryption (secretbox)](#secret-key-authenticated-encryption-secretbox) + * [Scalar multiplication](#scalar-multiplication) + * [Signatures](#signatures) + * [Hashing](#hashing) + * [Random bytes generation](#random-bytes-generation) + * [Constant-time comparison](#constant-time-comparison) +* [System requirements](#system-requirements) +* [Development and testing](#development-and-testing) +* [Benchmarks](#benchmarks) +* [Contributors](#contributors) +* [Who uses it](#who-uses-it) + + +Overview +-------- + +The primary goal of this project is to produce a translation of TweetNaCl to +JavaScript which is as close as possible to the original C implementation, plus +a thin layer of idiomatic high-level API on top of it. + +There are two versions, you can use either of them: + +* `nacl.js` is the port of TweetNaCl with minimum differences from the + original + high-level API. + +* `nacl-fast.js` is like `nacl.js`, but with some functions replaced with + faster versions. + + +Installation +------------ + +You can install TweetNaCl.js via a package manager: + +[Bower](http://bower.io): + + $ bower install tweetnacl + +[NPM](https://www.npmjs.org/): + + $ npm install tweetnacl + +or [download source code](https://github.com/dchest/tweetnacl-js/releases). + + +Usage +----- + +All API functions accept and return bytes as `Uint8Array`s. If you need to +encode or decode strings, use functions from + or one of the more robust codec +packages. + +In Node.js v4 and later `Buffer` objects are backed by `Uint8Array`s, so you +can freely pass them to TweetNaCl.js functions as arguments. The returned +objects are still `Uint8Array`s, so if you need `Buffer`s, you'll have to +convert them manually; make sure to convert using copying: `new Buffer(array)`, +instead of sharing: `new Buffer(array.buffer)`, because some functions return +subarrays of their buffers. + + +### Public-key authenticated encryption (box) + +Implements *curve25519-xsalsa20-poly1305*. + +#### nacl.box.keyPair() + +Generates a new random key pair for box and returns it as an object with +`publicKey` and `secretKey` members: + + { + publicKey: ..., // Uint8Array with 32-byte public key + secretKey: ... // Uint8Array with 32-byte secret key + } + + +#### nacl.box.keyPair.fromSecretKey(secretKey) + +Returns a key pair for box with public key corresponding to the given secret +key. + +#### nacl.box(message, nonce, theirPublicKey, mySecretKey) + +Encrypt and authenticates message using peer's public key, our secret key, and +the given nonce, which must be unique for each distinct message for a key pair. + +Returns an encrypted and authenticated message, which is +`nacl.box.overheadLength` longer than the original message. + +#### nacl.box.open(box, nonce, theirPublicKey, mySecretKey) + +Authenticates and decrypts the given box with peer's public key, our secret +key, and the given nonce. + +Returns the original message, or `false` if authentication fails. + +#### nacl.box.before(theirPublicKey, mySecretKey) + +Returns a precomputed shared key which can be used in `nacl.box.after` and +`nacl.box.open.after`. + +#### nacl.box.after(message, nonce, sharedKey) + +Same as `nacl.box`, but uses a shared key precomputed with `nacl.box.before`. + +#### nacl.box.open.after(box, nonce, sharedKey) + +Same as `nacl.box.open`, but uses a shared key precomputed with `nacl.box.before`. + +#### nacl.box.publicKeyLength = 32 + +Length of public key in bytes. + +#### nacl.box.secretKeyLength = 32 + +Length of secret key in bytes. + +#### nacl.box.sharedKeyLength = 32 + +Length of precomputed shared key in bytes. + +#### nacl.box.nonceLength = 24 + +Length of nonce in bytes. + +#### nacl.box.overheadLength = 16 + +Length of overhead added to box compared to original message. + + +### Secret-key authenticated encryption (secretbox) + +Implements *xsalsa20-poly1305*. + +#### nacl.secretbox(message, nonce, key) + +Encrypt and authenticates message using the key and the nonce. The nonce must +be unique for each distinct message for this key. + +Returns an encrypted and authenticated message, which is +`nacl.secretbox.overheadLength` longer than the original message. + +#### nacl.secretbox.open(box, nonce, key) + +Authenticates and decrypts the given secret box using the key and the nonce. + +Returns the original message, or `false` if authentication fails. + +#### nacl.secretbox.keyLength = 32 + +Length of key in bytes. + +#### nacl.secretbox.nonceLength = 24 + +Length of nonce in bytes. + +#### nacl.secretbox.overheadLength = 16 + +Length of overhead added to secret box compared to original message. + + +### Scalar multiplication + +Implements *curve25519*. + +#### nacl.scalarMult(n, p) + +Multiplies an integer `n` by a group element `p` and returns the resulting +group element. + +#### nacl.scalarMult.base(n) + +Multiplies an integer `n` by a standard group element and returns the resulting +group element. + +#### nacl.scalarMult.scalarLength = 32 + +Length of scalar in bytes. + +#### nacl.scalarMult.groupElementLength = 32 + +Length of group element in bytes. + + +### Signatures + +Implements [ed25519](http://ed25519.cr.yp.to). + +#### nacl.sign.keyPair() + +Generates new random key pair for signing and returns it as an object with +`publicKey` and `secretKey` members: + + { + publicKey: ..., // Uint8Array with 32-byte public key + secretKey: ... // Uint8Array with 64-byte secret key + } + +#### nacl.sign.keyPair.fromSecretKey(secretKey) + +Returns a signing key pair with public key corresponding to the given +64-byte secret key. The secret key must have been generated by +`nacl.sign.keyPair` or `nacl.sign.keyPair.fromSeed`. + +#### nacl.sign.keyPair.fromSeed(seed) + +Returns a new signing key pair generated deterministically from a 32-byte seed. +The seed must contain enough entropy to be secure. This method is not +recommended for general use: instead, use `nacl.sign.keyPair` to generate a new +key pair from a random seed. + +#### nacl.sign(message, secretKey) + +Signs the message using the secret key and returns a signed message. + +#### nacl.sign.open(signedMessage, publicKey) + +Verifies the signed message and returns the message without signature. + +Returns `null` if verification failed. + +#### nacl.sign.detached(message, secretKey) + +Signs the message using the secret key and returns a signature. + +#### nacl.sign.detached.verify(message, signature, publicKey) + +Verifies the signature for the message and returns `true` if verification +succeeded or `false` if it failed. + +#### nacl.sign.publicKeyLength = 32 + +Length of signing public key in bytes. + +#### nacl.sign.secretKeyLength = 64 + +Length of signing secret key in bytes. + +#### nacl.sign.seedLength = 32 + +Length of seed for `nacl.sign.keyPair.fromSeed` in bytes. + +#### nacl.sign.signatureLength = 64 + +Length of signature in bytes. + + +### Hashing + +Implements *SHA-512*. + +#### nacl.hash(message) + +Returns SHA-512 hash of the message. + +#### nacl.hash.hashLength = 64 + +Length of hash in bytes. + + +### Random bytes generation + +#### nacl.randomBytes(length) + +Returns a `Uint8Array` of the given length containing random bytes of +cryptographic quality. + +**Implementation note** + +TweetNaCl.js uses the following methods to generate random bytes, +depending on the platform it runs on: + +* `window.crypto.getRandomValues` (WebCrypto standard) +* `window.msCrypto.getRandomValues` (Internet Explorer 11) +* `crypto.randomBytes` (Node.js) + +If the platform doesn't provide a suitable PRNG, the following functions, +which require random numbers, will throw exception: + +* `nacl.randomBytes` +* `nacl.box.keyPair` +* `nacl.sign.keyPair` + +Other functions are deterministic and will continue working. + +If a platform you are targeting doesn't implement secure random number +generator, but you somehow have a cryptographically-strong source of entropy +(not `Math.random`!), and you know what you are doing, you can plug it into +TweetNaCl.js like this: + + nacl.setPRNG(function(x, n) { + // ... copy n random bytes into x ... + }); + +Note that `nacl.setPRNG` *completely replaces* internal random byte generator +with the one provided. + + +### Constant-time comparison + +#### nacl.verify(x, y) + +Compares `x` and `y` in constant time and returns `true` if their lengths are +non-zero and equal, and their contents are equal. + +Returns `false` if either of the arguments has zero length, or arguments have +different lengths, or their contents differ. + + +System requirements +------------------- + +TweetNaCl.js supports modern browsers that have a cryptographically secure +pseudorandom number generator and typed arrays, including the latest versions +of: + +* Chrome +* Firefox +* Safari (Mac, iOS) +* Internet Explorer 11 + +Other systems: + +* Node.js + + +Development and testing +------------------------ + +Install NPM modules needed for development: + + $ npm install + +To build minified versions: + + $ npm run build + +Tests use minified version, so make sure to rebuild it every time you change +`nacl.js` or `nacl-fast.js`. + +### Testing + +To run tests in Node.js: + + $ npm run test-node + +By default all tests described here work on `nacl.min.js`. To test other +versions, set environment variable `NACL_SRC` to the file name you want to test. +For example, the following command will test fast minified version: + + $ NACL_SRC=nacl-fast.min.js npm run test-node + +To run full suite of tests in Node.js, including comparing outputs of +JavaScript port to outputs of the original C version: + + $ npm run test-node-all + +To prepare tests for browsers: + + $ npm run build-test-browser + +and then open `test/browser/test.html` (or `test/browser/test-fast.html`) to +run them. + +To run headless browser tests with `tape-run` (powered by Electron): + + $ npm run test-browser + +(If you get `Error: spawn ENOENT`, install *xvfb*: `sudo apt-get install xvfb`.) + +To run tests in both Node and Electron: + + $ npm test + +### Benchmarking + +To run benchmarks in Node.js: + + $ npm run bench + $ NACL_SRC=nacl-fast.min.js npm run bench + +To run benchmarks in a browser, open `test/benchmark/bench.html` (or +`test/benchmark/bench-fast.html`). + + +Benchmarks +---------- + +For reference, here are benchmarks from MacBook Pro (Retina, 13-inch, Mid 2014) +laptop with 2.6 GHz Intel Core i5 CPU (Intel) in Chrome 53/OS X and Xiaomi Redmi +Note 3 smartphone with 1.8 GHz Qualcomm Snapdragon 650 64-bit CPU (ARM) in +Chrome 52/Android: + +| | nacl.js Intel | nacl-fast.js Intel | nacl.js ARM | nacl-fast.js ARM | +| ------------- |:-------------:|:-------------------:|:-------------:|:-----------------:| +| salsa20 | 1.3 MB/s | 128 MB/s | 0.4 MB/s | 43 MB/s | +| poly1305 | 13 MB/s | 171 MB/s | 4 MB/s | 52 MB/s | +| hash | 4 MB/s | 34 MB/s | 0.9 MB/s | 12 MB/s | +| secretbox 1K | 1113 op/s | 57583 op/s | 334 op/s | 14227 op/s | +| box 1K | 145 op/s | 718 op/s | 37 op/s | 368 op/s | +| scalarMult | 171 op/s | 733 op/s | 56 op/s | 380 op/s | +| sign | 77 op/s | 200 op/s | 20 op/s | 61 op/s | +| sign.open | 39 op/s | 102 op/s | 11 op/s | 31 op/s | + +(You can run benchmarks on your devices by clicking on the links at the bottom +of the [home page](https://tweetnacl.js.org)). + +In short, with *nacl-fast.js* and 1024-byte messages you can expect to encrypt and +authenticate more than 57000 messages per second on a typical laptop or more than +14000 messages per second on a $170 smartphone, sign about 200 and verify 100 +messages per second on a laptop or 60 and 30 messages per second on a smartphone, +per CPU core (with Web Workers you can do these operations in parallel), +which is good enough for most applications. + + +Contributors +------------ + +See AUTHORS.md file. + + +Third-party libraries based on TweetNaCl.js +------------------------------------------- + +* [forward-secrecy](https://github.com/alax/forward-secrecy) — Axolotl ratchet implementation +* [nacl-stream](https://github.com/dchest/nacl-stream-js) - streaming encryption +* [tweetnacl-auth-js](https://github.com/dchest/tweetnacl-auth-js) — implementation of [`crypto_auth`](http://nacl.cr.yp.to/auth.html) +* [chloride](https://github.com/dominictarr/chloride) - unified API for various NaCl modules + + +Who uses it +----------- + +Some notable users of TweetNaCl.js: + +* [miniLock](http://minilock.io/) +* [Stellar](https://www.stellar.org/) diff --git a/appasar/canary/node_modules/tweetnacl/nacl-fast.js b/appasar/canary/node_modules/tweetnacl/nacl-fast.js new file mode 100644 index 0000000..5e4562f --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/nacl-fast.js @@ -0,0 +1,2388 @@ +(function(nacl) { +'use strict'; + +// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. +// Public domain. +// +// Implementation derived from TweetNaCl version 20140427. +// See for details: http://tweetnacl.cr.yp.to/ + +var gf = function(init) { + var i, r = new Float64Array(16); + if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; + return r; +}; + +// Pluggable, initialized in high-level API below. +var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; + +var _0 = new Uint8Array(16); +var _9 = new Uint8Array(32); _9[0] = 9; + +var gf0 = gf(), + gf1 = gf([1]), + _121665 = gf([0xdb41, 1]), + D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), + D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), + X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), + Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), + I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); + +function ts64(x, i, h, l) { + x[i] = (h >> 24) & 0xff; + x[i+1] = (h >> 16) & 0xff; + x[i+2] = (h >> 8) & 0xff; + x[i+3] = h & 0xff; + x[i+4] = (l >> 24) & 0xff; + x[i+5] = (l >> 16) & 0xff; + x[i+6] = (l >> 8) & 0xff; + x[i+7] = l & 0xff; +} + +function vn(x, xi, y, yi, n) { + var i,d = 0; + for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; + return (1 & ((d - 1) >>> 8)) - 1; +} + +function crypto_verify_16(x, xi, y, yi) { + return vn(x,xi,y,yi,16); +} + +function crypto_verify_32(x, xi, y, yi) { + return vn(x,xi,y,yi,32); +} + +function core_salsa20(o, p, k, c) { + var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, + j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, + j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, + j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, + j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, + j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, + j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, + j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, + j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, + j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, + j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, + j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, + j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, + j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, + j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, + j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; + + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, + x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, + x15 = j15, u; + + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u<<7 | u>>>(32-7); + u = x4 + x0 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x4 | 0; + x12 ^= u<<13 | u>>>(32-13); + u = x12 + x8 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x1 | 0; + x9 ^= u<<7 | u>>>(32-7); + u = x9 + x5 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x9 | 0; + x1 ^= u<<13 | u>>>(32-13); + u = x1 + x13 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x6 | 0; + x14 ^= u<<7 | u>>>(32-7); + u = x14 + x10 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x14 | 0; + x6 ^= u<<13 | u>>>(32-13); + u = x6 + x2 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x11 | 0; + x3 ^= u<<7 | u>>>(32-7); + u = x3 + x15 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x3 | 0; + x11 ^= u<<13 | u>>>(32-13); + u = x11 + x7 | 0; + x15 ^= u<<18 | u>>>(32-18); + + u = x0 + x3 | 0; + x1 ^= u<<7 | u>>>(32-7); + u = x1 + x0 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x1 | 0; + x3 ^= u<<13 | u>>>(32-13); + u = x3 + x2 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x4 | 0; + x6 ^= u<<7 | u>>>(32-7); + u = x6 + x5 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x6 | 0; + x4 ^= u<<13 | u>>>(32-13); + u = x4 + x7 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x9 | 0; + x11 ^= u<<7 | u>>>(32-7); + u = x11 + x10 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x11 | 0; + x9 ^= u<<13 | u>>>(32-13); + u = x9 + x8 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x14 | 0; + x12 ^= u<<7 | u>>>(32-7); + u = x12 + x15 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x12 | 0; + x14 ^= u<<13 | u>>>(32-13); + u = x14 + x13 | 0; + x15 ^= u<<18 | u>>>(32-18); + } + x0 = x0 + j0 | 0; + x1 = x1 + j1 | 0; + x2 = x2 + j2 | 0; + x3 = x3 + j3 | 0; + x4 = x4 + j4 | 0; + x5 = x5 + j5 | 0; + x6 = x6 + j6 | 0; + x7 = x7 + j7 | 0; + x8 = x8 + j8 | 0; + x9 = x9 + j9 | 0; + x10 = x10 + j10 | 0; + x11 = x11 + j11 | 0; + x12 = x12 + j12 | 0; + x13 = x13 + j13 | 0; + x14 = x14 + j14 | 0; + x15 = x15 + j15 | 0; + + o[ 0] = x0 >>> 0 & 0xff; + o[ 1] = x0 >>> 8 & 0xff; + o[ 2] = x0 >>> 16 & 0xff; + o[ 3] = x0 >>> 24 & 0xff; + + o[ 4] = x1 >>> 0 & 0xff; + o[ 5] = x1 >>> 8 & 0xff; + o[ 6] = x1 >>> 16 & 0xff; + o[ 7] = x1 >>> 24 & 0xff; + + o[ 8] = x2 >>> 0 & 0xff; + o[ 9] = x2 >>> 8 & 0xff; + o[10] = x2 >>> 16 & 0xff; + o[11] = x2 >>> 24 & 0xff; + + o[12] = x3 >>> 0 & 0xff; + o[13] = x3 >>> 8 & 0xff; + o[14] = x3 >>> 16 & 0xff; + o[15] = x3 >>> 24 & 0xff; + + o[16] = x4 >>> 0 & 0xff; + o[17] = x4 >>> 8 & 0xff; + o[18] = x4 >>> 16 & 0xff; + o[19] = x4 >>> 24 & 0xff; + + o[20] = x5 >>> 0 & 0xff; + o[21] = x5 >>> 8 & 0xff; + o[22] = x5 >>> 16 & 0xff; + o[23] = x5 >>> 24 & 0xff; + + o[24] = x6 >>> 0 & 0xff; + o[25] = x6 >>> 8 & 0xff; + o[26] = x6 >>> 16 & 0xff; + o[27] = x6 >>> 24 & 0xff; + + o[28] = x7 >>> 0 & 0xff; + o[29] = x7 >>> 8 & 0xff; + o[30] = x7 >>> 16 & 0xff; + o[31] = x7 >>> 24 & 0xff; + + o[32] = x8 >>> 0 & 0xff; + o[33] = x8 >>> 8 & 0xff; + o[34] = x8 >>> 16 & 0xff; + o[35] = x8 >>> 24 & 0xff; + + o[36] = x9 >>> 0 & 0xff; + o[37] = x9 >>> 8 & 0xff; + o[38] = x9 >>> 16 & 0xff; + o[39] = x9 >>> 24 & 0xff; + + o[40] = x10 >>> 0 & 0xff; + o[41] = x10 >>> 8 & 0xff; + o[42] = x10 >>> 16 & 0xff; + o[43] = x10 >>> 24 & 0xff; + + o[44] = x11 >>> 0 & 0xff; + o[45] = x11 >>> 8 & 0xff; + o[46] = x11 >>> 16 & 0xff; + o[47] = x11 >>> 24 & 0xff; + + o[48] = x12 >>> 0 & 0xff; + o[49] = x12 >>> 8 & 0xff; + o[50] = x12 >>> 16 & 0xff; + o[51] = x12 >>> 24 & 0xff; + + o[52] = x13 >>> 0 & 0xff; + o[53] = x13 >>> 8 & 0xff; + o[54] = x13 >>> 16 & 0xff; + o[55] = x13 >>> 24 & 0xff; + + o[56] = x14 >>> 0 & 0xff; + o[57] = x14 >>> 8 & 0xff; + o[58] = x14 >>> 16 & 0xff; + o[59] = x14 >>> 24 & 0xff; + + o[60] = x15 >>> 0 & 0xff; + o[61] = x15 >>> 8 & 0xff; + o[62] = x15 >>> 16 & 0xff; + o[63] = x15 >>> 24 & 0xff; +} + +function core_hsalsa20(o,p,k,c) { + var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, + j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, + j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, + j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, + j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, + j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, + j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, + j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, + j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, + j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, + j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, + j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, + j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, + j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, + j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, + j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; + + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, + x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, + x15 = j15, u; + + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u<<7 | u>>>(32-7); + u = x4 + x0 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x4 | 0; + x12 ^= u<<13 | u>>>(32-13); + u = x12 + x8 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x1 | 0; + x9 ^= u<<7 | u>>>(32-7); + u = x9 + x5 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x9 | 0; + x1 ^= u<<13 | u>>>(32-13); + u = x1 + x13 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x6 | 0; + x14 ^= u<<7 | u>>>(32-7); + u = x14 + x10 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x14 | 0; + x6 ^= u<<13 | u>>>(32-13); + u = x6 + x2 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x11 | 0; + x3 ^= u<<7 | u>>>(32-7); + u = x3 + x15 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x3 | 0; + x11 ^= u<<13 | u>>>(32-13); + u = x11 + x7 | 0; + x15 ^= u<<18 | u>>>(32-18); + + u = x0 + x3 | 0; + x1 ^= u<<7 | u>>>(32-7); + u = x1 + x0 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x1 | 0; + x3 ^= u<<13 | u>>>(32-13); + u = x3 + x2 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x4 | 0; + x6 ^= u<<7 | u>>>(32-7); + u = x6 + x5 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x6 | 0; + x4 ^= u<<13 | u>>>(32-13); + u = x4 + x7 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x9 | 0; + x11 ^= u<<7 | u>>>(32-7); + u = x11 + x10 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x11 | 0; + x9 ^= u<<13 | u>>>(32-13); + u = x9 + x8 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x14 | 0; + x12 ^= u<<7 | u>>>(32-7); + u = x12 + x15 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x12 | 0; + x14 ^= u<<13 | u>>>(32-13); + u = x14 + x13 | 0; + x15 ^= u<<18 | u>>>(32-18); + } + + o[ 0] = x0 >>> 0 & 0xff; + o[ 1] = x0 >>> 8 & 0xff; + o[ 2] = x0 >>> 16 & 0xff; + o[ 3] = x0 >>> 24 & 0xff; + + o[ 4] = x5 >>> 0 & 0xff; + o[ 5] = x5 >>> 8 & 0xff; + o[ 6] = x5 >>> 16 & 0xff; + o[ 7] = x5 >>> 24 & 0xff; + + o[ 8] = x10 >>> 0 & 0xff; + o[ 9] = x10 >>> 8 & 0xff; + o[10] = x10 >>> 16 & 0xff; + o[11] = x10 >>> 24 & 0xff; + + o[12] = x15 >>> 0 & 0xff; + o[13] = x15 >>> 8 & 0xff; + o[14] = x15 >>> 16 & 0xff; + o[15] = x15 >>> 24 & 0xff; + + o[16] = x6 >>> 0 & 0xff; + o[17] = x6 >>> 8 & 0xff; + o[18] = x6 >>> 16 & 0xff; + o[19] = x6 >>> 24 & 0xff; + + o[20] = x7 >>> 0 & 0xff; + o[21] = x7 >>> 8 & 0xff; + o[22] = x7 >>> 16 & 0xff; + o[23] = x7 >>> 24 & 0xff; + + o[24] = x8 >>> 0 & 0xff; + o[25] = x8 >>> 8 & 0xff; + o[26] = x8 >>> 16 & 0xff; + o[27] = x8 >>> 24 & 0xff; + + o[28] = x9 >>> 0 & 0xff; + o[29] = x9 >>> 8 & 0xff; + o[30] = x9 >>> 16 & 0xff; + o[31] = x9 >>> 24 & 0xff; +} + +function crypto_core_salsa20(out,inp,k,c) { + core_salsa20(out,inp,k,c); +} + +function crypto_core_hsalsa20(out,inp,k,c) { + core_hsalsa20(out,inp,k,c); +} + +var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); + // "expand 32-byte k" + +function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + mpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i]; + } + return 0; +} + +function crypto_stream_salsa20(c,cpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = x[i]; + } + return 0; +} + +function crypto_stream(c,cpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) sn[i] = n[i+16]; + return crypto_stream_salsa20(c,cpos,d,sn,s); +} + +function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) sn[i] = n[i+16]; + return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s); +} + +/* +* Port of Andrew Moon's Poly1305-donna-16. Public domain. +* https://github.com/floodyberry/poly1305-donna +*/ + +var poly1305 = function(key) { + this.buffer = new Uint8Array(16); + this.r = new Uint16Array(10); + this.h = new Uint16Array(10); + this.pad = new Uint16Array(8); + this.leftover = 0; + this.fin = 0; + + var t0, t1, t2, t3, t4, t5, t6, t7; + + t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; + t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; + t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; + this.r[5] = ((t4 >>> 1)) & 0x1ffe; + t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; + t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + this.r[9] = ((t7 >>> 5)) & 0x007f; + + this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; + this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; + this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; + this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; + this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; + this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; + this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; + this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; +}; + +poly1305.prototype.blocks = function(m, mpos, bytes) { + var hibit = this.fin ? 0 : (1 << 11); + var t0, t1, t2, t3, t4, t5, t6, t7, c; + var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; + + var h0 = this.h[0], + h1 = this.h[1], + h2 = this.h[2], + h3 = this.h[3], + h4 = this.h[4], + h5 = this.h[5], + h6 = this.h[6], + h7 = this.h[7], + h8 = this.h[8], + h9 = this.h[9]; + + var r0 = this.r[0], + r1 = this.r[1], + r2 = this.r[2], + r3 = this.r[3], + r4 = this.r[4], + r5 = this.r[5], + r6 = this.r[6], + r7 = this.r[7], + r8 = this.r[8], + r9 = this.r[9]; + + while (bytes >= 16) { + t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; + t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; + t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; + h5 += ((t4 >>> 1)) & 0x1fff; + t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; + t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + h9 += ((t7 >>> 5)) | hibit; + + c = 0; + + d0 = c; + d0 += h0 * r0; + d0 += h1 * (5 * r9); + d0 += h2 * (5 * r8); + d0 += h3 * (5 * r7); + d0 += h4 * (5 * r6); + c = (d0 >>> 13); d0 &= 0x1fff; + d0 += h5 * (5 * r5); + d0 += h6 * (5 * r4); + d0 += h7 * (5 * r3); + d0 += h8 * (5 * r2); + d0 += h9 * (5 * r1); + c += (d0 >>> 13); d0 &= 0x1fff; + + d1 = c; + d1 += h0 * r1; + d1 += h1 * r0; + d1 += h2 * (5 * r9); + d1 += h3 * (5 * r8); + d1 += h4 * (5 * r7); + c = (d1 >>> 13); d1 &= 0x1fff; + d1 += h5 * (5 * r6); + d1 += h6 * (5 * r5); + d1 += h7 * (5 * r4); + d1 += h8 * (5 * r3); + d1 += h9 * (5 * r2); + c += (d1 >>> 13); d1 &= 0x1fff; + + d2 = c; + d2 += h0 * r2; + d2 += h1 * r1; + d2 += h2 * r0; + d2 += h3 * (5 * r9); + d2 += h4 * (5 * r8); + c = (d2 >>> 13); d2 &= 0x1fff; + d2 += h5 * (5 * r7); + d2 += h6 * (5 * r6); + d2 += h7 * (5 * r5); + d2 += h8 * (5 * r4); + d2 += h9 * (5 * r3); + c += (d2 >>> 13); d2 &= 0x1fff; + + d3 = c; + d3 += h0 * r3; + d3 += h1 * r2; + d3 += h2 * r1; + d3 += h3 * r0; + d3 += h4 * (5 * r9); + c = (d3 >>> 13); d3 &= 0x1fff; + d3 += h5 * (5 * r8); + d3 += h6 * (5 * r7); + d3 += h7 * (5 * r6); + d3 += h8 * (5 * r5); + d3 += h9 * (5 * r4); + c += (d3 >>> 13); d3 &= 0x1fff; + + d4 = c; + d4 += h0 * r4; + d4 += h1 * r3; + d4 += h2 * r2; + d4 += h3 * r1; + d4 += h4 * r0; + c = (d4 >>> 13); d4 &= 0x1fff; + d4 += h5 * (5 * r9); + d4 += h6 * (5 * r8); + d4 += h7 * (5 * r7); + d4 += h8 * (5 * r6); + d4 += h9 * (5 * r5); + c += (d4 >>> 13); d4 &= 0x1fff; + + d5 = c; + d5 += h0 * r5; + d5 += h1 * r4; + d5 += h2 * r3; + d5 += h3 * r2; + d5 += h4 * r1; + c = (d5 >>> 13); d5 &= 0x1fff; + d5 += h5 * r0; + d5 += h6 * (5 * r9); + d5 += h7 * (5 * r8); + d5 += h8 * (5 * r7); + d5 += h9 * (5 * r6); + c += (d5 >>> 13); d5 &= 0x1fff; + + d6 = c; + d6 += h0 * r6; + d6 += h1 * r5; + d6 += h2 * r4; + d6 += h3 * r3; + d6 += h4 * r2; + c = (d6 >>> 13); d6 &= 0x1fff; + d6 += h5 * r1; + d6 += h6 * r0; + d6 += h7 * (5 * r9); + d6 += h8 * (5 * r8); + d6 += h9 * (5 * r7); + c += (d6 >>> 13); d6 &= 0x1fff; + + d7 = c; + d7 += h0 * r7; + d7 += h1 * r6; + d7 += h2 * r5; + d7 += h3 * r4; + d7 += h4 * r3; + c = (d7 >>> 13); d7 &= 0x1fff; + d7 += h5 * r2; + d7 += h6 * r1; + d7 += h7 * r0; + d7 += h8 * (5 * r9); + d7 += h9 * (5 * r8); + c += (d7 >>> 13); d7 &= 0x1fff; + + d8 = c; + d8 += h0 * r8; + d8 += h1 * r7; + d8 += h2 * r6; + d8 += h3 * r5; + d8 += h4 * r4; + c = (d8 >>> 13); d8 &= 0x1fff; + d8 += h5 * r3; + d8 += h6 * r2; + d8 += h7 * r1; + d8 += h8 * r0; + d8 += h9 * (5 * r9); + c += (d8 >>> 13); d8 &= 0x1fff; + + d9 = c; + d9 += h0 * r9; + d9 += h1 * r8; + d9 += h2 * r7; + d9 += h3 * r6; + d9 += h4 * r5; + c = (d9 >>> 13); d9 &= 0x1fff; + d9 += h5 * r4; + d9 += h6 * r3; + d9 += h7 * r2; + d9 += h8 * r1; + d9 += h9 * r0; + c += (d9 >>> 13); d9 &= 0x1fff; + + c = (((c << 2) + c)) | 0; + c = (c + d0) | 0; + d0 = c & 0x1fff; + c = (c >>> 13); + d1 += c; + + h0 = d0; + h1 = d1; + h2 = d2; + h3 = d3; + h4 = d4; + h5 = d5; + h6 = d6; + h7 = d7; + h8 = d8; + h9 = d9; + + mpos += 16; + bytes -= 16; + } + this.h[0] = h0; + this.h[1] = h1; + this.h[2] = h2; + this.h[3] = h3; + this.h[4] = h4; + this.h[5] = h5; + this.h[6] = h6; + this.h[7] = h7; + this.h[8] = h8; + this.h[9] = h9; +}; + +poly1305.prototype.finish = function(mac, macpos) { + var g = new Uint16Array(10); + var c, mask, f, i; + + if (this.leftover) { + i = this.leftover; + this.buffer[i++] = 1; + for (; i < 16; i++) this.buffer[i] = 0; + this.fin = 1; + this.blocks(this.buffer, 0, 16); + } + + c = this.h[1] >>> 13; + this.h[1] &= 0x1fff; + for (i = 2; i < 10; i++) { + this.h[i] += c; + c = this.h[i] >>> 13; + this.h[i] &= 0x1fff; + } + this.h[0] += (c * 5); + c = this.h[0] >>> 13; + this.h[0] &= 0x1fff; + this.h[1] += c; + c = this.h[1] >>> 13; + this.h[1] &= 0x1fff; + this.h[2] += c; + + g[0] = this.h[0] + 5; + c = g[0] >>> 13; + g[0] &= 0x1fff; + for (i = 1; i < 10; i++) { + g[i] = this.h[i] + c; + c = g[i] >>> 13; + g[i] &= 0x1fff; + } + g[9] -= (1 << 13); + + mask = (c ^ 1) - 1; + for (i = 0; i < 10; i++) g[i] &= mask; + mask = ~mask; + for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i]; + + this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff; + this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff; + this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff; + this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff; + this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff; + this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff; + this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff; + this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff; + + f = this.h[0] + this.pad[0]; + this.h[0] = f & 0xffff; + for (i = 1; i < 8; i++) { + f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0; + this.h[i] = f & 0xffff; + } + + mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; + mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; + mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; + mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; + mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; + mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; + mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; + mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; + mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; + mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; + mac[macpos+10] = (this.h[5] >>> 0) & 0xff; + mac[macpos+11] = (this.h[5] >>> 8) & 0xff; + mac[macpos+12] = (this.h[6] >>> 0) & 0xff; + mac[macpos+13] = (this.h[6] >>> 8) & 0xff; + mac[macpos+14] = (this.h[7] >>> 0) & 0xff; + mac[macpos+15] = (this.h[7] >>> 8) & 0xff; +}; + +poly1305.prototype.update = function(m, mpos, bytes) { + var i, want; + + if (this.leftover) { + want = (16 - this.leftover); + if (want > bytes) + want = bytes; + for (i = 0; i < want; i++) + this.buffer[this.leftover + i] = m[mpos+i]; + bytes -= want; + mpos += want; + this.leftover += want; + if (this.leftover < 16) + return; + this.blocks(this.buffer, 0, 16); + this.leftover = 0; + } + + if (bytes >= 16) { + want = bytes - (bytes % 16); + this.blocks(m, mpos, want); + mpos += want; + bytes -= want; + } + + if (bytes) { + for (i = 0; i < bytes; i++) + this.buffer[this.leftover + i] = m[mpos+i]; + this.leftover += bytes; + } +}; + +function crypto_onetimeauth(out, outpos, m, mpos, n, k) { + var s = new poly1305(k); + s.update(m, mpos, n); + s.finish(out, outpos); + return 0; +} + +function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { + var x = new Uint8Array(16); + crypto_onetimeauth(x,0,m,mpos,n,k); + return crypto_verify_16(h,hpos,x,0); +} + +function crypto_secretbox(c,m,d,n,k) { + var i; + if (d < 32) return -1; + crypto_stream_xor(c,0,m,0,d,n,k); + crypto_onetimeauth(c, 16, c, 32, d - 32, c); + for (i = 0; i < 16; i++) c[i] = 0; + return 0; +} + +function crypto_secretbox_open(m,c,d,n,k) { + var i; + var x = new Uint8Array(32); + if (d < 32) return -1; + crypto_stream(x,0,32,n,k); + if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; + crypto_stream_xor(m,0,c,0,d,n,k); + for (i = 0; i < 32; i++) m[i] = 0; + return 0; +} + +function set25519(r, a) { + var i; + for (i = 0; i < 16; i++) r[i] = a[i]|0; +} + +function car25519(o) { + var i, v, c = 1; + for (i = 0; i < 16; i++) { + v = o[i] + c + 65535; + c = Math.floor(v / 65536); + o[i] = v - c * 65536; + } + o[0] += c-1 + 37 * (c-1); +} + +function sel25519(p, q, b) { + var t, c = ~(b-1); + for (var i = 0; i < 16; i++) { + t = c & (p[i] ^ q[i]); + p[i] ^= t; + q[i] ^= t; + } +} + +function pack25519(o, n) { + var i, j, b; + var m = gf(), t = gf(); + for (i = 0; i < 16; i++) t[i] = n[i]; + car25519(t); + car25519(t); + car25519(t); + for (j = 0; j < 2; j++) { + m[0] = t[0] - 0xffed; + for (i = 1; i < 15; i++) { + m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); + m[i-1] &= 0xffff; + } + m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); + b = (m[15]>>16) & 1; + m[14] &= 0xffff; + sel25519(t, m, 1-b); + } + for (i = 0; i < 16; i++) { + o[2*i] = t[i] & 0xff; + o[2*i+1] = t[i]>>8; + } +} + +function neq25519(a, b) { + var c = new Uint8Array(32), d = new Uint8Array(32); + pack25519(c, a); + pack25519(d, b); + return crypto_verify_32(c, 0, d, 0); +} + +function par25519(a) { + var d = new Uint8Array(32); + pack25519(d, a); + return d[0] & 1; +} + +function unpack25519(o, n) { + var i; + for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); + o[15] &= 0x7fff; +} + +function A(o, a, b) { + for (var i = 0; i < 16; i++) o[i] = a[i] + b[i]; +} + +function Z(o, a, b) { + for (var i = 0; i < 16; i++) o[i] = a[i] - b[i]; +} + +function M(o, a, b) { + var v, c, + t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, + t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, + t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, + t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, + b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3], + b4 = b[4], + b5 = b[5], + b6 = b[6], + b7 = b[7], + b8 = b[8], + b9 = b[9], + b10 = b[10], + b11 = b[11], + b12 = b[12], + b13 = b[13], + b14 = b[14], + b15 = b[15]; + + v = a[0]; + t0 += v * b0; + t1 += v * b1; + t2 += v * b2; + t3 += v * b3; + t4 += v * b4; + t5 += v * b5; + t6 += v * b6; + t7 += v * b7; + t8 += v * b8; + t9 += v * b9; + t10 += v * b10; + t11 += v * b11; + t12 += v * b12; + t13 += v * b13; + t14 += v * b14; + t15 += v * b15; + v = a[1]; + t1 += v * b0; + t2 += v * b1; + t3 += v * b2; + t4 += v * b3; + t5 += v * b4; + t6 += v * b5; + t7 += v * b6; + t8 += v * b7; + t9 += v * b8; + t10 += v * b9; + t11 += v * b10; + t12 += v * b11; + t13 += v * b12; + t14 += v * b13; + t15 += v * b14; + t16 += v * b15; + v = a[2]; + t2 += v * b0; + t3 += v * b1; + t4 += v * b2; + t5 += v * b3; + t6 += v * b4; + t7 += v * b5; + t8 += v * b6; + t9 += v * b7; + t10 += v * b8; + t11 += v * b9; + t12 += v * b10; + t13 += v * b11; + t14 += v * b12; + t15 += v * b13; + t16 += v * b14; + t17 += v * b15; + v = a[3]; + t3 += v * b0; + t4 += v * b1; + t5 += v * b2; + t6 += v * b3; + t7 += v * b4; + t8 += v * b5; + t9 += v * b6; + t10 += v * b7; + t11 += v * b8; + t12 += v * b9; + t13 += v * b10; + t14 += v * b11; + t15 += v * b12; + t16 += v * b13; + t17 += v * b14; + t18 += v * b15; + v = a[4]; + t4 += v * b0; + t5 += v * b1; + t6 += v * b2; + t7 += v * b3; + t8 += v * b4; + t9 += v * b5; + t10 += v * b6; + t11 += v * b7; + t12 += v * b8; + t13 += v * b9; + t14 += v * b10; + t15 += v * b11; + t16 += v * b12; + t17 += v * b13; + t18 += v * b14; + t19 += v * b15; + v = a[5]; + t5 += v * b0; + t6 += v * b1; + t7 += v * b2; + t8 += v * b3; + t9 += v * b4; + t10 += v * b5; + t11 += v * b6; + t12 += v * b7; + t13 += v * b8; + t14 += v * b9; + t15 += v * b10; + t16 += v * b11; + t17 += v * b12; + t18 += v * b13; + t19 += v * b14; + t20 += v * b15; + v = a[6]; + t6 += v * b0; + t7 += v * b1; + t8 += v * b2; + t9 += v * b3; + t10 += v * b4; + t11 += v * b5; + t12 += v * b6; + t13 += v * b7; + t14 += v * b8; + t15 += v * b9; + t16 += v * b10; + t17 += v * b11; + t18 += v * b12; + t19 += v * b13; + t20 += v * b14; + t21 += v * b15; + v = a[7]; + t7 += v * b0; + t8 += v * b1; + t9 += v * b2; + t10 += v * b3; + t11 += v * b4; + t12 += v * b5; + t13 += v * b6; + t14 += v * b7; + t15 += v * b8; + t16 += v * b9; + t17 += v * b10; + t18 += v * b11; + t19 += v * b12; + t20 += v * b13; + t21 += v * b14; + t22 += v * b15; + v = a[8]; + t8 += v * b0; + t9 += v * b1; + t10 += v * b2; + t11 += v * b3; + t12 += v * b4; + t13 += v * b5; + t14 += v * b6; + t15 += v * b7; + t16 += v * b8; + t17 += v * b9; + t18 += v * b10; + t19 += v * b11; + t20 += v * b12; + t21 += v * b13; + t22 += v * b14; + t23 += v * b15; + v = a[9]; + t9 += v * b0; + t10 += v * b1; + t11 += v * b2; + t12 += v * b3; + t13 += v * b4; + t14 += v * b5; + t15 += v * b6; + t16 += v * b7; + t17 += v * b8; + t18 += v * b9; + t19 += v * b10; + t20 += v * b11; + t21 += v * b12; + t22 += v * b13; + t23 += v * b14; + t24 += v * b15; + v = a[10]; + t10 += v * b0; + t11 += v * b1; + t12 += v * b2; + t13 += v * b3; + t14 += v * b4; + t15 += v * b5; + t16 += v * b6; + t17 += v * b7; + t18 += v * b8; + t19 += v * b9; + t20 += v * b10; + t21 += v * b11; + t22 += v * b12; + t23 += v * b13; + t24 += v * b14; + t25 += v * b15; + v = a[11]; + t11 += v * b0; + t12 += v * b1; + t13 += v * b2; + t14 += v * b3; + t15 += v * b4; + t16 += v * b5; + t17 += v * b6; + t18 += v * b7; + t19 += v * b8; + t20 += v * b9; + t21 += v * b10; + t22 += v * b11; + t23 += v * b12; + t24 += v * b13; + t25 += v * b14; + t26 += v * b15; + v = a[12]; + t12 += v * b0; + t13 += v * b1; + t14 += v * b2; + t15 += v * b3; + t16 += v * b4; + t17 += v * b5; + t18 += v * b6; + t19 += v * b7; + t20 += v * b8; + t21 += v * b9; + t22 += v * b10; + t23 += v * b11; + t24 += v * b12; + t25 += v * b13; + t26 += v * b14; + t27 += v * b15; + v = a[13]; + t13 += v * b0; + t14 += v * b1; + t15 += v * b2; + t16 += v * b3; + t17 += v * b4; + t18 += v * b5; + t19 += v * b6; + t20 += v * b7; + t21 += v * b8; + t22 += v * b9; + t23 += v * b10; + t24 += v * b11; + t25 += v * b12; + t26 += v * b13; + t27 += v * b14; + t28 += v * b15; + v = a[14]; + t14 += v * b0; + t15 += v * b1; + t16 += v * b2; + t17 += v * b3; + t18 += v * b4; + t19 += v * b5; + t20 += v * b6; + t21 += v * b7; + t22 += v * b8; + t23 += v * b9; + t24 += v * b10; + t25 += v * b11; + t26 += v * b12; + t27 += v * b13; + t28 += v * b14; + t29 += v * b15; + v = a[15]; + t15 += v * b0; + t16 += v * b1; + t17 += v * b2; + t18 += v * b3; + t19 += v * b4; + t20 += v * b5; + t21 += v * b6; + t22 += v * b7; + t23 += v * b8; + t24 += v * b9; + t25 += v * b10; + t26 += v * b11; + t27 += v * b12; + t28 += v * b13; + t29 += v * b14; + t30 += v * b15; + + t0 += 38 * t16; + t1 += 38 * t17; + t2 += 38 * t18; + t3 += 38 * t19; + t4 += 38 * t20; + t5 += 38 * t21; + t6 += 38 * t22; + t7 += 38 * t23; + t8 += 38 * t24; + t9 += 38 * t25; + t10 += 38 * t26; + t11 += 38 * t27; + t12 += 38 * t28; + t13 += 38 * t29; + t14 += 38 * t30; + // t15 left as is + + // first car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); + + // second car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); + + o[ 0] = t0; + o[ 1] = t1; + o[ 2] = t2; + o[ 3] = t3; + o[ 4] = t4; + o[ 5] = t5; + o[ 6] = t6; + o[ 7] = t7; + o[ 8] = t8; + o[ 9] = t9; + o[10] = t10; + o[11] = t11; + o[12] = t12; + o[13] = t13; + o[14] = t14; + o[15] = t15; +} + +function S(o, a) { + M(o, a, a); +} + +function inv25519(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 253; a >= 0; a--) { + S(c, c); + if(a !== 2 && a !== 4) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; +} + +function pow2523(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 250; a >= 0; a--) { + S(c, c); + if(a !== 1) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; +} + +function crypto_scalarmult(q, n, p) { + var z = new Uint8Array(32); + var x = new Float64Array(80), r, i; + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(); + for (i = 0; i < 31; i++) z[i] = n[i]; + z[31]=(n[31]&127)|64; + z[0]&=248; + unpack25519(x,p); + for (i = 0; i < 16; i++) { + b[i]=x[i]; + d[i]=a[i]=c[i]=0; + } + a[0]=d[0]=1; + for (i=254; i>=0; --i) { + r=(z[i>>>3]>>>(i&7))&1; + sel25519(a,b,r); + sel25519(c,d,r); + A(e,a,c); + Z(a,a,c); + A(c,b,d); + Z(b,b,d); + S(d,e); + S(f,a); + M(a,c,a); + M(c,b,e); + A(e,a,c); + Z(a,a,c); + S(b,a); + Z(c,d,f); + M(a,c,_121665); + A(a,a,d); + M(c,c,a); + M(a,d,f); + M(d,b,x); + S(b,e); + sel25519(a,b,r); + sel25519(c,d,r); + } + for (i = 0; i < 16; i++) { + x[i+16]=a[i]; + x[i+32]=c[i]; + x[i+48]=b[i]; + x[i+64]=d[i]; + } + var x32 = x.subarray(32); + var x16 = x.subarray(16); + inv25519(x32,x32); + M(x16,x16,x32); + pack25519(q,x16); + return 0; +} + +function crypto_scalarmult_base(q, n) { + return crypto_scalarmult(q, n, _9); +} + +function crypto_box_keypair(y, x) { + randombytes(x, 32); + return crypto_scalarmult_base(y, x); +} + +function crypto_box_beforenm(k, y, x) { + var s = new Uint8Array(32); + crypto_scalarmult(s, x, y); + return crypto_core_hsalsa20(k, _0, s, sigma); +} + +var crypto_box_afternm = crypto_secretbox; +var crypto_box_open_afternm = crypto_secretbox_open; + +function crypto_box(c, m, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_afternm(c, m, d, n, k); +} + +function crypto_box_open(m, c, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_open_afternm(m, c, d, n, k); +} + +var K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +function crypto_hashblocks_hl(hh, hl, m, n) { + var wh = new Int32Array(16), wl = new Int32Array(16), + bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, + bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, + th, tl, i, j, h, l, a, b, c, d; + + var ah0 = hh[0], + ah1 = hh[1], + ah2 = hh[2], + ah3 = hh[3], + ah4 = hh[4], + ah5 = hh[5], + ah6 = hh[6], + ah7 = hh[7], + + al0 = hl[0], + al1 = hl[1], + al2 = hl[2], + al3 = hl[3], + al4 = hl[4], + al5 = hl[5], + al6 = hl[6], + al7 = hl[7]; + + var pos = 0; + while (n >= 128) { + for (i = 0; i < 16; i++) { + j = 8 * i + pos; + wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3]; + wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7]; + } + for (i = 0; i < 80; i++) { + bh0 = ah0; + bh1 = ah1; + bh2 = ah2; + bh3 = ah3; + bh4 = ah4; + bh5 = ah5; + bh6 = ah6; + bh7 = ah7; + + bl0 = al0; + bl1 = al1; + bl2 = al2; + bl3 = al3; + bl4 = al4; + bl5 = al5; + bl6 = al6; + bl7 = al7; + + // add + h = ah7; + l = al7; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + // Sigma1 + h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32)))); + l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32)))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // Ch + h = (ah4 & ah5) ^ (~ah4 & ah6); + l = (al4 & al5) ^ (~al4 & al6); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // K + h = K[i*2]; + l = K[i*2+1]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // w + h = wh[i%16]; + l = wl[i%16]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + th = c & 0xffff | d << 16; + tl = a & 0xffff | b << 16; + + // add + h = th; + l = tl; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + // Sigma0 + h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32)))); + l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32)))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // Maj + h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2); + l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + bh7 = (c & 0xffff) | (d << 16); + bl7 = (a & 0xffff) | (b << 16); + + // add + h = bh3; + l = bl3; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = th; + l = tl; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + bh3 = (c & 0xffff) | (d << 16); + bl3 = (a & 0xffff) | (b << 16); + + ah1 = bh0; + ah2 = bh1; + ah3 = bh2; + ah4 = bh3; + ah5 = bh4; + ah6 = bh5; + ah7 = bh6; + ah0 = bh7; + + al1 = bl0; + al2 = bl1; + al3 = bl2; + al4 = bl3; + al5 = bl4; + al6 = bl5; + al7 = bl6; + al0 = bl7; + + if (i%16 === 15) { + for (j = 0; j < 16; j++) { + // add + h = wh[j]; + l = wl[j]; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = wh[(j+9)%16]; + l = wl[(j+9)%16]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // sigma0 + th = wh[(j+1)%16]; + tl = wl[(j+1)%16]; + h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7); + l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // sigma1 + th = wh[(j+14)%16]; + tl = wl[(j+14)%16]; + h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6); + l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + wh[j] = (c & 0xffff) | (d << 16); + wl[j] = (a & 0xffff) | (b << 16); + } + } + } + + // add + h = ah0; + l = al0; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[0]; + l = hl[0]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[0] = ah0 = (c & 0xffff) | (d << 16); + hl[0] = al0 = (a & 0xffff) | (b << 16); + + h = ah1; + l = al1; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[1]; + l = hl[1]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[1] = ah1 = (c & 0xffff) | (d << 16); + hl[1] = al1 = (a & 0xffff) | (b << 16); + + h = ah2; + l = al2; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[2]; + l = hl[2]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[2] = ah2 = (c & 0xffff) | (d << 16); + hl[2] = al2 = (a & 0xffff) | (b << 16); + + h = ah3; + l = al3; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[3]; + l = hl[3]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[3] = ah3 = (c & 0xffff) | (d << 16); + hl[3] = al3 = (a & 0xffff) | (b << 16); + + h = ah4; + l = al4; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[4]; + l = hl[4]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[4] = ah4 = (c & 0xffff) | (d << 16); + hl[4] = al4 = (a & 0xffff) | (b << 16); + + h = ah5; + l = al5; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[5]; + l = hl[5]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[5] = ah5 = (c & 0xffff) | (d << 16); + hl[5] = al5 = (a & 0xffff) | (b << 16); + + h = ah6; + l = al6; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[6]; + l = hl[6]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[6] = ah6 = (c & 0xffff) | (d << 16); + hl[6] = al6 = (a & 0xffff) | (b << 16); + + h = ah7; + l = al7; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[7]; + l = hl[7]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[7] = ah7 = (c & 0xffff) | (d << 16); + hl[7] = al7 = (a & 0xffff) | (b << 16); + + pos += 128; + n -= 128; + } + + return n; +} + +function crypto_hash(out, m, n) { + var hh = new Int32Array(8), + hl = new Int32Array(8), + x = new Uint8Array(256), + i, b = n; + + hh[0] = 0x6a09e667; + hh[1] = 0xbb67ae85; + hh[2] = 0x3c6ef372; + hh[3] = 0xa54ff53a; + hh[4] = 0x510e527f; + hh[5] = 0x9b05688c; + hh[6] = 0x1f83d9ab; + hh[7] = 0x5be0cd19; + + hl[0] = 0xf3bcc908; + hl[1] = 0x84caa73b; + hl[2] = 0xfe94f82b; + hl[3] = 0x5f1d36f1; + hl[4] = 0xade682d1; + hl[5] = 0x2b3e6c1f; + hl[6] = 0xfb41bd6b; + hl[7] = 0x137e2179; + + crypto_hashblocks_hl(hh, hl, m, n); + n %= 128; + + for (i = 0; i < n; i++) x[i] = m[b-n+i]; + x[n] = 128; + + n = 256-128*(n<112?1:0); + x[n-9] = 0; + ts64(x, n-8, (b / 0x20000000) | 0, b << 3); + crypto_hashblocks_hl(hh, hl, x, n); + + for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]); + + return 0; +} + +function add(p, q) { + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(), + g = gf(), h = gf(), t = gf(); + + Z(a, p[1], p[0]); + Z(t, q[1], q[0]); + M(a, a, t); + A(b, p[0], p[1]); + A(t, q[0], q[1]); + M(b, b, t); + M(c, p[3], q[3]); + M(c, c, D2); + M(d, p[2], q[2]); + A(d, d, d); + Z(e, b, a); + Z(f, d, c); + A(g, d, c); + A(h, b, a); + + M(p[0], e, f); + M(p[1], h, g); + M(p[2], g, f); + M(p[3], e, h); +} + +function cswap(p, q, b) { + var i; + for (i = 0; i < 4; i++) { + sel25519(p[i], q[i], b); + } +} + +function pack(r, p) { + var tx = gf(), ty = gf(), zi = gf(); + inv25519(zi, p[2]); + M(tx, p[0], zi); + M(ty, p[1], zi); + pack25519(r, ty); + r[31] ^= par25519(tx) << 7; +} + +function scalarmult(p, q, s) { + var b, i; + set25519(p[0], gf0); + set25519(p[1], gf1); + set25519(p[2], gf1); + set25519(p[3], gf0); + for (i = 255; i >= 0; --i) { + b = (s[(i/8)|0] >> (i&7)) & 1; + cswap(p, q, b); + add(q, p); + add(p, p); + cswap(p, q, b); + } +} + +function scalarbase(p, s) { + var q = [gf(), gf(), gf(), gf()]; + set25519(q[0], X); + set25519(q[1], Y); + set25519(q[2], gf1); + M(q[3], X, Y); + scalarmult(p, q, s); +} + +function crypto_sign_keypair(pk, sk, seeded) { + var d = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()]; + var i; + + if (!seeded) randombytes(sk, 32); + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + scalarbase(p, d); + pack(pk, p); + + for (i = 0; i < 32; i++) sk[i+32] = pk[i]; + return 0; +} + +var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); + +function modL(r, x) { + var carry, i, j, k; + for (i = 63; i >= 32; --i) { + carry = 0; + for (j = i - 32, k = i - 12; j < k; ++j) { + x[j] += carry - 16 * x[i] * L[j - (i - 32)]; + carry = (x[j] + 128) >> 8; + x[j] -= carry * 256; + } + x[j] += carry; + x[i] = 0; + } + carry = 0; + for (j = 0; j < 32; j++) { + x[j] += carry - (x[31] >> 4) * L[j]; + carry = x[j] >> 8; + x[j] &= 255; + } + for (j = 0; j < 32; j++) x[j] -= carry * L[j]; + for (i = 0; i < 32; i++) { + x[i+1] += x[i] >> 8; + r[i] = x[i] & 255; + } +} + +function reduce(r) { + var x = new Float64Array(64), i; + for (i = 0; i < 64; i++) x[i] = r[i]; + for (i = 0; i < 64; i++) r[i] = 0; + modL(r, x); +} + +// Note: difference from C - smlen returned, not passed as argument. +function crypto_sign(sm, m, n, sk) { + var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); + var i, j, x = new Float64Array(64); + var p = [gf(), gf(), gf(), gf()]; + + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + var smlen = n + 64; + for (i = 0; i < n; i++) sm[64 + i] = m[i]; + for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; + + crypto_hash(r, sm.subarray(32), n+32); + reduce(r); + scalarbase(p, r); + pack(sm, p); + + for (i = 32; i < 64; i++) sm[i] = sk[i]; + crypto_hash(h, sm, n + 64); + reduce(h); + + for (i = 0; i < 64; i++) x[i] = 0; + for (i = 0; i < 32; i++) x[i] = r[i]; + for (i = 0; i < 32; i++) { + for (j = 0; j < 32; j++) { + x[i+j] += h[i] * d[j]; + } + } + + modL(sm.subarray(32), x); + return smlen; +} + +function unpackneg(r, p) { + var t = gf(), chk = gf(), num = gf(), + den = gf(), den2 = gf(), den4 = gf(), + den6 = gf(); + + set25519(r[2], gf1); + unpack25519(r[1], p); + S(num, r[1]); + M(den, num, D); + Z(num, num, r[2]); + A(den, r[2], den); + + S(den2, den); + S(den4, den2); + M(den6, den4, den2); + M(t, den6, num); + M(t, t, den); + + pow2523(t, t); + M(t, t, num); + M(t, t, den); + M(t, t, den); + M(r[0], t, den); + + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) M(r[0], r[0], I); + + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) return -1; + + if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); + + M(r[3], r[0], r[1]); + return 0; +} + +function crypto_sign_open(m, sm, n, pk) { + var i, mlen; + var t = new Uint8Array(32), h = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()], + q = [gf(), gf(), gf(), gf()]; + + mlen = -1; + if (n < 64) return -1; + + if (unpackneg(q, pk)) return -1; + + for (i = 0; i < n; i++) m[i] = sm[i]; + for (i = 0; i < 32; i++) m[i+32] = pk[i]; + crypto_hash(h, m, n); + reduce(h); + scalarmult(p, q, h); + + scalarbase(q, sm.subarray(32)); + add(p, q); + pack(t, p); + + n -= 64; + if (crypto_verify_32(sm, 0, t, 0)) { + for (i = 0; i < n; i++) m[i] = 0; + return -1; + } + + for (i = 0; i < n; i++) m[i] = sm[i + 64]; + mlen = n; + return mlen; +} + +var crypto_secretbox_KEYBYTES = 32, + crypto_secretbox_NONCEBYTES = 24, + crypto_secretbox_ZEROBYTES = 32, + crypto_secretbox_BOXZEROBYTES = 16, + crypto_scalarmult_BYTES = 32, + crypto_scalarmult_SCALARBYTES = 32, + crypto_box_PUBLICKEYBYTES = 32, + crypto_box_SECRETKEYBYTES = 32, + crypto_box_BEFORENMBYTES = 32, + crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, + crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, + crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, + crypto_sign_BYTES = 64, + crypto_sign_PUBLICKEYBYTES = 32, + crypto_sign_SECRETKEYBYTES = 64, + crypto_sign_SEEDBYTES = 32, + crypto_hash_BYTES = 64; + +nacl.lowlevel = { + crypto_core_hsalsa20: crypto_core_hsalsa20, + crypto_stream_xor: crypto_stream_xor, + crypto_stream: crypto_stream, + crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, + crypto_stream_salsa20: crypto_stream_salsa20, + crypto_onetimeauth: crypto_onetimeauth, + crypto_onetimeauth_verify: crypto_onetimeauth_verify, + crypto_verify_16: crypto_verify_16, + crypto_verify_32: crypto_verify_32, + crypto_secretbox: crypto_secretbox, + crypto_secretbox_open: crypto_secretbox_open, + crypto_scalarmult: crypto_scalarmult, + crypto_scalarmult_base: crypto_scalarmult_base, + crypto_box_beforenm: crypto_box_beforenm, + crypto_box_afternm: crypto_box_afternm, + crypto_box: crypto_box, + crypto_box_open: crypto_box_open, + crypto_box_keypair: crypto_box_keypair, + crypto_hash: crypto_hash, + crypto_sign: crypto_sign, + crypto_sign_keypair: crypto_sign_keypair, + crypto_sign_open: crypto_sign_open, + + crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, + crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, + crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, + crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, + crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, + crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, + crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, + crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, + crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, + crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, + crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, + crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, + crypto_sign_BYTES: crypto_sign_BYTES, + crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, + crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, + crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, + crypto_hash_BYTES: crypto_hash_BYTES +}; + +/* High-level API */ + +function checkLengths(k, n) { + if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); + if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); +} + +function checkBoxLengths(pk, sk) { + if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); + if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); +} + +function checkArrayTypes() { + var t, i; + for (i = 0; i < arguments.length; i++) { + if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') + throw new TypeError('unexpected type ' + t + ', use Uint8Array'); + } +} + +function cleanup(arr) { + for (var i = 0; i < arr.length; i++) arr[i] = 0; +} + +// TODO: Completely remove this in v0.15. +if (!nacl.util) { + nacl.util = {}; + nacl.util.decodeUTF8 = nacl.util.encodeUTF8 = nacl.util.encodeBase64 = nacl.util.decodeBase64 = function() { + throw new Error('nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js'); + }; +} + +nacl.randomBytes = function(n) { + var b = new Uint8Array(n); + randombytes(b, n); + return b; +}; + +nacl.secretbox = function(msg, nonce, key) { + checkArrayTypes(msg, nonce, key); + checkLengths(key, nonce); + var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); + var c = new Uint8Array(m.length); + for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; + crypto_secretbox(c, m, m.length, nonce, key); + return c.subarray(crypto_secretbox_BOXZEROBYTES); +}; + +nacl.secretbox.open = function(box, nonce, key) { + checkArrayTypes(box, nonce, key); + checkLengths(key, nonce); + var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); + var m = new Uint8Array(c.length); + for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; + if (c.length < 32) return false; + if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; + return m.subarray(crypto_secretbox_ZEROBYTES); +}; + +nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; +nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; +nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; + +nacl.scalarMult = function(n, p) { + checkArrayTypes(n, p); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult(q, n, p); + return q; +}; + +nacl.scalarMult.base = function(n) { + checkArrayTypes(n); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult_base(q, n); + return q; +}; + +nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; +nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; + +nacl.box = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox(msg, nonce, k); +}; + +nacl.box.before = function(publicKey, secretKey) { + checkArrayTypes(publicKey, secretKey); + checkBoxLengths(publicKey, secretKey); + var k = new Uint8Array(crypto_box_BEFORENMBYTES); + crypto_box_beforenm(k, publicKey, secretKey); + return k; +}; + +nacl.box.after = nacl.secretbox; + +nacl.box.open = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox.open(msg, nonce, k); +}; + +nacl.box.open.after = nacl.secretbox.open; + +nacl.box.keyPair = function() { + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); + crypto_box_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.box.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_box_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + crypto_scalarmult_base(pk, secretKey); + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; + +nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; +nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; +nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; +nacl.box.nonceLength = crypto_box_NONCEBYTES; +nacl.box.overheadLength = nacl.secretbox.overheadLength; + +nacl.sign = function(msg, secretKey) { + checkArrayTypes(msg, secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); + crypto_sign(signedMsg, msg, msg.length, secretKey); + return signedMsg; +}; + +nacl.sign.open = function(signedMsg, publicKey) { + if (arguments.length !== 2) + throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); + checkArrayTypes(signedMsg, publicKey); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var tmp = new Uint8Array(signedMsg.length); + var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); + if (mlen < 0) return null; + var m = new Uint8Array(mlen); + for (var i = 0; i < m.length; i++) m[i] = tmp[i]; + return m; +}; + +nacl.sign.detached = function(msg, secretKey) { + var signedMsg = nacl.sign(msg, secretKey); + var sig = new Uint8Array(crypto_sign_BYTES); + for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; + return sig; +}; + +nacl.sign.detached.verify = function(msg, sig, publicKey) { + checkArrayTypes(msg, sig, publicKey); + if (sig.length !== crypto_sign_BYTES) + throw new Error('bad signature size'); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var sm = new Uint8Array(crypto_sign_BYTES + msg.length); + var m = new Uint8Array(crypto_sign_BYTES + msg.length); + var i; + for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; + for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; + return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); +}; + +nacl.sign.keyPair = function() { + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + crypto_sign_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.sign.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; + +nacl.sign.keyPair.fromSeed = function(seed) { + checkArrayTypes(seed); + if (seed.length !== crypto_sign_SEEDBYTES) + throw new Error('bad seed size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + for (var i = 0; i < 32; i++) sk[i] = seed[i]; + crypto_sign_keypair(pk, sk, true); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; +nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; +nacl.sign.seedLength = crypto_sign_SEEDBYTES; +nacl.sign.signatureLength = crypto_sign_BYTES; + +nacl.hash = function(msg) { + checkArrayTypes(msg); + var h = new Uint8Array(crypto_hash_BYTES); + crypto_hash(h, msg, msg.length); + return h; +}; + +nacl.hash.hashLength = crypto_hash_BYTES; + +nacl.verify = function(x, y) { + checkArrayTypes(x, y); + // Zero length arguments are considered not equal. + if (x.length === 0 || y.length === 0) return false; + if (x.length !== y.length) return false; + return (vn(x, 0, y, 0, x.length) === 0) ? true : false; +}; + +nacl.setPRNG = function(fn) { + randombytes = fn; +}; + +(function() { + // Initialize PRNG if environment provides CSPRNG. + // If not, methods calling randombytes will throw. + var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; + if (crypto && crypto.getRandomValues) { + // Browsers. + var QUOTA = 65536; + nacl.setPRNG(function(x, n) { + var i, v = new Uint8Array(n); + for (i = 0; i < n; i += QUOTA) { + crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); + } + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } else if (typeof require !== 'undefined') { + // Node.js. + crypto = require('crypto'); + if (crypto && crypto.randomBytes) { + nacl.setPRNG(function(x, n) { + var i, v = crypto.randomBytes(n); + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } + } +})(); + +})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); diff --git a/appasar/canary/node_modules/tweetnacl/nacl-fast.min.js b/appasar/canary/node_modules/tweetnacl/nacl-fast.min.js new file mode 100644 index 0000000..8bc47da --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/nacl-fast.min.js @@ -0,0 +1,2 @@ +!function(r){"use strict";function t(r,t,n,e){r[t]=n>>24&255,r[t+1]=n>>16&255,r[t+2]=n>>8&255,r[t+3]=255&n,r[t+4]=e>>24&255,r[t+5]=e>>16&255,r[t+6]=e>>8&255,r[t+7]=255&e}function n(r,t,n,e,o){var i,h=0;for(i=0;i>>8)-1}function e(r,t,e,o){return n(r,t,e,o,16)}function o(r,t,e,o){return n(r,t,e,o,32)}function i(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,c=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,v=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,b=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,g=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,_=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,d=i,U=h,E=a,x=f,M=s,m=c,B=u,S=y,K=l,T=w,Y=p,k=v,L=b,z=g,R=_,P=A,O=0;O<20;O+=2)o=d+L|0,M^=o<<7|o>>>25,o=M+d|0,K^=o<<9|o>>>23,o=K+M|0,L^=o<<13|o>>>19,o=L+K|0,d^=o<<18|o>>>14,o=m+U|0,T^=o<<7|o>>>25,o=T+m|0,z^=o<<9|o>>>23,o=z+T|0,U^=o<<13|o>>>19,o=U+z|0,m^=o<<18|o>>>14,o=Y+B|0,R^=o<<7|o>>>25,o=R+Y|0,E^=o<<9|o>>>23,o=E+R|0,B^=o<<13|o>>>19,o=B+E|0,Y^=o<<18|o>>>14,o=P+k|0,x^=o<<7|o>>>25,o=x+P|0,S^=o<<9|o>>>23,o=S+x|0,k^=o<<13|o>>>19,o=k+S|0,P^=o<<18|o>>>14,o=d+x|0,U^=o<<7|o>>>25,o=U+d|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,d^=o<<18|o>>>14,o=m+M|0,B^=o<<7|o>>>25,o=B+m|0,S^=o<<9|o>>>23,o=S+B|0,M^=o<<13|o>>>19,o=M+S|0,m^=o<<18|o>>>14,o=Y+T|0,k^=o<<7|o>>>25,o=k+Y|0,K^=o<<9|o>>>23,o=K+k|0,T^=o<<13|o>>>19,o=T+K|0,Y^=o<<18|o>>>14,o=P+R|0,L^=o<<7|o>>>25,o=L+P|0,z^=o<<9|o>>>23,o=z+L|0,R^=o<<13|o>>>19,o=R+z|0,P^=o<<18|o>>>14;d=d+i|0,U=U+h|0,E=E+a|0,x=x+f|0,M=M+s|0,m=m+c|0,B=B+u|0,S=S+y|0,K=K+l|0,T=T+w|0,Y=Y+p|0,k=k+v|0,L=L+b|0,z=z+g|0,R=R+_|0,P=P+A|0,r[0]=d>>>0&255,r[1]=d>>>8&255,r[2]=d>>>16&255,r[3]=d>>>24&255,r[4]=U>>>0&255,r[5]=U>>>8&255,r[6]=U>>>16&255,r[7]=U>>>24&255,r[8]=E>>>0&255,r[9]=E>>>8&255,r[10]=E>>>16&255,r[11]=E>>>24&255,r[12]=x>>>0&255,r[13]=x>>>8&255,r[14]=x>>>16&255,r[15]=x>>>24&255,r[16]=M>>>0&255,r[17]=M>>>8&255,r[18]=M>>>16&255,r[19]=M>>>24&255,r[20]=m>>>0&255,r[21]=m>>>8&255,r[22]=m>>>16&255,r[23]=m>>>24&255,r[24]=B>>>0&255,r[25]=B>>>8&255,r[26]=B>>>16&255,r[27]=B>>>24&255,r[28]=S>>>0&255,r[29]=S>>>8&255,r[30]=S>>>16&255,r[31]=S>>>24&255,r[32]=K>>>0&255,r[33]=K>>>8&255,r[34]=K>>>16&255,r[35]=K>>>24&255,r[36]=T>>>0&255,r[37]=T>>>8&255,r[38]=T>>>16&255,r[39]=T>>>24&255,r[40]=Y>>>0&255,r[41]=Y>>>8&255,r[42]=Y>>>16&255,r[43]=Y>>>24&255,r[44]=k>>>0&255,r[45]=k>>>8&255,r[46]=k>>>16&255,r[47]=k>>>24&255,r[48]=L>>>0&255,r[49]=L>>>8&255,r[50]=L>>>16&255,r[51]=L>>>24&255,r[52]=z>>>0&255,r[53]=z>>>8&255,r[54]=z>>>16&255,r[55]=z>>>24&255,r[56]=R>>>0&255,r[57]=R>>>8&255,r[58]=R>>>16&255,r[59]=R>>>24&255,r[60]=P>>>0&255,r[61]=P>>>8&255,r[62]=P>>>16&255,r[63]=P>>>24&255}function h(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,c=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,v=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,b=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,g=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,_=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,d=i,U=h,E=a,x=f,M=s,m=c,B=u,S=y,K=l,T=w,Y=p,k=v,L=b,z=g,R=_,P=A,O=0;O<20;O+=2)o=d+L|0,M^=o<<7|o>>>25,o=M+d|0,K^=o<<9|o>>>23,o=K+M|0,L^=o<<13|o>>>19,o=L+K|0,d^=o<<18|o>>>14,o=m+U|0,T^=o<<7|o>>>25,o=T+m|0,z^=o<<9|o>>>23,o=z+T|0,U^=o<<13|o>>>19,o=U+z|0,m^=o<<18|o>>>14,o=Y+B|0,R^=o<<7|o>>>25,o=R+Y|0,E^=o<<9|o>>>23,o=E+R|0,B^=o<<13|o>>>19,o=B+E|0,Y^=o<<18|o>>>14,o=P+k|0,x^=o<<7|o>>>25,o=x+P|0,S^=o<<9|o>>>23,o=S+x|0,k^=o<<13|o>>>19,o=k+S|0,P^=o<<18|o>>>14,o=d+x|0,U^=o<<7|o>>>25,o=U+d|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,d^=o<<18|o>>>14,o=m+M|0,B^=o<<7|o>>>25,o=B+m|0,S^=o<<9|o>>>23,o=S+B|0,M^=o<<13|o>>>19,o=M+S|0,m^=o<<18|o>>>14,o=Y+T|0,k^=o<<7|o>>>25,o=k+Y|0,K^=o<<9|o>>>23,o=K+k|0,T^=o<<13|o>>>19,o=T+K|0,Y^=o<<18|o>>>14,o=P+R|0,L^=o<<7|o>>>25,o=L+P|0,z^=o<<9|o>>>23,o=z+L|0,R^=o<<13|o>>>19,o=R+z|0,P^=o<<18|o>>>14;r[0]=d>>>0&255,r[1]=d>>>8&255,r[2]=d>>>16&255,r[3]=d>>>24&255,r[4]=m>>>0&255,r[5]=m>>>8&255,r[6]=m>>>16&255,r[7]=m>>>24&255,r[8]=Y>>>0&255,r[9]=Y>>>8&255,r[10]=Y>>>16&255,r[11]=Y>>>24&255,r[12]=P>>>0&255,r[13]=P>>>8&255,r[14]=P>>>16&255,r[15]=P>>>24&255,r[16]=B>>>0&255,r[17]=B>>>8&255,r[18]=B>>>16&255,r[19]=B>>>24&255,r[20]=S>>>0&255,r[21]=S>>>8&255,r[22]=S>>>16&255,r[23]=S>>>24&255,r[24]=K>>>0&255,r[25]=K>>>8&255,r[26]=K>>>16&255,r[27]=K>>>24&255,r[28]=T>>>0&255,r[29]=T>>>8&255,r[30]=T>>>16&255,r[31]=T>>>24&255}function a(r,t,n,e){i(r,t,n,e)}function f(r,t,n,e){h(r,t,n,e)}function s(r,t,n,e,o,i,h){var f,s,c=new Uint8Array(16),u=new Uint8Array(64);for(s=0;s<16;s++)c[s]=0;for(s=0;s<8;s++)c[s]=i[s];for(;o>=64;){for(a(u,c,h,ur),s=0;s<64;s++)r[t+s]=n[e+s]^u[s];for(f=1,s=8;s<16;s++)f=f+(255&c[s])|0,c[s]=255&f,f>>>=8;o-=64,t+=64,e+=64}if(o>0)for(a(u,c,h,ur),s=0;s=64;){for(a(s,f,o,ur),h=0;h<64;h++)r[t+h]=s[h];for(i=1,h=8;h<16;h++)i=i+(255&f[h])|0,f[h]=255&i,i>>>=8;n-=64,t+=64}if(n>0)for(a(s,f,o,ur),h=0;h>16&1),i[n-1]&=65535;i[15]=h[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,_(h,i,1-o)}for(n=0;n<16;n++)r[2*n]=255&h[n],r[2*n+1]=h[n]>>8}function d(r,t){var n=new Uint8Array(32),e=new Uint8Array(32);return A(n,r),A(e,t),o(n,0,e,0)}function U(r){var t=new Uint8Array(32);return A(t,r),1&t[0]}function E(r,t){var n;for(n=0;n<16;n++)r[n]=t[2*n]+(t[2*n+1]<<8);r[15]&=32767}function x(r,t,n){for(var e=0;e<16;e++)r[e]=t[e]+n[e]}function M(r,t,n){for(var e=0;e<16;e++)r[e]=t[e]-n[e]}function m(r,t,n){var e,o,i=0,h=0,a=0,f=0,s=0,c=0,u=0,y=0,l=0,w=0,p=0,v=0,b=0,g=0,_=0,A=0,d=0,U=0,E=0,x=0,M=0,m=0,B=0,S=0,K=0,T=0,Y=0,k=0,L=0,z=0,R=0,P=n[0],O=n[1],N=n[2],C=n[3],F=n[4],I=n[5],G=n[6],Z=n[7],j=n[8],q=n[9],V=n[10],X=n[11],D=n[12],H=n[13],J=n[14],Q=n[15];e=t[0],i+=e*P,h+=e*O,a+=e*N,f+=e*C,s+=e*F,c+=e*I,u+=e*G,y+=e*Z,l+=e*j,w+=e*q,p+=e*V,v+=e*X,b+=e*D,g+=e*H,_+=e*J,A+=e*Q,e=t[1],h+=e*P,a+=e*O,f+=e*N,s+=e*C,c+=e*F,u+=e*I,y+=e*G,l+=e*Z,w+=e*j,p+=e*q,v+=e*V,b+=e*X,g+=e*D,_+=e*H,A+=e*J,d+=e*Q,e=t[2],a+=e*P,f+=e*O,s+=e*N,c+=e*C,u+=e*F,y+=e*I,l+=e*G,w+=e*Z,p+=e*j,v+=e*q,b+=e*V,g+=e*X,_+=e*D,A+=e*H,d+=e*J,U+=e*Q,e=t[3],f+=e*P,s+=e*O,c+=e*N,u+=e*C,y+=e*F,l+=e*I,w+=e*G,p+=e*Z,v+=e*j,b+=e*q,g+=e*V,_+=e*X,A+=e*D,d+=e*H,U+=e*J,E+=e*Q,e=t[4],s+=e*P,c+=e*O,u+=e*N,y+=e*C,l+=e*F,w+=e*I,p+=e*G,v+=e*Z,b+=e*j,g+=e*q,_+=e*V,A+=e*X,d+=e*D,U+=e*H,E+=e*J,x+=e*Q,e=t[5],c+=e*P,u+=e*O,y+=e*N,l+=e*C,w+=e*F,p+=e*I,v+=e*G,b+=e*Z,g+=e*j,_+=e*q,A+=e*V,d+=e*X,U+=e*D,E+=e*H,x+=e*J,M+=e*Q,e=t[6],u+=e*P,y+=e*O,l+=e*N,w+=e*C,p+=e*F,v+=e*I,b+=e*G,g+=e*Z,_+=e*j,A+=e*q,d+=e*V,U+=e*X,E+=e*D,x+=e*H,M+=e*J,m+=e*Q,e=t[7],y+=e*P,l+=e*O,w+=e*N,p+=e*C,v+=e*F,b+=e*I,g+=e*G,_+=e*Z,A+=e*j,d+=e*q,U+=e*V,E+=e*X,x+=e*D,M+=e*H,m+=e*J,B+=e*Q,e=t[8],l+=e*P,w+=e*O,p+=e*N,v+=e*C,b+=e*F,g+=e*I,_+=e*G,A+=e*Z,d+=e*j,U+=e*q,E+=e*V,x+=e*X,M+=e*D,m+=e*H,B+=e*J,S+=e*Q,e=t[9],w+=e*P,p+=e*O,v+=e*N,b+=e*C,g+=e*F,_+=e*I,A+=e*G,d+=e*Z,U+=e*j,E+=e*q,x+=e*V,M+=e*X,m+=e*D,B+=e*H,S+=e*J,K+=e*Q,e=t[10],p+=e*P,v+=e*O,b+=e*N,g+=e*C,_+=e*F,A+=e*I,d+=e*G,U+=e*Z,E+=e*j,x+=e*q,M+=e*V,m+=e*X,B+=e*D,S+=e*H,K+=e*J,T+=e*Q,e=t[11],v+=e*P,b+=e*O,g+=e*N,_+=e*C,A+=e*F,d+=e*I,U+=e*G,E+=e*Z,x+=e*j,M+=e*q,m+=e*V,B+=e*X;S+=e*D;K+=e*H,T+=e*J,Y+=e*Q,e=t[12],b+=e*P,g+=e*O,_+=e*N,A+=e*C,d+=e*F,U+=e*I,E+=e*G,x+=e*Z,M+=e*j,m+=e*q,B+=e*V,S+=e*X,K+=e*D,T+=e*H,Y+=e*J,k+=e*Q,e=t[13],g+=e*P,_+=e*O,A+=e*N,d+=e*C,U+=e*F,E+=e*I,x+=e*G,M+=e*Z,m+=e*j,B+=e*q,S+=e*V,K+=e*X,T+=e*D,Y+=e*H,k+=e*J,L+=e*Q,e=t[14],_+=e*P,A+=e*O,d+=e*N,U+=e*C,E+=e*F,x+=e*I,M+=e*G,m+=e*Z,B+=e*j,S+=e*q,K+=e*V,T+=e*X,Y+=e*D,k+=e*H,L+=e*J,z+=e*Q,e=t[15],A+=e*P,d+=e*O,U+=e*N,E+=e*C,x+=e*F,M+=e*I,m+=e*G,B+=e*Z,S+=e*j,K+=e*q,T+=e*V,Y+=e*X,k+=e*D,L+=e*H,z+=e*J,R+=e*Q,i+=38*d,h+=38*U,a+=38*E,f+=38*x,s+=38*M,c+=38*m,u+=38*B,y+=38*S,l+=38*K,w+=38*T,p+=38*Y,v+=38*k,b+=38*L,g+=38*z,_+=38*R,o=1,e=i+o+65535,o=Math.floor(e/65536),i=e-65536*o,e=h+o+65535,o=Math.floor(e/65536),h=e-65536*o,e=a+o+65535,o=Math.floor(e/65536),a=e-65536*o,e=f+o+65535,o=Math.floor(e/65536),f=e-65536*o,e=s+o+65535,o=Math.floor(e/65536),s=e-65536*o,e=c+o+65535,o=Math.floor(e/65536),c=e-65536*o,e=u+o+65535,o=Math.floor(e/65536),u=e-65536*o,e=y+o+65535,o=Math.floor(e/65536),y=e-65536*o,e=l+o+65535,o=Math.floor(e/65536),l=e-65536*o,e=w+o+65535,o=Math.floor(e/65536),w=e-65536*o,e=p+o+65535,o=Math.floor(e/65536),p=e-65536*o,e=v+o+65535,o=Math.floor(e/65536),v=e-65536*o,e=b+o+65535,o=Math.floor(e/65536),b=e-65536*o,e=g+o+65535,o=Math.floor(e/65536),g=e-65536*o,e=_+o+65535,o=Math.floor(e/65536),_=e-65536*o,e=A+o+65535,o=Math.floor(e/65536),A=e-65536*o,i+=o-1+37*(o-1),o=1,e=i+o+65535,o=Math.floor(e/65536),i=e-65536*o,e=h+o+65535,o=Math.floor(e/65536),h=e-65536*o,e=a+o+65535,o=Math.floor(e/65536),a=e-65536*o,e=f+o+65535,o=Math.floor(e/65536),f=e-65536*o,e=s+o+65535,o=Math.floor(e/65536),s=e-65536*o,e=c+o+65535,o=Math.floor(e/65536),c=e-65536*o,e=u+o+65535,o=Math.floor(e/65536),u=e-65536*o,e=y+o+65535,o=Math.floor(e/65536),y=e-65536*o,e=l+o+65535,o=Math.floor(e/65536),l=e-65536*o,e=w+o+65535,o=Math.floor(e/65536),w=e-65536*o,e=p+o+65535,o=Math.floor(e/65536),p=e-65536*o,e=v+o+65535,o=Math.floor(e/65536),v=e-65536*o,e=b+o+65535,o=Math.floor(e/65536),b=e-65536*o,e=g+o+65535,o=Math.floor(e/65536),g=e-65536*o,e=_+o+65535,o=Math.floor(e/65536),_=e-65536*o,e=A+o+65535,o=Math.floor(e/65536),A=e-65536*o,i+=o-1+37*(o-1),r[0]=i,r[1]=h,r[2]=a,r[3]=f,r[4]=s,r[5]=c,r[6]=u,r[7]=y,r[8]=l,r[9]=w,r[10]=p,r[11]=v,r[12]=b,r[13]=g;r[14]=_;r[15]=A}function B(r,t){m(r,t,t)}function S(r,t){var n,e=$();for(n=0;n<16;n++)e[n]=t[n];for(n=253;n>=0;n--)B(e,e),2!==n&&4!==n&&m(e,e,t);for(n=0;n<16;n++)r[n]=e[n]}function K(r,t){var n,e=$();for(n=0;n<16;n++)e[n]=t[n];for(n=250;n>=0;n--)B(e,e),1!==n&&m(e,e,t);for(n=0;n<16;n++)r[n]=e[n]}function T(r,t,n){var e,o,i=new Uint8Array(32),h=new Float64Array(80),a=$(),f=$(),s=$(),c=$(),u=$(),y=$();for(o=0;o<31;o++)i[o]=t[o];for(i[31]=127&t[31]|64,i[0]&=248,E(h,n),o=0;o<16;o++)f[o]=h[o],c[o]=a[o]=s[o]=0;for(a[0]=c[0]=1,o=254;o>=0;--o)e=i[o>>>3]>>>(7&o)&1,_(a,f,e),_(s,c,e),x(u,a,s),M(a,a,s),x(s,f,c),M(f,f,c),B(c,u),B(y,a),m(a,s,a),m(s,f,u),x(u,a,s),M(a,a,s),B(f,a),M(s,c,y),m(a,s,ir),x(a,a,c),m(s,s,a),m(a,c,y),m(c,f,h),B(f,u),_(a,f,e),_(s,c,e);for(o=0;o<16;o++)h[o+16]=a[o],h[o+32]=s[o],h[o+48]=f[o],h[o+64]=c[o];var l=h.subarray(32),w=h.subarray(16);return S(l,l),m(w,w,l),A(r,w),0}function Y(r,t){return T(r,t,nr)}function k(r,t){return rr(t,32),Y(r,t)}function L(r,t,n){var e=new Uint8Array(32);return T(e,n,t),f(r,tr,e,ur)}function z(r,t,n,e,o,i){var h=new Uint8Array(32);return L(h,o,i),lr(r,t,n,e,h)}function R(r,t,n,e,o,i){var h=new Uint8Array(32);return L(h,o,i),wr(r,t,n,e,h)}function P(r,t,n,e){for(var o,i,h,a,f,s,c,u,y,l,w,p,v,b,g,_,A,d,U,E,x,M,m,B,S,K,T=new Int32Array(16),Y=new Int32Array(16),k=r[0],L=r[1],z=r[2],R=r[3],P=r[4],O=r[5],N=r[6],C=r[7],F=t[0],I=t[1],G=t[2],Z=t[3],j=t[4],q=t[5],V=t[6],X=t[7],D=0;e>=128;){for(U=0;U<16;U++)E=8*U+D,T[U]=n[E+0]<<24|n[E+1]<<16|n[E+2]<<8|n[E+3],Y[U]=n[E+4]<<24|n[E+5]<<16|n[E+6]<<8|n[E+7];for(U=0;U<80;U++)if(o=k,i=L,h=z,a=R,f=P,s=O,c=N,u=C,y=F,l=I,w=G,p=Z,v=j,b=q,g=V,_=X,x=C,M=X,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=(P>>>14|j<<18)^(P>>>18|j<<14)^(j>>>9|P<<23),M=(j>>>14|P<<18)^(j>>>18|P<<14)^(P>>>9|j<<23),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=P&O^~P&N,M=j&q^~j&V,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=pr[2*U],M=pr[2*U+1],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=T[U%16],M=Y[U%16],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,A=65535&S|K<<16,d=65535&m|B<<16,x=A,M=d,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=(k>>>28|F<<4)^(F>>>2|k<<30)^(F>>>7|k<<25),M=(F>>>28|k<<4)^(k>>>2|F<<30)^(k>>>7|F<<25),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=k&L^k&z^L&z,M=F&I^F&G^I&G,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,u=65535&S|K<<16,_=65535&m|B<<16,x=a,M=p,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=A,M=d,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,a=65535&S|K<<16,p=65535&m|B<<16,L=o,z=i,R=h,P=a,O=f,N=s,C=c,k=u,I=y,G=l,Z=w,j=p,q=v,V=b,X=g,F=_,U%16===15)for(E=0;E<16;E++)x=T[E],M=Y[E],m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=T[(E+9)%16],M=Y[(E+9)%16],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,A=T[(E+1)%16],d=Y[(E+1)%16],x=(A>>>1|d<<31)^(A>>>8|d<<24)^A>>>7,M=(d>>>1|A<<31)^(d>>>8|A<<24)^(d>>>7|A<<25),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,A=T[(E+14)%16],d=Y[(E+14)%16],x=(A>>>19|d<<13)^(d>>>29|A<<3)^A>>>6,M=(d>>>19|A<<13)^(A>>>29|d<<3)^(d>>>6|A<<26),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,T[E]=65535&S|K<<16,Y[E]=65535&m|B<<16;x=k,M=F,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[0],M=t[0],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[0]=k=65535&S|K<<16,t[0]=F=65535&m|B<<16,x=L,M=I,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[1],M=t[1],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[1]=L=65535&S|K<<16,t[1]=I=65535&m|B<<16,x=z,M=G,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[2],M=t[2],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[2]=z=65535&S|K<<16,t[2]=G=65535&m|B<<16,x=R,M=Z,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[3],M=t[3],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[3]=R=65535&S|K<<16,t[3]=Z=65535&m|B<<16,x=P,M=j,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[4],M=t[4],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[4]=P=65535&S|K<<16,t[4]=j=65535&m|B<<16,x=O,M=q,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[5],M=t[5],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[5]=O=65535&S|K<<16,t[5]=q=65535&m|B<<16,x=N,M=V,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[6],M=t[6],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[6]=N=65535&S|K<<16,t[6]=V=65535&m|B<<16,x=C,M=X,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[7],M=t[7],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[7]=C=65535&S|K<<16,t[7]=X=65535&m|B<<16,D+=128,e-=128}return e}function O(r,n,e){var o,i=new Int32Array(8),h=new Int32Array(8),a=new Uint8Array(256),f=e;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,h[0]=4089235720,h[1]=2227873595,h[2]=4271175723,h[3]=1595750129,h[4]=2917565137,h[5]=725511199,h[6]=4215389547,h[7]=327033209,P(i,h,n,e),e%=128,o=0;o=0;--o)e=n[o/8|0]>>(7&o)&1,C(r,t,e),N(t,r),N(r,r),C(r,t,e)}function G(r,t){var n=[$(),$(),$(),$()];b(n[0],fr),b(n[1],sr),b(n[2],or),m(n[3],fr,sr),I(r,n,t)}function Z(r,t,n){var e,o=new Uint8Array(64),i=[$(),$(),$(),$()];for(n||rr(t,32),O(o,t,32),o[0]&=248,o[31]&=127,o[31]|=64,G(i,o),F(r,i),e=0;e<32;e++)t[e+32]=r[e];return 0}function j(r,t){var n,e,o,i;for(e=63;e>=32;--e){for(n=0,o=e-32,i=e-12;o>8,t[o]-=256*n;t[o]+=n,t[e]=0}for(n=0,o=0;o<32;o++)t[o]+=n-(t[31]>>4)*vr[o],n=t[o]>>8,t[o]&=255;for(o=0;o<32;o++)t[o]-=n*vr[o];for(e=0;e<32;e++)t[e+1]+=t[e]>>8,r[e]=255&t[e]}function q(r){var t,n=new Float64Array(64);for(t=0;t<64;t++)n[t]=r[t];for(t=0;t<64;t++)r[t]=0;j(r,n)}function V(r,t,n,e){var o,i,h=new Uint8Array(64),a=new Uint8Array(64),f=new Uint8Array(64),s=new Float64Array(64),c=[$(),$(),$(),$()];O(h,e,32),h[0]&=248,h[31]&=127,h[31]|=64;var u=n+64;for(o=0;o>7&&M(r[0],er,r[0]),m(r[3],r[0],r[1]),0)}function D(r,t,n,e){var i,h,a=new Uint8Array(32),f=new Uint8Array(64),s=[$(),$(),$(),$()],c=[$(),$(),$(),$()];if(h=-1,n<64)return-1;if(X(c,e))return-1;for(i=0;i>>13|n<<3),e=255&r[4]|(255&r[5])<<8,this.r[2]=7939&(n>>>10|e<<6),o=255&r[6]|(255&r[7])<<8,this.r[3]=8191&(e>>>7|o<<9),i=255&r[8]|(255&r[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,h=255&r[10]|(255&r[11])<<8,this.r[6]=8191&(i>>>14|h<<2),a=255&r[12]|(255&r[13])<<8,this.r[7]=8065&(h>>>11|a<<5),f=255&r[14]|(255&r[15])<<8,this.r[8]=8191&(a>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&r[16]|(255&r[17])<<8,this.pad[1]=255&r[18]|(255&r[19])<<8,this.pad[2]=255&r[20]|(255&r[21])<<8,this.pad[3]=255&r[22]|(255&r[23])<<8,this.pad[4]=255&r[24]|(255&r[25])<<8,this.pad[5]=255&r[26]|(255&r[27])<<8,this.pad[6]=255&r[28]|(255&r[29])<<8,this.pad[7]=255&r[30]|(255&r[31])<<8};yr.prototype.blocks=function(r,t,n){for(var e,o,i,h,a,f,s,c,u,y,l,w,p,v,b,g,_,A,d,U=this.fin?0:2048,E=this.h[0],x=this.h[1],M=this.h[2],m=this.h[3],B=this.h[4],S=this.h[5],K=this.h[6],T=this.h[7],Y=this.h[8],k=this.h[9],L=this.r[0],z=this.r[1],R=this.r[2],P=this.r[3],O=this.r[4],N=this.r[5],C=this.r[6],F=this.r[7],I=this.r[8],G=this.r[9];n>=16;)e=255&r[t+0]|(255&r[t+1])<<8,E+=8191&e,o=255&r[t+2]|(255&r[t+3])<<8,x+=8191&(e>>>13|o<<3),i=255&r[t+4]|(255&r[t+5])<<8,M+=8191&(o>>>10|i<<6),h=255&r[t+6]|(255&r[t+7])<<8,m+=8191&(i>>>7|h<<9),a=255&r[t+8]|(255&r[t+9])<<8,B+=8191&(h>>>4|a<<12),S+=a>>>1&8191,f=255&r[t+10]|(255&r[t+11])<<8,K+=8191&(a>>>14|f<<2),s=255&r[t+12]|(255&r[t+13])<<8,T+=8191&(f>>>11|s<<5),c=255&r[t+14]|(255&r[t+15])<<8,Y+=8191&(s>>>8|c<<8),k+=c>>>5|U,u=0,y=u,y+=E*L,y+=x*(5*G),y+=M*(5*I),y+=m*(5*F),y+=B*(5*C),u=y>>>13,y&=8191,y+=S*(5*N),y+=K*(5*O),y+=T*(5*P),y+=Y*(5*R),y+=k*(5*z),u+=y>>>13,y&=8191,l=u,l+=E*z,l+=x*L,l+=M*(5*G),l+=m*(5*I),l+=B*(5*F),u=l>>>13,l&=8191,l+=S*(5*C),l+=K*(5*N),l+=T*(5*O),l+=Y*(5*P),l+=k*(5*R),u+=l>>>13,l&=8191,w=u,w+=E*R,w+=x*z,w+=M*L,w+=m*(5*G),w+=B*(5*I),u=w>>>13,w&=8191,w+=S*(5*F),w+=K*(5*C),w+=T*(5*N),w+=Y*(5*O),w+=k*(5*P),u+=w>>>13,w&=8191,p=u,p+=E*P,p+=x*R,p+=M*z,p+=m*L,p+=B*(5*G),u=p>>>13,p&=8191,p+=S*(5*I),p+=K*(5*F),p+=T*(5*C),p+=Y*(5*N),p+=k*(5*O),u+=p>>>13,p&=8191,v=u,v+=E*O,v+=x*P,v+=M*R,v+=m*z,v+=B*L,u=v>>>13,v&=8191,v+=S*(5*G),v+=K*(5*I),v+=T*(5*F),v+=Y*(5*C),v+=k*(5*N),u+=v>>>13,v&=8191,b=u,b+=E*N,b+=x*O,b+=M*P,b+=m*R,b+=B*z,u=b>>>13,b&=8191,b+=S*L,b+=K*(5*G),b+=T*(5*I),b+=Y*(5*F),b+=k*(5*C),u+=b>>>13,b&=8191,g=u,g+=E*C,g+=x*N,g+=M*O,g+=m*P,g+=B*R,u=g>>>13,g&=8191,g+=S*z,g+=K*L,g+=T*(5*G),g+=Y*(5*I),g+=k*(5*F),u+=g>>>13,g&=8191,_=u,_+=E*F,_+=x*C,_+=M*N,_+=m*O,_+=B*P,u=_>>>13,_&=8191,_+=S*R,_+=K*z,_+=T*L,_+=Y*(5*G),_+=k*(5*I),u+=_>>>13,_&=8191,A=u,A+=E*I,A+=x*F,A+=M*C,A+=m*N,A+=B*O,u=A>>>13,A&=8191,A+=S*P,A+=K*R,A+=T*z,A+=Y*L,A+=k*(5*G),u+=A>>>13,A&=8191,d=u,d+=E*G,d+=x*I,d+=M*F,d+=m*C,d+=B*N,u=d>>>13,d&=8191,d+=S*O,d+=K*P,d+=T*R,d+=Y*z,d+=k*L,u+=d>>>13,d&=8191,u=(u<<2)+u|0,u=u+y|0,y=8191&u,u>>>=13,l+=u,E=y,x=l,M=w,m=p,B=v,S=b,K=g,T=_,Y=A,k=d,t+=16,n-=16;this.h[0]=E,this.h[1]=x,this.h[2]=M,this.h[3]=m,this.h[4]=B,this.h[5]=S,this.h[6]=K,this.h[7]=T,this.h[8]=Y,this.h[9]=k},yr.prototype.finish=function(r,t){var n,e,o,i,h=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,h[0]=this.h[0]+5,n=h[0]>>>13,h[0]&=8191,i=1;i<10;i++)h[i]=this.h[i]+n,n=h[i]>>>13,h[i]&=8191;for(h[9]-=8192,e=(1^n)-1,i=0;i<10;i++)h[i]&=e;for(e=~e,i=0;i<10;i++)this.h[i]=this.h[i]&e|h[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;r[t+0]=this.h[0]>>>0&255,r[t+1]=this.h[0]>>>8&255,r[t+2]=this.h[1]>>>0&255,r[t+3]=this.h[1]>>>8&255,r[t+4]=this.h[2]>>>0&255,r[t+5]=this.h[2]>>>8&255,r[t+6]=this.h[3]>>>0&255,r[t+7]=this.h[3]>>>8&255,r[t+8]=this.h[4]>>>0&255,r[t+9]=this.h[4]>>>8&255,r[t+10]=this.h[5]>>>0&255,r[t+11]=this.h[5]>>>8&255,r[t+12]=this.h[6]>>>0&255,r[t+13]=this.h[6]>>>8&255,r[t+14]=this.h[7]>>>0&255,r[t+15]=this.h[7]>>>8&255},yr.prototype.update=function(r,t,n){var e,o;if(this.leftover){for(o=16-this.leftover,o>n&&(o=n),e=0;e=16&&(o=n-n%16,this.blocks(r,t,o),t+=o,n-=o),n){for(e=0;e=0},r.sign.keyPair=function(){var r=new Uint8Array(Tr),t=new Uint8Array(Yr);return Z(r,t),{publicKey:r,secretKey:t}},r.sign.keyPair.fromSecretKey=function(r){if(Q(r),r.length!==Yr)throw new Error("bad secret key size");for(var t=new Uint8Array(Tr),n=0;n void): void; +} diff --git a/appasar/canary/node_modules/tweetnacl/nacl.js b/appasar/canary/node_modules/tweetnacl/nacl.js new file mode 100644 index 0000000..f72dd78 --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/nacl.js @@ -0,0 +1,1175 @@ +(function(nacl) { +'use strict'; + +// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. +// Public domain. +// +// Implementation derived from TweetNaCl version 20140427. +// See for details: http://tweetnacl.cr.yp.to/ + +var u64 = function(h, l) { this.hi = h|0 >>> 0; this.lo = l|0 >>> 0; }; +var gf = function(init) { + var i, r = new Float64Array(16); + if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; + return r; +}; + +// Pluggable, initialized in high-level API below. +var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; + +var _0 = new Uint8Array(16); +var _9 = new Uint8Array(32); _9[0] = 9; + +var gf0 = gf(), + gf1 = gf([1]), + _121665 = gf([0xdb41, 1]), + D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), + D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), + X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), + Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), + I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); + +function L32(x, c) { return (x << c) | (x >>> (32 - c)); } + +function ld32(x, i) { + var u = x[i+3] & 0xff; + u = (u<<8)|(x[i+2] & 0xff); + u = (u<<8)|(x[i+1] & 0xff); + return (u<<8)|(x[i+0] & 0xff); +} + +function dl64(x, i) { + var h = (x[i] << 24) | (x[i+1] << 16) | (x[i+2] << 8) | x[i+3]; + var l = (x[i+4] << 24) | (x[i+5] << 16) | (x[i+6] << 8) | x[i+7]; + return new u64(h, l); +} + +function st32(x, j, u) { + var i; + for (i = 0; i < 4; i++) { x[j+i] = u & 255; u >>>= 8; } +} + +function ts64(x, i, u) { + x[i] = (u.hi >> 24) & 0xff; + x[i+1] = (u.hi >> 16) & 0xff; + x[i+2] = (u.hi >> 8) & 0xff; + x[i+3] = u.hi & 0xff; + x[i+4] = (u.lo >> 24) & 0xff; + x[i+5] = (u.lo >> 16) & 0xff; + x[i+6] = (u.lo >> 8) & 0xff; + x[i+7] = u.lo & 0xff; +} + +function vn(x, xi, y, yi, n) { + var i,d = 0; + for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; + return (1 & ((d - 1) >>> 8)) - 1; +} + +function crypto_verify_16(x, xi, y, yi) { + return vn(x,xi,y,yi,16); +} + +function crypto_verify_32(x, xi, y, yi) { + return vn(x,xi,y,yi,32); +} + +function core(out,inp,k,c,h) { + var w = new Uint32Array(16), x = new Uint32Array(16), + y = new Uint32Array(16), t = new Uint32Array(4); + var i, j, m; + + for (i = 0; i < 4; i++) { + x[5*i] = ld32(c, 4*i); + x[1+i] = ld32(k, 4*i); + x[6+i] = ld32(inp, 4*i); + x[11+i] = ld32(k, 16+4*i); + } + + for (i = 0; i < 16; i++) y[i] = x[i]; + + for (i = 0; i < 20; i++) { + for (j = 0; j < 4; j++) { + for (m = 0; m < 4; m++) t[m] = x[(5*j+4*m)%16]; + t[1] ^= L32((t[0]+t[3])|0, 7); + t[2] ^= L32((t[1]+t[0])|0, 9); + t[3] ^= L32((t[2]+t[1])|0,13); + t[0] ^= L32((t[3]+t[2])|0,18); + for (m = 0; m < 4; m++) w[4*j+(j+m)%4] = t[m]; + } + for (m = 0; m < 16; m++) x[m] = w[m]; + } + + if (h) { + for (i = 0; i < 16; i++) x[i] = (x[i] + y[i]) | 0; + for (i = 0; i < 4; i++) { + x[5*i] = (x[5*i] - ld32(c, 4*i)) | 0; + x[6+i] = (x[6+i] - ld32(inp, 4*i)) | 0; + } + for (i = 0; i < 4; i++) { + st32(out,4*i,x[5*i]); + st32(out,16+4*i,x[6+i]); + } + } else { + for (i = 0; i < 16; i++) st32(out, 4 * i, (x[i] + y[i]) | 0); + } +} + +function crypto_core_salsa20(out,inp,k,c) { + core(out,inp,k,c,false); + return 0; +} + +function crypto_core_hsalsa20(out,inp,k,c) { + core(out,inp,k,c,true); + return 0; +} + +var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); + // "expand 32-byte k" + +function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + if (!b) return 0; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + if (m) mpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i]; + } + return 0; +} + +function crypto_stream_salsa20(c,cpos,d,n,k) { + return crypto_stream_salsa20_xor(c,cpos,null,0,d,n,k); +} + +function crypto_stream(c,cpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + return crypto_stream_salsa20(c,cpos,d,n.subarray(16),s); +} + +function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,n.subarray(16),s); +} + +function add1305(h, c) { + var j, u = 0; + for (j = 0; j < 17; j++) { + u = (u + ((h[j] + c[j]) | 0)) | 0; + h[j] = u & 255; + u >>>= 8; + } +} + +var minusp = new Uint32Array([ + 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252 +]); + +function crypto_onetimeauth(out, outpos, m, mpos, n, k) { + var s, i, j, u; + var x = new Uint32Array(17), r = new Uint32Array(17), + h = new Uint32Array(17), c = new Uint32Array(17), + g = new Uint32Array(17); + for (j = 0; j < 17; j++) r[j]=h[j]=0; + for (j = 0; j < 16; j++) r[j]=k[j]; + r[3]&=15; + r[4]&=252; + r[7]&=15; + r[8]&=252; + r[11]&=15; + r[12]&=252; + r[15]&=15; + + while (n > 0) { + for (j = 0; j < 17; j++) c[j] = 0; + for (j = 0; (j < 16) && (j < n); ++j) c[j] = m[mpos+j]; + c[j] = 1; + mpos += j; n -= j; + add1305(h,c); + for (i = 0; i < 17; i++) { + x[i] = 0; + for (j = 0; j < 17; j++) x[i] = (x[i] + (h[j] * ((j <= i) ? r[i - j] : ((320 * r[i + 17 - j])|0))) | 0) | 0; + } + for (i = 0; i < 17; i++) h[i] = x[i]; + u = 0; + for (j = 0; j < 16; j++) { + u = (u + h[j]) | 0; + h[j] = u & 255; + u >>>= 8; + } + u = (u + h[16]) | 0; h[16] = u & 3; + u = (5 * (u >>> 2)) | 0; + for (j = 0; j < 16; j++) { + u = (u + h[j]) | 0; + h[j] = u & 255; + u >>>= 8; + } + u = (u + h[16]) | 0; h[16] = u; + } + + for (j = 0; j < 17; j++) g[j] = h[j]; + add1305(h,minusp); + s = (-(h[16] >>> 7) | 0); + for (j = 0; j < 17; j++) h[j] ^= s & (g[j] ^ h[j]); + + for (j = 0; j < 16; j++) c[j] = k[j + 16]; + c[16] = 0; + add1305(h,c); + for (j = 0; j < 16; j++) out[outpos+j] = h[j]; + return 0; +} + +function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { + var x = new Uint8Array(16); + crypto_onetimeauth(x,0,m,mpos,n,k); + return crypto_verify_16(h,hpos,x,0); +} + +function crypto_secretbox(c,m,d,n,k) { + var i; + if (d < 32) return -1; + crypto_stream_xor(c,0,m,0,d,n,k); + crypto_onetimeauth(c, 16, c, 32, d - 32, c); + for (i = 0; i < 16; i++) c[i] = 0; + return 0; +} + +function crypto_secretbox_open(m,c,d,n,k) { + var i; + var x = new Uint8Array(32); + if (d < 32) return -1; + crypto_stream(x,0,32,n,k); + if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; + crypto_stream_xor(m,0,c,0,d,n,k); + for (i = 0; i < 32; i++) m[i] = 0; + return 0; +} + +function set25519(r, a) { + var i; + for (i = 0; i < 16; i++) r[i] = a[i]|0; +} + +function car25519(o) { + var c; + var i; + for (i = 0; i < 16; i++) { + o[i] += 65536; + c = Math.floor(o[i] / 65536); + o[(i+1)*(i<15?1:0)] += c - 1 + 37 * (c-1) * (i===15?1:0); + o[i] -= (c * 65536); + } +} + +function sel25519(p, q, b) { + var t, c = ~(b-1); + for (var i = 0; i < 16; i++) { + t = c & (p[i] ^ q[i]); + p[i] ^= t; + q[i] ^= t; + } +} + +function pack25519(o, n) { + var i, j, b; + var m = gf(), t = gf(); + for (i = 0; i < 16; i++) t[i] = n[i]; + car25519(t); + car25519(t); + car25519(t); + for (j = 0; j < 2; j++) { + m[0] = t[0] - 0xffed; + for (i = 1; i < 15; i++) { + m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); + m[i-1] &= 0xffff; + } + m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); + b = (m[15]>>16) & 1; + m[14] &= 0xffff; + sel25519(t, m, 1-b); + } + for (i = 0; i < 16; i++) { + o[2*i] = t[i] & 0xff; + o[2*i+1] = t[i]>>8; + } +} + +function neq25519(a, b) { + var c = new Uint8Array(32), d = new Uint8Array(32); + pack25519(c, a); + pack25519(d, b); + return crypto_verify_32(c, 0, d, 0); +} + +function par25519(a) { + var d = new Uint8Array(32); + pack25519(d, a); + return d[0] & 1; +} + +function unpack25519(o, n) { + var i; + for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); + o[15] &= 0x7fff; +} + +function A(o, a, b) { + var i; + for (i = 0; i < 16; i++) o[i] = (a[i] + b[i])|0; +} + +function Z(o, a, b) { + var i; + for (i = 0; i < 16; i++) o[i] = (a[i] - b[i])|0; +} + +function M(o, a, b) { + var i, j, t = new Float64Array(31); + for (i = 0; i < 31; i++) t[i] = 0; + for (i = 0; i < 16; i++) { + for (j = 0; j < 16; j++) { + t[i+j] += a[i] * b[j]; + } + } + for (i = 0; i < 15; i++) { + t[i] += 38 * t[i+16]; + } + for (i = 0; i < 16; i++) o[i] = t[i]; + car25519(o); + car25519(o); +} + +function S(o, a) { + M(o, a, a); +} + +function inv25519(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 253; a >= 0; a--) { + S(c, c); + if(a !== 2 && a !== 4) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; +} + +function pow2523(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 250; a >= 0; a--) { + S(c, c); + if(a !== 1) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; +} + +function crypto_scalarmult(q, n, p) { + var z = new Uint8Array(32); + var x = new Float64Array(80), r, i; + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(); + for (i = 0; i < 31; i++) z[i] = n[i]; + z[31]=(n[31]&127)|64; + z[0]&=248; + unpack25519(x,p); + for (i = 0; i < 16; i++) { + b[i]=x[i]; + d[i]=a[i]=c[i]=0; + } + a[0]=d[0]=1; + for (i=254; i>=0; --i) { + r=(z[i>>>3]>>>(i&7))&1; + sel25519(a,b,r); + sel25519(c,d,r); + A(e,a,c); + Z(a,a,c); + A(c,b,d); + Z(b,b,d); + S(d,e); + S(f,a); + M(a,c,a); + M(c,b,e); + A(e,a,c); + Z(a,a,c); + S(b,a); + Z(c,d,f); + M(a,c,_121665); + A(a,a,d); + M(c,c,a); + M(a,d,f); + M(d,b,x); + S(b,e); + sel25519(a,b,r); + sel25519(c,d,r); + } + for (i = 0; i < 16; i++) { + x[i+16]=a[i]; + x[i+32]=c[i]; + x[i+48]=b[i]; + x[i+64]=d[i]; + } + var x32 = x.subarray(32); + var x16 = x.subarray(16); + inv25519(x32,x32); + M(x16,x16,x32); + pack25519(q,x16); + return 0; +} + +function crypto_scalarmult_base(q, n) { + return crypto_scalarmult(q, n, _9); +} + +function crypto_box_keypair(y, x) { + randombytes(x, 32); + return crypto_scalarmult_base(y, x); +} + +function crypto_box_beforenm(k, y, x) { + var s = new Uint8Array(32); + crypto_scalarmult(s, x, y); + return crypto_core_hsalsa20(k, _0, s, sigma); +} + +var crypto_box_afternm = crypto_secretbox; +var crypto_box_open_afternm = crypto_secretbox_open; + +function crypto_box(c, m, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_afternm(c, m, d, n, k); +} + +function crypto_box_open(m, c, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_open_afternm(m, c, d, n, k); +} + +function add64() { + var a = 0, b = 0, c = 0, d = 0, m16 = 65535, l, h, i; + for (i = 0; i < arguments.length; i++) { + l = arguments[i].lo; + h = arguments[i].hi; + a += (l & m16); b += (l >>> 16); + c += (h & m16); d += (h >>> 16); + } + + b += (a >>> 16); + c += (b >>> 16); + d += (c >>> 16); + + return new u64((c & m16) | (d << 16), (a & m16) | (b << 16)); +} + +function shr64(x, c) { + return new u64((x.hi >>> c), (x.lo >>> c) | (x.hi << (32 - c))); +} + +function xor64() { + var l = 0, h = 0, i; + for (i = 0; i < arguments.length; i++) { + l ^= arguments[i].lo; + h ^= arguments[i].hi; + } + return new u64(h, l); +} + +function R(x, c) { + var h, l, c1 = 32 - c; + if (c < 32) { + h = (x.hi >>> c) | (x.lo << c1); + l = (x.lo >>> c) | (x.hi << c1); + } else if (c < 64) { + h = (x.lo >>> c) | (x.hi << c1); + l = (x.hi >>> c) | (x.lo << c1); + } + return new u64(h, l); +} + +function Ch(x, y, z) { + var h = (x.hi & y.hi) ^ (~x.hi & z.hi), + l = (x.lo & y.lo) ^ (~x.lo & z.lo); + return new u64(h, l); +} + +function Maj(x, y, z) { + var h = (x.hi & y.hi) ^ (x.hi & z.hi) ^ (y.hi & z.hi), + l = (x.lo & y.lo) ^ (x.lo & z.lo) ^ (y.lo & z.lo); + return new u64(h, l); +} + +function Sigma0(x) { return xor64(R(x,28), R(x,34), R(x,39)); } +function Sigma1(x) { return xor64(R(x,14), R(x,18), R(x,41)); } +function sigma0(x) { return xor64(R(x, 1), R(x, 8), shr64(x,7)); } +function sigma1(x) { return xor64(R(x,19), R(x,61), shr64(x,6)); } + +var K = [ + new u64(0x428a2f98, 0xd728ae22), new u64(0x71374491, 0x23ef65cd), + new u64(0xb5c0fbcf, 0xec4d3b2f), new u64(0xe9b5dba5, 0x8189dbbc), + new u64(0x3956c25b, 0xf348b538), new u64(0x59f111f1, 0xb605d019), + new u64(0x923f82a4, 0xaf194f9b), new u64(0xab1c5ed5, 0xda6d8118), + new u64(0xd807aa98, 0xa3030242), new u64(0x12835b01, 0x45706fbe), + new u64(0x243185be, 0x4ee4b28c), new u64(0x550c7dc3, 0xd5ffb4e2), + new u64(0x72be5d74, 0xf27b896f), new u64(0x80deb1fe, 0x3b1696b1), + new u64(0x9bdc06a7, 0x25c71235), new u64(0xc19bf174, 0xcf692694), + new u64(0xe49b69c1, 0x9ef14ad2), new u64(0xefbe4786, 0x384f25e3), + new u64(0x0fc19dc6, 0x8b8cd5b5), new u64(0x240ca1cc, 0x77ac9c65), + new u64(0x2de92c6f, 0x592b0275), new u64(0x4a7484aa, 0x6ea6e483), + new u64(0x5cb0a9dc, 0xbd41fbd4), new u64(0x76f988da, 0x831153b5), + new u64(0x983e5152, 0xee66dfab), new u64(0xa831c66d, 0x2db43210), + new u64(0xb00327c8, 0x98fb213f), new u64(0xbf597fc7, 0xbeef0ee4), + new u64(0xc6e00bf3, 0x3da88fc2), new u64(0xd5a79147, 0x930aa725), + new u64(0x06ca6351, 0xe003826f), new u64(0x14292967, 0x0a0e6e70), + new u64(0x27b70a85, 0x46d22ffc), new u64(0x2e1b2138, 0x5c26c926), + new u64(0x4d2c6dfc, 0x5ac42aed), new u64(0x53380d13, 0x9d95b3df), + new u64(0x650a7354, 0x8baf63de), new u64(0x766a0abb, 0x3c77b2a8), + new u64(0x81c2c92e, 0x47edaee6), new u64(0x92722c85, 0x1482353b), + new u64(0xa2bfe8a1, 0x4cf10364), new u64(0xa81a664b, 0xbc423001), + new u64(0xc24b8b70, 0xd0f89791), new u64(0xc76c51a3, 0x0654be30), + new u64(0xd192e819, 0xd6ef5218), new u64(0xd6990624, 0x5565a910), + new u64(0xf40e3585, 0x5771202a), new u64(0x106aa070, 0x32bbd1b8), + new u64(0x19a4c116, 0xb8d2d0c8), new u64(0x1e376c08, 0x5141ab53), + new u64(0x2748774c, 0xdf8eeb99), new u64(0x34b0bcb5, 0xe19b48a8), + new u64(0x391c0cb3, 0xc5c95a63), new u64(0x4ed8aa4a, 0xe3418acb), + new u64(0x5b9cca4f, 0x7763e373), new u64(0x682e6ff3, 0xd6b2b8a3), + new u64(0x748f82ee, 0x5defb2fc), new u64(0x78a5636f, 0x43172f60), + new u64(0x84c87814, 0xa1f0ab72), new u64(0x8cc70208, 0x1a6439ec), + new u64(0x90befffa, 0x23631e28), new u64(0xa4506ceb, 0xde82bde9), + new u64(0xbef9a3f7, 0xb2c67915), new u64(0xc67178f2, 0xe372532b), + new u64(0xca273ece, 0xea26619c), new u64(0xd186b8c7, 0x21c0c207), + new u64(0xeada7dd6, 0xcde0eb1e), new u64(0xf57d4f7f, 0xee6ed178), + new u64(0x06f067aa, 0x72176fba), new u64(0x0a637dc5, 0xa2c898a6), + new u64(0x113f9804, 0xbef90dae), new u64(0x1b710b35, 0x131c471b), + new u64(0x28db77f5, 0x23047d84), new u64(0x32caab7b, 0x40c72493), + new u64(0x3c9ebe0a, 0x15c9bebc), new u64(0x431d67c4, 0x9c100d4c), + new u64(0x4cc5d4be, 0xcb3e42b6), new u64(0x597f299c, 0xfc657e2a), + new u64(0x5fcb6fab, 0x3ad6faec), new u64(0x6c44198c, 0x4a475817) +]; + +function crypto_hashblocks(x, m, n) { + var z = [], b = [], a = [], w = [], t, i, j; + + for (i = 0; i < 8; i++) z[i] = a[i] = dl64(x, 8*i); + + var pos = 0; + while (n >= 128) { + for (i = 0; i < 16; i++) w[i] = dl64(m, 8*i+pos); + for (i = 0; i < 80; i++) { + for (j = 0; j < 8; j++) b[j] = a[j]; + t = add64(a[7], Sigma1(a[4]), Ch(a[4], a[5], a[6]), K[i], w[i%16]); + b[7] = add64(t, Sigma0(a[0]), Maj(a[0], a[1], a[2])); + b[3] = add64(b[3], t); + for (j = 0; j < 8; j++) a[(j+1)%8] = b[j]; + if (i%16 === 15) { + for (j = 0; j < 16; j++) { + w[j] = add64(w[j], w[(j+9)%16], sigma0(w[(j+1)%16]), sigma1(w[(j+14)%16])); + } + } + } + + for (i = 0; i < 8; i++) { + a[i] = add64(a[i], z[i]); + z[i] = a[i]; + } + + pos += 128; + n -= 128; + } + + for (i = 0; i < 8; i++) ts64(x, 8*i, z[i]); + return n; +} + +var iv = new Uint8Array([ + 0x6a,0x09,0xe6,0x67,0xf3,0xbc,0xc9,0x08, + 0xbb,0x67,0xae,0x85,0x84,0xca,0xa7,0x3b, + 0x3c,0x6e,0xf3,0x72,0xfe,0x94,0xf8,0x2b, + 0xa5,0x4f,0xf5,0x3a,0x5f,0x1d,0x36,0xf1, + 0x51,0x0e,0x52,0x7f,0xad,0xe6,0x82,0xd1, + 0x9b,0x05,0x68,0x8c,0x2b,0x3e,0x6c,0x1f, + 0x1f,0x83,0xd9,0xab,0xfb,0x41,0xbd,0x6b, + 0x5b,0xe0,0xcd,0x19,0x13,0x7e,0x21,0x79 +]); + +function crypto_hash(out, m, n) { + var h = new Uint8Array(64), x = new Uint8Array(256); + var i, b = n; + + for (i = 0; i < 64; i++) h[i] = iv[i]; + + crypto_hashblocks(h, m, n); + n %= 128; + + for (i = 0; i < 256; i++) x[i] = 0; + for (i = 0; i < n; i++) x[i] = m[b-n+i]; + x[n] = 128; + + n = 256-128*(n<112?1:0); + x[n-9] = 0; + ts64(x, n-8, new u64((b / 0x20000000) | 0, b << 3)); + crypto_hashblocks(h, x, n); + + for (i = 0; i < 64; i++) out[i] = h[i]; + + return 0; +} + +function add(p, q) { + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(), + g = gf(), h = gf(), t = gf(); + + Z(a, p[1], p[0]); + Z(t, q[1], q[0]); + M(a, a, t); + A(b, p[0], p[1]); + A(t, q[0], q[1]); + M(b, b, t); + M(c, p[3], q[3]); + M(c, c, D2); + M(d, p[2], q[2]); + A(d, d, d); + Z(e, b, a); + Z(f, d, c); + A(g, d, c); + A(h, b, a); + + M(p[0], e, f); + M(p[1], h, g); + M(p[2], g, f); + M(p[3], e, h); +} + +function cswap(p, q, b) { + var i; + for (i = 0; i < 4; i++) { + sel25519(p[i], q[i], b); + } +} + +function pack(r, p) { + var tx = gf(), ty = gf(), zi = gf(); + inv25519(zi, p[2]); + M(tx, p[0], zi); + M(ty, p[1], zi); + pack25519(r, ty); + r[31] ^= par25519(tx) << 7; +} + +function scalarmult(p, q, s) { + var b, i; + set25519(p[0], gf0); + set25519(p[1], gf1); + set25519(p[2], gf1); + set25519(p[3], gf0); + for (i = 255; i >= 0; --i) { + b = (s[(i/8)|0] >> (i&7)) & 1; + cswap(p, q, b); + add(q, p); + add(p, p); + cswap(p, q, b); + } +} + +function scalarbase(p, s) { + var q = [gf(), gf(), gf(), gf()]; + set25519(q[0], X); + set25519(q[1], Y); + set25519(q[2], gf1); + M(q[3], X, Y); + scalarmult(p, q, s); +} + +function crypto_sign_keypair(pk, sk, seeded) { + var d = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()]; + var i; + + if (!seeded) randombytes(sk, 32); + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + scalarbase(p, d); + pack(pk, p); + + for (i = 0; i < 32; i++) sk[i+32] = pk[i]; + return 0; +} + +var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); + +function modL(r, x) { + var carry, i, j, k; + for (i = 63; i >= 32; --i) { + carry = 0; + for (j = i - 32, k = i - 12; j < k; ++j) { + x[j] += carry - 16 * x[i] * L[j - (i - 32)]; + carry = (x[j] + 128) >> 8; + x[j] -= carry * 256; + } + x[j] += carry; + x[i] = 0; + } + carry = 0; + for (j = 0; j < 32; j++) { + x[j] += carry - (x[31] >> 4) * L[j]; + carry = x[j] >> 8; + x[j] &= 255; + } + for (j = 0; j < 32; j++) x[j] -= carry * L[j]; + for (i = 0; i < 32; i++) { + x[i+1] += x[i] >> 8; + r[i] = x[i] & 255; + } +} + +function reduce(r) { + var x = new Float64Array(64), i; + for (i = 0; i < 64; i++) x[i] = r[i]; + for (i = 0; i < 64; i++) r[i] = 0; + modL(r, x); +} + +// Note: difference from C - smlen returned, not passed as argument. +function crypto_sign(sm, m, n, sk) { + var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); + var i, j, x = new Float64Array(64); + var p = [gf(), gf(), gf(), gf()]; + + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + var smlen = n + 64; + for (i = 0; i < n; i++) sm[64 + i] = m[i]; + for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; + + crypto_hash(r, sm.subarray(32), n+32); + reduce(r); + scalarbase(p, r); + pack(sm, p); + + for (i = 32; i < 64; i++) sm[i] = sk[i]; + crypto_hash(h, sm, n + 64); + reduce(h); + + for (i = 0; i < 64; i++) x[i] = 0; + for (i = 0; i < 32; i++) x[i] = r[i]; + for (i = 0; i < 32; i++) { + for (j = 0; j < 32; j++) { + x[i+j] += h[i] * d[j]; + } + } + + modL(sm.subarray(32), x); + return smlen; +} + +function unpackneg(r, p) { + var t = gf(), chk = gf(), num = gf(), + den = gf(), den2 = gf(), den4 = gf(), + den6 = gf(); + + set25519(r[2], gf1); + unpack25519(r[1], p); + S(num, r[1]); + M(den, num, D); + Z(num, num, r[2]); + A(den, r[2], den); + + S(den2, den); + S(den4, den2); + M(den6, den4, den2); + M(t, den6, num); + M(t, t, den); + + pow2523(t, t); + M(t, t, num); + M(t, t, den); + M(t, t, den); + M(r[0], t, den); + + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) M(r[0], r[0], I); + + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) return -1; + + if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); + + M(r[3], r[0], r[1]); + return 0; +} + +function crypto_sign_open(m, sm, n, pk) { + var i, mlen; + var t = new Uint8Array(32), h = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()], + q = [gf(), gf(), gf(), gf()]; + + mlen = -1; + if (n < 64) return -1; + + if (unpackneg(q, pk)) return -1; + + for (i = 0; i < n; i++) m[i] = sm[i]; + for (i = 0; i < 32; i++) m[i+32] = pk[i]; + crypto_hash(h, m, n); + reduce(h); + scalarmult(p, q, h); + + scalarbase(q, sm.subarray(32)); + add(p, q); + pack(t, p); + + n -= 64; + if (crypto_verify_32(sm, 0, t, 0)) { + for (i = 0; i < n; i++) m[i] = 0; + return -1; + } + + for (i = 0; i < n; i++) m[i] = sm[i + 64]; + mlen = n; + return mlen; +} + +var crypto_secretbox_KEYBYTES = 32, + crypto_secretbox_NONCEBYTES = 24, + crypto_secretbox_ZEROBYTES = 32, + crypto_secretbox_BOXZEROBYTES = 16, + crypto_scalarmult_BYTES = 32, + crypto_scalarmult_SCALARBYTES = 32, + crypto_box_PUBLICKEYBYTES = 32, + crypto_box_SECRETKEYBYTES = 32, + crypto_box_BEFORENMBYTES = 32, + crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, + crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, + crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, + crypto_sign_BYTES = 64, + crypto_sign_PUBLICKEYBYTES = 32, + crypto_sign_SECRETKEYBYTES = 64, + crypto_sign_SEEDBYTES = 32, + crypto_hash_BYTES = 64; + +nacl.lowlevel = { + crypto_core_hsalsa20: crypto_core_hsalsa20, + crypto_stream_xor: crypto_stream_xor, + crypto_stream: crypto_stream, + crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, + crypto_stream_salsa20: crypto_stream_salsa20, + crypto_onetimeauth: crypto_onetimeauth, + crypto_onetimeauth_verify: crypto_onetimeauth_verify, + crypto_verify_16: crypto_verify_16, + crypto_verify_32: crypto_verify_32, + crypto_secretbox: crypto_secretbox, + crypto_secretbox_open: crypto_secretbox_open, + crypto_scalarmult: crypto_scalarmult, + crypto_scalarmult_base: crypto_scalarmult_base, + crypto_box_beforenm: crypto_box_beforenm, + crypto_box_afternm: crypto_box_afternm, + crypto_box: crypto_box, + crypto_box_open: crypto_box_open, + crypto_box_keypair: crypto_box_keypair, + crypto_hash: crypto_hash, + crypto_sign: crypto_sign, + crypto_sign_keypair: crypto_sign_keypair, + crypto_sign_open: crypto_sign_open, + + crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, + crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, + crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, + crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, + crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, + crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, + crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, + crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, + crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, + crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, + crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, + crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, + crypto_sign_BYTES: crypto_sign_BYTES, + crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, + crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, + crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, + crypto_hash_BYTES: crypto_hash_BYTES +}; + +/* High-level API */ + +function checkLengths(k, n) { + if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); + if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); +} + +function checkBoxLengths(pk, sk) { + if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); + if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); +} + +function checkArrayTypes() { + var t, i; + for (i = 0; i < arguments.length; i++) { + if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') + throw new TypeError('unexpected type ' + t + ', use Uint8Array'); + } +} + +function cleanup(arr) { + for (var i = 0; i < arr.length; i++) arr[i] = 0; +} + +// TODO: Completely remove this in v0.15. +if (!nacl.util) { + nacl.util = {}; + nacl.util.decodeUTF8 = nacl.util.encodeUTF8 = nacl.util.encodeBase64 = nacl.util.decodeBase64 = function() { + throw new Error('nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js'); + }; +} + +nacl.randomBytes = function(n) { + var b = new Uint8Array(n); + randombytes(b, n); + return b; +}; + +nacl.secretbox = function(msg, nonce, key) { + checkArrayTypes(msg, nonce, key); + checkLengths(key, nonce); + var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); + var c = new Uint8Array(m.length); + for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; + crypto_secretbox(c, m, m.length, nonce, key); + return c.subarray(crypto_secretbox_BOXZEROBYTES); +}; + +nacl.secretbox.open = function(box, nonce, key) { + checkArrayTypes(box, nonce, key); + checkLengths(key, nonce); + var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); + var m = new Uint8Array(c.length); + for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; + if (c.length < 32) return false; + if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; + return m.subarray(crypto_secretbox_ZEROBYTES); +}; + +nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; +nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; +nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; + +nacl.scalarMult = function(n, p) { + checkArrayTypes(n, p); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult(q, n, p); + return q; +}; + +nacl.scalarMult.base = function(n) { + checkArrayTypes(n); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult_base(q, n); + return q; +}; + +nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; +nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; + +nacl.box = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox(msg, nonce, k); +}; + +nacl.box.before = function(publicKey, secretKey) { + checkArrayTypes(publicKey, secretKey); + checkBoxLengths(publicKey, secretKey); + var k = new Uint8Array(crypto_box_BEFORENMBYTES); + crypto_box_beforenm(k, publicKey, secretKey); + return k; +}; + +nacl.box.after = nacl.secretbox; + +nacl.box.open = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox.open(msg, nonce, k); +}; + +nacl.box.open.after = nacl.secretbox.open; + +nacl.box.keyPair = function() { + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); + crypto_box_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.box.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_box_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + crypto_scalarmult_base(pk, secretKey); + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; + +nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; +nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; +nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; +nacl.box.nonceLength = crypto_box_NONCEBYTES; +nacl.box.overheadLength = nacl.secretbox.overheadLength; + +nacl.sign = function(msg, secretKey) { + checkArrayTypes(msg, secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); + crypto_sign(signedMsg, msg, msg.length, secretKey); + return signedMsg; +}; + +nacl.sign.open = function(signedMsg, publicKey) { + if (arguments.length !== 2) + throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); + checkArrayTypes(signedMsg, publicKey); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var tmp = new Uint8Array(signedMsg.length); + var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); + if (mlen < 0) return null; + var m = new Uint8Array(mlen); + for (var i = 0; i < m.length; i++) m[i] = tmp[i]; + return m; +}; + +nacl.sign.detached = function(msg, secretKey) { + var signedMsg = nacl.sign(msg, secretKey); + var sig = new Uint8Array(crypto_sign_BYTES); + for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; + return sig; +}; + +nacl.sign.detached.verify = function(msg, sig, publicKey) { + checkArrayTypes(msg, sig, publicKey); + if (sig.length !== crypto_sign_BYTES) + throw new Error('bad signature size'); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var sm = new Uint8Array(crypto_sign_BYTES + msg.length); + var m = new Uint8Array(crypto_sign_BYTES + msg.length); + var i; + for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; + for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; + return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); +}; + +nacl.sign.keyPair = function() { + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + crypto_sign_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.sign.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; + +nacl.sign.keyPair.fromSeed = function(seed) { + checkArrayTypes(seed); + if (seed.length !== crypto_sign_SEEDBYTES) + throw new Error('bad seed size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + for (var i = 0; i < 32; i++) sk[i] = seed[i]; + crypto_sign_keypair(pk, sk, true); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; +nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; +nacl.sign.seedLength = crypto_sign_SEEDBYTES; +nacl.sign.signatureLength = crypto_sign_BYTES; + +nacl.hash = function(msg) { + checkArrayTypes(msg); + var h = new Uint8Array(crypto_hash_BYTES); + crypto_hash(h, msg, msg.length); + return h; +}; + +nacl.hash.hashLength = crypto_hash_BYTES; + +nacl.verify = function(x, y) { + checkArrayTypes(x, y); + // Zero length arguments are considered not equal. + if (x.length === 0 || y.length === 0) return false; + if (x.length !== y.length) return false; + return (vn(x, 0, y, 0, x.length) === 0) ? true : false; +}; + +nacl.setPRNG = function(fn) { + randombytes = fn; +}; + +(function() { + // Initialize PRNG if environment provides CSPRNG. + // If not, methods calling randombytes will throw. + var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; + if (crypto && crypto.getRandomValues) { + // Browsers. + var QUOTA = 65536; + nacl.setPRNG(function(x, n) { + var i, v = new Uint8Array(n); + for (i = 0; i < n; i += QUOTA) { + crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); + } + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } else if (typeof require !== 'undefined') { + // Node.js. + crypto = require('crypto'); + if (crypto && crypto.randomBytes) { + nacl.setPRNG(function(x, n) { + var i, v = crypto.randomBytes(n); + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } + } +})(); + +})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); diff --git a/appasar/canary/node_modules/tweetnacl/nacl.min.js b/appasar/canary/node_modules/tweetnacl/nacl.min.js new file mode 100644 index 0000000..4484974 --- /dev/null +++ b/appasar/canary/node_modules/tweetnacl/nacl.min.js @@ -0,0 +1 @@ +!function(r){"use strict";function n(r,n){return r<>>32-n}function e(r,n){var e=255&r[n+3];return e=e<<8|255&r[n+2],e=e<<8|255&r[n+1],e<<8|255&r[n+0]}function t(r,n){var e=r[n]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3],t=r[n+4]<<24|r[n+5]<<16|r[n+6]<<8|r[n+7];return new sr(e,t)}function o(r,n,e){var t;for(t=0;t<4;t++)r[n+t]=255&e,e>>>=8}function i(r,n,e){r[n]=e.hi>>24&255,r[n+1]=e.hi>>16&255,r[n+2]=e.hi>>8&255,r[n+3]=255&e.hi,r[n+4]=e.lo>>24&255,r[n+5]=e.lo>>16&255,r[n+6]=e.lo>>8&255,r[n+7]=255&e.lo}function a(r,n,e,t,o){var i,a=0;for(i=0;i>>8)-1}function f(r,n,e,t){return a(r,n,e,t,16)}function u(r,n,e,t){return a(r,n,e,t,32)}function c(r,t,i,a,f){var u,c,w,y=new Uint32Array(16),l=new Uint32Array(16),s=new Uint32Array(16),h=new Uint32Array(4);for(u=0;u<4;u++)l[5*u]=e(a,4*u),l[1+u]=e(i,4*u),l[6+u]=e(t,4*u),l[11+u]=e(i,16+4*u);for(u=0;u<16;u++)s[u]=l[u];for(u=0;u<20;u++){for(c=0;c<4;c++){for(w=0;w<4;w++)h[w]=l[(5*c+4*w)%16];for(h[1]^=n(h[0]+h[3]|0,7),h[2]^=n(h[1]+h[0]|0,9),h[3]^=n(h[2]+h[1]|0,13),h[0]^=n(h[3]+h[2]|0,18),w=0;w<4;w++)y[4*c+(c+w)%4]=h[w]}for(w=0;w<16;w++)l[w]=y[w]}if(f){for(u=0;u<16;u++)l[u]=l[u]+s[u]|0;for(u=0;u<4;u++)l[5*u]=l[5*u]-e(a,4*u)|0,l[6+u]=l[6+u]-e(t,4*u)|0;for(u=0;u<4;u++)o(r,4*u,l[5*u]),o(r,16+4*u,l[6+u])}else for(u=0;u<16;u++)o(r,4*u,l[u]+s[u]|0)}function w(r,n,e,t){return c(r,n,e,t,!1),0}function y(r,n,e,t){return c(r,n,e,t,!0),0}function l(r,n,e,t,o,i,a){var f,u,c=new Uint8Array(16),y=new Uint8Array(64);if(!o)return 0;for(u=0;u<16;u++)c[u]=0;for(u=0;u<8;u++)c[u]=i[u];for(;o>=64;){for(w(y,c,a,Br),u=0;u<64;u++)r[n+u]=(e?e[t+u]:0)^y[u];for(f=1,u=8;u<16;u++)f=f+(255&c[u])|0,c[u]=255&f,f>>>=8;o-=64,n+=64,e&&(t+=64)}if(o>0)for(w(y,c,a,Br),u=0;u>>=8}function b(r,n,e,t,o,i){var a,f,u,c,w=new Uint32Array(17),y=new Uint32Array(17),l=new Uint32Array(17),s=new Uint32Array(17),h=new Uint32Array(17);for(u=0;u<17;u++)y[u]=l[u]=0;for(u=0;u<16;u++)y[u]=i[u];for(y[3]&=15,y[4]&=252,y[7]&=15,y[8]&=252,y[11]&=15,y[12]&=252,y[15]&=15;o>0;){for(u=0;u<17;u++)s[u]=0;for(u=0;u<16&&u>>=8;for(c=c+l[16]|0,l[16]=3&c,c=5*(c>>>2)|0,u=0;u<16;u++)c=c+l[u]|0,l[u]=255&c,c>>>=8;c=c+l[16]|0,l[16]=c}for(u=0;u<17;u++)h[u]=l[u];for(v(l,Sr),a=0|-(l[16]>>>7),u=0;u<17;u++)l[u]^=a&(h[u]^l[u]);for(u=0;u<16;u++)s[u]=i[u+16];for(s[16]=0,v(l,s),u=0;u<16;u++)r[n+u]=l[u];return 0}function p(r,n,e,t,o,i){var a=new Uint8Array(16);return b(a,0,e,t,o,i),f(r,n,a,0)}function _(r,n,e,t,o){var i;if(e<32)return-1;for(g(r,0,n,0,e,t,o),b(r,16,r,32,e-32,r),i=0;i<16;i++)r[i]=0;return 0}function A(r,n,e,t,o){var i,a=new Uint8Array(32);if(e<32)return-1;if(h(a,0,32,t,o),0!==p(n,16,n,32,e-32,a))return-1;for(g(r,0,n,0,e,t,o),i=0;i<32;i++)r[i]=0;return 0}function U(r,n){var e;for(e=0;e<16;e++)r[e]=0|n[e]}function E(r){var n,e;for(e=0;e<16;e++)r[e]+=65536,n=Math.floor(r[e]/65536),r[(e+1)*(e<15?1:0)]+=n-1+37*(n-1)*(15===e?1:0),r[e]-=65536*n}function d(r,n,e){for(var t,o=~(e-1),i=0;i<16;i++)t=o&(r[i]^n[i]),r[i]^=t,n[i]^=t}function x(r,n){var e,t,o,i=hr(),a=hr();for(e=0;e<16;e++)a[e]=n[e];for(E(a),E(a),E(a),t=0;t<2;t++){for(i[0]=a[0]-65517,e=1;e<15;e++)i[e]=a[e]-65535-(i[e-1]>>16&1),i[e-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,d(a,i,1-o)}for(e=0;e<16;e++)r[2*e]=255&a[e],r[2*e+1]=a[e]>>8}function m(r,n){var e=new Uint8Array(32),t=new Uint8Array(32);return x(e,r),x(t,n),u(e,0,t,0)}function B(r){var n=new Uint8Array(32);return x(n,r),1&n[0]}function S(r,n){var e;for(e=0;e<16;e++)r[e]=n[2*e]+(n[2*e+1]<<8);r[15]&=32767}function K(r,n,e){var t;for(t=0;t<16;t++)r[t]=n[t]+e[t]|0}function T(r,n,e){var t;for(t=0;t<16;t++)r[t]=n[t]-e[t]|0}function Y(r,n,e){var t,o,i=new Float64Array(31);for(t=0;t<31;t++)i[t]=0;for(t=0;t<16;t++)for(o=0;o<16;o++)i[t+o]+=n[t]*e[o];for(t=0;t<15;t++)i[t]+=38*i[t+16];for(t=0;t<16;t++)r[t]=i[t];E(r),E(r)}function L(r,n){Y(r,n,n)}function k(r,n){var e,t=hr();for(e=0;e<16;e++)t[e]=n[e];for(e=253;e>=0;e--)L(t,t),2!==e&&4!==e&&Y(t,t,n);for(e=0;e<16;e++)r[e]=t[e]}function z(r,n){var e,t=hr();for(e=0;e<16;e++)t[e]=n[e];for(e=250;e>=0;e--)L(t,t),1!==e&&Y(t,t,n);for(e=0;e<16;e++)r[e]=t[e]}function R(r,n,e){var t,o,i=new Uint8Array(32),a=new Float64Array(80),f=hr(),u=hr(),c=hr(),w=hr(),y=hr(),l=hr();for(o=0;o<31;o++)i[o]=n[o];for(i[31]=127&n[31]|64,i[0]&=248,S(a,e),o=0;o<16;o++)u[o]=a[o],w[o]=f[o]=c[o]=0;for(f[0]=w[0]=1,o=254;o>=0;--o)t=i[o>>>3]>>>(7&o)&1,d(f,u,t),d(c,w,t),K(y,f,c),T(f,f,c),K(c,u,w),T(u,u,w),L(w,y),L(l,f),Y(f,c,f),Y(c,u,y),K(y,f,c),T(f,f,c),L(u,f),T(c,w,l),Y(f,c,Ar),K(f,f,w),Y(c,c,f),Y(f,w,l),Y(w,u,a),L(u,y),d(f,u,t),d(c,w,t);for(o=0;o<16;o++)a[o+16]=f[o],a[o+32]=c[o],a[o+48]=u[o],a[o+64]=w[o];var s=a.subarray(32),h=a.subarray(16);return k(s,s),Y(h,h,s),x(r,h),0}function P(r,n){return R(r,n,br)}function O(r,n){return gr(n,32),P(r,n)}function F(r,n,e){var t=new Uint8Array(32);return R(t,e,n),y(r,vr,t,Br)}function N(r,n,e,t,o,i){var a=new Uint8Array(32);return F(a,o,i),Kr(r,n,e,t,a)}function C(r,n,e,t,o,i){var a=new Uint8Array(32);return F(a,o,i),Tr(r,n,e,t,a)}function M(){var r,n,e,t=0,o=0,i=0,a=0,f=65535;for(e=0;e>>16,i+=n&f,a+=n>>>16;return o+=t>>>16,i+=o>>>16,a+=i>>>16,new sr(i&f|a<<16,t&f|o<<16)}function G(r,n){return new sr(r.hi>>>n,r.lo>>>n|r.hi<<32-n)}function Z(){var r,n=0,e=0;for(r=0;r>>n|r.lo<>>n|r.hi<>>n|r.hi<>>n|r.lo<=128;){for(a=0;a<16;a++)y[a]=t(n,8*a+l);for(a=0;a<80;a++){for(f=0;f<8;f++)c[f]=w[f];for(o=M(w[7],X(w[4]),q(w[4],w[5],w[6]),Yr[a],y[a%16]),c[7]=M(o,V(w[0]),I(w[0],w[1],w[2])),c[3]=M(c[3],o),f=0;f<8;f++)w[(f+1)%8]=c[f];if(a%16===15)for(f=0;f<16;f++)y[f]=M(y[f],y[(f+9)%16],D(y[(f+1)%16]),H(y[(f+14)%16]))}for(a=0;a<8;a++)w[a]=M(w[a],u[a]),u[a]=w[a];l+=128,e-=128}for(a=0;a<8;a++)i(r,8*a,u[a]);return e}function Q(r,n,e){var t,o=new Uint8Array(64),a=new Uint8Array(256),f=e;for(t=0;t<64;t++)o[t]=Lr[t];for(J(o,n,e),e%=128,t=0;t<256;t++)a[t]=0;for(t=0;t=0;--o)t=e[o/8|0]>>(7&o)&1,$(r,n,t),W(n,r),W(r,r),$(r,n,t)}function er(r,n){var e=[hr(),hr(),hr(),hr()];U(e[0],dr),U(e[1],xr),U(e[2],_r),Y(e[3],dr,xr),nr(r,e,n)}function tr(r,n,e){var t,o=new Uint8Array(64),i=[hr(),hr(),hr(),hr()];for(e||gr(n,32),Q(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,er(i,o),rr(r,i),t=0;t<32;t++)n[t+32]=r[t];return 0}function or(r,n){var e,t,o,i;for(t=63;t>=32;--t){for(e=0,o=t-32,i=t-12;o>8,n[o]-=256*e;n[o]+=e,n[t]=0}for(e=0,o=0;o<32;o++)n[o]+=e-(n[31]>>4)*kr[o],e=n[o]>>8,n[o]&=255;for(o=0;o<32;o++)n[o]-=e*kr[o];for(t=0;t<32;t++)n[t+1]+=n[t]>>8,r[t]=255&n[t]}function ir(r){var n,e=new Float64Array(64);for(n=0;n<64;n++)e[n]=r[n];for(n=0;n<64;n++)r[n]=0;or(r,e)}function ar(r,n,e,t){var o,i,a=new Uint8Array(64),f=new Uint8Array(64),u=new Uint8Array(64),c=new Float64Array(64),w=[hr(),hr(),hr(),hr()];Q(a,t,32),a[0]&=248,a[31]&=127,a[31]|=64;var y=e+64;for(o=0;o>7&&T(r[0],pr,r[0]),Y(r[3],r[0],r[1]),0)}function ur(r,n,e,t){var o,i,a=new Uint8Array(32),f=new Uint8Array(64),c=[hr(),hr(),hr(),hr()],w=[hr(),hr(),hr(),hr()];if(i=-1,e<64)return-1;if(fr(w,t))return-1;for(o=0;o=0},r.sign.keyPair=function(){var r=new Uint8Array(Vr),n=new Uint8Array(Xr);return tr(r,n),{publicKey:r,secretKey:n}},r.sign.keyPair.fromSecretKey=function(r){if(yr(r),r.length!==Xr)throw new Error("bad secret key size");for(var n=new Uint8Array(Vr),e=0;e/dev/null && browserify test/browser/init.js test/*.quick.js | uglifyjs -c -m -o test/browser/_bundle-quick.js 2>/dev/null", + "test": "npm run test-node-all && npm run test-browser", + "bench": "node test/benchmark/bench.js", + "lint": "eslint nacl.js nacl-fast.js test/*.js test/benchmark/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/dchest/tweetnacl-js.git" + }, + "keywords": [ + "crypto", + "cryptography", + "curve25519", + "ed25519", + "encrypt", + "hash", + "key", + "nacl", + "poly1305", + "public", + "salsa20", + "signatures" + ], + "author": "TweetNaCl-js contributors", + "license": "Unlicense", + "bugs": { + "url": "https://github.com/dchest/tweetnacl-js/issues" + }, + "homepage": "https://tweetnacl.js.org", + "devDependencies": { + "browserify": "^13.0.0", + "eslint": "^2.2.0", + "faucet": "^0.0.1", + "tap-browser-color": "^0.1.2", + "tape": "^4.4.0", + "tape-run": "^2.1.3", + "tweetnacl-util": "^0.13.3", + "uglify-js": "^2.6.1" + }, + "browser": { + "buffer": false, + "crypto": false + } +} diff --git a/appasar/canary/node_modules/uuid/.eslintrc.json b/appasar/canary/node_modules/uuid/.eslintrc.json new file mode 100644 index 0000000..734a8e1 --- /dev/null +++ b/appasar/canary/node_modules/uuid/.eslintrc.json @@ -0,0 +1,47 @@ +{ + "root": true, + "env": { + "browser": true, + "commonjs": true, + "node": true, + "mocha": true + }, + "extends": ["eslint:recommended"], + "rules": { + "array-bracket-spacing": ["warn", "never"], + "arrow-body-style": ["warn", "as-needed"], + "arrow-parens": ["warn", "as-needed"], + "arrow-spacing": "warn", + "brace-style": ["warn", "1tbs"], + "camelcase": "warn", + "comma-spacing": ["warn", {"after": true}], + "dot-notation": "warn", + "eqeqeq": ["warn", "smart"], + "indent": ["warn", 2, { + "SwitchCase": 1, + "FunctionDeclaration": {"parameters": 1}, + "MemberExpression": 1, + "CallExpression": {"arguments": 1} + }], + "key-spacing": ["warn", {"beforeColon": false, "afterColon": true, "mode": "minimum"}], + "keyword-spacing": "warn", + "no-console": "off", + "no-empty": "off", + "no-multi-spaces": "warn", + "no-redeclare": "off", + "no-restricted-globals": ["warn", "Promise"], + "no-trailing-spaces": "warn", + "no-undef": "error", + "no-unused-vars": ["warn", {"args": "none"}], + "one-var": ["warn", "never"], + "padded-blocks": ["warn", "never"], + "object-curly-spacing": ["warn", "never"], + "quotes": ["warn", "single"], + "react/prop-types": "off", + "react/jsx-no-bind": "off", + "semi": ["warn", "always"], + "space-before-blocks": ["warn", "always"], + "space-before-function-paren": ["warn", "never"], + "space-in-parens": ["warn", "never"] + } +} diff --git a/appasar/canary/node_modules/uuid/AUTHORS b/appasar/canary/node_modules/uuid/AUTHORS new file mode 100644 index 0000000..5a10523 --- /dev/null +++ b/appasar/canary/node_modules/uuid/AUTHORS @@ -0,0 +1,5 @@ +Robert Kieffer +Christoph Tavan +AJ ONeal +Vincent Voyer +Roman Shtylman diff --git a/appasar/canary/node_modules/uuid/CHANGELOG.md b/appasar/canary/node_modules/uuid/CHANGELOG.md new file mode 100644 index 0000000..d9fe59c --- /dev/null +++ b/appasar/canary/node_modules/uuid/CHANGELOG.md @@ -0,0 +1,57 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +## [3.2.1](https://github.com/kelektiv/node-uuid/compare/v3.1.0...v3.2.1) (2018-01-16) + + +### Bug Fixes + +* use msCrypto if available. Fixes [#241](https://github.com/kelektiv/node-uuid/issues/241) ([#247](https://github.com/kelektiv/node-uuid/issues/247)) ([1fef18b](https://github.com/kelektiv/node-uuid/commit/1fef18b)) + + + + +# [3.2.0](https://github.com/kelektiv/node-uuid/compare/v3.1.0...v3.2.0) (2018-01-16) + + +### Bug Fixes + +* remove mistakenly added typescript dependency, rollback version (standard-version will auto-increment) ([09fa824](https://github.com/kelektiv/node-uuid/commit/09fa824)) +* use msCrypto if available. Fixes [#241](https://github.com/kelektiv/node-uuid/issues/241) ([#247](https://github.com/kelektiv/node-uuid/issues/247)) ([1fef18b](https://github.com/kelektiv/node-uuid/commit/1fef18b)) + + +### Features + +* Add v3 Support ([#217](https://github.com/kelektiv/node-uuid/issues/217)) ([d94f726](https://github.com/kelektiv/node-uuid/commit/d94f726)) + + + +# 3.0.1 (2016-11-28) + + * split uuid versions into separate files + +# 3.0.0 (2016-11-17) + + * remove .parse and .unparse + +# 2.0.0 + + * Removed uuid.BufferClass + +# 1.4.0 + + * Improved module context detection + * Removed public RNG functions + +# 1.3.2 + + * Improve tests and handling of v1() options (Issue #24) + * Expose RNG option to allow for perf testing with different generators + +# 1.3.0 + + * Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)! + * Support for node.js crypto API + * De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code diff --git a/appasar/canary/node_modules/uuid/LICENSE.md b/appasar/canary/node_modules/uuid/LICENSE.md new file mode 100644 index 0000000..8c84e39 --- /dev/null +++ b/appasar/canary/node_modules/uuid/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2010-2016 Robert Kieffer and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/uuid/README.md b/appasar/canary/node_modules/uuid/README.md new file mode 100644 index 0000000..cddaa14 --- /dev/null +++ b/appasar/canary/node_modules/uuid/README.md @@ -0,0 +1,293 @@ + + +# uuid [![Build Status](https://secure.travis-ci.org/kelektiv/node-uuid.svg?branch=master)](http://travis-ci.org/kelektiv/node-uuid) # + +Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS. + +Features: + +* Support for version 1, 3, 4 and 5 UUIDs +* Cross-platform +* Uses cryptographically-strong random number APIs (when available) +* Zero-dependency, small footprint (... but not [this small](https://gist.github.com/982883)) + +[**Deprecation warning**: The use of `require('uuid')` is deprecated and will not be +supported after version 3.x of this module. Instead, use `require('uuid/[v1|v3|v4|v5]')` as shown in the examples below.] + +## Quickstart - CommonJS (Recommended) + +```shell +npm install uuid +``` + +Then generate your uuid version of choice ... + +Version 1 (timestamp): + +```javascript +const uuidv1 = require('uuid/v1'); +uuidv1(); // ⇨ 'f64f2940-fae4-11e7-8c5f-ef356f279131' + +``` + +Version 3 (namespace): + +```javascript +const uuidv3 = require('uuid/v3'); + +// ... using predefined DNS namespace (for domain names) +uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6' + +// ... using predefined URL namespace (for, well, URLs) +uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138' + +// ... using a custom namespace +// +// Note: Custom namespaces should be a UUID string specific to your application! +// E.g. the one here was generated using this modules `uuid` CLI. +const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341'; +uuidv3('Hello, World!', MY_NAMESPACE); // ⇨ 'e8b5a51d-11c8-3310-a6ab-367563f20686' + +``` + +Version 4 (random): + +```javascript +const uuidv4 = require('uuid/v4'); +uuidv4(); // ⇨ '416ac246-e7ac-49ff-93b4-f7e94d997e6b' + +``` + +Version 5 (namespace): + +```javascript +const uuidv5 = require('uuid/v5'); + +// ... using predefined DNS namespace (for domain names) +uuidv5('hello.example.com', uuidv5.DNS); // ⇨ 'fdda765f-fc57-5604-a269-52a7df8164ec' + +// ... using predefined URL namespace (for, well, URLs) +uuidv5('http://example.com/hello', uuidv5.URL); // ⇨ '3bbcee75-cecc-5b56-8031-b6641c1ed1f1' + +// ... using a custom namespace +// +// Note: Custom namespaces should be a UUID string specific to your application! +// E.g. the one here was generated using this modules `uuid` CLI. +const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341'; +uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681' + +``` + +## Quickstart - Browser-ready Versions + +Browser-ready versions of this module are available via [wzrd.in](https://github.com/jfhbrook/wzrd.in). + +For version 1 uuids: + +```html + + +``` + +For version 3 uuids: + +```html + + +``` + +For version 4 uuids: + +```html + + +``` + +For version 5 uuids: + +```html + + +``` + +## API + +### Version 1 + +```javascript +const uuidv1 = require('uuid/v1'); + +// Incantations +uuidv1(); +uuidv1(options); +uuidv1(options, buffer, offset); +``` + +Generate and return a RFC4122 v1 (timestamp-based) UUID. + +* `options` - (Object) Optional uuid state to apply. Properties may include: + + * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1. + * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used. + * `msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used. + * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2. + +* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. +* `offset` - (Number) Starting index in `buffer` at which to begin writing. + +Returns `buffer`, if specified, otherwise the string form of the UUID + +Note: The id is generated guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.) + +Example: Generate string UUID with fully-specified options + +```javascript +const v1options = { + node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], + clockseq: 0x1234, + msecs: new Date('2011-11-01').getTime(), + nsecs: 5678 +}; +uuidv1(v1options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab' + +``` + +Example: In-place generation of two binary IDs + +```javascript +// Generate two ids in an array +const arr = new Array(); +uuidv1(null, arr, 0); // ⇨ [ 246, 87, 141, 176, 250, 228, 17, 231, 146, 52, 239, 53, 111, 39, 145, 49 ] +uuidv1(null, arr, 16); // ⇨ [ 246, 87, 141, 176, 250, 228, 17, 231, 146, 52, 239, 53, 111, 39, 145, 49, 246, 87, 180, 192, 250, 228, 17, 231, 146, 52, 239, 53, 111, 39, 145, 49 ] + +``` + +### Version 3 + +```javascript +const uuidv3 = require('uuid/v3'); + +// Incantations +uuidv3(name, namespace); +uuidv3(name, namespace, buffer); +uuidv3(name, namespace, buffer, offset); +``` + +Generate and return a RFC4122 v3 UUID. + +* `name` - (String | Array[]) "name" to create UUID with +* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values +* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. +* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0 + +Returns `buffer`, if specified, otherwise the string form of the UUID + +Example: + +```javascript +uuidv3('hello world', MY_NAMESPACE); // ⇨ '042ffd34-d989-321c-ad06-f60826172424' + +``` + +### Version 4 + +```javascript +const uuidv4 = require('uuid/v4') + +// Incantations +uuidv4(); +uuidv4(options); +uuidv4(options, buffer, offset); +``` + +Generate and return a RFC4122 v4 UUID. + +* `options` - (Object) Optional uuid state to apply. Properties may include: + * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values + * `rng` - (Function) Random # generator function that returns an Array[16] of byte values (0-255) +* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. +* `offset` - (Number) Starting index in `buffer` at which to begin writing. + +Returns `buffer`, if specified, otherwise the string form of the UUID + +Example: Generate string UUID with predefined `random` values + +```javascript +const v4options = { + random: [ + 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, + 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 + ] +}; +uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836' + +``` + +Example: Generate two IDs in a single buffer + +```javascript +const buffer = new Array(); +uuidv4(null, buffer, 0); // ⇨ [ 175, 10, 162, 184, 217, 255, 77, 139, 161, 80, 41, 200, 70, 238, 196, 250 ] +uuidv4(null, buffer, 16); // ⇨ [ 175, 10, 162, 184, 217, 255, 77, 139, 161, 80, 41, 200, 70, 238, 196, 250, 75, 162, 105, 153, 48, 238, 77, 58, 169, 56, 158, 207, 106, 160, 47, 239 ] + +``` + +### Version 5 + +```javascript +const uuidv5 = require('uuid/v5'); + +// Incantations +uuidv5(name, namespace); +uuidv5(name, namespace, buffer); +uuidv5(name, namespace, buffer, offset); +``` + +Generate and return a RFC4122 v5 UUID. + +* `name` - (String | Array[]) "name" to create UUID with +* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values +* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. +* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0 + +Returns `buffer`, if specified, otherwise the string form of the UUID + +Example: + +```javascript +uuidv5('hello world', MY_NAMESPACE); // ⇨ '9f282611-e0fd-5650-8953-89c8e342da0b' + +``` + +## Command Line + +UUIDs can be generated from the command line with the `uuid` command. + +```shell +$ uuid +ddeb27fb-d9a0-4624-be4d-4615062daed4 + +$ uuid v1 +02d37060-d446-11e7-a9fa-7bdae751ebe1 +``` + +Type `uuid --help` for usage details + +## Testing + +```shell +npm test +``` + +---- +Markdown generated from [README_js.md](README_js.md) by [![RunMD Logo](http://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd) \ No newline at end of file diff --git a/appasar/canary/node_modules/uuid/README_js.md b/appasar/canary/node_modules/uuid/README_js.md new file mode 100644 index 0000000..f34453b --- /dev/null +++ b/appasar/canary/node_modules/uuid/README_js.md @@ -0,0 +1,280 @@ +```javascript --hide +runmd.onRequire = path => path.replace(/^uuid/, './'); +``` + +# uuid [![Build Status](https://secure.travis-ci.org/kelektiv/node-uuid.svg?branch=master)](http://travis-ci.org/kelektiv/node-uuid) # + +Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS. + +Features: + +* Support for version 1, 3, 4 and 5 UUIDs +* Cross-platform +* Uses cryptographically-strong random number APIs (when available) +* Zero-dependency, small footprint (... but not [this small](https://gist.github.com/982883)) + +[**Deprecation warning**: The use of `require('uuid')` is deprecated and will not be +supported after version 3.x of this module. Instead, use `require('uuid/[v1|v3|v4|v5]')` as shown in the examples below.] + +## Quickstart - CommonJS (Recommended) + +```shell +npm install uuid +``` + +Then generate your uuid version of choice ... + +Version 1 (timestamp): + +```javascript --run v1 +const uuidv1 = require('uuid/v1'); +uuidv1(); // RESULT +``` + +Version 3 (namespace): + +```javascript --run v3 +const uuidv3 = require('uuid/v3'); + +// ... using predefined DNS namespace (for domain names) +uuidv3('hello.example.com', uuidv3.DNS); // RESULT + +// ... using predefined URL namespace (for, well, URLs) +uuidv3('http://example.com/hello', uuidv3.URL); // RESULT + +// ... using a custom namespace +// +// Note: Custom namespaces should be a UUID string specific to your application! +// E.g. the one here was generated using this modules `uuid` CLI. +const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341'; +uuidv3('Hello, World!', MY_NAMESPACE); // RESULT +``` + +Version 4 (random): + +```javascript --run v4 +const uuidv4 = require('uuid/v4'); +uuidv4(); // RESULT +``` + +Version 5 (namespace): + +```javascript --run v5 +const uuidv5 = require('uuid/v5'); + +// ... using predefined DNS namespace (for domain names) +uuidv5('hello.example.com', uuidv5.DNS); // RESULT + +// ... using predefined URL namespace (for, well, URLs) +uuidv5('http://example.com/hello', uuidv5.URL); // RESULT + +// ... using a custom namespace +// +// Note: Custom namespaces should be a UUID string specific to your application! +// E.g. the one here was generated using this modules `uuid` CLI. +const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341'; +uuidv5('Hello, World!', MY_NAMESPACE); // RESULT +``` + +## Quickstart - Browser-ready Versions + +Browser-ready versions of this module are available via [wzrd.in](https://github.com/jfhbrook/wzrd.in). + +For version 1 uuids: + +```html + + +``` + +For version 3 uuids: + +```html + + +``` + +For version 4 uuids: + +```html + + +``` + +For version 5 uuids: + +```html + + +``` + +## API + +### Version 1 + +```javascript +const uuidv1 = require('uuid/v1'); + +// Incantations +uuidv1(); +uuidv1(options); +uuidv1(options, buffer, offset); +``` + +Generate and return a RFC4122 v1 (timestamp-based) UUID. + +* `options` - (Object) Optional uuid state to apply. Properties may include: + + * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1. + * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used. + * `msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used. + * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2. + +* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. +* `offset` - (Number) Starting index in `buffer` at which to begin writing. + +Returns `buffer`, if specified, otherwise the string form of the UUID + +Note: The id is generated guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.) + +Example: Generate string UUID with fully-specified options + +```javascript --run v1 +const v1options = { + node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], + clockseq: 0x1234, + msecs: new Date('2011-11-01').getTime(), + nsecs: 5678 +}; +uuidv1(v1options); // RESULT +``` + +Example: In-place generation of two binary IDs + +```javascript --run v1 +// Generate two ids in an array +const arr = new Array(); +uuidv1(null, arr, 0); // RESULT +uuidv1(null, arr, 16); // RESULT +``` + +### Version 3 + +```javascript +const uuidv3 = require('uuid/v3'); + +// Incantations +uuidv3(name, namespace); +uuidv3(name, namespace, buffer); +uuidv3(name, namespace, buffer, offset); +``` + +Generate and return a RFC4122 v3 UUID. + +* `name` - (String | Array[]) "name" to create UUID with +* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values +* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. +* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0 + +Returns `buffer`, if specified, otherwise the string form of the UUID + +Example: + +```javascript --run v3 +uuidv3('hello world', MY_NAMESPACE); // RESULT +``` + +### Version 4 + +```javascript +const uuidv4 = require('uuid/v4') + +// Incantations +uuidv4(); +uuidv4(options); +uuidv4(options, buffer, offset); +``` + +Generate and return a RFC4122 v4 UUID. + +* `options` - (Object) Optional uuid state to apply. Properties may include: + * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values + * `rng` - (Function) Random # generator function that returns an Array[16] of byte values (0-255) +* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. +* `offset` - (Number) Starting index in `buffer` at which to begin writing. + +Returns `buffer`, if specified, otherwise the string form of the UUID + +Example: Generate string UUID with predefined `random` values + +```javascript --run v4 +const v4options = { + random: [ + 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, + 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 + ] +}; +uuidv4(v4options); // RESULT +``` + +Example: Generate two IDs in a single buffer + +```javascript --run v4 +const buffer = new Array(); +uuidv4(null, buffer, 0); // RESULT +uuidv4(null, buffer, 16); // RESULT +``` + +### Version 5 + +```javascript +const uuidv5 = require('uuid/v5'); + +// Incantations +uuidv5(name, namespace); +uuidv5(name, namespace, buffer); +uuidv5(name, namespace, buffer, offset); +``` + +Generate and return a RFC4122 v5 UUID. + +* `name` - (String | Array[]) "name" to create UUID with +* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values +* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. +* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0 + +Returns `buffer`, if specified, otherwise the string form of the UUID + +Example: + +```javascript --run v5 +uuidv5('hello world', MY_NAMESPACE); // RESULT +``` + +## Command Line + +UUIDs can be generated from the command line with the `uuid` command. + +```shell +$ uuid +ddeb27fb-d9a0-4624-be4d-4615062daed4 + +$ uuid v1 +02d37060-d446-11e7-a9fa-7bdae751ebe1 +``` + +Type `uuid --help` for usage details + +## Testing + +```shell +npm test +``` diff --git a/appasar/canary/node_modules/uuid/bin/uuid b/appasar/canary/node_modules/uuid/bin/uuid new file mode 100644 index 0000000..502626e --- /dev/null +++ b/appasar/canary/node_modules/uuid/bin/uuid @@ -0,0 +1,65 @@ +#!/usr/bin/env node +var assert = require('assert'); + +function usage() { + console.log('Usage:'); + console.log(' uuid'); + console.log(' uuid v1'); + console.log(' uuid v3 '); + console.log(' uuid v4'); + console.log(' uuid v5 '); + console.log(' uuid --help'); + console.log('\nNote: may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122'); +} + +var args = process.argv.slice(2); + +if (args.indexOf('--help') >= 0) { + usage(); + process.exit(0); +} +var version = args.shift() || 'v4'; + +switch (version) { + case 'v1': + var uuidV1 = require('../v1'); + console.log(uuidV1()); + break; + + case 'v3': + var uuidV3 = require('../v3'); + + var name = args.shift(); + var namespace = args.shift(); + assert(name != null, 'v3 name not specified'); + assert(namespace != null, 'v3 namespace not specified'); + + if (namespace == 'URL') namespace = uuidV3.URL; + if (namespace == 'DNS') namespace = uuidV3.DNS; + + console.log(uuidV3(name, namespace)); + break; + + case 'v4': + var uuidV4 = require('../v4'); + console.log(uuidV4()); + break; + + case 'v5': + var uuidV5 = require('../v5'); + + var name = args.shift(); + var namespace = args.shift(); + assert(name != null, 'v5 name not specified'); + assert(namespace != null, 'v5 namespace not specified'); + + if (namespace == 'URL') namespace = uuidV5.URL; + if (namespace == 'DNS') namespace = uuidV5.DNS; + + console.log(uuidV5(name, namespace)); + break; + + default: + usage(); + process.exit(1); +} diff --git a/appasar/canary/node_modules/uuid/index.js b/appasar/canary/node_modules/uuid/index.js new file mode 100644 index 0000000..e96791a --- /dev/null +++ b/appasar/canary/node_modules/uuid/index.js @@ -0,0 +1,8 @@ +var v1 = require('./v1'); +var v4 = require('./v4'); + +var uuid = v4; +uuid.v1 = v1; +uuid.v4 = v4; + +module.exports = uuid; diff --git a/appasar/canary/node_modules/uuid/lib/bytesToUuid.js b/appasar/canary/node_modules/uuid/lib/bytesToUuid.js new file mode 100644 index 0000000..2c9a223 --- /dev/null +++ b/appasar/canary/node_modules/uuid/lib/bytesToUuid.js @@ -0,0 +1,23 @@ +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +var byteToHex = []; +for (var i = 0; i < 256; ++i) { + byteToHex[i] = (i + 0x100).toString(16).substr(1); +} + +function bytesToUuid(buf, offset) { + var i = offset || 0; + var bth = byteToHex; + return bth[buf[i++]] + bth[buf[i++]] + + bth[buf[i++]] + bth[buf[i++]] + '-' + + bth[buf[i++]] + bth[buf[i++]] + '-' + + bth[buf[i++]] + bth[buf[i++]] + '-' + + bth[buf[i++]] + bth[buf[i++]] + '-' + + bth[buf[i++]] + bth[buf[i++]] + + bth[buf[i++]] + bth[buf[i++]] + + bth[buf[i++]] + bth[buf[i++]]; +} + +module.exports = bytesToUuid; diff --git a/appasar/canary/node_modules/uuid/lib/md5-browser.js b/appasar/canary/node_modules/uuid/lib/md5-browser.js new file mode 100644 index 0000000..9b3b6c7 --- /dev/null +++ b/appasar/canary/node_modules/uuid/lib/md5-browser.js @@ -0,0 +1,216 @@ +/* + * Browser-compatible JavaScript MD5 + * + * Modification of JavaScript MD5 + * https://github.com/blueimp/JavaScript-MD5 + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + * + * Based on + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +'use strict'; + +function md5(bytes) { + if (typeof(bytes) == 'string') { + var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + bytes = new Array(msg.length); + for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i); + } + + return md5ToHexEncodedArray( + wordsToMd5( + bytesToWords(bytes) + , bytes.length * 8) + ); +} + + +/* +* Convert an array of little-endian words to an array of bytes +*/ +function md5ToHexEncodedArray(input) { + var i; + var x; + var output = []; + var length32 = input.length * 32; + var hexTab = '0123456789abcdef'; + var hex; + + for (i = 0; i < length32; i += 8) { + x = (input[i >> 5] >>> (i % 32)) & 0xFF; + + hex = parseInt(hexTab.charAt((x >>> 4) & 0x0F) + hexTab.charAt(x & 0x0F), 16); + + output.push(hex); + } + return output; +} + +/* +* Calculate the MD5 of an array of little-endian words, and a bit length. +*/ +function wordsToMd5(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << (len % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var i; + var olda; + var oldb; + var oldc; + var oldd; + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + + var d = 271733878; + + for (i = 0; i < x.length; i += 16) { + olda = a; + oldb = b; + oldc = c; + oldd = d; + + a = md5ff(a, b, c, d, x[i], 7, -680876936); + d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); + c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); + b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); + a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); + d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); + c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); + b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); + a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); + d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); + c = md5ff(c, d, a, b, x[i + 10], 17, -42063); + b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); + a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); + d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); + c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); + b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); + + a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); + d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); + c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); + b = md5gg(b, c, d, a, x[i], 20, -373897302); + a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); + d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); + c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); + b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); + a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); + d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); + c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); + b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); + a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); + d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); + c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); + b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); + + a = md5hh(a, b, c, d, x[i + 5], 4, -378558); + d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); + c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); + b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); + a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); + d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); + c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); + b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); + a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); + d = md5hh(d, a, b, c, x[i], 11, -358537222); + c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); + b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); + a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); + d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); + c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); + b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); + + a = md5ii(a, b, c, d, x[i], 6, -198630844); + d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); + c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); + b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); + a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); + d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); + c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); + b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); + a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); + d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); + c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); + b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); + a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); + d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); + c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); + b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); + + a = safeAdd(a, olda); + b = safeAdd(b, oldb); + c = safeAdd(c, oldc); + d = safeAdd(d, oldd); + } + return [a, b, c, d]; +} + +/* +* Convert an array bytes to an array of little-endian words +* Characters >255 have their high-byte silently ignored. +*/ +function bytesToWords(input) { + var i; + var output = []; + output[(input.length >> 2) - 1] = undefined; + for (i = 0; i < output.length; i += 1) { + output[i] = 0; + } + var length8 = input.length * 8; + for (i = 0; i < length8; i += 8) { + output[i >> 5] |= (input[(i / 8)] & 0xFF) << (i % 32); + } + + return output; +} + +/* +* Add integers, wrapping at 2^32. This uses 16-bit operations internally +* to work around bugs in some JS interpreters. +*/ +function safeAdd(x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* +* Bitwise rotate a 32-bit number to the left. +*/ +function bitRotateLeft(num, cnt) { + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* +* These functions implement the four basic operations the algorithm uses. +*/ +function md5cmn(q, a, b, x, s, t) { + return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); +} +function md5ff(a, b, c, d, x, s, t) { + return md5cmn((b & c) | ((~b) & d), a, b, x, s, t); +} +function md5gg(a, b, c, d, x, s, t) { + return md5cmn((b & d) | (c & (~d)), a, b, x, s, t); +} +function md5hh(a, b, c, d, x, s, t) { + return md5cmn(b ^ c ^ d, a, b, x, s, t); +} +function md5ii(a, b, c, d, x, s, t) { + return md5cmn(c ^ (b | (~d)), a, b, x, s, t); +} + +module.exports = md5; diff --git a/appasar/canary/node_modules/uuid/lib/md5.js b/appasar/canary/node_modules/uuid/lib/md5.js new file mode 100644 index 0000000..7044b87 --- /dev/null +++ b/appasar/canary/node_modules/uuid/lib/md5.js @@ -0,0 +1,25 @@ +'use strict'; + +var crypto = require('crypto'); + +function md5(bytes) { + if (typeof Buffer.from === 'function') { + // Modern Buffer API + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + } else { + // Pre-v4 Buffer API + if (Array.isArray(bytes)) { + bytes = new Buffer(bytes); + } else if (typeof bytes === 'string') { + bytes = new Buffer(bytes, 'utf8'); + } + } + + return crypto.createHash('md5').update(bytes).digest(); +} + +module.exports = md5; diff --git a/appasar/canary/node_modules/uuid/lib/rng-browser.js b/appasar/canary/node_modules/uuid/lib/rng-browser.js new file mode 100644 index 0000000..14d2117 --- /dev/null +++ b/appasar/canary/node_modules/uuid/lib/rng-browser.js @@ -0,0 +1,32 @@ +// Unique ID creation requires a high quality random # generator. In the +// browser this is a little complicated due to unknown quality of Math.random() +// and inconsistent support for the `crypto` API. We do the best we can via +// feature-detection + +// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. +var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues.bind(crypto)) || + (typeof(msCrypto) != 'undefined' && msCrypto.getRandomValues.bind(msCrypto)); +if (getRandomValues) { + // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto + var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef + + module.exports = function whatwgRNG() { + getRandomValues(rnds8); + return rnds8; + }; +} else { + // Math.random()-based (RNG) + // + // If all else fails, use Math.random(). It's fast, but is of unspecified + // quality. + var rnds = new Array(16); + + module.exports = function mathRNG() { + for (var i = 0, r; i < 16; i++) { + if ((i & 0x03) === 0) r = Math.random() * 0x100000000; + rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; + } + + return rnds; + }; +} diff --git a/appasar/canary/node_modules/uuid/lib/rng.js b/appasar/canary/node_modules/uuid/lib/rng.js new file mode 100644 index 0000000..58f0dc9 --- /dev/null +++ b/appasar/canary/node_modules/uuid/lib/rng.js @@ -0,0 +1,8 @@ +// Unique ID creation requires a high quality random # generator. In node.js +// this is pretty straight-forward - we use the crypto API. + +var crypto = require('crypto'); + +module.exports = function nodeRNG() { + return crypto.randomBytes(16); +}; diff --git a/appasar/canary/node_modules/uuid/lib/sha1-browser.js b/appasar/canary/node_modules/uuid/lib/sha1-browser.js new file mode 100644 index 0000000..5758ed7 --- /dev/null +++ b/appasar/canary/node_modules/uuid/lib/sha1-browser.js @@ -0,0 +1,89 @@ +// Adapted from Chris Veness' SHA1 code at +// http://www.movable-type.co.uk/scripts/sha1.html +'use strict'; + +function f(s, x, y, z) { + switch (s) { + case 0: return (x & y) ^ (~x & z); + case 1: return x ^ y ^ z; + case 2: return (x & y) ^ (x & z) ^ (y & z); + case 3: return x ^ y ^ z; + } +} + +function ROTL(x, n) { + return (x << n) | (x>>> (32 - n)); +} + +function sha1(bytes) { + var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; + var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; + + if (typeof(bytes) == 'string') { + var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + bytes = new Array(msg.length); + for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i); + } + + bytes.push(0x80); + + var l = bytes.length/4 + 2; + var N = Math.ceil(l/16); + var M = new Array(N); + + for (var i=0; i>> 0; + e = d; + d = c; + c = ROTL(b, 30) >>> 0; + b = a; + a = T; + } + + H[0] = (H[0] + a) >>> 0; + H[1] = (H[1] + b) >>> 0; + H[2] = (H[2] + c) >>> 0; + H[3] = (H[3] + d) >>> 0; + H[4] = (H[4] + e) >>> 0; + } + + return [ + H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, + H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, + H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, + H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, + H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff + ]; +} + +module.exports = sha1; diff --git a/appasar/canary/node_modules/uuid/lib/sha1.js b/appasar/canary/node_modules/uuid/lib/sha1.js new file mode 100644 index 0000000..0b54b25 --- /dev/null +++ b/appasar/canary/node_modules/uuid/lib/sha1.js @@ -0,0 +1,25 @@ +'use strict'; + +var crypto = require('crypto'); + +function sha1(bytes) { + if (typeof Buffer.from === 'function') { + // Modern Buffer API + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + } else { + // Pre-v4 Buffer API + if (Array.isArray(bytes)) { + bytes = new Buffer(bytes); + } else if (typeof bytes === 'string') { + bytes = new Buffer(bytes, 'utf8'); + } + } + + return crypto.createHash('sha1').update(bytes).digest(); +} + +module.exports = sha1; diff --git a/appasar/canary/node_modules/uuid/lib/v35.js b/appasar/canary/node_modules/uuid/lib/v35.js new file mode 100644 index 0000000..842c60e --- /dev/null +++ b/appasar/canary/node_modules/uuid/lib/v35.js @@ -0,0 +1,53 @@ +var bytesToUuid = require('./bytesToUuid'); + +function uuidToBytes(uuid) { + // Note: We assume we're being passed a valid uuid string + var bytes = []; + uuid.replace(/[a-fA-F0-9]{2}/g, function(hex) { + bytes.push(parseInt(hex, 16)); + }); + + return bytes; +} + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + var bytes = new Array(str.length); + for (var i = 0; i < str.length; i++) { + bytes[i] = str.charCodeAt(i); + } + return bytes; +} + +module.exports = function(name, version, hashfunc) { + var generateUUID = function(value, namespace, buf, offset) { + var off = buf && offset || 0; + + if (typeof(value) == 'string') value = stringToBytes(value); + if (typeof(namespace) == 'string') namespace = uuidToBytes(namespace); + + if (!Array.isArray(value)) throw TypeError('value must be an array of bytes'); + if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values'); + + // Per 4.3 + var bytes = hashfunc(namespace.concat(value)); + bytes[6] = (bytes[6] & 0x0f) | version; + bytes[8] = (bytes[8] & 0x3f) | 0x80; + + if (buf) { + for (var idx = 0; idx < 16; ++idx) { + buf[off+idx] = bytes[idx]; + } + } + + return buf || bytesToUuid(bytes); + }; + + generateUUID.name = name; + + // Pre-defined namespaces, per Appendix C + generateUUID.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; + generateUUID.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; + + return generateUUID; +}; diff --git a/appasar/canary/node_modules/uuid/package.json b/appasar/canary/node_modules/uuid/package.json new file mode 100644 index 0000000..8adfef5 --- /dev/null +++ b/appasar/canary/node_modules/uuid/package.json @@ -0,0 +1,36 @@ +{ + "name": "uuid", + "version": "3.2.1", + "description": "RFC4122 (v1, v4, and v5) UUIDs", + "keywords": [ + "uuid", + "guid", + "rfc4122" + ], + "license": "MIT", + "bin": { + "uuid": "./bin/uuid" + }, + "devDependencies": { + "eslint": "4.5.0", + "mocha": "3.1.2", + "runmd": "1.0.1", + "standard-version": "4.2.0" + }, + "scripts": { + "test": "mocha test/test.js", + "md": "runmd --watch --output=README.md README_js.md", + "release": "standard-version", + "prepare": "runmd --output=README.md README_js.md" + }, + "browser": { + "./lib/rng.js": "./lib/rng-browser.js", + "./lib/sha1.js": "./lib/sha1-browser.js", + "./lib/md5.js": "./lib/md5-browser.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/kelektiv/node-uuid.git" + }, + "dependencies": {} +} diff --git a/appasar/canary/node_modules/uuid/v1.js b/appasar/canary/node_modules/uuid/v1.js new file mode 100644 index 0000000..d84c0f4 --- /dev/null +++ b/appasar/canary/node_modules/uuid/v1.js @@ -0,0 +1,109 @@ +var rng = require('./lib/rng'); +var bytesToUuid = require('./lib/bytesToUuid'); + +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html + +var _nodeId; +var _clockseq; + +// Previous uuid creation time +var _lastMSecs = 0; +var _lastNSecs = 0; + +// See https://github.com/broofa/node-uuid for API details +function v1(options, buf, offset) { + var i = buf && offset || 0; + var b = buf || []; + + options = options || {}; + var node = options.node || _nodeId; + var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; + + // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + if (node == null || clockseq == null) { + var seedBytes = rng(); + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [ + seedBytes[0] | 0x01, + seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5] + ]; + } + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } + + // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); + + // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; + + // Time since last uuid creation (in msecs) + var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; + + // Per 4.2.1.2, Bump clockseq on clock regression + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } + + // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } + + // Per 4.2.1.2 Throw error if too many uuids are requested + if (nsecs >= 10000) { + throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; + + // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + msecs += 12219292800000; + + // `time_low` + var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; + + // `time_mid` + var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; + + // `time_high_and_version` + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + b[i++] = tmh >>> 16 & 0xff; + + // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + b[i++] = clockseq >>> 8 | 0x80; + + // `clock_seq_low` + b[i++] = clockseq & 0xff; + + // `node` + for (var n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf ? buf : bytesToUuid(b); +} + +module.exports = v1; diff --git a/appasar/canary/node_modules/uuid/v3.js b/appasar/canary/node_modules/uuid/v3.js new file mode 100644 index 0000000..ee7e14c --- /dev/null +++ b/appasar/canary/node_modules/uuid/v3.js @@ -0,0 +1,4 @@ +var v35 = require('./lib/v35.js'); +var md5 = require('./lib/md5'); + +module.exports = v35('v3', 0x30, md5); \ No newline at end of file diff --git a/appasar/canary/node_modules/uuid/v4.js b/appasar/canary/node_modules/uuid/v4.js new file mode 100644 index 0000000..1f07be1 --- /dev/null +++ b/appasar/canary/node_modules/uuid/v4.js @@ -0,0 +1,29 @@ +var rng = require('./lib/rng'); +var bytesToUuid = require('./lib/bytesToUuid'); + +function v4(options, buf, offset) { + var i = buf && offset || 0; + + if (typeof(options) == 'string') { + buf = options === 'binary' ? new Array(16) : null; + options = null; + } + options = options || {}; + + var rnds = options.random || (options.rng || rng)(); + + // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + rnds[6] = (rnds[6] & 0x0f) | 0x40; + rnds[8] = (rnds[8] & 0x3f) | 0x80; + + // Copy bytes to buffer, if provided + if (buf) { + for (var ii = 0; ii < 16; ++ii) { + buf[i + ii] = rnds[ii]; + } + } + + return buf || bytesToUuid(rnds); +} + +module.exports = v4; diff --git a/appasar/canary/node_modules/uuid/v5.js b/appasar/canary/node_modules/uuid/v5.js new file mode 100644 index 0000000..4945baf --- /dev/null +++ b/appasar/canary/node_modules/uuid/v5.js @@ -0,0 +1,3 @@ +var v35 = require('./lib/v35.js'); +var sha1 = require('./lib/sha1'); +module.exports = v35('v5', 0x50, sha1); diff --git a/appasar/canary/node_modules/verror/.npmignore b/appasar/canary/node_modules/verror/.npmignore new file mode 100644 index 0000000..f14aec8 --- /dev/null +++ b/appasar/canary/node_modules/verror/.npmignore @@ -0,0 +1,9 @@ +.gitignore +.gitmodules +deps +examples +experiments +jsl.node.conf +Makefile +Makefile.targ +test diff --git a/appasar/canary/node_modules/verror/CHANGES.md b/appasar/canary/node_modules/verror/CHANGES.md new file mode 100644 index 0000000..bbb745a --- /dev/null +++ b/appasar/canary/node_modules/verror/CHANGES.md @@ -0,0 +1,28 @@ +# Changelog + +## Not yet released + +None yet. + +## v1.10.0 + +* #49 want convenience functions for MultiErrors + +## v1.9.0 + +* #47 could use VError.hasCauseWithName() + +## v1.8.1 + +* #39 captureStackTrace lost when inheriting from WError + +## v1.8.0 + +* #23 Preserve original stack trace(s) + +## v1.7.0 + +* #10 better support for extra properties on Errors +* #11 make it easy to find causes of a particular kind +* #29 No documentation on how to Install this package +* #36 elide development-only files from npm package diff --git a/appasar/canary/node_modules/verror/CONTRIBUTING.md b/appasar/canary/node_modules/verror/CONTRIBUTING.md new file mode 100644 index 0000000..750cef8 --- /dev/null +++ b/appasar/canary/node_modules/verror/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing + +This repository uses [cr.joyent.us](https://cr.joyent.us) (Gerrit) for new +changes. Anyone can submit changes. To get started, see the [cr.joyent.us user +guide](https://github.com/joyent/joyent-gerrit/blob/master/docs/user/README.md). +This repo does not use GitHub pull requests. + +See the [Joyent Engineering +Guidelines](https://github.com/joyent/eng/blob/master/docs/index.md) for general +best practices expected in this repository. + +Contributions should be "make prepush" clean. The "prepush" target runs the +"check" target, which requires these separate tools: + +* https://github.com/davepacheco/jsstyle +* https://github.com/davepacheco/javascriptlint + +If you're changing something non-trivial or user-facing, you may want to submit +an issue first. diff --git a/appasar/canary/node_modules/verror/LICENSE b/appasar/canary/node_modules/verror/LICENSE new file mode 100644 index 0000000..82a5cb8 --- /dev/null +++ b/appasar/canary/node_modules/verror/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016, Joyent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE diff --git a/appasar/canary/node_modules/verror/README.md b/appasar/canary/node_modules/verror/README.md new file mode 100644 index 0000000..c1f0635 --- /dev/null +++ b/appasar/canary/node_modules/verror/README.md @@ -0,0 +1,528 @@ +# verror: rich JavaScript errors + +This module provides several classes in support of Joyent's [Best Practices for +Error Handling in Node.js](http://www.joyent.com/developers/node/design/errors). +If you find any of the behavior here confusing or surprising, check out that +document first. + +The error classes here support: + +* printf-style arguments for the message +* chains of causes +* properties to provide extra information about the error +* creating your own subclasses that support all of these + +The classes here are: + +* **VError**, for chaining errors while preserving each one's error message. + This is useful in servers and command-line utilities when you want to + propagate an error up a call stack, but allow various levels to add their own + context. See examples below. +* **WError**, for wrapping errors while hiding the lower-level messages from the + top-level error. This is useful for API endpoints where you don't want to + expose internal error messages, but you still want to preserve the error chain + for logging and debugging. +* **SError**, which is just like VError but interprets printf-style arguments + more strictly. +* **MultiError**, which is just an Error that encapsulates one or more other + errors. (This is used for parallel operations that return several errors.) + + +# Quick start + +First, install the package: + + npm install verror + +If nothing else, you can use VError as a drop-in replacement for the built-in +JavaScript Error class, with the addition of printf-style messages: + +```javascript +var err = new VError('missing file: "%s"', '/etc/passwd'); +console.log(err.message); +``` + +This prints: + + missing file: "/etc/passwd" + +You can also pass a `cause` argument, which is any other Error object: + +```javascript +var fs = require('fs'); +var filename = '/nonexistent'; +fs.stat(filename, function (err1) { + var err2 = new VError(err1, 'stat "%s"', filename); + console.error(err2.message); +}); +``` + +This prints out: + + stat "/nonexistent": ENOENT, stat '/nonexistent' + +which resembles how Unix programs typically report errors: + + $ sort /nonexistent + sort: open failed: /nonexistent: No such file or directory + +To match the Unixy feel, when you print out the error, just prepend the +program's name to the VError's `message`. Or just call +[node-cmdutil.fail(your_verror)](https://github.com/joyent/node-cmdutil), which +does this for you. + +You can get the next-level Error using `err.cause()`: + +```javascript +console.error(err2.cause().message); +``` + +prints: + + ENOENT, stat '/nonexistent' + +Of course, you can chain these as many times as you want, and it works with any +kind of Error: + +```javascript +var err1 = new Error('No such file or directory'); +var err2 = new VError(err1, 'failed to stat "%s"', '/junk'); +var err3 = new VError(err2, 'request failed'); +console.error(err3.message); +``` + +This prints: + + request failed: failed to stat "/junk": No such file or directory + +The idea is that each layer in the stack annotates the error with a description +of what it was doing. The end result is a message that explains what happened +at each level. + +You can also decorate Error objects with additional information so that callers +can not only handle each kind of error differently, but also construct their own +error messages (e.g., to localize them, format them, group them by type, and so +on). See the example below. + + +# Deeper dive + +The two main goals for VError are: + +* **Make it easy to construct clear, complete error messages intended for + people.** Clear error messages greatly improve both user experience and + debuggability, so we wanted to make it easy to build them. That's why the + constructor takes printf-style arguments. +* **Make it easy to construct objects with programmatically-accessible + metadata** (which we call _informational properties_). Instead of just saying + "connection refused while connecting to 192.168.1.2:80", you can add + properties like `"ip": "192.168.1.2"` and `"tcpPort": 80`. This can be used + for feeding into monitoring systems, analyzing large numbers of Errors (as + from a log file), or localizing error messages. + +To really make this useful, it also needs to be easy to compose Errors: +higher-level code should be able to augment the Errors reported by lower-level +code to provide a more complete description of what happened. Instead of saying +"connection refused", you can say "operation X failed: connection refused". +That's why VError supports `causes`. + +In order for all this to work, programmers need to know that it's generally safe +to wrap lower-level Errors with higher-level ones. If you have existing code +that handles Errors produced by a library, you should be able to wrap those +Errors with a VError to add information without breaking the error handling +code. There are two obvious ways that this could break such consumers: + +* The error's name might change. People typically use `name` to determine what + kind of Error they've got. To ensure compatibility, you can create VErrors + with custom names, but this approach isn't great because it prevents you from + representing complex failures. For this reason, VError provides + `findCauseByName`, which essentially asks: does this Error _or any of its + causes_ have this specific type? If error handling code uses + `findCauseByName`, then subsystems can construct very specific causal chains + for debuggability and still let people handle simple cases easily. There's an + example below. +* The error's properties might change. People often hang additional properties + off of Error objects. If we wrap an existing Error in a new Error, those + properties would be lost unless we copied them. But there are a variety of + both standard and non-standard Error properties that should _not_ be copied in + this way: most obviously `name`, `message`, and `stack`, but also `fileName`, + `lineNumber`, and a few others. Plus, it's useful for some Error subclasses + to have their own private properties -- and there'd be no way to know whether + these should be copied. For these reasons, VError first-classes these + information properties. You have to provide them in the constructor, you can + only fetch them with the `info()` function, and VError takes care of making + sure properties from causes wind up in the `info()` output. + +Let's put this all together with an example from the node-fast RPC library. +node-fast implements a simple RPC protocol for Node programs. There's a server +and client interface, and clients make RPC requests to servers. Let's say the +server fails with an UnauthorizedError with message "user 'bob' is not +authorized". The client wraps all server errors with a FastServerError. The +client also wraps all request errors with a FastRequestError that includes the +name of the RPC call being made. The result of this failed RPC might look like +this: + + name: FastRequestError + message: "request failed: server error: user 'bob' is not authorized" + rpcMsgid: + rpcMethod: GetObject + cause: + name: FastServerError + message: "server error: user 'bob' is not authorized" + cause: + name: UnauthorizedError + message: "user 'bob' is not authorized" + rpcUser: "bob" + +When the caller uses `VError.info()`, the information properties are collapsed +so that it looks like this: + + message: "request failed: server error: user 'bob' is not authorized" + rpcMsgid: + rpcMethod: GetObject + rpcUser: "bob" + +Taking this apart: + +* The error's message is a complete description of the problem. The caller can + report this directly to its caller, which can potentially make its way back to + an end user (if appropriate). It can also be logged. +* The caller can tell that the request failed on the server, rather than as a + result of a client problem (e.g., failure to serialize the request), a + transport problem (e.g., failure to connect to the server), or something else + (e.g., a timeout). They do this using `findCauseByName('FastServerError')` + rather than checking the `name` field directly. +* If the caller logs this error, the logs can be analyzed to aggregate + errors by cause, by RPC method name, by user, or whatever. Or the + error can be correlated with other events for the same rpcMsgid. +* It wasn't very hard for any part of the code to contribute to this Error. + Each part of the stack has just a few lines to provide exactly what it knows, + with very little boilerplate. + +It's not expected that you'd use these complex forms all the time. Despite +supporting the complex case above, you can still just do: + + new VError("my service isn't working"); + +for the simple cases. + + +# Reference: VError, WError, SError + +VError, WError, and SError are convenient drop-in replacements for `Error` that +support printf-style arguments, first-class causes, informational properties, +and other useful features. + + +## Constructors + +The VError constructor has several forms: + +```javascript +/* + * This is the most general form. You can specify any supported options + * (including "cause" and "info") this way. + */ +new VError(options, sprintf_args...) + +/* + * This is a useful shorthand when the only option you need is "cause". + */ +new VError(cause, sprintf_args...) + +/* + * This is a useful shorthand when you don't need any options at all. + */ +new VError(sprintf_args...) +``` + +All of these forms construct a new VError that behaves just like the built-in +JavaScript `Error` class, with some additional methods described below. + +In the first form, `options` is a plain object with any of the following +optional properties: + +Option name | Type | Meaning +---------------- | ---------------- | ------- +`name` | string | Describes what kind of error this is. This is intended for programmatic use to distinguish between different kinds of errors. Note that in modern versions of Node.js, this name is ignored in the `stack` property value, but callers can still use the `name` property to get at it. +`cause` | any Error object | Indicates that the new error was caused by `cause`. See `cause()` below. If unspecified, the cause will be `null`. +`strict` | boolean | If true, then `null` and `undefined` values in `sprintf_args` are passed through to `sprintf()`. Otherwise, these are replaced with the strings `'null'`, and '`undefined`', respectively. +`constructorOpt` | function | If specified, then the stack trace for this error ends at function `constructorOpt`. Functions called by `constructorOpt` will not show up in the stack. This is useful when this class is subclassed. +`info` | object | Specifies arbitrary informational properties that are available through the `VError.info(err)` static class method. See that method for details. + +The second form is equivalent to using the first form with the specified `cause` +as the error's cause. This form is distinguished from the first form because +the first argument is an Error. + +The third form is equivalent to using the first form with all default option +values. This form is distinguished from the other forms because the first +argument is not an object or an Error. + +The `WError` constructor is used exactly the same way as the `VError` +constructor. The `SError` constructor is also used the same way as the +`VError` constructor except that in all cases, the `strict` property is +overriden to `true. + + +## Public properties + +`VError`, `WError`, and `SError` all provide the same public properties as +JavaScript's built-in Error objects. + +Property name | Type | Meaning +------------- | ------ | ------- +`name` | string | Programmatically-usable name of the error. +`message` | string | Human-readable summary of the failure. Programmatically-accessible details are provided through `VError.info(err)` class method. +`stack` | string | Human-readable stack trace where the Error was constructed. + +For all of these classes, the printf-style arguments passed to the constructor +are processed with `sprintf()` to form a message. For `WError`, this becomes +the complete `message` property. For `SError` and `VError`, this message is +prepended to the message of the cause, if any (with a suitable separator), and +the result becomes the `message` property. + +The `stack` property is managed entirely by the underlying JavaScript +implementation. It's generally implemented using a getter function because +constructing the human-readable stack trace is somewhat expensive. + +## Class methods + +The following methods are defined on the `VError` class and as exported +functions on the `verror` module. They're defined this way rather than using +methods on VError instances so that they can be used on Errors not created with +`VError`. + +### `VError.cause(err)` + +The `cause()` function returns the next Error in the cause chain for `err`, or +`null` if there is no next error. See the `cause` argument to the constructor. +Errors can have arbitrarily long cause chains. You can walk the `cause` chain +by invoking `VError.cause(err)` on each subsequent return value. If `err` is +not a `VError`, the cause is `null`. + +### `VError.info(err)` + +Returns an object with all of the extra error information that's been associated +with this Error and all of its causes. These are the properties passed in using +the `info` option to the constructor. Properties not specified in the +constructor for this Error are implicitly inherited from this error's cause. + +These properties are intended to provide programmatically-accessible metadata +about the error. For an error that indicates a failure to resolve a DNS name, +informational properties might include the DNS name to be resolved, or even the +list of resolvers used to resolve it. The values of these properties should +generally be plain objects (i.e., consisting only of null, undefined, numbers, +booleans, strings, and objects and arrays containing only other plain objects). + +### `VError.fullStack(err)` + +Returns a string containing the full stack trace, with all nested errors recursively +reported as `'caused by:' + err.stack`. + +### `VError.findCauseByName(err, name)` + +The `findCauseByName()` function traverses the cause chain for `err`, looking +for an error whose `name` property matches the passed in `name` value. If no +match is found, `null` is returned. + +If all you want is to know _whether_ there's a cause (and you don't care what it +is), you can use `VError.hasCauseWithName(err, name)`. + +If a vanilla error or a non-VError error is passed in, then there is no cause +chain to traverse. In this scenario, the function will check the `name` +property of only `err`. + +### `VError.hasCauseWithName(err, name)` + +Returns true if and only if `VError.findCauseByName(err, name)` would return +a non-null value. This essentially determines whether `err` has any cause in +its cause chain that has name `name`. + +### `VError.errorFromList(errors)` + +Given an array of Error objects (possibly empty), return a single error +representing the whole collection of errors. If the list has: + +* 0 elements, returns `null` +* 1 element, returns the sole error +* more than 1 element, returns a MultiError referencing the whole list + +This is useful for cases where an operation may produce any number of errors, +and you ultimately want to implement the usual `callback(err)` pattern. You can +accumulate the errors in an array and then invoke +`callback(VError.errorFromList(errors))` when the operation is complete. + + +### `VError.errorForEach(err, func)` + +Convenience function for iterating an error that may itself be a MultiError. + +In all cases, `err` must be an Error. If `err` is a MultiError, then `func` is +invoked as `func(errorN)` for each of the underlying errors of the MultiError. +If `err` is any other kind of error, `func` is invoked once as `func(err)`. In +all cases, `func` is invoked synchronously. + +This is useful for cases where an operation may produce any number of warnings +that may be encapsulated with a MultiError -- but may not be. + +This function does not iterate an error's cause chain. + + +## Examples + +The "Demo" section above covers several basic cases. Here's a more advanced +case: + +```javascript +var err1 = new VError('something bad happened'); +/* ... */ +var err2 = new VError({ + 'name': 'ConnectionError', + 'cause': err1, + 'info': { + 'errno': 'ECONNREFUSED', + 'remote_ip': '127.0.0.1', + 'port': 215 + } +}, 'failed to connect to "%s:%d"', '127.0.0.1', 215); + +console.log(err2.message); +console.log(err2.name); +console.log(VError.info(err2)); +console.log(err2.stack); +``` + +This outputs: + + failed to connect to "127.0.0.1:215": something bad happened + ConnectionError + { errno: 'ECONNREFUSED', remote_ip: '127.0.0.1', port: 215 } + ConnectionError: failed to connect to "127.0.0.1:215": something bad happened + at Object. (/home/dap/node-verror/examples/info.js:5:12) + at Module._compile (module.js:456:26) + at Object.Module._extensions..js (module.js:474:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + at Function.Module.runMain (module.js:497:10) + at startup (node.js:119:16) + at node.js:935:3 + +Information properties are inherited up the cause chain, with values at the top +of the chain overriding same-named values lower in the chain. To continue that +example: + +```javascript +var err3 = new VError({ + 'name': 'RequestError', + 'cause': err2, + 'info': { + 'errno': 'EBADREQUEST' + } +}, 'request failed'); + +console.log(err3.message); +console.log(err3.name); +console.log(VError.info(err3)); +console.log(err3.stack); +``` + +This outputs: + + request failed: failed to connect to "127.0.0.1:215": something bad happened + RequestError + { errno: 'EBADREQUEST', remote_ip: '127.0.0.1', port: 215 } + RequestError: request failed: failed to connect to "127.0.0.1:215": something bad happened + at Object. (/home/dap/node-verror/examples/info.js:20:12) + at Module._compile (module.js:456:26) + at Object.Module._extensions..js (module.js:474:10) + at Module.load (module.js:356:32) + at Function.Module._load (module.js:312:12) + at Function.Module.runMain (module.js:497:10) + at startup (node.js:119:16) + at node.js:935:3 + +You can also print the complete stack trace of combined `Error`s by using +`VError.fullStack(err).` + +```javascript +var err1 = new VError('something bad happened'); +/* ... */ +var err2 = new VError(err1, 'something really bad happened here'); + +console.log(VError.fullStack(err2)); +``` + +This outputs: + + VError: something really bad happened here: something bad happened + at Object. (/home/dap/node-verror/examples/fullStack.js:5:12) + at Module._compile (module.js:409:26) + at Object.Module._extensions..js (module.js:416:10) + at Module.load (module.js:343:32) + at Function.Module._load (module.js:300:12) + at Function.Module.runMain (module.js:441:10) + at startup (node.js:139:18) + at node.js:968:3 + caused by: VError: something bad happened + at Object. (/home/dap/node-verror/examples/fullStack.js:3:12) + at Module._compile (module.js:409:26) + at Object.Module._extensions..js (module.js:416:10) + at Module.load (module.js:343:32) + at Function.Module._load (module.js:300:12) + at Function.Module.runMain (module.js:441:10) + at startup (node.js:139:18) + at node.js:968:3 + +`VError.fullStack` is also safe to use on regular `Error`s, so feel free to use +it whenever you need to extract the stack trace from an `Error`, regardless if +it's a `VError` or not. + +# Reference: MultiError + +MultiError is an Error class that represents a group of Errors. This is used +when you logically need to provide a single Error, but you want to preserve +information about multiple underying Errors. A common case is when you execute +several operations in parallel and some of them fail. + +MultiErrors are constructed as: + +```javascript +new MultiError(error_list) +``` + +`error_list` is an array of at least one `Error` object. + +The cause of the MultiError is the first error provided. None of the other +`VError` options are supported. The `message` for a MultiError consists the +`message` from the first error, prepended with a message indicating that there +were other errors. + +For example: + +```javascript +err = new MultiError([ + new Error('failed to resolve DNS name "abc.example.com"'), + new Error('failed to resolve DNS name "def.example.com"'), +]); + +console.error(err.message); +``` + +outputs: + + first of 2 errors: failed to resolve DNS name "abc.example.com" + +See the convenience function `VError.errorFromList`, which is sometimes simpler +to use than this constructor. + +## Public methods + + +### `errors()` + +Returns an array of the errors used to construct this MultiError. + + +# Contributing + +See separate [contribution guidelines](CONTRIBUTING.md). diff --git a/appasar/canary/node_modules/verror/lib/verror.js b/appasar/canary/node_modules/verror/lib/verror.js new file mode 100644 index 0000000..8663dde --- /dev/null +++ b/appasar/canary/node_modules/verror/lib/verror.js @@ -0,0 +1,451 @@ +/* + * verror.js: richer JavaScript errors + */ + +var mod_assertplus = require('assert-plus'); +var mod_util = require('util'); + +var mod_extsprintf = require('extsprintf'); +var mod_isError = require('core-util-is').isError; +var sprintf = mod_extsprintf.sprintf; + +/* + * Public interface + */ + +/* So you can 'var VError = require('verror')' */ +module.exports = VError; +/* For compatibility */ +VError.VError = VError; +/* Other exported classes */ +VError.SError = SError; +VError.WError = WError; +VError.MultiError = MultiError; + +/* + * Common function used to parse constructor arguments for VError, WError, and + * SError. Named arguments to this function: + * + * strict force strict interpretation of sprintf arguments, even + * if the options in "argv" don't say so + * + * argv error's constructor arguments, which are to be + * interpreted as described in README.md. For quick + * reference, "argv" has one of the following forms: + * + * [ sprintf_args... ] (argv[0] is a string) + * [ cause, sprintf_args... ] (argv[0] is an Error) + * [ options, sprintf_args... ] (argv[0] is an object) + * + * This function normalizes these forms, producing an object with the following + * properties: + * + * options equivalent to "options" in third form. This will never + * be a direct reference to what the caller passed in + * (i.e., it may be a shallow copy), so it can be freely + * modified. + * + * shortmessage result of sprintf(sprintf_args), taking options.strict + * into account as described in README.md. + */ +function parseConstructorArguments(args) +{ + var argv, options, sprintf_args, shortmessage, k; + + mod_assertplus.object(args, 'args'); + mod_assertplus.bool(args.strict, 'args.strict'); + mod_assertplus.array(args.argv, 'args.argv'); + argv = args.argv; + + /* + * First, figure out which form of invocation we've been given. + */ + if (argv.length === 0) { + options = {}; + sprintf_args = []; + } else if (mod_isError(argv[0])) { + options = { 'cause': argv[0] }; + sprintf_args = argv.slice(1); + } else if (typeof (argv[0]) === 'object') { + options = {}; + for (k in argv[0]) { + options[k] = argv[0][k]; + } + sprintf_args = argv.slice(1); + } else { + mod_assertplus.string(argv[0], + 'first argument to VError, SError, or WError ' + + 'constructor must be a string, object, or Error'); + options = {}; + sprintf_args = argv; + } + + /* + * Now construct the error's message. + * + * extsprintf (which we invoke here with our caller's arguments in order + * to construct this Error's message) is strict in its interpretation of + * values to be processed by the "%s" specifier. The value passed to + * extsprintf must actually be a string or something convertible to a + * String using .toString(). Passing other values (notably "null" and + * "undefined") is considered a programmer error. The assumption is + * that if you actually want to print the string "null" or "undefined", + * then that's easy to do that when you're calling extsprintf; on the + * other hand, if you did NOT want that (i.e., there's actually a bug + * where the program assumes some variable is non-null and tries to + * print it, which might happen when constructing a packet or file in + * some specific format), then it's better to stop immediately than + * produce bogus output. + * + * However, sometimes the bug is only in the code calling VError, and a + * programmer might prefer to have the error message contain "null" or + * "undefined" rather than have the bug in the error path crash the + * program (making the first bug harder to identify). For that reason, + * by default VError converts "null" or "undefined" arguments to their + * string representations and passes those to extsprintf. Programmers + * desiring the strict behavior can use the SError class or pass the + * "strict" option to the VError constructor. + */ + mod_assertplus.object(options); + if (!options.strict && !args.strict) { + sprintf_args = sprintf_args.map(function (a) { + return (a === null ? 'null' : + a === undefined ? 'undefined' : a); + }); + } + + if (sprintf_args.length === 0) { + shortmessage = ''; + } else { + shortmessage = sprintf.apply(null, sprintf_args); + } + + return ({ + 'options': options, + 'shortmessage': shortmessage + }); +} + +/* + * See README.md for reference documentation. + */ +function VError() +{ + var args, obj, parsed, cause, ctor, message, k; + + args = Array.prototype.slice.call(arguments, 0); + + /* + * This is a regrettable pattern, but JavaScript's built-in Error class + * is defined to work this way, so we allow the constructor to be called + * without "new". + */ + if (!(this instanceof VError)) { + obj = Object.create(VError.prototype); + VError.apply(obj, arguments); + return (obj); + } + + /* + * For convenience and backwards compatibility, we support several + * different calling forms. Normalize them here. + */ + parsed = parseConstructorArguments({ + 'argv': args, + 'strict': false + }); + + /* + * If we've been given a name, apply it now. + */ + if (parsed.options.name) { + mod_assertplus.string(parsed.options.name, + 'error\'s "name" must be a string'); + this.name = parsed.options.name; + } + + /* + * For debugging, we keep track of the original short message (attached + * this Error particularly) separately from the complete message (which + * includes the messages of our cause chain). + */ + this.jse_shortmsg = parsed.shortmessage; + message = parsed.shortmessage; + + /* + * If we've been given a cause, record a reference to it and update our + * message appropriately. + */ + cause = parsed.options.cause; + if (cause) { + mod_assertplus.ok(mod_isError(cause), 'cause is not an Error'); + this.jse_cause = cause; + + if (!parsed.options.skipCauseMessage) { + message += ': ' + cause.message; + } + } + + /* + * If we've been given an object with properties, shallow-copy that + * here. We don't want to use a deep copy in case there are non-plain + * objects here, but we don't want to use the original object in case + * the caller modifies it later. + */ + this.jse_info = {}; + if (parsed.options.info) { + for (k in parsed.options.info) { + this.jse_info[k] = parsed.options.info[k]; + } + } + + this.message = message; + Error.call(this, message); + + if (Error.captureStackTrace) { + ctor = parsed.options.constructorOpt || this.constructor; + Error.captureStackTrace(this, ctor); + } + + return (this); +} + +mod_util.inherits(VError, Error); +VError.prototype.name = 'VError'; + +VError.prototype.toString = function ve_toString() +{ + var str = (this.hasOwnProperty('name') && this.name || + this.constructor.name || this.constructor.prototype.name); + if (this.message) + str += ': ' + this.message; + + return (str); +}; + +/* + * This method is provided for compatibility. New callers should use + * VError.cause() instead. That method also uses the saner `null` return value + * when there is no cause. + */ +VError.prototype.cause = function ve_cause() +{ + var cause = VError.cause(this); + return (cause === null ? undefined : cause); +}; + +/* + * Static methods + * + * These class-level methods are provided so that callers can use them on + * instances of Errors that are not VErrors. New interfaces should be provided + * only using static methods to eliminate the class of programming mistake where + * people fail to check whether the Error object has the corresponding methods. + */ + +VError.cause = function (err) +{ + mod_assertplus.ok(mod_isError(err), 'err must be an Error'); + return (mod_isError(err.jse_cause) ? err.jse_cause : null); +}; + +VError.info = function (err) +{ + var rv, cause, k; + + mod_assertplus.ok(mod_isError(err), 'err must be an Error'); + cause = VError.cause(err); + if (cause !== null) { + rv = VError.info(cause); + } else { + rv = {}; + } + + if (typeof (err.jse_info) == 'object' && err.jse_info !== null) { + for (k in err.jse_info) { + rv[k] = err.jse_info[k]; + } + } + + return (rv); +}; + +VError.findCauseByName = function (err, name) +{ + var cause; + + mod_assertplus.ok(mod_isError(err), 'err must be an Error'); + mod_assertplus.string(name, 'name'); + mod_assertplus.ok(name.length > 0, 'name cannot be empty'); + + for (cause = err; cause !== null; cause = VError.cause(cause)) { + mod_assertplus.ok(mod_isError(cause)); + if (cause.name == name) { + return (cause); + } + } + + return (null); +}; + +VError.hasCauseWithName = function (err, name) +{ + return (VError.findCauseByName(err, name) !== null); +}; + +VError.fullStack = function (err) +{ + mod_assertplus.ok(mod_isError(err), 'err must be an Error'); + + var cause = VError.cause(err); + + if (cause) { + return (err.stack + '\ncaused by: ' + VError.fullStack(cause)); + } + + return (err.stack); +}; + +VError.errorFromList = function (errors) +{ + mod_assertplus.arrayOfObject(errors, 'errors'); + + if (errors.length === 0) { + return (null); + } + + errors.forEach(function (e) { + mod_assertplus.ok(mod_isError(e)); + }); + + if (errors.length == 1) { + return (errors[0]); + } + + return (new MultiError(errors)); +}; + +VError.errorForEach = function (err, func) +{ + mod_assertplus.ok(mod_isError(err), 'err must be an Error'); + mod_assertplus.func(func, 'func'); + + if (err instanceof MultiError) { + err.errors().forEach(function iterError(e) { func(e); }); + } else { + func(err); + } +}; + + +/* + * SError is like VError, but stricter about types. You cannot pass "null" or + * "undefined" as string arguments to the formatter. + */ +function SError() +{ + var args, obj, parsed, options; + + args = Array.prototype.slice.call(arguments, 0); + if (!(this instanceof SError)) { + obj = Object.create(SError.prototype); + SError.apply(obj, arguments); + return (obj); + } + + parsed = parseConstructorArguments({ + 'argv': args, + 'strict': true + }); + + options = parsed.options; + VError.call(this, options, '%s', parsed.shortmessage); + + return (this); +} + +/* + * We don't bother setting SError.prototype.name because once constructed, + * SErrors are just like VErrors. + */ +mod_util.inherits(SError, VError); + + +/* + * Represents a collection of errors for the purpose of consumers that generally + * only deal with one error. Callers can extract the individual errors + * contained in this object, but may also just treat it as a normal single + * error, in which case a summary message will be printed. + */ +function MultiError(errors) +{ + mod_assertplus.array(errors, 'list of errors'); + mod_assertplus.ok(errors.length > 0, 'must be at least one error'); + this.ase_errors = errors; + + VError.call(this, { + 'cause': errors[0] + }, 'first of %d error%s', errors.length, errors.length == 1 ? '' : 's'); +} + +mod_util.inherits(MultiError, VError); +MultiError.prototype.name = 'MultiError'; + +MultiError.prototype.errors = function me_errors() +{ + return (this.ase_errors.slice(0)); +}; + + +/* + * See README.md for reference details. + */ +function WError() +{ + var args, obj, parsed, options; + + args = Array.prototype.slice.call(arguments, 0); + if (!(this instanceof WError)) { + obj = Object.create(WError.prototype); + WError.apply(obj, args); + return (obj); + } + + parsed = parseConstructorArguments({ + 'argv': args, + 'strict': false + }); + + options = parsed.options; + options['skipCauseMessage'] = true; + VError.call(this, options, '%s', parsed.shortmessage); + + return (this); +} + +mod_util.inherits(WError, VError); +WError.prototype.name = 'WError'; + +WError.prototype.toString = function we_toString() +{ + var str = (this.hasOwnProperty('name') && this.name || + this.constructor.name || this.constructor.prototype.name); + if (this.message) + str += ': ' + this.message; + if (this.jse_cause && this.jse_cause.message) + str += '; caused by ' + this.jse_cause.toString(); + + return (str); +}; + +/* + * For purely historical reasons, WError's cause() function allows you to set + * the cause. + */ +WError.prototype.cause = function we_cause(c) +{ + if (mod_isError(c)) + this.jse_cause = c; + + return (this.jse_cause); +}; diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/.gitmodules b/appasar/canary/node_modules/verror/node_modules/extsprintf/.gitmodules new file mode 100644 index 0000000..401f01a --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/catest"] + path = deps/catest + url = https://github.com/joyent/catest diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/.npmignore b/appasar/canary/node_modules/verror/node_modules/extsprintf/.npmignore new file mode 100644 index 0000000..6ed1ae9 --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/.npmignore @@ -0,0 +1,2 @@ +/deps +/examples diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/CHANGES.md b/appasar/canary/node_modules/verror/node_modules/extsprintf/CHANGES.md new file mode 100644 index 0000000..91c057e --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/CHANGES.md @@ -0,0 +1,10 @@ +# Changelog + +## Not yet released + +None yet. + +## v1.4.0 + +* #13 could provide better error messages for programmer errors +* #14 bring extsprintf into the modern world diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/CONTRIBUTING.md b/appasar/canary/node_modules/verror/node_modules/extsprintf/CONTRIBUTING.md new file mode 100644 index 0000000..0ec903f --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/CONTRIBUTING.md @@ -0,0 +1,20 @@ +# Contributing + +This repository uses [cr.joyent.us](https://cr.joyent.us) (Gerrit) for new +changes. Anyone can submit changes. To get started, see the [cr.joyent.us user +guide](https://github.com/joyent/joyent-gerrit/blob/master/docs/user/README.md). +This repo does not use GitHub pull requests. + +See the [Joyent Engineering +Guidelines](https://github.com/joyent/eng/blob/master/docs/index.md) for general +best practices expected in this repository. + +Contributions should be "make prepush" clean. This target requires separate +tools: + +* https://github.com/davepacheco/jsstyle +* https://github.com/davepacheco/javascriptlint +* https://github.com/joyent/catest + +If you're changing something non-trivial or user-facing, you may want to submit +an issue first. diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/LICENSE b/appasar/canary/node_modules/verror/node_modules/extsprintf/LICENSE new file mode 100644 index 0000000..cbc0bb3 --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012, Joyent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/Makefile b/appasar/canary/node_modules/verror/node_modules/extsprintf/Makefile new file mode 100644 index 0000000..6d96059 --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/Makefile @@ -0,0 +1,30 @@ +# +# Copyright (c) 2017, Joyent, Inc. All rights reserved. +# +# Makefile: top-level Makefile +# +# This Makefile contains only repo-specific logic and uses included makefiles +# to supply common targets (javascriptlint, jsstyle, restdown, etc.), which are +# used by other repos as well. +# + +# +# Files +# +CATEST = deps/catest/catest +JSL = jsl +JSSTYLE = jsstyle +JS_FILES := $(shell find examples lib -name '*.js') +JSL_FILES_NODE = $(JS_FILES) +JSSTYLE_FILES = $(JS_FILES) +JSL_CONF_NODE = jsl.node.conf + +# Default target is "check" +check: + +test: | $(CATEST) + $(CATEST) -a + +CATEST: deps/catest/.git + +include ./Makefile.targ diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/Makefile.targ b/appasar/canary/node_modules/verror/node_modules/extsprintf/Makefile.targ new file mode 100644 index 0000000..2a64fe7 --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/Makefile.targ @@ -0,0 +1,285 @@ +# -*- mode: makefile -*- +# +# Copyright (c) 2012, Joyent, Inc. All rights reserved. +# +# Makefile.targ: common targets. +# +# NOTE: This makefile comes from the "eng" repo. It's designed to be dropped +# into other repos as-is without requiring any modifications. If you find +# yourself changing this file, you should instead update the original copy in +# eng.git and then update your repo to use the new version. +# +# This Makefile defines several useful targets and rules. You can use it by +# including it from a Makefile that specifies some of the variables below. +# +# Targets defined in this Makefile: +# +# check Checks JavaScript files for lint and style +# Checks bash scripts for syntax +# Checks SMF manifests for validity against the SMF DTD +# +# clean Removes built files +# +# docs Builds restdown documentation in docs/ +# +# prepush Depends on "check" and "test" +# +# test Does nothing (you should override this) +# +# xref Generates cscope (source cross-reference index) +# +# For details on what these targets are supposed to do, see the Joyent +# Engineering Guide. +# +# To make use of these targets, you'll need to set some of these variables. Any +# variables left unset will simply not be used. +# +# BASH_FILES Bash scripts to check for syntax +# (paths relative to top-level Makefile) +# +# CLEAN_FILES Files to remove as part of the "clean" target. Note +# that files generated by targets in this Makefile are +# automatically included in CLEAN_FILES. These include +# restdown-generated HTML and JSON files. +# +# DOC_FILES Restdown (documentation source) files. These are +# assumed to be contained in "docs/", and must NOT +# contain the "docs/" prefix. +# +# JSL_CONF_NODE Specify JavaScriptLint configuration files +# JSL_CONF_WEB (paths relative to top-level Makefile) +# +# Node.js and Web configuration files are separate +# because you'll usually want different global variable +# configurations. If no file is specified, none is given +# to jsl, which causes it to use a default configuration, +# which probably isn't what you want. +# +# JSL_FILES_NODE JavaScript files to check with Node config file. +# JSL_FILES_WEB JavaScript files to check with Web config file. +# +# You can also override these variables: +# +# BASH Path to bash (default: bash) +# +# CSCOPE_DIRS Directories to search for source files for the cscope +# index. (default: ".") +# +# JSL Path to JavaScriptLint (default: "jsl") +# +# JSL_FLAGS_NODE Additional flags to pass through to JSL +# JSL_FLAGS_WEB +# JSL_FLAGS +# +# JSSTYLE Path to jsstyle (default: jsstyle) +# +# JSSTYLE_FLAGS Additional flags to pass through to jsstyle +# + +# +# Defaults for the various tools we use. +# +BASH ?= bash +BASHSTYLE ?= tools/bashstyle +CP ?= cp +CSCOPE ?= cscope +CSCOPE_DIRS ?= . +JSL ?= jsl +JSSTYLE ?= jsstyle +MKDIR ?= mkdir -p +MV ?= mv +RESTDOWN_FLAGS ?= +RMTREE ?= rm -rf +JSL_FLAGS ?= --nologo --nosummary + +ifeq ($(shell uname -s),SunOS) + TAR ?= gtar +else + TAR ?= tar +endif + + +# +# Defaults for other fixed values. +# +BUILD = build +DISTCLEAN_FILES += $(BUILD) +DOC_BUILD = $(BUILD)/docs/public + +# +# Configure JSL_FLAGS_{NODE,WEB} based on JSL_CONF_{NODE,WEB}. +# +ifneq ($(origin JSL_CONF_NODE), undefined) + JSL_FLAGS_NODE += --conf=$(JSL_CONF_NODE) +endif + +ifneq ($(origin JSL_CONF_WEB), undefined) + JSL_FLAGS_WEB += --conf=$(JSL_CONF_WEB) +endif + +# +# Targets. For descriptions on what these are supposed to do, see the +# Joyent Engineering Guide. +# + +# +# Instruct make to keep around temporary files. We have rules below that +# automatically update git submodules as needed, but they employ a deps/*/.git +# temporary file. Without this directive, make tries to remove these .git +# directories after the build has completed. +# +.SECONDARY: $($(wildcard deps/*):%=%/.git) + +# +# This rule enables other rules that use files from a git submodule to have +# those files depend on deps/module/.git and have "make" automatically check +# out the submodule as needed. +# +deps/%/.git: + git submodule update --init deps/$* + +# +# These recipes make heavy use of dynamically-created phony targets. The parent +# Makefile defines a list of input files like BASH_FILES. We then say that each +# of these files depends on a fake target called filename.bashchk, and then we +# define a pattern rule for those targets that runs bash in check-syntax-only +# mode. This mechanism has the nice properties that if you specify zero files, +# the rule becomes a noop (unlike a single rule to check all bash files, which +# would invoke bash with zero files), and you can check individual files from +# the command line with "make filename.bashchk". +# +.PHONY: check-bash +check-bash: $(BASH_FILES:%=%.bashchk) $(BASH_FILES:%=%.bashstyle) + +%.bashchk: % + $(BASH) -n $^ + +%.bashstyle: % + $(BASHSTYLE) $^ + +.PHONY: check-jsl check-jsl-node check-jsl-web +check-jsl: check-jsl-node check-jsl-web + +check-jsl-node: $(JSL_FILES_NODE:%=%.jslnodechk) + +check-jsl-web: $(JSL_FILES_WEB:%=%.jslwebchk) + +%.jslnodechk: % $(JSL_EXEC) + $(JSL) $(JSL_FLAGS) $(JSL_FLAGS_NODE) $< + +%.jslwebchk: % $(JSL_EXEC) + $(JSL) $(JSL_FLAGS) $(JSL_FLAGS_WEB) $< + +.PHONY: check-jsstyle +check-jsstyle: $(JSSTYLE_FILES:%=%.jsstylechk) + +%.jsstylechk: % $(JSSTYLE_EXEC) + $(JSSTYLE) $(JSSTYLE_FLAGS) $< + +.PHONY: check +check: check-jsl check-jsstyle check-bash + @echo check ok + +.PHONY: clean +clean:: + -$(RMTREE) $(CLEAN_FILES) + +.PHONY: distclean +distclean:: clean + -$(RMTREE) $(DISTCLEAN_FILES) + +CSCOPE_FILES = cscope.in.out cscope.out cscope.po.out +CLEAN_FILES += $(CSCOPE_FILES) + +.PHONY: xref +xref: cscope.files + $(CSCOPE) -bqR + +.PHONY: cscope.files +cscope.files: + find $(CSCOPE_DIRS) -name '*.c' -o -name '*.h' -o -name '*.cc' \ + -o -name '*.js' -o -name '*.s' -o -name '*.cpp' > $@ + +# +# The "docs" target is complicated because we do several things here: +# +# (1) Use restdown to build HTML and JSON files from each of DOC_FILES. +# +# (2) Copy these files into $(DOC_BUILD) (build/docs/public), which +# functions as a complete copy of the documentation that could be +# mirrored or served over HTTP. +# +# (3) Then copy any directories and media from docs/media into +# $(DOC_BUILD)/media. This allows projects to include their own media, +# including files that will override same-named files provided by +# restdown. +# +# Step (3) is the surprisingly complex part: in order to do this, we need to +# identify the subdirectories in docs/media, recreate them in +# $(DOC_BUILD)/media, then do the same with the files. +# +DOC_MEDIA_DIRS := $(shell find docs/media -type d 2>/dev/null | grep -v "^docs/media$$") +DOC_MEDIA_DIRS := $(DOC_MEDIA_DIRS:docs/media/%=%) +DOC_MEDIA_DIRS_BUILD := $(DOC_MEDIA_DIRS:%=$(DOC_BUILD)/media/%) + +DOC_MEDIA_FILES := $(shell find docs/media -type f 2>/dev/null) +DOC_MEDIA_FILES := $(DOC_MEDIA_FILES:docs/media/%=%) +DOC_MEDIA_FILES_BUILD := $(DOC_MEDIA_FILES:%=$(DOC_BUILD)/media/%) + +# +# Like the other targets, "docs" just depends on the final files we want to +# create in $(DOC_BUILD), leveraging other targets and recipes to define how +# to get there. +# +.PHONY: docs +docs: \ + $(DOC_FILES:%.restdown=$(DOC_BUILD)/%.html) \ + $(DOC_FILES:%.restdown=$(DOC_BUILD)/%.json) \ + $(DOC_MEDIA_FILES_BUILD) + +# +# We keep the intermediate files so that the next build can see whether the +# files in DOC_BUILD are up to date. +# +.PRECIOUS: \ + $(DOC_FILES:%.restdown=docs/%.html) \ + $(DOC_FILES:%.restdown=docs/%json) + +# +# We do clean those intermediate files, as well as all of DOC_BUILD. +# +CLEAN_FILES += \ + $(DOC_BUILD) \ + $(DOC_FILES:%.restdown=docs/%.html) \ + $(DOC_FILES:%.restdown=docs/%.json) + +# +# Before installing the files, we must make sure the directories exist. The | +# syntax tells make that the dependency need only exist, not be up to date. +# Otherwise, it might try to rebuild spuriously because the directory itself +# appears out of date. +# +$(DOC_MEDIA_FILES_BUILD): | $(DOC_MEDIA_DIRS_BUILD) + +$(DOC_BUILD)/%: docs/% | $(DOC_BUILD) + $(CP) $< $@ + +docs/%.json docs/%.html: docs/%.restdown | $(DOC_BUILD) $(RESTDOWN_EXEC) + $(RESTDOWN) $(RESTDOWN_FLAGS) -m $(DOC_BUILD) $< + +$(DOC_BUILD): + $(MKDIR) $@ + +$(DOC_MEDIA_DIRS_BUILD): + $(MKDIR) $@ + +# +# The default "test" target does nothing. This should usually be overridden by +# the parent Makefile. It's included here so we can define "prepush" without +# requiring the repo to define "test". +# +.PHONY: test +test: + +.PHONY: prepush +prepush: check test diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/README.md b/appasar/canary/node_modules/verror/node_modules/extsprintf/README.md new file mode 100644 index 0000000..b22998d --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/README.md @@ -0,0 +1,46 @@ +# extsprintf: extended POSIX-style sprintf + +Stripped down version of s[n]printf(3c). We make a best effort to throw an +exception when given a format string we don't understand, rather than ignoring +it, so that we won't break existing programs if/when we go implement the rest +of this. + +This implementation currently supports specifying + +* field alignment ('-' flag), +* zero-pad ('0' flag) +* always show numeric sign ('+' flag), +* field width +* conversions for strings, decimal integers, and floats (numbers). +* argument size specifiers. These are all accepted but ignored, since + Javascript has no notion of the physical size of an argument. + +Everything else is currently unsupported, most notably: precision, unsigned +numbers, non-decimal numbers, and characters. + +Besides the usual POSIX conversions, this implementation supports: + +* `%j`: pretty-print a JSON object (using node's "inspect") +* `%r`: pretty-print an Error object + +# Example + +First, install it: + + # npm install extsprintf + +Now, use it: + + var mod_extsprintf = require('extsprintf'); + console.log(mod_extsprintf.sprintf('hello %25s', 'world')); + +outputs: + + hello world + +# Also supported + +**printf**: same args as sprintf, but prints the result to stdout + +**fprintf**: same args as sprintf, preceded by a Node stream. Prints the result +to the given stream. diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/jsl.node.conf b/appasar/canary/node_modules/verror/node_modules/extsprintf/jsl.node.conf new file mode 100644 index 0000000..03f787f --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/jsl.node.conf @@ -0,0 +1,137 @@ +# +# Configuration File for JavaScript Lint +# +# This configuration file can be used to lint a collection of scripts, or to enable +# or disable warnings for scripts that are linted via the command line. +# + +### Warnings +# Enable or disable warnings based on requirements. +# Use "+WarningName" to display or "-WarningName" to suppress. +# ++ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent ++ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity ++ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement ++anon_no_return_value # anonymous function does not always return value ++assign_to_function_call # assignment to a function call +-block_without_braces # block statement without curly braces ++comma_separated_stmts # multiple statements separated by commas (use semicolons?) ++comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==) ++default_not_at_end # the default case is not at the end of the switch statement ++dup_option_explicit # duplicate "option explicit" control comment ++duplicate_case_in_switch # duplicate case in switch statement ++duplicate_formal # duplicate formal argument {name} ++empty_statement # empty statement or extra semicolon ++identifier_hides_another # identifer {name} hides an identifier in a parent scope +-inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement ++incorrect_version # Expected /*jsl:content-type*/ control comment. The script was parsed with the wrong version. ++invalid_fallthru # unexpected "fallthru" control comment ++invalid_pass # unexpected "pass" control comment ++jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax ++leading_decimal_point # leading decimal point may indicate a number or an object member ++legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax ++meaningless_block # meaningless block; curly braces have no impact ++mismatch_ctrl_comments # mismatched control comment; "ignore" and "end" control comments must have a one-to-one correspondence ++misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma ++missing_break # missing break statement ++missing_break_for_last_case # missing break statement for last case in switch ++missing_default_case # missing default case in switch statement ++missing_option_explicit # the "option explicit" control comment is missing ++missing_semicolon # missing semicolon ++missing_semicolon_for_lambda # missing semicolon for lambda assignment ++multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs ++nested_comment # nested comment ++no_return_value # function {name} does not always return a value ++octal_number # leading zeros make an octal number ++parseint_missing_radix # parseInt missing radix parameter ++partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag ++redeclared_var # redeclaration of {name} ++trailing_comma_in_array # extra comma is not recommended in array initializers ++trailing_decimal_point # trailing decimal point may indicate a number or an object member ++undeclared_identifier # undeclared identifier: {name} ++unreachable_code # unreachable code +-unreferenced_argument # argument declared but never referenced: {name} +-unreferenced_function # function is declared but never referenced: {name} ++unreferenced_variable # variable is declared but never referenced: {name} ++unsupported_version # JavaScript {version} is not supported ++use_of_label # use of label ++useless_assign # useless assignment ++useless_comparison # useless comparison; comparing identical expressions +-useless_quotes # the quotation marks are unnecessary ++useless_void # use of the void type may be unnecessary (void is always undefined) ++var_hides_arg # variable {name} hides argument ++want_assign_or_call # expected an assignment or function call ++with_statement # with statement hides undeclared variables; use temporary variable instead + + +### Output format +# Customize the format of the error message. +# __FILE__ indicates current file path +# __FILENAME__ indicates current file name +# __LINE__ indicates current line +# __COL__ indicates current column +# __ERROR__ indicates error message (__ERROR_PREFIX__: __ERROR_MSG__) +# __ERROR_NAME__ indicates error name (used in configuration file) +# __ERROR_PREFIX__ indicates error prefix +# __ERROR_MSG__ indicates error message +# +# For machine-friendly output, the output format can be prefixed with +# "encode:". If specified, all items will be encoded with C-slashes. +# +# Visual Studio syntax (default): ++output-format __FILE__(__LINE__): __ERROR__ +# Alternative syntax: +#+output-format __FILE__:__LINE__: __ERROR__ + + +### Context +# Show the in-line position of the error. +# Use "+context" to display or "-context" to suppress. +# ++context + + +### Control Comments +# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for +# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is +# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason, +# although legacy control comments are enabled by default for backward compatibility. +# +-legacy_control_comments + + +### Defining identifiers +# By default, "option explicit" is enabled on a per-file basis. +# To enable this for all files, use "+always_use_option_explicit" +-always_use_option_explicit + +# Define certain identifiers of which the lint is not aware. +# (Use this in conjunction with the "undeclared identifier" warning.) +# +# Common uses for webpages might be: ++define __dirname ++define clearInterval ++define clearTimeout ++define console ++define exports ++define global ++define process ++define require ++define setInterval ++define setTimeout ++define Buffer ++define JSON ++define Math + +### JavaScript Version +# To change the default JavaScript version: +#+default-type text/javascript;version=1.5 +#+default-type text/javascript;e4x=1 + +### Files +# Specify which files to lint +# Use "+recurse" to enable recursion (disabled by default). +# To add a set of files, use "+process FileName", "+process Folder\Path\*.js", +# or "+process Folder\Path\*.htm". +# + diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/lib/extsprintf.js b/appasar/canary/node_modules/verror/node_modules/extsprintf/lib/extsprintf.js new file mode 100644 index 0000000..d5d8ad9 --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/lib/extsprintf.js @@ -0,0 +1,225 @@ +/* + * extsprintf.js: extended POSIX-style sprintf + */ + +var mod_assert = require('assert'); +var mod_util = require('util'); + +/* + * Public interface + */ +exports.sprintf = jsSprintf; +exports.printf = jsPrintf; +exports.fprintf = jsFprintf; + +/* + * Stripped down version of s[n]printf(3c). We make a best effort to throw an + * exception when given a format string we don't understand, rather than + * ignoring it, so that we won't break existing programs if/when we go implement + * the rest of this. + * + * This implementation currently supports specifying + * - field alignment ('-' flag), + * - zero-pad ('0' flag) + * - always show numeric sign ('+' flag), + * - field width + * - conversions for strings, decimal integers, and floats (numbers). + * - argument size specifiers. These are all accepted but ignored, since + * Javascript has no notion of the physical size of an argument. + * + * Everything else is currently unsupported, most notably precision, unsigned + * numbers, non-decimal numbers, and characters. + */ +function jsSprintf(ofmt) +{ + var regex = [ + '([^%]*)', /* normal text */ + '%', /* start of format */ + '([\'\\-+ #0]*?)', /* flags (optional) */ + '([1-9]\\d*)?', /* width (optional) */ + '(\\.([1-9]\\d*))?', /* precision (optional) */ + '[lhjztL]*?', /* length mods (ignored) */ + '([diouxXfFeEgGaAcCsSp%jr])' /* conversion */ + ].join(''); + + var re = new RegExp(regex); + + /* variadic arguments used to fill in conversion specifiers */ + var args = Array.prototype.slice.call(arguments, 1); + /* remaining format string */ + var fmt = ofmt; + + /* components of the current conversion specifier */ + var flags, width, precision, conversion; + var left, pad, sign, arg, match; + + /* return value */ + var ret = ''; + + /* current variadic argument (1-based) */ + var argn = 1; + /* 0-based position in the format string that we've read */ + var posn = 0; + /* 1-based position in the format string of the current conversion */ + var convposn; + /* current conversion specifier */ + var curconv; + + mod_assert.equal('string', typeof (fmt), + 'first argument must be a format string'); + + while ((match = re.exec(fmt)) !== null) { + ret += match[1]; + fmt = fmt.substring(match[0].length); + + /* + * Update flags related to the current conversion specifier's + * position so that we can report clear error messages. + */ + curconv = match[0].substring(match[1].length); + convposn = posn + match[1].length + 1; + posn += match[0].length; + + flags = match[2] || ''; + width = match[3] || 0; + precision = match[4] || ''; + conversion = match[6]; + left = false; + sign = false; + pad = ' '; + + if (conversion == '%') { + ret += '%'; + continue; + } + + if (args.length === 0) { + throw (jsError(ofmt, convposn, curconv, + 'has no matching argument ' + + '(too few arguments passed)')); + } + + arg = args.shift(); + argn++; + + if (flags.match(/[\' #]/)) { + throw (jsError(ofmt, convposn, curconv, + 'uses unsupported flags')); + } + + if (precision.length > 0) { + throw (jsError(ofmt, convposn, curconv, + 'uses non-zero precision (not supported)')); + } + + if (flags.match(/-/)) + left = true; + + if (flags.match(/0/)) + pad = '0'; + + if (flags.match(/\+/)) + sign = true; + + switch (conversion) { + case 's': + if (arg === undefined || arg === null) { + throw (jsError(ofmt, convposn, curconv, + 'attempted to print undefined or null ' + + 'as a string (argument ' + argn + ' to ' + + 'sprintf)')); + } + ret += doPad(pad, width, left, arg.toString()); + break; + + case 'd': + arg = Math.floor(arg); + /*jsl:fallthru*/ + case 'f': + sign = sign && arg > 0 ? '+' : ''; + ret += sign + doPad(pad, width, left, + arg.toString()); + break; + + case 'x': + ret += doPad(pad, width, left, arg.toString(16)); + break; + + case 'j': /* non-standard */ + if (width === 0) + width = 10; + ret += mod_util.inspect(arg, false, width); + break; + + case 'r': /* non-standard */ + ret += dumpException(arg); + break; + + default: + throw (jsError(ofmt, convposn, curconv, + 'is not supported')); + } + } + + ret += fmt; + return (ret); +} + +function jsError(fmtstr, convposn, curconv, reason) { + mod_assert.equal(typeof (fmtstr), 'string'); + mod_assert.equal(typeof (curconv), 'string'); + mod_assert.equal(typeof (convposn), 'number'); + mod_assert.equal(typeof (reason), 'string'); + return (new Error('format string "' + fmtstr + + '": conversion specifier "' + curconv + '" at character ' + + convposn + ' ' + reason)); +} + +function jsPrintf() { + var args = Array.prototype.slice.call(arguments); + args.unshift(process.stdout); + jsFprintf.apply(null, args); +} + +function jsFprintf(stream) { + var args = Array.prototype.slice.call(arguments, 1); + return (stream.write(jsSprintf.apply(this, args))); +} + +function doPad(chr, width, left, str) +{ + var ret = str; + + while (ret.length < width) { + if (left) + ret += chr; + else + ret = chr + ret; + } + + return (ret); +} + +/* + * This function dumps long stack traces for exceptions having a cause() method. + * See node-verror for an example. + */ +function dumpException(ex) +{ + var ret; + + if (!(ex instanceof Error)) + throw (new Error(jsSprintf('invalid type for %%r: %j', ex))); + + /* Note that V8 prepends "ex.stack" with ex.toString(). */ + ret = 'EXCEPTION: ' + ex.constructor.name + ': ' + ex.stack; + + if (ex.cause && typeof (ex.cause) === 'function') { + var cex = ex.cause(); + if (cex) { + ret += '\nCaused by: ' + dumpException(cex); + } + } + + return (ret); +} diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/package.json b/appasar/canary/node_modules/verror/node_modules/extsprintf/package.json new file mode 100644 index 0000000..42669d2 --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/package.json @@ -0,0 +1,14 @@ +{ + "name": "extsprintf", + "version": "1.4.0", + "description": "extended POSIX-style sprintf", + "main": "./lib/extsprintf.js", + "repository": { + "type": "git", + "url": "git://github.com/davepacheco/node-extsprintf.git" + }, + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" +} diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/test/tst.basic.js b/appasar/canary/node_modules/verror/node_modules/extsprintf/test/tst.basic.js new file mode 100644 index 0000000..9e56fda --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/test/tst.basic.js @@ -0,0 +1,118 @@ +/* + * tst.basic.js: tests various valid invocation + */ + +var mod_assert = require('assert'); +var mod_extsprintf = require('../lib/extsprintf'); +var mod_path = require('path'); +var sprintf = mod_extsprintf.sprintf; + +var testcases = [ { + 'name': 'empty string', + 'args': [ '' ], + 'result': '' +}, { + 'name': '%s: basic', + 'args': [ '%s', 'foo' ], + 'result': 'foo' +}, { + 'name': '%s: not first', + 'args': [ 'hello %s\n', 'world' ], + 'result': 'hello world\n' +}, { + 'name': '%s: right-aligned', + 'args': [ 'hello %10s\n', 'world' ], + 'result': 'hello world\n' +}, { + 'name': '%s: left-aligned', + 'args': [ 'hello %-10sagain\n', 'world' ], + 'result': 'hello world again\n' +}, { + 'name': '%d: basic, positive', + 'args': [ '%d', 17 ], + 'result': '17' +}, { + 'name': '%d: basic, zero', + 'args': [ '%d', 0 ], + 'result': '0' +}, { + 'name': '%d: basic, floating point value', + 'args': [ '%d', 17.3 ], + 'result': '17' +}, { + 'name': '%d: basic, negative', + 'args': [ '%d', -3 ], + 'result': '-3' +}, { + 'name': '%d: right-aligned', + 'args': [ '%4d', 17 ], + 'result': ' 17' +}, { + 'name': '%d: right-aligned, zero-padded', + 'args': [ '%04d', 17 ], + 'result': '0017' +}, { + 'name': '%d: left-aligned', + 'args': [ '%-4d', 17 ], + 'result': '17 ' +}, { + 'name': '%x: basic', + 'args': [ '%x', 18], + 'result': '12' +}, { + 'name': '%x: zero-padded, right-aligned', + 'args': [ '%08x', 0xfeedface ], + 'result': 'feedface' +}, { + 'name': '%d: with plus sign', + 'args': [ '%+d', 17 ], + 'result': '+17' +}, { + 'name': '%f: basic', + 'args': [ '%f', 3.2 ], + 'result': '3.2' +}, { + 'name': '%f: right-aligned', + 'args': [ '%5f', 3.2 ], + 'result': ' 3.2' +}, { + 'name': '%%: basic', + 'args': [ '%%' ], + 'result': '%' +}, { + 'name': 'complex', + 'args': [ 'one %s %8s %-3d bytes past 0x%04x, which was %6f%%%s%5s', + 'program', 'wrote', -2, 0x30, 3.7, ' plus', 'over' ], + 'result': 'one program wrote -2 bytes past 0x0030, which was ' + + '3.7% plus over' +} ]; + +function main(verbose) { + /* + * Create one test case with a very large input string. + */ + var input = '1234'; + while (input.length < 100 * 1024) { + input += input; + } + testcases.push({ + 'name': 'long string argument (' + input.length + ' characters)', + 'args': [ '%s', input ], + 'result': input + }); + + testcases.forEach(function (tc) { + var result; + console.error('test case: %s', tc.name); + result = sprintf.apply(null, tc.args); + if (verbose) { + console.error(' args: %s', JSON.stringify(tc.args)); + console.error(' result: %s', result); + } + mod_assert.equal(tc.result, result); + }); + + console.log('%s tests passed', mod_path.basename(__filename)); +} + +main(process.argv.length > 2 && process.argv[2] == '-v'); diff --git a/appasar/canary/node_modules/verror/node_modules/extsprintf/test/tst.invalid.js b/appasar/canary/node_modules/verror/node_modules/extsprintf/test/tst.invalid.js new file mode 100644 index 0000000..1a7a560 --- /dev/null +++ b/appasar/canary/node_modules/verror/node_modules/extsprintf/test/tst.invalid.js @@ -0,0 +1,78 @@ +/* + * tst.invalid.js: tests invalid invocations + */ + +var mod_assert = require('assert'); +var mod_extsprintf = require('../lib/extsprintf'); +var mod_path = require('path'); +var sprintf = mod_extsprintf.sprintf; + +var testcases = [ { + 'name': 'missing all arguments', + 'args': [], + 'errmsg': /first argument must be a format string$/ +}, { + 'name': 'missing argument for format specifier (first char and specifier)', + 'args': [ '%s' ], + 'errmsg': new RegExp( + 'format string "%s": conversion specifier "%s" at character 1 ' + + 'has no matching argument \\(too few arguments passed\\)') +}, { + 'name': 'missing argument for format specifier (later in string)', + 'args': [ 'hello %s world %13d', 'big' ], + 'errmsg': new RegExp( + 'format string "hello %s world %13d": conversion specifier "%13d" at ' + + 'character 16 has no matching argument \\(too few arguments passed\\)') +}, { + 'name': 'printing null as string', + 'args': [ '%d cookies %3s', 15, null ], + 'errmsg': new RegExp( + 'format string "%d cookies %3s": conversion specifier "%3s" at ' + + 'character 12 attempted to print undefined or null as a string ' + + '\\(argument 3 to sprintf\\)') +}, { + 'name': 'printing undefined as string', + 'args': [ '%d cookies %3s ah %d', 15, undefined, 7 ], + 'errmsg': new RegExp( + 'format string "%d cookies %3s ah %d": conversion specifier "%3s" at ' + + 'character 12 attempted to print undefined or null as a string ' + + '\\(argument 3 to sprintf\\)') +}, { + 'name': 'unsupported format character', + 'args': [ 'do not use %X', 13 ], + 'errmsg': new RegExp( + 'format string "do not use %X": conversion ' + + 'specifier "%X" at character 12 is not supported$') +}, { + 'name': 'unsupported flags', + 'args': [ '%#x', 13 ], + 'errmsg': new RegExp( + 'format string "%#x": conversion ' + + 'specifier "%#x" at character 1 uses unsupported flags$') +} ]; + +function main(verbose) { + testcases.forEach(function (tc) { + var error; + console.error('test case: %s', tc.name); + if (verbose) { + console.error(' args: %s', JSON.stringify(tc.args)); + } + mod_assert.throws(function () { + try { + sprintf.apply(null, tc.args); + } catch (ex) { + error = ex; + throw (ex); + } + }, tc.errmsg); + + if (verbose && error) { + console.error(' error: %s', error.message); + } + }); + + console.log('%s tests passed', mod_path.basename(__filename)); +} + +main(process.argv.length > 2 && process.argv[2] == '-v'); diff --git a/appasar/canary/node_modules/verror/package.json b/appasar/canary/node_modules/verror/package.json new file mode 100644 index 0000000..79295c5 --- /dev/null +++ b/appasar/canary/node_modules/verror/package.json @@ -0,0 +1,22 @@ +{ + "name": "verror", + "version": "1.10.0", + "description": "richer JavaScript errors", + "main": "./lib/verror.js", + "repository": { + "type": "git", + "url": "git://github.com/davepacheco/node-verror.git" + }, + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "engines": [ + "node >=0.6.0" + ], + "scripts": { + "test": "make test" + }, + "license": "MIT" +} diff --git a/appasar/canary/node_modules/wrappy/LICENSE b/appasar/canary/node_modules/wrappy/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/appasar/canary/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/appasar/canary/node_modules/wrappy/README.md b/appasar/canary/node_modules/wrappy/README.md new file mode 100644 index 0000000..98eab25 --- /dev/null +++ b/appasar/canary/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/appasar/canary/node_modules/wrappy/package.json b/appasar/canary/node_modules/wrappy/package.json new file mode 100644 index 0000000..1307520 --- /dev/null +++ b/appasar/canary/node_modules/wrappy/package.json @@ -0,0 +1,29 @@ +{ + "name": "wrappy", + "version": "1.0.2", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "files": [ + "wrappy.js" + ], + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^2.3.1" + }, + "scripts": { + "test": "tap --coverage test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy" +} diff --git a/appasar/canary/node_modules/wrappy/wrappy.js b/appasar/canary/node_modules/wrappy/wrappy.js new file mode 100644 index 0000000..bb7e7d6 --- /dev/null +++ b/appasar/canary/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/appasar/canary/node_modules/yauzl/LICENSE b/appasar/canary/node_modules/yauzl/LICENSE new file mode 100644 index 0000000..37538d4 --- /dev/null +++ b/appasar/canary/node_modules/yauzl/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Josh Wolfe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/appasar/canary/node_modules/yauzl/README.md b/appasar/canary/node_modules/yauzl/README.md new file mode 100644 index 0000000..137fcde --- /dev/null +++ b/appasar/canary/node_modules/yauzl/README.md @@ -0,0 +1,633 @@ +# yauzl + +[![Build Status](https://travis-ci.org/thejoshwolfe/yauzl.svg?branch=master)](https://travis-ci.org/thejoshwolfe/yauzl) +[![Coverage Status](https://img.shields.io/coveralls/thejoshwolfe/yauzl.svg)](https://coveralls.io/r/thejoshwolfe/yauzl) + +yet another unzip library for node. For zipping, see +[yazl](https://github.com/thejoshwolfe/yazl). + +Design principles: + + * Follow the spec. + Don't scan for local file headers. + Read the central directory for file metadata. + (see [No Streaming Unzip API](#no-streaming-unzip-api)). + * Don't block the JavaScript thread. + Use and provide async APIs. + * Keep memory usage under control. + Don't attempt to buffer entire files in RAM at once. + * Never crash (if used properly). + Don't let malformed zip files bring down client applications who are trying to catch errors. + * Catch unsafe file names. + See `validateFileName()`. + +## Usage + +```js +var yauzl = require("yauzl"); + +yauzl.open("path/to/file.zip", {lazyEntries: true}, function(err, zipfile) { + if (err) throw err; + zipfile.readEntry(); + zipfile.on("entry", function(entry) { + if (/\/$/.test(entry.fileName)) { + // Directory file names end with '/'. + // Note that entires for directories themselves are optional. + // An entry's fileName implicitly requires its parent directories to exist. + zipfile.readEntry(); + } else { + // file entry + zipfile.openReadStream(entry, function(err, readStream) { + if (err) throw err; + readStream.on("end", function() { + zipfile.readEntry(); + }); + readStream.pipe(somewhere); + }); + } + }); +}); +``` + +See also `examples/` for more usage examples. + +## API + +The default for every optional `callback` parameter is: + +```js +function defaultCallback(err) { + if (err) throw err; +} +``` + +### open(path, [options], [callback]) + +Calls `fs.open(path, "r")` and reads the `fd` effectively the same as `fromFd()` would. + +`options` may be omitted or `null`. The defaults are `{autoClose: true, lazyEntries: false, decodeStrings: true, validateEntrySizes: true}`. + +`autoClose` is effectively equivalent to: + +```js +zipfile.once("end", function() { + zipfile.close(); +}); +``` + +`lazyEntries` indicates that entries should be read only when `readEntry()` is called. +If `lazyEntries` is `false`, `entry` events will be emitted as fast as possible to allow `pipe()`ing +file data from all entries in parallel. +This is not recommended, as it can lead to out of control memory usage for zip files with many entries. +See [issue #22](https://github.com/thejoshwolfe/yauzl/issues/22). +If `lazyEntries` is `true`, an `entry` or `end` event will be emitted in response to each call to `readEntry()`. +This allows processing of one entry at a time, and will keep memory usage under control for zip files with many entries. + +`decodeStrings` is the default and causes yauzl to decode strings with `CP437` or `UTF-8` as required by the spec. +The exact effects of turning this option off are: + +* `zipfile.comment`, `entry.fileName`, and `entry.fileComment` will be `Buffer` objects instead of `String`s. +* Any Info-ZIP Unicode Path Extra Field will be ignored. See `extraFields`. +* Automatic file name validation will not be performed. See `validateFileName()`. + +`validateEntrySizes` is the default and ensures that an entry's reported uncompressed size matches its actual uncompressed size. +This check happens as early as possible, which is either before emitting each `"entry"` event (for entries with no compression), +or during the `readStream` piping after calling `openReadStream()`. +See `openReadStream()` for more information on defending against zip bomb attacks. + +The `callback` is given the arguments `(err, zipfile)`. +An `err` is provided if the End of Central Directory Record cannot be found, or if its metadata appears malformed. +This kind of error usually indicates that this is not a zip file. +Otherwise, `zipfile` is an instance of `ZipFile`. + +### fromFd(fd, [options], [callback]) + +Reads from the fd, which is presumed to be an open .zip file. +Note that random access is required by the zip file specification, +so the fd cannot be an open socket or any other fd that does not support random access. + +`options` may be omitted or `null`. The defaults are `{autoClose: false, lazyEntries: false, decodeStrings: true, validateEntrySizes: true}`. + +See `open()` for the meaning of the options and callback. + +### fromBuffer(buffer, [options], [callback]) + +Like `fromFd()`, but reads from a RAM buffer instead of an open file. +`buffer` is a `Buffer`. + +If a `ZipFile` is acquired from this method, +it will never emit the `close` event, +and calling `close()` is not necessary. + +`options` may be omitted or `null`. The defaults are `{lazyEntries: false, decodeStrings: true, validateEntrySizes: true}`. + +See `open()` for the meaning of the options and callback. +The `autoClose` option is ignored for this method. + +### fromRandomAccessReader(reader, totalSize, [options], [callback]) + +This method of reading a zip file allows clients to implement their own back-end file system. +For example, a client might translate read calls into network requests. + +The `reader` parameter must be of a type that is a subclass of +[RandomAccessReader](#class-randomaccessreader) that implements the required methods. +The `totalSize` is a Number and indicates the total file size of the zip file. + +`options` may be omitted or `null`. The defaults are `{autoClose: true, lazyEntries: false, decodeStrings: true, validateEntrySizes: true}`. + +See `open()` for the meaning of the options and callback. + +### dosDateTimeToDate(date, time) + +Converts MS-DOS `date` and `time` data into a JavaScript `Date` object. +Each parameter is a `Number` treated as an unsigned 16-bit integer. +Note that this format does not support timezones, +so the returned object will use the local timezone. + +### validateFileName(fileName) + +Returns `null` or a `String` error message depending on the validity of `fileName`. +If `fileName` starts with `"/"` or `/[A-Za-z]:\//` or if it contains `".."` path segments or `"\\"`, +this function returns an error message appropriate for use like this: + +```js +var errorMessage = yauzl.validateFileName(fileName); +if (errorMessage != null) throw new Error(errorMessage); +``` + +This function is automatically run for each entry, as long as `decodeStrings` is `true`. +See `open()` and `Event: "entry"` for more information. + +### Class: ZipFile + +The constructor for the class is not part of the public API. +Use `open()`, `fromFd()`, `fromBuffer()`, or `fromRandomAccessReader()` instead. + +#### Event: "entry" + +Callback gets `(entry)`, which is an `Entry`. +See `open()` and `readEntry()` for when this event is emitted. + +If `decodeStrings` is `true`, entries emitted via this event have already passed file name validation. +See `validateFileName()` and `open()` for more information. + +If `validateEntrySizes` is `true` and this entry's `compressionMethod` is `0` (stored without compression), +this entry has already passed entry size validation. +See `open()` for more information. + +#### Event: "end" + +Emitted after the last `entry` event has been emitted. +See `open()` and `readEntry()` for more info on when this event is emitted. + +#### Event: "close" + +Emitted after the fd is actually closed. +This is after calling `close()` (or after the `end` event when `autoClose` is `true`), +and after all stream pipelines created from `openReadStream()` have finished reading data from the fd. + +If this `ZipFile` was acquired from `fromRandomAccessReader()`, +the "fd" in the previous paragraph refers to the `RandomAccessReader` implemented by the client. + +If this `ZipFile` was acquired from `fromBuffer()`, this event is never emitted. + +#### Event: "error" + +Emitted in the case of errors with reading the zip file. +(Note that other errors can be emitted from the streams created from `openReadStream()` as well.) +After this event has been emitted, no further `entry`, `end`, or `error` events will be emitted, +but the `close` event may still be emitted. + +#### readEntry() + +Causes this `ZipFile` to emit an `entry` or `end` event (or an `error` event). +This method must only be called when this `ZipFile` was created with the `lazyEntries` option set to `true` (see `open()`). +When this `ZipFile` was created with the `lazyEntries` option set to `true`, +`entry` and `end` events are only ever emitted in response to this method call. + +The event that is emitted in response to this method will not be emitted until after this method has returned, +so it is safe to call this method before attaching event listeners. + +After calling this method, calling this method again before the response event has been emitted will cause undefined behavior. +Calling this method after the `end` event has been emitted will cause undefined behavior. +Calling this method after calling `close()` will cause undefined behavior. + +#### openReadStream(entry, [options], callback) + +`entry` must be an `Entry` object from this `ZipFile`. +`callback` gets `(err, readStream)`, where `readStream` is a `Readable Stream` that provides the file data for this entry. +If this zipfile is already closed (see `close()`), the `callback` will receive an `err`. + +`options` may be omitted or `null`, and has the following defaults: + +```js +{ + decompress: entry.isCompressed() ? true : null, + decrypt: null, + start: 0, // actually the default is null, see below + end: entry.compressedSize, // actually the default is null, see below +} +``` + +If the entry is compressed (with a supported compression method), +and the `decompress` option is `true` (or omitted), +the read stream provides the decompressed data. +Omitting the `decompress` option is what most clients should do. + +The `decompress` option must be `null` (or omitted) when the entry is not compressed (see `isCompressed()`), +and either `true` (or omitted) or `false` when the entry is compressed. +Specifying `decompress: false` for a compressed entry causes the read stream +to provide the raw compressed file data without going through a zlib inflate transform. + +If the entry is encrypted (see `isEncrypted()`), clients may want to avoid calling `openReadStream()` on the entry entirely. +Alternatively, clients may call `openReadStream()` for encrypted entries and specify `decrypt: false`. +If the entry is also compressed, clients must *also* specify `decompress: false`. +Specifying `decrypt: false` for an encrypted entry causes the read stream to provide the raw, still-encrypted file data. +(This data includes the 12-byte header described in the spec.) + +The `decrypt` option must be `null` (or omitted) for non-encrypted entries, and `false` for encrypted entries. +Omitting the `decrypt` option (or specifying it as `null`) for an encrypted entry +will result in the `callback` receiving an `err`. +This default behavior is so that clients not accounting for encrypted files aren't surprised by bogus file data. + +The `start` (inclusive) and `end` (exclusive) options are byte offsets into this entry's file data, +and can be used to obtain part of an entry's file data rather than the whole thing. +If either of these options are specified and non-`null`, +then the above options must be used to obain the file's raw data. +Speficying `{start: 0, end: entry.compressedSize}` will result in the complete file, +which is effectively the default values for these options, +but note that unlike omitting the options, when you specify `start` or `end` as any non-`null` value, +the above requirement is still enforced that you must also pass the appropriate options to get the file's raw data. + +It's possible for the `readStream` provided to the `callback` to emit errors for several reasons. +For example, if zlib cannot decompress the data, the zlib error will be emitted from the `readStream`. +Two more error cases (when `validateEntrySizes` is `true`) are if the decompressed data has too many +or too few actual bytes compared to the reported byte count from the entry's `uncompressedSize` field. +yauzl notices this false information and emits an error from the `readStream` +after some number of bytes have already been piped through the stream. + +This check allows clients to trust the `uncompressedSize` field in `Entry` objects. +Guarding against [zip bomb](http://en.wikipedia.org/wiki/Zip_bomb) attacks can be accomplished by +doing some heuristic checks on the size metadata and then watching out for the above errors. +Such heuristics are outside the scope of this library, +but enforcing the `uncompressedSize` is implemented here as a security feature. + +It is possible to destroy the `readStream` before it has piped all of its data. +To do this, call `readStream.destroy()`. +You must `unpipe()` the `readStream` from any destination before calling `readStream.destroy()`. +If this zipfile was created using `fromRandomAccessReader()`, the `RandomAccessReader` implementation +must provide readable streams that implement a `.destroy()` method (see `randomAccessReader._readStreamForRange()`) +in order for calls to `readStream.destroy()` to work in this context. + +#### close() + +Causes all future calls to `openReadStream()` to fail, +and closes the fd after all streams created by `openReadStream()` have emitted their `end` events. + +If the `autoClose` option is set to `true` (see `open()`), +this function will be called automatically effectively in response to this object's `end` event. + +If the `lazyEntries` option is set to `false` (see `open()`) and this object's `end` event has not been emitted yet, +this function causes undefined behavior. +If the `lazyEntries` option is set to `true`, +you can call this function instead of calling `readEntry()` to abort reading the entries of a zipfile. + +It is safe to call this function multiple times; after the first call, successive calls have no effect. +This includes situations where the `autoClose` option effectively calls this function for you. + +#### isOpen + +`Boolean`. `true` until `close()` is called; then it's `false`. + +#### entryCount + +`Number`. Total number of central directory records. + +#### comment + +`String`. Always decoded with `CP437` per the spec. + +If `decodeStrings` is `false` (see `open()`), this field is the undecoded `Buffer` instead of a decoded `String`. + +### Class: Entry + +Objects of this class represent Central Directory Records. +Refer to the zipfile specification for more details about these fields. + +These fields are of type `Number`: + + * `versionMadeBy` + * `versionNeededToExtract` + * `generalPurposeBitFlag` + * `compressionMethod` + * `lastModFileTime` (MS-DOS format, see `getLastModDateTime`) + * `lastModFileDate` (MS-DOS format, see `getLastModDateTime`) + * `crc32` + * `compressedSize` + * `uncompressedSize` + * `fileNameLength` (bytes) + * `extraFieldLength` (bytes) + * `fileCommentLength` (bytes) + * `internalFileAttributes` + * `externalFileAttributes` + * `relativeOffsetOfLocalHeader` + +#### fileName + +`String`. +Following the spec, the bytes for the file name are decoded with +`UTF-8` if `generalPurposeBitFlag & 0x800`, otherwise with `CP437`. +Alternatively, this field may be populated from the Info-ZIP Unicode Path Extra Field +(see `extraFields`). + +This field is automatically validated by `validateFileName()` before yauzl emits an "entry" event. +If this field would contain unsafe characters, yauzl emits an error instead of an entry. + +If `decodeStrings` is `false` (see `open()`), this field is the undecoded `Buffer` instead of a decoded `String`. +Therefore, `generalPurposeBitFlag` and any Info-ZIP Unicode Path Extra Field are ignored. +Furthermore, no automatic file name validation is performed for this file name. + +#### extraFields + +`Array` with each entry in the form `{id: id, data: data}`, +where `id` is a `Number` and `data` is a `Buffer`. + +This library looks for and reads the ZIP64 Extended Information Extra Field (0x0001) +in order to support ZIP64 format zip files. + +This library also looks for and reads the Info-ZIP Unicode Path Extra Field (0x7075) +in order to support some zipfiles that use it instead of General Purpose Bit 8 +to convey `UTF-8` file names. +When the field is identified and verified to be reliable (see the zipfile spec), +the the file name in this field is stored in the `fileName` property, +and the file name in the central directory record for this entry is ignored. +Note that when `decodeStrings` is false, all Info-ZIP Unicode Path Extra Fields are ignored. + +None of the other fields are considered significant by this library. +Fields that this library reads are left unalterned in the `extraFields` array. + +#### fileComment + +`String` decoded with the charset indicated by `generalPurposeBitFlag & 0x800` as with the `fileName`. +(The Info-ZIP Unicode Path Extra Field has no effect on the charset used for this field.) + +If `decodeStrings` is `false` (see `open()`), this field is the undecoded `Buffer` instead of a decoded `String`. + +Prior to yauzl version 2.7.0, this field was erroneously documented as `comment` instead of `fileComment`. +For compatibility with any code that uses the field name `comment`, +yauzl creates an alias field named `comment` which is identical to `fileComment`. + +#### getLastModDate() + +Effectively implemented as: + +```js +return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime); +``` + +#### isEncrypted() + +Returns is this entry encrypted with "Traditional Encryption". +Effectively implemented as: + +```js +return (this.generalPurposeBitFlag & 0x1) !== 0; +``` + +See `openReadStream()` for the implications of this value. + +Note that "Strong Encryption" is not supported, and will result in an `"error"` event emitted from the `ZipFile`. + +#### isCompressed() + +Effectively implemented as: + +```js +return this.compressionMethod === 8; +``` + +See `openReadStream()` for the implications of this value. + +### Class: RandomAccessReader + +This class is meant to be subclassed by clients and instantiated for the `fromRandomAccessReader()` function. + +An example implementation can be found in `test/test.js`. + +#### randomAccessReader._readStreamForRange(start, end) + +Subclasses *must* implement this method. + +`start` and `end` are Numbers and indicate byte offsets from the start of the file. +`end` is exclusive, so `_readStreamForRange(0x1000, 0x2000)` would indicate to read `0x1000` bytes. +`end - start` will always be at least `1`. + +This method should return a readable stream which will be `pipe()`ed into another stream. +It is expected that the readable stream will provide data in several chunks if necessary. +If the readable stream provides too many or too few bytes, an error will be emitted. +(Note that `validateEntrySizes` has no effect on this check, +because this is a low-level API that should behave correctly regardless of the contents of the file.) +Any errors emitted on the readable stream will be handled and re-emitted on the client-visible stream +(returned from `zipfile.openReadStream()`) or provided as the `err` argument to the appropriate callback +(for example, for `fromRandomAccessReader()`). + +The returned stream *must* implement a method `.destroy()` +if you call `readStream.destroy()` on streams you get from `openReadStream()`. +If you never call `readStream.destroy()`, then streams returned from this method do not need to implement a method `.destroy()`. +`.destroy()` should abort any streaming that is in progress and clean up any associated resources. +`.destroy()` will only be called after the stream has been `unpipe()`d from its destination. + +Note that the stream returned from this method might not be the same object that is provided by `openReadStream()`. +The stream returned from this method might be `pipe()`d through one or more filter streams (for example, a zlib inflate stream). + +#### randomAccessReader.read(buffer, offset, length, position, callback) + +Subclasses may implement this method. +The default implementation uses `createReadStream()` to fill the `buffer`. + +This method should behave like `fs.read()`. + +#### randomAccessReader.close(callback) + +Subclasses may implement this method. +The default implementation is effectively `setImmediate(callback);`. + +`callback` takes parameters `(err)`. + +This method is called once the all streams returned from `_readStreamForRange()` have ended, +and no more `_readStreamForRange()` or `read()` requests will be issued to this object. + +## How to Avoid Crashing + +When a malformed zipfile is encountered, the default behavior is to crash (throw an exception). +If you want to handle errors more gracefully than this, +be sure to do the following: + + * Provide `callback` parameters where they are allowed, and check the `err` parameter. + * Attach a listener for the `error` event on any `ZipFile` object you get from `open()`, `fromFd()`, `fromBuffer()`, or `fromRandomAccessReader()`. + * Attach a listener for the `error` event on any stream you get from `openReadStream()`. + +Minor version updates to yauzl will not add any additional requirements to this list. + +## Limitations + +### No Streaming Unzip API + +Due to the design of the .zip file format, it's impossible to interpret a .zip file from start to finish +(such as from a readable stream) without sacrificing correctness. +The Central Directory, which is the authority on the contents of the .zip file, is at the end of a .zip file, not the beginning. +A streaming API would need to either buffer the entire .zip file to get to the Central Directory before interpreting anything +(defeating the purpose of a streaming interface), or rely on the Local File Headers which are interspersed through the .zip file. +However, the Local File Headers are explicitly denounced in the spec as being unreliable copies of the Central Directory, +so trusting them would be a violation of the spec. + +Any library that offers a streaming unzip API must make one of the above two compromises, +which makes the library either dishonest or nonconformant (usually the latter). +This library insists on correctness and adherence to the spec, and so does not offer a streaming API. + +Here is a way to create a spec-conformant .zip file using the `zip` command line program (Info-ZIP) +available in most unix-like environments, that is (nearly) impossible to parse correctly with a streaming parser: + +``` +$ echo -ne '\x50\x4b\x07\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' > file.txt +$ zip -q0 - file.txt | cat > out.zip +``` + +This .zip file contains a single file entry that uses General Purpose Bit 3, +which means the Local File Header doesn't know the size of the file. +Any streaming parser that encounters this situation will either immediately fail, +or attempt to search for the Data Descriptor after the file's contents. +The file's contents is a sequence of 16-bytes crafted to exactly mimic a valid Data Descriptor for an empty file, +which will fool any parser that gets this far into thinking that the file is empty rather than containing 16-bytes. +What follows the file's real contents is the file's real Data Descriptor, +which will likely cause some kind of signature mismatch error for a streaming parser (if one hasn't occurred already). + +By using General Purpose Bit 3 (and compression method 0), +it's possible to create arbitrarily ambiguous .zip files that +distract parsers with file contents that contain apparently valid .zip file metadata. + +### Limitted ZIP64 Support + +For ZIP64, only zip files smaller than `8PiB` are supported, +not the full `16EiB` range that a 64-bit integer should be able to index. +This is due to the JavaScript Number type being an IEEE 754 double precision float. + +The Node.js `fs` module probably has this same limitation. + +### ZIP64 Extensible Data Sector Is Ignored + +The spec does not allow zip file creators to put arbitrary data here, +but rather reserves its use for PKWARE and mentions something about Z390. +This doesn't seem useful to expose in this library, so it is ignored. + +### No Multi-Disk Archive Support + +This library does not support multi-disk zip files. +The multi-disk fields in the zipfile spec were intended for a zip file to span multiple floppy disks, +which probably never happens now. +If the "number of this disk" field in the End of Central Directory Record is not `0`, +the `open()`, `fromFd()`, `fromBuffer()`, or `fromRandomAccessReader()` `callback` will receive an `err`. +By extension the following zip file fields are ignored by this library and not provided to clients: + + * Disk where central directory starts + * Number of central directory records on this disk + * Disk number where file starts + +### Limited Encryption Handling + +You can detect when a file entry is encrypted with "Traditional Encryption" via `isEncrypted()`, +but yauzl will not help you decrypt it. +See `openReadStream()`. + +If a zip file contains file entries encrypted with "Strong Encryption", yauzl emits an error. + +If the central directory is encrypted or compressed, yauzl emits an error. + +### Local File Headers Are Ignored + +Many unzip libraries mistakenly read the Local File Header data in zip files. +This data is officially defined to be redundant with the Central Directory information, +and is not to be trusted. +Aside from checking the signature, yauzl ignores the content of the Local File Header. + +### No CRC-32 Checking + +This library provides the `crc32` field of `Entry` objects read from the Central Directory. +However, this field is not used for anything in this library. + +### versionNeededToExtract Is Ignored + +The field `versionNeededToExtract` is ignored, +because this library doesn't support the complete zip file spec at any version, + +### No Support For Obscure Compression Methods + +Regarding the `compressionMethod` field of `Entry` objects, +only method `0` (stored with no compression) +and method `8` (deflated) are supported. +Any of the other 15 official methods will cause the `openReadStream()` `callback` to receive an `err`. + +### Data Descriptors Are Ignored + +There may or may not be Data Descriptor sections in a zip file. +This library provides no support for finding or interpreting them. + +### Archive Extra Data Record Is Ignored + +There may or may not be an Archive Extra Data Record section in a zip file. +This library provides no support for finding or interpreting it. + +### No Language Encoding Flag Support + +Zip files officially support charset encodings other than CP437 and UTF-8, +but the zip file spec does not specify how it works. +This library makes no attempt to interpret the Language Encoding Flag. + +## Change History + + * 2.9.1 + * Remove `console.log()` accidentally introduced in 2.9.0. [issue #64](https://github.com/thejoshwolfe/yauzl/issues/64) + * 2.9.0 + * Throw an exception if `readEntry()` is called without `lazyEntries:true`. Previously this caused undefined behavior. [issue #63](https://github.com/thejoshwolfe/yauzl/issues/63) + * 2.8.0 + * Added option `validateEntrySizes`. [issue #53](https://github.com/thejoshwolfe/yauzl/issues/53) + * Added `examples/promises.js` + * Added ability to read raw file data via `decompress` and `decrypt` options. [issue #11](https://github.com/thejoshwolfe/yauzl/issues/11), [issue #38](https://github.com/thejoshwolfe/yauzl/issues/38), [pull #39](https://github.com/thejoshwolfe/yauzl/pull/39) + * Added `start` and `end` options to `openReadStream()`. [issue #38](https://github.com/thejoshwolfe/yauzl/issues/38) + * 2.7.0 + * Added option `decodeStrings`. [issue #42](https://github.com/thejoshwolfe/yauzl/issues/42) + * Fixed documentation for `entry.fileComment` and added compatibility alias. [issue #47](https://github.com/thejoshwolfe/yauzl/issues/47) + * 2.6.0 + * Support Info-ZIP Unicode Path Extra Field, used by WinRAR for Chinese file names. [issue #33](https://github.com/thejoshwolfe/yauzl/issues/33) + * 2.5.0 + * Ignore malformed Extra Field that is common in Android .apk files. [issue #31](https://github.com/thejoshwolfe/yauzl/issues/31) + * 2.4.3 + * Fix crash when parsing malformed Extra Field buffers. [issue #31](https://github.com/thejoshwolfe/yauzl/issues/31) + * 2.4.2 + * Remove .npmignore and .travis.yml from npm package. + * 2.4.1 + * Fix error handling. + * 2.4.0 + * Add ZIP64 support. [issue #6](https://github.com/thejoshwolfe/yauzl/issues/6) + * Add `lazyEntries` option. [issue #22](https://github.com/thejoshwolfe/yauzl/issues/22) + * Add `readStream.destroy()` method. [issue #26](https://github.com/thejoshwolfe/yauzl/issues/26) + * Add `fromRandomAccessReader()`. [issue #14](https://github.com/thejoshwolfe/yauzl/issues/14) + * Add `examples/unzip.js`. + * 2.3.1 + * Documentation updates. + * 2.3.0 + * Check that `uncompressedSize` is correct, or else emit an error. [issue #13](https://github.com/thejoshwolfe/yauzl/issues/13) + * 2.2.1 + * Update dependencies. + * 2.2.0 + * Update dependencies. + * 2.1.0 + * Remove dependency on `iconv`. + * 2.0.3 + * Fix crash when trying to read a 0-byte file. + * 2.0.2 + * Fix event behavior after errors. + * 2.0.1 + * Fix bug with using `iconv`. + * 2.0.0 + * Initial release. diff --git a/appasar/canary/node_modules/yauzl/index.js b/appasar/canary/node_modules/yauzl/index.js new file mode 100644 index 0000000..ae1fea6 --- /dev/null +++ b/appasar/canary/node_modules/yauzl/index.js @@ -0,0 +1,775 @@ +var fs = require("fs"); +var zlib = require("zlib"); +var fd_slicer = require("fd-slicer"); +var crc32 = require("buffer-crc32"); +var util = require("util"); +var EventEmitter = require("events").EventEmitter; +var Transform = require("stream").Transform; +var PassThrough = require("stream").PassThrough; +var Writable = require("stream").Writable; + +exports.open = open; +exports.fromFd = fromFd; +exports.fromBuffer = fromBuffer; +exports.fromRandomAccessReader = fromRandomAccessReader; +exports.dosDateTimeToDate = dosDateTimeToDate; +exports.validateFileName = validateFileName; +exports.ZipFile = ZipFile; +exports.Entry = Entry; +exports.RandomAccessReader = RandomAccessReader; + +function open(path, options, callback) { + if (typeof options === "function") { + callback = options; + options = null; + } + if (options == null) options = {}; + if (options.autoClose == null) options.autoClose = true; + if (options.lazyEntries == null) options.lazyEntries = false; + if (options.decodeStrings == null) options.decodeStrings = true; + if (options.validateEntrySizes == null) options.validateEntrySizes = true; + if (callback == null) callback = defaultCallback; + fs.open(path, "r", function(err, fd) { + if (err) return callback(err); + fromFd(fd, options, function(err, zipfile) { + if (err) fs.close(fd, defaultCallback); + callback(err, zipfile); + }); + }); +} + +function fromFd(fd, options, callback) { + if (typeof options === "function") { + callback = options; + options = null; + } + if (options == null) options = {}; + if (options.autoClose == null) options.autoClose = false; + if (options.lazyEntries == null) options.lazyEntries = false; + if (options.decodeStrings == null) options.decodeStrings = true; + if (options.validateEntrySizes == null) options.validateEntrySizes = true; + if (callback == null) callback = defaultCallback; + fs.fstat(fd, function(err, stats) { + if (err) return callback(err); + var reader = fd_slicer.createFromFd(fd, {autoClose: true}); + fromRandomAccessReader(reader, stats.size, options, callback); + }); +} + +function fromBuffer(buffer, options, callback) { + if (typeof options === "function") { + callback = options; + options = null; + } + if (options == null) options = {}; + options.autoClose = false; + if (options.lazyEntries == null) options.lazyEntries = false; + if (options.decodeStrings == null) options.decodeStrings = true; + if (options.validateEntrySizes == null) options.validateEntrySizes = true; + // i got your open file right here. + var reader = fd_slicer.createFromBuffer(buffer); + fromRandomAccessReader(reader, buffer.length, options, callback); +} + +function fromRandomAccessReader(reader, totalSize, options, callback) { + if (typeof options === "function") { + callback = options; + options = null; + } + if (options == null) options = {}; + if (options.autoClose == null) options.autoClose = true; + if (options.lazyEntries == null) options.lazyEntries = false; + if (options.decodeStrings == null) options.decodeStrings = true; + var decodeStrings = !!options.decodeStrings; + if (options.validateEntrySizes == null) options.validateEntrySizes = true; + if (callback == null) callback = defaultCallback; + if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number"); + if (totalSize > Number.MAX_SAFE_INTEGER) { + throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double."); + } + + // the matching unref() call is in zipfile.close() + reader.ref(); + + // eocdr means End of Central Directory Record. + // search backwards for the eocdr signature. + // the last field of the eocdr is a variable-length comment. + // the comment size is encoded in a 2-byte field in the eocdr, which we can't find without trudging backwards through the comment to find it. + // as a consequence of this design decision, it's possible to have ambiguous zip file metadata if a coherent eocdr was in the comment. + // we search backwards for a eocdr signature, and hope that whoever made the zip file was smart enough to forbid the eocdr signature in the comment. + var eocdrWithoutCommentSize = 22; + var maxCommentSize = 0xffff; // 2-byte size + var bufferSize = Math.min(eocdrWithoutCommentSize + maxCommentSize, totalSize); + var buffer = new Buffer(bufferSize); + var bufferReadStart = totalSize - buffer.length; + readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) { + if (err) return callback(err); + for (var i = bufferSize - eocdrWithoutCommentSize; i >= 0; i -= 1) { + if (buffer.readUInt32LE(i) !== 0x06054b50) continue; + // found eocdr + var eocdrBuffer = buffer.slice(i); + + // 0 - End of central directory signature = 0x06054b50 + // 4 - Number of this disk + var diskNumber = eocdrBuffer.readUInt16LE(4); + if (diskNumber !== 0) { + return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber)); + } + // 6 - Disk where central directory starts + // 8 - Number of central directory records on this disk + // 10 - Total number of central directory records + var entryCount = eocdrBuffer.readUInt16LE(10); + // 12 - Size of central directory (bytes) + // 16 - Offset of start of central directory, relative to start of archive + var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16); + // 20 - Comment length + var commentLength = eocdrBuffer.readUInt16LE(20); + var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize; + if (commentLength !== expectedCommentLength) { + return callback(new Error("invalid comment length. expected: " + expectedCommentLength + ". found: " + commentLength)); + } + // 22 - Comment + // the encoding is always cp437. + var comment = decodeStrings ? decodeBuffer(eocdrBuffer, 22, eocdrBuffer.length, false) + : eocdrBuffer.slice(22); + + if (!(entryCount === 0xffff || centralDirectoryOffset === 0xffffffff)) { + return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes)); + } + + // ZIP64 format + + // ZIP64 Zip64 end of central directory locator + var zip64EocdlBuffer = new Buffer(20); + var zip64EocdlOffset = bufferReadStart + i - zip64EocdlBuffer.length; + readAndAssertNoEof(reader, zip64EocdlBuffer, 0, zip64EocdlBuffer.length, zip64EocdlOffset, function(err) { + if (err) return callback(err); + + // 0 - zip64 end of central dir locator signature = 0x07064b50 + if (zip64EocdlBuffer.readUInt32LE(0) !== 0x07064b50) { + return callback(new Error("invalid zip64 end of central directory locator signature")); + } + // 4 - number of the disk with the start of the zip64 end of central directory + // 8 - relative offset of the zip64 end of central directory record + var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8); + // 16 - total number of disks + + // ZIP64 end of central directory record + var zip64EocdrBuffer = new Buffer(56); + readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err) { + if (err) return callback(err); + + // 0 - zip64 end of central dir signature 4 bytes (0x06064b50) + if (zip64EocdrBuffer.readUInt32LE(0) !== 0x06064b50) { + return callback(new Error("invalid zip64 end of central directory record signature")); + } + // 4 - size of zip64 end of central directory record 8 bytes + // 12 - version made by 2 bytes + // 14 - version needed to extract 2 bytes + // 16 - number of this disk 4 bytes + // 20 - number of the disk with the start of the central directory 4 bytes + // 24 - total number of entries in the central directory on this disk 8 bytes + // 32 - total number of entries in the central directory 8 bytes + entryCount = readUInt64LE(zip64EocdrBuffer, 32); + // 40 - size of the central directory 8 bytes + // 48 - offset of start of central directory with respect to the starting disk number 8 bytes + centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48); + // 56 - zip64 extensible data sector (variable size) + return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes)); + }); + }); + return; + } + callback(new Error("end of central directory record signature not found")); + }); +} + +util.inherits(ZipFile, EventEmitter); +function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes) { + var self = this; + EventEmitter.call(self); + self.reader = reader; + // forward close events + self.reader.on("error", function(err) { + // error closing the fd + emitError(self, err); + }); + self.reader.once("close", function() { + self.emit("close"); + }); + self.readEntryCursor = centralDirectoryOffset; + self.fileSize = fileSize; + self.entryCount = entryCount; + self.comment = comment; + self.entriesRead = 0; + self.autoClose = !!autoClose; + self.lazyEntries = !!lazyEntries; + self.decodeStrings = !!decodeStrings; + self.validateEntrySizes = !!validateEntrySizes; + self.isOpen = true; + self.emittedError = false; + + if (!self.lazyEntries) self._readEntry(); +} +ZipFile.prototype.close = function() { + if (!this.isOpen) return; + this.isOpen = false; + this.reader.unref(); +}; + +function emitErrorAndAutoClose(self, err) { + if (self.autoClose) self.close(); + emitError(self, err); +} +function emitError(self, err) { + if (self.emittedError) return; + self.emittedError = true; + self.emit("error", err); +} + +ZipFile.prototype.readEntry = function() { + if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true"); + this._readEntry(); +}; +ZipFile.prototype._readEntry = function() { + var self = this; + if (self.entryCount === self.entriesRead) { + // done with metadata + setImmediate(function() { + if (self.autoClose) self.close(); + if (self.emittedError) return; + self.emit("end"); + }); + return; + } + if (self.emittedError) return; + var buffer = new Buffer(46); + readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) { + if (err) return emitErrorAndAutoClose(self, err); + if (self.emittedError) return; + var entry = new Entry(); + // 0 - Central directory file header signature + var signature = buffer.readUInt32LE(0); + if (signature !== 0x02014b50) return emitErrorAndAutoClose(self, new Error("invalid central directory file header signature: 0x" + signature.toString(16))); + // 4 - Version made by + entry.versionMadeBy = buffer.readUInt16LE(4); + // 6 - Version needed to extract (minimum) + entry.versionNeededToExtract = buffer.readUInt16LE(6); + // 8 - General purpose bit flag + entry.generalPurposeBitFlag = buffer.readUInt16LE(8); + // 10 - Compression method + entry.compressionMethod = buffer.readUInt16LE(10); + // 12 - File last modification time + entry.lastModFileTime = buffer.readUInt16LE(12); + // 14 - File last modification date + entry.lastModFileDate = buffer.readUInt16LE(14); + // 16 - CRC-32 + entry.crc32 = buffer.readUInt32LE(16); + // 20 - Compressed size + entry.compressedSize = buffer.readUInt32LE(20); + // 24 - Uncompressed size + entry.uncompressedSize = buffer.readUInt32LE(24); + // 28 - File name length (n) + entry.fileNameLength = buffer.readUInt16LE(28); + // 30 - Extra field length (m) + entry.extraFieldLength = buffer.readUInt16LE(30); + // 32 - File comment length (k) + entry.fileCommentLength = buffer.readUInt16LE(32); + // 34 - Disk number where file starts + // 36 - Internal file attributes + entry.internalFileAttributes = buffer.readUInt16LE(36); + // 38 - External file attributes + entry.externalFileAttributes = buffer.readUInt32LE(38); + // 42 - Relative offset of local file header + entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42); + + if (entry.generalPurposeBitFlag & 0x40) return emitErrorAndAutoClose(self, new Error("strong encryption is not supported")); + + self.readEntryCursor += 46; + + buffer = new Buffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength); + readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) { + if (err) return emitErrorAndAutoClose(self, err); + if (self.emittedError) return; + // 46 - File name + var isUtf8 = (entry.generalPurposeBitFlag & 0x800) !== 0; + entry.fileName = self.decodeStrings ? decodeBuffer(buffer, 0, entry.fileNameLength, isUtf8) + : buffer.slice(0, entry.fileNameLength); + + // 46+n - Extra field + var fileCommentStart = entry.fileNameLength + entry.extraFieldLength; + var extraFieldBuffer = buffer.slice(entry.fileNameLength, fileCommentStart); + entry.extraFields = []; + var i = 0; + while (i < extraFieldBuffer.length - 3) { + var headerId = extraFieldBuffer.readUInt16LE(i + 0); + var dataSize = extraFieldBuffer.readUInt16LE(i + 2); + var dataStart = i + 4; + var dataEnd = dataStart + dataSize; + if (dataEnd > extraFieldBuffer.length) return emitErrorAndAutoClose(self, new Error("extra field length exceeds extra field buffer size")); + var dataBuffer = new Buffer(dataSize); + extraFieldBuffer.copy(dataBuffer, 0, dataStart, dataEnd); + entry.extraFields.push({ + id: headerId, + data: dataBuffer, + }); + i = dataEnd; + } + + // 46+n+m - File comment + entry.fileComment = self.decodeStrings ? decodeBuffer(buffer, fileCommentStart, fileCommentStart + entry.fileCommentLength, isUtf8) + : buffer.slice(fileCommentStart, fileCommentStart + entry.fileCommentLength); + // compatibility hack for https://github.com/thejoshwolfe/yauzl/issues/47 + entry.comment = entry.fileComment; + + self.readEntryCursor += buffer.length; + self.entriesRead += 1; + + if (entry.uncompressedSize === 0xffffffff || + entry.compressedSize === 0xffffffff || + entry.relativeOffsetOfLocalHeader === 0xffffffff) { + // ZIP64 format + // find the Zip64 Extended Information Extra Field + var zip64EiefBuffer = null; + for (var i = 0; i < entry.extraFields.length; i++) { + var extraField = entry.extraFields[i]; + if (extraField.id === 0x0001) { + zip64EiefBuffer = extraField.data; + break; + } + } + if (zip64EiefBuffer == null) { + return emitErrorAndAutoClose(self, new Error("expected zip64 extended information extra field")); + } + var index = 0; + // 0 - Original Size 8 bytes + if (entry.uncompressedSize === 0xffffffff) { + if (index + 8 > zip64EiefBuffer.length) { + return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include uncompressed size")); + } + entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index); + index += 8; + } + // 8 - Compressed Size 8 bytes + if (entry.compressedSize === 0xffffffff) { + if (index + 8 > zip64EiefBuffer.length) { + return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include compressed size")); + } + entry.compressedSize = readUInt64LE(zip64EiefBuffer, index); + index += 8; + } + // 16 - Relative Header Offset 8 bytes + if (entry.relativeOffsetOfLocalHeader === 0xffffffff) { + if (index + 8 > zip64EiefBuffer.length) { + return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include relative header offset")); + } + entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index); + index += 8; + } + // 24 - Disk Start Number 4 bytes + } + + // check for Info-ZIP Unicode Path Extra Field (0x7075) + // see https://github.com/thejoshwolfe/yauzl/issues/33 + if (self.decodeStrings) { + for (var i = 0; i < entry.extraFields.length; i++) { + var extraField = entry.extraFields[i]; + if (extraField.id === 0x7075) { + if (extraField.data.length < 6) { + // too short to be meaningful + continue; + } + // Version 1 byte version of this extra field, currently 1 + if (extraField.data.readUInt8(0) !== 1) { + // > Changes may not be backward compatible so this extra + // > field should not be used if the version is not recognized. + continue; + } + // NameCRC32 4 bytes File Name Field CRC32 Checksum + var oldNameCrc32 = extraField.data.readUInt32LE(1); + if (crc32.unsigned(buffer.slice(0, entry.fileNameLength)) !== oldNameCrc32) { + // > If the CRC check fails, this UTF-8 Path Extra Field should be + // > ignored and the File Name field in the header should be used instead. + continue; + } + // UnicodeName Variable UTF-8 version of the entry File Name + entry.fileName = decodeBuffer(extraField.data, 5, extraField.data.length, true); + break; + } + } + } + + // validate file size + if (self.validateEntrySizes && entry.compressionMethod === 0) { + var expectedCompressedSize = entry.uncompressedSize; + if (entry.isEncrypted()) { + // traditional encryption prefixes the file data with a header + expectedCompressedSize += 12; + } + if (entry.compressedSize !== expectedCompressedSize) { + var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize; + return emitErrorAndAutoClose(self, new Error(msg)); + } + } + + if (self.decodeStrings) { + var errorMessage = validateFileName(entry.fileName); + if (errorMessage != null) return emitErrorAndAutoClose(self, new Error(errorMessage)); + } + self.emit("entry", entry); + + if (!self.lazyEntries) self._readEntry(); + }); + }); +}; + +ZipFile.prototype.openReadStream = function(entry, options, callback) { + var self = this; + // parameter validation + var relativeStart = 0; + var relativeEnd = entry.compressedSize; + if (callback == null) { + callback = options; + options = {}; + } else { + // validate options that the caller has no excuse to get wrong + if (options.decrypt != null) { + if (!entry.isEncrypted()) { + throw new Error("options.decrypt can only be specified for encrypted entries"); + } + if (options.decrypt !== false) throw new Error("invalid options.decrypt value: " + options.decrypt); + if (entry.isCompressed()) { + if (options.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false"); + } + } + if (options.decompress != null) { + if (!entry.isCompressed()) { + throw new Error("options.decompress can only be specified for compressed entries"); + } + if (!(options.decompress === false || options.decompress === true)) { + throw new Error("invalid options.decompress value: " + options.decompress); + } + } + if (options.start != null || options.end != null) { + if (entry.isCompressed() && options.decompress !== false) { + throw new Error("start/end range not allowed for compressed entry without options.decompress === false"); + } + if (entry.isEncrypted() && options.decrypt !== false) { + throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false"); + } + } + if (options.start != null) { + relativeStart = options.start; + if (relativeStart < 0) throw new Error("options.start < 0"); + if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize"); + } + if (options.end != null) { + relativeEnd = options.end; + if (relativeEnd < 0) throw new Error("options.end < 0"); + if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize"); + if (relativeEnd < relativeStart) throw new Error("options.end < options.start"); + } + } + // any further errors can either be caused by the zipfile, + // or were introduced in a minor version of yauzl, + // so should be passed to the client rather than thrown. + if (!self.isOpen) return callback(new Error("closed")); + if (entry.isEncrypted()) { + if (options.decrypt !== false) return callback(new Error("entry is encrypted, and options.decrypt !== false")); + } + // make sure we don't lose the fd before we open the actual read stream + self.reader.ref(); + var buffer = new Buffer(30); + readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) { + try { + if (err) return callback(err); + // 0 - Local file header signature = 0x04034b50 + var signature = buffer.readUInt32LE(0); + if (signature !== 0x04034b50) { + return callback(new Error("invalid local file header signature: 0x" + signature.toString(16))); + } + // all this should be redundant + // 4 - Version needed to extract (minimum) + // 6 - General purpose bit flag + // 8 - Compression method + // 10 - File last modification time + // 12 - File last modification date + // 14 - CRC-32 + // 18 - Compressed size + // 22 - Uncompressed size + // 26 - File name length (n) + var fileNameLength = buffer.readUInt16LE(26); + // 28 - Extra field length (m) + var extraFieldLength = buffer.readUInt16LE(28); + // 30 - File name + // 30+n - Extra field + var localFileHeaderEnd = entry.relativeOffsetOfLocalHeader + buffer.length + fileNameLength + extraFieldLength; + var decompress; + if (entry.compressionMethod === 0) { + // 0 - The file is stored (no compression) + decompress = false; + } else if (entry.compressionMethod === 8) { + // 8 - The file is Deflated + decompress = options.decompress != null ? options.decompress : true; + } else { + return callback(new Error("unsupported compression method: " + entry.compressionMethod)); + } + var fileDataStart = localFileHeaderEnd; + var fileDataEnd = fileDataStart + entry.compressedSize; + if (entry.compressedSize !== 0) { + // bounds check now, because the read streams will probably not complain loud enough. + // since we're dealing with an unsigned offset plus an unsigned size, + // we only have 1 thing to check for. + if (fileDataEnd > self.fileSize) { + return callback(new Error("file data overflows file bounds: " + + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize)); + } + } + var readStream = self.reader.createReadStream({ + start: fileDataStart + relativeStart, + end: fileDataStart + relativeEnd, + }); + var endpointStream = readStream; + if (decompress) { + var destroyed = false; + var inflateFilter = zlib.createInflateRaw(); + readStream.on("error", function(err) { + // setImmediate here because errors can be emitted during the first call to pipe() + setImmediate(function() { + if (!destroyed) inflateFilter.emit("error", err); + }); + }); + readStream.pipe(inflateFilter); + + if (self.validateEntrySizes) { + endpointStream = new AssertByteCountStream(entry.uncompressedSize); + inflateFilter.on("error", function(err) { + // forward zlib errors to the client-visible stream + setImmediate(function() { + if (!destroyed) endpointStream.emit("error", err); + }); + }); + inflateFilter.pipe(endpointStream); + } else { + // the zlib filter is the client-visible stream + endpointStream = inflateFilter; + } + // this is part of yauzl's API, so implement this function on the client-visible stream + endpointStream.destroy = function() { + destroyed = true; + if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream); + readStream.unpipe(inflateFilter); + // TODO: the inflateFilter may cause a memory leak. see Issue #27. + readStream.destroy(); + }; + } + callback(null, endpointStream); + } finally { + self.reader.unref(); + } + }); +}; + +function Entry() { +} +Entry.prototype.getLastModDate = function() { + return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime); +}; +Entry.prototype.isEncrypted = function() { + return (this.generalPurposeBitFlag & 0x1) !== 0; +}; +Entry.prototype.isCompressed = function() { + return this.compressionMethod === 8; +}; + +function dosDateTimeToDate(date, time) { + var day = date & 0x1f; // 1-31 + var month = (date >> 5 & 0xf) - 1; // 1-12, 0-11 + var year = (date >> 9 & 0x7f) + 1980; // 0-128, 1980-2108 + + var millisecond = 0; + var second = (time & 0x1f) * 2; // 0-29, 0-58 (even numbers) + var minute = time >> 5 & 0x3f; // 0-59 + var hour = time >> 11 & 0x1f; // 0-23 + + return new Date(year, month, day, hour, minute, second, millisecond); +} + +function validateFileName(fileName) { + if (fileName.indexOf("\\") !== -1) { + return "invalid characters in fileName: " + fileName; + } + if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) { + return "absolute path: " + fileName; + } + if (fileName.split("/").indexOf("..") !== -1) { + return "invalid relative path: " + fileName; + } + // all good + return null; +}; + +function readAndAssertNoEof(reader, buffer, offset, length, position, callback) { + if (length === 0) { + // fs.read will throw an out-of-bounds error if you try to read 0 bytes from a 0 byte file + return setImmediate(function() { callback(null, new Buffer(0)); }); + } + reader.read(buffer, offset, length, position, function(err, bytesRead) { + if (err) return callback(err); + if (bytesRead < length) { + return callback(new Error("unexpected EOF")); + } + callback(); + }); +} + +util.inherits(AssertByteCountStream, Transform); +function AssertByteCountStream(byteCount) { + Transform.call(this); + this.actualByteCount = 0; + this.expectedByteCount = byteCount; +} +AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) { + this.actualByteCount += chunk.length; + if (this.actualByteCount > this.expectedByteCount) { + var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount; + return cb(new Error(msg)); + } + cb(null, chunk); +}; +AssertByteCountStream.prototype._flush = function(cb) { + if (this.actualByteCount < this.expectedByteCount) { + var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount; + return cb(new Error(msg)); + } + cb(); +}; + +util.inherits(RandomAccessReader, EventEmitter); +function RandomAccessReader() { + EventEmitter.call(this); + this.refCount = 0; +} +RandomAccessReader.prototype.ref = function() { + this.refCount += 1; +}; +RandomAccessReader.prototype.unref = function() { + var self = this; + self.refCount -= 1; + + if (self.refCount > 0) return; + if (self.refCount < 0) throw new Error("invalid unref"); + + self.close(onCloseDone); + + function onCloseDone(err) { + if (err) return self.emit('error', err); + self.emit('close'); + } +}; +RandomAccessReader.prototype.createReadStream = function(options) { + var start = options.start; + var end = options.end; + if (start === end) { + var emptyStream = new PassThrough(); + setImmediate(function() { + emptyStream.end(); + }); + return emptyStream; + } + var stream = this._readStreamForRange(start, end); + + var destroyed = false; + var refUnrefFilter = new RefUnrefFilter(this); + stream.on("error", function(err) { + setImmediate(function() { + if (!destroyed) refUnrefFilter.emit("error", err); + }); + }); + refUnrefFilter.destroy = function() { + stream.unpipe(refUnrefFilter); + refUnrefFilter.unref(); + stream.destroy(); + }; + + var byteCounter = new AssertByteCountStream(end - start); + refUnrefFilter.on("error", function(err) { + setImmediate(function() { + if (!destroyed) byteCounter.emit("error", err); + }); + }); + byteCounter.destroy = function() { + destroyed = true; + refUnrefFilter.unpipe(byteCounter); + refUnrefFilter.destroy(); + }; + + return stream.pipe(refUnrefFilter).pipe(byteCounter); +}; +RandomAccessReader.prototype._readStreamForRange = function(start, end) { + throw new Error("not implemented"); +}; +RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) { + var readStream = this.createReadStream({start: position, end: position + length}); + var writeStream = new Writable(); + var written = 0; + writeStream._write = function(chunk, encoding, cb) { + chunk.copy(buffer, offset + written, 0, chunk.length); + written += chunk.length; + cb(); + }; + writeStream.on("finish", callback); + readStream.on("error", function(error) { + callback(error); + }); + readStream.pipe(writeStream); +}; +RandomAccessReader.prototype.close = function(callback) { + setImmediate(callback); +}; + +util.inherits(RefUnrefFilter, PassThrough); +function RefUnrefFilter(context) { + PassThrough.call(this); + this.context = context; + this.context.ref(); + this.unreffedYet = false; +} +RefUnrefFilter.prototype._flush = function(cb) { + this.unref(); + cb(); +}; +RefUnrefFilter.prototype.unref = function(cb) { + if (this.unreffedYet) return; + this.unreffedYet = true; + this.context.unref(); +}; + +var cp437 = '\u0000☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ '; +function decodeBuffer(buffer, start, end, isUtf8) { + if (isUtf8) { + return buffer.toString("utf8", start, end); + } else { + var result = ""; + for (var i = start; i < end; i++) { + result += cp437[buffer[i]]; + } + return result; + } +} + +function readUInt64LE(buffer, offset) { + // there is no native function for this, because we can't actually store 64-bit integers precisely. + // after 53 bits, JavaScript's Number type (IEEE 754 double) can't store individual integers anymore. + // but since 53 bits is a whole lot more than 32 bits, we do our best anyway. + var lower32 = buffer.readUInt32LE(offset); + var upper32 = buffer.readUInt32LE(offset + 4); + // we can't use bitshifting here, because JavaScript bitshifting only works on 32-bit integers. + return upper32 * 0x100000000 + lower32; + // as long as we're bounds checking the result of this function against the total file size, + // we'll catch any overflow errors, because we already made sure the total file size was within reason. +} + +function defaultCallback(err) { + if (err) throw err; +} diff --git a/appasar/canary/node_modules/yauzl/package.json b/appasar/canary/node_modules/yauzl/package.json new file mode 100644 index 0000000..800621d --- /dev/null +++ b/appasar/canary/node_modules/yauzl/package.json @@ -0,0 +1,40 @@ +{ + "name": "yauzl", + "version": "2.9.1", + "description": "yet another unzip library for node", + "main": "index.js", + "scripts": { + "test": "node test/test.js", + "test-cov": "istanbul cover test/test.js", + "test-travis": "istanbul cover --report lcovonly test/test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/thejoshwolfe/yauzl.git" + }, + "keywords": [ + "unzip", + "zip", + "stream", + "archive", + "file" + ], + "author": "Josh Wolfe ", + "license": "MIT", + "bugs": { + "url": "https://github.com/thejoshwolfe/yauzl/issues" + }, + "homepage": "https://github.com/thejoshwolfe/yauzl", + "dependencies": { + "fd-slicer": "~1.0.1", + "buffer-crc32": "~0.2.3" + }, + "devDependencies": { + "bl": "~1.0.0", + "istanbul": "~0.3.4", + "pend": "~1.2.0" + }, + "files": [ + "index.js" + ] +} diff --git a/appasar/canary/package.json b/appasar/canary/package.json new file mode 100644 index 0000000..6225913 --- /dev/null +++ b/appasar/canary/package.json @@ -0,0 +1,15 @@ +{ + "name": "discord", + "description": "Discord Client for Desktop - Bootstrapper", + "main": "app_bootstrap/index.js", + "private": true, + "dependencies": { + "mkdirp": "^0.5.1", + "request": "2.83.0", + "rimraf": "^2.5.2", + "yauzl": "^2.5.0" + }, + "devDependencies": { + "devtron": "1.4.0" + } +} diff --git a/electronasar/canary/browser/api/app.js b/electronasar/canary/browser/api/app.js new file mode 100644 index 0000000..4cef536 --- /dev/null +++ b/electronasar/canary/browser/api/app.js @@ -0,0 +1,117 @@ +'use strict' + +const bindings = process.atomBinding('app') +const path = require('path') +const { app, App } = bindings + +// Only one app object permitted. +module.exports = app + +const electron = require('electron') +const { deprecate, Menu } = electron +const { EventEmitter } = require('events') + +let dockMenu = null + +// App is an EventEmitter. +Object.setPrototypeOf(App.prototype, EventEmitter.prototype) +EventEmitter.call(app) + +Object.assign(app, { + setApplicationMenu (menu) { + return Menu.setApplicationMenu(menu) + }, + getApplicationMenu () { + return Menu.getApplicationMenu() + }, + commandLine: { + appendSwitch (...args) { + const castedArgs = args.map((arg) => { + return typeof arg !== 'string' ? `${arg}` : arg + }) + return bindings.appendSwitch(...castedArgs) + }, + appendArgument (...args) { + const castedArgs = args.map((arg) => { + return typeof arg !== 'string' ? `${arg}` : arg + }) + return bindings.appendArgument(...castedArgs) + } + } +}) + +const nativeFn = app.getAppMetrics +app.getAppMetrics = () => { + const metrics = nativeFn.call(app) + for (const metric of metrics) { + if ('memory' in metric) { + deprecate.removeProperty(metric, 'memory') + } + } + + return metrics +} + +app.isPackaged = (() => { + const execFile = path.basename(process.execPath).toLowerCase() + if (process.platform === 'win32') { + return execFile !== 'electron.exe' + } + return execFile !== 'electron' +})() + +if (process.platform === 'darwin') { + app.dock = { + bounce (type = 'informational') { + return bindings.dockBounce(type) + }, + cancelBounce: bindings.dockCancelBounce, + downloadFinished: bindings.dockDownloadFinished, + setBadge: bindings.dockSetBadgeText, + getBadge: bindings.dockGetBadgeText, + hide: bindings.dockHide, + show: bindings.dockShow, + isVisible: bindings.dockIsVisible, + setMenu (menu) { + dockMenu = menu + bindings.dockSetMenu(menu) + }, + getMenu () { + return dockMenu + }, + setIcon: bindings.dockSetIcon + } +} + +if (process.platform === 'linux') { + app.launcher = { + setBadgeCount: bindings.unityLauncherSetBadgeCount, + getBadgeCount: bindings.unityLauncherGetBadgeCount, + isCounterBadgeAvailable: bindings.unityLauncherAvailable, + isUnityRunning: bindings.unityLauncherAvailable + } +} + +app.allowNTLMCredentialsForAllDomains = function (allow) { + if (!process.noDeprecations) { + deprecate.warn('app.allowNTLMCredentialsForAllDomains', 'session.allowNTLMCredentialsForDomains') + } + const domains = allow ? '*' : '' + if (!this.isReady()) { + this.commandLine.appendSwitch('auth-server-whitelist', domains) + } else { + electron.session.defaultSession.allowNTLMCredentialsForDomains(domains) + } +} + +// Routes the events to webContents. +const events = ['login', 'certificate-error', 'select-client-certificate'] +for (const name of events) { + app.on(name, (event, webContents, ...args) => { + webContents.emit(name, event, ...args) + }) +} + +// Wrappers for native classes. +const { DownloadItem } = process.atomBinding('download_item') +Object.setPrototypeOf(DownloadItem.prototype, EventEmitter.prototype) diff --git a/electronasar/canary/browser/api/auto-updater.js b/electronasar/canary/browser/api/auto-updater.js new file mode 100644 index 0000000..db3e8da --- /dev/null +++ b/electronasar/canary/browser/api/auto-updater.js @@ -0,0 +1,7 @@ +'use strict' + +if (process.platform === 'win32') { + module.exports = require('@electron/internal/browser/api/auto-updater/auto-updater-win') +} else { + module.exports = require('@electron/internal/browser/api/auto-updater/auto-updater-native') +} diff --git a/electronasar/canary/browser/api/auto-updater/auto-updater-native.js b/electronasar/canary/browser/api/auto-updater/auto-updater-native.js new file mode 100644 index 0000000..d15a3c2 --- /dev/null +++ b/electronasar/canary/browser/api/auto-updater/auto-updater-native.js @@ -0,0 +1,10 @@ +'use strict' + +const EventEmitter = require('events').EventEmitter +const { autoUpdater, AutoUpdater } = process.atomBinding('auto_updater') + +// AutoUpdater is an EventEmitter. +Object.setPrototypeOf(AutoUpdater.prototype, EventEmitter.prototype) +EventEmitter.call(autoUpdater) + +module.exports = autoUpdater diff --git a/electronasar/canary/browser/api/auto-updater/auto-updater-win.js b/electronasar/canary/browser/api/auto-updater/auto-updater-win.js new file mode 100644 index 0000000..cb8e6a0 --- /dev/null +++ b/electronasar/canary/browser/api/auto-updater/auto-updater-win.js @@ -0,0 +1,74 @@ +'use strict' + +const { app } = require('electron') +const { EventEmitter } = require('events') +const squirrelUpdate = require('@electron/internal/browser/api/auto-updater/squirrel-update-win') + +class AutoUpdater extends EventEmitter { + quitAndInstall () { + if (!this.updateAvailable) { + return this.emitError('No update available, can\'t quit and install') + } + squirrelUpdate.processStart() + app.quit() + } + + getFeedURL () { + return this.updateURL + } + + setFeedURL (options) { + let updateURL + if (typeof options === 'object') { + if (typeof options.url === 'string') { + updateURL = options.url + } else { + throw new Error('Expected options object to contain a \'url\' string property in setFeedUrl call') + } + } else if (typeof options === 'string') { + updateURL = options + } else { + throw new Error('Expected an options object with a \'url\' property to be provided') + } + this.updateURL = updateURL + } + + checkForUpdates () { + if (!this.updateURL) { + return this.emitError('Update URL is not set') + } + if (!squirrelUpdate.supported()) { + return this.emitError('Can not find Squirrel') + } + this.emit('checking-for-update') + squirrelUpdate.checkForUpdate(this.updateURL, (error, update) => { + if (error != null) { + return this.emitError(error) + } + if (update == null) { + return this.emit('update-not-available') + } + this.updateAvailable = true + this.emit('update-available') + squirrelUpdate.update(this.updateURL, (error) => { + if (error != null) { + return this.emitError(error) + } + const { releaseNotes, version } = update + // Date is not available on Windows, so fake it. + const date = new Date() + this.emit('update-downloaded', {}, releaseNotes, version, date, this.updateURL, () => { + this.quitAndInstall() + }) + }) + }) + } + + // Private: Emit both error object and message, this is to keep compatibility + // with Old APIs. + emitError (message) { + this.emit('error', new Error(message), message) + } +} + +module.exports = new AutoUpdater() diff --git a/electronasar/canary/browser/api/auto-updater/squirrel-update-win.js b/electronasar/canary/browser/api/auto-updater/squirrel-update-win.js new file mode 100644 index 0000000..4954c67 --- /dev/null +++ b/electronasar/canary/browser/api/auto-updater/squirrel-update-win.js @@ -0,0 +1,119 @@ +'use strict' + +const fs = require('fs') +const path = require('path') +const spawn = require('child_process').spawn + +// i.e. my-app/app-0.1.13/ +const appFolder = path.dirname(process.execPath) + +// i.e. my-app/Update.exe +const updateExe = path.resolve(appFolder, '..', 'Update.exe') +const exeName = path.basename(process.execPath) +let spawnedArgs = [] +let spawnedProcess + +const isSameArgs = (args) => args.length === spawnedArgs.length && args.every((e, i) => e === spawnedArgs[i]) + +// Spawn a command and invoke the callback when it completes with an error +// and the output from standard out. +const spawnUpdate = function (args, detached, callback) { + let error, errorEmitted, stderr, stdout + + try { + // Ensure we don't spawn multiple squirrel processes + // Process spawned, same args: Attach events to alread running process + // Process spawned, different args: Return with error + // No process spawned: Spawn new process + if (spawnedProcess && !isSameArgs(args)) { + // Disabled for backwards compatibility: + // eslint-disable-next-line standard/no-callback-literal + return callback(`AutoUpdater process with arguments ${args} is already running`) + } else if (!spawnedProcess) { + spawnedProcess = spawn(updateExe, args, { + detached: detached, + windowsHide: true + }) + spawnedArgs = args || [] + } + } catch (error1) { + error = error1 + + // Shouldn't happen, but still guard it. + process.nextTick(function () { + return callback(error) + }) + return + } + stdout = '' + stderr = '' + + spawnedProcess.stdout.on('data', (data) => { stdout += data }) + spawnedProcess.stderr.on('data', (data) => { stderr += data }) + + errorEmitted = false + spawnedProcess.on('error', (error) => { + errorEmitted = true + callback(error) + }) + + return spawnedProcess.on('exit', function (code, signal) { + spawnedProcess = undefined + spawnedArgs = [] + + // We may have already emitted an error. + if (errorEmitted) { + return + } + + // Process terminated with error. + if (code !== 0) { + // Disabled for backwards compatibility: + // eslint-disable-next-line standard/no-callback-literal + return callback(`Command failed: ${signal != null ? signal : code}\n${stderr}`) + } + + // Success. + callback(null, stdout) + }) +} + +// Start an instance of the installed app. +exports.processStart = function () { + return spawnUpdate(['--processStartAndWait', exeName], true, function () {}) +} + +// Download the releases specified by the URL and write new results to stdout. +exports.checkForUpdate = function (updateURL, callback) { + return spawnUpdate(['--checkForUpdate', updateURL], false, function (error, stdout) { + let ref, ref1, update + if (error != null) { + return callback(error) + } + try { + // Last line of output is the JSON details about the releases + const json = stdout.trim().split('\n').pop() + update = (ref = JSON.parse(json)) != null ? (ref1 = ref.releasesToApply) != null ? typeof ref1.pop === 'function' ? ref1.pop() : void 0 : void 0 : void 0 + } catch (jsonError) { + // Disabled for backwards compatibility: + // eslint-disable-next-line standard/no-callback-literal + return callback(`Invalid result:\n${stdout}`) + } + return callback(null, update) + }) +} + +// Update the application to the latest remote version specified by URL. +exports.update = function (updateURL, callback) { + return spawnUpdate(['--update', updateURL], false, callback) +} + +// Is the Update.exe installed with the current application? +exports.supported = function () { + try { + fs.accessSync(updateExe, fs.R_OK) + return true + } catch (error) { + return false + } +} diff --git a/electronasar/canary/browser/api/browser-view.js b/electronasar/canary/browser/api/browser-view.js new file mode 100644 index 0000000..0779f5f --- /dev/null +++ b/electronasar/canary/browser/api/browser-view.js @@ -0,0 +1,16 @@ +'use strict' + +const { EventEmitter } = require('events') +const { BrowserView } = process.atomBinding('browser_view') + +Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype) + +BrowserView.fromWebContents = (webContents) => { + for (const view of BrowserView.getAllViews()) { + if (view.webContents.equal(webContents)) return view + } + + return null +} + +module.exports = BrowserView diff --git a/electronasar/canary/browser/api/browser-window.js b/electronasar/canary/browser/api/browser-window.js new file mode 100644 index 0000000..7fdbf8e --- /dev/null +++ b/electronasar/canary/browser/api/browser-window.js @@ -0,0 +1,256 @@ +'use strict' + +const electron = require('electron') +const { WebContentsView, TopLevelWindow } = electron +const { BrowserWindow } = process.atomBinding('window') +const v8Util = process.atomBinding('v8_util') +const ipcMain = require('@electron/internal/browser/ipc-main-internal') + +Object.setPrototypeOf(BrowserWindow.prototype, TopLevelWindow.prototype) + +BrowserWindow.prototype._init = function () { + // Call parent class's _init. + TopLevelWindow.prototype._init.call(this) + + // Avoid recursive require. + const { app } = electron + + // Create WebContentsView. + this.setContentView(new WebContentsView(this.webContents)) + + const nativeSetBounds = this.setBounds + this.setBounds = (bounds, ...opts) => { + bounds = { + ...this.getBounds(), + ...bounds + } + nativeSetBounds.call(this, bounds, ...opts) + } + + // Make new windows requested by links behave like "window.open" + this.webContents.on('-new-window', (event, url, frameName, disposition, + additionalFeatures, postData, + referrer) => { + const options = { + show: true, + width: 800, + height: 600 + } + ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', + event, url, referrer, frameName, disposition, + options, additionalFeatures, postData) + }) + + this.webContents.on('-web-contents-created', (event, webContents, url, + frameName) => { + v8Util.setHiddenValue(webContents, 'url-framename', { url, frameName }) + }) + + // Create a new browser window for the native implementation of + // "window.open", used in sandbox and nativeWindowOpen mode + this.webContents.on('-add-new-contents', (event, webContents, disposition, + userGesture, left, top, width, + height) => { + const urlFrameName = v8Util.getHiddenValue(webContents, 'url-framename') + if ((disposition !== 'foreground-tab' && disposition !== 'new-window' && + disposition !== 'background-tab') || !urlFrameName) { + event.preventDefault() + return + } + + if (webContents.getLastWebPreferences().nodeIntegration === true) { + const message = + 'Enabling Node.js integration in child windows opened with the ' + + '"nativeWindowOpen" option will cause memory leaks, please turn off ' + + 'the "nodeIntegration" option.\\n' + + 'From 5.x child windows opened with the "nativeWindowOpen" option ' + + 'will always have Node.js integration disabled.\\n' + + 'See https://github.com/electron/electron/pull/15076 for more.' + // console is only available after DOM is created. + const printWarning = () => this.webContents.executeJavaScript(`console.warn('${message}')`) + if (this.webContents.isDomReady()) { + printWarning() + } else { + this.webContents.once('dom-ready', printWarning) + } + } + + const { url, frameName } = urlFrameName + v8Util.deleteHiddenValue(webContents, 'url-framename') + const options = { + show: true, + x: left, + y: top, + width: width || 800, + height: height || 600, + webContents: webContents + } + const referrer = { url: '', policy: 'default' } + ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', + event, url, referrer, frameName, disposition, options) + }) + + // window.resizeTo(...) + // window.moveTo(...) + this.webContents.on('move', (event, size) => { + this.setBounds(size) + }) + + // Hide the auto-hide menu when webContents is focused. + this.webContents.on('activate', () => { + if (process.platform !== 'darwin' && this.isMenuBarAutoHide() && this.isMenuBarVisible()) { + this.setMenuBarVisibility(false) + } + }) + + // Change window title to page title. + this.webContents.on('page-title-updated', (event, title) => { + // Route the event to BrowserWindow. + this.emit('page-title-updated', event, title) + if (!this.isDestroyed() && !event.defaultPrevented) this.setTitle(title) + }) + + // Sometimes the webContents doesn't get focus when window is shown, so we + // have to force focusing on webContents in this case. The safest way is to + // focus it when we first start to load URL, if we do it earlier it won't + // have effect, if we do it later we might move focus in the page. + // + // Though this hack is only needed on macOS when the app is launched from + // Finder, we still do it on all platforms in case of other bugs we don't + // know. + this.webContents.once('load-url', function () { + this.focus() + }) + + // Redirect focus/blur event to app instance too. + this.on('blur', (event) => { + app.emit('browser-window-blur', event, this) + }) + this.on('focus', (event) => { + app.emit('browser-window-focus', event, this) + }) + + // Subscribe to visibilityState changes and pass to renderer process. + let isVisible = this.isVisible() && !this.isMinimized() + const visibilityChanged = () => { + const newState = this.isVisible() && !this.isMinimized() + if (isVisible !== newState) { + isVisible = newState + const visibilityState = isVisible ? 'visible' : 'hidden' + this.webContents.emit('-window-visibility-change', visibilityState) + } + } + + const visibilityEvents = ['show', 'hide', 'minimize', 'maximize', 'restore'] + for (const event of visibilityEvents) { + this.on(event, visibilityChanged) + } + + // Notify the creation of the window. + app.emit('browser-window-created', {}, this) + + Object.defineProperty(this, 'devToolsWebContents', { + enumerable: true, + configurable: false, + get () { + return this.webContents.devToolsWebContents + } + }) +} + +const isBrowserWindow = (win) => { + return win && win.constructor.name === 'BrowserWindow' +} + +BrowserWindow.fromId = (id) => { + const win = TopLevelWindow.fromId(id) + return isBrowserWindow(win) ? win : null +} + +BrowserWindow.getAllWindows = () => { + return TopLevelWindow.getAllWindows().filter(isBrowserWindow) +} + +BrowserWindow.getFocusedWindow = () => { + for (const window of BrowserWindow.getAllWindows()) { + if (window.isFocused() || window.isDevToolsFocused()) return window + } + return null +} + +BrowserWindow.fromWebContents = (webContents) => { + for (const window of BrowserWindow.getAllWindows()) { + if (window.webContents.equal(webContents)) return window + } +} + +BrowserWindow.fromBrowserView = (browserView) => { + for (const window of BrowserWindow.getAllWindows()) { + if (window.getBrowserView() === browserView) return window + } + + return null +} + +BrowserWindow.fromDevToolsWebContents = (webContents) => { + for (const window of BrowserWindow.getAllWindows()) { + const { devToolsWebContents } = window + if (devToolsWebContents != null && devToolsWebContents.equal(webContents)) { + return window + } + } +} + +// Helpers. +Object.assign(BrowserWindow.prototype, { + loadURL (...args) { + return this.webContents.loadURL(...args) + }, + getURL (...args) { + return this.webContents.getURL() + }, + loadFile (...args) { + return this.webContents.loadFile(...args) + }, + reload (...args) { + return this.webContents.reload(...args) + }, + send (...args) { + return this.webContents.send(...args) + }, + openDevTools (...args) { + return this.webContents.openDevTools(...args) + }, + closeDevTools () { + return this.webContents.closeDevTools() + }, + isDevToolsOpened () { + return this.webContents.isDevToolsOpened() + }, + isDevToolsFocused () { + return this.webContents.isDevToolsFocused() + }, + toggleDevTools () { + return this.webContents.toggleDevTools() + }, + inspectElement (...args) { + return this.webContents.inspectElement(...args) + }, + inspectServiceWorker () { + return this.webContents.inspectServiceWorker() + }, + showDefinitionForSelection () { + return this.webContents.showDefinitionForSelection() + }, + capturePage (...args) { + return this.webContents.capturePage(...args) + }, + setTouchBar (touchBar) { + electron.TouchBar._setOnWindow(touchBar, this) + }, + setBackgroundThrottling (allowed) { + this.webContents.setBackgroundThrottling(allowed) + } +}) + +module.exports = BrowserWindow diff --git a/electronasar/canary/browser/api/content-tracing.js b/electronasar/canary/browser/api/content-tracing.js new file mode 100644 index 0000000..81bd70f --- /dev/null +++ b/electronasar/canary/browser/api/content-tracing.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = process.atomBinding('content_tracing') diff --git a/electronasar/canary/browser/api/crash-reporter.js b/electronasar/canary/browser/api/crash-reporter.js new file mode 100644 index 0000000..a963be8 --- /dev/null +++ b/electronasar/canary/browser/api/crash-reporter.js @@ -0,0 +1,14 @@ +'use strict' + +const CrashReporter = require('@electron/internal/common/crash-reporter') +const ipcMain = require('@electron/internal/browser/ipc-main-internal') + +class CrashReporterMain extends CrashReporter { + sendSync (channel, ...args) { + const event = {} + ipcMain.emit(channel, event, ...args) + return event.returnValue + } +} + +module.exports = new CrashReporterMain() diff --git a/electronasar/canary/browser/api/dialog.js b/electronasar/canary/browser/api/dialog.js new file mode 100644 index 0000000..861f0a0 --- /dev/null +++ b/electronasar/canary/browser/api/dialog.js @@ -0,0 +1,311 @@ +'use strict' + +const { app, BrowserWindow } = require('electron') +const binding = process.atomBinding('dialog') +const v8Util = process.atomBinding('v8_util') + +const fileDialogProperties = { + openFile: 1 << 0, + openDirectory: 1 << 1, + multiSelections: 1 << 2, + createDirectory: 1 << 3, + showHiddenFiles: 1 << 4, + promptToCreate: 1 << 5, + noResolveAliases: 1 << 6, + treatPackageAsDirectory: 1 << 7 +} + +const messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'] + +const messageBoxOptions = { + noLink: 1 << 0 +} + +const parseArgs = function (window, options, callback, ...args) { + if (window != null && window.constructor !== BrowserWindow) { + // Shift. + [callback, options, window] = [options, window, null] + } + + if ((callback == null) && typeof options === 'function') { + // Shift. + [callback, options] = [options, null] + } + + // Fallback to using very last argument as the callback function + const lastArgument = args[args.length - 1] + if ((callback == null) && typeof lastArgument === 'function') { + callback = lastArgument + } + + return [window, options, callback] +} + +const normalizeAccessKey = (text) => { + if (typeof text !== 'string') return text + + // macOS does not have access keys so remove single ampersands + // and replace double ampersands with a single ampersand + if (process.platform === 'darwin') { + return text.replace(/&(&?)/g, '$1') + } + + // Linux uses a single underscore as an access key prefix so escape + // existing single underscores with a second underscore, replace double + // ampersands with a single ampersand, and replace a single ampersand with + // a single underscore + if (process.platform === 'linux') { + return text.replace(/_/g, '__').replace(/&(.?)/g, (match, after) => { + if (after === '&') return after + return `_${after}` + }) + } + + return text +} + +const checkAppInitialized = function () { + if (!app.isReady()) { + throw new Error('dialog module can only be used after app is ready') + } +} + +module.exports = { + showOpenDialog: function (...args) { + checkAppInitialized() + + let [window, options, callback] = parseArgs(...args) + + if (options == null) { + options = { + title: 'Open', + properties: ['openFile'] + } + } + + let { buttonLabel, defaultPath, filters, properties, title, message, securityScopedBookmarks = false } = options + + if (properties == null) { + properties = ['openFile'] + } else if (!Array.isArray(properties)) { + throw new TypeError('Properties must be an array') + } + + let dialogProperties = 0 + for (const prop in fileDialogProperties) { + if (properties.includes(prop)) { + dialogProperties |= fileDialogProperties[prop] + } + } + + if (title == null) { + title = '' + } else if (typeof title !== 'string') { + throw new TypeError('Title must be a string') + } + + if (buttonLabel == null) { + buttonLabel = '' + } else if (typeof buttonLabel !== 'string') { + throw new TypeError('Button label must be a string') + } + + if (defaultPath == null) { + defaultPath = '' + } else if (typeof defaultPath !== 'string') { + throw new TypeError('Default path must be a string') + } + + if (filters == null) { + filters = [] + } + + if (message == null) { + message = '' + } else if (typeof message !== 'string') { + throw new TypeError('Message must be a string') + } + + const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) { + return success ? callback(result, bookmarkData) : callback() + } : null + const settings = { title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, window } + settings.properties = dialogProperties + return binding.showOpenDialog(settings, wrappedCallback) + }, + + showSaveDialog: function (...args) { + checkAppInitialized() + + let [window, options, callback] = parseArgs(...args) + + if (options == null) { + options = { + title: 'Save' + } + } + + let { buttonLabel, defaultPath, filters, title, message, securityScopedBookmarks = false, nameFieldLabel, showsTagField } = options + + if (title == null) { + title = '' + } else if (typeof title !== 'string') { + throw new TypeError('Title must be a string') + } + + if (buttonLabel == null) { + buttonLabel = '' + } else if (typeof buttonLabel !== 'string') { + throw new TypeError('Button label must be a string') + } + + if (defaultPath == null) { + defaultPath = '' + } else if (typeof defaultPath !== 'string') { + throw new TypeError('Default path must be a string') + } + + if (filters == null) { + filters = [] + } + + if (message == null) { + message = '' + } else if (typeof message !== 'string') { + throw new TypeError('Message must be a string') + } + + if (nameFieldLabel == null) { + nameFieldLabel = '' + } else if (typeof nameFieldLabel !== 'string') { + throw new TypeError('Name field label must be a string') + } + + if (showsTagField == null) { + showsTagField = true + } + + const wrappedCallback = typeof callback === 'function' ? function (success, result, bookmarkData) { + return success ? callback(result, bookmarkData) : callback() + } : null + const settings = { title, buttonLabel, defaultPath, filters, message, securityScopedBookmarks, nameFieldLabel, showsTagField, window } + return binding.showSaveDialog(settings, wrappedCallback) + }, + + showMessageBox: function (...args) { + checkAppInitialized() + + let [window, options, callback] = parseArgs(...args) + + if (options == null) { + options = { + type: 'none' + } + } + + let { + buttons, cancelId, checkboxLabel, checkboxChecked, defaultId, detail, + icon, message, title, type + } = options + + if (type == null) { + type = 'none' + } + + const messageBoxType = messageBoxTypes.indexOf(type) + if (messageBoxType === -1) { + throw new TypeError('Invalid message box type') + } + + if (buttons == null) { + buttons = [] + } else if (!Array.isArray(buttons)) { + throw new TypeError('Buttons must be an array') + } + + if (options.normalizeAccessKeys) { + buttons = buttons.map(normalizeAccessKey) + } + + if (title == null) { + title = '' + } else if (typeof title !== 'string') { + throw new TypeError('Title must be a string') + } + + if (message == null) { + message = '' + } else if (typeof message !== 'string') { + throw new TypeError('Message must be a string') + } + + if (detail == null) { + detail = '' + } else if (typeof detail !== 'string') { + throw new TypeError('Detail must be a string') + } + + checkboxChecked = !!checkboxChecked + + if (checkboxLabel == null) { + checkboxLabel = '' + } else if (typeof checkboxLabel !== 'string') { + throw new TypeError('checkboxLabel must be a string') + } + + if (icon == null) { + icon = null + } + + if (defaultId == null) { + defaultId = -1 + } + + // Choose a default button to get selected when dialog is cancelled. + if (cancelId == null) { + cancelId = 0 + for (let i = 0; i < buttons.length; i++) { + const text = buttons[i].toLowerCase() + if (text === 'cancel' || text === 'no') { + cancelId = i + break + } + } + } + + const flags = options.noLink ? messageBoxOptions.noLink : 0 + return binding.showMessageBox(messageBoxType, buttons, defaultId, cancelId, + flags, title, message, detail, checkboxLabel, + checkboxChecked, icon, window, callback) + }, + + showErrorBox: function (...args) { + return binding.showErrorBox(...args) + }, + + showCertificateTrustDialog: function (...args) { + const [window, options, callback] = parseArgs(...args) + + if (options == null || typeof options !== 'object') { + throw new TypeError('options must be an object') + } + + let { certificate, message } = options + if (certificate == null || typeof certificate !== 'object') { + throw new TypeError('certificate must be an object') + } + + if (message == null) { + message = '' + } else if (typeof message !== 'string') { + throw new TypeError('message must be a string') + } + + return binding.showCertificateTrustDialog(window, certificate, message, callback) + } +} + +// Mark standard asynchronous functions. +v8Util.setHiddenValue(module.exports.showMessageBox, 'asynchronous', true) +v8Util.setHiddenValue(module.exports.showOpenDialog, 'asynchronous', true) +v8Util.setHiddenValue(module.exports.showSaveDialog, 'asynchronous', true) diff --git a/electronasar/canary/browser/api/exports/electron.js b/electronasar/canary/browser/api/exports/electron.js new file mode 100644 index 0000000..0cf6c26 --- /dev/null +++ b/electronasar/canary/browser/api/exports/electron.js @@ -0,0 +1,15 @@ +'use strict' + +const common = require('@electron/internal/common/api/exports/electron') +// since browser module list is also used in renderer, keep it separate. +const moduleList = require('@electron/internal/browser/api/module-list') + +// Import common modules. +common.defineProperties(exports) + +for (const module of moduleList) { + Object.defineProperty(exports, module.name, { + enumerable: !module.private, + get: common.memoizedGetter(() => require(`@electron/internal/browser/api/${module.file}.js`)) + }) +} diff --git a/electronasar/canary/browser/api/global-shortcut.js b/electronasar/canary/browser/api/global-shortcut.js new file mode 100644 index 0000000..ec9878e --- /dev/null +++ b/electronasar/canary/browser/api/global-shortcut.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = process.atomBinding('global_shortcut').globalShortcut diff --git a/electronasar/canary/browser/api/in-app-purchase.js b/electronasar/canary/browser/api/in-app-purchase.js new file mode 100644 index 0000000..95f4589 --- /dev/null +++ b/electronasar/canary/browser/api/in-app-purchase.js @@ -0,0 +1,20 @@ +'use strict' + +if (process.platform === 'darwin') { + const { EventEmitter } = require('events') + const { inAppPurchase, InAppPurchase } = process.atomBinding('in_app_purchase') + + // inAppPurchase is an EventEmitter. + Object.setPrototypeOf(InAppPurchase.prototype, EventEmitter.prototype) + EventEmitter.call(inAppPurchase) + + module.exports = inAppPurchase +} else { + module.exports = { + purchaseProduct: (productID, quantity, callback) => { + throw new Error('The inAppPurchase module can only be used on macOS') + }, + canMakePayments: () => false, + getReceiptURL: () => '' + } +} diff --git a/electronasar/canary/browser/api/ipc-main.js b/electronasar/canary/browser/api/ipc-main.js new file mode 100644 index 0000000..9ab9569 --- /dev/null +++ b/electronasar/canary/browser/api/ipc-main.js @@ -0,0 +1,10 @@ +'use strict' + +const { EventEmitter } = require('events') + +const emitter = new EventEmitter() + +// Do not throw exception when channel name is "error". +emitter.on('error', () => {}) + +module.exports = emitter diff --git a/electronasar/canary/browser/api/menu-item-roles.js b/electronasar/canary/browser/api/menu-item-roles.js new file mode 100644 index 0000000..61c6226 --- /dev/null +++ b/electronasar/canary/browser/api/menu-item-roles.js @@ -0,0 +1,296 @@ +'use strict' + +const { app } = require('electron') + +const roles = { + about: { + get label () { + return process.platform === 'linux' ? 'About' : `About ${app.getName()}` + } + }, + close: { + label: process.platform === 'darwin' ? 'Close Window' : 'Close', + accelerator: 'CommandOrControl+W', + windowMethod: 'close' + }, + copy: { + label: 'Copy', + accelerator: 'CommandOrControl+C', + webContentsMethod: 'copy', + registerAccelerator: false + }, + cut: { + label: 'Cut', + accelerator: 'CommandOrControl+X', + webContentsMethod: 'cut', + registerAccelerator: false + }, + delete: { + label: 'Delete', + webContentsMethod: 'delete' + }, + forcereload: { + label: 'Force Reload', + accelerator: 'Shift+CmdOrCtrl+R', + nonNativeMacOSRole: true, + windowMethod: (window) => { + window.webContents.reloadIgnoringCache() + } + }, + front: { + label: 'Bring All to Front' + }, + help: { + label: 'Help' + }, + hide: { + get label () { + return `Hide ${app.getName()}` + }, + accelerator: 'Command+H' + }, + hideothers: { + label: 'Hide Others', + accelerator: 'Command+Alt+H' + }, + minimize: { + label: 'Minimize', + accelerator: 'CommandOrControl+M', + windowMethod: 'minimize' + }, + paste: { + label: 'Paste', + accelerator: 'CommandOrControl+V', + webContentsMethod: 'paste', + registerAccelerator: false + }, + pasteandmatchstyle: { + label: 'Paste and Match Style', + accelerator: 'Shift+CommandOrControl+V', + webContentsMethod: 'pasteAndMatchStyle', + registerAccelerator: false + }, + quit: { + get label () { + switch (process.platform) { + case 'darwin': return `Quit ${app.getName()}` + case 'win32': return 'Exit' + default: return 'Quit' + } + }, + accelerator: process.platform === 'win32' ? null : 'CommandOrControl+Q', + appMethod: 'quit' + }, + redo: { + label: 'Redo', + accelerator: process.platform === 'win32' ? 'Control+Y' : 'Shift+CommandOrControl+Z', + webContentsMethod: 'redo' + }, + reload: { + label: 'Reload', + accelerator: 'CmdOrCtrl+R', + nonNativeMacOSRole: true, + windowMethod: 'reload' + }, + resetzoom: { + label: 'Actual Size', + accelerator: 'CommandOrControl+0', + nonNativeMacOSRole: true, + webContentsMethod: (webContents) => { + webContents.setZoomLevel(0) + } + }, + selectall: { + label: 'Select All', + accelerator: 'CommandOrControl+A', + webContentsMethod: 'selectAll' + }, + services: { + label: 'Services' + }, + recentdocuments: { + label: 'Open Recent' + }, + clearrecentdocuments: { + label: 'Clear Menu' + }, + startspeaking: { + label: 'Start Speaking' + }, + stopspeaking: { + label: 'Stop Speaking' + }, + toggledevtools: { + label: 'Toggle Developer Tools', + accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I', + nonNativeMacOSRole: true, + windowMethod: 'toggleDevTools' + }, + togglefullscreen: { + label: 'Toggle Full Screen', + accelerator: process.platform === 'darwin' ? 'Control+Command+F' : 'F11', + windowMethod: (window) => { + window.setFullScreen(!window.isFullScreen()) + } + }, + undo: { + label: 'Undo', + accelerator: 'CommandOrControl+Z', + webContentsMethod: 'undo' + }, + unhide: { + label: 'Show All' + }, + window: { + label: 'Window' + }, + zoom: { + label: 'Zoom' + }, + zoomin: { + label: 'Zoom In', + accelerator: 'CommandOrControl+Plus', + nonNativeMacOSRole: true, + webContentsMethod: (webContents) => { + webContents.getZoomLevel((zoomLevel) => { + webContents.setZoomLevel(zoomLevel + 0.5) + }) + } + }, + zoomout: { + label: 'Zoom Out', + accelerator: 'CommandOrControl+-', + nonNativeMacOSRole: true, + webContentsMethod: (webContents) => { + webContents.getZoomLevel((zoomLevel) => { + webContents.setZoomLevel(zoomLevel - 0.5) + }) + } + }, + // Edit submenu (should fit both Mac & Windows) + editmenu: { + label: 'Edit', + submenu: [ + { + role: 'undo' + }, + { + role: 'redo' + }, + { + type: 'separator' + }, + { + role: 'cut' + }, + { + role: 'copy' + }, + { + role: 'paste' + }, + + process.platform === 'darwin' ? { + role: 'pasteAndMatchStyle' + } : null, + + { + role: 'delete' + }, + + process.platform === 'win32' ? { + type: 'separator' + } : null, + + { + role: 'selectAll' + } + ] + }, + + // Window submenu should be used for Mac only + windowmenu: { + label: 'Window', + submenu: [ + { + role: 'minimize' + }, + { + role: 'close' + }, + + process.platform === 'darwin' ? { + type: 'separator' + } : null, + + process.platform === 'darwin' ? { + role: 'front' + } : null + + ] + } +} + +const canExecuteRole = (role) => { + if (!roles.hasOwnProperty(role)) return false + if (process.platform !== 'darwin') return true + + // macOS handles all roles natively except for a few + return roles[role].nonNativeMacOSRole +} + +exports.getDefaultLabel = (role) => { + return roles.hasOwnProperty(role) ? roles[role].label : '' +} + +exports.getDefaultAccelerator = (role) => { + if (roles.hasOwnProperty(role)) return roles[role].accelerator +} + +exports.shouldRegisterAccelerator = (role) => { + return roles.hasOwnProperty(role) ? roles[role].registerAccelerator : true +} + +exports.getDefaultSubmenu = (role) => { + if (!roles.hasOwnProperty(role)) return + + let { submenu } = roles[role] + + // remove null items from within the submenu + if (Array.isArray(submenu)) { + submenu = submenu.filter((item) => item != null) + } + + return submenu +} + +exports.execute = (role, focusedWindow, focusedWebContents) => { + if (!canExecuteRole(role)) return false + + const { appMethod, webContentsMethod, windowMethod } = roles[role] + + if (appMethod) { + app[appMethod]() + return true + } + + if (windowMethod && focusedWindow != null) { + if (typeof windowMethod === 'function') { + windowMethod(focusedWindow) + } else { + focusedWindow[windowMethod]() + } + return true + } + + if (webContentsMethod && focusedWebContents != null) { + if (typeof webContentsMethod === 'function') { + webContentsMethod(focusedWebContents) + } else { + focusedWebContents[webContentsMethod]() + } + return true + } + + return false +} diff --git a/electronasar/canary/browser/api/menu-item.js b/electronasar/canary/browser/api/menu-item.js new file mode 100644 index 0000000..33388cb --- /dev/null +++ b/electronasar/canary/browser/api/menu-item.js @@ -0,0 +1,85 @@ +'use strict' + +const roles = require('@electron/internal/browser/api/menu-item-roles') + +let nextCommandId = 0 + +const MenuItem = function (options) { + const { Menu } = require('electron') + + // Preserve extra fields specified by user + for (const key in options) { + if (!(key in this)) this[key] = options[key] + } + if (typeof this.role === 'string' || this.role instanceof String) { + this.role = this.role.toLowerCase() + } + this.submenu = this.submenu || roles.getDefaultSubmenu(this.role) + if (this.submenu != null && this.submenu.constructor !== Menu) { + this.submenu = Menu.buildFromTemplate(this.submenu) + } + if (this.type == null && this.submenu != null) { + this.type = 'submenu' + } + if (this.type === 'submenu' && (this.submenu == null || this.submenu.constructor !== Menu)) { + throw new Error('Invalid submenu') + } + + this.overrideReadOnlyProperty('type', 'normal') + this.overrideReadOnlyProperty('role') + this.overrideReadOnlyProperty('accelerator') + this.overrideReadOnlyProperty('icon') + this.overrideReadOnlyProperty('submenu') + + this.overrideProperty('label', roles.getDefaultLabel(this.role)) + this.overrideProperty('sublabel', '') + this.overrideProperty('enabled', true) + this.overrideProperty('visible', true) + this.overrideProperty('checked', false) + this.overrideProperty('registerAccelerator', roles.shouldRegisterAccelerator(this.role)) + + if (!MenuItem.types.includes(this.type)) { + throw new Error(`Unknown menu item type: ${this.type}`) + } + + this.overrideReadOnlyProperty('commandId', ++nextCommandId) + + const click = options.click + this.click = (event, focusedWindow, focusedWebContents) => { + // Manually flip the checked flags when clicked. + if (this.type === 'checkbox' || this.type === 'radio') { + this.checked = !this.checked + } + + if (!roles.execute(this.role, focusedWindow, focusedWebContents)) { + if (typeof click === 'function') { + click(this, focusedWindow, event) + } else if (typeof this.selector === 'string' && process.platform === 'darwin') { + Menu.sendActionToFirstResponder(this.selector) + } + } + } +} + +MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio'] + +MenuItem.prototype.getDefaultRoleAccelerator = function () { + return roles.getDefaultAccelerator(this.role) +} + +MenuItem.prototype.overrideProperty = function (name, defaultValue = null) { + if (this[name] == null) { + this[name] = defaultValue + } +} + +MenuItem.prototype.overrideReadOnlyProperty = function (name, defaultValue) { + this.overrideProperty(name, defaultValue) + Object.defineProperty(this, name, { + enumerable: true, + writable: false, + value: this[name] + }) +} + +module.exports = MenuItem diff --git a/electronasar/canary/browser/api/menu-utils.js b/electronasar/canary/browser/api/menu-utils.js new file mode 100644 index 0000000..42636bf --- /dev/null +++ b/electronasar/canary/browser/api/menu-utils.js @@ -0,0 +1,176 @@ +'use strict' + +function splitArray (arr, predicate) { + const result = arr.reduce((multi, item) => { + const current = multi[multi.length - 1] + if (predicate(item)) { + if (current.length > 0) multi.push([]) + } else { + current.push(item) + } + return multi + }, [[]]) + + if (result[result.length - 1].length === 0) { + return result.slice(0, result.length - 1) + } + return result +} + +function joinArrays (arrays, joinIDs) { + return arrays.reduce((joined, arr, i) => { + if (i > 0 && arr.length) { + if (joinIDs.length > 0) { + joined.push(joinIDs[0]) + joinIDs.splice(0, 1) + } else { + joined.push({ type: 'separator' }) + } + } + return joined.concat(arr) + }, []) +} + +function pushOntoMultiMap (map, key, value) { + if (!map.has(key)) { + map.set(key, []) + } + map.get(key).push(value) +} + +function indexOfGroupContainingID (groups, id, ignoreGroup) { + return groups.findIndex( + candidateGroup => + candidateGroup !== ignoreGroup && + candidateGroup.some( + candidateItem => candidateItem.id === id + ) + ) +} + +// Sort nodes topologically using a depth-first approach. Encountered cycles +// are broken. +function sortTopologically (originalOrder, edgesById) { + const sorted = [] + const marked = new Set() + + const visit = (mark) => { + if (marked.has(mark)) return + marked.add(mark) + const edges = edgesById.get(mark) + if (edges != null) { + edges.forEach(visit) + } + sorted.push(mark) + } + + originalOrder.forEach(visit) + return sorted +} + +function attemptToMergeAGroup (groups) { + for (let i = 0; i < groups.length; i++) { + const group = groups[i] + for (const item of group) { + const toIDs = [...(item.before || []), ...(item.after || [])] + for (const id of toIDs) { + const index = indexOfGroupContainingID(groups, id, group) + if (index === -1) continue + const mergeTarget = groups[index] + + mergeTarget.push(...group) + groups.splice(i, 1) + return true + } + } + } + return false +} + +function mergeGroups (groups) { + let merged = true + while (merged) { + merged = attemptToMergeAGroup(groups) + } + return groups +} + +function sortItemsInGroup (group) { + const originalOrder = group.map((node, i) => i) + const edges = new Map() + const idToIndex = new Map(group.map((item, i) => [item.id, i])) + + group.forEach((item, i) => { + if (item.before) { + item.before.forEach(toID => { + const to = idToIndex.get(toID) + if (to != null) { + pushOntoMultiMap(edges, to, i) + } + }) + } + if (item.after) { + item.after.forEach(toID => { + const to = idToIndex.get(toID) + if (to != null) { + pushOntoMultiMap(edges, i, to) + } + }) + } + }) + + const sortedNodes = sortTopologically(originalOrder, edges) + return sortedNodes.map(i => group[i]) +} + +function findEdgesInGroup (groups, i, edges) { + const group = groups[i] + for (const item of group) { + if (item.beforeGroupContaining) { + for (const id of item.beforeGroupContaining) { + const to = indexOfGroupContainingID(groups, id, group) + if (to !== -1) { + pushOntoMultiMap(edges, to, i) + return + } + } + } + if (item.afterGroupContaining) { + for (const id of item.afterGroupContaining) { + const to = indexOfGroupContainingID(groups, id, group) + if (to !== -1) { + pushOntoMultiMap(edges, i, to) + return + } + } + } + } +} + +function sortGroups (groups) { + const originalOrder = groups.map((item, i) => i) + const edges = new Map() + + for (let i = 0; i < groups.length; i++) { + findEdgesInGroup(groups, i, edges) + } + + const sortedGroupIndexes = sortTopologically(originalOrder, edges) + return sortedGroupIndexes.map(i => groups[i]) +} + +function sortMenuItems (menuItems) { + const isSeparator = (item) => item.type === 'separator' + const separators = menuItems.filter(i => i.type === 'separator') + + // Split the items into their implicit groups based upon separators. + const groups = splitArray(menuItems, isSeparator) + const mergedGroups = mergeGroups(groups) + const mergedGroupsWithSortedItems = mergedGroups.map(sortItemsInGroup) + const sortedGroups = sortGroups(mergedGroupsWithSortedItems) + + const joined = joinArrays(sortedGroups, separators) + return joined +} + +module.exports = { sortMenuItems } diff --git a/electronasar/canary/browser/api/menu.js b/electronasar/canary/browser/api/menu.js new file mode 100644 index 0000000..14fcaba --- /dev/null +++ b/electronasar/canary/browser/api/menu.js @@ -0,0 +1,258 @@ +'use strict' + +const { TopLevelWindow, MenuItem, webContents } = require('electron') +const { sortMenuItems } = require('@electron/internal/browser/api/menu-utils') +const EventEmitter = require('events').EventEmitter +const v8Util = process.atomBinding('v8_util') +const bindings = process.atomBinding('menu') + +const { Menu } = bindings +let applicationMenu = null +let groupIdIndex = 0 + +Object.setPrototypeOf(Menu.prototype, EventEmitter.prototype) + +// Menu Delegate. +// This object should hold no reference to |Menu| to avoid cyclic reference. +const delegate = { + isCommandIdChecked: (menu, id) => menu.commandsMap[id] ? menu.commandsMap[id].checked : undefined, + isCommandIdEnabled: (menu, id) => menu.commandsMap[id] ? menu.commandsMap[id].enabled : undefined, + isCommandIdVisible: (menu, id) => menu.commandsMap[id] ? menu.commandsMap[id].visible : undefined, + getAcceleratorForCommandId: (menu, id, useDefaultAccelerator) => { + const command = menu.commandsMap[id] + if (!command) return + if (command.accelerator != null) return command.accelerator + if (useDefaultAccelerator) return command.getDefaultRoleAccelerator() + }, + shouldRegisterAcceleratorForCommandId: (menu, id) => menu.commandsMap[id] ? menu.commandsMap[id].registerAccelerator : undefined, + executeCommand: (menu, event, id) => { + const command = menu.commandsMap[id] + if (!command) return + command.click(event, TopLevelWindow.getFocusedWindow(), webContents.getFocusedWebContents()) + }, + menuWillShow: (menu) => { + // Ensure radio groups have at least one menu item seleted + for (const id in menu.groupsMap) { + const found = menu.groupsMap[id].find(item => item.checked) || null + if (!found) v8Util.setHiddenValue(menu.groupsMap[id][0], 'checked', true) + } + } +} + +/* Instance Methods */ + +Menu.prototype._init = function () { + this.commandsMap = {} + this.groupsMap = {} + this.items = [] + this.delegate = delegate +} + +Menu.prototype.popup = function (options = {}) { + if (options == null || typeof options !== 'object') { + throw new TypeError('Options must be an object') + } + let { window, x, y, positioningItem, callback } = options + + // no callback passed + if (!callback || typeof callback !== 'function') callback = () => {} + + // set defaults + if (typeof x !== 'number') x = -1 + if (typeof y !== 'number') y = -1 + if (typeof positioningItem !== 'number') positioningItem = -1 + + // find which window to use + const wins = TopLevelWindow.getAllWindows() + if (!wins || wins.indexOf(window) === -1) { + window = TopLevelWindow.getFocusedWindow() + if (!window && wins && wins.length > 0) { + window = wins[0] + } + if (!window) { + throw new Error(`Cannot open Menu without a TopLevelWindow present`) + } + } + + this.popupAt(window, x, y, positioningItem, callback) + return { browserWindow: window, x, y, position: positioningItem } +} + +Menu.prototype.closePopup = function (window) { + if (window instanceof TopLevelWindow) { + this.closePopupAt(window.id) + } else { + // Passing -1 (invalid) would make closePopupAt close the all menu runners + // belong to this menu. + this.closePopupAt(-1) + } +} + +Menu.prototype.getMenuItemById = function (id) { + const items = this.items + + let found = items.find(item => item.id === id) || null + for (let i = 0; !found && i < items.length; i++) { + if (items[i].submenu) { + found = items[i].submenu.getMenuItemById(id) + } + } + return found +} + +Menu.prototype.append = function (item) { + return this.insert(this.getItemCount(), item) +} + +Menu.prototype.insert = function (pos, item) { + if ((item ? item.constructor : void 0) !== MenuItem) { + throw new TypeError('Invalid item') + } + + // insert item depending on its type + insertItemByType.call(this, item, pos) + + // set item properties + if (item.sublabel) this.setSublabel(pos, item.sublabel) + if (item.icon) this.setIcon(pos, item.icon) + if (item.role) this.setRole(pos, item.role) + + // Make menu accessable to items. + item.overrideReadOnlyProperty('menu', this) + + // Remember the items. + this.items.splice(pos, 0, item) + this.commandsMap[item.commandId] = item +} + +Menu.prototype._callMenuWillShow = function () { + if (this.delegate) this.delegate.menuWillShow(this) + this.items.forEach(item => { + if (item.submenu) item.submenu._callMenuWillShow() + }) +} + +/* Static Methods */ + +Menu.getApplicationMenu = () => applicationMenu + +Menu.sendActionToFirstResponder = bindings.sendActionToFirstResponder + +// set application menu with a preexisting menu +Menu.setApplicationMenu = function (menu) { + if (menu && menu.constructor !== Menu) { + throw new TypeError('Invalid menu') + } + + applicationMenu = menu + if (process.platform === 'darwin') { + if (!menu) return + menu._callMenuWillShow() + bindings.setApplicationMenu(menu) + } else { + const windows = TopLevelWindow.getAllWindows() + return windows.map(w => w.setMenu(menu)) + } +} + +Menu.buildFromTemplate = function (template) { + if (!Array.isArray(template)) { + throw new TypeError('Invalid template for Menu: Menu template must be an array') + } + const menu = new Menu() + if (!areValidTemplateItems(template)) { + throw new TypeError('Invalid template for MenuItem: must have at least one of label, role or type') + } + const filtered = removeExtraSeparators(template) + const sorted = sortTemplate(filtered) + + sorted.forEach((item) => menu.append(new MenuItem(item))) + + return menu +} + +/* Helper Functions */ + +// validate the template against having the wrong attribute +function areValidTemplateItems (template) { + return template.every(item => + item != null && typeof item === 'object' && (item.hasOwnProperty('label') || item.hasOwnProperty('role') || item.type === 'separator')) +} + +function sortTemplate (template) { + const sorted = sortMenuItems(template) + for (const id in sorted) { + const item = sorted[id] + if (Array.isArray(item.submenu)) { + item.submenu = sortTemplate(item.submenu) + } + } + return sorted +} + +// Search between separators to find a radio menu item and return its group id +function generateGroupId (items, pos) { + if (pos > 0) { + for (let idx = pos - 1; idx >= 0; idx--) { + if (items[idx].type === 'radio') return items[idx].groupId + if (items[idx].type === 'separator') break + } + } else if (pos < items.length) { + for (let idx = pos; idx <= items.length - 1; idx++) { + if (items[idx].type === 'radio') return items[idx].groupId + if (items[idx].type === 'separator') break + } + } + groupIdIndex += 1 + return groupIdIndex +} + +function removeExtraSeparators (items) { + // fold adjacent separators together + let ret = items.filter((e, idx, arr) => { + if (e.visible === false) return true + return e.type !== 'separator' || idx === 0 || arr[idx - 1].type !== 'separator' + }) + + // remove edge separators + ret = ret.filter((e, idx, arr) => { + if (e.visible === false) return true + return e.type !== 'separator' || (idx !== 0 && idx !== arr.length - 1) + }) + + return ret +} + +function insertItemByType (item, pos) { + const types = { + normal: () => this.insertItem(pos, item.commandId, item.label), + checkbox: () => this.insertCheckItem(pos, item.commandId, item.label), + separator: () => this.insertSeparator(pos), + submenu: () => this.insertSubMenu(pos, item.commandId, item.label, item.submenu), + radio: () => { + // Grouping radio menu items + item.overrideReadOnlyProperty('groupId', generateGroupId(this.items, pos)) + if (this.groupsMap[item.groupId] == null) { + this.groupsMap[item.groupId] = [] + } + this.groupsMap[item.groupId].push(item) + + // Setting a radio menu item should flip other items in the group. + v8Util.setHiddenValue(item, 'checked', item.checked) + Object.defineProperty(item, 'checked', { + enumerable: true, + get: () => v8Util.getHiddenValue(item, 'checked'), + set: () => { + this.groupsMap[item.groupId].forEach(other => { + if (other !== item) v8Util.setHiddenValue(other, 'checked', false) + }) + v8Util.setHiddenValue(item, 'checked', true) + } + }) + this.insertRadioItem(pos, item.commandId, item.label, item.groupId) + } + } + types[item.type]() +} + +module.exports = Menu diff --git a/electronasar/canary/browser/api/module-list.js b/electronasar/canary/browser/api/module-list.js new file mode 100644 index 0000000..8ec7bda --- /dev/null +++ b/electronasar/canary/browser/api/module-list.js @@ -0,0 +1,46 @@ +'use strict' + +const features = process.atomBinding('features') + +// Browser side modules, please sort alphabetically. +module.exports = [ + { name: 'app', file: 'app' }, + { name: 'autoUpdater', file: 'auto-updater' }, + { name: 'BrowserView', file: 'browser-view' }, + { name: 'BrowserWindow', file: 'browser-window' }, + { name: 'contentTracing', file: 'content-tracing' }, + { name: 'crashReporter', file: 'crash-reporter' }, + { name: 'dialog', file: 'dialog' }, + { name: 'globalShortcut', file: 'global-shortcut' }, + { name: 'ipcMain', file: 'ipc-main' }, + { name: 'inAppPurchase', file: 'in-app-purchase' }, + { name: 'Menu', file: 'menu' }, + { name: 'MenuItem', file: 'menu-item' }, + { name: 'net', file: 'net' }, + { name: 'netLog', file: 'net-log' }, + { name: 'Notification', file: 'notification' }, + { name: 'powerMonitor', file: 'power-monitor' }, + { name: 'powerSaveBlocker', file: 'power-save-blocker' }, + { name: 'protocol', file: 'protocol' }, + { name: 'screen', file: 'screen' }, + { name: 'session', file: 'session' }, + { name: 'systemPreferences', file: 'system-preferences' }, + { name: 'TopLevelWindow', file: 'top-level-window' }, + { name: 'TouchBar', file: 'touch-bar' }, + { name: 'Tray', file: 'tray' }, + { name: 'View', file: 'view' }, + { name: 'webContents', file: 'web-contents' }, + { name: 'WebContentsView', file: 'web-contents-view' }, + // The internal modules, invisible unless you know their names. + { name: 'NavigationController', file: 'navigation-controller', private: true } +] + +if (features.isViewApiEnabled()) { + module.exports.push( + { name: 'BoxLayout', file: 'views/box-layout' }, + { name: 'Button', file: 'views/button' }, + { name: 'LabelButton', file: 'views/label-button' }, + { name: 'LayoutManager', file: 'views/layout-manager' }, + { name: 'TextField', file: 'views/text-field' } + ) +} diff --git a/electronasar/canary/browser/api/navigation-controller.js b/electronasar/canary/browser/api/navigation-controller.js new file mode 100644 index 0000000..1863961 --- /dev/null +++ b/electronasar/canary/browser/api/navigation-controller.js @@ -0,0 +1,171 @@ +'use strict' + +const ipcMain = require('@electron/internal/browser/ipc-main-internal') + +// The history operation in renderer is redirected to browser. +ipcMain.on('ELECTRON_NAVIGATION_CONTROLLER', function (event, method, ...args) { + event.sender[method](...args) +}) + +ipcMain.on('ELECTRON_SYNC_NAVIGATION_CONTROLLER', function (event, method, ...args) { + event.returnValue = event.sender[method](...args) +}) + +// JavaScript implementation of Chromium's NavigationController. +// Instead of relying on Chromium for history control, we compeletely do history +// control on user land, and only rely on WebContents.loadURL for navigation. +// This helps us avoid Chromium's various optimizations so we can ensure renderer +// process is restarted everytime. +const NavigationController = (function () { + function NavigationController (webContents) { + this.webContents = webContents + this.clearHistory() + + // webContents may have already navigated to a page. + if (this.webContents._getURL()) { + this.currentIndex++ + this.history.push(this.webContents._getURL()) + } + this.webContents.on('navigation-entry-commited', (event, url, inPage, replaceEntry) => { + if (this.inPageIndex > -1 && !inPage) { + // Navigated to a new page, clear in-page mark. + this.inPageIndex = -1 + } else if (this.inPageIndex === -1 && inPage && !replaceEntry) { + // Started in-page navigations. + this.inPageIndex = this.currentIndex + } + if (this.pendingIndex >= 0) { + // Go to index. + this.currentIndex = this.pendingIndex + this.pendingIndex = -1 + this.history[this.currentIndex] = url + } else if (replaceEntry) { + // Non-user initialized navigation. + this.history[this.currentIndex] = url + } else { + // Normal navigation. Clear history. + this.history = this.history.slice(0, this.currentIndex + 1) + this.currentIndex++ + this.history.push(url) + } + }) + } + + NavigationController.prototype.loadURL = function (url, options) { + if (options == null) { + options = {} + } + this.pendingIndex = -1 + this.webContents._loadURL(url, options) + return this.webContents.emit('load-url', url, options) + } + + NavigationController.prototype.getURL = function () { + if (this.currentIndex === -1) { + return '' + } else { + return this.history[this.currentIndex] + } + } + + NavigationController.prototype.stop = function () { + this.pendingIndex = -1 + return this.webContents._stop() + } + + NavigationController.prototype.reload = function () { + this.pendingIndex = this.currentIndex + return this.webContents._loadURL(this.getURL(), {}) + } + + NavigationController.prototype.reloadIgnoringCache = function () { + this.pendingIndex = this.currentIndex + return this.webContents._loadURL(this.getURL(), { + extraHeaders: 'pragma: no-cache\n' + }) + } + + NavigationController.prototype.canGoBack = function () { + return this.getActiveIndex() > 0 + } + + NavigationController.prototype.canGoForward = function () { + return this.getActiveIndex() < this.history.length - 1 + } + + NavigationController.prototype.canGoToIndex = function (index) { + return index >= 0 && index < this.history.length + } + + NavigationController.prototype.canGoToOffset = function (offset) { + return this.canGoToIndex(this.currentIndex + offset) + } + + NavigationController.prototype.clearHistory = function () { + this.history = [] + this.currentIndex = -1 + this.pendingIndex = -1 + this.inPageIndex = -1 + } + + NavigationController.prototype.goBack = function () { + if (!this.canGoBack()) { + return + } + this.pendingIndex = this.getActiveIndex() - 1 + if (this.inPageIndex > -1 && this.pendingIndex >= this.inPageIndex) { + return this.webContents._goBack() + } else { + return this.webContents._loadURL(this.history[this.pendingIndex], {}) + } + } + + NavigationController.prototype.goForward = function () { + if (!this.canGoForward()) { + return + } + this.pendingIndex = this.getActiveIndex() + 1 + if (this.inPageIndex > -1 && this.pendingIndex >= this.inPageIndex) { + return this.webContents._goForward() + } else { + return this.webContents._loadURL(this.history[this.pendingIndex], {}) + } + } + + NavigationController.prototype.goToIndex = function (index) { + if (!this.canGoToIndex(index)) { + return + } + this.pendingIndex = index + return this.webContents._loadURL(this.history[this.pendingIndex], {}) + } + + NavigationController.prototype.goToOffset = function (offset) { + if (!this.canGoToOffset(offset)) { + return + } + const pendingIndex = this.currentIndex + offset + if (this.inPageIndex > -1 && pendingIndex >= this.inPageIndex) { + this.pendingIndex = pendingIndex + return this.webContents._goToOffset(offset) + } else { + return this.goToIndex(pendingIndex) + } + } + + NavigationController.prototype.getActiveIndex = function () { + if (this.pendingIndex === -1) { + return this.currentIndex + } else { + return this.pendingIndex + } + } + + NavigationController.prototype.length = function () { + return this.history.length + } + + return NavigationController +})() + +module.exports = NavigationController diff --git a/electronasar/canary/browser/api/net-log.js b/electronasar/canary/browser/api/net-log.js new file mode 100644 index 0000000..1649c63 --- /dev/null +++ b/electronasar/canary/browser/api/net-log.js @@ -0,0 +1,28 @@ +'use strict' + +// TODO(deepak1556): Deprecate and remove standalone netLog module, +// it is now a property of sessio module. +const { app, session } = require('electron') + +// Fallback to default session. +Object.setPrototypeOf(module.exports, new Proxy({}, { + get (target, property) { + if (!app.isReady()) return + + const netLog = session.defaultSession.netLog + if (!Object.getPrototypeOf(netLog).hasOwnProperty(property)) return + + // Returning a native function directly would throw error. + return (...args) => netLog[property](...args) + }, + + ownKeys () { + if (!app.isReady()) return [] + + return Object.getOwnPropertyNames(Object.getPrototypeOf(session.defaultSession.netLog)) + }, + + getOwnPropertyDescriptor (target) { + return { configurable: true, enumerable: true } + } +})) diff --git a/electronasar/canary/browser/api/net.js b/electronasar/canary/browser/api/net.js new file mode 100644 index 0000000..0d8cb71 --- /dev/null +++ b/electronasar/canary/browser/api/net.js @@ -0,0 +1,372 @@ +'use strict' + +const url = require('url') +const { EventEmitter } = require('events') +const { Readable } = require('stream') +const { app } = require('electron') +const { Session } = process.atomBinding('session') +const { net, Net } = process.atomBinding('net') +const { URLRequest } = net + +// Net is an EventEmitter. +Object.setPrototypeOf(Net.prototype, EventEmitter.prototype) +EventEmitter.call(net) + +Object.setPrototypeOf(URLRequest.prototype, EventEmitter.prototype) + +const kSupportedProtocols = new Set(['http:', 'https:']) + +class IncomingMessage extends Readable { + constructor (urlRequest) { + super() + this.urlRequest = urlRequest + this.shouldPush = false + this.data = [] + this.urlRequest.on('data', (event, chunk) => { + this._storeInternalData(chunk) + this._pushInternalData() + }) + this.urlRequest.on('end', () => { + this._storeInternalData(null) + this._pushInternalData() + }) + } + + get statusCode () { + return this.urlRequest.statusCode + } + + get statusMessage () { + return this.urlRequest.statusMessage + } + + get headers () { + return this.urlRequest.rawResponseHeaders + } + + get httpVersion () { + return `${this.httpVersionMajor}.${this.httpVersionMinor}` + } + + get httpVersionMajor () { + return this.urlRequest.httpVersionMajor + } + + get httpVersionMinor () { + return this.urlRequest.httpVersionMinor + } + + get rawTrailers () { + throw new Error('HTTP trailers are not supported.') + } + + get trailers () { + throw new Error('HTTP trailers are not supported.') + } + + _storeInternalData (chunk) { + this.data.push(chunk) + } + + _pushInternalData () { + while (this.shouldPush && this.data.length > 0) { + const chunk = this.data.shift() + this.shouldPush = this.push(chunk) + } + } + + _read () { + this.shouldPush = true + this._pushInternalData() + } +} + +URLRequest.prototype._emitRequestEvent = function (isAsync, ...rest) { + if (isAsync) { + process.nextTick(() => { + this.clientRequest.emit(...rest) + }) + } else { + this.clientRequest.emit(...rest) + } +} + +URLRequest.prototype._emitResponseEvent = function (isAsync, ...rest) { + if (isAsync) { + process.nextTick(() => { + this._response.emit(...rest) + }) + } else { + this._response.emit(...rest) + } +} + +class ClientRequest extends EventEmitter { + constructor (options, callback) { + super() + + if (!app.isReady()) { + throw new Error('net module can only be used after app is ready') + } + + if (typeof options === 'string') { + options = url.parse(options) + } else { + options = Object.assign({}, options) + } + + const method = (options.method || 'GET').toUpperCase() + let urlStr = options.url + + if (!urlStr) { + const urlObj = {} + const protocol = options.protocol || 'http:' + if (!kSupportedProtocols.has(protocol)) { + throw new Error('Protocol "' + protocol + '" not supported. ') + } + urlObj.protocol = protocol + + if (options.host) { + urlObj.host = options.host + } else { + if (options.hostname) { + urlObj.hostname = options.hostname + } else { + urlObj.hostname = 'localhost' + } + + if (options.port) { + urlObj.port = options.port + } + } + + if (options.path && / /.test(options.path)) { + // The actual regex is more like /[^A-Za-z0-9\-._~!$&'()*+,;=/:@]/ + // with an additional rule for ignoring percentage-escaped characters + // but that's a) hard to capture in a regular expression that performs + // well, and b) possibly too restrictive for real-world usage. That's + // why it only scans for spaces because those are guaranteed to create + // an invalid request. + throw new TypeError('Request path contains unescaped characters.') + } + const pathObj = url.parse(options.path || '/') + urlObj.pathname = pathObj.pathname + urlObj.search = pathObj.search + urlObj.hash = pathObj.hash + urlStr = url.format(urlObj) + } + + const redirectPolicy = options.redirect || 'follow' + if (!['follow', 'error', 'manual'].includes(redirectPolicy)) { + throw new Error('redirect mode should be one of follow, error or manual') + } + + const urlRequestOptions = { + method: method, + url: urlStr, + redirect: redirectPolicy + } + if (options.session) { + if (options.session instanceof Session) { + urlRequestOptions.session = options.session + } else { + throw new TypeError('`session` should be an instance of the Session class.') + } + } else if (options.partition) { + if (typeof options.partition === 'string') { + urlRequestOptions.partition = options.partition + } else { + throw new TypeError('`partition` should be an a string.') + } + } + + const urlRequest = new URLRequest(urlRequestOptions) + + // Set back and forward links. + this.urlRequest = urlRequest + urlRequest.clientRequest = this + + // This is a copy of the extra headers structure held by the native + // net::URLRequest. The main reason is to keep the getHeader API synchronous + // after the request starts. + this.extraHeaders = {} + + if (options.headers) { + for (const key in options.headers) { + this.setHeader(key, options.headers[key]) + } + } + + // Set when the request uses chunked encoding. Can be switched + // to true only once and never set back to false. + this.chunkedEncodingEnabled = false + + urlRequest.on('response', () => { + const response = new IncomingMessage(urlRequest) + urlRequest._response = response + this.emit('response', response) + }) + + urlRequest.on('login', (event, authInfo, callback) => { + this.emit('login', authInfo, (username, password) => { + // If null or undefined username/password, force to empty string. + if (username === null || username === undefined) { + username = '' + } + if (typeof username !== 'string') { + throw new Error('username must be a string') + } + if (password === null || password === undefined) { + password = '' + } + if (typeof password !== 'string') { + throw new Error('password must be a string') + } + callback(username, password) + }) + }) + + if (callback) { + this.once('response', callback) + } + } + + get chunkedEncoding () { + return this.chunkedEncodingEnabled + } + + set chunkedEncoding (value) { + if (!this.urlRequest.notStarted) { + throw new Error('Can\'t set the transfer encoding, headers have been sent.') + } + this.chunkedEncodingEnabled = value + } + + setHeader (name, value) { + if (typeof name !== 'string') { + throw new TypeError('`name` should be a string in setHeader(name, value).') + } + if (value == null) { + throw new Error('`value` required in setHeader("' + name + '", value).') + } + if (!this.urlRequest.notStarted) { + throw new Error('Can\'t set headers after they are sent.') + } + + const key = name.toLowerCase() + this.extraHeaders[key] = value + this.urlRequest.setExtraHeader(name, value.toString()) + } + + getHeader (name) { + if (name == null) { + throw new Error('`name` is required for getHeader(name).') + } + + if (!this.extraHeaders) { + return + } + + const key = name.toLowerCase() + return this.extraHeaders[key] + } + + removeHeader (name) { + if (name == null) { + throw new Error('`name` is required for removeHeader(name).') + } + + if (!this.urlRequest.notStarted) { + throw new Error('Can\'t remove headers after they are sent.') + } + + const key = name.toLowerCase() + delete this.extraHeaders[key] + this.urlRequest.removeExtraHeader(name) + } + + _write (chunk, encoding, callback, isLast) { + const chunkIsString = typeof chunk === 'string' + const chunkIsBuffer = chunk instanceof Buffer + if (!chunkIsString && !chunkIsBuffer) { + throw new TypeError('First argument must be a string or Buffer.') + } + + if (chunkIsString) { + // We convert all strings into binary buffers. + chunk = Buffer.from(chunk, encoding) + } + + // Since writing to the network is asynchronous, we conservatively + // assume that request headers are written after delivering the first + // buffer to the network IO thread. + if (this.urlRequest.notStarted) { + this.urlRequest.setChunkedUpload(this.chunkedEncoding) + } + + // Headers are assumed to be sent on first call to _writeBuffer, + // i.e. after the first call to write or end. + const result = this.urlRequest.write(chunk, isLast) + + // The write callback is fired asynchronously to mimic Node.js. + if (callback) { + process.nextTick(callback) + } + + return result + } + + write (data, encoding, callback) { + if (this.urlRequest.finished) { + const error = new Error('Write after end.') + process.nextTick(writeAfterEndNT, this, error, callback) + return true + } + + return this._write(data, encoding, callback, false) + } + + end (data, encoding, callback) { + if (this.urlRequest.finished) { + return false + } + + if (typeof data === 'function') { + callback = data + encoding = null + data = null + } else if (typeof encoding === 'function') { + callback = encoding + encoding = null + } + + data = data || '' + + return this._write(data, encoding, callback, true) + } + + followRedirect () { + this.urlRequest.followRedirect() + } + + abort () { + this.urlRequest.cancel() + } + + getUploadProgress () { + return this.urlRequest.getUploadProgress() + } +} + +function writeAfterEndNT (self, error, callback) { + self.emit('error', error) + if (callback) callback(error) +} + +Net.prototype.request = function (options, callback) { + return new ClientRequest(options, callback) +} + +net.ClientRequest = ClientRequest + +module.exports = net diff --git a/electronasar/canary/browser/api/notification.js b/electronasar/canary/browser/api/notification.js new file mode 100644 index 0000000..cc2374c --- /dev/null +++ b/electronasar/canary/browser/api/notification.js @@ -0,0 +1,10 @@ +'use strict' + +const { EventEmitter } = require('events') +const { Notification, isSupported } = process.atomBinding('notification') + +Object.setPrototypeOf(Notification.prototype, EventEmitter.prototype) + +Notification.isSupported = isSupported + +module.exports = Notification diff --git a/electronasar/canary/browser/api/power-monitor.js b/electronasar/canary/browser/api/power-monitor.js new file mode 100644 index 0000000..5e3371d --- /dev/null +++ b/electronasar/canary/browser/api/power-monitor.js @@ -0,0 +1,25 @@ +'use strict' + +const { EventEmitter } = require('events') +const { powerMonitor, PowerMonitor } = process.atomBinding('power_monitor') + +// PowerMonitor is an EventEmitter. +Object.setPrototypeOf(PowerMonitor.prototype, EventEmitter.prototype) +EventEmitter.call(powerMonitor) + +// On Linux we need to call blockShutdown() to subscribe to shutdown event. +if (process.platform === 'linux') { + powerMonitor.on('newListener', (event) => { + if (event === 'shutdown' && powerMonitor.listenerCount('shutdown') === 0) { + powerMonitor.blockShutdown() + } + }) + + powerMonitor.on('removeListener', (event) => { + if (event === 'shutdown' && powerMonitor.listenerCount('shutdown') === 0) { + powerMonitor.unblockShutdown() + } + }) +} + +module.exports = powerMonitor diff --git a/electronasar/canary/browser/api/power-save-blocker.js b/electronasar/canary/browser/api/power-save-blocker.js new file mode 100644 index 0000000..964ead8 --- /dev/null +++ b/electronasar/canary/browser/api/power-save-blocker.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = process.atomBinding('power_save_blocker').powerSaveBlocker diff --git a/electronasar/canary/browser/api/protocol.js b/electronasar/canary/browser/api/protocol.js new file mode 100644 index 0000000..0f1b0e6 --- /dev/null +++ b/electronasar/canary/browser/api/protocol.js @@ -0,0 +1,29 @@ +'use strict' + +const { app, session } = require('electron') + +// Global protocol APIs. +module.exports = process.atomBinding('protocol') + +// Fallback protocol APIs of default session. +Object.setPrototypeOf(module.exports, new Proxy({}, { + get (target, property) { + if (!app.isReady()) return + + const protocol = session.defaultSession.protocol + if (!Object.getPrototypeOf(protocol).hasOwnProperty(property)) return + + // Returning a native function directly would throw error. + return (...args) => protocol[property](...args) + }, + + ownKeys () { + if (!app.isReady()) return [] + + return Object.getOwnPropertyNames(Object.getPrototypeOf(session.defaultSession.protocol)) + }, + + getOwnPropertyDescriptor (target) { + return { configurable: true, enumerable: true } + } +})) diff --git a/electronasar/canary/browser/api/screen.js b/electronasar/canary/browser/api/screen.js new file mode 100644 index 0000000..a91df7d --- /dev/null +++ b/electronasar/canary/browser/api/screen.js @@ -0,0 +1,10 @@ +'use strict' + +const { EventEmitter } = require('events') +const { screen, Screen } = process.atomBinding('screen') + +// Screen is an EventEmitter. +Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype) +EventEmitter.call(screen) + +module.exports = screen diff --git a/electronasar/canary/browser/api/session.js b/electronasar/canary/browser/api/session.js new file mode 100644 index 0000000..08c10ee --- /dev/null +++ b/electronasar/canary/browser/api/session.js @@ -0,0 +1,24 @@ +'use strict' + +const { EventEmitter } = require('events') +const { app } = require('electron') +const { fromPartition, Session, Cookies } = process.atomBinding('session') + +// Public API. +Object.defineProperties(exports, { + defaultSession: { + enumerable: true, + get () { return fromPartition('') } + }, + fromPartition: { + enumerable: true, + value: fromPartition + } +}) + +Object.setPrototypeOf(Session.prototype, EventEmitter.prototype) +Object.setPrototypeOf(Cookies.prototype, EventEmitter.prototype) + +Session.prototype._init = function () { + app.emit('session-created', this) +} diff --git a/electronasar/canary/browser/api/system-preferences.js b/electronasar/canary/browser/api/system-preferences.js new file mode 100644 index 0000000..bb663e8 --- /dev/null +++ b/electronasar/canary/browser/api/system-preferences.js @@ -0,0 +1,10 @@ +'use strict' + +const { EventEmitter } = require('events') +const { systemPreferences, SystemPreferences } = process.atomBinding('system_preferences') + +// SystemPreferences is an EventEmitter. +Object.setPrototypeOf(SystemPreferences.prototype, EventEmitter.prototype) +EventEmitter.call(systemPreferences) + +module.exports = systemPreferences diff --git a/electronasar/canary/browser/api/top-level-window.js b/electronasar/canary/browser/api/top-level-window.js new file mode 100644 index 0000000..c7770ad --- /dev/null +++ b/electronasar/canary/browser/api/top-level-window.js @@ -0,0 +1,24 @@ +'use strict' + +const electron = require('electron') +const { EventEmitter } = require('events') +const { TopLevelWindow } = process.atomBinding('top_level_window') + +Object.setPrototypeOf(TopLevelWindow.prototype, EventEmitter.prototype) + +TopLevelWindow.prototype._init = function () { + // Avoid recursive require. + const { app } = electron + + // Simulate the application menu on platforms other than macOS. + if (process.platform !== 'darwin') { + const menu = app.getApplicationMenu() + if (menu) this.setMenu(menu) + } +} + +TopLevelWindow.getFocusedWindow = () => { + return TopLevelWindow.getAllWindows().find((win) => win.isFocused()) +} + +module.exports = TopLevelWindow diff --git a/electronasar/canary/browser/api/touch-bar.js b/electronasar/canary/browser/api/touch-bar.js new file mode 100644 index 0000000..ddacc73 --- /dev/null +++ b/electronasar/canary/browser/api/touch-bar.js @@ -0,0 +1,343 @@ +'use strict' + +const { EventEmitter } = require('events') + +let nextItemID = 1 + +class TouchBar extends EventEmitter { + // Bind a touch bar to a window + static _setOnWindow (touchBar, window) { + if (window._touchBar != null) { + window._touchBar._removeFromWindow(window) + } + + if (touchBar == null) { + window._setTouchBarItems([]) + return + } + + if (Array.isArray(touchBar)) { + touchBar = new TouchBar(touchBar) + } + touchBar._addToWindow(window) + } + + constructor (options) { + super() + + if (options == null) { + throw new Error('Must specify options object as first argument') + } + + let { items, escapeItem } = options + + // FIXME Support array as first argument, remove in 2.0 + if (Array.isArray(options)) { + items = options + escapeItem = null + } + + if (!Array.isArray(items)) { + items = [] + } + + this.changeListener = (item) => { + this.emit('change', item.id, item.type) + } + + this.windowListeners = {} + this.items = {} + this.ordereredItems = [] + this.escapeItem = escapeItem + + const registerItem = (item) => { + this.items[item.id] = item + item.on('change', this.changeListener) + if (item.child instanceof TouchBar) { + item.child.ordereredItems.forEach(registerItem) + } + } + items.forEach((item) => { + if (!(item instanceof TouchBarItem)) { + throw new Error('Each item must be an instance of TouchBarItem') + } + this.ordereredItems.push(item) + registerItem(item) + }) + } + + set escapeItem (item) { + if (item != null && !(item instanceof TouchBarItem)) { + throw new Error('Escape item must be an instance of TouchBarItem') + } + if (this.escapeItem != null) { + this.escapeItem.removeListener('change', this.changeListener) + } + this._escapeItem = item + if (this.escapeItem != null) { + this.escapeItem.on('change', this.changeListener) + } + this.emit('escape-item-change', item) + } + + get escapeItem () { + return this._escapeItem + } + + _addToWindow (window) { + const { id } = window + + // Already added to window + if (this.windowListeners.hasOwnProperty(id)) return + + window._touchBar = this + + const changeListener = (itemID) => { + window._refreshTouchBarItem(itemID) + } + this.on('change', changeListener) + + const escapeItemListener = (item) => { + window._setEscapeTouchBarItem(item != null ? item : {}) + } + this.on('escape-item-change', escapeItemListener) + + const interactionListener = (event, itemID, details) => { + let item = this.items[itemID] + if (item == null && this.escapeItem != null && this.escapeItem.id === itemID) { + item = this.escapeItem + } + if (item != null && item.onInteraction != null) { + item.onInteraction(details) + } + } + window.on('-touch-bar-interaction', interactionListener) + + const removeListeners = () => { + this.removeListener('change', changeListener) + this.removeListener('escape-item-change', escapeItemListener) + window.removeListener('-touch-bar-interaction', interactionListener) + window.removeListener('closed', removeListeners) + window._touchBar = null + delete this.windowListeners[id] + const unregisterItems = (items) => { + for (const item of items) { + item.removeListener('change', this.changeListener) + if (item.child instanceof TouchBar) { + unregisterItems(item.child.ordereredItems) + } + } + } + unregisterItems(this.ordereredItems) + if (this.escapeItem) { + this.escapeItem.removeListener('change', this.changeListener) + } + } + window.once('closed', removeListeners) + this.windowListeners[id] = removeListeners + + window._setTouchBarItems(this.ordereredItems) + escapeItemListener(this.escapeItem) + } + + _removeFromWindow (window) { + const removeListeners = this.windowListeners[window.id] + if (removeListeners != null) removeListeners() + } +} + +class TouchBarItem extends EventEmitter { + constructor () { + super() + this._addImmutableProperty('id', `${nextItemID++}`) + this._parents = [] + } + + _addImmutableProperty (name, value) { + Object.defineProperty(this, name, { + get: function () { + return value + }, + set: function () { + throw new Error(`Cannot override property ${name}`) + }, + enumerable: true, + configurable: false + }) + } + + _addLiveProperty (name, initialValue) { + const privateName = `_${name}` + this[privateName] = initialValue + Object.defineProperty(this, name, { + get: function () { + return this[privateName] + }, + set: function (value) { + this[privateName] = value + this.emit('change', this) + }, + enumerable: true + }) + } + + _addParent (item) { + const existing = this._parents.some(test => test.id === item.id) + if (!existing) { + this._parents.push({ + id: item.id, + type: item.type + }) + } + } +} + +TouchBar.TouchBarButton = class TouchBarButton extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + this._addImmutableProperty('type', 'button') + const { click, icon, iconPosition, label, backgroundColor } = config + this._addLiveProperty('label', label) + this._addLiveProperty('backgroundColor', backgroundColor) + this._addLiveProperty('icon', icon) + this._addLiveProperty('iconPosition', iconPosition) + if (typeof click === 'function') { + this._addImmutableProperty('onInteraction', () => { + config.click() + }) + } + } +} + +TouchBar.TouchBarColorPicker = class TouchBarColorPicker extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + this._addImmutableProperty('type', 'colorpicker') + const { availableColors, change, selectedColor } = config + this._addLiveProperty('availableColors', availableColors) + this._addLiveProperty('selectedColor', selectedColor) + + if (typeof change === 'function') { + this._addImmutableProperty('onInteraction', (details) => { + this._selectedColor = details.color + change(details.color) + }) + } + } +} + +TouchBar.TouchBarGroup = class TouchBarGroup extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + this._addImmutableProperty('type', 'group') + const defaultChild = (config.items instanceof TouchBar) ? config.items : new TouchBar(config.items) + this._addLiveProperty('child', defaultChild) + this.child.ordereredItems.forEach((item) => item._addParent(this)) + } +} + +TouchBar.TouchBarLabel = class TouchBarLabel extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + this._addImmutableProperty('type', 'label') + this._addLiveProperty('label', config.label) + this._addLiveProperty('textColor', config.textColor) + } +} + +TouchBar.TouchBarPopover = class TouchBarPopover extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + this._addImmutableProperty('type', 'popover') + this._addLiveProperty('label', config.label) + this._addLiveProperty('icon', config.icon) + this._addLiveProperty('showCloseButton', config.showCloseButton) + const defaultChild = (config.items instanceof TouchBar) ? config.items : new TouchBar(config.items) + this._addLiveProperty('child', defaultChild) + this.child.ordereredItems.forEach((item) => item._addParent(this)) + } +} + +TouchBar.TouchBarSlider = class TouchBarSlider extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + this._addImmutableProperty('type', 'slider') + const { change, label, minValue, maxValue, value } = config + this._addLiveProperty('label', label) + this._addLiveProperty('minValue', minValue) + this._addLiveProperty('maxValue', maxValue) + this._addLiveProperty('value', value) + + if (typeof change === 'function') { + this._addImmutableProperty('onInteraction', (details) => { + this._value = details.value + change(details.value) + }) + } + } +} + +TouchBar.TouchBarSpacer = class TouchBarSpacer extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + this._addImmutableProperty('type', 'spacer') + this._addImmutableProperty('size', config.size) + } +} + +TouchBar.TouchBarSegmentedControl = class TouchBarSegmentedControl extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + const { segmentStyle, segments, selectedIndex, change, mode } = config + this._addImmutableProperty('type', 'segmented_control') + this._addLiveProperty('segmentStyle', segmentStyle) + this._addLiveProperty('segments', segments || []) + this._addLiveProperty('selectedIndex', selectedIndex) + this._addLiveProperty('mode', mode) + + if (typeof change === 'function') { + this._addImmutableProperty('onInteraction', (details) => { + this._selectedIndex = details.selectedIndex + change(details.selectedIndex, details.isSelected) + }) + } + } +} + +TouchBar.TouchBarScrubber = class TouchBarScrubber extends TouchBarItem { + constructor (config) { + super() + if (config == null) config = {} + const { items, selectedStyle, overlayStyle, showArrowButtons, continuous, mode } = config + let { select, highlight } = config + this._addImmutableProperty('type', 'scrubber') + this._addLiveProperty('items', items) + this._addLiveProperty('selectedStyle', selectedStyle || null) + this._addLiveProperty('overlayStyle', overlayStyle || null) + this._addLiveProperty('showArrowButtons', showArrowButtons || false) + this._addLiveProperty('mode', mode || 'free') + this._addLiveProperty('continuous', typeof continuous === 'undefined' ? true : continuous) + + if (typeof select === 'function' || typeof highlight === 'function') { + if (select == null) select = () => {} + if (highlight == null) highlight = () => {} + this._addImmutableProperty('onInteraction', (details) => { + if (details.type === 'select' && typeof select === 'function') { + select(details.selectedIndex) + } else if (details.type === 'highlight' && typeof highlight === 'function') { + highlight(details.highlightedIndex) + } + }) + } + } +} + +module.exports = TouchBar diff --git a/electronasar/canary/browser/api/tray.js b/electronasar/canary/browser/api/tray.js new file mode 100644 index 0000000..1c6c108 --- /dev/null +++ b/electronasar/canary/browser/api/tray.js @@ -0,0 +1,8 @@ +'use strict' + +const { EventEmitter } = require('events') +const { Tray } = process.atomBinding('tray') + +Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype) + +module.exports = Tray diff --git a/electronasar/canary/browser/api/view.js b/electronasar/canary/browser/api/view.js new file mode 100644 index 0000000..cf39f8b --- /dev/null +++ b/electronasar/canary/browser/api/view.js @@ -0,0 +1,11 @@ +'use strict' + +const { EventEmitter } = require('events') +const { View } = process.atomBinding('view') + +Object.setPrototypeOf(View.prototype, EventEmitter.prototype) + +View.prototype._init = function () { +} + +module.exports = View diff --git a/electronasar/canary/browser/api/web-contents-view.js b/electronasar/canary/browser/api/web-contents-view.js new file mode 100644 index 0000000..89f36e8 --- /dev/null +++ b/electronasar/canary/browser/api/web-contents-view.js @@ -0,0 +1,15 @@ +'use strict' + +const electron = require('electron') + +const { View } = electron +const { WebContentsView } = process.atomBinding('web_contents_view') + +Object.setPrototypeOf(WebContentsView.prototype, View.prototype) + +WebContentsView.prototype._init = function () { + // Call parent class's _init. + View.prototype._init.call(this) +} + +module.exports = WebContentsView diff --git a/electronasar/canary/browser/api/web-contents.js b/electronasar/canary/browser/api/web-contents.js new file mode 100644 index 0000000..c5d923e --- /dev/null +++ b/electronasar/canary/browser/api/web-contents.js @@ -0,0 +1,420 @@ +'use strict' + +const features = process.atomBinding('features') +const { EventEmitter } = require('events') +const electron = require('electron') +const path = require('path') +const url = require('url') +const { app, ipcMain, session, NavigationController, deprecate } = electron + +const ipcMainInternal = require('@electron/internal/browser/ipc-main-internal') +const errorUtils = require('@electron/internal/common/error-utils') + +// session is not used here, the purpose is to make sure session is initalized +// before the webContents module. +// eslint-disable-next-line +session + +let nextId = 0 +const getNextId = function () { + return ++nextId +} + +// Stock page sizes +const PDFPageSizes = { + A5: { + custom_display_name: 'A5', + height_microns: 210000, + name: 'ISO_A5', + width_microns: 148000 + }, + A4: { + custom_display_name: 'A4', + height_microns: 297000, + name: 'ISO_A4', + is_default: 'true', + width_microns: 210000 + }, + A3: { + custom_display_name: 'A3', + height_microns: 420000, + name: 'ISO_A3', + width_microns: 297000 + }, + Legal: { + custom_display_name: 'Legal', + height_microns: 355600, + name: 'NA_LEGAL', + width_microns: 215900 + }, + Letter: { + custom_display_name: 'Letter', + height_microns: 279400, + name: 'NA_LETTER', + width_microns: 215900 + }, + Tabloid: { + height_microns: 431800, + name: 'NA_LEDGER', + width_microns: 279400, + custom_display_name: 'Tabloid' + } +} + +// Default printing setting +const defaultPrintingSetting = { + pageRage: [], + mediaSize: {}, + landscape: false, + color: 2, + headerFooterEnabled: false, + marginsType: 0, + isFirstRequest: false, + requestID: getNextId(), + previewUIID: 0, + previewModifiable: true, + printToPDF: true, + printWithCloudPrint: false, + printWithPrivet: false, + printWithExtension: false, + deviceName: 'Save as PDF', + generateDraftData: true, + fitToPageEnabled: false, + scaleFactor: 1, + dpiHorizontal: 72, + dpiVertical: 72, + rasterizePDF: false, + duplex: 0, + copies: 1, + collate: true, + shouldPrintBackgrounds: false, + shouldPrintSelectionOnly: false +} + +// JavaScript implementations of WebContents. +const binding = process.atomBinding('web_contents') +const { WebContents } = binding + +Object.setPrototypeOf(NavigationController.prototype, EventEmitter.prototype) +Object.setPrototypeOf(WebContents.prototype, NavigationController.prototype) + +// WebContents::send(channel, args..) +// WebContents::sendToAll(channel, args..) +WebContents.prototype.send = function (channel, ...args) { + if (typeof channel !== 'string') { + throw new Error('Missing required channel argument') + } + + const internal = false + const sendToAll = false + + return this._send(internal, sendToAll, channel, args) +} +WebContents.prototype.sendToAll = function (channel, ...args) { + if (typeof channel !== 'string') { + throw new Error('Missing required channel argument') + } + + const internal = false + const sendToAll = true + + return this._send(internal, sendToAll, channel, args) +} + +WebContents.prototype._sendInternal = function (channel, ...args) { + if (typeof channel !== 'string') { + throw new Error('Missing required channel argument') + } + + const internal = true + const sendToAll = false + + return this._send(internal, sendToAll, channel, args) +} +WebContents.prototype._sendInternalToAll = function (channel, ...args) { + if (typeof channel !== 'string') { + throw new Error('Missing required channel argument') + } + + const internal = true + const sendToAll = true + + return this._send(internal, sendToAll, channel, args) +} + +// Following methods are mapped to webFrame. +const webFrameMethods = [ + 'insertCSS', + 'insertText', + 'setLayoutZoomLevelLimits', + 'setVisualZoomLevelLimits' +] + +const asyncWebFrameMethods = function (requestId, method, callback, ...args) { + return new Promise((resolve, reject) => { + ipcMainInternal.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, error, result) { + if (error == null) { + if (typeof callback === 'function') callback(result) + resolve(result) + } else { + reject(errorUtils.deserialize(error)) + } + }) + this._sendInternal('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args) + }) +} + +for (const method of webFrameMethods) { + WebContents.prototype[method] = function (...args) { + this._sendInternal('ELECTRON_INTERNAL_RENDERER_WEB_FRAME_METHOD', method, args) + } +} + +// Make sure WebContents::executeJavaScript would run the code only when the +// WebContents has been loaded. +WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callback) { + const requestId = getNextId() + + if (typeof hasUserGesture === 'function') { + // Shift. + callback = hasUserGesture + hasUserGesture = null + } + + if (hasUserGesture == null) { + hasUserGesture = false + } + + if (this.getURL() && !this.isLoadingMainFrame()) { + return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture) + } else { + return new Promise((resolve, reject) => { + this.once('did-stop-loading', () => { + asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture).then(resolve).catch(reject) + }) + }) + } +} + +WebContents.prototype.takeHeapSnapshot = function (filePath) { + return new Promise((resolve, reject) => { + const channel = `ELECTRON_TAKE_HEAP_SNAPSHOT_RESULT_${getNextId()}` + ipcMain.once(channel, (event, success) => { + if (success) { + resolve() + } else { + reject(new Error('takeHeapSnapshot failed')) + } + }) + if (!this._takeHeapSnapshot(filePath, channel)) { + ipcMain.emit(channel, false) + } + }) +} + +// Translate the options of printToPDF. +WebContents.prototype.printToPDF = function (options, callback) { + const printingSetting = Object.assign({}, defaultPrintingSetting) + if (options.landscape) { + printingSetting.landscape = options.landscape + } + if (options.marginsType) { + printingSetting.marginsType = options.marginsType + } + if (options.printSelectionOnly) { + printingSetting.shouldPrintSelectionOnly = options.printSelectionOnly + } + if (options.printBackground) { + printingSetting.shouldPrintBackgrounds = options.printBackground + } + + if (options.pageSize) { + const pageSize = options.pageSize + if (typeof pageSize === 'object') { + if (!pageSize.height || !pageSize.width) { + return callback(new Error('Must define height and width for pageSize')) + } + // Dimensions in Microns + // 1 meter = 10^6 microns + printingSetting.mediaSize = { + name: 'CUSTOM', + custom_display_name: 'Custom', + height_microns: Math.ceil(pageSize.height), + width_microns: Math.ceil(pageSize.width) + } + } else if (PDFPageSizes[pageSize]) { + printingSetting.mediaSize = PDFPageSizes[pageSize] + } else { + return callback(new Error(`Does not support pageSize with ${pageSize}`)) + } + } else { + printingSetting.mediaSize = PDFPageSizes['A4'] + } + + // Chromium expects this in a 0-100 range number, not as float + printingSetting.scaleFactor *= 100 + if (features.isPrintingEnabled()) { + this._printToPDF(printingSetting, callback) + } else { + console.error('Error: Printing feature is disabled.') + } +} + +WebContents.prototype.print = function (...args) { + if (features.isPrintingEnabled()) { + this._print(args) + } else { + console.error('Error: Printing feature is disabled.') + } +} + +WebContents.prototype.getPrinters = function () { + if (features.isPrintingEnabled()) { + return this._getPrinters() + } else { + console.error('Error: Printing feature is disabled.') + } +} + +WebContents.prototype.getZoomLevel = function (callback) { + if (typeof callback !== 'function') { + throw new Error('Must pass function as an argument') + } + process.nextTick(() => { + const zoomLevel = this._getZoomLevel() + callback(zoomLevel) + }) +} + +WebContents.prototype.loadFile = function (filePath, options = {}) { + if (typeof filePath !== 'string') { + throw new Error('Must pass filePath as a string') + } + const { query, search, hash } = options + + return this.loadURL(url.format({ + protocol: 'file', + slashes: true, + pathname: path.resolve(app.getAppPath(), filePath), + query, + search, + hash + })) +} + +WebContents.prototype.getZoomFactor = function (callback) { + if (typeof callback !== 'function') { + throw new Error('Must pass function as an argument') + } + process.nextTick(() => { + const zoomFactor = this._getZoomFactor() + callback(zoomFactor) + }) +} + +WebContents.prototype.findInPage = function (text, options = {}) { + // TODO (nitsakh): Remove in 5.0 + if (options.wordStart != null || options.medialCapitalAtWordStart != null) { + deprecate.log('wordStart and medialCapitalAtWordStart options are deprecated') + } + return this._findInPage(text, options) +} + +// Add JavaScript wrappers for WebContents class. +WebContents.prototype._init = function () { + // The navigation controller. + NavigationController.call(this, this) + + // Every remote callback from renderer process would add a listenter to the + // render-view-deleted event, so ignore the listenters warning. + this.setMaxListeners(0) + + // Dispatch IPC messages to the ipc module. + this.on('ipc-message', function (event, [channel, ...args]) { + ipcMain.emit(channel, event, ...args) + }) + this.on('ipc-message-sync', function (event, [channel, ...args]) { + Object.defineProperty(event, 'returnValue', { + set: function (value) { + return event.sendReply([value]) + }, + get: function () {} + }) + ipcMain.emit(channel, event, ...args) + }) + + this.on('ipc-internal-message', function (event, [channel, ...args]) { + ipcMainInternal.emit(channel, event, ...args) + }) + this.on('ipc-internal-message-sync', function (event, [channel, ...args]) { + Object.defineProperty(event, 'returnValue', { + set: function (value) { + return event.sendReply([value]) + }, + get: function () {} + }) + ipcMainInternal.emit(channel, event, ...args) + }) + + // Handle context menu action request from pepper plugin. + this.on('pepper-context-menu', function (event, params, callback) { + // Access Menu via electron.Menu to prevent circular require. + const menu = electron.Menu.buildFromTemplate(params.menu) + menu.popup({ + window: event.sender.getOwnerBrowserWindow(), + x: params.x, + y: params.y, + callback + }) + }) + + this.on('remote-require', (event, ...args) => { + app.emit('remote-require', event, this, ...args) + }) + + this.on('remote-get-global', (event, ...args) => { + app.emit('remote-get-global', event, this, ...args) + }) + + deprecate.event(this, 'did-get-response-details', '-did-get-response-details') + deprecate.event(this, 'did-get-redirect-request', '-did-get-redirect-request') + + // The devtools requests the webContents to reload. + this.on('devtools-reload-page', function () { + this.reload() + }) + + app.emit('web-contents-created', {}, this) +} + +// JavaScript wrapper of Debugger. +const { Debugger } = process.atomBinding('debugger') + +Object.setPrototypeOf(Debugger.prototype, EventEmitter.prototype) + +// Public APIs. +module.exports = { + create (options = {}) { + return binding.create(options) + }, + + fromId (id) { + return binding.fromId(id) + }, + + getFocusedWebContents () { + let focused = null + for (const contents of binding.getAllWebContents()) { + if (!contents.isFocused()) continue + if (focused == null) focused = contents + // Return webview web contents which may be embedded inside another + // web contents that is also reporting as focused + if (contents.getType() === 'webview') return contents + } + return focused + }, + + getAllWebContents () { + return binding.getAllWebContents() + } +} diff --git a/electronasar/canary/browser/chrome-extension.js b/electronasar/canary/browser/chrome-extension.js new file mode 100644 index 0000000..627487a --- /dev/null +++ b/electronasar/canary/browser/chrome-extension.js @@ -0,0 +1,435 @@ +'use strict' + +const { app, webContents, BrowserWindow } = require('electron') +const { getAllWebContents } = process.atomBinding('web_contents') +const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllWebContents() +const ipcMain = require('@electron/internal/browser/ipc-main-internal') + +const { Buffer } = require('buffer') +const fs = require('fs') +const path = require('path') +const url = require('url') + +// Mapping between extensionId(hostname) and manifest. +const manifestMap = {} // extensionId => manifest +const manifestNameMap = {} // name => manifest +const devToolsExtensionNames = new Set() + +const generateExtensionIdFromName = function (name) { + return name.replace(/[\W_]+/g, '-').toLowerCase() +} + +const isWindowOrWebView = function (webContents) { + const type = webContents.getType() + return type === 'window' || type === 'webview' +} + +// Create or get manifest object from |srcDirectory|. +const getManifestFromPath = function (srcDirectory) { + let manifest + let manifestContent + + try { + manifestContent = fs.readFileSync(path.join(srcDirectory, 'manifest.json')) + } catch (readError) { + console.warn(`Reading ${path.join(srcDirectory, 'manifest.json')} failed.`) + console.warn(readError.stack || readError) + throw readError + } + + try { + manifest = JSON.parse(manifestContent) + } catch (parseError) { + console.warn(`Parsing ${path.join(srcDirectory, 'manifest.json')} failed.`) + console.warn(parseError.stack || parseError) + throw parseError + } + + if (!manifestNameMap[manifest.name]) { + const extensionId = generateExtensionIdFromName(manifest.name) + manifestMap[extensionId] = manifestNameMap[manifest.name] = manifest + Object.assign(manifest, { + srcDirectory: srcDirectory, + extensionId: extensionId, + // We can not use 'file://' directly because all resources in the extension + // will be treated as relative to the root in Chrome. + startPage: url.format({ + protocol: 'chrome-extension', + slashes: true, + hostname: extensionId, + pathname: manifest.devtools_page + }) + }) + return manifest + } else if (manifest && manifest.name) { + console.warn(`Attempted to load extension "${manifest.name}" that has already been loaded.`) + return manifest + } +} + +// Manage the background pages. +const backgroundPages = {} + +const startBackgroundPages = function (manifest) { + if (backgroundPages[manifest.extensionId] || !manifest.background) return + + let html + let name + if (manifest.background.page) { + name = manifest.background.page + html = fs.readFileSync(path.join(manifest.srcDirectory, manifest.background.page)) + } else { + name = '_generated_background_page.html' + const scripts = manifest.background.scripts.map((name) => { + return `` + }).join('') + html = Buffer.from(`${scripts}`) + } + + const contents = webContents.create({ + partition: 'persist:__chrome_extension', + isBackgroundPage: true, + commandLineSwitches: ['--background-page'] + }) + backgroundPages[manifest.extensionId] = { html: html, webContents: contents, name: name } + contents.loadURL(url.format({ + protocol: 'chrome-extension', + slashes: true, + hostname: manifest.extensionId, + pathname: name + })) +} + +const removeBackgroundPages = function (manifest) { + if (!backgroundPages[manifest.extensionId]) return + + backgroundPages[manifest.extensionId].webContents.destroy() + delete backgroundPages[manifest.extensionId] +} + +const sendToBackgroundPages = function (...args) { + for (const page of Object.values(backgroundPages)) { + page.webContents._sendInternalToAll(...args) + } +} + +// Dispatch web contents events to Chrome APIs +const hookWebContentsEvents = function (webContents) { + const tabId = webContents.id + + sendToBackgroundPages('CHROME_TABS_ONCREATED') + + webContents.on('will-navigate', (event, url) => { + sendToBackgroundPages('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', { + frameId: 0, + parentFrameId: -1, + processId: webContents.getProcessId(), + tabId: tabId, + timeStamp: Date.now(), + url: url + }) + }) + + webContents.on('did-navigate', (event, url) => { + sendToBackgroundPages('CHROME_WEBNAVIGATION_ONCOMPLETED', { + frameId: 0, + parentFrameId: -1, + processId: webContents.getProcessId(), + tabId: tabId, + timeStamp: Date.now(), + url: url + }) + }) + + webContents.once('destroyed', () => { + sendToBackgroundPages('CHROME_TABS_ONREMOVED', tabId) + }) +} + +// Handle the chrome.* API messages. +let nextId = 0 + +ipcMain.on('CHROME_RUNTIME_CONNECT', function (event, extensionId, connectInfo) { + const page = backgroundPages[extensionId] + if (!page) { + console.error(`Connect to unknown extension ${extensionId}`) + return + } + + const portId = ++nextId + event.returnValue = { tabId: page.webContents.id, portId: portId } + + event.sender.once('render-view-deleted', () => { + if (page.webContents.isDestroyed()) return + page.webContents._sendInternalToAll(`CHROME_PORT_DISCONNECT_${portId}`) + }) + page.webContents._sendInternalToAll(`CHROME_RUNTIME_ONCONNECT_${extensionId}`, event.sender.id, portId, connectInfo) +}) + +ipcMain.on('CHROME_I18N_MANIFEST', function (event, extensionId) { + event.returnValue = manifestMap[extensionId] +}) + +let resultID = 1 +ipcMain.on('CHROME_RUNTIME_SENDMESSAGE', function (event, extensionId, message, originResultID) { + const page = backgroundPages[extensionId] + if (!page) { + console.error(`Connect to unknown extension ${extensionId}`) + return + } + + page.webContents._sendInternalToAll(`CHROME_RUNTIME_ONMESSAGE_${extensionId}`, event.sender.id, message, resultID) + ipcMain.once(`CHROME_RUNTIME_ONMESSAGE_RESULT_${resultID}`, (event, result) => { + event.sender._sendInternal(`CHROME_RUNTIME_SENDMESSAGE_RESULT_${originResultID}`, result) + }) + resultID++ +}) + +ipcMain.on('CHROME_TABS_SEND_MESSAGE', function (event, tabId, extensionId, isBackgroundPage, message, originResultID) { + const contents = webContents.fromId(tabId) + if (!contents) { + console.error(`Sending message to unknown tab ${tabId}`) + return + } + + const senderTabId = isBackgroundPage ? null : event.sender.id + + contents._sendInternalToAll(`CHROME_RUNTIME_ONMESSAGE_${extensionId}`, senderTabId, message, resultID) + ipcMain.once(`CHROME_RUNTIME_ONMESSAGE_RESULT_${resultID}`, (event, result) => { + event.sender._sendInternal(`CHROME_TABS_SEND_MESSAGE_RESULT_${originResultID}`, result) + }) + resultID++ +}) + +ipcMain.on('CHROME_TABS_EXECUTESCRIPT', function (event, requestId, tabId, extensionId, details) { + const contents = webContents.fromId(tabId) + if (!contents) { + console.error(`Sending message to unknown tab ${tabId}`) + return + } + + let code, url + if (details.file) { + const manifest = manifestMap[extensionId] + code = String(fs.readFileSync(path.join(manifest.srcDirectory, details.file))) + url = `chrome-extension://${extensionId}${details.file}` + } else { + code = details.code + url = `chrome-extension://${extensionId}/${String(Math.random()).substr(2, 8)}.js` + } + + contents._sendInternal('CHROME_TABS_EXECUTESCRIPT', event.sender.id, requestId, extensionId, url, code) +}) + +// Transfer the content scripts to renderer. +const contentScripts = {} + +const injectContentScripts = function (manifest) { + if (contentScripts[manifest.name] || !manifest.content_scripts) return + + const readArrayOfFiles = function (relativePath) { + return { + url: `chrome-extension://${manifest.extensionId}/${relativePath}`, + code: String(fs.readFileSync(path.join(manifest.srcDirectory, relativePath))) + } + } + + const contentScriptToEntry = function (script) { + return { + matches: script.matches, + js: script.js ? script.js.map(readArrayOfFiles) : [], + css: script.css ? script.css.map(readArrayOfFiles) : [], + runAt: script.run_at || 'document_idle' + } + } + + try { + const entry = { + extensionId: manifest.extensionId, + contentScripts: manifest.content_scripts.map(contentScriptToEntry) + } + contentScripts[manifest.name] = renderProcessPreferences.addEntry(entry) + } catch (e) { + console.error('Failed to read content scripts', e) + } +} + +const removeContentScripts = function (manifest) { + if (!contentScripts[manifest.name]) return + + renderProcessPreferences.removeEntry(contentScripts[manifest.name]) + delete contentScripts[manifest.name] +} + +// Transfer the |manifest| to a format that can be recognized by the +// |DevToolsAPI.addExtensions|. +const manifestToExtensionInfo = function (manifest) { + return { + startPage: manifest.startPage, + srcDirectory: manifest.srcDirectory, + name: manifest.name, + exposeExperimentalAPIs: true + } +} + +// Load the extensions for the window. +const loadExtension = function (manifest) { + startBackgroundPages(manifest) + injectContentScripts(manifest) +} + +const loadDevToolsExtensions = function (win, manifests) { + if (!win.devToolsWebContents) return + + manifests.forEach(loadExtension) + + const extensionInfoArray = manifests.map(manifestToExtensionInfo) + extensionInfoArray.forEach((extension) => { + win.devToolsWebContents._grantOriginAccess(extension.startPage) + }) + win.devToolsWebContents.executeJavaScript(`DevToolsAPI.addExtensions(${JSON.stringify(extensionInfoArray)})`) +} + +app.on('web-contents-created', function (event, webContents) { + if (!isWindowOrWebView(webContents)) return + + hookWebContentsEvents(webContents) + webContents.on('devtools-opened', function () { + loadDevToolsExtensions(webContents, Object.values(manifestMap)) + }) +}) + +// The chrome-extension: can map a extension URL request to real file path. +const chromeExtensionHandler = function (request, callback) { + const parsed = url.parse(request.url) + if (!parsed.hostname || !parsed.path) return callback() + + const manifest = manifestMap[parsed.hostname] + if (!manifest) return callback() + + const page = backgroundPages[parsed.hostname] + if (page && parsed.path === `/${page.name}`) { + // Disabled due to false positive in StandardJS + // eslint-disable-next-line standard/no-callback-literal + return callback({ + mimeType: 'text/html', + data: page.html + }) + } + + fs.readFile(path.join(manifest.srcDirectory, parsed.path), function (err, content) { + if (err) { + // Disabled due to false positive in StandardJS + // eslint-disable-next-line standard/no-callback-literal + return callback(-6) // FILE_NOT_FOUND + } else { + return callback(content) + } + }) +} + +app.on('session-created', function (ses) { + ses.protocol.registerBufferProtocol('chrome-extension', chromeExtensionHandler, function (error) { + if (error) { + console.error(`Unable to register chrome-extension protocol: ${error}`) + } + }) +}) + +// The persistent path of "DevTools Extensions" preference file. +let loadedDevToolsExtensionsPath = null + +app.on('will-quit', function () { + try { + const loadedDevToolsExtensions = Array.from(devToolsExtensionNames) + .map(name => manifestNameMap[name].srcDirectory) + if (loadedDevToolsExtensions.length > 0) { + try { + fs.mkdirSync(path.dirname(loadedDevToolsExtensionsPath)) + } catch (error) { + // Ignore error + } + fs.writeFileSync(loadedDevToolsExtensionsPath, JSON.stringify(loadedDevToolsExtensions)) + } else { + fs.unlinkSync(loadedDevToolsExtensionsPath) + } + } catch (error) { + // Ignore error + } +}) + +// We can not use protocol or BrowserWindow until app is ready. +app.once('ready', function () { + // The public API to add/remove extensions. + BrowserWindow.addExtension = function (srcDirectory) { + const manifest = getManifestFromPath(srcDirectory) + if (manifest) { + loadExtension(manifest) + for (const webContents of getAllWebContents()) { + if (isWindowOrWebView(webContents)) { + loadDevToolsExtensions(webContents, [manifest]) + } + } + return manifest.name + } + } + + BrowserWindow.removeExtension = function (name) { + const manifest = manifestNameMap[name] + if (!manifest) return + + removeBackgroundPages(manifest) + removeContentScripts(manifest) + delete manifestMap[manifest.extensionId] + delete manifestNameMap[name] + } + + BrowserWindow.getExtensions = function () { + const extensions = {} + Object.keys(manifestNameMap).forEach(function (name) { + const manifest = manifestNameMap[name] + extensions[name] = { name: manifest.name, version: manifest.version } + }) + return extensions + } + + BrowserWindow.addDevToolsExtension = function (srcDirectory) { + const manifestName = BrowserWindow.addExtension(srcDirectory) + if (manifestName) { + devToolsExtensionNames.add(manifestName) + } + return manifestName + } + + BrowserWindow.removeDevToolsExtension = function (name) { + BrowserWindow.removeExtension(name) + devToolsExtensionNames.delete(name) + } + + BrowserWindow.getDevToolsExtensions = function () { + const extensions = BrowserWindow.getExtensions() + const devExtensions = {} + Array.from(devToolsExtensionNames).forEach(function (name) { + if (!extensions[name]) return + devExtensions[name] = extensions[name] + }) + return devExtensions + } + + // Load persisted extensions. + loadedDevToolsExtensionsPath = path.join(app.getPath('userData'), 'DevTools Extensions') + try { + const loadedDevToolsExtensions = JSON.parse(fs.readFileSync(loadedDevToolsExtensionsPath)) + if (Array.isArray(loadedDevToolsExtensions)) { + for (const srcDirectory of loadedDevToolsExtensions) { + // Start background pages and set content scripts. + BrowserWindow.addDevToolsExtension(srcDirectory) + } + } + } catch (error) { + if (process.env.ELECTRON_ENABLE_LOGGING && error.code !== 'ENOENT') { + console.error('Failed to load browser extensions from directory:', loadedDevToolsExtensionsPath) + console.error(error) + } + } +}) diff --git a/electronasar/canary/browser/desktop-capturer.js b/electronasar/canary/browser/desktop-capturer.js new file mode 100644 index 0000000..62e68bb --- /dev/null +++ b/electronasar/canary/browser/desktop-capturer.js @@ -0,0 +1,73 @@ +'use strict' + +const ipcMain = require('@electron/internal/browser/ipc-main-internal') +const { desktopCapturer } = process.atomBinding('desktop_capturer') + +const deepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b) + +// A queue for holding all requests from renderer process. +let requestsQueue = [] + +const electronSources = 'ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES' +const capturerResult = (id) => `ELECTRON_RENDERER_DESKTOP_CAPTURER_RESULT_${id}` + +ipcMain.on(electronSources, (event, captureWindow, captureScreen, thumbnailSize, id) => { + const request = { + id, + options: { + captureWindow, + captureScreen, + thumbnailSize + }, + webContents: event.sender + } + requestsQueue.push(request) + if (requestsQueue.length === 1) { + desktopCapturer.startHandling(captureWindow, captureScreen, thumbnailSize) + } + + // If the WebContents is destroyed before receiving result, just remove the + // reference from requestsQueue to make the module not send the result to it. + event.sender.once('destroyed', () => { + request.webContents = null + }) +}) + +desktopCapturer.emit = (event, name, sources) => { + // Receiving sources result from main process, now send them back to renderer. + const handledRequest = requestsQueue.shift() + const handledWebContents = handledRequest.webContents + const unhandledRequestsQueue = [] + + const result = sources.map(source => { + return { + id: source.id, + name: source.name, + thumbnail: source.thumbnail.toDataURL(), + display_id: source.display_id + } + }) + + if (handledWebContents) { + handledWebContents._sendInternal(capturerResult(handledRequest.id), result) + } + + // Check the queue to see whether there is another identical request & handle + requestsQueue.forEach(request => { + const webContents = request.webContents + if (deepEqual(handledRequest.options, request.options)) { + if (webContents) { + webContents._sendInternal(capturerResult(request.id), result) + } + } else { + unhandledRequestsQueue.push(request) + } + }) + requestsQueue = unhandledRequestsQueue + + // If the requestsQueue is not empty, start a new request handling. + if (requestsQueue.length > 0) { + const { captureWindow, captureScreen, thumbnailSize } = requestsQueue[0].options + return desktopCapturer.startHandling(captureWindow, captureScreen, thumbnailSize) + } +} diff --git a/electronasar/canary/browser/guest-view-manager.js b/electronasar/canary/browser/guest-view-manager.js new file mode 100644 index 0000000..8693235 --- /dev/null +++ b/electronasar/canary/browser/guest-view-manager.js @@ -0,0 +1,420 @@ +'use strict' + +const { webContents } = require('electron') +const ipcMain = require('@electron/internal/browser/ipc-main-internal') +const parseFeaturesString = require('@electron/internal/common/parse-features-string') +const errorUtils = require('@electron/internal/common/error-utils') + +// Doesn't exist in early initialization. +let webViewManager = null + +const supportedWebViewEvents = [ + 'load-commit', + 'did-attach', + 'did-finish-load', + 'did-fail-load', + 'did-frame-finish-load', + 'did-start-loading', + 'did-stop-loading', + 'dom-ready', + 'console-message', + 'context-menu', + 'devtools-opened', + 'devtools-closed', + 'devtools-focused', + 'new-window', + 'will-navigate', + 'did-start-navigation', + 'did-navigate', + 'did-frame-navigate', + 'did-navigate-in-page', + 'focus-change', + 'close', + 'crashed', + 'gpu-crashed', + 'plugin-crashed', + 'destroyed', + 'page-title-updated', + 'page-favicon-updated', + 'enter-html-full-screen', + 'leave-html-full-screen', + 'media-started-playing', + 'media-paused', + 'found-in-page', + 'did-change-theme-color', + 'update-target-url' +] + +let nextGuestInstanceId = 0 +const guestInstances = {} +const embedderElementsMap = {} + +// Generate guestInstanceId. +const getNextGuestInstanceId = function () { + return ++nextGuestInstanceId +} + +// Create a new guest instance. +const createGuest = function (embedder, params) { + if (webViewManager == null) { + webViewManager = process.atomBinding('web_view_manager') + } + + const guestInstanceId = getNextGuestInstanceId(embedder) + const guest = webContents.create({ + isGuest: true, + partition: params.partition, + embedder: embedder + }) + guestInstances[guestInstanceId] = { + guest: guest, + embedder: embedder + } + + // Clear the guest from map when it is destroyed. + // + // The guest WebContents is usually destroyed in 2 cases: + // 1. The embedder frame is closed (reloaded or destroyed), and it + // automatically closes the guest frame. + // 2. The guest frame is detached dynamically via JS, and it is manually + // destroyed when the renderer sends the GUEST_VIEW_MANAGER_DESTROY_GUEST + // message. + // The second case relies on the libcc patch: + // https://github.com/electron/libchromiumcontent/pull/676 + // The patch was introduced to work around a bug in Chromium: + // https://github.com/electron/electron/issues/14211 + // We should revisit the bug to see if we can remove our libcc patch, the + // patch was introduced in Chrome 66. + guest.once('destroyed', () => { + if (guestInstanceId in guestInstances) { + detachGuest(embedder, guestInstanceId) + } + }) + + // Init guest web view after attached. + guest.once('did-attach', function (event) { + params = this.attachParams + delete this.attachParams + + const previouslyAttached = this.viewInstanceId != null + this.viewInstanceId = params.instanceId + + // Only load URL and set size on first attach + if (previouslyAttached) { + return + } + + if (params.src) { + const opts = {} + if (params.httpreferrer) { + opts.httpReferrer = params.httpreferrer + } + if (params.useragent) { + opts.userAgent = params.useragent + } + this.loadURL(params.src, opts) + } + guest.allowPopups = params.allowpopups + embedder.emit('did-attach-webview', event, guest) + }) + + const sendToEmbedder = (channel, ...args) => { + if (!embedder.isDestroyed()) { + embedder._sendInternal(`${channel}-${guest.viewInstanceId}`, ...args) + } + } + + // Dispatch events to embedder. + const fn = function (event) { + guest.on(event, function (_, ...args) { + sendToEmbedder('ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT', event, ...args) + }) + } + for (const event of supportedWebViewEvents) { + fn(event) + } + + // Dispatch guest's IPC messages to embedder. + guest.on('ipc-message-host', function (_, [channel, ...args]) { + sendToEmbedder('ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE', channel, ...args) + }) + + // Notify guest of embedder window visibility when it is ready + // FIXME Remove once https://github.com/electron/electron/issues/6828 is fixed + guest.on('dom-ready', function () { + const guestInstance = guestInstances[guestInstanceId] + if (guestInstance != null && guestInstance.visibilityState != null) { + guest._sendInternal('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', guestInstance.visibilityState) + } + }) + + // Forward internal web contents event to embedder to handle + // native window.open setup + guest.on('-add-new-contents', (...args) => { + if (guest.getLastWebPreferences().nativeWindowOpen === true) { + const embedder = getEmbedder(guestInstanceId) + if (embedder != null) { + embedder.emit('-add-new-contents', ...args) + } + } + }) + guest.on('-web-contents-created', (...args) => { + if (guest.getLastWebPreferences().nativeWindowOpen === true) { + const embedder = getEmbedder(guestInstanceId) + if (embedder != null) { + embedder.emit('-web-contents-created', ...args) + } + } + }) + + return guestInstanceId +} + +// Attach the guest to an element of embedder. +const attachGuest = function (event, embedderFrameId, elementInstanceId, guestInstanceId, params) { + const embedder = event.sender + // Destroy the old guest when attaching. + const key = `${embedder.id}-${elementInstanceId}` + const oldGuestInstanceId = embedderElementsMap[key] + if (oldGuestInstanceId != null) { + // Reattachment to the same guest is just a no-op. + if (oldGuestInstanceId === guestInstanceId) { + return + } + + const oldGuestInstance = guestInstances[oldGuestInstanceId] + if (oldGuestInstance) { + oldGuestInstance.guest.destroy() + } + } + + const guestInstance = guestInstances[guestInstanceId] + // If this isn't a valid guest instance then do nothing. + if (!guestInstance) { + return + } + const { guest } = guestInstance + + // If this guest is already attached to an element then remove it + if (guestInstance.elementInstanceId) { + const oldKey = `${guestInstance.embedder.id}-${guestInstance.elementInstanceId}` + delete embedderElementsMap[oldKey] + + // Remove guest from embedder if moving across web views + if (guest.viewInstanceId !== params.instanceId) { + webViewManager.removeGuest(guestInstance.embedder, guestInstanceId) + guestInstance.embedder._sendInternal(`ELECTRON_GUEST_VIEW_INTERNAL_DESTROY_GUEST-${guest.viewInstanceId}`) + } + } + + const webPreferences = { + guestInstanceId: guestInstanceId, + nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false, + enableRemoteModule: params.enableremotemodule, + plugins: params.plugins, + zoomFactor: embedder._getZoomFactor(), + webSecurity: !params.disablewebsecurity, + enableBlinkFeatures: params.blinkfeatures, + disableBlinkFeatures: params.disableblinkfeatures + } + + // parse the 'webpreferences' attribute string, if set + // this uses the same parsing rules as window.open uses for its features + if (typeof params.webpreferences === 'string') { + parseFeaturesString(params.webpreferences, function (key, value) { + if (value === undefined) { + // no value was specified, default it to true + value = true + } + webPreferences[key] = value + }) + } + + if (params.preload) { + webPreferences.preloadURL = params.preload + } + + // Return null from native window.open if allowpopups is unset + if (webPreferences.nativeWindowOpen === true && !params.allowpopups) { + webPreferences.disablePopups = true + } + + // Security options that guest will always inherit from embedder + const inheritedWebPreferences = new Map([ + ['contextIsolation', true], + ['javascript', false], + ['nativeWindowOpen', true], + ['nodeIntegration', false], + ['enableRemoteModule', false], + ['sandbox', true] + ]) + + // Inherit certain option values from embedder + const lastWebPreferences = embedder.getLastWebPreferences() + for (const [name, value] of inheritedWebPreferences) { + if (lastWebPreferences[name] === value) { + webPreferences[name] = value + } + } + + embedder.emit('will-attach-webview', event, webPreferences, params) + if (event.defaultPrevented) { + if (guest.viewInstanceId == null) guest.viewInstanceId = params.instanceId + guest.destroy() + return + } + + guest.attachParams = params + embedderElementsMap[key] = guestInstanceId + + guest.setEmbedder(embedder) + guestInstance.embedder = embedder + guestInstance.elementInstanceId = elementInstanceId + + watchEmbedder(embedder) + + webViewManager.addGuest(guestInstanceId, elementInstanceId, embedder, guest, webPreferences) + guest.attachToIframe(embedder, embedderFrameId) +} + +// Remove an guest-embedder relationship. +const detachGuest = function (embedder, guestInstanceId) { + const guestInstance = guestInstances[guestInstanceId] + if (embedder !== guestInstance.embedder) { + return + } + + webViewManager.removeGuest(embedder, guestInstanceId) + delete guestInstances[guestInstanceId] + + const key = `${embedder.id}-${guestInstance.elementInstanceId}` + delete embedderElementsMap[key] +} + +// Once an embedder has had a guest attached we watch it for destruction to +// destroy any remaining guests. +const watchedEmbedders = new Set() +const watchEmbedder = function (embedder) { + if (watchedEmbedders.has(embedder)) { + return + } + watchedEmbedders.add(embedder) + + // Forward embedder window visiblity change events to guest + const onVisibilityChange = function (visibilityState) { + for (const guestInstanceId in guestInstances) { + const guestInstance = guestInstances[guestInstanceId] + guestInstance.visibilityState = visibilityState + if (guestInstance.embedder === embedder) { + guestInstance.guest._sendInternal('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', visibilityState) + } + } + } + embedder.on('-window-visibility-change', onVisibilityChange) + + embedder.once('will-destroy', () => { + // Usually the guestInstances is cleared when guest is destroyed, but it + // may happen that the embedder gets manually destroyed earlier than guest, + // and the embedder will be invalid in the usual code path. + for (const guestInstanceId in guestInstances) { + const guestInstance = guestInstances[guestInstanceId] + if (guestInstance.embedder === embedder) { + detachGuest(embedder, parseInt(guestInstanceId)) + } + } + // Clear the listeners. + embedder.removeListener('-window-visibility-change', onVisibilityChange) + watchedEmbedders.delete(embedder) + }) +} + +const isWebViewTagEnabledCache = new WeakMap() + +const isWebViewTagEnabled = function (contents) { + if (!isWebViewTagEnabledCache.has(contents)) { + const value = contents.getLastWebPreferences().webviewTag + isWebViewTagEnabledCache.set(contents, value) + } + + return isWebViewTagEnabledCache.get(contents) +} + +const handleMessage = function (channel, handler) { + ipcMain.on(channel, (event, ...args) => { + if (isWebViewTagEnabled(event.sender)) { + handler(event, ...args) + } else { + event.returnValue = null + } + }) +} + +handleMessage('ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST', function (event, params, requestId) { + event.sender._sendInternal(`ELECTRON_RESPONSE_${requestId}`, createGuest(event.sender, params)) +}) + +handleMessage('ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST_SYNC', function (event, params) { + event.returnValue = createGuest(event.sender, params) +}) + +handleMessage('ELECTRON_GUEST_VIEW_MANAGER_DESTROY_GUEST', function (event, guestInstanceId) { + const guest = getGuest(guestInstanceId) + if (guest) { + guest.destroy() + } +}) + +handleMessage('ELECTRON_GUEST_VIEW_MANAGER_ATTACH_GUEST', function (event, embedderFrameId, elementInstanceId, guestInstanceId, params) { + attachGuest(event, embedderFrameId, elementInstanceId, guestInstanceId, params) +}) + +handleMessage('ELECTRON_GUEST_VIEW_MANAGER_FOCUS_CHANGE', function (event, focus, guestInstanceId) { + event.sender.emit('focus-change', {}, focus, guestInstanceId) +}) + +handleMessage('ELECTRON_GUEST_VIEW_MANAGER_ASYNC_CALL', function (event, requestId, guestInstanceId, method, args, hasCallback) { + new Promise(resolve => { + const guest = getGuest(guestInstanceId) + if (guest.hostWebContents !== event.sender) { + throw new Error('Access denied') + } + if (hasCallback) { + guest[method](...args, resolve) + } else { + resolve(guest[method](...args)) + } + }).then(result => { + return [null, result] + }, error => { + return [errorUtils.serialize(error)] + }).then(responseArgs => { + event.sender._sendInternal(`ELECTRON_GUEST_VIEW_MANAGER_ASYNC_CALL_RESPONSE_${requestId}`, ...responseArgs) + }) +}) + +handleMessage('ELECTRON_GUEST_VIEW_MANAGER_SYNC_CALL', function (event, guestInstanceId, method, args) { + try { + const guest = getGuest(guestInstanceId) + if (guest.hostWebContents !== event.sender) { + throw new Error('Access denied') + } + event.returnValue = [null, guest[method].apply(guest, args)] + } catch (error) { + event.returnValue = [errorUtils.serialize(error)] + } +}) + +// Returns WebContents from its guest id. +const getGuest = function (guestInstanceId) { + const guestInstance = guestInstances[guestInstanceId] + if (guestInstance != null) return guestInstance.guest +} + +// Returns the embedder of the guest. +const getEmbedder = function (guestInstanceId) { + const guestInstance = guestInstances[guestInstanceId] + if (guestInstance != null) return guestInstance.embedder +} + +exports.getGuest = getGuest +exports.getEmbedder = getEmbedder diff --git a/electronasar/canary/browser/guest-window-manager.js b/electronasar/canary/browser/guest-window-manager.js new file mode 100644 index 0000000..5bc5d26 --- /dev/null +++ b/electronasar/canary/browser/guest-window-manager.js @@ -0,0 +1,353 @@ +'use strict' + +const { BrowserWindow, webContents } = require('electron') +const { isSameOrigin } = process.atomBinding('v8_util') +const ipcMain = require('@electron/internal/browser/ipc-main-internal') +const parseFeaturesString = require('@electron/internal/common/parse-features-string') + +const hasProp = {}.hasOwnProperty +const frameToGuest = new Map() + +// Security options that child windows will always inherit from parent windows +const inheritedWebPreferences = new Map([ + ['contextIsolation', true], + ['javascript', false], + ['nativeWindowOpen', true], + ['nodeIntegration', false], + ['enableRemoteModule', false], + ['sandbox', true], + ['webviewTag', false] +]) + +// Copy attribute of |parent| to |child| if it is not defined in |child|. +const mergeOptions = function (child, parent, visited) { + // Check for circular reference. + if (visited == null) visited = new Set() + if (visited.has(parent)) return + + visited.add(parent) + for (const key in parent) { + if (key === 'isBrowserView') continue + if (!hasProp.call(parent, key)) continue + if (key in child && key !== 'webPreferences') continue + + const value = parent[key] + if (typeof value === 'object') { + child[key] = mergeOptions(child[key] || {}, value, visited) + } else { + child[key] = value + } + } + visited.delete(parent) + + return child +} + +// Merge |options| with the |embedder|'s window's options. +const mergeBrowserWindowOptions = function (embedder, options) { + if (options.webPreferences == null) { + options.webPreferences = {} + } + if (embedder.browserWindowOptions != null) { + let parentOptions = embedder.browserWindowOptions + + // if parent's visibility is available, that overrides 'show' flag (#12125) + const win = BrowserWindow.fromWebContents(embedder.webContents) + if (win != null) { + parentOptions = { ...embedder.browserWindowOptions, show: win.isVisible() } + } + + // Inherit the original options if it is a BrowserWindow. + mergeOptions(options, parentOptions) + } else { + // Or only inherit webPreferences if it is a webview. + mergeOptions(options.webPreferences, embedder.getLastWebPreferences()) + } + + // Inherit certain option values from parent window + const webPreferences = embedder.getLastWebPreferences() + for (const [name, value] of inheritedWebPreferences) { + if (webPreferences[name] === value) { + options.webPreferences[name] = value + } + } + + // Sets correct openerId here to give correct options to 'new-window' event handler + options.webPreferences.openerId = embedder.id + + return options +} + +// Setup a new guest with |embedder| +const setupGuest = function (embedder, frameName, guest, options) { + // When |embedder| is destroyed we should also destroy attached guest, and if + // guest is closed by user then we should prevent |embedder| from double + // closing guest. + const guestId = guest.webContents.id + const closedByEmbedder = function () { + guest.removeListener('closed', closedByUser) + guest.destroy() + } + const closedByUser = function () { + embedder._sendInternal('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_' + guestId) + embedder.removeListener('render-view-deleted', closedByEmbedder) + } + embedder.once('render-view-deleted', closedByEmbedder) + guest.once('closed', closedByUser) + if (frameName) { + frameToGuest.set(frameName, guest) + guest.frameName = frameName + guest.once('closed', function () { + frameToGuest.delete(frameName) + }) + } + return guestId +} + +// Create a new guest created by |embedder| with |options|. +const createGuest = function (embedder, url, referrer, frameName, options, postData) { + let guest = frameToGuest.get(frameName) + if (frameName && (guest != null)) { + guest.loadURL(url) + return guest.webContents.id + } + + // Remember the embedder window's id. + if (options.webPreferences == null) { + options.webPreferences = {} + } + + guest = new BrowserWindow(options) + if (!options.webContents || url !== 'about:blank') { + // We should not call `loadURL` if the window was constructed from an + // existing webContents(window.open in a sandboxed renderer) and if the url + // is not 'about:blank'. + // + // Navigating to the url when creating the window from an existing + // webContents would not be necessary(it will navigate there anyway), but + // apparently there's a bug that allows the child window to be scripted by + // the opener, even when the child window is from another origin. + // + // That's why the second condition(url !== "about:blank") is required: to + // force `OverrideSiteInstanceForNavigation` to be called and consequently + // spawn a new renderer if the new window is targeting a different origin. + // + // If the URL is "about:blank", then it is very likely that the opener just + // wants to synchronously script the popup, for example: + // + // let popup = window.open() + // popup.document.body.write('

hello

') + // + // The above code would not work if a navigation to "about:blank" is done + // here, since the window would be cleared of all changes in the next tick. + const loadOptions = { + httpReferrer: referrer + } + if (postData != null) { + loadOptions.postData = postData + loadOptions.extraHeaders = 'content-type: application/x-www-form-urlencoded' + if (postData.length > 0) { + const postDataFront = postData[0].bytes.toString() + const boundary = /^--.*[^-\r\n]/.exec(postDataFront) + if (boundary != null) { + loadOptions.extraHeaders = `content-type: multipart/form-data; boundary=${boundary[0].substr(2)}` + } + } + } + guest.loadURL(url, loadOptions) + } + + return setupGuest(embedder, frameName, guest, options) +} + +const getGuestWindow = function (guestContents) { + let guestWindow = BrowserWindow.fromWebContents(guestContents) + if (guestWindow == null) { + const hostContents = guestContents.hostWebContents + if (hostContents != null) { + guestWindow = BrowserWindow.fromWebContents(hostContents) + } + } + return guestWindow +} + +// Checks whether |sender| can access the |target|: +// 1. Check whether |sender| is the parent of |target|. +// 2. Check whether |sender| has node integration, if so it is allowed to +// do anything it wants. +// 3. Check whether the origins match. +// +// However it allows a child window without node integration but with same +// origin to do anything it wants, when its opener window has node integration. +// The W3C does not have anything on this, but from my understanding of the +// security model of |window.opener|, this should be fine. +const canAccessWindow = function (sender, target) { + return (target.getLastWebPreferences().openerId === sender.id) || + (sender.getLastWebPreferences().nodeIntegration === true) || + isSameOrigin(sender.getURL(), target.getURL()) +} + +// Routed window.open messages with raw options +ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, frameName, features) => { + if (url == null || url === '') url = 'about:blank' + if (frameName == null) frameName = '' + if (features == null) features = '' + + const options = {} + + const ints = ['x', 'y', 'width', 'height', 'minWidth', 'maxWidth', 'minHeight', 'maxHeight', 'zoomFactor'] + const webPreferences = ['zoomFactor', 'nodeIntegration', 'enableRemoteModule', 'preload', 'javascript', 'contextIsolation', 'webviewTag'] + const disposition = 'new-window' + + // Used to store additional features + const additionalFeatures = [] + + // Parse the features + parseFeaturesString(features, function (key, value) { + if (value === undefined) { + additionalFeatures.push(key) + } else { + // Don't allow webPreferences to be set since it must be an object + // that cannot be directly overridden + if (key === 'webPreferences') return + + if (webPreferences.includes(key)) { + if (options.webPreferences == null) { + options.webPreferences = {} + } + options.webPreferences[key] = value + } else { + options[key] = value + } + } + }) + if (options.left) { + if (options.x == null) { + options.x = options.left + } + } + if (options.top) { + if (options.y == null) { + options.y = options.top + } + } + if (options.title == null) { + options.title = frameName + } + if (options.width == null) { + options.width = 800 + } + if (options.height == null) { + options.height = 600 + } + + for (const name of ints) { + if (options[name] != null) { + options[name] = parseInt(options[name], 10) + } + } + + const referrer = { url: '', policy: 'default' } + ipcMain.emit('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', event, + url, referrer, frameName, disposition, options, additionalFeatures) +}) + +// Routed window.open messages with fully parsed options +ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', function (event, url, referrer, + frameName, disposition, options, + additionalFeatures, postData) { + options = mergeBrowserWindowOptions(event.sender, options) + event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures, referrer) + const { newGuest } = event + if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) { + if (newGuest != null) { + if (options.webContents === newGuest.webContents) { + // the webContents is not changed, so set defaultPrevented to false to + // stop the callers of this event from destroying the webContents. + event.defaultPrevented = false + } + event.returnValue = setupGuest(event.sender, frameName, newGuest, options) + } else { + event.returnValue = null + } + } else { + event.returnValue = createGuest(event.sender, url, referrer, frameName, options, postData) + } +}) + +ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', function (event, guestId) { + const guestContents = webContents.fromId(guestId) + if (guestContents == null) return + + if (!canAccessWindow(event.sender, guestContents)) { + console.error(`Blocked ${event.sender.getURL()} from closing its opener.`) + return + } + + const guestWindow = getGuestWindow(guestContents) + if (guestWindow != null) guestWindow.destroy() +}) + +ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD', function (event, guestId, method, ...args) { + const guestContents = webContents.fromId(guestId) + if (guestContents == null) { + event.returnValue = null + return + } + + if (!canAccessWindow(event.sender, guestContents)) { + console.error(`Blocked ${event.sender.getURL()} from calling ${method} on its opener.`) + event.returnValue = null + return + } + + const guestWindow = getGuestWindow(guestContents) + if (guestWindow != null) { + event.returnValue = guestWindow[method](...args) + } else { + event.returnValue = null + } +}) + +ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', function (event, guestId, message, targetOrigin, sourceOrigin) { + if (targetOrigin == null) { + targetOrigin = '*' + } + + const guestContents = webContents.fromId(guestId) + if (guestContents == null) return + + // The W3C does not seem to have word on how postMessage should work when the + // origins do not match, so we do not do |canAccessWindow| check here since + // postMessage across origins is useful and not harmful. + if (targetOrigin === '*' || isSameOrigin(guestContents.getURL(), targetOrigin)) { + const sourceId = event.sender.id + guestContents._sendInternal('ELECTRON_GUEST_WINDOW_POSTMESSAGE', sourceId, message, sourceOrigin) + } +}) + +ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', function (event, guestId, method, ...args) { + const guestContents = webContents.fromId(guestId) + if (guestContents == null) return + + if (canAccessWindow(event.sender, guestContents)) { + guestContents[method](...args) + } else { + console.error(`Blocked ${event.sender.getURL()} from calling ${method} on its opener.`) + } +}) + +ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD_SYNC', function (event, guestId, method, ...args) { + const guestContents = webContents.fromId(guestId) + if (guestContents == null) { + event.returnValue = null + return + } + + if (canAccessWindow(event.sender, guestContents)) { + event.returnValue = guestContents[method](...args) + } else { + console.error(`Blocked ${event.sender.getURL()} from calling ${method} on its opener.`) + event.returnValue = null + } +}) diff --git a/electronasar/canary/browser/init.js b/electronasar/canary/browser/init.js new file mode 100644 index 0000000..fc526e1 --- /dev/null +++ b/electronasar/canary/browser/init.js @@ -0,0 +1,188 @@ +'use strict' + +const { Buffer } = require('buffer') +const fs = require('fs') +const path = require('path') +const util = require('util') +const Module = require('module') +const v8 = require('v8') + +// We modified the original process.argv to let node.js load the init.js, +// we need to restore it here. +process.argv.splice(1, 1) + +// Clear search paths. +require('../common/reset-search-paths') + +// Import common settings. +require('@electron/internal/common/init') + +const globalPaths = Module.globalPaths + +// Expose public APIs. +globalPaths.push(path.join(__dirname, 'api', 'exports')) + +if (process.platform === 'win32') { + // Redirect node's console to use our own implementations, since node can not + // handle console output when running as GUI program. + const consoleLog = function (...args) { + return process.log(util.format(...args) + '\n') + } + const streamWrite = function (chunk, encoding, callback) { + if (Buffer.isBuffer(chunk)) { + chunk = chunk.toString(encoding) + } + process.log(chunk) + if (callback) { + callback() + } + return true + } + console.log = console.error = console.warn = consoleLog + process.stdout.write = process.stderr.write = streamWrite +} + +// Don't quit on fatal error. +process.on('uncaughtException', function (error) { + // Do nothing if the user has a custom uncaught exception handler. + if (process.listeners('uncaughtException').length > 1) { + return + } + + // Show error in GUI. + const dialog = require('electron').dialog + const stack = error.stack ? error.stack : `${error.name}: ${error.message}` + const message = 'Uncaught Exception:\n' + stack + dialog.showErrorBox('A JavaScript error occurred in the main process', message) +}) + +// Emit 'exit' event on quit. +const { app } = require('electron') + +app.on('quit', function (event, exitCode) { + process.emit('exit', exitCode) +}) + +if (process.platform === 'win32') { + // If we are a Squirrel.Windows-installed app, set app user model ID + // so that users don't have to do this. + // + // Squirrel packages are always of the form: + // + // PACKAGE-NAME + // - Update.exe + // - app-VERSION + // - OUREXE.exe + // + // Squirrel itself will always set the shortcut's App User Model ID to the + // form `com.squirrel.PACKAGE-NAME.OUREXE`. We need to call + // app.setAppUserModelId with a matching identifier so that renderer processes + // will inherit this value. + const updateDotExe = path.join(path.dirname(process.execPath), '..', 'update.exe') + + if (fs.existsSync(updateDotExe)) { + const packageDir = path.dirname(path.resolve(updateDotExe)) + const packageName = path.basename(packageDir).replace(/\s/g, '') + const exeName = path.basename(process.execPath).replace(/\.exe$/i, '').replace(/\s/g, '') + + app.setAppUserModelId(`com.squirrel.${packageName}.${exeName}`) + } +} + +// Map process.exit to app.exit, which quits gracefully. +process.exit = app.exit + +// Load the RPC server. +require('@electron/internal/browser/rpc-server') + +// Load the guest view manager. +require('@electron/internal/browser/guest-view-manager') +require('@electron/internal/browser/guest-window-manager') + +// Now we try to load app's package.json. +let packagePath = null +let packageJson = null +const searchPaths = ['app', 'app.asar', 'default_app.asar'] +for (packagePath of searchPaths) { + try { + packagePath = path.join(process.resourcesPath, packagePath) + packageJson = require(path.join(packagePath, 'package.json')) + break + } catch (error) { + continue + } +} + +if (packageJson == null) { + process.nextTick(function () { + return process.exit(1) + }) + throw new Error('Unable to find a valid app') +} + +// Set application's version. +if (packageJson.version != null) { + app.setVersion(packageJson.version) +} + +// Set application's name. +if (packageJson.productName != null) { + app.setName(`${packageJson.productName}`.trim()) +} else if (packageJson.name != null) { + app.setName(`${packageJson.name}`.trim()) +} + +// Set application's desktop name. +if (packageJson.desktopName != null) { + app.setDesktopName(packageJson.desktopName) +} else { + app.setDesktopName((app.getName()) + '.desktop') +} + +// Set v8 flags +if (packageJson.v8Flags != null) { + v8.setFlagsFromString(packageJson.v8Flags) +} + +// Set the user path according to application's name. +app.setPath('userData', path.join(app.getPath('appData'), app.getName())) +app.setPath('userCache', path.join(app.getPath('cache'), app.getName())) +app.setAppPath(packagePath) + +// Load the chrome extension support. +require('@electron/internal/browser/chrome-extension') + +const features = process.atomBinding('features') +if (features.isDesktopCapturerEnabled()) { + // Load internal desktop-capturer module. + require('@electron/internal/browser/desktop-capturer') +} + +// Load protocol module to ensure it is populated on app ready +require('@electron/internal/browser/api/protocol') + +// Set main startup script of the app. +const mainStartupScript = packageJson.main || 'index.js' + +const KNOWN_XDG_DESKTOP_VALUES = ['Pantheon', 'Unity:Unity7', 'pop:GNOME'] + +function currentPlatformSupportsAppIndicator () { + if (process.platform !== 'linux') return false + const currentDesktop = process.env.XDG_CURRENT_DESKTOP + + if (!currentDesktop) return false + if (KNOWN_XDG_DESKTOP_VALUES.includes(currentDesktop)) return true + // ubuntu based or derived session (default ubuntu one, communitheme…) supports + // indicator too. + if (/ubuntu/ig.test(currentDesktop)) return true + + return false +} + +// Workaround for electron/electron#5050 and electron/electron#9046 +if (currentPlatformSupportsAppIndicator()) { + process.env.XDG_CURRENT_DESKTOP = 'Unity' +} + +// Finally load app's main.js and transfer control to C++. +Module._load(path.join(packagePath, mainStartupScript), Module, true) diff --git a/electronasar/canary/browser/ipc-main-internal.js b/electronasar/canary/browser/ipc-main-internal.js new file mode 100644 index 0000000..9ab9569 --- /dev/null +++ b/electronasar/canary/browser/ipc-main-internal.js @@ -0,0 +1,10 @@ +'use strict' + +const { EventEmitter } = require('events') + +const emitter = new EventEmitter() + +// Do not throw exception when channel name is "error". +emitter.on('error', () => {}) + +module.exports = emitter diff --git a/electronasar/canary/browser/objects-registry.js b/electronasar/canary/browser/objects-registry.js new file mode 100644 index 0000000..c3bbfae --- /dev/null +++ b/electronasar/canary/browser/objects-registry.js @@ -0,0 +1,116 @@ +'use strict' + +const v8Util = process.atomBinding('v8_util') + +const getOwnerKey = (webContents, contextId) => { + return `${webContents.id}-${contextId}` +} + +class ObjectsRegistry { + constructor () { + this.nextId = 0 + + // Stores all objects by ref-counting. + // (id) => {object, count} + this.storage = {} + + // Stores the IDs of objects referenced by WebContents. + // (ownerKey) => [id] + this.owners = {} + } + + // Register a new object and return its assigned ID. If the object is already + // registered then the already assigned ID would be returned. + add (webContents, contextId, obj) { + // Get or assign an ID to the object. + const id = this.saveToStorage(obj) + + // Add object to the set of referenced objects. + const ownerKey = getOwnerKey(webContents, contextId) + let owner = this.owners[ownerKey] + if (!owner) { + owner = this.owners[ownerKey] = new Set() + this.registerDeleteListener(webContents, contextId) + } + if (!owner.has(id)) { + owner.add(id) + // Increase reference count if not referenced before. + this.storage[id].count++ + } + return id + } + + // Get an object according to its ID. + get (id) { + const pointer = this.storage[id] + if (pointer != null) return pointer.object + } + + // Dereference an object according to its ID. + // Note that an object may be double-freed (cleared when page is reloaded, and + // then garbage collected in old page). + remove (webContents, contextId, id) { + const ownerKey = getOwnerKey(webContents, contextId) + const owner = this.owners[ownerKey] + if (owner) { + // Remove the reference in owner. + owner.delete(id) + // Dereference from the storage. + this.dereference(id) + } + } + + // Clear all references to objects refrenced by the WebContents. + clear (webContents, contextId) { + const ownerKey = getOwnerKey(webContents, contextId) + const owner = this.owners[ownerKey] + if (!owner) return + + for (const id of owner) this.dereference(id) + + delete this.owners[ownerKey] + } + + // Private: Saves the object into storage and assigns an ID for it. + saveToStorage (object) { + let id = v8Util.getHiddenValue(object, 'atomId') + if (!id) { + id = ++this.nextId + this.storage[id] = { + count: 0, + object: object + } + v8Util.setHiddenValue(object, 'atomId', id) + } + return id + } + + // Private: Dereference the object from store. + dereference (id) { + const pointer = this.storage[id] + if (pointer == null) { + return + } + pointer.count -= 1 + if (pointer.count === 0) { + v8Util.deleteHiddenValue(pointer.object, 'atomId') + delete this.storage[id] + } + } + + // Private: Clear the storage when renderer process is destroyed. + registerDeleteListener (webContents, contextId) { + // contextId => ${processHostId}-${contextCount} + const processHostId = contextId.split('-')[0] + const listener = (event, deletedProcessHostId) => { + if (deletedProcessHostId && + deletedProcessHostId.toString() === processHostId) { + webContents.removeListener('render-view-deleted', listener) + this.clear(webContents, contextId) + } + } + webContents.on('render-view-deleted', listener) + } +} + +module.exports = new ObjectsRegistry() diff --git a/electronasar/canary/browser/rpc-server.js b/electronasar/canary/browser/rpc-server.js new file mode 100644 index 0000000..bf3d0a3 --- /dev/null +++ b/electronasar/canary/browser/rpc-server.js @@ -0,0 +1,512 @@ +'use strict' + +const { spawn } = require('child_process') +const electron = require('electron') +const { EventEmitter } = require('events') +const fs = require('fs') +const os = require('os') +const path = require('path') +const v8Util = process.atomBinding('v8_util') +const eventBinding = process.atomBinding('event') + +const { isPromise } = electron + +const ipcMain = require('@electron/internal/browser/ipc-main-internal') +const objectsRegistry = require('@electron/internal/browser/objects-registry') +const bufferUtils = require('@electron/internal/common/buffer-utils') +const errorUtils = require('@electron/internal/common/error-utils') + +const hasProp = {}.hasOwnProperty + +// The internal properties of Function. +const FUNCTION_PROPERTIES = [ + 'length', 'name', 'arguments', 'caller', 'prototype' +] + +// The remote functions in renderer processes. +// id => Function +const rendererFunctions = v8Util.createDoubleIDWeakMap() + +// Return the description of object's members: +const getObjectMembers = function (object) { + let names = Object.getOwnPropertyNames(object) + // For Function, we should not override following properties even though they + // are "own" properties. + if (typeof object === 'function') { + names = names.filter((name) => { + return !FUNCTION_PROPERTIES.includes(name) + }) + } + // Map properties to descriptors. + return names.map((name) => { + const descriptor = Object.getOwnPropertyDescriptor(object, name) + const member = { name, enumerable: descriptor.enumerable, writable: false } + if (descriptor.get === undefined && typeof object[name] === 'function') { + member.type = 'method' + } else { + if (descriptor.set || descriptor.writable) member.writable = true + member.type = 'get' + } + return member + }) +} + +// Return the description of object's prototype. +const getObjectPrototype = function (object) { + const proto = Object.getPrototypeOf(object) + if (proto === null || proto === Object.prototype) return null + return { + members: getObjectMembers(proto), + proto: getObjectPrototype(proto) + } +} + +// Convert a real value into meta data. +const valueToMeta = function (sender, contextId, value, optimizeSimpleObject = false) { + // Determine the type of value. + const meta = { type: typeof value } + if (meta.type === 'object') { + // Recognize certain types of objects. + if (value === null) { + meta.type = 'value' + } else if (bufferUtils.isBuffer(value)) { + meta.type = 'buffer' + } else if (Array.isArray(value)) { + meta.type = 'array' + } else if (value instanceof Error) { + meta.type = 'error' + } else if (value instanceof Date) { + meta.type = 'date' + } else if (isPromise(value)) { + meta.type = 'promise' + } else if (hasProp.call(value, 'callee') && value.length != null) { + // Treat the arguments object as array. + meta.type = 'array' + } else if (optimizeSimpleObject && v8Util.getHiddenValue(value, 'simple')) { + // Treat simple objects as value. + meta.type = 'value' + } + } + + // Fill the meta object according to value's type. + if (meta.type === 'array') { + meta.members = value.map((el) => valueToMeta(sender, contextId, el, optimizeSimpleObject)) + } else if (meta.type === 'object' || meta.type === 'function') { + meta.name = value.constructor ? value.constructor.name : '' + + // Reference the original value if it's an object, because when it's + // passed to renderer we would assume the renderer keeps a reference of + // it. + meta.id = objectsRegistry.add(sender, contextId, value) + meta.members = getObjectMembers(value) + meta.proto = getObjectPrototype(value) + } else if (meta.type === 'buffer') { + meta.value = bufferUtils.bufferToMeta(value) + } else if (meta.type === 'promise') { + // Add default handler to prevent unhandled rejections in main process + // Instead they should appear in the renderer process + value.then(function () {}, function () {}) + + meta.then = valueToMeta(sender, contextId, function (onFulfilled, onRejected) { + value.then(onFulfilled, onRejected) + }) + } else if (meta.type === 'error') { + meta.members = plainObjectToMeta(value) + + // Error.name is not part of own properties. + meta.members.push({ + name: 'name', + value: value.name + }) + } else if (meta.type === 'date') { + meta.value = value.getTime() + } else { + meta.type = 'value' + meta.value = value + } + return meta +} + +// Convert object to meta by value. +const plainObjectToMeta = function (obj) { + return Object.getOwnPropertyNames(obj).map(function (name) { + return { + name: name, + value: obj[name] + } + }) +} + +// Convert Error into meta data. +const exceptionToMeta = function (sender, contextId, error) { + return { + type: 'exception', + value: errorUtils.serialize(error) + } +} + +const throwRPCError = function (message) { + const error = new Error(message) + error.code = 'EBADRPC' + error.errno = -72 + throw error +} + +const removeRemoteListenersAndLogWarning = (sender, callIntoRenderer) => { + const location = v8Util.getHiddenValue(callIntoRenderer, 'location') + let message = `Attempting to call a function in a renderer window that has been closed or released.` + + `\nFunction provided here: ${location}` + + if (sender instanceof EventEmitter) { + const remoteEvents = sender.eventNames().filter((eventName) => { + return sender.listeners(eventName).includes(callIntoRenderer) + }) + + if (remoteEvents.length > 0) { + message += `\nRemote event names: ${remoteEvents.join(', ')}` + remoteEvents.forEach((eventName) => { + sender.removeListener(eventName, callIntoRenderer) + }) + } + } + + console.warn(message) +} + +// Convert array of meta data from renderer into array of real values. +const unwrapArgs = function (sender, contextId, args) { + const metaToValue = function (meta) { + switch (meta.type) { + case 'value': + return meta.value + case 'remote-object': + return objectsRegistry.get(meta.id) + case 'array': + return unwrapArgs(sender, contextId, meta.value) + case 'buffer': + return bufferUtils.metaToBuffer(meta.value) + case 'date': + return new Date(meta.value) + case 'promise': + return Promise.resolve({ + then: metaToValue(meta.then) + }) + case 'object': { + const ret = {} + Object.defineProperty(ret.constructor, 'name', { value: meta.name }) + + for (const { name, value } of meta.members) { + ret[name] = metaToValue(value) + } + return ret + } + case 'function-with-return-value': + const returnValue = metaToValue(meta.value) + return function () { + return returnValue + } + case 'function': { + // Merge contextId and meta.id, since meta.id can be the same in + // different webContents. + const objectId = [contextId, meta.id] + + // Cache the callbacks in renderer. + if (rendererFunctions.has(objectId)) { + return rendererFunctions.get(objectId) + } + + const callIntoRenderer = function (...args) { + if (!sender.isDestroyed()) { + sender._sendInternal('ELECTRON_RENDERER_CALLBACK', contextId, meta.id, valueToMeta(sender, contextId, args)) + } else { + removeRemoteListenersAndLogWarning(this, callIntoRenderer) + } + } + v8Util.setHiddenValue(callIntoRenderer, 'location', meta.location) + Object.defineProperty(callIntoRenderer, 'length', { value: meta.length }) + + v8Util.setRemoteCallbackFreer(callIntoRenderer, contextId, meta.id, sender) + rendererFunctions.set(objectId, callIntoRenderer) + return callIntoRenderer + } + default: + throw new TypeError(`Unknown type: ${meta.type}`) + } + } + return args.map(metaToValue) +} + +// Call a function and send reply asynchronously if it's a an asynchronous +// style function and the caller didn't pass a callback. +const callFunction = function (event, contextId, func, caller, args) { + const funcMarkedAsync = v8Util.getHiddenValue(func, 'asynchronous') + const funcPassedCallback = typeof args[args.length - 1] === 'function' + try { + if (funcMarkedAsync && !funcPassedCallback) { + args.push(function (ret) { + event.returnValue = valueToMeta(event.sender, contextId, ret, true) + }) + func.apply(caller, args) + } else { + const ret = func.apply(caller, args) + return valueToMeta(event.sender, contextId, ret, true) + } + } catch (error) { + // Catch functions thrown further down in function invocation and wrap + // them with the function name so it's easier to trace things like + // `Error processing argument -1.` + const funcName = func.name || 'anonymous' + const err = new Error(`Could not call remote function '${funcName}'. Check that the function signature is correct. Underlying error: ${error.message}`) + err.cause = error + throw err + } +} + +const handleRemoteCommand = function (channel, handler) { + ipcMain.on(channel, (event, contextId, ...args) => { + let returnValue + if (!event.sender._isRemoteModuleEnabled()) { + event.returnValue = null + return + } + + try { + returnValue = handler(event, contextId, ...args) + } catch (error) { + returnValue = exceptionToMeta(event.sender, contextId, error) + } + + if (returnValue !== undefined) { + event.returnValue = returnValue + } + }) +} + +handleRemoteCommand('ELECTRON_BROWSER_WRONG_CONTEXT_ERROR', function (event, contextId, passedContextId, id) { + const objectId = [passedContextId, id] + if (!rendererFunctions.has(objectId)) { + // Do nothing if the error has already been reported before. + return + } + removeRemoteListenersAndLogWarning(event.sender, rendererFunctions.get(objectId)) +}) + +handleRemoteCommand('ELECTRON_BROWSER_REQUIRE', function (event, contextId, moduleName) { + const customEvent = eventBinding.createWithSender(event.sender) + event.sender.emit('remote-require', customEvent, moduleName) + + if (customEvent.defaultPrevented) { + if (typeof customEvent.returnValue === 'undefined') { + throw new Error(`Invalid module: ${moduleName}`) + } + } else { + customEvent.returnValue = process.mainModule.require(moduleName) + } + + return valueToMeta(event.sender, contextId, customEvent.returnValue) +}) + +handleRemoteCommand('ELECTRON_BROWSER_GET_BUILTIN', function (event, contextId, module) { + return valueToMeta(event.sender, contextId, electron[module]) +}) + +handleRemoteCommand('ELECTRON_BROWSER_GLOBAL', function (event, contextId, globalName) { + const customEvent = eventBinding.createWithSender(event.sender) + event.sender.emit('remote-get-global', customEvent, globalName) + + if (customEvent.defaultPrevented) { + if (typeof customEvent.returnValue === 'undefined') { + throw new Error(`Invalid global: ${globalName}`) + } + } else { + customEvent.returnValue = global[globalName] + } + + return valueToMeta(event.sender, contextId, customEvent.returnValue) +}) + +handleRemoteCommand('ELECTRON_BROWSER_CURRENT_WINDOW', function (event, contextId) { + return valueToMeta(event.sender, contextId, event.sender.getOwnerBrowserWindow()) +}) + +handleRemoteCommand('ELECTRON_BROWSER_CURRENT_WEB_CONTENTS', function (event, contextId) { + return valueToMeta(event.sender, contextId, event.sender) +}) + +handleRemoteCommand('ELECTRON_BROWSER_CONSTRUCTOR', function (event, contextId, id, args) { + args = unwrapArgs(event.sender, contextId, args) + const constructor = objectsRegistry.get(id) + + if (constructor == null) { + throwRPCError(`Cannot call constructor on missing remote object ${id}`) + } + + return valueToMeta(event.sender, contextId, new constructor(...args)) +}) + +handleRemoteCommand('ELECTRON_BROWSER_FUNCTION_CALL', function (event, contextId, id, args) { + args = unwrapArgs(event.sender, contextId, args) + const func = objectsRegistry.get(id) + + if (func == null) { + throwRPCError(`Cannot call function on missing remote object ${id}`) + } + + return callFunction(event, contextId, func, global, args) +}) + +handleRemoteCommand('ELECTRON_BROWSER_MEMBER_CONSTRUCTOR', function (event, contextId, id, method, args) { + args = unwrapArgs(event.sender, contextId, args) + const object = objectsRegistry.get(id) + + if (object == null) { + throwRPCError(`Cannot call constructor '${method}' on missing remote object ${id}`) + } + + return valueToMeta(event.sender, contextId, new object[method](...args)) +}) + +handleRemoteCommand('ELECTRON_BROWSER_MEMBER_CALL', function (event, contextId, id, method, args) { + args = unwrapArgs(event.sender, contextId, args) + const obj = objectsRegistry.get(id) + + if (obj == null) { + throwRPCError(`Cannot call function '${method}' on missing remote object ${id}`) + } + + return callFunction(event, contextId, obj[method], obj, args) +}) + +handleRemoteCommand('ELECTRON_BROWSER_MEMBER_SET', function (event, contextId, id, name, args) { + args = unwrapArgs(event.sender, contextId, args) + const obj = objectsRegistry.get(id) + + if (obj == null) { + throwRPCError(`Cannot set property '${name}' on missing remote object ${id}`) + } + + obj[name] = args[0] + return null +}) + +handleRemoteCommand('ELECTRON_BROWSER_MEMBER_GET', function (event, contextId, id, name) { + const obj = objectsRegistry.get(id) + + if (obj == null) { + throwRPCError(`Cannot get property '${name}' on missing remote object ${id}`) + } + + return valueToMeta(event.sender, contextId, obj[name]) +}) + +handleRemoteCommand('ELECTRON_BROWSER_DEREFERENCE', function (event, contextId, id) { + objectsRegistry.remove(event.sender, contextId, id) +}) + +handleRemoteCommand('ELECTRON_BROWSER_CONTEXT_RELEASE', (event, contextId) => { + objectsRegistry.clear(event.sender, contextId) + return null +}) + +handleRemoteCommand('ELECTRON_BROWSER_GUEST_WEB_CONTENTS', function (event, contextId, guestInstanceId) { + const guestViewManager = require('@electron/internal/browser/guest-view-manager') + return valueToMeta(event.sender, contextId, guestViewManager.getGuest(guestInstanceId)) +}) + +// Implements window.close() +ipcMain.on('ELECTRON_BROWSER_WINDOW_CLOSE', function (event) { + const window = event.sender.getOwnerBrowserWindow() + if (window) { + window.close() + } + event.returnValue = null +}) + +const getTempDirectory = function () { + try { + return electron.app.getPath('temp') + } catch (error) { + return os.tmpdir() + } +} + +const crashReporterInit = function (options) { + const productName = options.productName || electron.app.getName() + const crashesDirectory = path.join(getTempDirectory(), `${productName} Crashes`) + let crashServicePid + + if (process.platform === 'win32') { + const env = { + ELECTRON_INTERNAL_CRASH_SERVICE: 1 + } + const args = [ + '--reporter-url=' + options.submitURL, + '--application-name=' + productName, + '--crashes-directory=' + crashesDirectory, + '--v=1' + ] + + const crashServiceProcess = spawn(process.helperExecPath, args, { + env, + detached: true + }) + + crashServicePid = crashServiceProcess.pid + } + + return { + productName, + crashesDirectory, + crashServicePid, + appVersion: electron.app.getVersion() + } +} + +const setReturnValue = function (event, getValue) { + try { + event.returnValue = [null, getValue()] + } catch (error) { + event.returnValue = [errorUtils.serialize(error)] + } +} + +ipcMain.on('ELECTRON_CRASH_REPORTER_INIT', function (event, options) { + setReturnValue(event, () => crashReporterInit(options)) +}) + +ipcMain.on('ELECTRON_BROWSER_GET_LAST_WEB_PREFERENCES', function (event) { + setReturnValue(event, () => event.sender.getLastWebPreferences()) +}) + +ipcMain.on('ELECTRON_BROWSER_CLIPBOARD_READ_FIND_TEXT', function (event) { + setReturnValue(event, () => electron.clipboard.readFindText()) +}) + +ipcMain.on('ELECTRON_BROWSER_CLIPBOARD_WRITE_FIND_TEXT', function (event, text) { + setReturnValue(event, () => electron.clipboard.writeFindText(text)) +}) + +ipcMain.on('ELECTRON_BROWSER_SANDBOX_LOAD', function (event) { + const preloadPath = event.sender._getPreloadPath() + let preloadSrc = null + let preloadError = null + if (preloadPath) { + try { + preloadSrc = fs.readFileSync(preloadPath).toString() + } catch (err) { + preloadError = { stack: err ? err.stack : (new Error(`Failed to load "${preloadPath}"`)).stack } + } + } + event.returnValue = { + preloadSrc, + preloadError, + isRemoteModuleEnabled: event.sender._isRemoteModuleEnabled(), + process: { + arch: process.arch, + platform: process.platform, + env: process.env, + version: process.version, + versions: process.versions + } + } +}) diff --git a/electronasar/canary/common/api/clipboard.js b/electronasar/canary/common/api/clipboard.js new file mode 100644 index 0000000..e0c9921 --- /dev/null +++ b/electronasar/canary/common/api/clipboard.js @@ -0,0 +1,31 @@ +'use strict' + +if (process.platform === 'linux' && process.type === 'renderer') { + // On Linux we could not access clipboard in renderer process. + const { getRemoteForUsage } = require('@electron/internal/renderer/remote') + module.exports = getRemoteForUsage('clipboard').clipboard +} else { + const clipboard = process.atomBinding('clipboard') + + // Read/write to find pasteboard over IPC since only main process is notified + // of changes + if (process.platform === 'darwin' && process.type === 'renderer') { + const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + const errorUtils = require('@electron/internal/common/error-utils') + + const invoke = function (command, ...args) { + const [ error, result ] = ipcRenderer.sendSync(command, ...args) + + if (error) { + throw errorUtils.deserialize(error) + } else { + return result + } + } + + clipboard.readFindText = (...args) => invoke('ELECTRON_BROWSER_CLIPBOARD_READ_FIND_TEXT', ...args) + clipboard.writeFindText = (...args) => invoke('ELECTRON_BROWSER_CLIPBOARD_WRITE_FIND_TEXT', ...args) + } + + module.exports = clipboard +} diff --git a/electronasar/canary/common/api/deprecate.js b/electronasar/canary/common/api/deprecate.js new file mode 100644 index 0000000..f72939b --- /dev/null +++ b/electronasar/canary/common/api/deprecate.js @@ -0,0 +1,95 @@ +'use strict' + +let deprecationHandler = null + +function warnOnce (oldName, newName) { + let warned = false + const msg = newName + ? `'${oldName}' is deprecated and will be removed. Please use '${newName}' instead.` + : `'${oldName}' is deprecated and will be removed.` + return () => { + if (!warned && !process.noDeprecation) { + warned = true + deprecate.log(msg) + } + } +} + +const deprecate = { + setHandler: (handler) => { deprecationHandler = handler }, + getHandler: () => deprecationHandler, + warn: (oldName, newName) => { + return deprecate.log(`'${oldName}' is deprecated. Use '${newName}' instead.`) + }, + log: (message) => { + if (typeof deprecationHandler === 'function') { + deprecationHandler(message) + } else if (process.throwDeprecation) { + throw new Error(message) + } else if (process.traceDeprecation) { + return console.trace(message) + } else { + return console.warn(`(electron) ${message}`) + } + }, + + event: (emitter, oldName, newName) => { + const warn = newName.startsWith('-') /* internal event */ + ? warnOnce(`${oldName} event`) + : warnOnce(`${oldName} event`, `${newName} event`) + return emitter.on(newName, function (...args) { + if (this.listenerCount(oldName) !== 0) { + warn() + this.emit(oldName, ...args) + } + }) + }, + + removeProperty: (o, removedName) => { + // if the property's already been removed, warn about it + if (!(removedName in o)) { + deprecate.log(`Unable to remove property '${removedName}' from an object that lacks it.`) + } + + // wrap the deprecated property in an accessor to warn + const warn = warnOnce(removedName) + let val = o[removedName] + return Object.defineProperty(o, removedName, { + configurable: true, + get: () => { + warn() + return val + }, + set: newVal => { + warn() + val = newVal + } + }) + }, + + renameProperty: (o, oldName, newName) => { + const warn = warnOnce(oldName, newName) + + // if the new property isn't there yet, + // inject it and warn about it + if ((oldName in o) && !(newName in o)) { + warn() + o[newName] = o[oldName] + } + + // wrap the deprecated property in an accessor to warn + // and redirect to the new property + return Object.defineProperty(o, oldName, { + get: () => { + warn() + return o[newName] + }, + set: value => { + warn() + o[newName] = value + } + }) + } +} + +module.exports = deprecate diff --git a/electronasar/canary/common/api/deprecations.js b/electronasar/canary/common/api/deprecations.js new file mode 100644 index 0000000..f4c4d74 --- /dev/null +++ b/electronasar/canary/common/api/deprecations.js @@ -0,0 +1,11 @@ +'use strict' + +const deprecate = require('electron').deprecate + +exports.setHandler = function (deprecationHandler) { + deprecate.setHandler(deprecationHandler) +} + +exports.getHandler = function () { + return deprecate.getHandler() +} diff --git a/electronasar/canary/common/api/exports/electron.js b/electronasar/canary/common/api/exports/electron.js new file mode 100644 index 0000000..49c6702 --- /dev/null +++ b/electronasar/canary/common/api/exports/electron.js @@ -0,0 +1,31 @@ +'use strict' + +const moduleList = require('@electron/internal/common/api/module-list') + +exports.memoizedGetter = (getter) => { + /* + * It's ok to leak this value as it would be leaked by the global + * node module cache anyway at `Module._cache`. This memoization + * is dramatically faster than relying on nodes module cache however + */ + let memoizedValue = null + + return () => { + if (memoizedValue === null) { + memoizedValue = getter() + } + return memoizedValue + } +} + +// Attaches properties to |targetExports|. +exports.defineProperties = function (targetExports) { + const descriptors = {} + for (const module of moduleList) { + descriptors[module.name] = { + enumerable: !module.private, + get: exports.memoizedGetter(() => require(`@electron/internal/common/api/${module.file}`)) + } + } + return Object.defineProperties(targetExports, descriptors) +} diff --git a/electronasar/canary/common/api/is-promise.js b/electronasar/canary/common/api/is-promise.js new file mode 100644 index 0000000..d6115a1 --- /dev/null +++ b/electronasar/canary/common/api/is-promise.js @@ -0,0 +1,14 @@ +'use strict' + +module.exports = function isPromise (val) { + return ( + val && + val.then && + val.then instanceof Function && + val.constructor && + val.constructor.reject && + val.constructor.reject instanceof Function && + val.constructor.resolve && + val.constructor.resolve instanceof Function + ) +} diff --git a/electronasar/canary/common/api/module-list.js b/electronasar/canary/common/api/module-list.js new file mode 100644 index 0000000..3741f17 --- /dev/null +++ b/electronasar/canary/common/api/module-list.js @@ -0,0 +1,12 @@ +'use strict' + +// Common modules, please sort alphabetically +module.exports = [ + { name: 'clipboard', file: 'clipboard' }, + { name: 'nativeImage', file: 'native-image' }, + { name: 'shell', file: 'shell' }, + // The internal modules, invisible unless you know their names. + { name: 'deprecate', file: 'deprecate', private: true }, + { name: 'deprecations', file: 'deprecations', private: true }, + { name: 'isPromise', file: 'is-promise', private: true } +] diff --git a/electronasar/canary/common/api/native-image.js b/electronasar/canary/common/api/native-image.js new file mode 100644 index 0000000..f703f94 --- /dev/null +++ b/electronasar/canary/common/api/native-image.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = process.atomBinding('native_image') diff --git a/electronasar/canary/common/api/shell.js b/electronasar/canary/common/api/shell.js new file mode 100644 index 0000000..6907d90 --- /dev/null +++ b/electronasar/canary/common/api/shell.js @@ -0,0 +1,3 @@ +'use strict' + +module.exports = process.atomBinding('shell') diff --git a/electronasar/canary/common/atom-binding-setup.js b/electronasar/canary/common/atom-binding-setup.js new file mode 100644 index 0000000..36954f5 --- /dev/null +++ b/electronasar/canary/common/atom-binding-setup.js @@ -0,0 +1,15 @@ +'use strict' + +module.exports = function atomBindingSetup (binding, processType) { + return function atomBinding (name) { + try { + return binding(`atom_${processType}_${name}`) + } catch (error) { + if (/No such module/.test(error.message)) { + return binding(`atom_common_${name}`) + } else { + throw error + } + } + } +} diff --git a/electronasar/canary/common/buffer-utils.js b/electronasar/canary/common/buffer-utils.js new file mode 100644 index 0000000..8bfdf66 --- /dev/null +++ b/electronasar/canary/common/buffer-utils.js @@ -0,0 +1,66 @@ +'use strict' + +// Note: Don't use destructuring assignment for `Buffer`, or we'll hit a +// browserify bug that makes the statement invalid, throwing an error in +// sandboxed renderer. +const Buffer = require('buffer').Buffer + +const typedArrays = { + Buffer, + ArrayBuffer, + Int8Array, + Uint8Array, + Uint8ClampedArray, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array +} + +function getType (value) { + for (const type of Object.keys(typedArrays)) { + if (value instanceof typedArrays[type]) { + return type + } + } + return null +} + +function getBuffer (value) { + if (value instanceof Buffer) { + return value + } else if (value instanceof ArrayBuffer) { + return Buffer.from(value) + } else { + return Buffer.from(value.buffer, value.byteOffset, value.byteLength) + } +} + +exports.isBuffer = function (value) { + return ArrayBuffer.isView(value) || value instanceof ArrayBuffer +} + +exports.bufferToMeta = function (value) { + return { + type: getType(value), + data: getBuffer(value), + length: value.length + } +} + +exports.metaToBuffer = function (value) { + const constructor = typedArrays[value.type] + const data = getBuffer(value.data) + + if (constructor === Buffer) { + return data + } else if (constructor === ArrayBuffer) { + return data.buffer + } else if (constructor) { + return new constructor(data.buffer, data.byteOffset, value.length) + } else { + return data + } +} diff --git a/electronasar/canary/common/crash-reporter.js b/electronasar/canary/common/crash-reporter.js new file mode 100644 index 0000000..eed2c24 --- /dev/null +++ b/electronasar/canary/common/crash-reporter.js @@ -0,0 +1,123 @@ +'use strict' + +const binding = process.atomBinding('crash_reporter') + +const errorUtils = require('@electron/internal/common/error-utils') + +class CrashReporter { + contructor () { + this.productName = null + this.crashesDirectory = null + } + + sendSync (channel, ...args) { + throw new Error('Not implemented') + } + + invoke (command, ...args) { + const [ error, result ] = this.sendSync(command, ...args) + + if (error) { + throw errorUtils.deserialize(error) + } + + return result + } + + start (options) { + if (options == null) options = {} + + let { + productName, + companyName, + extra, + ignoreSystemCrashHandler, + submitURL, + uploadToServer + } = options + + if (uploadToServer == null) { + uploadToServer = true + } + + if (ignoreSystemCrashHandler == null) { + ignoreSystemCrashHandler = false + } + + if (companyName == null) { + throw new Error('companyName is a required option to crashReporter.start') + } + if (submitURL == null) { + throw new Error('submitURL is a required option to crashReporter.start') + } + + const ret = this.invoke('ELECTRON_CRASH_REPORTER_INIT', { + submitURL, + productName + }) + + this.productName = ret.productName + this.crashesDirectory = ret.crashesDirectory + this.crashServicePid = ret.crashServicePid + + if (extra == null) extra = {} + if (extra._productName == null) extra._productName = ret.productName + if (extra._companyName == null) extra._companyName = companyName + if (extra._version == null) extra._version = ret.appVersion + + binding.start(ret.productName, companyName, submitURL, ret.crashesDirectory, uploadToServer, ignoreSystemCrashHandler, extra) + } + + getLastCrashReport () { + const reports = this.getUploadedReports() + .sort((a, b) => { + const ats = (a && a.date) ? new Date(a.date).getTime() : 0 + const bts = (b && b.date) ? new Date(b.date).getTime() : 0 + return bts - ats + }) + + return (reports.length > 0) ? reports[0] : null + } + + getUploadedReports () { + return binding.getUploadedReports(this.getCrashesDirectory()) + } + + getCrashesDirectory () { + return this.crashesDirectory + } + + getProductName () { + return this.productName + } + + getUploadToServer () { + if (process.type === 'browser') { + return binding.getUploadToServer() + } else { + throw new Error('getUploadToServer can only be called from the main process') + } + } + + setUploadToServer (uploadToServer) { + if (process.type === 'browser') { + return binding.setUploadToServer(uploadToServer) + } else { + throw new Error('setUploadToServer can only be called from the main process') + } + } + + addExtraParameter (key, value) { + binding.addExtraParameter(key, value) + } + + removeExtraParameter (key) { + binding.removeExtraParameter(key) + } + + getParameters (key, value) { + return binding.getParameters() + } +} + +module.exports = CrashReporter diff --git a/electronasar/canary/common/error-utils.js b/electronasar/canary/common/error-utils.js new file mode 100644 index 0000000..26dd018 --- /dev/null +++ b/electronasar/canary/common/error-utils.js @@ -0,0 +1,39 @@ +'use strict' + +const constructors = new Map([ + [Error.name, Error], + [EvalError.name, EvalError], + [RangeError.name, RangeError], + [ReferenceError.name, ReferenceError], + [SyntaxError.name, SyntaxError], + [TypeError.name, TypeError], + [URIError.name, URIError] +]) + +exports.deserialize = function (error) { + if (error && error.__ELECTRON_SERIALIZED_ERROR__ && constructors.has(error.name)) { + const constructor = constructors.get(error.name) + const deserializedError = new constructor(error.message) + deserializedError.stack = error.stack + deserializedError.from = error.from + deserializedError.cause = exports.deserialize(error.cause) + return deserializedError + } + return error +} + +exports.serialize = function (error) { + if (error instanceof Error) { + // Errors get lost, because: JSON.stringify(new Error('Message')) === {} + // Take the serializable properties and construct a generic object + return { + message: error.message, + stack: error.stack, + name: error.name, + from: process.type, + cause: exports.serialize(error.cause), + __ELECTRON_SERIALIZED_ERROR__: true + } + } + return error +} diff --git a/electronasar/canary/common/init.js b/electronasar/canary/common/init.js new file mode 100644 index 0000000..a69d962 --- /dev/null +++ b/electronasar/canary/common/init.js @@ -0,0 +1,53 @@ +'use strict' + +const timers = require('timers') +const util = require('util') + +process.atomBinding = require('@electron/internal/common/atom-binding-setup')(process.binding, process.type) + +// setImmediate and process.nextTick makes use of uv_check and uv_prepare to +// run the callbacks, however since we only run uv loop on requests, the +// callbacks wouldn't be called until something else activated the uv loop, +// which would delay the callbacks for arbitrary long time. So we should +// initiatively activate the uv loop once setImmediate and process.nextTick is +// called. +const wrapWithActivateUvLoop = function (func) { + return wrap(func, function (func) { + return function () { + process.activateUvLoop() + return func.apply(this, arguments) + } + }) +} + +function wrap (func, wrapper) { + const wrapped = wrapper(func) + if (func[util.promisify.custom]) { + wrapped[util.promisify.custom] = wrapper(func[util.promisify.custom]) + } + return wrapped +} + +process.nextTick = wrapWithActivateUvLoop(process.nextTick) + +global.setImmediate = wrapWithActivateUvLoop(timers.setImmediate) +global.clearImmediate = timers.clearImmediate + +if (process.type === 'browser') { + // setTimeout needs to update the polling timeout of the event loop, when + // called under Chromium's event loop the node's event loop won't get a chance + // to update the timeout, so we have to force the node's event loop to + // recalculate the timeout in browser process. + global.setTimeout = wrapWithActivateUvLoop(timers.setTimeout) + global.setInterval = wrapWithActivateUvLoop(timers.setInterval) +} + +if (process.platform === 'win32') { + // Always returns EOF for stdin stream. + const { Readable } = require('stream') + const stdin = new Readable() + stdin.push(null) + process.__defineGetter__('stdin', function () { + return stdin + }) +} diff --git a/electronasar/canary/common/parse-features-string.js b/electronasar/canary/common/parse-features-string.js new file mode 100644 index 0000000..955ab8f --- /dev/null +++ b/electronasar/canary/common/parse-features-string.js @@ -0,0 +1,21 @@ +'use strict' + +// parses a feature string that has the format used in window.open() +// - `features` input string +// - `emit` function(key, value) - called for each parsed KV +module.exports = function parseFeaturesString (features, emit) { + features = `${features}` + // split the string by ',' + features.split(/,\s*/).forEach((feature) => { + // expected form is either a key by itself or a key/value pair in the form of + // 'key=value' + let [key, value] = feature.split(/\s*=/) + if (!key) return + + // interpret the value as a boolean, if possible + value = (value === 'yes' || value === '1') ? true : (value === 'no' || value === '0') ? false : value + + // emit the parsed pair + emit(key, value) + }) +} diff --git a/electronasar/canary/common/reset-search-paths.js b/electronasar/canary/common/reset-search-paths.js new file mode 100644 index 0000000..5890592 --- /dev/null +++ b/electronasar/canary/common/reset-search-paths.js @@ -0,0 +1,45 @@ +'use strict' + +const path = require('path') +const Module = require('module') + +// Clear Node's global search paths. +Module.globalPaths.length = 0 + +// Clear current and parent(init.js)'s search paths. +module.paths = [] +module.parent.paths = [] + +// Prevent Node from adding paths outside this app to search paths. +const resourcesPathWithTrailingSlash = process.resourcesPath + path.sep +const originalNodeModulePaths = Module._nodeModulePaths +Module._nodeModulePaths = function (from) { + const paths = originalNodeModulePaths(from) + const fromPath = path.resolve(from) + path.sep + // If "from" is outside the app then we do nothing. + if (fromPath.startsWith(resourcesPathWithTrailingSlash)) { + return paths.filter(function (candidate) { + return candidate.startsWith(resourcesPathWithTrailingSlash) + }) + } else { + return paths + } +} + +const BASE_INTERNAL_PATH = path.resolve(__dirname, '..') +const INTERNAL_MODULE_PREFIX = '@electron/internal/' + +// Patch Module._resolveFilename to always require the Electron API when +// require('electron') is done. +const electronPath = path.join(__dirname, '..', process.type, 'api', 'exports', 'electron.js') +const originalResolveFilename = Module._resolveFilename +Module._resolveFilename = function (request, parent, isMain) { + if (request === 'electron') { + return electronPath + } else if (request.startsWith(INTERNAL_MODULE_PREFIX) && request.length > INTERNAL_MODULE_PREFIX.length) { + const slicedRequest = request.slice(INTERNAL_MODULE_PREFIX.length) + return path.resolve(BASE_INTERNAL_PATH, `${slicedRequest}${slicedRequest.endsWith('.js') ? '' : '.js'}`) + } else { + return originalResolveFilename(request, parent, isMain) + } +} diff --git a/electronasar/canary/renderer/api/crash-reporter.js b/electronasar/canary/renderer/api/crash-reporter.js new file mode 100644 index 0000000..5bbd90e --- /dev/null +++ b/electronasar/canary/renderer/api/crash-reporter.js @@ -0,0 +1,12 @@ +'use strict' + +const CrashReporter = require('@electron/internal/common/crash-reporter') +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + +class CrashReporterRenderer extends CrashReporter { + sendSync (channel, ...args) { + return ipcRenderer.sendSync(channel, ...args) + } +} + +module.exports = new CrashReporterRenderer() diff --git a/electronasar/canary/renderer/api/desktop-capturer.js b/electronasar/canary/renderer/api/desktop-capturer.js new file mode 100644 index 0000000..e4ece82 --- /dev/null +++ b/electronasar/canary/renderer/api/desktop-capturer.js @@ -0,0 +1,48 @@ +'use strict' + +const { nativeImage } = require('electron') +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + +const includes = [].includes +let currentId = 0 + +const incrementId = () => { + currentId += 1 + return currentId +} + +// |options.types| can't be empty and must be an array +function isValid (options) { + const types = options ? options.types : undefined + return Array.isArray(types) +} + +exports.getSources = function (options, callback) { + if (!isValid(options)) return callback(new Error('Invalid options')) + const captureWindow = includes.call(options.types, 'window') + const captureScreen = includes.call(options.types, 'screen') + + if (options.thumbnailSize == null) { + options.thumbnailSize = { + width: 150, + height: 150 + } + } + + const id = incrementId() + ipcRenderer.send('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', captureWindow, captureScreen, options.thumbnailSize, id) + return ipcRenderer.once(`ELECTRON_RENDERER_DESKTOP_CAPTURER_RESULT_${id}`, (event, sources) => { + callback(null, (() => { + const results = [] + sources.forEach(source => { + results.push({ + id: source.id, + name: source.name, + thumbnail: nativeImage.createFromDataURL(source.thumbnail), + display_id: source.display_id + }) + }) + return results + })()) + }) +} diff --git a/electronasar/canary/renderer/api/exports/electron.js b/electronasar/canary/renderer/api/exports/electron.js new file mode 100644 index 0000000..63aa8d4 --- /dev/null +++ b/electronasar/canary/renderer/api/exports/electron.js @@ -0,0 +1,23 @@ +'use strict' + +const common = require('@electron/internal/common/api/exports/electron') +const moduleList = require('@electron/internal/renderer/api/module-list') + +// Import common modules. +common.defineProperties(exports) + +for (const { + name, + file, + enabled = true, + private: isPrivate = false +} of moduleList) { + if (!enabled) { + continue + } + + Object.defineProperty(exports, name, { + enumerable: !isPrivate, + get: common.memoizedGetter(() => require(`@electron/internal/renderer/api/${file}`)) + }) +} diff --git a/electronasar/canary/renderer/api/ipc-renderer.js b/electronasar/canary/renderer/api/ipc-renderer.js new file mode 100644 index 0000000..7705f9f --- /dev/null +++ b/electronasar/canary/renderer/api/ipc-renderer.js @@ -0,0 +1,30 @@ +'use strict' + +const binding = process.atomBinding('ipc') +const v8Util = process.atomBinding('v8_util') + +// Created by init.js. +const ipcRenderer = v8Util.getHiddenValue(global, 'ipc') +const internal = false + +ipcRenderer.send = function (...args) { + return binding.send('ipc-message', args) +} + +ipcRenderer.sendSync = function (...args) { + return binding.sendSync('ipc-message-sync', args)[0] +} + +ipcRenderer.sendToHost = function (...args) { + return binding.send('ipc-message-host', args) +} + +ipcRenderer.sendTo = function (webContentsId, channel, ...args) { + return binding.sendTo(internal, false, webContentsId, channel, args) +} + +ipcRenderer.sendToAll = function (webContentsId, channel, ...args) { + return binding.sendTo(internal, true, webContentsId, channel, args) +} + +module.exports = ipcRenderer diff --git a/electronasar/canary/renderer/api/module-list.js b/electronasar/canary/renderer/api/module-list.js new file mode 100644 index 0000000..b9bba8a --- /dev/null +++ b/electronasar/canary/renderer/api/module-list.js @@ -0,0 +1,21 @@ +'use strict' + +const features = process.atomBinding('features') +const v8Util = process.atomBinding('v8_util') + +const enableRemoteModule = v8Util.getHiddenValue(global, 'enableRemoteModule') + +// Renderer side modules, please sort alphabetically. +// A module is `enabled` if there is no explicit condition defined. +module.exports = [ + { name: 'crashReporter', file: 'crash-reporter', enabled: true }, + { + name: 'desktopCapturer', + file: 'desktop-capturer', + enabled: features.isDesktopCapturerEnabled() + }, + { name: 'ipcRenderer', file: 'ipc-renderer' }, + { name: 'remote', file: 'remote', enabled: enableRemoteModule }, + { name: 'screen', file: 'screen' }, + { name: 'webFrame', file: 'web-frame' } +] diff --git a/electronasar/canary/renderer/api/remote.js b/electronasar/canary/renderer/api/remote.js new file mode 100644 index 0000000..036ebd8 --- /dev/null +++ b/electronasar/canary/renderer/api/remote.js @@ -0,0 +1,355 @@ +'use strict' + +const v8Util = process.atomBinding('v8_util') +const { isPromise } = require('electron') +const resolvePromise = Promise.resolve.bind(Promise) + +const CallbacksRegistry = require('@electron/internal/renderer/callbacks-registry') +const bufferUtils = require('@electron/internal/common/buffer-utils') +const errorUtils = require('@electron/internal/common/error-utils') +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + +const callbacksRegistry = new CallbacksRegistry() +const remoteObjectCache = v8Util.createIDWeakMap() + +// An unique ID that can represent current context. +const contextId = v8Util.getHiddenValue(global, 'contextId') + +// Notify the main process when current context is going to be released. +// Note that when the renderer process is destroyed, the message may not be +// sent, we also listen to the "render-view-deleted" event in the main process +// to guard that situation. +process.on('exit', () => { + const command = 'ELECTRON_BROWSER_CONTEXT_RELEASE' + ipcRenderer.sendSync(command, contextId) +}) + +// Convert the arguments object into an array of meta data. +function wrapArgs (args, visited = new Set()) { + const valueToMeta = (value) => { + // Check for circular reference. + if (visited.has(value)) { + return { + type: 'value', + value: null + } + } + + if (Array.isArray(value)) { + visited.add(value) + const meta = { + type: 'array', + value: wrapArgs(value, visited) + } + visited.delete(value) + return meta + } else if (bufferUtils.isBuffer(value)) { + return { + type: 'buffer', + value: bufferUtils.bufferToMeta(value) + } + } else if (value instanceof Date) { + return { + type: 'date', + value: value.getTime() + } + } else if ((value != null) && typeof value === 'object') { + if (isPromise(value)) { + return { + type: 'promise', + then: valueToMeta(function (onFulfilled, onRejected) { + value.then(onFulfilled, onRejected) + }) + } + } else if (v8Util.getHiddenValue(value, 'atomId')) { + return { + type: 'remote-object', + id: v8Util.getHiddenValue(value, 'atomId') + } + } + + const meta = { + type: 'object', + name: value.constructor ? value.constructor.name : '', + members: [] + } + visited.add(value) + for (const prop in value) { + meta.members.push({ + name: prop, + value: valueToMeta(value[prop]) + }) + } + visited.delete(value) + return meta + } else if (typeof value === 'function' && v8Util.getHiddenValue(value, 'returnValue')) { + return { + type: 'function-with-return-value', + value: valueToMeta(value()) + } + } else if (typeof value === 'function') { + return { + type: 'function', + id: callbacksRegistry.add(value), + location: v8Util.getHiddenValue(value, 'location'), + length: value.length + } + } else { + return { + type: 'value', + value: value + } + } + } + return args.map(valueToMeta) +} + +// Populate object's members from descriptors. +// The |ref| will be kept referenced by |members|. +// This matches |getObjectMemebers| in rpc-server. +function setObjectMembers (ref, object, metaId, members) { + if (!Array.isArray(members)) return + + for (const member of members) { + if (object.hasOwnProperty(member.name)) continue + + const descriptor = { enumerable: member.enumerable } + if (member.type === 'method') { + const remoteMemberFunction = function (...args) { + let command + if (this && this.constructor === remoteMemberFunction) { + command = 'ELECTRON_BROWSER_MEMBER_CONSTRUCTOR' + } else { + command = 'ELECTRON_BROWSER_MEMBER_CALL' + } + const ret = ipcRenderer.sendSync(command, contextId, metaId, member.name, wrapArgs(args)) + return metaToValue(ret) + } + + let descriptorFunction = proxyFunctionProperties(remoteMemberFunction, metaId, member.name) + + descriptor.get = () => { + descriptorFunction.ref = ref // The member should reference its object. + return descriptorFunction + } + // Enable monkey-patch the method + descriptor.set = (value) => { + descriptorFunction = value + return value + } + descriptor.configurable = true + } else if (member.type === 'get') { + descriptor.get = () => { + const command = 'ELECTRON_BROWSER_MEMBER_GET' + const meta = ipcRenderer.sendSync(command, contextId, metaId, member.name) + return metaToValue(meta) + } + + if (member.writable) { + descriptor.set = (value) => { + const args = wrapArgs([value]) + const command = 'ELECTRON_BROWSER_MEMBER_SET' + const meta = ipcRenderer.sendSync(command, contextId, metaId, member.name, args) + if (meta != null) metaToValue(meta) + return value + } + } + } + + Object.defineProperty(object, member.name, descriptor) + } +} + +// Populate object's prototype from descriptor. +// This matches |getObjectPrototype| in rpc-server. +function setObjectPrototype (ref, object, metaId, descriptor) { + if (descriptor === null) return + const proto = {} + setObjectMembers(ref, proto, metaId, descriptor.members) + setObjectPrototype(ref, proto, metaId, descriptor.proto) + Object.setPrototypeOf(object, proto) +} + +// Wrap function in Proxy for accessing remote properties +function proxyFunctionProperties (remoteMemberFunction, metaId, name) { + let loaded = false + + // Lazily load function properties + const loadRemoteProperties = () => { + if (loaded) return + loaded = true + const command = 'ELECTRON_BROWSER_MEMBER_GET' + const meta = ipcRenderer.sendSync(command, contextId, metaId, name) + setObjectMembers(remoteMemberFunction, remoteMemberFunction, meta.id, meta.members) + } + + return new Proxy(remoteMemberFunction, { + set: (target, property, value, receiver) => { + if (property !== 'ref') loadRemoteProperties() + target[property] = value + return true + }, + get: (target, property, receiver) => { + if (!target.hasOwnProperty(property)) loadRemoteProperties() + const value = target[property] + if (property === 'toString' && typeof value === 'function') { + return value.bind(target) + } + return value + }, + ownKeys: (target) => { + loadRemoteProperties() + return Object.getOwnPropertyNames(target) + }, + getOwnPropertyDescriptor: (target, property) => { + const descriptor = Object.getOwnPropertyDescriptor(target, property) + if (descriptor) return descriptor + loadRemoteProperties() + return Object.getOwnPropertyDescriptor(target, property) + } + }) +} + +// Convert meta data from browser into real value. +function metaToValue (meta) { + const types = { + value: () => meta.value, + array: () => meta.members.map((member) => metaToValue(member)), + buffer: () => bufferUtils.metaToBuffer(meta.value), + promise: () => resolvePromise({ then: metaToValue(meta.then) }), + error: () => metaToPlainObject(meta), + date: () => new Date(meta.value), + exception: () => { throw errorUtils.deserialize(meta.value) } + } + + if (meta.type in types) { + return types[meta.type]() + } else { + let ret + if (remoteObjectCache.has(meta.id)) { + return remoteObjectCache.get(meta.id) + } + + // A shadow class to represent the remote function object. + if (meta.type === 'function') { + const remoteFunction = function (...args) { + let command + if (this && this.constructor === remoteFunction) { + command = 'ELECTRON_BROWSER_CONSTRUCTOR' + } else { + command = 'ELECTRON_BROWSER_FUNCTION_CALL' + } + const obj = ipcRenderer.sendSync(command, contextId, meta.id, wrapArgs(args)) + return metaToValue(obj) + } + ret = remoteFunction + } else { + ret = {} + } + + setObjectMembers(ret, ret, meta.id, meta.members) + setObjectPrototype(ret, ret, meta.id, meta.proto) + Object.defineProperty(ret.constructor, 'name', { value: meta.name }) + + // Track delegate obj's lifetime & tell browser to clean up when object is GCed. + v8Util.setRemoteObjectFreer(ret, contextId, meta.id) + v8Util.setHiddenValue(ret, 'atomId', meta.id) + remoteObjectCache.set(meta.id, ret) + return ret + } +} + +// Construct a plain object from the meta. +function metaToPlainObject (meta) { + const obj = (() => meta.type === 'error' ? new Error() : {})() + for (let i = 0; i < meta.members.length; i++) { + const { name, value } = meta.members[i] + obj[name] = value + } + return obj +} + +function handleMessage (channel, handler) { + ipcRenderer.on(channel, (event, passedContextId, id, ...args) => { + if (passedContextId === contextId) { + handler(id, ...args) + } else { + // Message sent to an un-exist context, notify the error to main process. + ipcRenderer.send('ELECTRON_BROWSER_WRONG_CONTEXT_ERROR', contextId, passedContextId, id) + } + }) +} + +// Browser calls a callback in renderer. +handleMessage('ELECTRON_RENDERER_CALLBACK', (id, args) => { + callbacksRegistry.apply(id, metaToValue(args)) +}) + +// A callback in browser is released. +handleMessage('ELECTRON_RENDERER_RELEASE_CALLBACK', (id) => { + callbacksRegistry.remove(id) +}) + +exports.require = (module) => { + const command = 'ELECTRON_BROWSER_REQUIRE' + const meta = ipcRenderer.sendSync(command, contextId, module) + return metaToValue(meta) +} + +// Alias to remote.require('electron').xxx. +exports.getBuiltin = (module) => { + const command = 'ELECTRON_BROWSER_GET_BUILTIN' + const meta = ipcRenderer.sendSync(command, contextId, module) + return metaToValue(meta) +} + +exports.getCurrentWindow = () => { + const command = 'ELECTRON_BROWSER_CURRENT_WINDOW' + const meta = ipcRenderer.sendSync(command, contextId) + return metaToValue(meta) +} + +// Get current WebContents object. +exports.getCurrentWebContents = () => { + return metaToValue(ipcRenderer.sendSync('ELECTRON_BROWSER_CURRENT_WEB_CONTENTS', contextId)) +} + +// Get a global object in browser. +exports.getGlobal = (name) => { + const command = 'ELECTRON_BROWSER_GLOBAL' + const meta = ipcRenderer.sendSync(command, contextId, name) + return metaToValue(meta) +} + +// Get the process object in browser. +exports.__defineGetter__('process', () => exports.getGlobal('process')) + +// Create a function that will return the specified value when called in browser. +exports.createFunctionWithReturnValue = (returnValue) => { + const func = () => returnValue + v8Util.setHiddenValue(func, 'returnValue', true) + return func +} + +// Get the guest WebContents from guestInstanceId. +exports.getGuestWebContents = (guestInstanceId) => { + const command = 'ELECTRON_BROWSER_GUEST_WEB_CONTENTS' + const meta = ipcRenderer.sendSync(command, contextId, guestInstanceId) + return metaToValue(meta) +} + +const addBuiltinProperty = (name) => { + Object.defineProperty(exports, name, { + get: () => exports.getBuiltin(name) + }) +} + +const browserModules = + require('@electron/internal/common/api/module-list').concat( + require('@electron/internal/browser/api/module-list')) + +// And add a helper receiver for each one. +browserModules + .filter((m) => !m.private) + .map((m) => m.name) + .forEach(addBuiltinProperty) diff --git a/electronasar/canary/renderer/api/screen.js b/electronasar/canary/renderer/api/screen.js new file mode 100644 index 0000000..6cae10d --- /dev/null +++ b/electronasar/canary/renderer/api/screen.js @@ -0,0 +1,4 @@ +'use strict' + +const { getRemoteForUsage } = require('@electron/internal/renderer/remote') +module.exports = getRemoteForUsage('screen').screen diff --git a/electronasar/canary/renderer/api/web-frame.js b/electronasar/canary/renderer/api/web-frame.js new file mode 100644 index 0000000..78ab231 --- /dev/null +++ b/electronasar/canary/renderer/api/web-frame.js @@ -0,0 +1,13 @@ +'use strict' + +const { EventEmitter } = require('events') +const { webFrame, WebFrame } = process.atomBinding('web_frame') + +// WebFrame is an EventEmitter. +Object.setPrototypeOf(WebFrame.prototype, EventEmitter.prototype) +EventEmitter.call(webFrame) + +// Lots of webview would subscribe to webFrame's events. +webFrame.setMaxListeners(0) + +module.exports = webFrame diff --git a/electronasar/canary/renderer/callbacks-registry.js b/electronasar/canary/renderer/callbacks-registry.js new file mode 100644 index 0000000..6a1c63b --- /dev/null +++ b/electronasar/canary/renderer/callbacks-registry.js @@ -0,0 +1,59 @@ +'use strict' + +const v8Util = process.atomBinding('v8_util') + +class CallbacksRegistry { + constructor () { + this.nextId = 0 + this.callbacks = {} + } + + add (callback) { + // The callback is already added. + let id = v8Util.getHiddenValue(callback, 'callbackId') + if (id != null) return id + + id = this.nextId += 1 + + // Capture the location of the function and put it in the ID string, + // so that release errors can be tracked down easily. + const regexp = /at (.*)/gi + const stackString = (new Error()).stack + + let filenameAndLine + let match + + while ((match = regexp.exec(stackString)) !== null) { + const location = match[1] + if (location.includes('(native)')) continue + if (location.includes('()')) continue + if (location.includes('electron.asar')) continue + + const ref = /([^/^)]*)\)?$/gi.exec(location) + filenameAndLine = ref[1] + break + } + this.callbacks[id] = callback + v8Util.setHiddenValue(callback, 'callbackId', id) + v8Util.setHiddenValue(callback, 'location', filenameAndLine) + return id + } + + get (id) { + return this.callbacks[id] || function () {} + } + + apply (id, ...args) { + return this.get(id).apply(global, ...args) + } + + remove (id) { + const callback = this.callbacks[id] + if (callback) { + v8Util.deleteHiddenValue(callback, 'callbackId') + delete this.callbacks[id] + } + } +} + +module.exports = CallbacksRegistry diff --git a/electronasar/canary/renderer/chrome-api.js b/electronasar/canary/renderer/chrome-api.js new file mode 100644 index 0000000..f34454c --- /dev/null +++ b/electronasar/canary/renderer/chrome-api.js @@ -0,0 +1,194 @@ +'use strict' + +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') +const Event = require('@electron/internal/renderer/extensions/event') +const url = require('url') + +let nextId = 0 + +class Tab { + constructor (tabId) { + this.id = tabId + } +} + +class MessageSender { + constructor (tabId, extensionId) { + this.tab = tabId ? new Tab(tabId) : null + this.id = extensionId + this.url = `chrome-extension://${extensionId}` + } +} + +class Port { + constructor (tabId, portId, extensionId, name) { + this.tabId = tabId + this.portId = portId + this.disconnected = false + + this.name = name + this.onDisconnect = new Event() + this.onMessage = new Event() + this.sender = new MessageSender(tabId, extensionId) + + ipcRenderer.once(`CHROME_PORT_DISCONNECT_${portId}`, () => { + this._onDisconnect() + }) + ipcRenderer.on(`CHROME_PORT_POSTMESSAGE_${portId}`, (event, message) => { + const sendResponse = function () { console.error('sendResponse is not implemented') } + this.onMessage.emit(message, this.sender, sendResponse) + }) + } + + disconnect () { + if (this.disconnected) return + + ipcRenderer.sendToAll(this.tabId, `CHROME_PORT_DISCONNECT_${this.portId}`) + this._onDisconnect() + } + + postMessage (message) { + ipcRenderer.sendToAll(this.tabId, `CHROME_PORT_POSTMESSAGE_${this.portId}`, message) + } + + _onDisconnect () { + this.disconnected = true + ipcRenderer.removeAllListeners(`CHROME_PORT_POSTMESSAGE_${this.portId}`) + this.onDisconnect.emit() + } +} + +// Inject chrome API to the |context| +exports.injectTo = function (extensionId, isBackgroundPage, context) { + const chrome = context.chrome = context.chrome || {} + let originResultID = 1 + + ipcRenderer.on(`CHROME_RUNTIME_ONCONNECT_${extensionId}`, (event, tabId, portId, connectInfo) => { + chrome.runtime.onConnect.emit(new Port(tabId, portId, extensionId, connectInfo.name)) + }) + + ipcRenderer.on(`CHROME_RUNTIME_ONMESSAGE_${extensionId}`, (event, tabId, message, resultID) => { + chrome.runtime.onMessage.emit(message, new MessageSender(tabId, extensionId), (messageResult) => { + ipcRenderer.send(`CHROME_RUNTIME_ONMESSAGE_RESULT_${resultID}`, messageResult) + }) + }) + + ipcRenderer.on('CHROME_TABS_ONCREATED', (event, tabId) => { + chrome.tabs.onCreated.emit(new Tab(tabId)) + }) + + ipcRenderer.on('CHROME_TABS_ONREMOVED', (event, tabId) => { + chrome.tabs.onRemoved.emit(tabId) + }) + + chrome.runtime = { + id: extensionId, + + getURL: function (path) { + return url.format({ + protocol: 'chrome-extension', + slashes: true, + hostname: extensionId, + pathname: path + }) + }, + + connect (...args) { + if (isBackgroundPage) { + console.error('chrome.runtime.connect is not supported in background page') + return + } + + // Parse the optional args. + let targetExtensionId = extensionId + let connectInfo = { name: '' } + if (args.length === 1) { + connectInfo = args[0] + } else if (args.length === 2) { + [targetExtensionId, connectInfo] = args + } + + const { tabId, portId } = ipcRenderer.sendSync('CHROME_RUNTIME_CONNECT', targetExtensionId, connectInfo) + return new Port(tabId, portId, extensionId, connectInfo.name) + }, + + sendMessage (...args) { + if (isBackgroundPage) { + console.error('chrome.runtime.sendMessage is not supported in background page') + return + } + + // Parse the optional args. + let targetExtensionId = extensionId + let message + if (args.length === 1) { + message = args[0] + } else if (args.length === 2) { + // A case of not provide extension-id: (message, responseCallback) + if (typeof args[1] === 'function') { + ipcRenderer.on(`CHROME_RUNTIME_SENDMESSAGE_RESULT_${originResultID}`, (event, result) => args[1](result)) + message = args[0] + } else { + [targetExtensionId, message] = args + } + } else { + console.error('options is not supported') + ipcRenderer.on(`CHROME_RUNTIME_SENDMESSAGE_RESULT_${originResultID}`, (event, result) => args[2](result)) + } + + ipcRenderer.send('CHROME_RUNTIME_SENDMESSAGE', targetExtensionId, message, originResultID) + originResultID++ + }, + + onConnect: new Event(), + onMessage: new Event(), + onInstalled: new Event() + } + + chrome.tabs = { + executeScript (tabId, details, callback) { + const requestId = ++nextId + ipcRenderer.once(`CHROME_TABS_EXECUTESCRIPT_RESULT_${requestId}`, (event, result) => { + // Disabled due to false positive in StandardJS + // eslint-disable-next-line standard/no-callback-literal + callback([event.result]) + }) + ipcRenderer.send('CHROME_TABS_EXECUTESCRIPT', requestId, tabId, extensionId, details) + }, + + sendMessage (tabId, message, options, responseCallback) { + if (responseCallback) { + ipcRenderer.on(`CHROME_TABS_SEND_MESSAGE_RESULT_${originResultID}`, (event, result) => responseCallback(result)) + } + ipcRenderer.send('CHROME_TABS_SEND_MESSAGE', tabId, extensionId, isBackgroundPage, message, originResultID) + originResultID++ + }, + + onUpdated: new Event(), + onCreated: new Event(), + onRemoved: new Event() + } + + chrome.extension = { + getURL: chrome.runtime.getURL, + connect: chrome.runtime.connect, + onConnect: chrome.runtime.onConnect, + sendMessage: chrome.runtime.sendMessage, + onMessage: chrome.runtime.onMessage + } + + chrome.storage = require('@electron/internal/renderer/extensions/storage').setup(extensionId) + + chrome.pageAction = { + show () {}, + hide () {}, + setTitle () {}, + getTitle () {}, + setIcon () {}, + setPopup () {}, + getPopup () {} + } + + chrome.i18n = require('@electron/internal/renderer/extensions/i18n').setup(extensionId) + chrome.webNavigation = require('@electron/internal/renderer/extensions/web-navigation').setup() +} diff --git a/electronasar/canary/renderer/content-scripts-injector.js b/electronasar/canary/renderer/content-scripts-injector.js new file mode 100644 index 0000000..5091d84 --- /dev/null +++ b/electronasar/canary/renderer/content-scripts-injector.js @@ -0,0 +1,101 @@ +'use strict' + +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') +const { runInThisContext } = require('vm') + +// Check whether pattern matches. +// https://developer.chrome.com/extensions/match_patterns +const matchesPattern = function (pattern) { + if (pattern === '') return true + const regexp = new RegExp(`^${pattern.replace(/\*/g, '.*')}$`) + const url = `${location.protocol}//${location.host}${location.pathname}` + return url.match(regexp) +} + +// Run the code with chrome API integrated. +const runContentScript = function (extensionId, url, code) { + const context = {} + require('@electron/internal/renderer/chrome-api').injectTo(extensionId, false, context) + const wrapper = `((chrome) => {\n ${code}\n })` + const compiledWrapper = runInThisContext(wrapper, { + filename: url, + lineOffset: 1, + displayErrors: true + }) + return compiledWrapper.call(this, context.chrome) +} + +const runAllContentScript = function (scripts, extensionId) { + for (const { url, code } of scripts) { + runContentScript.call(window, extensionId, url, code) + } +} + +const runStylesheet = function (url, code) { + const wrapper = `((code) => { + function init() { + const styleElement = document.createElement('style'); + styleElement.textContent = code; + document.head.append(styleElement); + } + document.addEventListener('DOMContentLoaded', init); + })` + const compiledWrapper = runInThisContext(wrapper, { + filename: url, + lineOffset: 1, + displayErrors: true + }) + return compiledWrapper.call(this, code) +} + +const runAllStylesheet = function (css) { + for (const { url, code } of css) { + runStylesheet.call(window, url, code) + } +} + +// Run injected scripts. +// https://developer.chrome.com/extensions/content_scripts +const injectContentScript = function (extensionId, script) { + if (!script.matches.some(matchesPattern)) return + + if (script.js) { + const fire = runAllContentScript.bind(window, script.js, extensionId) + if (script.runAt === 'document_start') { + process.once('document-start', fire) + } else if (script.runAt === 'document_end') { + process.once('document-end', fire) + } else { + document.addEventListener('DOMContentLoaded', fire) + } + } + + if (script.css) { + const fire = runAllStylesheet.bind(window, script.css) + if (script.runAt === 'document_start') { + process.once('document-start', fire) + } else if (script.runAt === 'document_end') { + process.once('document-end', fire) + } else { + document.addEventListener('DOMContentLoaded', fire) + } + } +} + +// Handle the request of chrome.tabs.executeJavaScript. +ipcRenderer.on('CHROME_TABS_EXECUTESCRIPT', function (event, senderWebContentsId, requestId, extensionId, url, code) { + const result = runContentScript.call(window, extensionId, url, code) + ipcRenderer.sendToAll(senderWebContentsId, `CHROME_TABS_EXECUTESCRIPT_RESULT_${requestId}`, result) +}) + +// Read the renderer process preferences. +const preferences = process.getRenderProcessPreferences() +if (preferences) { + for (const pref of preferences) { + if (pref.contentScripts) { + for (const script of pref.contentScripts) { + injectContentScript(pref.extensionId, script) + } + } + } +} diff --git a/electronasar/canary/renderer/extensions/event.js b/electronasar/canary/renderer/extensions/event.js new file mode 100644 index 0000000..93f5ad2 --- /dev/null +++ b/electronasar/canary/renderer/extensions/event.js @@ -0,0 +1,26 @@ +'use strict' + +class Event { + constructor () { + this.listeners = [] + } + + addListener (callback) { + this.listeners.push(callback) + } + + removeListener (callback) { + const index = this.listeners.indexOf(callback) + if (index !== -1) { + this.listeners.splice(index, 1) + } + } + + emit (...args) { + for (const listener of this.listeners) { + listener(...args) + } + } +} + +module.exports = Event diff --git a/electronasar/canary/renderer/extensions/i18n.js b/electronasar/canary/renderer/extensions/i18n.js new file mode 100644 index 0000000..661b264 --- /dev/null +++ b/electronasar/canary/renderer/extensions/i18n.js @@ -0,0 +1,88 @@ +'use strict' + +// Implementation of chrome.i18n.getMessage +// https://developer.chrome.com/extensions/i18n#method-getMessage +// +// Does not implement predefined messages: +// https://developer.chrome.com/extensions/i18n#overview-predefined + +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') +const fs = require('fs') +const path = require('path') + +let metadata + +const getExtensionMetadata = (extensionId) => { + if (!metadata) { + metadata = ipcRenderer.sendSync('CHROME_I18N_MANIFEST', extensionId) + } + return metadata +} + +const getMessagesPath = (extensionId, language) => { + const metadata = getExtensionMetadata(extensionId) + const localesDirectory = path.join(metadata.srcDirectory, '_locales') + try { + const filename = path.join(localesDirectory, language, 'messages.json') + fs.accessSync(filename, fs.constants.R_OK) + return filename + } catch (err) { + const defaultLocale = metadata.default_locale || 'en' + return path.join(localesDirectory, defaultLocale, 'messages.json') + } +} + +const getMessages = (extensionId, language) => { + try { + const messagesPath = getMessagesPath(extensionId, language) + return JSON.parse(fs.readFileSync(messagesPath)) || {} + } catch (error) { + return {} + } +} + +const getLanguage = () => { + return navigator.language.replace(/-.*$/, '').toLowerCase() +} + +const replaceNumberedSubstitutions = (message, substitutions) => { + return message.replace(/\$(\d+)/, (_, number) => { + const index = parseInt(number, 10) - 1 + return substitutions[index] || '' + }) +} + +const replacePlaceholders = (message, placeholders, substitutions) => { + if (typeof substitutions === 'string') { + substitutions = [substitutions] + } + if (!Array.isArray(substitutions)) { + substitutions = [] + } + + if (placeholders) { + Object.keys(placeholders).forEach((name) => { + let { content } = placeholders[name] + content = replaceNumberedSubstitutions(content, substitutions) + message = message.replace(new RegExp(`\\$${name}\\$`, 'gi'), content) + }) + } + + return replaceNumberedSubstitutions(message, substitutions) +} + +const getMessage = (extensionId, messageName, substitutions) => { + const messages = getMessages(extensionId, getLanguage()) + if (messages.hasOwnProperty(messageName)) { + const { message, placeholders } = messages[messageName] + return replacePlaceholders(message, placeholders, substitutions) + } +} + +exports.setup = (extensionId) => { + return { + getMessage (messageName, substitutions) { + return getMessage(extensionId, messageName, substitutions) + } + } +} diff --git a/electronasar/canary/renderer/extensions/storage.js b/electronasar/canary/renderer/extensions/storage.js new file mode 100644 index 0000000..8afaac7 --- /dev/null +++ b/electronasar/canary/renderer/extensions/storage.js @@ -0,0 +1,138 @@ +'use strict' + +const fs = require('fs') +const path = require('path') +const { remote } = require('electron') +const { app } = remote + +const getChromeStoragePath = (storageType, extensionId) => { + return path.join( + app.getPath('userData'), `/Chrome Storage/${extensionId}-${storageType}.json`) +} + +const mkdirp = (dir, callback) => { + fs.mkdir(dir, (error) => { + if (error && error.code === 'ENOENT') { + mkdirp(path.dirname(dir), (error) => { + if (!error) { + mkdirp(dir, callback) + } + }) + } else if (error && error.code === 'EEXIST') { + callback(null) + } else { + callback(error) + } + }) +} + +const readChromeStorageFile = (storageType, extensionId, cb) => { + const filePath = getChromeStoragePath(storageType, extensionId) + fs.readFile(filePath, 'utf8', (err, data) => { + if (err && err.code === 'ENOENT') { + return cb(null, null) + } + cb(err, data) + }) +} + +const writeChromeStorageFile = (storageType, extensionId, data, cb) => { + const filePath = getChromeStoragePath(storageType, extensionId) + + mkdirp(path.dirname(filePath), err => { + if (err) { /* we just ignore the errors of mkdir or mkdirp */ } + fs.writeFile(filePath, data, cb) + }) +} + +const getStorage = (storageType, extensionId, cb) => { + readChromeStorageFile(storageType, extensionId, (err, data) => { + if (err) throw err + if (!cb) throw new TypeError('No callback provided') + + if (data !== null) { + cb(JSON.parse(data)) + } else { + // Disabled due to false positive in StandardJS + // eslint-disable-next-line standard/no-callback-literal + cb({}) + } + }) +} + +const setStorage = (storageType, extensionId, storage, cb) => { + const json = JSON.stringify(storage) + writeChromeStorageFile(storageType, extensionId, json, err => { + if (err) throw err + if (cb) cb() + }) +} + +const getStorageManager = (storageType, extensionId) => { + return { + get (keys, callback) { + getStorage(storageType, extensionId, storage => { + if (keys == null) return callback(storage) + + let defaults = {} + switch (typeof keys) { + case 'string': + keys = [keys] + break + case 'object': + if (!Array.isArray(keys)) { + defaults = keys + keys = Object.keys(keys) + } + break + } + + // Disabled due to false positive in StandardJS + // eslint-disable-next-line standard/no-callback-literal + if (keys.length === 0) return callback({}) + + const items = {} + keys.forEach(function (key) { + let value = storage[key] + if (value == null) value = defaults[key] + items[key] = value + }) + callback(items) + }) + }, + + set (items, callback) { + getStorage(storageType, extensionId, storage => { + Object.keys(items).forEach(function (name) { + storage[name] = items[name] + }) + + setStorage(storageType, extensionId, storage, callback) + }) + }, + + remove (keys, callback) { + getStorage(storageType, extensionId, storage => { + if (!Array.isArray(keys)) { + keys = [keys] + } + keys.forEach(function (key) { + delete storage[key] + }) + + setStorage(storageType, extensionId, storage, callback) + }) + }, + + clear (callback) { + setStorage(storageType, extensionId, {}, callback) + } + } +} + +module.exports = { + setup: extensionId => ({ + sync: getStorageManager('sync', extensionId), + local: getStorageManager('local', extensionId) + }) +} diff --git a/electronasar/canary/renderer/extensions/web-navigation.js b/electronasar/canary/renderer/extensions/web-navigation.js new file mode 100644 index 0000000..9c3f3f0 --- /dev/null +++ b/electronasar/canary/renderer/extensions/web-navigation.js @@ -0,0 +1,23 @@ +'use strict' + +const Event = require('@electron/internal/renderer/extensions/event') +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + +class WebNavigation { + constructor () { + this.onBeforeNavigate = new Event() + this.onCompleted = new Event() + + ipcRenderer.on('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', (event, details) => { + this.onBeforeNavigate.emit(details) + }) + + ipcRenderer.on('CHROME_WEBNAVIGATION_ONCOMPLETED', (event, details) => { + this.onCompleted.emit(details) + }) + } +} + +exports.setup = () => { + return new WebNavigation() +} diff --git a/electronasar/canary/renderer/init.js b/electronasar/canary/renderer/init.js new file mode 100644 index 0000000..cf1af5b --- /dev/null +++ b/electronasar/canary/renderer/init.js @@ -0,0 +1,176 @@ +'use strict' + +const { EventEmitter } = require('events') +const path = require('path') +const Module = require('module') + +// We modified the original process.argv to let node.js load the +// init.js, we need to restore it here. +process.argv.splice(1, 1) + +// Clear search paths. +require('../common/reset-search-paths') + +// Import common settings. +require('@electron/internal/common/init') + +const globalPaths = Module.globalPaths + +// Expose public APIs. +globalPaths.push(path.join(__dirname, 'api', 'exports')) + +// The global variable will be used by ipc for event dispatching +const v8Util = process.atomBinding('v8_util') + +v8Util.setHiddenValue(global, 'ipc', new EventEmitter()) +v8Util.setHiddenValue(global, 'ipc-internal', new EventEmitter()) + +// Use electron module after everything is ready. +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + +require('@electron/internal/renderer/web-frame-init')() + +// Process command line arguments. +let nodeIntegration = false +let webviewTag = false +let preloadScript = null +let preloadScripts = [] +let isBackgroundPage = false +let appPath = null +for (const arg of process.argv) { + if (arg.indexOf('--guest-instance-id=') === 0) { + // This is a guest web view. + process.guestInstanceId = parseInt(arg.substr(arg.indexOf('=') + 1)) + } else if (arg.indexOf('--opener-id=') === 0) { + // This is a guest BrowserWindow. + process.openerId = parseInt(arg.substr(arg.indexOf('=') + 1)) + } else if (arg.indexOf('--node-integration=') === 0) { + nodeIntegration = arg.substr(arg.indexOf('=') + 1) === 'true' + } else if (arg.indexOf('--preload=') === 0) { + preloadScript = arg.substr(arg.indexOf('=') + 1) + } else if (arg === '--background-page') { + isBackgroundPage = true + } else if (arg.indexOf('--app-path=') === 0) { + appPath = arg.substr(arg.indexOf('=') + 1) + } else if (arg.indexOf('--webview-tag=') === 0) { + webviewTag = arg.substr(arg.indexOf('=') + 1) === 'true' + } else if (arg.indexOf('--preload-scripts') === 0) { + preloadScripts = arg.substr(arg.indexOf('=') + 1).split(path.delimiter) + } +} + +// The webContents preload script is loaded after the session preload scripts. +if (preloadScript) { + preloadScripts.push(preloadScript) +} + +if (window.location.protocol === 'chrome-devtools:') { + // Override some inspector APIs. + require('@electron/internal/renderer/inspector') + nodeIntegration = false +} else if (window.location.protocol === 'chrome-extension:') { + // Add implementations of chrome API. + require('@electron/internal/renderer/chrome-api').injectTo(window.location.hostname, isBackgroundPage, window) + nodeIntegration = false +} else if (window.location.protocol === 'chrome:') { + // Disable node integration for chrome UI scheme. + nodeIntegration = false +} else { + // Override default web functions. + require('@electron/internal/renderer/override') + + // Inject content scripts. + require('@electron/internal/renderer/content-scripts-injector') + + // Load webview tag implementation. + if (webviewTag && process.guestInstanceId == null) { + const { setupWebView } = require('@electron/internal/renderer/web-view/web-view') + if (process.argv.includes('--context-isolation')) { + v8Util.setHiddenValue(window, 'setup-webview', setupWebView) + } else { + setupWebView(window) + } + } +} + +if (nodeIntegration) { + // Export node bindings to global. + global.require = require + global.module = module + + // Set the __filename to the path of html file if it is file: protocol. + if (window.location.protocol === 'file:') { + const location = window.location + let pathname = location.pathname + + if (process.platform === 'win32') { + if (pathname[0] === '/') pathname = pathname.substr(1) + + const isWindowsNetworkSharePath = location.hostname.length > 0 && globalPaths[0].startsWith('\\') + if (isWindowsNetworkSharePath) { + pathname = `//${location.host}/${pathname}` + } + } + + global.__filename = path.normalize(decodeURIComponent(pathname)) + global.__dirname = path.dirname(global.__filename) + + // Set module's filename so relative require can work as expected. + module.filename = global.__filename + + // Also search for module under the html file. + module.paths = module.paths.concat(Module._nodeModulePaths(global.__dirname)) + } else { + global.__filename = __filename + global.__dirname = __dirname + + if (appPath) { + // Search for module under the app directory + module.paths = module.paths.concat(Module._nodeModulePaths(appPath)) + } + } + + // Redirect window.onerror to uncaughtException. + window.onerror = function (message, filename, lineno, colno, error) { + if (global.process.listeners('uncaughtException').length > 0) { + global.process.emit('uncaughtException', error) + return true + } else { + return false + } + } +} else { + // Delete Node's symbols after the Environment has been loaded. + process.once('loaded', function () { + delete global.process + delete global.Buffer + delete global.setImmediate + delete global.clearImmediate + delete global.global + }) +} + +// Load the preload scripts. +for (const preloadScript of preloadScripts) { + try { + require(preloadScript) + } catch (error) { + console.error('Unable to load preload script: ' + preloadScript) + console.error(error.stack || error.message) + } +} + +// Warn about security issues +require('@electron/internal/renderer/security-warnings')(nodeIntegration) + +// Report focus/blur events of webview to browser. +// Note that while Chromium content APIs have observer for focus/blur, they +// unfortunately do not work for webview. +if (process.guestInstanceId) { + window.addEventListener('focus', () => { + ipcRenderer.send('ELECTRON_GUEST_VIEW_MANAGER_FOCUS_CHANGE', true, process.guestInstanceId) + }) + window.addEventListener('blur', () => { + ipcRenderer.send('ELECTRON_GUEST_VIEW_MANAGER_FOCUS_CHANGE', false, process.guestInstanceId) + }) +} diff --git a/electronasar/canary/renderer/inspector.js b/electronasar/canary/renderer/inspector.js new file mode 100644 index 0000000..b358fa6 --- /dev/null +++ b/electronasar/canary/renderer/inspector.js @@ -0,0 +1,138 @@ +'use strict' + +window.onload = function () { + // Use menu API to show context menu. + window.InspectorFrontendHost.showContextMenuAtPoint = createMenu + + // correct for Chromium returning undefined for filesystem + window.Persistence.FileSystemWorkspaceBinding.completeURL = completeURL + + // Use dialog API to override file chooser dialog. + window.UI.createFileSelectorElement = createFileSelectorElement +} + +// Extra / is needed as a result of MacOS requiring absolute paths +function completeURL (project, path) { + project = 'file:///' + return `${project}${path}` +} + +window.confirm = function (message, title) { + const { dialog } = require('electron').remote + if (title == null) { + title = '' + } + return !dialog.showMessageBox({ + message: message, + title: title, + buttons: ['OK', 'Cancel'], + cancelId: 1 + }) +} + +const convertToMenuTemplate = function (items) { + return items.map(function (item) { + const transformed = item.type === 'subMenu' ? { + type: 'submenu', + label: item.label, + enabled: item.enabled, + submenu: convertToMenuTemplate(item.subItems) + } : item.type === 'separator' ? { + type: 'separator' + } : item.type === 'checkbox' ? { + type: 'checkbox', + label: item.label, + enabled: item.enabled, + checked: item.checked + } : { + type: 'normal', + label: item.label, + enabled: item.enabled + } + + if (item.id != null) { + transformed.click = function () { + window.DevToolsAPI.contextMenuItemSelected(item.id) + return window.DevToolsAPI.contextMenuCleared() + } + } + + return transformed + }) +} + +const createMenu = function (x, y, items) { + const { remote } = require('electron') + const { Menu } = remote + + let template = convertToMenuTemplate(items) + if (useEditMenuItems(x, y, template)) { + template = getEditMenuItems() + } + const menu = Menu.buildFromTemplate(template) + + // The menu is expected to show asynchronously. + setTimeout(function () { + menu.popup({ window: remote.getCurrentWindow() }) + }) +} + +const useEditMenuItems = function (x, y, items) { + return items.length === 0 && document.elementsFromPoint(x, y).some(function (element) { + return element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA' || element.isContentEditable + }) +} + +const getEditMenuItems = function () { + return [ + { + role: 'undo' + }, + { + role: 'redo' + }, + { + type: 'separator' + }, + { + role: 'cut' + }, + { + role: 'copy' + }, + { + role: 'paste' + }, + { + role: 'pasteAndMatchStyle' + }, + { + role: 'delete' + }, + { + role: 'selectAll' + } + ] +} + +const showFileChooserDialog = function (callback) { + const { dialog } = require('electron').remote + const files = dialog.showOpenDialog({}) + if (files != null) { + callback(pathToHtml5FileObject(files[0])) + } +} + +const pathToHtml5FileObject = function (path) { + const fs = require('fs') + const blob = new Blob([fs.readFileSync(path)]) + blob.name = path + return blob +} + +const createFileSelectorElement = function (callback) { + const fileSelectorElement = document.createElement('span') + fileSelectorElement.style.display = 'none' + fileSelectorElement.click = showFileChooserDialog.bind(this, callback) + return fileSelectorElement +} diff --git a/electronasar/canary/renderer/ipc-renderer-internal.js b/electronasar/canary/renderer/ipc-renderer-internal.js new file mode 100644 index 0000000..a8dda32 --- /dev/null +++ b/electronasar/canary/renderer/ipc-renderer-internal.js @@ -0,0 +1,26 @@ +'use strict' + +const binding = process.atomBinding('ipc') +const v8Util = process.atomBinding('v8_util') + +// Created by init.js. +const ipcRenderer = v8Util.getHiddenValue(global, 'ipc-internal') +const internal = true + +ipcRenderer.send = function (...args) { + return binding.send('ipc-internal-message', args) +} + +ipcRenderer.sendSync = function (...args) { + return binding.sendSync('ipc-internal-message-sync', args)[0] +} + +ipcRenderer.sendTo = function (webContentsId, channel, ...args) { + return binding.sendTo(internal, false, webContentsId, channel, args) +} + +ipcRenderer.sendToAll = function (webContentsId, channel, ...args) { + return binding.sendTo(internal, true, webContentsId, channel, args) +} + +module.exports = ipcRenderer diff --git a/electronasar/canary/renderer/override.js b/electronasar/canary/renderer/override.js new file mode 100644 index 0000000..72a4a5a --- /dev/null +++ b/electronasar/canary/renderer/override.js @@ -0,0 +1,18 @@ +'use strict' + +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + +const v8Util = process.atomBinding('v8_util') + +const { guestInstanceId, openerId } = process +const hiddenPage = process.argv.includes('--hidden-page') +const usesNativeWindowOpen = process.argv.includes('--native-window-open') +const contextIsolation = process.argv.includes('--context-isolation') + +// Pass the arguments to isolatedWorld. +if (contextIsolation) { + const isolatedWorldArgs = { ipcRenderer, guestInstanceId, hiddenPage, openerId, usesNativeWindowOpen } + v8Util.setHiddenValue(global, 'isolated-world-args', isolatedWorldArgs) +} + +require('@electron/internal/renderer/window-setup')(ipcRenderer, guestInstanceId, openerId, hiddenPage, usesNativeWindowOpen) diff --git a/electronasar/canary/renderer/remote.js b/electronasar/canary/renderer/remote.js new file mode 100644 index 0000000..b807723 --- /dev/null +++ b/electronasar/canary/renderer/remote.js @@ -0,0 +1,10 @@ +'use strict' + +const { remote } = require('electron') + +exports.getRemoteForUsage = function (usage) { + if (!remote) { + throw new Error(`${usage} requires remote, which is not enabled`) + } + return remote +} diff --git a/electronasar/canary/renderer/security-warnings.js b/electronasar/canary/renderer/security-warnings.js new file mode 100644 index 0000000..9d41190 --- /dev/null +++ b/electronasar/canary/renderer/security-warnings.js @@ -0,0 +1,336 @@ +'use strict' + +let shouldLog = null + +/** + * This method checks if a security message should be logged. + * It does so by determining whether we're running as Electron, + * which indicates that a developer is currently looking at the + * app. + * + * @returns {boolean} - Should we log? + */ +const shouldLogSecurityWarnings = function () { + if (shouldLog !== null) { + return shouldLog + } + + const { platform, execPath, env } = process + + switch (platform) { + case 'darwin': + shouldLog = execPath.endsWith('MacOS/Electron') || + execPath.includes('Electron.app/Contents/Frameworks/') + break + case 'freebsd': + case 'linux': + shouldLog = execPath.endsWith('/electron') + break + case 'win32': + shouldLog = execPath.endsWith('\\electron.exe') + break + default: + shouldLog = false + } + + if ((env && env.ELECTRON_DISABLE_SECURITY_WARNINGS) || + (window && window.ELECTRON_DISABLE_SECURITY_WARNINGS)) { + shouldLog = false + } + + if ((env && env.ELECTRON_ENABLE_SECURITY_WARNINGS) || + (window && window.ELECTRON_ENABLE_SECURITY_WARNINGS)) { + shouldLog = true + } + + return shouldLog +} + +/** + * Checks if the current window is remote. + * + * @returns {boolean} - Is this a remote protocol? + */ +const getIsRemoteProtocol = function () { + if (window && window.location && window.location.protocol) { + return /^(http|ftp)s?/gi.test(window.location.protocol) + } +} + +/** + * Tries to determine whether a CSP without `unsafe-eval` is set. + * + * @returns {boolean} Is a CSP with `unsafe-eval` set? + */ +const isUnsafeEvalEnabled = function () { + const { webFrame } = require('electron') + + return new Promise((resolve) => { + webFrame.executeJavaScript(`(${(() => { + try { + new Function('') // eslint-disable-line no-new,no-new-func + } catch (err) { + return false + } + return true + }).toString()})()`, resolve) + }) +} + +const moreInformation = `\nFor more information and help, consult +https://electronjs.org/docs/tutorial/security.\n This warning will not show up +once the app is packaged.` + +/** + * #1 Only load secure content + * + * Checks the loaded resources on the current page and logs a + * message about all resources loaded over HTTP or FTP. + */ +const warnAboutInsecureResources = function () { + if (!window || !window.performance || !window.performance.getEntriesByType) { + return + } + + const resources = window.performance + .getEntriesByType('resource') + .filter(({ name }) => /^(http|ftp):/gi.test(name || '')) + .map(({ name }) => `- ${name}`) + .join('\n') + + if (!resources || resources.length === 0) { + return + } + + const warning = `This renderer process loads resources using insecure + protocols.This exposes users of this app to unnecessary security risks. + Consider loading the following resources over HTTPS or FTPS. \n ${resources} + \n ${moreInformation}` + + console.warn('%cElectron Security Warning (Insecure Resources)', + 'font-weight: bold;', warning) +} + +/** + * #2 on the checklist: Disable the Node.js integration in all renderers that + * display remote content + * + * Logs a warning message about Node integration. + */ +const warnAboutNodeWithRemoteContent = function (nodeIntegration) { + if (!nodeIntegration) return + + if (getIsRemoteProtocol()) { + const warning = `This renderer process has Node.js integration enabled + and attempted to load remote content from '${window.location}'. This + exposes users of this app to severe security risks.\n ${moreInformation}` + + console.warn('%cElectron Security Warning (Node.js Integration with Remote Content)', + 'font-weight: bold;', warning) + } +} + +// Currently missing since it has ramifications and is still experimental: +// #3 Enable context isolation in all renderers that display remote content +// +// Currently missing since we can't easily programmatically check for those cases: +// #4 Use ses.setPermissionRequestHandler() in all sessions that load remote content + +/** + * #5 on the checklist: Do not disable websecurity + * + * Logs a warning message about disabled webSecurity. + */ +const warnAboutDisabledWebSecurity = function (webPreferences) { + if (!webPreferences || webPreferences.webSecurity !== false) return + + const warning = `This renderer process has "webSecurity" disabled. This + exposes users of this app to severe security risks.\n ${moreInformation}` + + console.warn('%cElectron Security Warning (Disabled webSecurity)', + 'font-weight: bold;', warning) +} + +/** + * #6 on the checklist: Define a Content-Security-Policy and use restrictive + * rules (i.e. script-src 'self') + * + * #7 on the checklist: Disable eval + * + * Logs a warning message about unset or insecure CSP + */ +const warnAboutInsecureCSP = function () { + isUnsafeEvalEnabled().then((enabled) => { + if (!enabled) return + + const warning = `This renderer process has either no Content Security + Policy set or a policy with "unsafe-eval" enabled. This exposes users of + this app to unnecessary security risks.\n ${moreInformation}` + + console.warn('%cElectron Security Warning (Insecure Content-Security-Policy)', + 'font-weight: bold;', warning) + }) +} + +/** + * #8 on the checklist: Do not set allowRunningInsecureContent to true + * + * Logs a warning message about disabled webSecurity. + */ +const warnAboutInsecureContentAllowed = function (webPreferences) { + if (!webPreferences || !webPreferences.allowRunningInsecureContent) return + + const warning = `This renderer process has "allowRunningInsecureContent" + enabled. This exposes users of this app to severe security risks.\n + ${moreInformation}` + + console.warn('%cElectron Security Warning (allowRunningInsecureContent)', + 'font-weight: bold;', warning) +} + +/** + * #9 on the checklist: Do not enable experimental features + * + * Logs a warning message about experimental features. + */ +const warnAboutExperimentalFeatures = function (webPreferences) { + if (!webPreferences || (!webPreferences.experimentalFeatures)) { + return + } + + const warning = `This renderer process has "experimentalFeatures" enabled. + This exposes users of this app to some security risk. If you do not need + this feature, you should disable it.\n ${moreInformation}` + + console.warn('%cElectron Security Warning (experimentalFeatures)', + 'font-weight: bold;', warning) +} + +/** + * #10 on the checklist: Do not use enableBlinkFeatures + * + * Logs a warning message about enableBlinkFeatures + */ +const warnAboutEnableBlinkFeatures = function (webPreferences) { + if (webPreferences === null || + !webPreferences.hasOwnProperty('enableBlinkFeatures') || + webPreferences.enableBlinkFeatures.length === 0) { + return + } + + const warning = `This renderer process has additional "enableBlinkFeatures" + enabled. This exposes users of this app to some security risk. If you do not + need this feature, you should disable it.\n ${moreInformation}` + + console.warn('%cElectron Security Warning (enableBlinkFeatures)', + 'font-weight: bold;', warning) +} + +/** + * #11 on the checklist: Do Not Use allowpopups + * + * Logs a warning message about allowed popups + */ +const warnAboutAllowedPopups = function () { + if (document && document.querySelectorAll) { + const domElements = document.querySelectorAll('[allowpopups]') + + if (!domElements || domElements.length === 0) { + return + } + + const warning = `A has "allowpopups" set to true. This exposes + users of this app to some security risk, since popups are just + BrowserWindows. If you do not need this feature, you should disable it.\n + ${moreInformation}` + + console.warn('%cElectron Security Warning (allowpopups)', + 'font-weight: bold;', warning) + } +} + +const warnAboutNodeIntegrationDefault = function (webPreferences) { + if (webPreferences.nodeIntegration && !webPreferences.nodeIntegrationWasExplicitlyEnabled) { + const warning = `This window has node integration enabled by default. In ` + + `Electron 5.0.0, node integration will be disabled by default. To prepare ` + + `for this change, set {nodeIntegration: true} in the webPreferences for ` + + `this window, or ensure that this window does not rely on node integration ` + + `and set {nodeIntegration: false}.` + console.warn('%cElectron Deprecation Warning (nodeIntegration default change)', 'font-weight: bold;', warning) + } +} + +const warnAboutContextIsolationDefault = function (webPreferences) { + if (webPreferences.preload && !webPreferences.contextIsolation && !webPreferences.contextIsolationWasExplicitlyDisabled) { + const url = 'https://electronjs.org/docs/tutorial/security#3-enable-context-isolation-for-remote-content' + const warning = `This window has context isolation disabled by default. In ` + + `Electron 5.0.0, context isolation will be enabled by default. To prepare ` + + `for this change, set {contextIsolation: false} in the webPreferences for ` + + `this window, or ensure that this window does not rely on context ` + + `isolation being disabled, and set {contextIsolation: true}.\n\n` + + `For more information, see ${url}` + console.warn('%cElectron Deprecation Warning (contextIsolation default change)', 'font-weight: bold;', warning) + } +} + +const warnAboutDeprecatedWebviewTagDefault = function (webPreferences) { + if (webPreferences.webviewTagWasExplicitlyEnabled) { + return + } + if (!document || !document.getElementsByTagName) { + return + } + const webviews = document.getElementsByTagName('webview') + if (webviews && webviews.length > 0) { + const url = 'https://github.com/electron/electron/blob/master/docs/api/breaking-changes.md#new-browserwindow-webpreferences-' + const warning = `This window has the tag enabled by default. In ` + + `Electron 5.0.0, tags will be disabled by default. To prepare ` + + `for this change, set {webviewTag: true} in the webPreferences for ` + + `this window.\n\n` + + `For more information, see ${url}` + + console.warn('%cElectron Deprecation Warning (webviewTag default change)', + 'font-weight: bold;', warning) + } +} + +// Currently missing since we can't easily programmatically check for it: +// #12WebViews: Verify the options and params of all `` tags + +const logSecurityWarnings = function (webPreferences, nodeIntegration) { + warnAboutNodeWithRemoteContent(nodeIntegration) + warnAboutDisabledWebSecurity(webPreferences) + warnAboutInsecureResources() + warnAboutInsecureContentAllowed(webPreferences) + warnAboutExperimentalFeatures(webPreferences) + warnAboutEnableBlinkFeatures(webPreferences) + warnAboutInsecureCSP() + warnAboutAllowedPopups() + warnAboutNodeIntegrationDefault(webPreferences) + warnAboutContextIsolationDefault(webPreferences) + warnAboutDeprecatedWebviewTagDefault(webPreferences) +} + +const getWebPreferences = function () { + const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + const errorUtils = require('@electron/internal/common/error-utils') + + const [ error, result ] = ipcRenderer.sendSync('ELECTRON_BROWSER_GET_LAST_WEB_PREFERENCES') + + if (error) { + console.warn(`getLastWebPreferences() failed: ${errorUtils.deserialize(error)}`) + return null + } else { + return result + } +} + +module.exports = function (nodeIntegration) { + const loadHandler = function () { + if (shouldLogSecurityWarnings()) { + const webPreferences = getWebPreferences() + logSecurityWarnings(webPreferences, nodeIntegration) + } + } + window.addEventListener('load', loadHandler, { once: true }) +} diff --git a/electronasar/canary/renderer/web-frame-init.js b/electronasar/canary/renderer/web-frame-init.js new file mode 100644 index 0000000..f7861db --- /dev/null +++ b/electronasar/canary/renderer/web-frame-init.js @@ -0,0 +1,24 @@ +'use strict' + +const { webFrame } = require('electron') +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') +const errorUtils = require('@electron/internal/common/error-utils') + +module.exports = () => { + // Call webFrame method + ipcRenderer.on('ELECTRON_INTERNAL_RENDERER_WEB_FRAME_METHOD', (event, method, args) => { + webFrame[method](...args) + }) + + ipcRenderer.on('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', (event, requestId, method, args) => { + new Promise(resolve => + webFrame[method](...args, resolve) + ).then(result => { + return [null, result] + }, error => { + return [errorUtils.serialize(error)] + }).then(responseArgs => { + event.sender.send(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, ...responseArgs) + }) + }) +} diff --git a/electronasar/canary/renderer/web-view/guest-view-internal.js b/electronasar/canary/renderer/web-view/guest-view-internal.js new file mode 100644 index 0000000..3d544aa --- /dev/null +++ b/electronasar/canary/renderer/web-view/guest-view-internal.js @@ -0,0 +1,108 @@ +'use strict' + +const { webFrame } = require('electron') +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') + +let requestId = 0 + +const WEB_VIEW_EVENTS = { + 'load-commit': ['url', 'isMainFrame'], + 'did-attach': [], + 'did-finish-load': [], + 'did-fail-load': ['errorCode', 'errorDescription', 'validatedURL', 'isMainFrame', 'frameProcessId', 'frameRoutingId'], + 'did-frame-finish-load': ['isMainFrame', 'frameProcessId', 'frameRoutingId'], + 'did-start-loading': [], + 'did-stop-loading': [], + 'dom-ready': [], + 'console-message': ['level', 'message', 'line', 'sourceId'], + 'context-menu': ['params'], + 'devtools-opened': [], + 'devtools-closed': [], + 'devtools-focused': [], + 'new-window': ['url', 'frameName', 'disposition', 'options'], + 'will-navigate': ['url'], + 'did-start-navigation': ['url', 'isInPlace', 'isMainFrame', 'frameProcessId', 'frameRoutingId'], + 'did-navigate': ['url', 'httpResponseCode', 'httpStatusText'], + 'did-frame-navigate': ['url', 'httpResponseCode', 'httpStatusText', 'isMainFrame', 'frameProcessId', 'frameRoutingId'], + 'did-navigate-in-page': ['url', 'isMainFrame', 'frameProcessId', 'frameRoutingId'], + 'focus-change': ['focus', 'guestInstanceId'], + 'close': [], + 'crashed': [], + 'gpu-crashed': [], + 'plugin-crashed': ['name', 'version'], + 'destroyed': [], + 'page-title-updated': ['title', 'explicitSet'], + 'page-favicon-updated': ['favicons'], + 'enter-html-full-screen': [], + 'leave-html-full-screen': [], + 'media-started-playing': [], + 'media-paused': [], + 'found-in-page': ['result'], + 'did-change-theme-color': ['themeColor'], + 'update-target-url': ['url'] +} + +const DEPRECATED_EVENTS = { + 'page-title-updated': 'page-title-set' +} + +const dispatchEvent = function (webView, eventName, eventKey, ...args) { + if (DEPRECATED_EVENTS[eventName] != null) { + dispatchEvent(webView, DEPRECATED_EVENTS[eventName], eventKey, ...args) + } + const domEvent = new Event(eventName) + WEB_VIEW_EVENTS[eventKey].forEach((prop, index) => { + domEvent[prop] = args[index] + }) + webView.dispatchEvent(domEvent) + if (eventName === 'load-commit') { + webView.onLoadCommit(domEvent) + } else if (eventName === 'focus-change') { + webView.onFocusChange(domEvent) + } +} + +module.exports = { + registerEvents: function (webView, viewInstanceId) { + ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_DESTROY_GUEST-${viewInstanceId}`, function () { + webView.guestInstanceId = undefined + webView.reset() + const domEvent = new Event('destroyed') + webView.dispatchEvent(domEvent) + }) + + ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-${viewInstanceId}`, function (event, eventName, ...args) { + dispatchEvent(webView, eventName, eventName, ...args) + }) + + ipcRenderer.on(`ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE-${viewInstanceId}`, function (event, channel, ...args) { + const domEvent = new Event('ipc-message') + domEvent.channel = channel + domEvent.args = args + webView.dispatchEvent(domEvent) + }) + }, + deregisterEvents: function (viewInstanceId) { + ipcRenderer.removeAllListeners(`ELECTRON_GUEST_VIEW_INTERNAL_DESTROY_GUEST-${viewInstanceId}`) + ipcRenderer.removeAllListeners(`ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-${viewInstanceId}`) + ipcRenderer.removeAllListeners(`ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE-${viewInstanceId}`) + }, + createGuest: function (params, callback) { + requestId++ + ipcRenderer.send('ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST', params, requestId) + ipcRenderer.once(`ELECTRON_RESPONSE_${requestId}`, callback) + }, + createGuestSync: function (params) { + return ipcRenderer.sendSync('ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST_SYNC', params) + }, + destroyGuest: function (guestInstanceId) { + ipcRenderer.send('ELECTRON_GUEST_VIEW_MANAGER_DESTROY_GUEST', guestInstanceId) + }, + attachGuest: function (elementInstanceId, guestInstanceId, params, contentWindow) { + const embedderFrameId = webFrame.getWebFrameId(contentWindow) + if (embedderFrameId < 0) { // this error should not happen. + throw new Error('Invalid embedder frame') + } + ipcRenderer.send('ELECTRON_GUEST_VIEW_MANAGER_ATTACH_GUEST', embedderFrameId, elementInstanceId, guestInstanceId, params) + } +} diff --git a/electronasar/canary/renderer/web-view/web-view-attributes.js b/electronasar/canary/renderer/web-view/web-view-attributes.js new file mode 100644 index 0000000..39d986e --- /dev/null +++ b/electronasar/canary/renderer/web-view/web-view-attributes.js @@ -0,0 +1,281 @@ +'use strict' + +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') +const { WebViewImpl } = require('@electron/internal/renderer/web-view/web-view') +const webViewConstants = require('@electron/internal/renderer/web-view/web-view-constants') +const errorUtils = require('@electron/internal/common/error-utils') + +// Helper function to resolve url set in attribute. +const a = document.createElement('a') + +const resolveURL = function (url) { + if (url === '') return '' + a.href = url + return a.href +} + +// Attribute objects. +// Default implementation of a WebView attribute. +class WebViewAttribute { + constructor (name, webViewImpl) { + this.name = name + this.value = webViewImpl.webviewNode[name] || '' + this.webViewImpl = webViewImpl + this.ignoreMutation = false + this.defineProperty() + } + + // Retrieves and returns the attribute's value. + getValue () { + return this.webViewImpl.webviewNode.getAttribute(this.name) || this.value + } + + // Sets the attribute's value. + setValue (value) { + this.webViewImpl.webviewNode.setAttribute(this.name, value || '') + } + + // Changes the attribute's value without triggering its mutation handler. + setValueIgnoreMutation (value) { + this.ignoreMutation = true + this.setValue(value) + this.ignoreMutation = false + } + + // Defines this attribute as a property on the webview node. + defineProperty () { + return Object.defineProperty(this.webViewImpl.webviewNode, this.name, { + get: () => { + return this.getValue() + }, + set: (value) => { + return this.setValue(value) + }, + enumerable: true + }) + } + + // Called when the attribute's value changes. + handleMutation () {} +} + +// An attribute that is treated as a Boolean. +class BooleanAttribute extends WebViewAttribute { + getValue () { + return this.webViewImpl.webviewNode.hasAttribute(this.name) + } + + setValue (value) { + if (value) { + this.webViewImpl.webviewNode.setAttribute(this.name, '') + } else { + this.webViewImpl.webviewNode.removeAttribute(this.name) + } + } +} + +// Attribute representing the state of the storage partition. +class PartitionAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_PARTITION, webViewImpl) + this.validPartitionId = true + } + + handleMutation (oldValue, newValue) { + newValue = newValue || '' + + // The partition cannot change if the webview has already navigated. + if (!this.webViewImpl.beforeFirstNavigation) { + console.error(webViewConstants.ERROR_MSG_ALREADY_NAVIGATED) + this.setValueIgnoreMutation(oldValue) + return + } + if (newValue === 'persist:') { + this.validPartitionId = false + console.error(webViewConstants.ERROR_MSG_INVALID_PARTITION_ATTRIBUTE) + } + } +} + +// Attribute that handles the location and navigation of the webview. +class SrcAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_SRC, webViewImpl) + this.setupMutationObserver() + } + + getValue () { + if (this.webViewImpl.webviewNode.hasAttribute(this.name)) { + return resolveURL(this.webViewImpl.webviewNode.getAttribute(this.name)) + } else { + return this.value + } + } + + setValueIgnoreMutation (value) { + super.setValueIgnoreMutation(value) + + // takeRecords() is needed to clear queued up src mutations. Without it, it + // is possible for this change to get picked up asyncronously by src's + // mutation observer |observer|, and then get handled even though we do not + // want to handle this mutation. + this.observer.takeRecords() + } + + handleMutation (oldValue, newValue) { + // Once we have navigated, we don't allow clearing the src attribute. + // Once enters a navigated state, it cannot return to a + // placeholder state. + if (!newValue && oldValue) { + // src attribute changes normally initiate a navigation. We suppress + // the next src attribute handler call to avoid reloading the page + // on every guest-initiated navigation. + this.setValueIgnoreMutation(oldValue) + return + } + this.parse() + } + + // The purpose of this mutation observer is to catch assignment to the src + // attribute without any changes to its value. This is useful in the case + // where the webview guest has crashed and navigating to the same address + // spawns off a new process. + setupMutationObserver () { + this.observer = new MutationObserver((mutations) => { + for (const mutation of mutations) { + const { oldValue } = mutation + const newValue = this.getValue() + if (oldValue !== newValue) { + return + } + this.handleMutation(oldValue, newValue) + } + }) + const params = { + attributes: true, + attributeOldValue: true, + attributeFilter: [this.name] + } + this.observer.observe(this.webViewImpl.webviewNode, params) + } + + parse () { + if (!this.webViewImpl.elementAttached || !this.webViewImpl.attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId || !this.getValue()) { + return + } + if (this.webViewImpl.guestInstanceId == null) { + if (this.webViewImpl.beforeFirstNavigation) { + this.webViewImpl.beforeFirstNavigation = false + this.webViewImpl.createGuest() + } + return + } + + // Navigate to |this.src|. + const opts = {} + const httpreferrer = this.webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue() + if (httpreferrer) { + opts.httpReferrer = httpreferrer + } + const useragent = this.webViewImpl.attributes[webViewConstants.ATTRIBUTE_USERAGENT].getValue() + if (useragent) { + opts.userAgent = useragent + } + + const guestInstanceId = this.webViewImpl.guestInstanceId + const method = 'loadURL' + const args = [this.getValue(), opts] + + const [error] = ipcRenderer.sendSync('ELECTRON_GUEST_VIEW_MANAGER_SYNC_CALL', guestInstanceId, method, args) + if (error) { + throw errorUtils.deserialize(error) + } + } +} + +// Attribute specifies HTTP referrer. +class HttpReferrerAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_HTTPREFERRER, webViewImpl) + } +} + +// Attribute specifies user agent +class UserAgentAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_USERAGENT, webViewImpl) + } +} + +// Attribute that set preload script. +class PreloadAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_PRELOAD, webViewImpl) + } + + getValue () { + if (!this.webViewImpl.webviewNode.hasAttribute(this.name)) { + return this.value + } + let preload = resolveURL(this.webViewImpl.webviewNode.getAttribute(this.name)) + const protocol = preload.substr(0, 5) + if (protocol !== 'file:') { + console.error(webViewConstants.ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE) + preload = '' + } + return preload + } +} + +// Attribute that specifies the blink features to be enabled. +class BlinkFeaturesAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_BLINKFEATURES, webViewImpl) + } +} + +// Attribute that specifies the blink features to be disabled. +class DisableBlinkFeaturesAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_DISABLEBLINKFEATURES, webViewImpl) + } +} + +// Attribute that specifies the web preferences to be enabled. +class WebPreferencesAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_WEBPREFERENCES, webViewImpl) + } +} + +class EnableRemoteModuleAttribute extends WebViewAttribute { + constructor (webViewImpl) { + super(webViewConstants.ATTRIBUTE_ENABLEREMOTEMODULE, webViewImpl) + } + + getValue () { + return this.webViewImpl.webviewNode.getAttribute(this.name) !== 'false' + } + + setValue (value) { + this.webViewImpl.webviewNode.setAttribute(this.name, value ? 'true' : 'false') + } +} + +// Sets up all of the webview attributes. +WebViewImpl.prototype.setupWebViewAttributes = function () { + this.attributes = {} + this.attributes[webViewConstants.ATTRIBUTE_PARTITION] = new PartitionAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_SRC] = new SrcAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER] = new HttpReferrerAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_USERAGENT] = new UserAgentAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_NODEINTEGRATION] = new BooleanAttribute(webViewConstants.ATTRIBUTE_NODEINTEGRATION, this) + this.attributes[webViewConstants.ATTRIBUTE_PLUGINS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_PLUGINS, this) + this.attributes[webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY] = new BooleanAttribute(webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY, this) + this.attributes[webViewConstants.ATTRIBUTE_ALLOWPOPUPS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWPOPUPS, this) + this.attributes[webViewConstants.ATTRIBUTE_ENABLEREMOTEMODULE] = new EnableRemoteModuleAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_BLINKFEATURES] = new BlinkFeaturesAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_DISABLEBLINKFEATURES] = new DisableBlinkFeaturesAttribute(this) + this.attributes[webViewConstants.ATTRIBUTE_WEBPREFERENCES] = new WebPreferencesAttribute(this) +} diff --git a/electronasar/canary/renderer/web-view/web-view-constants.js b/electronasar/canary/renderer/web-view/web-view-constants.js new file mode 100644 index 0000000..459aafa --- /dev/null +++ b/electronasar/canary/renderer/web-view/web-view-constants.js @@ -0,0 +1,28 @@ +'use strict' + +module.exports = { + // Attributes. + ATTRIBUTE_NAME: 'name', + ATTRIBUTE_PARTITION: 'partition', + ATTRIBUTE_SRC: 'src', + ATTRIBUTE_HTTPREFERRER: 'httpreferrer', + ATTRIBUTE_NODEINTEGRATION: 'nodeintegration', + ATTRIBUTE_ENABLEREMOTEMODULE: 'enableremotemodule', + ATTRIBUTE_PLUGINS: 'plugins', + ATTRIBUTE_DISABLEWEBSECURITY: 'disablewebsecurity', + ATTRIBUTE_ALLOWPOPUPS: 'allowpopups', + ATTRIBUTE_PRELOAD: 'preload', + ATTRIBUTE_USERAGENT: 'useragent', + ATTRIBUTE_BLINKFEATURES: 'blinkfeatures', + ATTRIBUTE_DISABLEBLINKFEATURES: 'disableblinkfeatures', + ATTRIBUTE_WEBPREFERENCES: 'webpreferences', + + // Internal attribute. + ATTRIBUTE_INTERNALINSTANCEID: 'internalinstanceid', + + // Error messages. + ERROR_MSG_ALREADY_NAVIGATED: 'The object has already navigated, so its partition cannot be changed.', + ERROR_MSG_CANNOT_INJECT_SCRIPT: ': ' + 'Script cannot be injected into content until the page has loaded.', + ERROR_MSG_INVALID_PARTITION_ATTRIBUTE: 'Invalid partition attribute.', + ERROR_MSG_INVALID_PRELOAD_ATTRIBUTE: 'Only "file:" protocol is supported in "preload" attribute.' +} diff --git a/electronasar/canary/renderer/web-view/web-view.js b/electronasar/canary/renderer/web-view/web-view.js new file mode 100644 index 0000000..1413f4c --- /dev/null +++ b/electronasar/canary/renderer/web-view/web-view.js @@ -0,0 +1,381 @@ +'use strict' + +const { webFrame } = require('electron') + +const v8Util = process.atomBinding('v8_util') +const ipcRenderer = require('@electron/internal/renderer/ipc-renderer-internal') +const guestViewInternal = require('@electron/internal/renderer/web-view/guest-view-internal') +const webViewConstants = require('@electron/internal/renderer/web-view/web-view-constants') +const errorUtils = require('@electron/internal/common/error-utils') + +// ID generator. +let nextId = 0 + +const getNextId = function () { + return ++nextId +} + +// Represents the internal state of the WebView node. +class WebViewImpl { + constructor (webviewNode) { + this.webviewNode = webviewNode + v8Util.setHiddenValue(this.webviewNode, 'internal', this) + this.elementAttached = false + this.beforeFirstNavigation = true + this.hasFocus = false + + // on* Event handlers. + this.on = {} + + // Create internal iframe element. + this.internalElement = this.createInternalElement() + const shadowRoot = this.webviewNode.attachShadow({ mode: 'open' }) + shadowRoot.innerHTML = '' + this.setupWebViewAttributes() + this.viewInstanceId = getNextId() + shadowRoot.appendChild(this.internalElement) + + // Provide access to contentWindow. + Object.defineProperty(this.webviewNode, 'contentWindow', { + get: () => { + return this.internalElement.contentWindow + }, + enumerable: true + }) + } + + createInternalElement () { + const iframeElement = document.createElement('iframe') + iframeElement.style.flex = '1 1 auto' + iframeElement.style.width = '100%' + iframeElement.style.border = '0' + v8Util.setHiddenValue(iframeElement, 'internal', this) + return iframeElement + } + + // Resets some state upon reattaching element to the DOM. + reset () { + // If guestInstanceId is defined then the has navigated and has + // already picked up a partition ID. Thus, we need to reset the initialization + // state. However, it may be the case that beforeFirstNavigation is false BUT + // guestInstanceId has yet to be initialized. This means that we have not + // heard back from createGuest yet. We will not reset the flag in this case so + // that we don't end up allocating a second guest. + if (this.guestInstanceId) { + guestViewInternal.destroyGuest(this.guestInstanceId) + this.guestInstanceId = void 0 + } + + this.beforeFirstNavigation = true + this.attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true + + // Since attachment swaps a local frame for a remote frame, we need our + // internal iframe element to be local again before we can reattach. + const newFrame = this.createInternalElement() + const oldFrame = this.internalElement + this.internalElement = newFrame + oldFrame.parentNode.replaceChild(newFrame, oldFrame) + } + + // Sets the .request property. + setRequestPropertyOnWebViewNode (request) { + Object.defineProperty(this.webviewNode, 'request', { + value: request, + enumerable: true + }) + } + + // This observer monitors mutations to attributes of the and + // updates the BrowserPlugin properties accordingly. In turn, updating + // a BrowserPlugin property will update the corresponding BrowserPlugin + // attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more + // details. + handleWebviewAttributeMutation (attributeName, oldValue, newValue) { + if (!this.attributes[attributeName] || this.attributes[attributeName].ignoreMutation) { + return + } + + // Let the changed attribute handle its own mutation + this.attributes[attributeName].handleMutation(oldValue, newValue) + } + + onElementResize () { + const resizeEvent = new Event('resize') + resizeEvent.newWidth = this.webviewNode.clientWidth + resizeEvent.newHeight = this.webviewNode.clientHeight + this.dispatchEvent(resizeEvent) + } + + createGuest () { + return guestViewInternal.createGuest(this.buildParams(), (event, guestInstanceId) => { + this.attachGuestInstance(guestInstanceId) + }) + } + + createGuestSync () { + this.beforeFirstNavigation = false + this.attachGuestInstance(guestViewInternal.createGuestSync(this.buildParams())) + } + + dispatchEvent (webViewEvent) { + this.webviewNode.dispatchEvent(webViewEvent) + } + + // Adds an 'on' property on the webview, which can be used to set/unset + // an event handler. + setupEventProperty (eventName) { + const propertyName = `on${eventName.toLowerCase()}` + return Object.defineProperty(this.webviewNode, propertyName, { + get: () => { + return this.on[propertyName] + }, + set: (value) => { + if (this.on[propertyName]) { + this.webviewNode.removeEventListener(eventName, this.on[propertyName]) + } + this.on[propertyName] = value + if (value) { + return this.webviewNode.addEventListener(eventName, value) + } + }, + enumerable: true + }) + } + + // Updates state upon loadcommit. + onLoadCommit (webViewEvent) { + const oldValue = this.webviewNode.getAttribute(webViewConstants.ATTRIBUTE_SRC) + const newValue = webViewEvent.url + if (webViewEvent.isMainFrame && (oldValue !== newValue)) { + // Touching the src attribute triggers a navigation. To avoid + // triggering a page reload on every guest-initiated navigation, + // we do not handle this mutation. + this.attributes[webViewConstants.ATTRIBUTE_SRC].setValueIgnoreMutation(newValue) + } + } + + // Emits focus/blur events. + onFocusChange () { + const hasFocus = document.activeElement === this.webviewNode + if (hasFocus !== this.hasFocus) { + this.hasFocus = hasFocus + this.dispatchEvent(new Event(hasFocus ? 'focus' : 'blur')) + } + } + + onAttach (storagePartitionId) { + return this.attributes[webViewConstants.ATTRIBUTE_PARTITION].setValue(storagePartitionId) + } + + buildParams () { + const params = { + instanceId: this.viewInstanceId, + userAgentOverride: this.userAgentOverride + } + for (const attributeName in this.attributes) { + if (this.attributes.hasOwnProperty(attributeName)) { + params[attributeName] = this.attributes[attributeName].getValue() + } + } + return params + } + + attachGuestInstance (guestInstanceId) { + if (!this.elementAttached) { + // The element could be detached before we got response from browser. + return + } + this.internalInstanceId = getNextId() + this.guestInstanceId = guestInstanceId + guestViewInternal.attachGuest(this.internalInstanceId, this.guestInstanceId, this.buildParams(), this.internalElement.contentWindow) + // ResizeObserver is a browser global not recognized by "standard". + /* globals ResizeObserver */ + // TODO(zcbenz): Should we deprecate the "resize" event? Wait, it is not + // even documented. + this.resizeObserver = new ResizeObserver(this.onElementResize.bind(this)).observe(this.internalElement) + } +} + +// Registers custom element. +const registerWebViewElement = (window) => { + const proto = Object.create(window.HTMLObjectElement.prototype) + proto.createdCallback = function () { + return new WebViewImpl(this) + } + proto.attributeChangedCallback = function (name, oldValue, newValue) { + const internal = v8Util.getHiddenValue(this, 'internal') + if (internal) { + internal.handleWebviewAttributeMutation(name, oldValue, newValue) + } + } + proto.detachedCallback = function () { + const internal = v8Util.getHiddenValue(this, 'internal') + if (!internal) { + return + } + guestViewInternal.deregisterEvents(internal.viewInstanceId) + internal.elementAttached = false + this.internalInstanceId = 0 + internal.reset() + } + proto.attachedCallback = function () { + const internal = v8Util.getHiddenValue(this, 'internal') + if (!internal) { + return + } + if (!internal.elementAttached) { + guestViewInternal.registerEvents(internal, internal.viewInstanceId) + internal.elementAttached = true + internal.attributes[webViewConstants.ATTRIBUTE_SRC].parse() + } + } + + // Public-facing API methods. + const methods = [ + 'getURL', + 'loadURL', + 'getTitle', + 'isLoading', + 'isLoadingMainFrame', + 'isWaitingForResponse', + 'stop', + 'reload', + 'reloadIgnoringCache', + 'canGoBack', + 'canGoForward', + 'canGoToOffset', + 'clearHistory', + 'goBack', + 'goForward', + 'goToIndex', + 'goToOffset', + 'isCrashed', + 'setUserAgent', + 'getUserAgent', + 'openDevTools', + 'closeDevTools', + 'isDevToolsOpened', + 'isDevToolsFocused', + 'inspectElement', + 'setAudioMuted', + 'isAudioMuted', + 'isCurrentlyAudible', + 'undo', + 'redo', + 'cut', + 'copy', + 'paste', + 'pasteAndMatchStyle', + 'delete', + 'selectAll', + 'unselect', + 'replace', + 'replaceMisspelling', + 'findInPage', + 'stopFindInPage', + 'downloadURL', + 'inspectServiceWorker', + 'showDefinitionForSelection', + 'setZoomFactor', + 'setZoomLevel', + 'sendImeEvent' + ] + const nonblockMethods = [ + 'insertCSS', + 'insertText', + 'send', + 'sendInputEvent', + 'setLayoutZoomLevelLimits', + 'setVisualZoomLevelLimits', + // with callback + 'capturePage', + 'executeJavaScript', + 'getZoomFactor', + 'getZoomLevel', + 'print', + 'printToPDF' + ] + + const getGuestInstanceId = function (self) { + const internal = v8Util.getHiddenValue(self, 'internal') + if (!internal.guestInstanceId) { + throw new Error('The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.') + } + return internal.guestInstanceId + } + + // Forward proto.foo* method calls to WebViewImpl.foo*. + const createBlockHandler = function (method) { + return function (...args) { + const [error, result] = ipcRenderer.sendSync('ELECTRON_GUEST_VIEW_MANAGER_SYNC_CALL', getGuestInstanceId(this), method, args) + if (error) { + throw errorUtils.deserialize(error) + } else { + return result + } + } + } + for (const method of methods) { + proto[method] = createBlockHandler(method) + } + + const createNonBlockHandler = function (method) { + return function (...args) { + const callback = (typeof args[args.length - 1] === 'function') ? args.pop() : null + const requestId = getNextId() + ipcRenderer.once(`ELECTRON_GUEST_VIEW_MANAGER_ASYNC_CALL_RESPONSE_${requestId}`, function (event, error, result) { + if (error == null) { + if (callback) callback(result) + } else { + throw errorUtils.deserialize(error) + } + }) + ipcRenderer.send('ELECTRON_GUEST_VIEW_MANAGER_ASYNC_CALL', requestId, getGuestInstanceId(this), method, args, callback != null) + } + } + for (const method of nonblockMethods) { + proto[method] = createNonBlockHandler(method) + } + + // WebContents associated with this webview. + proto.getWebContents = function () { + const { getRemoteForUsage } = require('@electron/internal/renderer/remote') + const remote = getRemoteForUsage('getWebContents()') + const internal = v8Util.getHiddenValue(this, 'internal') + if (!internal.guestInstanceId) { + internal.createGuestSync() + } + return remote.getGuestWebContents(internal.guestInstanceId) + } + + // Focusing the webview should move page focus to the underlying iframe. + proto.focus = function () { + this.contentWindow.focus() + } + + window.WebView = webFrame.registerEmbedderCustomElement(window, 'webview', { + prototype: proto + }) + + // Delete the callbacks so developers cannot call them and produce unexpected + // behavior. + delete proto.createdCallback + delete proto.attachedCallback + delete proto.detachedCallback + delete proto.attributeChangedCallback +} + +const setupWebView = (window) => { + require('@electron/internal/renderer/web-view/web-view-attributes') + + const useCapture = true + window.addEventListener('readystatechange', function listener (event) { + if (document.readyState === 'loading') { + return + } + registerWebViewElement(window) + window.removeEventListener(event.type, listener, useCapture) + }, useCapture) +} + +module.exports = { setupWebView, WebViewImpl } diff --git a/electronasar/canary/renderer/window-setup.js b/electronasar/canary/renderer/window-setup.js new file mode 100644 index 0000000..f4ab44a --- /dev/null +++ b/electronasar/canary/renderer/window-setup.js @@ -0,0 +1,201 @@ +'use strict' + +// This file should have no requires since it is used by the isolated context +// preload bundle. Instead arguments should be passed in for everything it +// needs. + +// This file implements the following APIs: +// - window.alert() +// - window.confirm() +// - window.history.back() +// - window.history.forward() +// - window.history.go() +// - window.history.length +// - window.open() +// - window.opener.blur() +// - window.opener.close() +// - window.opener.eval() +// - window.opener.focus() +// - window.opener.location +// - window.opener.print() +// - window.opener.postMessage() +// - window.prompt() +// - document.hidden +// - document.visibilityState + +const { defineProperty } = Object + +// Helper function to resolve relative url. +const a = window.top.document.createElement('a') +const resolveURL = function (url) { + a.href = url + return a.href +} + +// Use this method to ensure values expected as strings in the main process +// are convertible to strings in the renderer process. This ensures exceptions +// converting values to strings are thrown in this process. +const toString = (value) => { + return value != null ? `${value}` : value +} + +const windowProxies = {} + +const getOrCreateProxy = (ipcRenderer, guestId) => { + let proxy = windowProxies[guestId] + if (proxy == null) { + proxy = new BrowserWindowProxy(ipcRenderer, guestId) + windowProxies[guestId] = proxy + } + return proxy +} + +const removeProxy = (guestId) => { + delete windowProxies[guestId] +} + +function BrowserWindowProxy (ipcRenderer, guestId) { + this.closed = false + + defineProperty(this, 'location', { + get: function () { + return ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD_SYNC', guestId, 'getURL') + }, + set: function (url) { + url = resolveURL(url) + return ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD_SYNC', guestId, 'loadURL', url) + } + }) + + ipcRenderer.once(`ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_${guestId}`, () => { + removeProxy(guestId) + this.closed = true + }) + + this.close = () => { + ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', guestId) + } + + this.focus = () => { + ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD', guestId, 'focus') + } + + this.blur = () => { + ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD', guestId, 'blur') + } + + this.print = () => { + ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', guestId, 'print') + } + + this.postMessage = (message, targetOrigin) => { + ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', guestId, message, toString(targetOrigin), window.location.origin) + } + + this.eval = (...args) => { + ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', guestId, 'executeJavaScript', ...args) + } +} + +// Forward history operations to browser. +const sendHistoryOperation = function (ipcRenderer, ...args) { + ipcRenderer.send('ELECTRON_NAVIGATION_CONTROLLER', ...args) +} + +const getHistoryOperation = function (ipcRenderer, ...args) { + return ipcRenderer.sendSync('ELECTRON_SYNC_NAVIGATION_CONTROLLER', ...args) +} + +module.exports = (ipcRenderer, guestInstanceId, openerId, hiddenPage, usesNativeWindowOpen) => { + if (guestInstanceId == null) { + // Override default window.close. + window.close = function () { + ipcRenderer.sendSync('ELECTRON_BROWSER_WINDOW_CLOSE') + } + } + + if (!usesNativeWindowOpen) { + // Make the browser window or guest view emit "new-window" event. + window.open = function (url, frameName, features) { + if (url != null && url !== '') { + url = resolveURL(url) + } + const guestId = ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', url, toString(frameName), toString(features)) + if (guestId != null) { + return getOrCreateProxy(ipcRenderer, guestId) + } else { + return null + } + } + + if (openerId != null) { + window.opener = getOrCreateProxy(ipcRenderer, openerId) + } + } + + // But we do not support prompt(). + window.prompt = function () { + throw new Error('prompt() is and will not be supported.') + } + + ipcRenderer.on('ELECTRON_GUEST_WINDOW_POSTMESSAGE', function (event, sourceId, message, sourceOrigin) { + // Manually dispatch event instead of using postMessage because we also need to + // set event.source. + event = document.createEvent('Event') + event.initEvent('message', false, false) + event.data = message + event.origin = sourceOrigin + event.source = getOrCreateProxy(ipcRenderer, sourceId) + window.dispatchEvent(event) + }) + + window.history.back = function () { + sendHistoryOperation(ipcRenderer, 'goBack') + } + + window.history.forward = function () { + sendHistoryOperation(ipcRenderer, 'goForward') + } + + window.history.go = function (offset) { + sendHistoryOperation(ipcRenderer, 'goToOffset', +offset) + } + + defineProperty(window.history, 'length', { + get: function () { + return getHistoryOperation(ipcRenderer, 'length') + } + }) + + if (guestInstanceId != null) { + // Webview `document.visibilityState` tracks window visibility (and ignores + // the actual element visibility) for backwards compatibility. + // See discussion in #9178. + // + // Note that this results in duplicate visibilitychange events (since + // Chromium also fires them) and potentially incorrect visibility change. + // We should reconsider this decision for Electron 2.0. + let cachedVisibilityState = hiddenPage ? 'hidden' : 'visible' + + // Subscribe to visibilityState changes. + ipcRenderer.on('ELECTRON_GUEST_INSTANCE_VISIBILITY_CHANGE', function (event, visibilityState) { + if (cachedVisibilityState !== visibilityState) { + cachedVisibilityState = visibilityState + document.dispatchEvent(new Event('visibilitychange')) + } + }) + + // Make document.hidden and document.visibilityState return the correct value. + defineProperty(document, 'hidden', { + get: function () { + return cachedVisibilityState !== 'visible' + } + }) + + defineProperty(document, 'visibilityState', { + get: function () { + return cachedVisibilityState + } + }) + } +} diff --git a/electronasar/canary/worker/init.js b/electronasar/canary/worker/init.js new file mode 100644 index 0000000..e4f8250 --- /dev/null +++ b/electronasar/canary/worker/init.js @@ -0,0 +1,37 @@ +'use strict' + +const path = require('path') +const Module = require('module') + +// We modified the original process.argv to let node.js load the +// init.js, we need to restore it here. +process.argv.splice(1, 1) + +// Clear search paths. +require('../common/reset-search-paths') + +// Import common settings. +require('@electron/internal/common/init') + +// Expose public APIs. +Module.globalPaths.push(path.join(__dirname, 'api', 'exports')) + +// Export node bindings to global. +global.require = require +global.module = module + +// Set the __filename to the path of html file if it is file: protocol. +if (self.location.protocol === 'file:') { + const pathname = process.platform === 'win32' && self.location.pathname[0] === '/' ? self.location.pathname.substr(1) : self.location.pathname + global.__filename = path.normalize(decodeURIComponent(pathname)) + global.__dirname = path.dirname(global.__filename) + + // Set module's filename so relative require can work as expected. + module.filename = global.__filename + + // Also search for module under the html file. + module.paths = module.paths.concat(Module._nodeModulePaths(global.__dirname)) +} else { + global.__filename = __filename + global.__dirname = __dirname +}