From fbdfa54d9b1fcea99ec5ca87cbbd492f2acc13d5 Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Thu, 25 Feb 2021 13:46:24 +0300 Subject: [PATCH] Bug fix. - Refactor HttpGetter function. - Remove redundant asset files. - Fix BlockSync dependency issues. --- package-lock.json | 254 +++++++--------- package.json | 7 +- src/app/_helpers/http-getter.ts | 27 +- src/app/_helpers/index.ts | 1 - src/app/_helpers/pgp-key-store.ts | 2 +- src/app/_services/block-sync.service.ts | 37 +-- src/app/_services/user.service.ts | 6 +- src/app/app.component.ts | 1 - .../account-details.component.ts | 3 +- .../transactions/transactions.component.ts | 7 +- src/assets/js/block-sync/cic-client.web.js | 274 ------------------ src/assets/js/block-sync/sync.js | 3 +- src/assets/js/cic-meta/auth.ts | 199 ------------- src/assets/js/cic-meta/constants.js | 24 -- src/assets/js/cic-meta/sync.js | 246 ---------------- src/assets/js/eth_account_index/index.d.ts | 1 - src/assets/js/eth_account_index/index.js | 5 - src/assets/js/eth_account_index/registry.d.ts | 10 - src/assets/js/eth_account_index/registry.js | 109 ------- src/assets/js/moolb.js | 165 ----------- src/assets/js/openpgp.min.js | 2 - src/assets/js/sync.js | 30 -- src/assets/js/web3.min.js | 1 - src/assets/js/worker.js | 63 ---- src/environments/environment.prod.ts | 3 +- src/environments/environment.ts | 3 +- src/index.html | 1 - 27 files changed, 138 insertions(+), 1346 deletions(-) delete mode 100644 src/assets/js/block-sync/cic-client.web.js delete mode 100644 src/assets/js/cic-meta/auth.ts delete mode 100644 src/assets/js/cic-meta/constants.js delete mode 100644 src/assets/js/cic-meta/sync.js delete mode 100644 src/assets/js/eth_account_index/index.d.ts delete mode 100644 src/assets/js/eth_account_index/index.js delete mode 100644 src/assets/js/eth_account_index/registry.d.ts delete mode 100644 src/assets/js/eth_account_index/registry.js delete mode 100644 src/assets/js/moolb.js delete mode 100644 src/assets/js/openpgp.min.js delete mode 100644 src/assets/js/sync.js delete mode 100644 src/assets/js/web3.min.js delete mode 100644 src/assets/js/worker.js diff --git a/package-lock.json b/package-lock.json index 7a603c1..e4da64f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -302,6 +302,12 @@ "ms": "^2.1.1" } }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, "uuid": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", @@ -1647,9 +1653,9 @@ } }, "@ethereumjs/common": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.0.0.tgz", - "integrity": "sha512-yL0zA7Xwgz8IFHKW0VoXGjdZDVxUJg8BQ/muMHvYPW7zHJNNC80gQmvLH+MpvIg1TCXZkFXxrpYRAyCElSm+aw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.1.0.tgz", + "integrity": "sha512-sY2yBKwZjlIM5Z+sBd9ZEEH5YDB5OsvSVCi5hzTqeMfv4307JfLH0MjM09whi4InLmqWRdJp/fmt/rQyP4qxKg==", "requires": { "crc-32": "^1.2.0" } @@ -2007,6 +2013,14 @@ "pacote": "9.5.12", "semver": "7.3.2", "semver-intersect": "1.4.0" + }, + "dependencies": { + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + } } }, "@sindresorhus/is": { @@ -2160,14 +2174,6 @@ "integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==", "dev": true }, - "@types/web3": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/web3/-/web3-1.2.2.tgz", - "integrity": "sha512-eFiYJKggNrOl0nsD+9cMh2MLk4zVBfXfGnVeRFbpiZzBE20eet4KLA3fXcjSuHaBn0RnQzwLAGdgzgzdet4C0A==", - "requires": { - "web3": "*" - } - }, "@types/webpack-sources": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.8.tgz", @@ -3348,15 +3354,6 @@ "tweetnacl": "^0.14.3" } }, - "better-assert": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", - "dev": true, - "requires": { - "callsite": "1.0.0" - } - }, "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -3416,6 +3413,11 @@ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, + "bn": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bn/-/bn-1.0.5.tgz", + "integrity": "sha512-7TvGbqbZb6lDzsBtNz1VkdXXV0BVmZKPPViPmo2IpvwaryF7P+QKYKACyVkwo2mZPr2CpFiz7EtgPEcc3o/JFQ==" + }, "bn.js": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", @@ -3832,12 +3834,6 @@ "caller-callsite": "^2.0.0" } }, - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", - "dev": true - }, "callsites": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", @@ -3956,14 +3952,16 @@ } }, "cic-client": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/cic-client/-/cic-client-0.0.3.tgz", - "integrity": "sha512-PAgHs8O2W8zhH8vsAuHv2IWz/Ol8ZjYDLiNqLyIPRG7h457XY5IM5zfy8hEwSFpsXRYC9gFMnb8THR4HG17Oqg==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/cic-client/-/cic-client-0.1.1.tgz", + "integrity": "sha512-4eywf1VT8YaA4a+ap2gTsjmep/vmjWDMNoADOztOhua7uh/Jh0AR4446npmT3c7S3Hp1aailR2EJABbzpkePjA==", "requires": { - "@types/web3": "^1.2.2", + "bn": "^1.0.5", + "lru-cache": "^6.0.0", + "path-browserify": "^1.0.1", "ts-node": "^9.0.0", "typescript": "^4.0.5", - "web3": "^1.3.0", + "web3": "^1.3.1", "webpack": "^5.4.0" }, "dependencies": { @@ -4145,6 +4143,11 @@ "yocto-queue": "^0.1.0" } }, + "path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, "schema-utils": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", @@ -4234,9 +4237,9 @@ } }, "webpack": { - "version": "5.24.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.24.1.tgz", - "integrity": "sha512-eg+6OIt6npUSwbhRQY6XffAixEUSARBf+WAWOxrZwOB4jRbbpMXlridFy/Yt7N0U20Ry1vp/nnDbtN7l1rUdIA==", + "version": "5.24.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.24.2.tgz", + "integrity": "sha512-uxxKYEY4kMNjP+D2Y+8aw5Vd7ar4pMuKCNemxV26ysr1nk0YDiQTylg9U3VZIdkmI0YHa0uC8ABxL+uGxGWWJg==", "requires": { "@types/eslint-scope": "^3.7.0", "@types/estree": "^0.0.46", @@ -4275,9 +4278,9 @@ } }, "cic-client-meta": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/cic-client-meta/-/cic-client-meta-0.0.5.tgz", - "integrity": "sha512-eWRzhZHA7/1/4dJB3gazzdtBWyEHjhUzIbfhW3eaGbCs7sW7m0Sj7nq/uzEC/bFxFMoVGx+3aiKrjLN8ocqcZA==", + "version": "0.0.7-alpha.3", + "resolved": "https://registry.npmjs.org/cic-client-meta/-/cic-client-meta-0.0.7-alpha.3.tgz", + "integrity": "sha512-4lnzx8Bz6iiIi0wuJL0vSnR+umvrTyDok3efQfafkUM4stNR4kBh6vpqZJiA0FE+oTOr1raiVvm2QyekyUx24A==", "requires": { "@ethereumjs/tx": "^3.0.0-beta.1", "automerge": "^0.14.1", @@ -4383,9 +4386,9 @@ } }, "yargs-parser": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.5.tgz", - "integrity": "sha512-jYRGS3zWy20NtDtK2kBgo/TlAoy5YUuhD9/LZ7z7W4j1Fdw2cqD0xEEclf8fxc8xjD6X5Qr+qQQwCEsP8iRiYg==" + "version": "20.2.6", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.6.tgz", + "integrity": "sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==" } } }, @@ -5832,23 +5835,23 @@ } }, "engine.io": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.2.tgz", - "integrity": "sha512-b4Q85dFkGw+TqgytGPrGgACRUhsdKc9S9ErRAXpPGy/CXKs4tYoHDkvIRdsseAF7NjfVwjRFIn6KTnbw7LwJZg==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.5.0.tgz", + "integrity": "sha512-21HlvPUKaitDGE4GXNtQ7PLP0Sz4aWLddMPw2VTyFz1FVZqu/kZsJUO8WNpKuE/OCL7nkfRaOui2ZCJloGznGA==", "dev": true, "requires": { "accepts": "~1.3.4", "base64id": "2.0.0", - "cookie": "0.3.1", + "cookie": "~0.4.1", "debug": "~4.1.0", "engine.io-parser": "~2.2.0", - "ws": "^7.1.2" + "ws": "~7.4.2" }, "dependencies": { "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", "dev": true }, "debug": { @@ -5861,17 +5864,17 @@ } }, "ws": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", - "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz", + "integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==", "dev": true } } }, "engine.io-client": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.4.tgz", - "integrity": "sha512-iU4CRr38Fecj8HoZEnFtm2EiKGbYZcPn3cHxqNGl/tmdWRf60KhK+9vE0JeSjgnlS/0oynEfLgKbT9ALpim0sQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.0.tgz", + "integrity": "sha512-12wPRfMrugVw/DNyJk34GQ5vIVArEcVMXWugQGGuw2XxUSztFNmJggZmv8IZlLyEdnpO1QB9LkcjeWewO2vxtA==", "dev": true, "requires": { "component-emitter": "~1.3.0", @@ -5882,7 +5885,7 @@ "indexof": "0.0.1", "parseqs": "0.0.6", "parseuri": "0.0.6", - "ws": "~6.1.0", + "ws": "~7.4.2", "xmlhttprequest-ssl": "~1.5.4", "yeast": "0.1.2" }, @@ -5902,26 +5905,11 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "parseqs": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", - "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==", - "dev": true - }, - "parseuri": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", - "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==", - "dev": true - }, "ws": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", - "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz", + "integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==", + "dev": true } } }, @@ -7724,9 +7712,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "inquirer": { "version": "7.3.3", @@ -10663,12 +10651,6 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, - "object-component": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", - "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", - "dev": true - }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -11294,22 +11276,16 @@ } }, "parseqs": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", - "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", - "dev": true, - "requires": { - "better-assert": "~1.0.0" - } + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", + "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==", + "dev": true }, "parseuri": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", - "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", - "dev": true, - "requires": { - "better-assert": "~1.0.0" - } + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", + "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==", + "dev": true }, "parseurl": { "version": "1.3.3", @@ -13826,16 +13802,16 @@ } }, "socket.io": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz", - "integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.4.1.tgz", + "integrity": "sha512-Si18v0mMXGAqLqCVpTxBa8MGqriHGQh8ccEOhmsmNS3thNCGBwO8WGrwMibANsWtQQ5NStdZwHqZR3naJVFc3w==", "dev": true, "requires": { "debug": "~4.1.0", - "engine.io": "~3.4.0", + "engine.io": "~3.5.0", "has-binary2": "~1.0.2", "socket.io-adapter": "~1.1.0", - "socket.io-client": "2.3.0", + "socket.io-client": "2.4.0", "socket.io-parser": "~3.4.0" }, "dependencies": { @@ -13857,46 +13833,31 @@ "dev": true }, "socket.io-client": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", - "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.4.0.tgz", + "integrity": "sha512-M6xhnKQHuuZd4Ba9vltCLT9oa+YvTsP8j9NcEiLElfIg8KeYPyhWOes6x4t+LTAC8enQbE/995AdTem2uNyKKQ==", "dev": true, "requires": { "backo2": "1.0.2", - "base64-arraybuffer": "0.1.5", "component-bind": "1.0.0", - "component-emitter": "1.2.1", - "debug": "~4.1.0", - "engine.io-client": "~3.4.0", + "component-emitter": "~1.3.0", + "debug": "~3.1.0", + "engine.io-client": "~3.5.0", "has-binary2": "~1.0.2", - "has-cors": "1.1.0", "indexof": "0.0.1", - "object-component": "0.0.3", - "parseqs": "0.0.5", - "parseuri": "0.0.5", + "parseqs": "0.0.6", + "parseuri": "0.0.6", "socket.io-parser": "~3.3.0", "to-array": "0.1.4" }, "dependencies": { - "base64-arraybuffer": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", - "dev": true - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.0.0" } }, "isarray": { @@ -13905,38 +13866,21 @@ "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", "dev": true }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, "socket.io-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.1.tgz", - "integrity": "sha512-1QLvVAe8dTz+mKmZ07Swxt+LAo4Y1ff50rlyoEx00TQmDFVQYPfcqGvIDJLGaBdhdNCecXtyKpD+EgKGcmmbuQ==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.2.tgz", + "integrity": "sha512-FJvDBuOALxdCI9qwRrO/Rfp9yfndRtc1jSgVgV8FDraihmSP/MLGD5PEuJrNfjALvcQ+vMDM/33AWOYP/JSjDg==", "dev": true, "requires": { "component-emitter": "~1.3.0", "debug": "~3.1.0", "isarray": "2.0.1" - }, - "dependencies": { - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } } } } diff --git a/package.json b/package.json index c0042f3..aca2444 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "block-syncer": "^0.2.4", "bootstrap": "^4.5.3", "chart.js": "^2.9.4", - "cic-client": "0.0.3", - "cic-client-meta": "0.0.5", + "cic-client": "^0.1.1", + "cic-client-meta": "0.0.7-alpha.3", "datatables.net": "^1.10.22", "datatables.net-dt": "^1.10.22", "jquery": "^3.5.1", @@ -64,5 +64,6 @@ "ts-node": "~8.3.0", "tslint": "~6.1.0", "typescript": "~4.0.2" - } + }, + "author": "Spencer Ofwiti " } diff --git a/src/app/_helpers/http-getter.ts b/src/app/_helpers/http-getter.ts index 12b6edb..f5c9f65 100644 --- a/src/app/_helpers/http-getter.ts +++ b/src/app/_helpers/http-getter.ts @@ -1,19 +1,18 @@ +function HttpGetter(): void {} +HttpGetter.prototype.get = filename => new Promise((whohoo, doh) => { + const xhr = new XMLHttpRequest(); + xhr.addEventListener('load', (e) => { + if (xhr.status === 200) { + whohoo(xhr.responseText); + return; + } + doh('failed with status ' + xhr.status + ': ' + xhr.statusText); + }); + xhr.open('GET', filename); + xhr.send(); +}); -class HttpGetter { - async get(filename: string): Promise { - const xhr = new XMLHttpRequest(); - xhr.addEventListener('load', (e) => { - if (xhr.status === 200) { - console.log(xhr.responseText); - return; - } - console.log('failed with status ' + xhr.status + ': ' + xhr.statusText); - }); - xhr.open('GET', filename); - xhr.send(); - } -} export { HttpGetter }; diff --git a/src/app/_helpers/index.ts b/src/app/_helpers/index.ts index 018e3ad..c071fe8 100644 --- a/src/app/_helpers/index.ts +++ b/src/app/_helpers/index.ts @@ -7,4 +7,3 @@ export * from '@app/_helpers/array-sum'; export * from '@app/_helpers/accountIndex'; export * from '@app/_helpers/http-getter'; export * from '@app/_helpers/pgp-signer'; - diff --git a/src/app/_helpers/pgp-key-store.ts b/src/app/_helpers/pgp-key-store.ts index cf438c7..ae8f03f 100644 --- a/src/app/_helpers/pgp-key-store.ts +++ b/src/app/_helpers/pgp-key-store.ts @@ -1,6 +1,6 @@ +import { KeyStore } from 'cic-client-meta'; const openpgp = require('openpgp'); const keyring = new openpgp.Keyring(); -import { KeyStore } from '@src/assets/js/cic-meta/auth'; interface MutableKeyStore extends KeyStore { loadKeyring(): Promise; diff --git a/src/app/_services/block-sync.service.ts b/src/app/_services/block-sync.service.ts index de1ce2a..3401253 100644 --- a/src/app/_services/block-sync.service.ts +++ b/src/app/_services/block-sync.service.ts @@ -1,33 +1,32 @@ import {Injectable} from '@angular/core'; import {Settings} from '@app/_models'; import Web3 from 'web3'; -import {abi, Registry, TransactionHelper} from 'cic-client'; +import {CICRegistry, TransactionHelper} from 'cic-client'; import {first} from 'rxjs/operators'; import {TransactionService} from '@app/_services/transaction.service'; import {environment} from '@src/environments/environment'; -const cic = require('@src/assets/js/block-sync/cic-client.web'); +import {HttpGetter} from '@app/_helpers'; @Injectable({ providedIn: 'root' }) export class BlockSyncService { - trustedDeclaratorAddress: string = '0x5567139c7a1C2977A391f51D8cA45B1D6700f5F6'; readyStateTarget: number = 2; readyState: number = 0; + fileGetter = new HttpGetter(); constructor(private transactionService: TransactionService) { } blockSync(): any { const settings = new Settings(this.scan); const provider = environment.web3Provider; - const readyStateElements = { - token: 1, - network: 2, - }; + const readyStateElements = { network: 2 }; settings.w3.provider = provider; settings.w3.engine = new Web3(provider); - settings.registry = new Registry(settings.w3.engine, environment.registryAddress, abi); - settings.txHelper = new TransactionHelper(settings.registry); + settings.registry = new CICRegistry(settings.w3.engine, environment.registryAddress, this.fileGetter, + ['../../assets/js/block-sync/data']); + settings.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress); + settings.txHelper = new TransactionHelper(settings.w3.engine, settings.registry); settings.txHelper.ontransfer = async (transaction: any): Promise => { window.dispatchEvent(this.newTransferEvent(transaction)); @@ -35,12 +34,8 @@ export class BlockSyncService { settings.txHelper.onconversion = async (transaction: any): Promise => { window.dispatchEvent(this.newConversionEvent(transaction)); }; - settings.registry.ontokensload = (tokenCount: number): void => { - // console.debug('loaded tokens', tokenCount); - this.readyStateProcessor(settings, readyStateElements.token); - }; - settings.registry.onregistryload = (addressReturned: number): void => { - // console.debug('loaded network contracts', addressReturned); + settings.registry.onload = (addressReturned: number): void => { + console.log('loaded network contracts', addressReturned); this.readyStateProcessor(settings, readyStateElements.network); }; @@ -79,7 +74,7 @@ export class BlockSyncService { } async scan(settings, lo, hi, bloomBlockBytes, bloomBlocktxBytes, bloomRounds): Promise { - const w = new Worker('./../assets/js/worker.js'); + const w = new Worker('./../assets/js/block-sync/ondemand.js'); w.onmessage = (m) => { settings.txHelper.processReceipt(m.data); }; @@ -114,14 +109,4 @@ export class BlockSyncService { settings.scanFilter(settings, data.low, data.high, bOne, bTwo, data.filter_rounds); }); } - - headWorker(): void { - const wHeadSync = new Worker('./../assets/js/block-sync/head.js', {type: 'module'}); - wHeadSync.onmessage = (m) => { - console.log(m.data); - }; - wHeadSync.postMessage({ - w3_provider: environment.web3Provider, - }); - } } diff --git a/src/app/_services/user.service.ts b/src/app/_services/user.service.ts index 87f6223..9140593 100644 --- a/src/app/_services/user.service.ts +++ b/src/app/_services/user.service.ts @@ -3,9 +3,8 @@ import {BehaviorSubject, Observable} from 'rxjs'; import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http'; import {environment} from '@src/environments/environment'; import {first} from 'rxjs/operators'; -import {ArgPair, Envelope, Syncable} from '@src/assets/js/cic-meta/sync.js'; import {MutableKeyStore, MutablePgpKeyStore, PGPSigner, Signer} from '@app/_helpers'; -import {User} from 'cic-client-meta'; +import {ArgPair, Envelope, Syncable, User} from 'cic-client-meta'; @Injectable({ providedIn: 'root' @@ -64,8 +63,7 @@ export class UserService { await this.updateMeta(syncableAccount, accountKey, this.headers); }, async error => { console.error('There is an error!', error); - const refName = accountKey + ':cic.person'; - const syncableAccount: Syncable = new Syncable(refName, accountDetails); + const syncableAccount: Syncable = new Syncable(accountKey, accountDetails); await this.updateMeta(syncableAccount, accountKey, this.headers); }); return accountKey; diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 46f303d..9b59708 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -26,7 +26,6 @@ export class AppComponent implements OnInit { } ngOnInit(): void { - this.blockSyncService.headWorker(); this.mediaQuery.addListener(this.onResize); this.onResize(this.mediaQuery); this.queryAccountsIndex(20).then(); diff --git a/src/app/pages/accounts/account-details/account-details.component.ts b/src/app/pages/accounts/account-details/account-details.component.ts index b2c32f2..c7d12c2 100644 --- a/src/app/pages/accounts/account-details/account-details.component.ts +++ b/src/app/pages/accounts/account-details/account-details.component.ts @@ -8,8 +8,7 @@ import {ActivatedRoute, Params, Router} from '@angular/router'; import {first} from 'rxjs/operators'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {CustomErrorStateMatcher} from '@app/_helpers'; -import {User} from 'cic-client-meta'; -import {Envelope} from '@src/assets/js/cic-meta/sync'; +import {Envelope, User} from 'cic-client-meta'; @Component({ selector: 'app-account-details', diff --git a/src/app/pages/transactions/transactions.component.ts b/src/app/pages/transactions/transactions.component.ts index 89857cf..f3eefaf 100644 --- a/src/app/pages/transactions/transactions.component.ts +++ b/src/app/pages/transactions/transactions.component.ts @@ -1,5 +1,5 @@ import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; -import {BlockSyncService, TransactionService} from '@app/_services'; +import {TransactionService} from '@app/_services'; import {MatTableDataSource} from '@angular/material/table'; import {SelectionModel} from '@angular/cdk/collections'; import {MatPaginator} from '@angular/material/paginator'; @@ -25,10 +25,7 @@ export class TransactionsComponent implements OnInit, AfterViewInit { constructor( private transactionService: TransactionService, - private blockSyncService: BlockSyncService - ) { - this.blockSyncService.blockSync(); - } + ) { } ngOnInit(): void { this.transactionService.transactionsSubject.subscribe(transactions => { diff --git a/src/assets/js/block-sync/cic-client.web.js b/src/assets/js/block-sync/cic-client.web.js deleted file mode 100644 index 493c503..0000000 --- a/src/assets/js/block-sync/cic-client.web.js +++ /dev/null @@ -1,274 +0,0 @@ -/* - * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). - * This devtool is not neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ -window.cic = -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "./dist/bancor/convert.js": -/*!********************************!*\ - !*** ./dist/bancor/convert.js ***! - \********************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: top-level-this-exports, __webpack_exports__, __webpack_require__ */ -/*! CommonJS bailout: this is used directly at 2:17-21 */ -/*! CommonJS bailout: this is used directly at 11:19-23 */ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Conversion = void 0;\nvar tx_1 = __webpack_require__(/*! ../common/tx */ \"./dist/common/tx.js\");\nvar topic_convert = '0x7154b38b5dd31bb3122436a96d4e09aba5b323ae1fd580025fab55074334c095';\n/**\n * Instance represents a single conversion event on network.\n *\n * @class Conversion\n */\nvar Conversion = /** @class */ (function () {\n /**\n *\n * @param tx Ethereum transaction\n * @param sourceToken ERC20 token sent in conversion\n * @param destinationToken ERC20 token received from conversion\n * @param trader Ethereum address performing the conversion (sender and recipient)\n * @param fromValue Source token value of conversion\n * @param toValue Destination token value of conversion\n */\n function Conversion(tx, sourceToken, destinationToken, trader, fromValue, toValue) {\n this.sourceToken = sourceToken;\n this.destinationToken = destinationToken;\n this.trader = trader;\n this.fromValue = fromValue;\n this.toValue = toValue;\n this.tx = tx;\n }\n /**\n * Scans a transaction log for transfer event.\n *\n * @static\n * @param w3 A connected Web3 object\n * @param registry Registry context of conversion\n * @param success State of transaction\n * @param log A Web3 transaction receipt logs array\n * @return conversion Instance of Conversion if conversion is found, undefined if not.\n */\n Conversion.processLog = function (w3, registry, success, log) {\n return __awaiter(this, void 0, void 0, function () {\n var conversion, block, sourceToken_address, sourceToken, destinationToken_address, destinationToken, fromValue, toValue, trader, tx;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n conversion = undefined;\n if (!(log.topics[0] == topic_convert)) return [3 /*break*/, 4];\n return [4 /*yield*/, w3.eth.getBlock(log.blockNumber)];\n case 1:\n block = _a.sent();\n sourceToken_address = w3.utils.toChecksumAddress('0x' + log.topics[1].substring(26, 66));\n return [4 /*yield*/, registry.getToken(sourceToken_address)];\n case 2:\n sourceToken = _a.sent();\n destinationToken_address = w3.utils.toChecksumAddress('0x' + log.topics[2].substring(26, 66));\n return [4 /*yield*/, registry.getToken(destinationToken_address)];\n case 3:\n destinationToken = _a.sent();\n fromValue = BigInt(log.data.substring(0, 66));\n toValue = BigInt(log.data.substring(0, 66));\n trader = w3.utils.toChecksumAddress('0x' + log.data.substring(154));\n tx = new tx_1.Tx(log.blockNumber, log.transactionIndex, log.transactionHash, block.timestamp, success);\n conversion = new Conversion(tx, sourceToken, destinationToken, trader, fromValue, toValue);\n console.log('convert', conversion);\n _a.label = 4;\n case 4: return [2 /*return*/, conversion];\n }\n });\n });\n };\n return Conversion;\n}());\nexports.Conversion = Conversion;\n\n\n//# sourceURL=webpack://cic/./dist/bancor/convert.js?"); - -/***/ }), - -/***/ "./dist/common/erc20.js": -/*!******************************!*\ - !*** ./dist/common/erc20.js ***! - \******************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: top-level-this-exports, __webpack_exports__, __webpack_require__ */ -/*! CommonJS bailout: this is used directly at 7:17-21 */ -/*! CommonJS bailout: this is used directly at 16:19-23 */ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -eval("\n/**\n * Provides a representation of a token transfer transaction, aswell as a processor to detect transfer events.\n *\n * @module erc20\n */\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.topics = exports.Token = exports.Transfer = void 0;\nvar tx_1 = __webpack_require__(/*! ./tx */ \"./dist/common/tx.js\");\nvar topics = {\n 'transfer': '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',\n};\nexports.topics = topics;\n/**\n * A Transfer instance represents a single ERC20 token transfer.\n *\n * @class Transfer\n */\nvar Transfer = /** @class */ (function () {\n /**\n *\n * @param tx A transaction object\n * @param token Ethereum address of ERC20 token transferred\n * @param from Ethereum address of sender\n * @param to Ethereum address of receipient\n * @param value Value of transfer\n */\n function Transfer(tx, token, from, to, value) {\n this.from = from;\n this.to = to;\n this.token = token;\n this.value = value;\n this.tx = tx;\n }\n /**\n * Scans a transaction log for transfer event.\n *\n * @static\n * @param w3 A connected Web3 object\n * @param success State of transaction\n * @param token Token address to find transfer for\n * @param log A Web3 transaction receipt logs array\n * @return transfer Instance of Transfer if transfer is found, undefined if not.\n */\n Transfer.processLog = function (w3, success, token, log) {\n return __awaiter(this, void 0, void 0, function () {\n var transfer, block, from, to, value, tx;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n transfer = undefined;\n if (!(log.topics[0] == topics['transfer'])) return [3 /*break*/, 2];\n return [4 /*yield*/, w3.eth.getBlock(log.blockNumber)];\n case 1:\n block = _a.sent();\n from = w3.utils.toChecksumAddress(log.topics[1].substring(26, 66));\n to = w3.utils.toChecksumAddress(log.topics[2].substring(26, 66));\n value = BigInt(log.data);\n tx = new tx_1.Tx(log.blockNumber, log.transactionIndex, log.transactionHash, block.timestamp, success);\n transfer = new Transfer(tx, token, from, to, value);\n _a.label = 2;\n case 2: return [2 /*return*/, transfer];\n }\n });\n });\n };\n return Transfer;\n}());\nexports.Transfer = Transfer;\n/**\n * Metadata for a single ERC20 token.\n *\n * @class Token\n *\n */\nvar Token = /** @class */ (function () {\n /**\n *\n * @param address Ethereum address of token contract\n * @param name ERC20 token name\n * @param symbol ERC20 token symbol\n */\n function Token(address, name, symbol, decimals, totalSupply) {\n this.address = address;\n this.name = name;\n this.symbol = symbol;\n this.totalSupply = totalSupply;\n this.decimals = decimals;\n }\n /**\n * Informal string representation of token.\n *\n */\n Token.prototype.toString = function () {\n return 'Token: ' + this.name + ' (' + this.symbol + ')';\n };\n return Token;\n}());\nexports.Token = Token;\n\n\n//# sourceURL=webpack://cic/./dist/common/erc20.js?"); - -/***/ }), - -/***/ "./dist/common/tx.js": -/*!***************************!*\ - !*** ./dist/common/tx.js ***! - \***************************/ -/*! flagged exports */ -/*! export Log [provided] [no usage info] [missing usage info prevents renaming] */ -/*! export Tx [provided] [no usage info] [missing usage info prevents renaming] */ -/*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ -/*! other exports [not provided] [no usage info] */ -/*! runtime requirements: __webpack_exports__ */ -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; -eval("\n/**\n * Abstractions of Web3 transactions and transaction receipt logs\n *\n * @module tx\n */\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Log = exports.Tx = void 0;\n/**\n * Instance encapsulates metadata of a single mined transaction.\n *\n * @class Tx\n */\nvar Tx = /** @class */ (function () {\n /**\n *\n * @param block Block number\n * @param txIndex Transaction index in block\n * @param txHash Transaction hash\n * @param timestamp Block timestamp\n * @param success Whether transaction was successful\n */\n function Tx(block, txIndex, txHash, timestamp, success) {\n this.block = block;\n this.txIndex = txIndex;\n this.txHash = txHash;\n this.timestamp = timestamp;\n this.success = success;\n }\n return Tx;\n}());\nexports.Tx = Tx;\n/**\n * Represents a single Web3 transaction receipt Log entry\n *\n * @class Log\n * @todo Should be changed to type def instead\n */\nvar Log = /** @class */ (function () {\n function Log() {\n }\n return Log;\n}());\nexports.Log = Log;\n\n\n//# sourceURL=webpack://cic/./dist/common/tx.js?"); - -/***/ }), - -/***/ "./dist/const.js": -/*!***********************!*\ - !*** ./dist/const.js ***! - \***********************/ -/*! flagged exports */ -/*! export __esModule [provided] [no usage info] [missing usage info prevents renaming] */ -/*! export zeroAddress [provided] [no usage info] [missing usage info prevents renaming] */ -/*! export zeroContent [provided] [no usage info] [missing usage info prevents renaming] */ -/*! other exports [not provided] [no usage info] */ -/*! runtime requirements: __webpack_exports__ */ -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.zeroAddress = exports.zeroContent = void 0;\nvar zeroContent = '0x0000000000000000000000000000000000000000000000000000000000000000';\nexports.zeroContent = zeroContent;\nvar zeroAddress = '0x0000000000000000000000000000000000000000';\nexports.zeroAddress = zeroAddress;\n\n\n//# sourceURL=webpack://cic/./dist/const.js?"); - -/***/ }), - -/***/ "./dist/crypto.js": -/*!************************!*\ - !*** ./dist/crypto.js ***! - \************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: top-level-this-exports, __webpack_exports__, __webpack_require__ */ -/*! CommonJS bailout: this is used directly at 2:23-27 */ -/*! CommonJS bailout: this is used directly at 9:26-30 */ -/*! CommonJS bailout: this is used directly at 14:20-24 */ -/*! CommonJS bailout: this is used directly at 21:17-21 */ -/*! CommonJS bailout: this is used directly at 30:19-23 */ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.subtle = void 0;\nvar crypto = __importStar(__webpack_require__(/*! crypto */ \"?8465\"));\nvar _algs = {\n 'SHA-256': 'sha256',\n};\nfunction cryptoWrapper() {\n}\ncryptoWrapper.prototype.digest = function (s, d) {\n return __awaiter(this, void 0, void 0, function () {\n var h;\n return __generator(this, function (_a) {\n h = crypto.createHash(_algs[s]);\n h.update(d);\n return [2 /*return*/, h.digest()];\n });\n });\n};\nvar subtle = undefined;\nexports.subtle = subtle;\nif (typeof window !== 'undefined') {\n exports.subtle = subtle = window.crypto.subtle;\n}\nelse {\n exports.subtle = subtle = new cryptoWrapper();\n}\n\n\n//# sourceURL=webpack://cic/./dist/crypto.js?"); - -/***/ }), - -/***/ "./dist/digest.js": -/*!************************!*\ - !*** ./dist/digest.js ***! - \************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: top-level-this-exports, __webpack_exports__, __webpack_require__ */ -/*! CommonJS bailout: this is used directly at 2:23-27 */ -/*! CommonJS bailout: this is used directly at 9:26-30 */ -/*! CommonJS bailout: this is used directly at 14:20-24 */ -/*! CommonJS bailout: this is used directly at 21:17-21 */ -/*! CommonJS bailout: this is used directly at 30:19-23 */ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.addressToBytes = exports.bytesToHex = exports.toAddressKey = exports.toKey = void 0;\nvar crypto = __importStar(__webpack_require__(/*! ./crypto */ \"./dist/crypto.js\"));\nfunction stringToBytes(s) {\n var a = new Uint8Array(20);\n var j = 2;\n for (var i = 0; i < a.byteLength; i++) {\n var n = parseInt(s.substring(j, j + 2), 16);\n a[i] = n;\n j += 2;\n }\n return a;\n}\nfunction bytesToHex(a) {\n var s = '';\n for (var i = 0; i < a.byteLength; i++) {\n var h = '00' + a[i].toString(16);\n s += h.slice(-2);\n }\n return s;\n}\nexports.bytesToHex = bytesToHex;\nfunction mergeKey(a, s) {\n return __awaiter(this, void 0, void 0, function () {\n var y, i, i, z;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n y = new Uint8Array(a.byteLength + s.byteLength);\n for (i = 0; i < a.byteLength; i++) {\n y[i] = a[i];\n }\n for (i = 0; i < s.byteLength; i++) {\n y[a.byteLength + i] = s[i];\n }\n return [4 /*yield*/, crypto.subtle.digest('SHA-256', y)];\n case 1:\n z = _a.sent();\n return [2 /*return*/, bytesToHex(new Uint8Array(z))];\n }\n });\n });\n}\nfunction toKey(v, salt) {\n return __awaiter(this, void 0, void 0, function () {\n var a, s;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n a = stringToBytes(v);\n s = new TextEncoder().encode(salt);\n return [4 /*yield*/, mergeKey(a, s)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n}\nexports.toKey = toKey;\nfunction toAddressKey(zeroExHex, salt) {\n return __awaiter(this, void 0, void 0, function () {\n var a, s;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n a = addressToBytes(zeroExHex);\n s = new TextEncoder().encode(salt);\n return [4 /*yield*/, mergeKey(a, s)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n}\nexports.toAddressKey = toAddressKey;\nvar re_addrHex = /^0[xX][a-fA-F0-9]{40}$/;\nfunction addressToBytes(s) {\n if (!s.match(re_addrHex)) {\n throw 'invalid address hex';\n }\n return stringToBytes(s);\n}\nexports.addressToBytes = addressToBytes;\n\n\n//# sourceURL=webpack://cic/./dist/digest.js?"); - -/***/ }), - -/***/ "./dist/helper.js": -/*!************************!*\ - !*** ./dist/helper.js ***! - \************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: top-level-this-exports, __webpack_exports__, __webpack_require__ */ -/*! CommonJS bailout: this is used directly at 7:17-21 */ -/*! CommonJS bailout: this is used directly at 16:19-23 */ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -eval("\n/**\n * Provides processing of Ethereum transaction receipts relevant for the CIC network.\n *\n * @module helper\n */\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TokenDeclarationHelper = exports.TransactionHelper = exports.DeclaratorHelper = void 0;\nvar erc20_1 = __webpack_require__(/*! ./common/erc20 */ \"./dist/common/erc20.js\");\nvar convert_1 = __webpack_require__(/*! ./bancor/convert */ \"./dist/bancor/convert.js\");\nvar solidity_1 = __webpack_require__(/*! ./solidity */ \"./dist/solidity.js\");\nvar const_1 = __webpack_require__(/*! ./const */ \"./dist/const.js\");\n/**\n * Reduced, concrete view of a transaction receipt.\n *\n * @todo Is there a way of importing the web3 type instead?\n */\nvar Receipt = /** @class */ (function () {\n function Receipt() {\n }\n return Receipt;\n}());\n/**\n * Receipt processor within context of a given registry.\n *\n */\nvar TransactionHelper = /** @class */ (function () {\n /**\n *\n * @param registry The registry context to use\n */\n function TransactionHelper(w3, registry) {\n this.w3 = w3;\n this.registry = registry;\n this.ontransfer = function (t) {\n console.debug('transfer ', t);\n };\n this.onconversion = function (c) {\n console.debug('convert ', c);\n };\n }\n /**\n * Processes a single receipt to find conversion and token transfer events.\n *\n * If a transfer is found, ontransfer callback will be called with a Transfer instance.\n * If a conversion is found, onconvsrsion callback will be called with a Conversion instance.\n *\n * @param r A Web3 transaction receipt.\n * @todo The from-amount of convert is currently wrong, but be retrieved from the initial transfer log entry instead.\n */\n TransactionHelper.prototype.processReceipt = function (r) {\n return __awaiter(this, void 0, void 0, function () {\n var self, logs, convert_log, token_txs, i, contractAddress, t, e_1, d, t, e_2, e_3, conversion, _i, token_txs_1, a, transfer;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n self = this;\n logs = r.logs;\n convert_log = undefined;\n token_txs = [];\n i = 0;\n _a.label = 1;\n case 1:\n if (!(i < logs.length)) return [3 /*break*/, 15];\n contractAddress = logs[i].address;\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 14]);\n return [4 /*yield*/, this.registry.getToken(contractAddress)];\n case 3:\n t = _a.sent();\n token_txs.push([r.status, t, logs[i]]);\n return [3 /*break*/, 14];\n case 4:\n e_1 = _a.sent();\n _a.label = 5;\n case 5:\n _a.trys.push([5, 8, , 13]);\n return [4 /*yield*/, this.registry.declaratorHelper.getTrustedTokenDeclaration('AddressDeclarator', contractAddress)];\n case 6:\n d = _a.sent();\n console.debug('trust record for ' + contractAddress + ' found', d);\n return [4 /*yield*/, this.registry.addToken(contractAddress)];\n case 7:\n t = _a.sent();\n token_txs.push([r.status, t, logs[i]]);\n return [3 /*break*/, 13];\n case 8:\n e_2 = _a.sent();\n _a.label = 9;\n case 9:\n _a.trys.push([9, 11, , 12]);\n return [4 /*yield*/, this.registry.getContract(contractAddress)];\n case 10:\n _a.sent();\n convert_log = logs[i];\n return [3 /*break*/, 15];\n case 11:\n e_3 = _a.sent();\n return [3 /*break*/, 14];\n case 12: return [3 /*break*/, 13];\n case 13: return [3 /*break*/, 14];\n case 14:\n i++;\n return [3 /*break*/, 1];\n case 15:\n if (!(convert_log !== undefined)) return [3 /*break*/, 17];\n return [4 /*yield*/, convert_1.Conversion.processLog(this.w3, this.registry, r.status, convert_log)];\n case 16:\n conversion = _a.sent();\n if (conversion !== undefined) {\n this.onconversion(conversion);\n }\n return [3 /*break*/, 21];\n case 17:\n _i = 0, token_txs_1 = token_txs;\n _a.label = 18;\n case 18:\n if (!(_i < token_txs_1.length)) return [3 /*break*/, 21];\n a = token_txs_1[_i];\n return [4 /*yield*/, erc20_1.Transfer.processLog(this.w3, a[0], a[1], a[2])];\n case 19:\n transfer = _a.sent();\n if (transfer !== undefined) {\n this.ontransfer(transfer);\n }\n _a.label = 20;\n case 20:\n _i++;\n return [3 /*break*/, 18];\n case 21: return [2 /*return*/];\n }\n });\n });\n };\n return TransactionHelper;\n}());\nexports.TransactionHelper = TransactionHelper;\n/**\n * Token query within the context of a registry.\n */\nvar TokenDeclarationHelper = /** @class */ (function () {\n /**\n *\n * @param w3\n * @param registry The registry context to use.\n */\n function TokenDeclarationHelper(w3, registry) {\n this.registry = registry;\n this.w3 = w3;\n }\n /**\n * Check if a token fits the ERC20 standard.\n *\n * @param tokenAddress The address of the token to be checked.\n */\n TokenDeclarationHelper.prototype.assertERC20TokenType = function (tokenAddress) {\n return __awaiter(this, void 0, void 0, function () {\n var erc20Abi, tokenContract, tokenSymbol, e_4;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.registry.getAbi('ERC20')];\n case 1:\n erc20Abi = _a.sent();\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n tokenContract = new this.w3.eth.Contract(erc20Abi, tokenAddress);\n return [4 /*yield*/, tokenContract.methods.symbol().call()];\n case 3:\n tokenSymbol = _a.sent();\n if (tokenSymbol !== undefined) {\n return [2 /*return*/, true];\n }\n return [3 /*break*/, 5];\n case 4:\n e_4 = _a.sent();\n console.log('contract ' + tokenAddress + ' is not an ERC20 token');\n return [3 /*break*/, 5];\n case 5: return [2 /*return*/, false];\n }\n });\n });\n };\n return TokenDeclarationHelper;\n}());\nexports.TokenDeclarationHelper = TokenDeclarationHelper;\n/**\n * Declarator query within the context of a registry.\n */\nvar DeclaratorHelper = /** @class */ (function () {\n /**\n *\n * @param w3\n * @param registry The registry context to use.\n */\n function DeclaratorHelper(w3, registry) {\n this.registry = registry;\n this.trusts = [];\n this.tokenHelper = new TokenDeclarationHelper(w3, registry);\n }\n /**\n * Add an address to list of declarators to trust.\n *\n * @param address The address to be added to the trust list\n */\n DeclaratorHelper.prototype.addTrust = function (address) {\n this.trusts.push(address);\n };\n /**\n * Check for trust records of a token\n *\n * if there are no trust records, an error will be thrown.\n *\n * @param tokenRegistryContractName The name of the token in the token registry.\n * @param tokenAddress The address of the contract used to deploy the token.\n * @param checkInterface A boolean on whether to to check the interface.\n */\n DeclaratorHelper.prototype.getTrustedTokenDeclaration = function (tokenRegistryContractName, tokenAddress, checkInterface) {\n if (checkInterface === void 0) { checkInterface = false; }\n return __awaiter(this, void 0, void 0, function () {\n var i, isERC20, _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n i = 0;\n _b.label = 1;\n case 1:\n if (!(i < this.trusts.length)) return [3 /*break*/, 7];\n console.debug('checking for trust record by ' + this.trusts[i] + ' for token ' + tokenAddress);\n _b.label = 2;\n case 2:\n _b.trys.push([2, 5, , 6]);\n return [4 /*yield*/, this.tokenHelper.assertERC20TokenType(tokenAddress)];\n case 3:\n isERC20 = _b.sent();\n if (isERC20) {\n console.log('contract ' + tokenAddress + ' is an ERC20 token');\n }\n return [4 /*yield*/, this.getTokenDeclaration(tokenRegistryContractName, this.trusts[i], tokenAddress, checkInterface)];\n case 4: return [2 /*return*/, _b.sent()];\n case 5:\n _a = _b.sent();\n return [3 /*break*/, 6];\n case 6:\n i++;\n return [3 /*break*/, 1];\n case 7: throw new Error('no trusted records for token ' + tokenAddress);\n }\n });\n });\n };\n /**\n * Check for trust records for a token by a declarator.\n *\n * @param tokenRegistryContractName The name of the token in the token registry.\n * @param declarator The address of the declarator used to check for trust.\n * @param tokenAddress The address of the contract used to deploy the token.\n * @param checkInterface A boolean on whether to to check the interface.\n */\n DeclaratorHelper.prototype.getTokenDeclaration = function (tokenRegistryContractName, declarator, tokenAddress, checkInterface) {\n if (checkInterface === void 0) { checkInterface = false; }\n return __awaiter(this, void 0, void 0, function () {\n var tokenRegistryContract, declarationParts;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.registry.getContractByName(tokenRegistryContractName, 'AddressDeclarator', [solidity_1.interfaceCodes.Declarator])];\n case 1:\n tokenRegistryContract = _a.sent();\n return [4 /*yield*/, tokenRegistryContract.methods.declaration(declarator, tokenAddress).call()];\n case 2:\n declarationParts = _a.sent();\n if (declarationParts.length == 1 && declarationParts[0] == const_1.zeroAddress) {\n throw new Error('no declarations found for declarator \"' + declarator + '\" address \"' + tokenAddress + '\"');\n }\n return [2 /*return*/, declarationParts];\n }\n });\n });\n };\n return DeclaratorHelper;\n}());\nexports.DeclaratorHelper = DeclaratorHelper;\n\n\n//# sourceURL=webpack://cic/./dist/helper.js?"); - -/***/ }), - -/***/ "./dist/index.js": -/*!***********************!*\ - !*** ./dist/index.js ***! - \***********************/ -/*! flagged exports */ -/*! export CICRegistry [provided] [maybe used in index (runtime-defined)] [usage prevents renaming] */ -/*! export TransactionHelper [provided] [maybe used in index (runtime-defined)] [usage prevents renaming] */ -/*! export __esModule [provided] [maybe used in index (runtime-defined)] [usage prevents renaming] */ -/*! other exports [not provided] [maybe used in index (runtime-defined)] */ -/*! runtime requirements: __webpack_exports__, __webpack_require__ */ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TransactionHelper = exports.CICRegistry = void 0;\nvar registry_1 = __webpack_require__(/*! ./registry */ \"./dist/registry.js\");\nObject.defineProperty(exports, \"CICRegistry\", ({ enumerable: true, get: function () { return registry_1.CICRegistry; } }));\nvar helper_1 = __webpack_require__(/*! ./helper */ \"./dist/helper.js\");\nObject.defineProperty(exports, \"TransactionHelper\", ({ enumerable: true, get: function () { return helper_1.TransactionHelper; } }));\n\n\n//# sourceURL=webpack://cic/./dist/index.js?"); - -/***/ }), - -/***/ "./dist/registry.js": -/*!**************************!*\ - !*** ./dist/registry.js ***! - \**************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: top-level-this-exports, __webpack_exports__, __webpack_require__ */ -/*! CommonJS bailout: this is used directly at 2:17-21 */ -/*! CommonJS bailout: this is used directly at 11:19-23 */ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.toRegistryKey = exports.toContractKey = exports.CICRegistry = void 0;\nvar helper_1 = __webpack_require__(/*! ./helper */ \"./dist/helper.js\");\nvar LRU = __webpack_require__(/*! lru-cache */ \"./node_modules/lru-cache/index.js\");\nvar solidity_1 = __webpack_require__(/*! ./solidity */ \"./dist/solidity.js\");\nvar const_1 = __webpack_require__(/*! ./const */ \"./dist/const.js\");\nvar crypto_1 = __webpack_require__(/*! ./crypto */ \"./dist/crypto.js\");\nvar digest_1 = __webpack_require__(/*! ./digest */ \"./dist/digest.js\");\nvar KV = /** @class */ (function () {\n function KV() {\n this.store = {};\n }\n KV.prototype.put = function (k, v) {\n this.store[k] = v;\n };\n KV.prototype.get = function (k) {\n return this.store[k];\n };\n KV.prototype.peek = function (k) {\n return this.store[k];\n };\n return KV;\n}());\nvar CICRegistry = /** @class */ (function () {\n function CICRegistry(w3, address, fileGetter, paths) {\n this.w3 = w3;\n this.address = address;\n this.store = new KV();\n this.paths = paths;\n this.fileGetter = fileGetter;\n this.declaratorHelper = new helper_1.DeclaratorHelper(w3, this);\n }\n CICRegistry.prototype.load = function () {\n return __awaiter(this, void 0, void 0, function () {\n var registryAbi, contractIdHex, contractId, confirmedContractAddress;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, solidity_1.abi(this.fileGetter, 'CICRegistry', this.paths)];\n case 1:\n registryAbi = _a.sent();\n this.contract = new this.w3.eth.Contract(registryAbi, this.address);\n contractIdHex = this.w3.utils.toHex('CICRegistry');\n contractId = this.w3.eth.abi.encodeParameter('bytes32', contractIdHex);\n return [4 /*yield*/, this.contract.methods.addressOf(contractId).call()];\n case 2:\n confirmedContractAddress = _a.sent();\n if (this.address != confirmedContractAddress) {\n throw new Error('cic registry contract entry does not match its own address');\n }\n if (this.onload !== undefined) {\n this.onload(this.address);\n }\n return [2 /*return*/];\n }\n });\n });\n };\n CICRegistry.prototype.getAbi = function (abiName) {\n return __awaiter(this, void 0, void 0, function () {\n var abiObject;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n abiObject = this.store.get(toAbiKey(abiName));\n if (!(abiObject === undefined)) return [3 /*break*/, 2];\n return [4 /*yield*/, solidity_1.abi(this.fileGetter, abiName, this.paths)];\n case 1:\n abiObject = _a.sent();\n _a.label = 2;\n case 2: return [2 /*return*/, abiObject];\n }\n });\n });\n };\n CICRegistry.prototype.addToken = function (address, requireTrust) {\n if (requireTrust === void 0) { requireTrust = false; }\n return __awaiter(this, void 0, void 0, function () {\n var erc20Abi, tokenContract, tokenSymbol;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (requireTrust) {\n throw new Error('trust check not implemented yet, sorry');\n }\n return [4 /*yield*/, this.getAbi('ERC20')];\n case 1:\n erc20Abi = _a.sent();\n tokenContract = new this.w3.eth.Contract(erc20Abi, address);\n return [4 /*yield*/, tokenContract.methods.symbol().call()];\n case 2:\n tokenSymbol = _a.sent();\n if (tokenSymbol === undefined) {\n throw new Error('attempted to add token contract ' + address + ' which is not an ERC20 token');\n }\n this.store.put(toTokenKey(tokenSymbol), tokenContract);\n this.store.put(address, tokenContract);\n return [2 /*return*/, tokenContract];\n }\n });\n });\n };\n CICRegistry.prototype.getContract = function (address) {\n return __awaiter(this, void 0, void 0, function () {\n var contract;\n return __generator(this, function (_a) {\n contract = this.store.get(address);\n if (contract === undefined) {\n throw new Error('unknown contract ' + address);\n }\n return [2 /*return*/, contract];\n });\n });\n };\n CICRegistry.prototype.getToken = function (address) {\n return __awaiter(this, void 0, void 0, function () {\n var tokenContract, tokenSymbol;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getContract(address)];\n case 1:\n tokenContract = _a.sent();\n return [4 /*yield*/, tokenContract.methods.symbol().call()];\n case 2:\n tokenSymbol = _a.sent();\n if (tokenSymbol === undefined) {\n throw new Error('contract ' + address + ' is not an ERC20 token');\n }\n return [2 /*return*/, tokenContract];\n }\n });\n });\n };\n CICRegistry.prototype.getContractByName = function (contractName, abiName, requireInterfaces) {\n return __awaiter(this, void 0, void 0, function () {\n var contractKey, contract, contractAddress, contractAbi;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n contractKey = toContractKey(contractName);\n contract = this.store.get(contractKey);\n if (!(contract === undefined)) return [3 /*break*/, 3];\n return [4 /*yield*/, this.getContractAddressByName(contractName, abiName, requireInterfaces)];\n case 1:\n contractAddress = _a.sent();\n if (abiName === undefined) {\n abiName = contractName;\n }\n return [4 /*yield*/, this.getAbi(abiName)];\n case 2:\n contractAbi = _a.sent();\n contract = new this.w3.eth.Contract(contractAbi, contractAddress);\n this.store.put(contractKey, contract);\n this.store.put(contractAddress, contract);\n _a.label = 3;\n case 3: return [2 /*return*/, contract];\n }\n });\n });\n };\n CICRegistry.prototype.getContractAddressByName = function (contractName, abiName, requireInterfaces) {\n return __awaiter(this, void 0, void 0, function () {\n var contract_id_hex, contract_id, contractAddress;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n contract_id_hex = this.w3.utils.toHex(contractName);\n contract_id = this.w3.eth.abi.encodeParameter('bytes32', contract_id_hex);\n return [4 /*yield*/, this.contract.methods.addressOf(contract_id).call()];\n case 1:\n contractAddress = _a.sent();\n if (contractAddress == const_1.zeroAddress) {\n throw new Error('unknown contract ' + contractName + ' (' + contract_id_hex + ')');\n }\n return [2 /*return*/, contractAddress];\n }\n });\n });\n };\n CICRegistry.prototype.getFungibleToken = function (tokenAddress, checkInterface) {\n if (checkInterface === void 0) { checkInterface = false; }\n return __awaiter(this, void 0, void 0, function () {\n var tokenAbi, tokenContract, tokenSymbol;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getAbi('ERC20')];\n case 1:\n tokenAbi = _a.sent();\n tokenContract = new this.w3.eth.Contract(tokenAbi, tokenAddress);\n if (checkInterface) {\n if (!tokenContract.methods.supportsInterface('ERC20')) {\n throw 'token does not declare ERC20 interface support';\n }\n }\n return [4 /*yield*/, tokenContract.methods.symbol().call()];\n case 2:\n tokenSymbol = _a.sent();\n this.store.put('token:' + tokenSymbol, tokenContract);\n this.store.put(tokenAddress, tokenContract);\n return [2 /*return*/, tokenContract];\n }\n });\n });\n };\n CICRegistry.prototype.getTokenBySymbol = function (tokenRegistryContractName, symbol, checkInterface) {\n if (checkInterface === void 0) { checkInterface = false; }\n return __awaiter(this, void 0, void 0, function () {\n var tokenRegistryContract, symbolId, tokenAddress, token;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.getContractByName(tokenRegistryContractName, 'Registry', [solidity_1.interfaceCodes.Registry])];\n case 1:\n tokenRegistryContract = _a.sent();\n return [4 /*yield*/, toRegistryKey(symbol)];\n case 2:\n symbolId = _a.sent();\n return [4 /*yield*/, tokenRegistryContract.methods.addressOf(symbolId).call()];\n case 3:\n tokenAddress = _a.sent();\n if (tokenAddress === const_1.zeroAddress) {\n throw 'unknown token \"' + symbol + '\" using registry \"' + tokenRegistryContractName + '\"';\n }\n token = this.getFungibleToken(tokenAddress, checkInterface);\n return [2 /*return*/, token];\n }\n });\n });\n };\n return CICRegistry;\n}());\nexports.CICRegistry = CICRegistry;\nfunction toRegistryKey(s) {\n return __awaiter(this, void 0, void 0, function () {\n var sDigest, sId;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, crypto_1.subtle.digest('SHA-256', s)];\n case 1:\n sDigest = _a.sent();\n sId = '0x' + digest_1.bytesToHex(sDigest);\n return [2 /*return*/, sId];\n }\n });\n });\n}\nexports.toRegistryKey = toRegistryKey;\nfunction toContractKey(s) {\n return 'contract:' + s;\n}\nexports.toContractKey = toContractKey;\nfunction toAbiKey(s) {\n return 'abi:' + s;\n}\nfunction toTokenKey(s) {\n return 'token:' + s;\n}\n\n\n//# sourceURL=webpack://cic/./dist/registry.js?"); - -/***/ }), - -/***/ "./dist/solidity.js": -/*!**************************!*\ - !*** ./dist/solidity.js ***! - \**************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: top-level-this-exports, __webpack_exports__, __webpack_require__ */ -/*! CommonJS bailout: this is used directly at 2:17-21 */ -/*! CommonJS bailout: this is used directly at 11:19-23 */ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.interfaceCodes = exports.bin = exports.abi = void 0;\nvar path = __webpack_require__(/*! path */ \"./node_modules/path-browserify/index.js\");\nvar interfaceCodes = {\n ERC20: '1da30d20',\n Registry: '325d15e2',\n Declarator: '00000000',\n};\nexports.interfaceCodes = interfaceCodes;\nfunction abi(fileGetter, interface_name, paths) {\n return __awaiter(this, void 0, void 0, function () {\n var d;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, findInPath(fileGetter, interface_name, 'json', paths)];\n case 1:\n d = _a.sent();\n return [2 /*return*/, JSON.parse(d)];\n }\n });\n });\n}\nexports.abi = abi;\nfunction bin(fileGetter, interface_name, paths) {\n return __awaiter(this, void 0, void 0, function () {\n var d;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, findInPath(fileGetter, interface_name, 'bin', paths)];\n case 1:\n d = _a.sent();\n return [2 /*return*/, new TextDecoder('utf-8').decode(d)];\n }\n });\n });\n}\nexports.bin = bin;\nfunction findInPath(fileGetter, stem, extension, paths) {\n return __awaiter(this, void 0, void 0, function () {\n var filename, found, e_1, i, filePath, d, e_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n filename = stem + '.' + extension;\n found = false;\n if (!(paths === undefined)) return [3 /*break*/, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, fileGetter.get(filename)];\n case 2: return [2 /*return*/, _a.sent()];\n case 3:\n e_1 = _a.sent();\n console.error(e_1);\n return [3 /*break*/, 4];\n case 4: return [3 /*break*/, 11];\n case 5:\n i = 0;\n _a.label = 6;\n case 6:\n if (!(i < paths.length)) return [3 /*break*/, 11];\n filePath = path.join(paths[i], filename);\n d = void 0;\n _a.label = 7;\n case 7:\n _a.trys.push([7, 9, , 10]);\n return [4 /*yield*/, fileGetter.get(filePath)];\n case 8: return [2 /*return*/, _a.sent()];\n case 9:\n e_2 = _a.sent();\n console.error(e_2);\n return [3 /*break*/, 10];\n case 10:\n i++;\n return [3 /*break*/, 6];\n case 11:\n if (!found) {\n throw new Error('file ' + filename + ' not found in data path');\n }\n return [2 /*return*/];\n }\n });\n });\n}\n\n\n//# sourceURL=webpack://cic/./dist/solidity.js?"); - -/***/ }), - -/***/ "./node_modules/lru-cache/index.js": -/*!*****************************************!*\ - !*** ./node_modules/lru-cache/index.js ***! - \*****************************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: module, __webpack_require__ */ -/*! CommonJS bailout: module.exports is used directly at 334:0-14 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -eval("\n\n// A linked list to keep track of recently-used-ness\nconst Yallist = __webpack_require__(/*! yallist */ \"./node_modules/lru-cache/node_modules/yallist/yallist.js\")\n\nconst MAX = Symbol('max')\nconst LENGTH = Symbol('length')\nconst LENGTH_CALCULATOR = Symbol('lengthCalculator')\nconst ALLOW_STALE = Symbol('allowStale')\nconst MAX_AGE = Symbol('maxAge')\nconst DISPOSE = Symbol('dispose')\nconst NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')\nconst LRU_LIST = Symbol('lruList')\nconst CACHE = Symbol('cache')\nconst UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')\n\nconst naiveLength = () => 1\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nclass LRUCache {\n constructor (options) {\n if (typeof options === 'number')\n options = { max: options }\n\n if (!options)\n options = {}\n\n if (options.max && (typeof options.max !== 'number' || options.max < 0))\n throw new TypeError('max must be a non-negative number')\n // Kind of weird to have a default max of Infinity, but oh well.\n const max = this[MAX] = options.max || Infinity\n\n const lc = options.length || naiveLength\n this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc\n this[ALLOW_STALE] = options.stale || false\n if (options.maxAge && typeof options.maxAge !== 'number')\n throw new TypeError('maxAge must be a number')\n this[MAX_AGE] = options.maxAge || 0\n this[DISPOSE] = options.dispose\n this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false\n this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false\n this.reset()\n }\n\n // resize the cache when the max changes.\n set max (mL) {\n if (typeof mL !== 'number' || mL < 0)\n throw new TypeError('max must be a non-negative number')\n\n this[MAX] = mL || Infinity\n trim(this)\n }\n get max () {\n return this[MAX]\n }\n\n set allowStale (allowStale) {\n this[ALLOW_STALE] = !!allowStale\n }\n get allowStale () {\n return this[ALLOW_STALE]\n }\n\n set maxAge (mA) {\n if (typeof mA !== 'number')\n throw new TypeError('maxAge must be a non-negative number')\n\n this[MAX_AGE] = mA\n trim(this)\n }\n get maxAge () {\n return this[MAX_AGE]\n }\n\n // resize the cache when the lengthCalculator changes.\n set lengthCalculator (lC) {\n if (typeof lC !== 'function')\n lC = naiveLength\n\n if (lC !== this[LENGTH_CALCULATOR]) {\n this[LENGTH_CALCULATOR] = lC\n this[LENGTH] = 0\n this[LRU_LIST].forEach(hit => {\n hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)\n this[LENGTH] += hit.length\n })\n }\n trim(this)\n }\n get lengthCalculator () { return this[LENGTH_CALCULATOR] }\n\n get length () { return this[LENGTH] }\n get itemCount () { return this[LRU_LIST].length }\n\n rforEach (fn, thisp) {\n thisp = thisp || this\n for (let walker = this[LRU_LIST].tail; walker !== null;) {\n const prev = walker.prev\n forEachStep(this, fn, walker, thisp)\n walker = prev\n }\n }\n\n forEach (fn, thisp) {\n thisp = thisp || this\n for (let walker = this[LRU_LIST].head; walker !== null;) {\n const next = walker.next\n forEachStep(this, fn, walker, thisp)\n walker = next\n }\n }\n\n keys () {\n return this[LRU_LIST].toArray().map(k => k.key)\n }\n\n values () {\n return this[LRU_LIST].toArray().map(k => k.value)\n }\n\n reset () {\n if (this[DISPOSE] &&\n this[LRU_LIST] &&\n this[LRU_LIST].length) {\n this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))\n }\n\n this[CACHE] = new Map() // hash of items by key\n this[LRU_LIST] = new Yallist() // list of items in order of use recency\n this[LENGTH] = 0 // length of items in the list\n }\n\n dump () {\n return this[LRU_LIST].map(hit =>\n isStale(this, hit) ? false : {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }).toArray().filter(h => h)\n }\n\n dumpLru () {\n return this[LRU_LIST]\n }\n\n set (key, value, maxAge) {\n maxAge = maxAge || this[MAX_AGE]\n\n if (maxAge && typeof maxAge !== 'number')\n throw new TypeError('maxAge must be a number')\n\n const now = maxAge ? Date.now() : 0\n const len = this[LENGTH_CALCULATOR](value, key)\n\n if (this[CACHE].has(key)) {\n if (len > this[MAX]) {\n del(this, this[CACHE].get(key))\n return false\n }\n\n const node = this[CACHE].get(key)\n const item = node.value\n\n // dispose of the old one before overwriting\n // split out into 2 ifs for better coverage tracking\n if (this[DISPOSE]) {\n if (!this[NO_DISPOSE_ON_SET])\n this[DISPOSE](key, item.value)\n }\n\n item.now = now\n item.maxAge = maxAge\n item.value = value\n this[LENGTH] += len - item.length\n item.length = len\n this.get(key)\n trim(this)\n return true\n }\n\n const hit = new Entry(key, value, len, now, maxAge)\n\n // oversized objects fall out of cache automatically.\n if (hit.length > this[MAX]) {\n if (this[DISPOSE])\n this[DISPOSE](key, value)\n\n return false\n }\n\n this[LENGTH] += hit.length\n this[LRU_LIST].unshift(hit)\n this[CACHE].set(key, this[LRU_LIST].head)\n trim(this)\n return true\n }\n\n has (key) {\n if (!this[CACHE].has(key)) return false\n const hit = this[CACHE].get(key).value\n return !isStale(this, hit)\n }\n\n get (key) {\n return get(this, key, true)\n }\n\n peek (key) {\n return get(this, key, false)\n }\n\n pop () {\n const node = this[LRU_LIST].tail\n if (!node)\n return null\n\n del(this, node)\n return node.value\n }\n\n del (key) {\n del(this, this[CACHE].get(key))\n }\n\n load (arr) {\n // reset the cache\n this.reset()\n\n const now = Date.now()\n // A previous serialized cache has the most recent items first\n for (let l = arr.length - 1; l >= 0; l--) {\n const hit = arr[l]\n const expiresAt = hit.e || 0\n if (expiresAt === 0)\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v)\n else {\n const maxAge = expiresAt - now\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge)\n }\n }\n }\n }\n\n prune () {\n this[CACHE].forEach((value, key) => get(this, key, false))\n }\n}\n\nconst get = (self, key, doUse) => {\n const node = self[CACHE].get(key)\n if (node) {\n const hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!self[ALLOW_STALE])\n return undefined\n } else {\n if (doUse) {\n if (self[UPDATE_AGE_ON_GET])\n node.value.now = Date.now()\n self[LRU_LIST].unshiftNode(node)\n }\n }\n return hit.value\n }\n}\n\nconst isStale = (self, hit) => {\n if (!hit || (!hit.maxAge && !self[MAX_AGE]))\n return false\n\n const diff = Date.now() - hit.now\n return hit.maxAge ? diff > hit.maxAge\n : self[MAX_AGE] && (diff > self[MAX_AGE])\n}\n\nconst trim = self => {\n if (self[LENGTH] > self[MAX]) {\n for (let walker = self[LRU_LIST].tail;\n self[LENGTH] > self[MAX] && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n const prev = walker.prev\n del(self, walker)\n walker = prev\n }\n }\n}\n\nconst del = (self, node) => {\n if (node) {\n const hit = node.value\n if (self[DISPOSE])\n self[DISPOSE](hit.key, hit.value)\n\n self[LENGTH] -= hit.length\n self[CACHE].delete(hit.key)\n self[LRU_LIST].removeNode(node)\n }\n}\n\nclass Entry {\n constructor (key, value, length, now, maxAge) {\n this.key = key\n this.value = value\n this.length = length\n this.now = now\n this.maxAge = maxAge || 0\n }\n}\n\nconst forEachStep = (self, fn, node, thisp) => {\n let hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!self[ALLOW_STALE])\n hit = undefined\n }\n if (hit)\n fn.call(thisp, hit.value, hit.key, self)\n}\n\nmodule.exports = LRUCache\n\n\n//# sourceURL=webpack://cic/./node_modules/lru-cache/index.js?"); - -/***/ }), - -/***/ "./node_modules/lru-cache/node_modules/yallist/iterator.js": -/*!*****************************************************************!*\ - !*** ./node_modules/lru-cache/node_modules/yallist/iterator.js ***! - \*****************************************************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: module */ -/*! CommonJS bailout: module.exports is used directly at 2:0-14 */ -/***/ ((module) => { - -"use strict"; -eval("\nmodule.exports = function (Yallist) {\n Yallist.prototype[Symbol.iterator] = function* () {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value\n }\n }\n}\n\n\n//# sourceURL=webpack://cic/./node_modules/lru-cache/node_modules/yallist/iterator.js?"); - -/***/ }), - -/***/ "./node_modules/lru-cache/node_modules/yallist/yallist.js": -/*!****************************************************************!*\ - !*** ./node_modules/lru-cache/node_modules/yallist/yallist.js ***! - \****************************************************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: module, __webpack_require__ */ -/*! CommonJS bailout: module.exports is used directly at 2:0-14 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -eval("\nmodule.exports = Yallist\n\nYallist.Node = Node\nYallist.create = Yallist\n\nfunction Yallist (list) {\n var self = this\n if (!(self instanceof Yallist)) {\n self = new Yallist()\n }\n\n self.tail = null\n self.head = null\n self.length = 0\n\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item)\n })\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i])\n }\n }\n\n return self\n}\n\nYallist.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list')\n }\n\n var next = node.next\n var prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n node.list.length--\n node.next = null\n node.prev = null\n node.list = null\n\n return next\n}\n\nYallist.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length++\n}\n\nYallist.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length++\n}\n\nYallist.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.pop = function () {\n if (!this.tail) {\n return undefined\n }\n\n var res = this.tail.value\n this.tail = this.tail.prev\n if (this.tail) {\n this.tail.next = null\n } else {\n this.head = null\n }\n this.length--\n return res\n}\n\nYallist.prototype.shift = function () {\n if (!this.head) {\n return undefined\n }\n\n var res = this.head.value\n this.head = this.head.next\n if (this.head) {\n this.head.prev = null\n } else {\n this.tail = null\n }\n this.length--\n return res\n}\n\nYallist.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n}\n\nYallist.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n}\n\nYallist.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.map = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.head; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n}\n\nYallist.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n}\n\nYallist.prototype.reduce = function (fn, initial) {\n var acc\n var walker = this.head\n if (arguments.length > 1) {\n acc = initial\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i)\n walker = walker.next\n }\n\n return acc\n}\n\nYallist.prototype.reduceReverse = function (fn, initial) {\n var acc\n var walker = this.tail\n if (arguments.length > 1) {\n acc = initial\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i)\n walker = walker.prev\n }\n\n return acc\n}\n\nYallist.prototype.toArray = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n}\n\nYallist.prototype.toArrayReverse = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n}\n\nYallist.prototype.slice = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.sliceReverse = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.splice = function (start, deleteCount, ...nodes) {\n if (start > this.length) {\n start = this.length - 1\n }\n if (start < 0) {\n start = this.length + start;\n }\n\n for (var i = 0, walker = this.head; walker !== null && i < start; i++) {\n walker = walker.next\n }\n\n var ret = []\n for (var i = 0; walker && i < deleteCount; i++) {\n ret.push(walker.value)\n walker = this.removeNode(walker)\n }\n if (walker === null) {\n walker = this.tail\n }\n\n if (walker !== this.head && walker !== this.tail) {\n walker = walker.prev\n }\n\n for (var i = 0; i < nodes.length; i++) {\n walker = insert(this, walker, nodes[i])\n }\n return ret;\n}\n\nYallist.prototype.reverse = function () {\n var head = this.head\n var tail = this.tail\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n}\n\nfunction insert (self, node, value) {\n var inserted = node === self.head ?\n new Node(value, null, node, self) :\n new Node(value, node, node.next, self)\n\n if (inserted.next === null) {\n self.tail = inserted\n }\n if (inserted.prev === null) {\n self.head = inserted\n }\n\n self.length++\n\n return inserted\n}\n\nfunction push (self, item) {\n self.tail = new Node(item, self.tail, null, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length++\n}\n\nfunction unshift (self, item) {\n self.head = new Node(item, null, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length++\n}\n\nfunction Node (value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list)\n }\n\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = null\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = null\n }\n}\n\ntry {\n // add if support for Symbol.iterator is present\n __webpack_require__(/*! ./iterator.js */ \"./node_modules/lru-cache/node_modules/yallist/iterator.js\")(Yallist)\n} catch (er) {}\n\n\n//# sourceURL=webpack://cic/./node_modules/lru-cache/node_modules/yallist/yallist.js?"); - -/***/ }), - -/***/ "./node_modules/path-browserify/index.js": -/*!***********************************************!*\ - !*** ./node_modules/path-browserify/index.js ***! - \***********************************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: module */ -/*! CommonJS bailout: module.exports is used directly at 529:0-14 */ -/***/ ((module) => { - -"use strict"; -eval("// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n\n\n//# sourceURL=webpack://cic/./node_modules/path-browserify/index.js?"); - -/***/ }), - -/***/ "?8465": -/*!************************!*\ - !*** crypto (ignored) ***! - \************************/ -/*! unknown exports (runtime-defined) */ -/*! runtime requirements: */ -/***/ (() => { - -eval("/* (ignored) */\n\n//# sourceURL=webpack://cic/crypto_(ignored)?"); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ // module exports must be returned from runtime so entry inlining is disabled -/******/ // startup -/******/ // Load entry module and return exports -/******/ return __webpack_require__("./dist/index.js"); -/******/ })() -; \ No newline at end of file diff --git a/src/assets/js/block-sync/sync.js b/src/assets/js/block-sync/sync.js index 91c6f04..eb17e2a 100644 --- a/src/assets/js/block-sync/sync.js +++ b/src/assets/js/block-sync/sync.js @@ -20,7 +20,6 @@ function sync_by_filter_block(block, count, buf, bloom_blocktx, result_callback) } function sync_by_filter(lo, hi, bloom_block, bloom_blocktx, tx_count_getter, result_callback) { - for (let i = lo; i <= hi; i++) { let a = new ArrayBuffer(8); let w = new DataView(a); @@ -33,7 +32,7 @@ function sync_by_filter(lo, hi, bloom_block, bloom_blocktx, tx_count_getter, res sync_by_filter_block(i, n, a, bloom_blocktx, result_callback); }).catch((e) => { console.error('get count fail', e); - });; + }); } }); } diff --git a/src/assets/js/cic-meta/auth.ts b/src/assets/js/cic-meta/auth.ts deleted file mode 100644 index d80ec50..0000000 --- a/src/assets/js/cic-meta/auth.ts +++ /dev/null @@ -1,199 +0,0 @@ -import * as pgp from 'openpgp'; -import * as crypto from 'crypto'; - -interface Signable { - digest(): string; -} - -type KeyGetter = () => any; - -type Signature = { - engine: string - algo: string - data: string - digest: string -}; - -interface Signer { - prepare(Signable): boolean; - - onsign(Signature): void; - - onverify(bool): void; - - sign(digest: string): void; - - verify(digest: string, signature: Signature): void; - - fingerprint(): string; -} - - -interface Authoritative { -} - -interface KeyStore { - getPrivateKey: KeyGetter; - getFingerprint: () => string; - getTrustedKeys: () => Array; - getTrustedActiveKeys: () => Array; - getEncryptKeys: () => Array; -} - -class PGPKeyStore implements KeyStore { - - fingerprint: string; - pk: any; - - pubk = { - active: [], - trusted: [], - encrypt: [], - }; - loads = 0x00; - loadsTarget = 0x0f; - onload: (k: KeyStore) => void; - - constructor(passphrase: string, pkArmor: string, pubkActiveArmor: string, pubkTrustedArmor: string, pubkEncryptArmor: string, - onload = (ks: KeyStore) => { - }) { - this._readKey(pkArmor, undefined, 1, passphrase); - this._readKey(pubkActiveArmor, 'active', 2); - this._readKey(pubkTrustedArmor, 'trusted', 4); - this._readKey(pubkEncryptArmor, 'encrypt', 8); - this.onload = onload; - } - - private _readKey(a: string, x: any, n: number, pass?: string): void { - pgp.key.readArmored(a).then((k) => { - if (pass !== undefined) { - this.pk = k.keys[0]; - this.pk.decrypt(pass).then(() => { - this.fingerprint = this.pk.getFingerprint(); - console.log('private key (sign)', this.fingerprint); - this._registerLoad(n); - }); - } else { - this.pubk[x] = k.keys; - k.keys.forEach((pubk) => { - console.log('public key (' + x + ')', pubk.getFingerprint()); - }); - this._registerLoad(n); - } - }); - } - - private _registerLoad(b: number): void { - this.loads |= b; - if (this.loads == this.loadsTarget) { - this.onload(this); - } - } - - public getTrustedKeys(): Array { - return this.pubk.trusted; - } - - public getTrustedActiveKeys(): Array { - return this.pubk.active; - } - - public getEncryptKeys(): Array { - return this.pubk.encrypt; - } - - public getPrivateKey(): any { - return this.pk; - } - - public getFingerprint(): string { - return this.fingerprint; - } -} - -class PGPSigner implements Signer { - - engine = 'pgp'; - algo = 'sha256'; - dgst: string; - signature: Signature; - keyStore: KeyStore; - onsign: (Signature) => void; - onverify: (bool) => void; - - constructor(keyStore: KeyStore) { - this.keyStore = keyStore; - this.onsign = (string) => { - }; - this.onverify = (boolean) => { - }; - } - - public fingerprint(): string { - return this.keyStore.getFingerprint(); - } - - public prepare(material: Signable): boolean { - this.dgst = material.digest(); - return true; - } - - public verify(digest: string, signature: Signature): void { - pgp.signature.readArmored(signature.data).then((s) => { - const opts = { - message: pgp.cleartext.fromText(digest), - publicKeys: this.keyStore.getTrustedKeys(), - signature: s, - }; - pgp.verify(opts).then((v) => { - let i = 0; - for (i = 0; i < v.signatures.length; i++) { - const s = v.signatures[i]; - if (s.valid) { - this.onverify(s); - return; - } - } - console.error('checked ' + i + ' signature(s) but none valid'); - this.onverify(false); - }); - }).catch((e) => { - console.error(e); - this.onverify(false); - }); - } - - public sign(digest: string): void { - const m = pgp.cleartext.fromText(digest); - const pk = this.keyStore.getPrivateKey(); - const opts = { - message: m, - privateKeys: [pk], - detached: true, - }; - pgp.sign(opts).then((s) => { - this.signature = { - engine: this.engine, - algo: this.algo, - data: s.signature, - // TODO: fix for browser later - digest: digest, - }; - this.onsign(this.signature); - }).catch((e) => { - console.error(e); - this.onsign(undefined); - }); - } -} - -export { - Signature, - Authoritative, - Signer, - KeyGetter, - Signable, - KeyStore, - PGPSigner, - PGPKeyStore, -}; diff --git a/src/assets/js/cic-meta/constants.js b/src/assets/js/cic-meta/constants.js deleted file mode 100644 index 6588949..0000000 --- a/src/assets/js/cic-meta/constants.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.networkSpec = exports.cryptoSpec = exports.engineSpec = void 0; -var ENGINE_NAME = 'automerge'; -var ENGINE_VERSION = '0.14.1'; -var NETWORK_NAME = 'cic'; -var NETWORK_VERSION = '1'; -var CRYPTO_NAME = 'pgp'; -var CRYPTO_VERSION = '2'; -var engineSpec = { - name: ENGINE_NAME, - version: ENGINE_VERSION, -}; -exports.engineSpec = engineSpec; -var cryptoSpec = { - name: CRYPTO_NAME, - version: CRYPTO_VERSION, -}; -exports.cryptoSpec = cryptoSpec; -var networkSpec = { - name: NETWORK_NAME, - version: NETWORK_VERSION, -}; -exports.networkSpec = networkSpec; diff --git a/src/assets/js/cic-meta/sync.js b/src/assets/js/cic-meta/sync.js deleted file mode 100644 index e4c2dea..0000000 --- a/src/assets/js/cic-meta/sync.js +++ /dev/null @@ -1,246 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Envelope = exports.ArgPair = exports.Syncable = void 0; -var Automerge = __importStar(require("automerge")); -var constants_1 = require("./constants"); -var fullSpec = { - name: 'cic', - version: '1', - ext: { - network: constants_1.cryptoSpec, - engine: constants_1.engineSpec, - }, -}; -var Envelope = /** @class */ (function () { - function Envelope(payload) { - this.o = fullSpec; - this.set(payload); - } - Envelope.prototype.set = function (payload) { - this.o['payload'] = payload; - }; - Envelope.prototype.get = function () { - return this.o['payload']; - }; - Envelope.prototype.toJSON = function () { - return JSON.stringify(this.o); - }; - Envelope.fromJSON = function (s) { - var e = new Envelope(undefined); - e.o = JSON.parse(s); - return e; - }; - Envelope.prototype.unwrap = function () { - return Syncable.fromJSON(this.o['payload']); - }; - return Envelope; -}()); -exports.Envelope = Envelope; -var ArgPair = /** @class */ (function () { - function ArgPair(k, v) { - this.k = k; - this.v = v; - } - return ArgPair; -}()); -exports.ArgPair = ArgPair; -var SignablePart = /** @class */ (function () { - function SignablePart(s) { - this.s = s; - } - SignablePart.prototype.digest = function () { - return this.s; - }; - return SignablePart; -}()); -function orderDict(src) { - var dst; - if (Array.isArray(src)) { - dst = []; - src.forEach(function (v) { - if (typeof (v) == 'object') { - v = orderDict(v); - } - dst.push(v); - }); - } - else { - dst = {}; - Object.keys(src).sort().forEach(function (k) { - var v = src[k]; - if (typeof (v) == 'object') { - v = orderDict(v); - } - dst[k] = v; - }); - } - return dst; -} -var Syncable = /** @class */ (function () { - // TODO: Move data to sub-object so timestamp, id, signature don't collide - function Syncable(id, v) { - this.id = id; - var o = { - 'id': id, - 'timestamp': Math.floor(Date.now() / 1000), - 'data': v, - }; - //this.m = Automerge.from(v) - this.m = Automerge.from(o); - } - Syncable.prototype.setSigner = function (signer) { - var _this = this; - this.signer = signer; - this.signer.onsign = function (s) { - _this.wrap(s); - }; - }; - // TODO: To keep integrity, the non-link key/value pairs for each step also need to be hashed - Syncable.prototype.digest = function () { - var links = []; - Automerge.getAllChanges(this.m).forEach(function (ch) { - var op = ch['ops']; - ch['ops'].forEach(function (op) { - if (op['action'] == 'link') { - //console.log('op link', op); - links.push([op['obj'], op['value']]); - } - }); - }); - //return JSON.stringify(links); - var j = JSON.stringify(links); - return Buffer.from(j).toString('base64'); - }; - Syncable.prototype.wrap = function (s) { - this.m = Automerge.change(this.m, 'sign', function (doc) { - doc['signature'] = s; - }); - this.e = new Envelope(this.toJSON()); - if (this.onwrap !== undefined) { - this.onwrap(this.e); - } - }; - // private _verifyLoop(i:number, history:Array, signable:Signable, result:boolean) { - // if (!result) { - // this.onauthenticate(false); - // return; - // } else if (history.length == 0) { - // this.onauthenticate(true); - // return; - // } - // const h = history.shift() - // if (i % 2 == 0) { - // i++; - // signable = { - // digest: () => { - // return Automerge.save(h.snapshot) - // }, - // }; - // this._verifyLoop(i, history, signable, true); - // } else { - // i++; - // const signature = h.snapshot['signature']; - // console.debug('signature', signature, signable.digest()); - // this.signer.onverify = (v) => { - // this._verifyLoop(i, history, signable, v) - // } - // this.signer.verify(signable, signature); - // } - // } - // - // // TODO: This should replay the graph and check signatures on each step - // public _authenticate(full:boolean=false) { - // let h = Automerge.getHistory(this.m); - // h.forEach((m) => { - // //console.debug(m.snapshot); - // }); - // const signable = { - // digest: () => { return '' }, - // } - // if (!full) { - // h = h.slice(h.length-2); - // } - // this._verifyLoop(0, h, signable, true); - // } - Syncable.prototype.authenticate = function (full) { - var _this = this; - if (full === void 0) { full = false; } - if (full) { - console.warn('only doing shallow authentication for now, sorry'); - } - //console.log('authenticating', signable.digest()); - //console.log('signature', this.m.signature); - this.signer.onverify = function (v) { - //this._verifyLoop(i, history, signable, v) - _this.onauthenticate(v); - }; - this.signer.verify(this.m.signature.digest, this.m.signature); - }; - Syncable.prototype.sign = function () { - //this.signer.prepare(this); - this.signer.sign(this.digest()); - }; - Syncable.prototype.update = function (changes, changesDescription) { - this.m = Automerge.change(this.m, changesDescription, function (m) { - changes.forEach(function (c) { - var path = c.k.split('.'); - var target = m['data']; - while (path.length > 1) { - var part = path.shift(); - target = target[part]; - } - target[path[0]] = c.v; - }); - m['timestamp'] = Math.floor(Date.now() / 1000); - }); - }; - Syncable.prototype.replace = function (o, changesDescription) { - this.m = Automerge.change(this.m, changesDescription, function (m) { - Object.keys(o).forEach(function (k) { - m['data'][k] = o[k]; - }); - Object.keys(m).forEach(function (k) { - if (o[k] == undefined) { - delete m['data'][k]; - } - }); - m['timestamp'] = Math.floor(Date.now() / 1000); - }); - }; - Syncable.prototype.merge = function (s) { - this.m = Automerge.merge(s.m, this.m); - }; - Syncable.prototype.toJSON = function () { - var s = Automerge.save(this.m); - var o = JSON.parse(s); - var oo = orderDict(o); - return JSON.stringify(oo); - }; - Syncable.fromJSON = function (s) { - var doc = Automerge.load(s); - var y = new Syncable(doc['id'], {}); - y.m = doc; - return y; - }; - return Syncable; -}()); -exports.Syncable = Syncable; diff --git a/src/assets/js/eth_account_index/index.d.ts b/src/assets/js/eth_account_index/index.d.ts deleted file mode 100644 index 0b242ac..0000000 --- a/src/assets/js/eth_account_index/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { AccountRegistry } from './registry'; diff --git a/src/assets/js/eth_account_index/index.js b/src/assets/js/eth_account_index/index.js deleted file mode 100644 index 87034da..0000000 --- a/src/assets/js/eth_account_index/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AccountRegistry = void 0; -var registry_1 = require("./registry"); -Object.defineProperty(exports, "AccountRegistry", { enumerable: true, get: function () { return registry_1.AccountRegistry; } }); diff --git a/src/assets/js/eth_account_index/registry.d.ts b/src/assets/js/eth_account_index/registry.d.ts deleted file mode 100644 index 84572e7..0000000 --- a/src/assets/js/eth_account_index/registry.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -declare class AccountRegistry { - contract: any; - signerAccount: any; - constructor(w3: any, abi: object, address: string, signerAddress?: string); - count(): Promise; - have(address: string): Promise; - last(n: number): Promise>; - add(address: string): Promise; -} -export { AccountRegistry, }; diff --git a/src/assets/js/eth_account_index/registry.js b/src/assets/js/eth_account_index/registry.js deleted file mode 100644 index 8ff737d..0000000 --- a/src/assets/js/eth_account_index/registry.js +++ /dev/null @@ -1,109 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AccountRegistry = void 0; -var AccountRegistry = /** @class */ (function () { - function AccountRegistry(w3, abi, address, signerAddress) { - this.contract = new w3.eth.Contract(abi, address); - if (signerAddress) { - this.signerAccount = signerAddress; - } - else { - this.signerAccount = w3.eth.accounts[0]; - } - } - AccountRegistry.prototype.count = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2 /*return*/, this.contract.methods.count().call()]; - }); - }); - }; - AccountRegistry.prototype.have = function (address) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.contract.methods.accountsIndex(address).call()]; - case 1: return [2 /*return*/, (_a.sent()) != 0]; - } - }); - }); - }; - AccountRegistry.prototype.last = function (n) { - return __awaiter(this, void 0, void 0, function () { - var c, lo, accounts, i, a; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.count()]; - case 1: - c = _a.sent(); - lo = c - n - 1; - if (lo < 0) { - lo = 0; - } - accounts = []; - i = c - 1; - _a.label = 2; - case 2: - if (!(i > lo)) return [3 /*break*/, 5]; - return [4 /*yield*/, this.contract.methods.accounts(i).call()]; - case 3: - a = _a.sent(); - accounts.push(a); - _a.label = 4; - case 4: - i--; - return [3 /*break*/, 2]; - case 5: return [2 /*return*/, accounts]; - } - }); - }); - }; - AccountRegistry.prototype.add = function (address) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.contract.methods.add(address).send({ from: this.signerAccount })]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - return AccountRegistry; -}()); -exports.AccountRegistry = AccountRegistry; diff --git a/src/assets/js/moolb.js b/src/assets/js/moolb.js deleted file mode 100644 index bd6fe3e..0000000 --- a/src/assets/js/moolb.js +++ /dev/null @@ -1,165 +0,0 @@ -let crypto = undefined; - -(function() { - if (typeof module !== 'undefined' && typeof exports !== 'undefined') { - const nodeCrypto = require('crypto'); - function hashWrapper(nodeCrypto, alg) { - this.alg = alg; - this.crypto = nodeCrypto.createHash(alg); - } - hashWrapper.prototype.update = function(d) { - this.crypto.update(d); - } - hashWrapper.prototype.digest = async function() { - const z = this.crypto.digest(this.data); - return new Uint8Array(z); - } - - function cryptoWrapper(nodeCrypto) { - this.crypto = nodeCrypto - } - cryptoWrapper.prototype.createHash = function(alg) { - return new hashWrapper(this.crypto, alg); - } - module.exports = { - Bloom: Bloom, - fromBytes: fromBytes, - }; - crypto = new cryptoWrapper(nodeCrypto); - } else { - function hashWrapper(webCrypto, alg) { - this.alg = alg; - this.crypto = webCrypto; - this.data = undefined; - } - hashWrapper.prototype.update = function(d) { - if (this.data != undefined) { - throw "cannot append"; - } - this.data = d; - } - hashWrapper.prototype.digest = async function() { - const z = await this.crypto.subtle.digest('SHA-256', this.data); - return new Uint8Array(z); - } - - function cryptoWrapper(webCrypto) { - this.crypto = webCrypto - } - cryptoWrapper.prototype.createHash = function(alg) { - return new hashWrapper(this.crypto, alg); - } - - crypto = new cryptoWrapper(window.crypto); - window.Bloom = Bloom; - window.bloomFromBytes = fromBytes; - } -})() - - -// block numbers 6000000 -// false positive probability 2% -// -// m = ceil((n * log(p)) / log(1 / pow(2, log(2)))); -// m = ceil((6000000 * log(0.1)) / log(1 / pow(2, log(2)))) -// = 3917675 - -// Creates a new bloom object. -// \param size of filter in bits, aligned to byte boundary -// \param number of rounds to hash -// \param hasher function, which must take two Uint8Array parameters 'data' and 'salt'. If not sef, hashBloomDefault will be used. -function Bloom(bits, rounds, hasher) { - this.bits = bits; - this.bytes = parseInt(bits / 8, 10); - this.rounds = rounds; - if (this.hasher === undefined) { - this.hasher = hashBloomDefault; - } - if (this.bytes * 8 != this.bits) { - console.error('number of bits must be on byte boundary'); - return false; - } else { - this.filter = new Uint8Array(this.bytes); - } -} - -// add entry to bloom filter -// \param value to add -Bloom.prototype.add = async function(v) { - let a = new ArrayBuffer(v.byteLength + 4); - let iw = new DataView(a); - for (let i = 0; i < v.byteLength; i++) { - iw.setUint8(i, v[i]); - } - //console.debug(iw, v); - for (var i = 0; i < this.rounds; i++) { - iw.setInt32(v.byteLength, i); - let result = await this.hasher(iw); - let resultHex = Array.prototype.map.call(new Uint8Array(result), x => ('00' + x.toString(16)).slice(-2)).join(''); - let resultInt = parseInt(BigInt('0x'+resultHex) % BigInt(this.bits), 10); - let bytepos = parseInt(resultInt / 8, 10); - let bitpos = parseInt(resultInt, 10) % 8; - this.filter[bytepos] |= 1 << bitpos; - //console.log("setpos ", bytepos, bitpos); - } -}; - -// checks if the block number has been added to the bloom filter -// \param value to check for -// \return false if not found in filter -Bloom.prototype.check = async function(v) { - let a = new ArrayBuffer(v.byteLength + 4); - let iw = new DataView(a); - for (let i = 0; i < v.byteLength; i++) { - iw.setUint8(i, v[i]); - } - for (let j = 0; j < this.filter.byteLength; j++) { - if (v[3] == 20 && this.filter[j] > 0) { - // console.log('filter ', j, this.filter[j]); - } - } - for (let i = 0; i < this.rounds; i++) { - iw.setInt32(v.byteLength, i); - let result = await this.hasher(iw); - //console.log('result', result); - let resultHex = Array.prototype.map.call(new Uint8Array(result), x => ('00' + x.toString(16)).slice(-2)).join(''); - let resultInt = parseInt(BigInt('0x'+resultHex) % BigInt(this.bits), 10); - let bytepos = parseInt(resultInt / 8, 10); - //console.log("setpos ", v, bytepos, resultInt % 8); - if (this.filter[bytepos] === undefined) { - // console.error('byte pos ' + bytepos + ' is undefined (filter length ' + this.filter.byteLength + ')'); - return false; - } else { - let test = 1 << (0xff & (resultInt % 8)); - if ((this.filter[bytepos] & test) == 0) { - return false; - } - } - } - return true; -}; - -// return the verbatim filter -// \return Uint8Array filter -Bloom.prototype.bytes = function() { - return this.filter; -}; - - -// Default hashing function used in Bloom.add() - sha256 -// \param data to insert in filter -// \param salt, typically a sequence number -// \return Uint8Array digest -async function hashBloomDefault(data, salt) { - const h = crypto.createHash('sha256'); - h.update(data); - const z = await h.digest(); - return Uint8Array.from(z); -} - -function fromBytes(bytes, rounds, hasher) { - const bits = bytes.byteLength * 8; - let b = new Bloom(bits, rounds, hasher); - b.filter = bytes; - return b; -} diff --git a/src/assets/js/openpgp.min.js b/src/assets/js/openpgp.min.js deleted file mode 100644 index 1dd5755..0000000 --- a/src/assets/js/openpgp.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! OpenPGP.js v4.10.8 - 2020-08-28 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */ -!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).openpgp=e()}}(function(){return function(){return function e(t,r,n){function i(s,o){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};t[s][0].call(f.exports,function(e){return i(t[s][1][e]||e)},f,f.exports,e,t,r,n)}return r[s].exports}for(var a="function"==typeof require&&require,s=0;s`Symbol(${e})`,n="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:void 0,i=Number.isNaN||function(e){return e!=e};function a(e){return"object"==typeof e&&null!==e||"function"==typeof e}function s(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function o(e){return e.slice()}function u(e,t,r,n,i){new Uint8Array(e).set(new Uint8Array(r,n,i),t)}function c(e){return!1!==function(e){return"number"==typeof e&&(!i(e)&&!(e<0))}(e)&&e!==1/0}function f(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function d(e,t,r,n){const i=e[t];if(void 0!==i){if("function"!=typeof i)throw new TypeError(`${i} is not a method`);switch(r){case 0:return()=>h(i,e,n);case 1:return t=>{const r=[t].concat(n);return h(i,e,r)}}}return()=>Promise.resolve()}function l(e,t,r){const n=e[t];if(void 0!==n)return f(n,e,r)}function h(e,t,r){try{return Promise.resolve(f(e,t,r))}catch(e){return Promise.reject(e)}}function p(e){return e}function y(e){if(e=Number(e),i(e)||e<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return e}function b(e){if(void 0===e)return()=>1;if("function"!=typeof e)throw new TypeError("size property of a queuing strategy must be a function");return t=>e(t)}function m(e,t,r){return Promise.prototype.then.call(e,t,r)}function g(e,t,r){let n,i;const a=new Promise((e,t)=>{n=e,i=t});return void 0===r&&(r=(e=>{throw e})),function(e,t,r){let n=!1;const i=e=>{!1===n&&(n=!0,r(e))};let a=0,s=0;const o=e.length,u=new Array(o);for(const c of e){const e=a;m(c,r=>{u[e]=r,++s===o&&t(u)},i),++a}}(e,e=>{try{const r=t(e);n(r)}catch(e){i(e)}},e=>{try{const t=r(e);n(t)}catch(e){i(e)}}),a}function w(e){}function _(e){e&&e instanceof w.AssertionError&&setTimeout(()=>{throw e},0)}function v(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function k(e,t,r){if(!c(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function A(e){e._queue=[],e._queueTotalSize=0}w.AssertionError=function(){};const S=r("[[AbortSteps]]"),E=r("[[ErrorSteps]]");class P{constructor(e={},t={}){M(this);const r=t.size;let n=t.highWaterMark;if(void 0!==e.type)throw new RangeError("Invalid type is specified");const i=b(r);void 0===n&&(n=1),function(e,t,r,n){const i=Object.create(H.prototype),a=d(t,"write",1,[i]),s=d(t,"close",0,[]),o=d(t,"abort",1,[]);W(e,i,function(){return l(t,"start",[i])},a,s,o,r,n)}(this,e,n=y(n),i)}get locked(){if(!1===C(this))throw X("locked");return K(this)}abort(e){return!1===C(this)?Promise.reject(X("abort")):!0===K(this)?Promise.reject(new TypeError("Cannot abort a stream that already has a writer")):U(this,e)}getWriter(){if(!1===C(this))throw X("getWriter");return x(this)}}function x(e){return new z(e)}function M(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=[],e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function C(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function K(e){return void 0!==e._writer}function U(e,t){const r=e._state;if("closed"===r||"errored"===r)return Promise.resolve(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let n=!1;"erroring"===r&&(n=!0,t=void 0);const i=new Promise((r,i)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:i,_reason:t,_wasAlreadyErroring:n}});return e._pendingAbortRequest._promise=i,!1===n&&B(e,t),i}function R(e,t){"writable"!==e._state?j(e):B(e,t)}function B(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&N(n,t),!1===function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&!0===r._started&&j(e)}function j(e){e._state="errored",e._writableStreamController[E]();const t=e._storedError;for(const n of e._writeRequests)n._reject(t);if(e._writeRequests=[],void 0===e._pendingAbortRequest)return void I(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,!0===r._wasAlreadyErroring)return r._reject(t),void I(e);e._writableStreamController[S](r._reason).then(()=>{r._resolve(),I(e)},t=>{r._reject(t),I(e)})}function T(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function I(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&ne(t,e._storedError)}function O(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(!0===t?ae(r):ce(r)),e._backpressure=t}class z{constructor(e){if(!1===C(e))throw new TypeError("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");if(!0===K(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!1===T(e)&&!0===e._backpressure?ae(this):oe(this),te(this);else if("erroring"===t)se(this,e._storedError),te(this);else if("closed"===t)oe(this),function(e){te(e),ie(e)}(this);else{const t=e._storedError;se(this,t),re(this,t)}}get closed(){return!1===D(this)?Promise.reject(Q("closed")):this._closedPromise}get desiredSize(){if(!1===D(this))throw Q("desiredSize");if(void 0===this._ownerWritableStream)throw ee("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Z(t._writableStreamController)}(this)}get ready(){return!1===D(this)?Promise.reject(Q("ready")):this._readyPromise}abort(e){return!1===D(this)?Promise.reject(Q("abort")):void 0===this._ownerWritableStream?Promise.reject(ee("abort")):function(e,t){return U(e._ownerWritableStream,t)}(this,e)}close(){if(!1===D(this))return Promise.reject(Q("close"));const e=this._ownerWritableStream;return void 0===e?Promise.reject(ee("close")):!0===T(e)?Promise.reject(new TypeError("cannot close an already-closing stream")):q(this)}releaseLock(){if(!1===D(this))throw Q("releaseLock");void 0!==this._ownerWritableStream&&F(this)}write(e){return!1===D(this)?Promise.reject(Q("write")):void 0===this._ownerWritableStream?Promise.reject(ee("write to")):L(this,e)}}function D(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function q(e){const t=e._ownerWritableStream,r=t._state;if("closed"===r||"errored"===r)return Promise.reject(new TypeError(`The stream (in ${r} state) is not in the writable state and cannot be closed`));const n=new Promise((e,r)=>{const n={_resolve:e,_reject:r};t._closeRequest=n});return!0===t._backpressure&&"writable"===r&&ce(e),function(e){k(e,"close",0),V(e)}(t._writableStreamController),n}function N(e,t){"pending"===e._readyPromiseState?ue(e,t):function(e,t){se(e,t)}(e,t)}function F(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");N(e,r),function(e,t){"pending"===e._closedPromiseState?ne(e,t):function(e,t){re(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function L(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,i=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Y(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return Promise.reject(ee("write to"));const a=r._state;if("errored"===a)return Promise.reject(r._storedError);if(!0===T(r)||"closed"===a)return Promise.reject(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return Promise.reject(r._storedError);const s=function(e){return new Promise((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)})}(r);return function(e,t,r){const n={chunk:t};try{k(e,n,r)}catch(t){return void Y(e,t)}const i=e._controlledWritableStream;if(!1===T(i)&&"writable"===i._state){O(i,$(e))}V(e)}(n,t,i),s}class H{constructor(){throw new TypeError("WritableStreamDefaultController cannot be constructed explicitly")}error(e){if(!1===function(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&J(this,e)}[S](e){const t=this._abortAlgorithm(e);return G(this),t}[E](){A(this)}}function W(e,t,r,n,i,a,s,o){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,A(t),t._started=!1,t._strategySizeAlgorithm=o,t._strategyHWM=s,t._writeAlgorithm=n,t._closeAlgorithm=i,t._abortAlgorithm=a;const u=$(t);O(e,u);const c=r();Promise.resolve(c).then(()=>{t._started=!0,V(t)},r=>{t._started=!0,R(e,r)}).catch(_)}function G(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Z(e){return e._strategyHWM-e._queueTotalSize}function V(e){const t=e._controlledWritableStream;if(!1===e._started)return;if(void 0!==t._inFlightWriteRequest)return;const r=t._state;if("closed"===r||"errored"===r)return;if("erroring"===r)return void j(t);if(0===e._queue.length)return;const n=function(e){return e._queue[0].value}(e);"close"===n?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),v(e);const r=e._closeAlgorithm();G(e),r.then(()=>{!function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&ie(t)}(t)},e=>{!function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),R(e,t)}(t,e)}).catch(_)}(e):function(e,t){const r=e._controlledWritableStream;(function(e){e._inFlightWriteRequest=e._writeRequests.shift()})(r),e._writeAlgorithm(t).then(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(v(e),!1===T(r)&&"writable"===t){const t=$(e);O(r,t)}V(e)},t=>{"writable"===r._state&&G(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,R(e,t)}(r,t)}).catch(_)}(e,n.chunk)}function Y(e,t){"writable"===e._controlledWritableStream._state&&J(e,t)}function $(e){return Z(e)<=0}function J(e,t){const r=e._controlledWritableStream;G(e),B(r,t)}function X(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Q(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function ee(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function te(e){e._closedPromise=new Promise((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function re(e,t){te(e),ne(e,t)}function ne(e,t){e._closedPromise.catch(()=>{}),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected"}function ie(e){e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved"}function ae(e){e._readyPromise=new Promise((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function se(e,t){ae(e),ue(e,t)}function oe(e){ae(e),ce(e)}function ue(e,t){e._readyPromise.catch(()=>{}),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected"}function ce(e){e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled"}const fe=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},de=r("[[CancelSteps]]"),le=r("[[PullSteps]]");class he{constructor(e={},t={}){be(this);const r=t.size;let n=t.highWaterMark;const i=e.type;if("bytes"===String(i)){if(void 0!==r)throw new RangeError("The strategy for a byte stream cannot have a size function");void 0===n&&(n=0),function(e,t,r){const n=Object.create(Je.prototype),i=d(t,"pull",0,[n]),a=d(t,"cancel",1,[]);let s=t.autoAllocateChunkSize;if(void 0!==s&&(s=Number(s),!1===fe(s)||s<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");!function(e,t,r,n,i,a,s){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,tt(t),t._queue=t._queueTotalSize=void 0,A(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=y(a),t._pullAlgorithm=n,t._cancelAlgorithm=i,t._autoAllocateChunkSize=s,t._pendingPullIntos=[],e._readableStreamController=t;const o=r();Promise.resolve(o).then(()=>{t._started=!0,et(t)},e=>{ht(t,e)}).catch(_)}(e,n,function(){return l(t,"start",[n])},i,a,r,s)}(this,e,n=y(n))}else{if(void 0!==i)throw new RangeError("Invalid type is specified");{const t=b(r);void 0===n&&(n=1),function(e,t,r,n){const i=Object.create(De.prototype),a=d(t,"pull",0,[i]),s=d(t,"cancel",1,[]);Ye(e,i,function(){return l(t,"start",[i])},a,s,r,n)}(this,e,n=y(n),t)}}}get locked(){if(!1===me(this))throw bt("locked");return ge(this)}cancel(e){return!1===me(this)?Promise.reject(bt("cancel")):!0===ge(this)?Promise.reject(new TypeError("Cannot cancel a stream that already has a reader")):ke(this,e)}getReader({mode:e}={}){if(!1===me(this))throw bt("getReader");if(void 0===e)return pe(this);if("byob"===(e=String(e)))return function(e){return new Re(e)}(this);throw new RangeError("Invalid mode is specified")}pipeThrough({writable:e,readable:t},{preventClose:r,preventAbort:n,preventCancel:i,signal:a}={}){if(!1===me(this))throw bt("pipeThrough");if(!1===C(e))throw new TypeError("writable argument to pipeThrough must be a WritableStream");if(!1===me(t))throw new TypeError("readable argument to pipeThrough must be a ReadableStream");if(r=Boolean(r),n=Boolean(n),i=Boolean(i),void 0!==a&&!yt(a))throw new TypeError("ReadableStream.prototype.pipeThrough's signal option must be an AbortSignal");if(!0===ge(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(!0===K(e))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return we(this,e,r,n,i,a).catch(()=>{}),t}pipeTo(e,{preventClose:t,preventAbort:r,preventCancel:n,signal:i}={}){return!1===me(this)?Promise.reject(bt("pipeTo")):!1===C(e)?Promise.reject(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream")):(t=Boolean(t),r=Boolean(r),n=Boolean(n),void 0===i||yt(i)?!0===ge(this)?Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):!0===K(e)?Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):we(this,e,t,r,n,i):Promise.reject(new TypeError("ReadableStream.prototype.pipeTo's signal option must be an AbortSignal")))}tee(){if(!1===me(this))throw bt("tee");const e=function(e,t){const r=pe(e);let n,i,a,s,u,c=!1,f=!1,d=!1;const l=new Promise(e=>{u=e});function h(){return ze(r).then(e=>{const t=e.value;if(!0===e.done&&!1===c&&(!1===f&&He(a._readableStreamController),!1===d&&He(s._readableStreamController),c=!0),!0===c)return;const r=t,n=t;!1===f&&We(a._readableStreamController,r),!1===d&&We(s._readableStreamController,n)})}function p(){}return a=ye(p,h,function(t){if(f=!0,n=t,!0===d){const t=o([n,i]),r=ke(e,t);u(r)}return l}),s=ye(p,h,function(t){if(d=!0,i=t,!0===f){const t=o([n,i]),r=ke(e,t);u(r)}return l}),r._closedPromise.catch(e=>{!0!==c&&(Ge(a._readableStreamController,e),Ge(s._readableStreamController,e),c=!0)}),[a,s]}(this);return o(e)}}function pe(e){return new Ue(e)}function ye(e,t,r,n=1,i=(()=>1)){const a=Object.create(he.prototype);return be(a),Ye(a,Object.create(De.prototype),e,t,r,n,i),a}function be(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function me(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function ge(e){return void 0!==e._reader}function we(e,t,r,n,i,a){const s=pe(e),o=x(t);let u=!1,c=Promise.resolve();return new Promise((f,d)=>{let l;if(void 0!==a){if(l=(()=>{const r=new DOMException("Aborted","AbortError"),a=[];!1===n&&a.push(()=>"writable"===t._state?U(t,r):Promise.resolve()),!1===i&&a.push(()=>"readable"===e._state?ke(e,r):Promise.resolve()),y(()=>g(a.map(e=>e()),e=>e),!0,r)}),!0===a.aborted)return void l();a.addEventListener("abort",l)}if(p(e,s._closedPromise,e=>{!1===n?y(()=>U(t,e),!0,e):b(!0,e)}),p(t,o._closedPromise,t=>{!1===i?y(()=>ke(e,t),!0,t):b(!0,t)}),function(e,t,r){"closed"===e._state?r():t.then(r).catch(_)}(e,s._closedPromise,()=>{!1===r?y(()=>(function(e){const t=e._ownerWritableStream,r=t._state;return!0===T(t)||"closed"===r?Promise.resolve():"errored"===r?Promise.reject(t._storedError):q(e)})(o)):b()}),!0===T(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");!1===i?y(()=>ke(e,t),!0,t):b(!0,t)}function h(){const e=c;return c.then(()=>e!==c?h():void 0)}function p(e,t,r){"errored"===e._state?r(e._storedError):t.catch(r).catch(_)}function y(e,r,n){function i(){e().then(()=>m(r,n),e=>m(!0,e)).catch(_)}!0!==u&&(u=!0,"writable"===t._state&&!1===T(t)?h().then(i):i())}function b(e,r){!0!==u&&(u=!0,"writable"===t._state&&!1===T(t)?h().then(()=>m(e,r)).catch(_):m(e,r))}function m(e,t){F(o),Oe(s),void 0!==a&&a.removeEventListener("abort",l),e?d(t):f(void 0)}new Promise((e,t)=>{!function r(n){n?e():(!0===u?Promise.resolve(!0):o._readyPromise.then(()=>ze(s).then(({value:e,done:t})=>!0===t||(c=L(o,e).catch(()=>{}),!1)))).then(r,t)}(!1)}).catch(e=>{c=Promise.resolve(),_(e)})})}function _e(e,t){return new Promise((r,n)=>{const i={_resolve:r,_reject:n,_forAuthorCode:t};e._reader._readIntoRequests.push(i)})}function ve(e,t){return new Promise((r,n)=>{const i={_resolve:r,_reject:n,_forAuthorCode:t};e._reader._readRequests.push(i)})}function ke(e,t){return e._disturbed=!0,"closed"===e._state?Promise.resolve(void 0):"errored"===e._state?Promise.reject(e._storedError):(Ae(e),e._readableStreamController[de](t).then(()=>void 0))}function Ae(e){e._state="closed";const t=e._reader;if(void 0!==t){if(je(t)){for(const e of t._readRequests){(0,e._resolve)(Se(void 0,!0,e._forAuthorCode))}t._readRequests=[]}kt(t)}}function Se(e,t,r){let n=null;!0===r&&(n=Object.prototype);const i=Object.create(n);return Object.defineProperty(i,"value",{value:e,enumerable:!0,writable:!0,configurable:!0}),Object.defineProperty(i,"done",{value:t,enumerable:!0,writable:!0,configurable:!0}),i}function Ee(e,t){e._state="errored",e._storedError=t;const r=e._reader;if(void 0!==r){if(je(r)){for(const e of r._readRequests)e._reject(t);r._readRequests=[]}else{for(const e of r._readIntoRequests)e._reject(t);r._readIntoRequests=[]}vt(r,t)}}function Pe(e,t,r){const n=e._reader._readRequests.shift();n._resolve(Se(t,r,n._forAuthorCode))}function xe(e){return e._reader._readIntoRequests.length}function Me(e){return e._reader._readRequests.length}function Ce(e){const t=e._reader;return void 0!==t&&!!Be(t)}function Ke(e){const t=e._reader;return void 0!==t&&!!je(t)}class Ue{constructor(e){if(!1===me(e))throw new TypeError("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===ge(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Te(this,e),this._readRequests=[]}get closed(){return je(this)?this._closedPromise:Promise.reject(gt("closed"))}cancel(e){return je(this)?void 0===this._ownerReadableStream?Promise.reject(mt("cancel")):Ie(this,e):Promise.reject(gt("cancel"))}read(){return je(this)?void 0===this._ownerReadableStream?Promise.reject(mt("read from")):ze(this,!0):Promise.reject(gt("read"))}releaseLock(){if(!je(this))throw gt("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Oe(this)}}}class Re{constructor(e){if(!me(e))throw new TypeError("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===Xe(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(ge(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Te(this,e),this._readIntoRequests=[]}get closed(){return Be(this)?this._closedPromise:Promise.reject(At("closed"))}cancel(e){return Be(this)?void 0===this._ownerReadableStream?Promise.reject(mt("cancel")):Ie(this,e):Promise.reject(At("cancel"))}read(e){return Be(this)?void 0===this._ownerReadableStream?Promise.reject(mt("read from")):ArrayBuffer.isView(e)?(e.buffer,0===e.byteLength?Promise.reject(new TypeError("view must have non-zero byteLength")):function(e,t,r=!1){const n=e._ownerReadableStream;return n._disturbed=!0,"errored"===n._state?Promise.reject(n._storedError):function(e,t,r){const n=e._controlledReadableByteStream;let i=1;t.constructor!==DataView&&(i=t.constructor.BYTES_PER_ELEMENT);const a=t.constructor,s={buffer:p(t.buffer),byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:i,ctor:a,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(s),_e(n,r);if("closed"===n._state){const e=new a(s.buffer,s.byteOffset,0);return Promise.resolve(Se(e,!0,r))}if(e._queueTotalSize>0){if(!0===at(e,s)){const t=nt(s);return ot(e),Promise.resolve(Se(t,!1,r))}if(!0===e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return ht(e,t),Promise.reject(t)}}e._pendingPullIntos.push(s);const o=_e(n,r);return et(e),o}(n._readableStreamController,t,r)}(this,e,!0)):Promise.reject(new TypeError("view must be an array buffer view")):Promise.reject(At("read"))}releaseLock(){if(!Be(this))throw At("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");Oe(this)}}}function Be(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function je(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function Te(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?wt(e):"closed"===t._state?function(e){wt(e),kt(e)}(e):_t(e,t._storedError)}function Ie(e,t){return ke(e._ownerReadableStream,t)}function Oe(e){"readable"===e._ownerReadableStream._state?vt(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){_t(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function ze(e,t=!1){const r=e._ownerReadableStream;return r._disturbed=!0,"closed"===r._state?Promise.resolve(Se(void 0,!0,t)):"errored"===r._state?Promise.reject(r._storedError):r._readableStreamController[le](t)}class De{constructor(){throw new TypeError}get desiredSize(){if(!1===qe(this))throw St("desiredSize");return Ze(this)}close(){if(!1===qe(this))throw St("close");if(!1===Ve(this))throw new TypeError("The stream is not in a state that permits close");He(this)}enqueue(e){if(!1===qe(this))throw St("enqueue");if(!1===Ve(this))throw new TypeError("The stream is not in a state that permits enqueue");return We(this,e)}error(e){if(!1===qe(this))throw St("error");Ge(this,e)}[de](e){A(this);const t=this._cancelAlgorithm(e);return Le(this),t}[le](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=v(this);return!0===this._closeRequested&&0===this._queue.length?(Le(this),Ae(t)):Ne(this),Promise.resolve(Se(r,!1,e))}const r=ve(t,e);return Ne(this),r}}function qe(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function Ne(e){!1!==Fe(e)&&(!0!==e._pulling?(e._pulling=!0,e._pullAlgorithm().then(()=>{if(e._pulling=!1,!0===e._pullAgain)return e._pullAgain=!1,Ne(e)},t=>{Ge(e,t)}).catch(_)):e._pullAgain=!0)}function Fe(e){const t=e._controlledReadableStream;return!1!==Ve(e)&&!1!==e._started&&(!0===ge(t)&&Me(t)>0||Ze(e)>0)}function Le(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function He(e){const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Le(e),Ae(t))}function We(e,t){const r=e._controlledReadableStream;if(!0===ge(r)&&Me(r)>0)Pe(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw Ge(e,t),t}try{k(e,t,r)}catch(t){throw Ge(e,t),t}}Ne(e)}function Ge(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(A(e),Le(e),Ee(r,t))}function Ze(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ve(e){const t=e._controlledReadableStream._state;return!1===e._closeRequested&&"readable"===t}function Ye(e,t,r,n,i,a,s){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,A(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,e._readableStreamController=t;const o=r();Promise.resolve(o).then(()=>{t._started=!0,Ne(t)},e=>{Ge(t,e)}).catch(_)}class $e{constructor(){throw new TypeError("ReadableStreamBYOBRequest cannot be used directly")}get view(){if(!1===Qe(this))throw Et("view");return this._view}respond(e){if(!1===Qe(this))throw Et("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(e,t){if(!1===c(t=Number(t)))throw new RangeError("bytesWritten must be a finite");ft(e,t)}(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!1===Qe(this))throw Et("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");e.buffer,function(e,t){const r=e._pendingPullIntos[0];if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer,ft(e,t.byteLength)}(this._associatedReadableByteStreamController,e)}}class Je{constructor(){throw new TypeError("ReadableByteStreamController constructor cannot be used directly")}get byobRequest(){if(!1===Xe(this))throw Pt("byobRequest");if(void 0===this._byobRequest&&this._pendingPullIntos.length>0){const e=this._pendingPullIntos[0],t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),r=Object.create($e.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(r,this,t),this._byobRequest=r}return this._byobRequest}get desiredSize(){if(!1===Xe(this))throw Pt("desiredSize");return pt(this)}close(){if(!1===Xe(this))throw Pt("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);!function(e){const t=e._controlledReadableByteStream;if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){if(e._pendingPullIntos[0].bytesFilled>0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw ht(e,t),t}}lt(e),Ae(t)}}(this)}enqueue(e){if(!1===Xe(this))throw Pt("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);if(!ArrayBuffer.isView(e))throw new TypeError("You can only enqueue array buffer views when using a ReadableByteStreamController");e.buffer,function(e,t){const r=e._controlledReadableByteStream,n=t.buffer,i=t.byteOffset,a=t.byteLength,s=p(n);if(!0===Ke(r))if(0===Me(r))it(e,s,i,a);else{Pe(r,new Uint8Array(s,i,a),!1)}else!0===Ce(r)?(it(e,s,i,a),ct(e)):it(e,s,i,a);et(e)}(this,e)}error(e){if(!1===Xe(this))throw Pt("error");ht(this,e)}[de](e){this._pendingPullIntos.length>0&&(this._pendingPullIntos[0].bytesFilled=0),A(this);const t=this._cancelAlgorithm(e);return lt(this),t}[le](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0){const t=this._queue.shift();let r;this._queueTotalSize-=t.byteLength,ot(this);try{r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}catch(e){return Promise.reject(e)}return Promise.resolve(Se(r,!1,e))}const r=this._autoAllocateChunkSize;if(void 0!==r){let t;try{t=new ArrayBuffer(r)}catch(e){return Promise.reject(e)}const n={buffer:t,byteOffset:0,byteLength:r,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(n)}const n=ve(t,e);return et(this),n}}function Xe(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function Qe(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function et(e){!1!==function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!0!==e._closeRequested&&(!1!==e._started&&(!0===Ke(t)&&Me(t)>0||(!0===Ce(t)&&xe(t)>0||pt(e)>0))))}(e)&&(!0!==e._pulling?(e._pulling=!0,e._pullAlgorithm().then(()=>{e._pulling=!1,!0===e._pullAgain&&(e._pullAgain=!1,et(e))},t=>{ht(e,t)}).catch(_)):e._pullAgain=!0)}function tt(e){ut(e),e._pendingPullIntos=[]}function rt(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=nt(t);"default"===t.readerType?Pe(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();n._resolve(Se(t,r,n._forAuthorCode))}(e,n,r)}function nt(e){const t=e.bytesFilled,r=e.elementSize;return new e.ctor(e.buffer,e.byteOffset,t/r)}function it(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function at(e,t){const r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,s=a-a%r;let o=i,c=!1;s>n&&(o=s-t.bytesFilled,c=!0);const f=e._queue;for(;o>0;){const r=f[0],n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;u(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?f.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,st(e,n,t),o-=n}return c}function st(e,t,r){ut(e),r.bytesFilled+=t}function ot(e){0===e._queueTotalSize&&!0===e._closeRequested?(lt(e),Ae(e._controlledReadableByteStream)):et(e)}function ut(e){void 0!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=void 0,e._byobRequest=void 0)}function ct(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos[0];!0===at(e,t)&&(dt(e),rt(e._controlledReadableByteStream,t))}}function ft(e,t){const r=e._pendingPullIntos[0];if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=p(t.buffer);const r=e._controlledReadableByteStream;if(!0===Ce(r))for(;xe(r)>0;)rt(r,dt(e))}(e,r)}else!function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");if(st(e,t,r),r.bytesFilled0){const t=r.byteOffset+r.bytesFilled,i=r.buffer.slice(t-n,t);it(e,i,0,i.byteLength)}r.buffer=p(r.buffer),r.bytesFilled-=n,rt(e._controlledReadableByteStream,r),ct(e)}(e,t,r);et(e)}function dt(e){const t=e._pendingPullIntos.shift();return ut(e),t}function lt(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function ht(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(tt(e),A(e),lt(e),Ee(r,t))}function pt(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function yt(e){if("object"!=typeof e||null===e)return!1;const t=Object.getOwnPropertyDescriptor(AbortSignal.prototype,"aborted").get;try{return t.call(e),!0}catch(e){return!1}}function bt(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function mt(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function gt(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}function wt(e){e._closedPromise=new Promise((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function _t(e,t){wt(e),vt(e,t)}function vt(e,t){e._closedPromise.catch(()=>{}),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}function kt(e){e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}function At(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function St(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function Et(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Pt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}class xt{constructor({highWaterMark:e}){s(this,"highWaterMark",e)}size(e){return e.byteLength}}class Mt{constructor({highWaterMark:e}){s(this,"highWaterMark",e)}size(){return 1}}class Ct{constructor(e={},t={},r={}){const n=t.size;let i=t.highWaterMark;const a=r.size;let s=r.highWaterMark;if(void 0!==e.writableType)throw new RangeError("Invalid writable type specified");const o=b(n);if(void 0===i&&(i=1),i=y(i),void 0!==e.readableType)throw new RangeError("Invalid readable type specified");const u=b(a);let c;void 0===s&&(s=0),s=y(s),function(e,t,r,n,i,a){function s(){return t}e._writable=function(e,t,r,n,i=1,a=(()=>1)){const s=Object.create(P.prototype);return M(s),W(s,Object.create(H.prototype),e,t,r,n,i,a),s}(s,function(t){return function(e,t){const r=e._transformStreamController;if(!0===e._backpressure){return e._backpressureChangePromise.then(()=>{const n=e._writable;if("erroring"===n._state)throw n._storedError;return zt(r,t)})}return zt(r,t)}(e,t)},function(){return function(e){const t=e._readable,r=e._transformStreamController,n=r._flushAlgorithm();return It(r),n.then(()=>{if("errored"===t._state)throw t._storedError;const e=t._readableStreamController;!0===Ve(e)&&He(e)}).catch(r=>{throw Ut(e,r),t._storedError})}(e)},function(t){return function(e,t){return Ut(e,t),Promise.resolve()}(e,t)},r,n),e._readable=ye(s,function(){return function(e){return Bt(e,!1),e._backpressureChangePromise}(e)},function(t){return Rt(e,t),Promise.resolve()},i,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,Bt(e,!0),e._transformStreamController=void 0}(this,new Promise(e=>{c=e}),i,o,s,u),function(e,t){const r=Object.create(jt.prototype);let n=e=>{try{return Ot(r,e),Promise.resolve()}catch(e){return Promise.reject(e)}};const i=t.transform;if(void 0!==i){if("function"!=typeof i)throw new TypeError("transform is not a method");n=(e=>h(i,t,[e,r]))}const a=d(t,"flush",0,[r]);!function(e,t,r,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n}(e,r,n,a)}(this,e);const f=l(e,"start",[this._transformStreamController]);c(f)}get readable(){if(!1===Kt(this))throw qt("readable");return this._readable}get writable(){if(!1===Kt(this))throw qt("writable");return this._writable}}function Kt(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function Ut(e,t){Ge(e._readable._readableStreamController,t),Rt(e,t)}function Rt(e,t){It(e._transformStreamController),Y(e._writable._writableStreamController,t),!0===e._backpressure&&Bt(e,!1)}function Bt(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=new Promise(t=>{e._backpressureChangePromise_resolve=t}),e._backpressure=t}class jt{constructor(){throw new TypeError("TransformStreamDefaultController instances cannot be created directly")}get desiredSize(){if(!1===Tt(this))throw Dt("desiredSize");return Ze(this._controlledTransformStream._readable._readableStreamController)}enqueue(e){if(!1===Tt(this))throw Dt("enqueue");Ot(this,e)}error(e){if(!1===Tt(this))throw Dt("error");!function(e,t){Ut(e._controlledTransformStream,t)}(this,e)}terminate(){if(!1===Tt(this))throw Dt("terminate");!function(e){const t=e._controlledTransformStream,r=t._readable._readableStreamController;!0===Ve(r)&&He(r),Rt(t,new TypeError("TransformStream terminated"))}(this)}}function Tt(e){return!!a(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function It(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function Ot(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!1===Ve(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{We(n,t)}catch(e){throw Rt(r,e),r._readable._storedError}!0!==Fe(n)!==r._backpressure&&Bt(r,!0)}function zt(e,t){return e._transformAlgorithm(t).catch(t=>{throw Ut(e._controlledTransformStream,t),t})}function Dt(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function qt(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}const Nt={ReadableStream:he,WritableStream:P,ByteLengthQueuingStrategy:xt,CountQueuingStrategy:Mt,TransformStream:Ct};void 0!==n&&Object.assign(n,Nt),t.ReadableStream=he,t.WritableStream=P,t.ByteLengthQueuingStrategy=xt,t.CountQueuingStrategy=Mt,t.TransformStream=Ct,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof r&&void 0!==t?r:(n=n||self).WebStreamsPolyfill={})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.AES_asm=function(){var e,t,r=!1;function n(r,n){var i=e[(t[r]+t[n])%255];return 0!==r&&0!==n||(i=0),i}var i,a,s,o,u=!1;function c(){function c(r){var n,i,a;for(i=a=function(r){var n=e[255-t[r]];return 0===r&&(n=0),n}(r),n=0;n<4;n++)a^=i=255&(i<<1|i>>>7);return a^=99}r||function(){e=[],t=[];var n,i,a=1;for(n=0;n<255;n++)e[n]=a,i=128&a,a<<=1,a&=255,128===i&&(a^=27),a^=e[n],t[e[n]]=n;e[255]=e[0],t[0]=0,r=!0}(),i=[],a=[],s=[[],[],[],[]],o=[[],[],[],[]];for(var f=0;f<256;f++){var d=c(f);i[f]=d,a[d]=f,s[0][f]=n(2,d)<<24|d<<16|d<<8|n(3,d),o[0][d]=n(14,f)<<24|n(9,f)<<16|n(13,f)<<8|n(11,f);for(var l=1;l<4;l++)s[l][f]=s[l-1][f]>>>8|s[l-1][f]<<24,o[l][d]=o[l-1][d]>>>8|o[l-1][d]<<24}u=!0}var f=function(e,t){u||c();var r=new Uint32Array(t);r.set(i,512),r.set(a,768);for(var n=0;n<4;n++)r.set(s[n],4096+1024*n>>2),r.set(o[n],8192+1024*n>>2);var f=function(e,t,r){"use asm";var n=0,i=0,a=0,s=0,o=0,u=0,c=0,f=0,d=0,l=0,h=0,p=0,y=0,b=0,m=0,g=0,w=0,_=0,v=0,k=0,A=0;var S=new e.Uint32Array(r),E=new e.Uint8Array(r);function P(e,t,r,o,u,c,f,d){e=e|0;t=t|0;r=r|0;o=o|0;u=u|0;c=c|0;f=f|0;d=d|0;var l=0,h=0,p=0,y=0,b=0,m=0,g=0,w=0;l=r|0x400,h=r|0x800,p=r|0xc00;u=u^S[(e|0)>>2],c=c^S[(e|4)>>2],f=f^S[(e|8)>>2],d=d^S[(e|12)>>2];for(w=16;(w|0)<=o<<4;w=w+16|0){y=S[(r|u>>22&1020)>>2]^S[(l|c>>14&1020)>>2]^S[(h|f>>6&1020)>>2]^S[(p|d<<2&1020)>>2]^S[(e|w|0)>>2],b=S[(r|c>>22&1020)>>2]^S[(l|f>>14&1020)>>2]^S[(h|d>>6&1020)>>2]^S[(p|u<<2&1020)>>2]^S[(e|w|4)>>2],m=S[(r|f>>22&1020)>>2]^S[(l|d>>14&1020)>>2]^S[(h|u>>6&1020)>>2]^S[(p|c<<2&1020)>>2]^S[(e|w|8)>>2],g=S[(r|d>>22&1020)>>2]^S[(l|u>>14&1020)>>2]^S[(h|c>>6&1020)>>2]^S[(p|f<<2&1020)>>2]^S[(e|w|12)>>2];u=y,c=b,f=m,d=g}n=S[(t|u>>22&1020)>>2]<<24^S[(t|c>>14&1020)>>2]<<16^S[(t|f>>6&1020)>>2]<<8^S[(t|d<<2&1020)>>2]^S[(e|w|0)>>2],i=S[(t|c>>22&1020)>>2]<<24^S[(t|f>>14&1020)>>2]<<16^S[(t|d>>6&1020)>>2]<<8^S[(t|u<<2&1020)>>2]^S[(e|w|4)>>2],a=S[(t|f>>22&1020)>>2]<<24^S[(t|d>>14&1020)>>2]<<16^S[(t|u>>6&1020)>>2]<<8^S[(t|c<<2&1020)>>2]^S[(e|w|8)>>2],s=S[(t|d>>22&1020)>>2]<<24^S[(t|u>>14&1020)>>2]<<16^S[(t|c>>6&1020)>>2]<<8^S[(t|f<<2&1020)>>2]^S[(e|w|12)>>2]}function x(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;P(0x0000,0x0800,0x1000,A,e,t,r,n)}function M(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var a=0;P(0x0400,0x0c00,0x2000,A,e,n,r,t);a=i,i=s,s=a}function C(e,t,r,d){e=e|0;t=t|0;r=r|0;d=d|0;P(0x0000,0x0800,0x1000,A,o^e,u^t,c^r,f^d);o=n,u=i,c=a,f=s}function K(e,t,r,d){e=e|0;t=t|0;r=r|0;d=d|0;var l=0;P(0x0400,0x0c00,0x2000,A,e,d,r,t);l=i,i=s,s=l;n=n^o,i=i^u,a=a^c,s=s^f;o=e,u=t,c=r,f=d}function U(e,t,r,d){e=e|0;t=t|0;r=r|0;d=d|0;P(0x0000,0x0800,0x1000,A,o,u,c,f);o=n=n^e,u=i=i^t,c=a=a^r,f=s=s^d}function R(e,t,r,d){e=e|0;t=t|0;r=r|0;d=d|0;P(0x0000,0x0800,0x1000,A,o,u,c,f);n=n^e,i=i^t,a=a^r,s=s^d;o=e,u=t,c=r,f=d}function B(e,t,r,d){e=e|0;t=t|0;r=r|0;d=d|0;P(0x0000,0x0800,0x1000,A,o,u,c,f);o=n,u=i,c=a,f=s;n=n^e,i=i^t,a=a^r,s=s^d}function j(e,t,r,o){e=e|0;t=t|0;r=r|0;o=o|0;P(0x0000,0x0800,0x1000,A,d,l,h,p);p=~g&p|g&p+1;h=~m&h|m&h+((p|0)==0);l=~b&l|b&l+((h|0)==0);d=~y&d|y&d+((l|0)==0);n=n^e;i=i^t;a=a^r;s=s^o}function T(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,a=0,s=0,d=0,l=0,h=0,p=0,y=0,b=0,m=0;e=e^o,t=t^u,r=r^c,n=n^f;i=w|0,a=_|0,s=v|0,d=k|0;for(;(b|0)<128;b=b+1|0){if(i>>>31){l=l^e,h=h^t,p=p^r,y=y^n}i=i<<1|a>>>31,a=a<<1|s>>>31,s=s<<1|d>>>31,d=d<<1;m=n&1;n=n>>>1|r<<31,r=r>>>1|t<<31,t=t>>>1|e<<31,e=e>>>1;if(m)e=e^0xe1000000}o=l,u=h,c=p,f=y}function I(e){e=e|0;A=e}function O(e,t,r,o){e=e|0;t=t|0;r=r|0;o=o|0;n=e,i=t,a=r,s=o}function z(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;o=e,u=t,c=r,f=n}function D(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;d=e,l=t,h=r,p=n}function q(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;y=e,b=t,m=r,g=n}function N(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;p=~g&p|g&n,h=~m&h|m&r,l=~b&l|b&t,d=~y&d|y&e}function F(e){e=e|0;if(e&15)return-1;E[e|0]=n>>>24,E[e|1]=n>>>16&255,E[e|2]=n>>>8&255,E[e|3]=n&255,E[e|4]=i>>>24,E[e|5]=i>>>16&255,E[e|6]=i>>>8&255,E[e|7]=i&255,E[e|8]=a>>>24,E[e|9]=a>>>16&255,E[e|10]=a>>>8&255,E[e|11]=a&255,E[e|12]=s>>>24,E[e|13]=s>>>16&255,E[e|14]=s>>>8&255,E[e|15]=s&255;return 16}function L(e){e=e|0;if(e&15)return-1;E[e|0]=o>>>24,E[e|1]=o>>>16&255,E[e|2]=o>>>8&255,E[e|3]=o&255,E[e|4]=u>>>24,E[e|5]=u>>>16&255,E[e|6]=u>>>8&255,E[e|7]=u&255,E[e|8]=c>>>24,E[e|9]=c>>>16&255,E[e|10]=c>>>8&255,E[e|11]=c&255,E[e|12]=f>>>24,E[e|13]=f>>>16&255,E[e|14]=f>>>8&255,E[e|15]=f&255;return 16}function H(){x(0,0,0,0);w=n,_=i,v=a,k=s}function W(e,t,r){e=e|0;t=t|0;r=r|0;var o=0;if(t&15)return-1;while((r|0)>=16){Z[e&7](E[t|0]<<24|E[t|1]<<16|E[t|2]<<8|E[t|3],E[t|4]<<24|E[t|5]<<16|E[t|6]<<8|E[t|7],E[t|8]<<24|E[t|9]<<16|E[t|10]<<8|E[t|11],E[t|12]<<24|E[t|13]<<16|E[t|14]<<8|E[t|15]);E[t|0]=n>>>24,E[t|1]=n>>>16&255,E[t|2]=n>>>8&255,E[t|3]=n&255,E[t|4]=i>>>24,E[t|5]=i>>>16&255,E[t|6]=i>>>8&255,E[t|7]=i&255,E[t|8]=a>>>24,E[t|9]=a>>>16&255,E[t|10]=a>>>8&255,E[t|11]=a&255,E[t|12]=s>>>24,E[t|13]=s>>>16&255,E[t|14]=s>>>8&255,E[t|15]=s&255;o=o+16|0,t=t+16|0,r=r-16|0}return o|0}function G(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(t&15)return-1;while((r|0)>=16){V[e&1](E[t|0]<<24|E[t|1]<<16|E[t|2]<<8|E[t|3],E[t|4]<<24|E[t|5]<<16|E[t|6]<<8|E[t|7],E[t|8]<<24|E[t|9]<<16|E[t|10]<<8|E[t|11],E[t|12]<<24|E[t|13]<<16|E[t|14]<<8|E[t|15]);n=n+16|0,t=t+16|0,r=r-16|0}return n|0}var Z=[x,M,C,K,U,R,B,j];var V=[C,T];return{set_rounds:I,set_state:O,set_iv:z,set_nonce:D,set_mask:q,set_counter:N,get_state:F,get_iv:L,gcm_init:H,cipher:W,mac:G}}({Uint8Array:Uint8Array,Uint32Array:Uint32Array},e,t);return f.set_key=function(e,t,n,a,s,u,c,d,l){var h=r.subarray(0,60),p=r.subarray(256,316);h.set([t,n,a,s,u,c,d,l]);for(var y=e,b=1;y<4*e+28;y++){var m=h[y-1];(y%e==0||8===e&&y%e==4)&&(m=i[m>>>24]<<24^i[m>>>16&255]<<16^i[m>>>8&255]<<8^i[255&m]),y%e==0&&(m=m<<8^m>>>24^b<<24,b=b<<1^(128&b?27:0)),h[y]=h[y-e]^m}for(var g=0;g=y-4?m:o[0][i[m>>>24]]^o[1][i[m>>>16&255]]^o[2][i[m>>>8&255]]^o[3][i[255&m]];f.set_rounds(e+5)},f};return f.ENC={ECB:0,CBC:2,CFB:4,OFB:6,CTR:7},f.DEC={ECB:1,CBC:3,CFB:5,OFB:6,CTR:7},f.MAC={CBC:0,GCM:1},f.HEAP_DATA=16384,f}()},{}],3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AES=void 0;var n=e("./aes.asm"),i=e("../other/utils"),a=e("../other/errors"),s=[],o=[],u=function(){function e(e,t,r,n){void 0===r&&(r=!0),this.pos=0,this.len=0,this.mode=n,this.pos=0,this.len=0,this.key=e,this.iv=t,this.padding=r,this.acquire_asm()}return e.prototype.acquire_asm=function(){void 0===this.heap&&void 0===this.asm&&(this.heap=s.pop()||(0,i._heap_init)().subarray(n.AES_asm.HEAP_DATA),this.asm=o.pop()||(0,n.AES_asm)(null,this.heap.buffer),this.reset(this.key,this.iv))},e.prototype.release_asm=function(){s.push(this.heap),o.push(this.asm),this.heap=void 0,this.asm=void 0},e.prototype.reset=function(e,t){var r=e.length;if(16!==r&&24!==r&&32!==r)throw new a.IllegalArgumentError("illegal key size");var n=new DataView(e.buffer,e.byteOffset,e.byteLength);if(this.asm.set_key(r>>2,n.getUint32(0),n.getUint32(4),n.getUint32(8),n.getUint32(12),r>16?n.getUint32(16):0,r>16?n.getUint32(20):0,r>24?n.getUint32(24):0,r>24?n.getUint32(28):0),void 0!==t){if(16!==t.length)throw new a.IllegalArgumentError("illegal iv size");var i=new DataView(t.buffer,t.byteOffset,t.byteLength);this.asm.set_iv(i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12))}else this.asm.set_iv(0,0,0,0)},e.prototype.AES_Encrypt_process=function(e){if(!(0,i.is_bytes)(e))throw new TypeError("data isn't of expected type");this.acquire_asm();for(var t=this.asm,r=this.heap,a=n.AES_asm.ENC[this.mode],s=n.AES_asm.HEAP_DATA,o=this.pos,u=this.len,c=0,f=e.length||0,d=0,l=0,h=new Uint8Array(u+f&-16);f>0;)u+=l=(0,i._heap_write)(r,o+u,e,c,f),c+=l,f-=l,(l=t.cipher(a,s+o,u))&&h.set(r.subarray(o,o+l),d),d+=l,l0;)u+=p=(0,i._heap_write)(r,o+u,e,c,f),c+=p,f-=p,(p=t.cipher(a,s+o,u-(f?0:h)))&&y.set(r.subarray(o,o+p),d),d+=p,p0){if(o%16){if(this.hasOwnProperty("padding"))throw new a.IllegalArgumentError("data length must be a multiple of the block size");o+=16-o%16}if(e.cipher(r,i+s,o),this.hasOwnProperty("padding")&&this.padding){var c=t[s+u-1];if(c<1||c>16||c>u)throw new a.SecurityError("bad padding");for(var f=0,d=c;d>1;d--)f|=c^t[s+u-d];if(f)throw new a.SecurityError("bad padding");u-=c}}var l=new Uint8Array(u);return u>0&&l.set(t.subarray(s,s+u)),this.pos=0,this.len=0,this.release_asm(),l},e}();r.AES=u},{"../other/errors":14,"../other/utils":15,"./aes.asm":2}],4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AES_CBC=void 0;var n,i=e("./aes"),a=e("../other/utils"),s=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=function(e){function t(t,r,n){return void 0===n&&(n=!0),e.call(this,t,r,n,"CBC")||this}return s(t,e),t.encrypt=function(e,r,n,i){return void 0===n&&(n=!0),new t(r,i,n).encrypt(e)},t.decrypt=function(e,r,n,i){return void 0===n&&(n=!0),new t(r,i,n).decrypt(e)},t.prototype.encrypt=function(e){var t=this.AES_Encrypt_process(e),r=this.AES_Encrypt_finish();return(0,a.joinBytes)(t,r)},t.prototype.decrypt=function(e){var t=this.AES_Decrypt_process(e),r=this.AES_Decrypt_finish();return(0,a.joinBytes)(t,r)},t}(i.AES);r.AES_CBC=o},{"../other/utils":15,"./aes":3}],5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AES_CFB=void 0;var n,i=e("./aes"),a=e("../other/utils"),s=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=function(e){function t(t,r){var n=e.call(this,t,r,!0,"CFB")||this;return delete n.padding,n}return s(t,e),t.encrypt=function(e,r,n){return new t(r,n).encrypt(e)},t.decrypt=function(e,r,n){return new t(r,n).decrypt(e)},t.prototype.encrypt=function(e){var t=this.AES_Encrypt_process(e),r=this.AES_Encrypt_finish();return(0,a.joinBytes)(t,r)},t.prototype.decrypt=function(e){var t=this.AES_Decrypt_process(e),r=this.AES_Decrypt_finish();return(0,a.joinBytes)(t,r)},t}(i.AES);r.AES_CFB=o},{"../other/utils":15,"./aes":3}],6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AES_CTR=void 0;var n,i=e("./aes"),a=e("../other/errors"),s=e("../other/utils"),o=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(e){function t(t,r){var n=e.call(this,t,void 0,!1,"CTR")||this;return delete n.padding,n.AES_CTR_set_options(r),n}return o(t,e),t.encrypt=function(e,r,n){return new t(r,n).encrypt(e)},t.decrypt=function(e,r,n){return new t(r,n).encrypt(e)},t.prototype.encrypt=function(e){var t=this.AES_Encrypt_process(e),r=this.AES_Encrypt_finish();return(0,s.joinBytes)(t,r)},t.prototype.decrypt=function(e){var t=this.AES_Encrypt_process(e),r=this.AES_Encrypt_finish();return(0,s.joinBytes)(t,r)},t.prototype.AES_CTR_set_options=function(e,t,r){if(void 0!==r){if(r<8||r>48)throw new a.IllegalArgumentError("illegal counter size");var n=Math.pow(2,r)-1;this.asm.set_mask(0,0,n/4294967296|0,0|n)}else r=48,this.asm.set_mask(0,0,65535,4294967295);if(void 0===e)throw new Error("nonce is required");var i=e.length;if(!i||i>16)throw new a.IllegalArgumentError("illegal nonce size");var s=new DataView(new ArrayBuffer(16));if(new Uint8Array(s.buffer).set(e),this.asm.set_nonce(s.getUint32(0),s.getUint32(4),s.getUint32(8),s.getUint32(12)),void 0!==t){if(t<0||t>=Math.pow(2,r))throw new a.IllegalArgumentError("illegal counter value");this.asm.set_counter(0,0,t/4294967296|0,0|t)}},t}(i.AES);r.AES_CTR=u},{"../other/errors":14,"../other/utils":15,"./aes":3}],7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AES_ECB=void 0;var n,i=e("./aes"),a=e("../other/utils"),s=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=function(e){function t(t,r){return void 0===r&&(r=!1),e.call(this,t,void 0,r,"ECB")||this}return s(t,e),t.encrypt=function(e,r,n){return void 0===n&&(n=!1),new t(r,n).encrypt(e)},t.decrypt=function(e,r,n){return void 0===n&&(n=!1),new t(r,n).decrypt(e)},t.prototype.encrypt=function(e){var t=this.AES_Encrypt_process(e),r=this.AES_Encrypt_finish();return(0,a.joinBytes)(t,r)},t.prototype.decrypt=function(e){var t=this.AES_Decrypt_process(e),r=this.AES_Decrypt_finish();return(0,a.joinBytes)(t,r)},t}(i.AES);r.AES_ECB=o},{"../other/utils":15,"./aes":3}],8:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AES_GCM=void 0;var n,i=e("../other/errors"),a=e("../other/utils"),s=e("./aes"),o=e("./aes.asm"),u=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=68719476704,f=function(e){function t(t,r,n,a){void 0===a&&(a=16);var s=e.call(this,t,void 0,!1,"CTR")||this;if(s.tagSize=a,s.gamma0=0,s.counter=1,s.asm.gcm_init(),s.tagSize<4||s.tagSize>16)throw new i.IllegalArgumentError("illegal tagSize value");var u=r.length||0,f=new Uint8Array(16);12!==u?(s._gcm_mac_process(r),s.heap[0]=0,s.heap[1]=0,s.heap[2]=0,s.heap[3]=0,s.heap[4]=0,s.heap[5]=0,s.heap[6]=0,s.heap[7]=0,s.heap[8]=0,s.heap[9]=0,s.heap[10]=0,s.heap[11]=u>>>29,s.heap[12]=u>>>21&255,s.heap[13]=u>>>13&255,s.heap[14]=u>>>5&255,s.heap[15]=u<<3&255,s.asm.mac(o.AES_asm.MAC.GCM,o.AES_asm.HEAP_DATA,16),s.asm.get_iv(o.AES_asm.HEAP_DATA),s.asm.set_iv(0,0,0,0),f.set(s.heap.subarray(0,16))):(f.set(r),f[15]=1);var d=new DataView(f.buffer);if(s.gamma0=d.getUint32(12),s.asm.set_nonce(d.getUint32(0),d.getUint32(4),d.getUint32(8),0),s.asm.set_mask(0,0,0,4294967295),void 0!==n){if(n.length>c)throw new i.IllegalArgumentError("illegal adata length");n.length?(s.adata=n,s._gcm_mac_process(n)):s.adata=void 0}else s.adata=void 0;if(s.counter<1||s.counter>4294967295)throw new RangeError("counter must be a positive 32-bit integer");return s.asm.set_counter(0,0,0,s.gamma0+s.counter|0),s}return u(t,e),t.encrypt=function(e,r,n,i,a){return new t(r,n,i,a).encrypt(e)},t.decrypt=function(e,r,n,i,a){return new t(r,n,i,a).decrypt(e)},t.prototype.encrypt=function(e){return this.AES_GCM_encrypt(e)},t.prototype.decrypt=function(e){return this.AES_GCM_decrypt(e)},t.prototype.AES_GCM_Encrypt_process=function(e){var t=0,r=e.length||0,n=this.asm,i=this.heap,s=this.counter,u=this.pos,f=this.len,d=0,l=f+r&-16,h=0;if((s-1<<4)+f+r>c)throw new RangeError("counter overflow");for(var p=new Uint8Array(l);r>0;)f+=h=(0,a._heap_write)(i,u+f,e,t,r),t+=h,r-=h,h=n.cipher(o.AES_asm.ENC.CTR,o.AES_asm.HEAP_DATA+u,f),(h=n.mac(o.AES_asm.MAC.GCM,o.AES_asm.HEAP_DATA+u,h))&&p.set(i.subarray(u,u+h),d),s+=h>>>4,d+=h,h>>29,t[4]=f>>>21,t[5]=f>>>13&255,t[6]=f>>>5&255,t[7]=f<<3&255,t[8]=t[9]=t[10]=0,t[11]=d>>>29,t[12]=d>>>21&255,t[13]=d>>>13&255,t[14]=d>>>5&255,t[15]=d<<3&255,e.mac(o.AES_asm.MAC.GCM,o.AES_asm.HEAP_DATA,16),e.get_iv(o.AES_asm.HEAP_DATA),e.set_counter(0,0,0,this.gamma0),e.cipher(o.AES_asm.ENC.CTR,o.AES_asm.HEAP_DATA,16),u.set(t.subarray(0,n),s),this.counter=1,this.pos=0,this.len=0,u},t.prototype.AES_GCM_Decrypt_process=function(e){var t=0,r=e.length||0,n=this.asm,i=this.heap,s=this.counter,u=this.tagSize,f=this.pos,d=this.len,l=0,h=d+r>u?d+r-u&-16:0,p=d+r-h,y=0;if((s-1<<4)+d+r>c)throw new RangeError("counter overflow");for(var b=new Uint8Array(h);r>p;)d+=y=(0,a._heap_write)(i,f+d,e,t,r-p),t+=y,r-=y,y=n.mac(o.AES_asm.MAC.GCM,o.AES_asm.HEAP_DATA+f,y),(y=n.cipher(o.AES_asm.DEC.CTR,o.AES_asm.HEAP_DATA+f,y))&&b.set(i.subarray(f,f+y),l),s+=y>>>4,l+=y,f=0,d=0;return r>0&&(d+=(0,a._heap_write)(i,0,e,t,r)),this.counter=s,this.pos=f,this.len=d,b},t.prototype.AES_GCM_Decrypt_finish=function(){var e=this.asm,t=this.heap,r=this.tagSize,n=this.adata,a=this.counter,s=this.pos,u=this.len,c=u-r;if(u>>29,t[4]=h>>>21,t[5]=h>>>13&255,t[6]=h>>>5&255,t[7]=h<<3&255,t[8]=t[9]=t[10]=0,t[11]=p>>>29,t[12]=p>>>21&255,t[13]=p>>>13&255,t[14]=p>>>5&255,t[15]=p<<3&255,e.mac(o.AES_asm.MAC.GCM,o.AES_asm.HEAP_DATA,16),e.get_iv(o.AES_asm.HEAP_DATA),e.set_counter(0,0,0,this.gamma0),e.cipher(o.AES_asm.ENC.CTR,o.AES_asm.HEAP_DATA,16);for(var y=0,b=0;b0;){for(n+=s=(0,a._heap_write)(t,0,e,n,i),i-=s;15&s;)t[s++]=0;r.mac(o.AES_asm.MAC.GCM,o.AES_asm.HEAP_DATA,s)}},t}(s.AES);r.AES_GCM=f},{"../other/errors":14,"../other/utils":15,"./aes":3,"./aes.asm":2}],9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Hash=void 0;var n=e("../other/utils"),i=e("../other/errors"),a=function(){function e(){this.pos=0,this.len=0,this.acquire_asm()}return e.prototype.acquire_asm=function(){void 0===this.heap&&void 0===this.asm&&(this.heap=this.constructor.heap_pool.pop()||(0,n._heap_init)(),this.asm=this.constructor.asm_pool.pop()||this.constructor.asm_function({Uint8Array:Uint8Array},null,this.heap.buffer),this.reset())},e.prototype.release_asm=function(){this.constructor.heap_pool.push(this.heap),this.constructor.asm_pool.push(this.asm),this.heap=void 0,this.asm=void 0},e.prototype.reset=function(){return this.acquire_asm(),this.result=null,this.pos=0,this.len=0,this.asm.reset(),this},e.prototype.process=function(e){if(null!==this.result)throw new i.IllegalStateError("state must be reset before processing new data");this.acquire_asm();for(var t=this.asm,r=this.heap,a=this.pos,s=this.len,o=0,u=e.length,c=0;u>0;)s+=c=(0,n._heap_write)(r,a+s,e,o,u),o+=c,u-=c,a+=c=t.process(a,s),(s-=c)||(a=0);return this.pos=a,this.len=s,this},e.prototype.finish=function(){if(null!==this.result)throw new i.IllegalStateError("state must be reset before processing new data");return this.acquire_asm(),this.asm.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(this.heap.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this.release_asm(),this},e}();r.Hash=a},{"../other/errors":14,"../other/utils":15}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.sha1_asm=function(e,t,r){"use asm";var n=0,i=0,a=0,s=0,o=0,u=0,c=0;var f=0,d=0,l=0,h=0,p=0,y=0,b=0,m=0,g=0,w=0;var _=new e.Uint8Array(r);function v(e,t,r,u,c,f,d,l,h,p,y,b,m,g,w,_){e=e|0;t=t|0;r=r|0;u=u|0;c=c|0;f=f|0;d=d|0;l=l|0;h=h|0;p=p|0;y=y|0;b=b|0;m=m|0;g=g|0;w=w|0;_=_|0;var v=0,k=0,A=0,S=0,E=0,P=0,x=0,M=0,C=0,K=0,U=0,R=0,B=0,j=0,T=0,I=0,O=0,z=0,D=0,q=0,N=0,F=0,L=0,H=0,W=0,G=0,Z=0,V=0,Y=0,$=0,J=0,X=0,Q=0,ee=0,te=0,re=0,ne=0,ie=0,ae=0,se=0,oe=0,ue=0,ce=0,fe=0,de=0,le=0,he=0,pe=0,ye=0,be=0,me=0,ge=0,we=0,_e=0,ve=0,ke=0,Ae=0,Se=0,Ee=0,Pe=0,xe=0,Me=0,Ce=0,Ke=0,Ue=0,Re=0,Be=0,je=0,Te=0,Ie=0,Oe=0;v=n;k=i;A=a;S=s;E=o;x=e+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=t+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=r+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=u+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=c+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=f+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=d+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=l+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=h+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=p+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=y+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=b+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=m+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=g+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=w+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;x=_+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=g^h^r^e;M=P<<1|P>>>31;x=M+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=w^p^u^t;C=P<<1|P>>>31;x=C+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=_^y^c^r;K=P<<1|P>>>31;x=K+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=M^b^f^u;U=P<<1|P>>>31;x=U+(v<<5|v>>>27)+E+(k&A|~k&S)+0x5a827999|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=C^m^d^c;R=P<<1|P>>>31;x=R+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=K^g^l^f;B=P<<1|P>>>31;x=B+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=U^w^h^d;j=P<<1|P>>>31;x=j+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=R^_^p^l;T=P<<1|P>>>31;x=T+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=B^M^y^h;I=P<<1|P>>>31;x=I+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=j^C^b^p;O=P<<1|P>>>31;x=O+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=T^K^m^y;z=P<<1|P>>>31;x=z+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=I^U^g^b;D=P<<1|P>>>31;x=D+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=O^R^w^m;q=P<<1|P>>>31;x=q+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=z^B^_^g;N=P<<1|P>>>31;x=N+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=D^j^M^w;F=P<<1|P>>>31;x=F+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=q^T^C^_;L=P<<1|P>>>31;x=L+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=N^I^K^M;H=P<<1|P>>>31;x=H+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=F^O^U^C;W=P<<1|P>>>31;x=W+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=L^z^R^K;G=P<<1|P>>>31;x=G+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=H^D^B^U;Z=P<<1|P>>>31;x=Z+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=W^q^j^R;V=P<<1|P>>>31;x=V+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=G^N^T^B;Y=P<<1|P>>>31;x=Y+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Z^F^I^j;$=P<<1|P>>>31;x=$+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=V^L^O^T;J=P<<1|P>>>31;x=J+(v<<5|v>>>27)+E+(k^A^S)+0x6ed9eba1|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Y^H^z^I;X=P<<1|P>>>31;x=X+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=$^W^D^O;Q=P<<1|P>>>31;x=Q+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=J^G^q^z;ee=P<<1|P>>>31;x=ee+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=X^Z^N^D;te=P<<1|P>>>31;x=te+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Q^V^F^q;re=P<<1|P>>>31;x=re+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ee^Y^L^N;ne=P<<1|P>>>31;x=ne+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=te^$^H^F;ie=P<<1|P>>>31;x=ie+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=re^J^W^L;ae=P<<1|P>>>31;x=ae+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ne^X^G^H;se=P<<1|P>>>31;x=se+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ie^Q^Z^W;oe=P<<1|P>>>31;x=oe+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ae^ee^V^G;ue=P<<1|P>>>31;x=ue+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=se^te^Y^Z;ce=P<<1|P>>>31;x=ce+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=oe^re^$^V;fe=P<<1|P>>>31;x=fe+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ue^ne^J^Y;de=P<<1|P>>>31;x=de+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ce^ie^X^$;le=P<<1|P>>>31;x=le+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=fe^ae^Q^J;he=P<<1|P>>>31;x=he+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=de^se^ee^X;pe=P<<1|P>>>31;x=pe+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=le^oe^te^Q;ye=P<<1|P>>>31;x=ye+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=he^ue^re^ee;be=P<<1|P>>>31;x=be+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=pe^ce^ne^te;me=P<<1|P>>>31;x=me+(v<<5|v>>>27)+E+(k&A|k&S|A&S)-0x70e44324|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ye^fe^ie^re;ge=P<<1|P>>>31;x=ge+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=be^de^ae^ne;we=P<<1|P>>>31;x=we+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=me^le^se^ie;_e=P<<1|P>>>31;x=_e+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ge^he^oe^ae;ve=P<<1|P>>>31;x=ve+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=we^pe^ue^se;ke=P<<1|P>>>31;x=ke+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=_e^ye^ce^oe;Ae=P<<1|P>>>31;x=Ae+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ve^be^fe^ue;Se=P<<1|P>>>31;x=Se+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=ke^me^de^ce;Ee=P<<1|P>>>31;x=Ee+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Ae^ge^le^fe;Pe=P<<1|P>>>31;x=Pe+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Se^we^he^de;xe=P<<1|P>>>31;x=xe+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Ee^_e^pe^le;Me=P<<1|P>>>31;x=Me+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Pe^ve^ye^he;Ce=P<<1|P>>>31;x=Ce+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=xe^ke^be^pe;Ke=P<<1|P>>>31;x=Ke+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Me^Ae^me^ye;Ue=P<<1|P>>>31;x=Ue+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Ce^Se^ge^be;Re=P<<1|P>>>31;x=Re+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Ke^Ee^we^me;Be=P<<1|P>>>31;x=Be+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Ue^Pe^_e^ge;je=P<<1|P>>>31;x=je+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Re^xe^ve^we;Te=P<<1|P>>>31;x=Te+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=Be^Me^ke^_e;Ie=P<<1|P>>>31;x=Ie+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;P=je^Ce^Ae^ve;Oe=P<<1|P>>>31;x=Oe+(v<<5|v>>>27)+E+(k^A^S)-0x359d3e2a|0;E=S;S=A;A=k<<30|k>>>2;k=v;v=x;n=n+v|0;i=i+k|0;a=a+A|0;s=s+S|0;o=o+E|0}function k(e){e=e|0;v(_[e|0]<<24|_[e|1]<<16|_[e|2]<<8|_[e|3],_[e|4]<<24|_[e|5]<<16|_[e|6]<<8|_[e|7],_[e|8]<<24|_[e|9]<<16|_[e|10]<<8|_[e|11],_[e|12]<<24|_[e|13]<<16|_[e|14]<<8|_[e|15],_[e|16]<<24|_[e|17]<<16|_[e|18]<<8|_[e|19],_[e|20]<<24|_[e|21]<<16|_[e|22]<<8|_[e|23],_[e|24]<<24|_[e|25]<<16|_[e|26]<<8|_[e|27],_[e|28]<<24|_[e|29]<<16|_[e|30]<<8|_[e|31],_[e|32]<<24|_[e|33]<<16|_[e|34]<<8|_[e|35],_[e|36]<<24|_[e|37]<<16|_[e|38]<<8|_[e|39],_[e|40]<<24|_[e|41]<<16|_[e|42]<<8|_[e|43],_[e|44]<<24|_[e|45]<<16|_[e|46]<<8|_[e|47],_[e|48]<<24|_[e|49]<<16|_[e|50]<<8|_[e|51],_[e|52]<<24|_[e|53]<<16|_[e|54]<<8|_[e|55],_[e|56]<<24|_[e|57]<<16|_[e|58]<<8|_[e|59],_[e|60]<<24|_[e|61]<<16|_[e|62]<<8|_[e|63])}function A(e){e=e|0;_[e|0]=n>>>24;_[e|1]=n>>>16&255;_[e|2]=n>>>8&255;_[e|3]=n&255;_[e|4]=i>>>24;_[e|5]=i>>>16&255;_[e|6]=i>>>8&255;_[e|7]=i&255;_[e|8]=a>>>24;_[e|9]=a>>>16&255;_[e|10]=a>>>8&255;_[e|11]=a&255;_[e|12]=s>>>24;_[e|13]=s>>>16&255;_[e|14]=s>>>8&255;_[e|15]=s&255;_[e|16]=o>>>24;_[e|17]=o>>>16&255;_[e|18]=o>>>8&255;_[e|19]=o&255}function S(){n=0x67452301;i=0xefcdab89;a=0x98badcfe;s=0x10325476;o=0xc3d2e1f0;u=c=0}function E(e,t,r,f,d,l,h){e=e|0;t=t|0;r=r|0;f=f|0;d=d|0;l=l|0;h=h|0;n=e;i=t;a=r;s=f;o=d;u=l;c=h}function P(e,t){e=e|0;t=t|0;var r=0;if(e&63)return-1;while((t|0)>=64){k(e);e=e+64|0;t=t-64|0;r=r+64|0}u=u+r|0;if(u>>>0>>0)c=c+1|0;return r|0}function x(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;if(e&63)return-1;if(~r)if(r&31)return-1;if((t|0)>=64){n=P(e,t)|0;if((n|0)==-1)return-1;e=e+n|0;t=t-n|0}n=n+t|0;u=u+t|0;if(u>>>0>>0)c=c+1|0;_[e|t]=0x80;if((t|0)>=56){for(i=t+1|0;(i|0)<64;i=i+1|0)_[e|i]=0x00;k(e);t=0;_[e|0]=0}for(i=t+1|0;(i|0)<59;i=i+1|0)_[e|i]=0;_[e|56]=c>>>21&255;_[e|57]=c>>>13&255;_[e|58]=c>>>5&255;_[e|59]=c<<3&255|u>>>29;_[e|60]=u>>>21&255;_[e|61]=u>>>13&255;_[e|62]=u>>>5&255;_[e|63]=u<<3&255;k(e);if(~r)A(r);return n|0}function M(){n=f;i=d;a=l;s=h;o=p;u=64;c=0}function C(){n=y;i=b;a=m;s=g;o=w;u=64;c=0}function K(e,t,r,_,k,A,E,P,x,M,C,K,U,R,B,j){e=e|0;t=t|0;r=r|0;_=_|0;k=k|0;A=A|0;E=E|0;P=P|0;x=x|0;M=M|0;C=C|0;K=K|0;U=U|0;R=R|0;B=B|0;j=j|0;S();v(e^0x5c5c5c5c,t^0x5c5c5c5c,r^0x5c5c5c5c,_^0x5c5c5c5c,k^0x5c5c5c5c,A^0x5c5c5c5c,E^0x5c5c5c5c,P^0x5c5c5c5c,x^0x5c5c5c5c,M^0x5c5c5c5c,C^0x5c5c5c5c,K^0x5c5c5c5c,U^0x5c5c5c5c,R^0x5c5c5c5c,B^0x5c5c5c5c,j^0x5c5c5c5c);y=n;b=i;m=a;g=s;w=o;S();v(e^0x36363636,t^0x36363636,r^0x36363636,_^0x36363636,k^0x36363636,A^0x36363636,E^0x36363636,P^0x36363636,x^0x36363636,M^0x36363636,C^0x36363636,K^0x36363636,U^0x36363636,R^0x36363636,B^0x36363636,j^0x36363636);f=n;d=i;l=a;h=s;p=o;u=64;c=0}function U(e,t,r){e=e|0;t=t|0;r=r|0;var u=0,c=0,f=0,d=0,l=0,h=0;if(e&63)return-1;if(~r)if(r&31)return-1;h=x(e,t,-1)|0;u=n,c=i,f=a,d=s,l=o;C();v(u,c,f,d,l,0x80000000,0,0,0,0,0,0,0,0,0,672);if(~r)A(r);return h|0}function R(e,t,r,u,c){e=e|0;t=t|0;r=r|0;u=u|0;c=c|0;var f=0,d=0,l=0,h=0,p=0,y=0,b=0,m=0,g=0,w=0;if(e&63)return-1;if(~c)if(c&31)return-1;_[e+t|0]=r>>>24;_[e+t+1|0]=r>>>16&255;_[e+t+2|0]=r>>>8&255;_[e+t+3|0]=r&255;U(e,t+4|0,-1)|0;f=y=n,d=b=i,l=m=a,h=g=s,p=w=o;u=u-1|0;while((u|0)>0){M();v(y,b,m,g,w,0x80000000,0,0,0,0,0,0,0,0,0,672);y=n,b=i,m=a,g=s,w=o;C();v(y,b,m,g,w,0x80000000,0,0,0,0,0,0,0,0,0,672);y=n,b=i,m=a,g=s,w=o;f=f^n;d=d^i;l=l^a;h=h^s;p=p^o;u=u-1|0}n=f;i=d;a=l;s=h;o=p;if(~c)A(c);return 0}return{reset:S,init:E,process:P,finish:x,hmac_reset:M,hmac_init:K,hmac_finish:U,pbkdf2_generate_block:R}}},{}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Sha1=r._sha1_hash_size=r._sha1_block_size=void 0;var n,i=e("./sha1.asm"),a=e("../hash"),s=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=r._sha1_block_size=64,u=r._sha1_hash_size=20,c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.NAME="sha1",t.BLOCK_SIZE=o,t.HASH_SIZE=u,t}return s(t,e),t.bytes=function(e){return(new t).process(e).finish().result},t.NAME="sha1",t.heap_pool=[],t.asm_pool=[],t.asm_function=i.sha1_asm,t}(a.Hash);r.Sha1=c},{"../hash":9,"./sha1.asm":10}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.sha256_asm=function(e,t,r){"use asm";var n=0,i=0,a=0,s=0,o=0,u=0,c=0,f=0,d=0,l=0;var h=0,p=0,y=0,b=0,m=0,g=0,w=0,_=0,v=0,k=0,A=0,S=0,E=0,P=0,x=0,M=0;var C=new e.Uint8Array(r);function K(e,t,r,d,l,h,p,y,b,m,g,w,_,v,k,A){e=e|0;t=t|0;r=r|0;d=d|0;l=l|0;h=h|0;p=p|0;y=y|0;b=b|0;m=m|0;g=g|0;w=w|0;_=_|0;v=v|0;k=k|0;A=A|0;var S=0,E=0,P=0,x=0,M=0,C=0,K=0,U=0;S=n;E=i;P=a;x=s;M=o;C=u;K=c;U=f;U=e+U+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(K^M&(C^K))+0x428a2f98|0;x=x+U|0;U=U+(S&E^P&(S^E))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;K=t+K+(x>>>6^x>>>11^x>>>25^x<<26^x<<21^x<<7)+(C^x&(M^C))+0x71374491|0;P=P+K|0;K=K+(U&S^E&(U^S))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;C=r+C+(P>>>6^P>>>11^P>>>25^P<<26^P<<21^P<<7)+(M^P&(x^M))+0xb5c0fbcf|0;E=E+C|0;C=C+(K&U^S&(K^U))+(K>>>2^K>>>13^K>>>22^K<<30^K<<19^K<<10)|0;M=d+M+(E>>>6^E>>>11^E>>>25^E<<26^E<<21^E<<7)+(x^E&(P^x))+0xe9b5dba5|0;S=S+M|0;M=M+(C&K^U&(C^K))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;x=l+x+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(P^S&(E^P))+0x3956c25b|0;U=U+x|0;x=x+(M&C^K&(M^C))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;P=h+P+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(E^U&(S^E))+0x59f111f1|0;K=K+P|0;P=P+(x&M^C&(x^M))+(x>>>2^x>>>13^x>>>22^x<<30^x<<19^x<<10)|0;E=p+E+(K>>>6^K>>>11^K>>>25^K<<26^K<<21^K<<7)+(S^K&(U^S))+0x923f82a4|0;C=C+E|0;E=E+(P&x^M&(P^x))+(P>>>2^P>>>13^P>>>22^P<<30^P<<19^P<<10)|0;S=y+S+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(K^U))+0xab1c5ed5|0;M=M+S|0;S=S+(E&P^x&(E^P))+(E>>>2^E>>>13^E>>>22^E<<30^E<<19^E<<10)|0;U=b+U+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(K^M&(C^K))+0xd807aa98|0;x=x+U|0;U=U+(S&E^P&(S^E))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;K=m+K+(x>>>6^x>>>11^x>>>25^x<<26^x<<21^x<<7)+(C^x&(M^C))+0x12835b01|0;P=P+K|0;K=K+(U&S^E&(U^S))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;C=g+C+(P>>>6^P>>>11^P>>>25^P<<26^P<<21^P<<7)+(M^P&(x^M))+0x243185be|0;E=E+C|0;C=C+(K&U^S&(K^U))+(K>>>2^K>>>13^K>>>22^K<<30^K<<19^K<<10)|0;M=w+M+(E>>>6^E>>>11^E>>>25^E<<26^E<<21^E<<7)+(x^E&(P^x))+0x550c7dc3|0;S=S+M|0;M=M+(C&K^U&(C^K))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;x=_+x+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(P^S&(E^P))+0x72be5d74|0;U=U+x|0;x=x+(M&C^K&(M^C))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;P=v+P+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(E^U&(S^E))+0x80deb1fe|0;K=K+P|0;P=P+(x&M^C&(x^M))+(x>>>2^x>>>13^x>>>22^x<<30^x<<19^x<<10)|0;E=k+E+(K>>>6^K>>>11^K>>>25^K<<26^K<<21^K<<7)+(S^K&(U^S))+0x9bdc06a7|0;C=C+E|0;E=E+(P&x^M&(P^x))+(P>>>2^P>>>13^P>>>22^P<<30^P<<19^P<<10)|0;S=A+S+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(K^U))+0xc19bf174|0;M=M+S|0;S=S+(E&P^x&(E^P))+(E>>>2^E>>>13^E>>>22^E<<30^E<<19^E<<10)|0;e=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(k>>>17^k>>>19^k>>>10^k<<15^k<<13)+e+m|0;U=e+U+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(K^M&(C^K))+0xe49b69c1|0;x=x+U|0;U=U+(S&E^P&(S^E))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;t=(r>>>7^r>>>18^r>>>3^r<<25^r<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+t+g|0;K=t+K+(x>>>6^x>>>11^x>>>25^x<<26^x<<21^x<<7)+(C^x&(M^C))+0xefbe4786|0;P=P+K|0;K=K+(U&S^E&(U^S))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;r=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+r+w|0;C=r+C+(P>>>6^P>>>11^P>>>25^P<<26^P<<21^P<<7)+(M^P&(x^M))+0x0fc19dc6|0;E=E+C|0;C=C+(K&U^S&(K^U))+(K>>>2^K>>>13^K>>>22^K<<30^K<<19^K<<10)|0;d=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+_|0;M=d+M+(E>>>6^E>>>11^E>>>25^E<<26^E<<21^E<<7)+(x^E&(P^x))+0x240ca1cc|0;S=S+M|0;M=M+(C&K^U&(C^K))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;l=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+l+v|0;x=l+x+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(P^S&(E^P))+0x2de92c6f|0;U=U+x|0;x=x+(M&C^K&(M^C))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;h=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+h+k|0;P=h+P+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(E^U&(S^E))+0x4a7484aa|0;K=K+P|0;P=P+(x&M^C&(x^M))+(x>>>2^x>>>13^x>>>22^x<<30^x<<19^x<<10)|0;p=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+p+A|0;E=p+E+(K>>>6^K>>>11^K>>>25^K<<26^K<<21^K<<7)+(S^K&(U^S))+0x5cb0a9dc|0;C=C+E|0;E=E+(P&x^M&(P^x))+(P>>>2^P>>>13^P>>>22^P<<30^P<<19^P<<10)|0;y=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+y+e|0;S=y+S+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(K^U))+0x76f988da|0;M=M+S|0;S=S+(E&P^x&(E^P))+(E>>>2^E>>>13^E>>>22^E<<30^E<<19^E<<10)|0;b=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+b+t|0;U=b+U+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(K^M&(C^K))+0x983e5152|0;x=x+U|0;U=U+(S&E^P&(S^E))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;m=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+m+r|0;K=m+K+(x>>>6^x>>>11^x>>>25^x<<26^x<<21^x<<7)+(C^x&(M^C))+0xa831c66d|0;P=P+K|0;K=K+(U&S^E&(U^S))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;g=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+g+d|0;C=g+C+(P>>>6^P>>>11^P>>>25^P<<26^P<<21^P<<7)+(M^P&(x^M))+0xb00327c8|0;E=E+C|0;C=C+(K&U^S&(K^U))+(K>>>2^K>>>13^K>>>22^K<<30^K<<19^K<<10)|0;w=(_>>>7^_>>>18^_>>>3^_<<25^_<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+w+l|0;M=w+M+(E>>>6^E>>>11^E>>>25^E<<26^E<<21^E<<7)+(x^E&(P^x))+0xbf597fc7|0;S=S+M|0;M=M+(C&K^U&(C^K))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;_=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+_+h|0;x=_+x+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(P^S&(E^P))+0xc6e00bf3|0;U=U+x|0;x=x+(M&C^K&(M^C))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;v=(k>>>7^k>>>18^k>>>3^k<<25^k<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+v+p|0;P=v+P+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(E^U&(S^E))+0xd5a79147|0;K=K+P|0;P=P+(x&M^C&(x^M))+(x>>>2^x>>>13^x>>>22^x<<30^x<<19^x<<10)|0;k=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(_>>>17^_>>>19^_>>>10^_<<15^_<<13)+k+y|0;E=k+E+(K>>>6^K>>>11^K>>>25^K<<26^K<<21^K<<7)+(S^K&(U^S))+0x06ca6351|0;C=C+E|0;E=E+(P&x^M&(P^x))+(P>>>2^P>>>13^P>>>22^P<<30^P<<19^P<<10)|0;A=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+A+b|0;S=A+S+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(K^U))+0x14292967|0;M=M+S|0;S=S+(E&P^x&(E^P))+(E>>>2^E>>>13^E>>>22^E<<30^E<<19^E<<10)|0;e=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(k>>>17^k>>>19^k>>>10^k<<15^k<<13)+e+m|0;U=e+U+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(K^M&(C^K))+0x27b70a85|0;x=x+U|0;U=U+(S&E^P&(S^E))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;t=(r>>>7^r>>>18^r>>>3^r<<25^r<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+t+g|0;K=t+K+(x>>>6^x>>>11^x>>>25^x<<26^x<<21^x<<7)+(C^x&(M^C))+0x2e1b2138|0;P=P+K|0;K=K+(U&S^E&(U^S))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;r=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+r+w|0;C=r+C+(P>>>6^P>>>11^P>>>25^P<<26^P<<21^P<<7)+(M^P&(x^M))+0x4d2c6dfc|0;E=E+C|0;C=C+(K&U^S&(K^U))+(K>>>2^K>>>13^K>>>22^K<<30^K<<19^K<<10)|0;d=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+_|0;M=d+M+(E>>>6^E>>>11^E>>>25^E<<26^E<<21^E<<7)+(x^E&(P^x))+0x53380d13|0;S=S+M|0;M=M+(C&K^U&(C^K))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;l=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+l+v|0;x=l+x+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(P^S&(E^P))+0x650a7354|0;U=U+x|0;x=x+(M&C^K&(M^C))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;h=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+h+k|0;P=h+P+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(E^U&(S^E))+0x766a0abb|0;K=K+P|0;P=P+(x&M^C&(x^M))+(x>>>2^x>>>13^x>>>22^x<<30^x<<19^x<<10)|0;p=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+p+A|0;E=p+E+(K>>>6^K>>>11^K>>>25^K<<26^K<<21^K<<7)+(S^K&(U^S))+0x81c2c92e|0;C=C+E|0;E=E+(P&x^M&(P^x))+(P>>>2^P>>>13^P>>>22^P<<30^P<<19^P<<10)|0;y=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+y+e|0;S=y+S+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(K^U))+0x92722c85|0;M=M+S|0;S=S+(E&P^x&(E^P))+(E>>>2^E>>>13^E>>>22^E<<30^E<<19^E<<10)|0;b=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+b+t|0;U=b+U+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(K^M&(C^K))+0xa2bfe8a1|0;x=x+U|0;U=U+(S&E^P&(S^E))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;m=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+m+r|0;K=m+K+(x>>>6^x>>>11^x>>>25^x<<26^x<<21^x<<7)+(C^x&(M^C))+0xa81a664b|0;P=P+K|0;K=K+(U&S^E&(U^S))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;g=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+g+d|0;C=g+C+(P>>>6^P>>>11^P>>>25^P<<26^P<<21^P<<7)+(M^P&(x^M))+0xc24b8b70|0;E=E+C|0;C=C+(K&U^S&(K^U))+(K>>>2^K>>>13^K>>>22^K<<30^K<<19^K<<10)|0;w=(_>>>7^_>>>18^_>>>3^_<<25^_<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+w+l|0;M=w+M+(E>>>6^E>>>11^E>>>25^E<<26^E<<21^E<<7)+(x^E&(P^x))+0xc76c51a3|0;S=S+M|0;M=M+(C&K^U&(C^K))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;_=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+_+h|0;x=_+x+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(P^S&(E^P))+0xd192e819|0;U=U+x|0;x=x+(M&C^K&(M^C))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;v=(k>>>7^k>>>18^k>>>3^k<<25^k<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+v+p|0;P=v+P+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(E^U&(S^E))+0xd6990624|0;K=K+P|0;P=P+(x&M^C&(x^M))+(x>>>2^x>>>13^x>>>22^x<<30^x<<19^x<<10)|0;k=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(_>>>17^_>>>19^_>>>10^_<<15^_<<13)+k+y|0;E=k+E+(K>>>6^K>>>11^K>>>25^K<<26^K<<21^K<<7)+(S^K&(U^S))+0xf40e3585|0;C=C+E|0;E=E+(P&x^M&(P^x))+(P>>>2^P>>>13^P>>>22^P<<30^P<<19^P<<10)|0;A=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+A+b|0;S=A+S+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(K^U))+0x106aa070|0;M=M+S|0;S=S+(E&P^x&(E^P))+(E>>>2^E>>>13^E>>>22^E<<30^E<<19^E<<10)|0;e=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(k>>>17^k>>>19^k>>>10^k<<15^k<<13)+e+m|0;U=e+U+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(K^M&(C^K))+0x19a4c116|0;x=x+U|0;U=U+(S&E^P&(S^E))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;t=(r>>>7^r>>>18^r>>>3^r<<25^r<<14)+(A>>>17^A>>>19^A>>>10^A<<15^A<<13)+t+g|0;K=t+K+(x>>>6^x>>>11^x>>>25^x<<26^x<<21^x<<7)+(C^x&(M^C))+0x1e376c08|0;P=P+K|0;K=K+(U&S^E&(U^S))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;r=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+r+w|0;C=r+C+(P>>>6^P>>>11^P>>>25^P<<26^P<<21^P<<7)+(M^P&(x^M))+0x2748774c|0;E=E+C|0;C=C+(K&U^S&(K^U))+(K>>>2^K>>>13^K>>>22^K<<30^K<<19^K<<10)|0;d=(l>>>7^l>>>18^l>>>3^l<<25^l<<14)+(t>>>17^t>>>19^t>>>10^t<<15^t<<13)+d+_|0;M=d+M+(E>>>6^E>>>11^E>>>25^E<<26^E<<21^E<<7)+(x^E&(P^x))+0x34b0bcb5|0;S=S+M|0;M=M+(C&K^U&(C^K))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;l=(h>>>7^h>>>18^h>>>3^h<<25^h<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+l+v|0;x=l+x+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(P^S&(E^P))+0x391c0cb3|0;U=U+x|0;x=x+(M&C^K&(M^C))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;h=(p>>>7^p>>>18^p>>>3^p<<25^p<<14)+(d>>>17^d>>>19^d>>>10^d<<15^d<<13)+h+k|0;P=h+P+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(E^U&(S^E))+0x4ed8aa4a|0;K=K+P|0;P=P+(x&M^C&(x^M))+(x>>>2^x>>>13^x>>>22^x<<30^x<<19^x<<10)|0;p=(y>>>7^y>>>18^y>>>3^y<<25^y<<14)+(l>>>17^l>>>19^l>>>10^l<<15^l<<13)+p+A|0;E=p+E+(K>>>6^K>>>11^K>>>25^K<<26^K<<21^K<<7)+(S^K&(U^S))+0x5b9cca4f|0;C=C+E|0;E=E+(P&x^M&(P^x))+(P>>>2^P>>>13^P>>>22^P<<30^P<<19^P<<10)|0;y=(b>>>7^b>>>18^b>>>3^b<<25^b<<14)+(h>>>17^h>>>19^h>>>10^h<<15^h<<13)+y+e|0;S=y+S+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(K^U))+0x682e6ff3|0;M=M+S|0;S=S+(E&P^x&(E^P))+(E>>>2^E>>>13^E>>>22^E<<30^E<<19^E<<10)|0;b=(m>>>7^m>>>18^m>>>3^m<<25^m<<14)+(p>>>17^p>>>19^p>>>10^p<<15^p<<13)+b+t|0;U=b+U+(M>>>6^M>>>11^M>>>25^M<<26^M<<21^M<<7)+(K^M&(C^K))+0x748f82ee|0;x=x+U|0;U=U+(S&E^P&(S^E))+(S>>>2^S>>>13^S>>>22^S<<30^S<<19^S<<10)|0;m=(g>>>7^g>>>18^g>>>3^g<<25^g<<14)+(y>>>17^y>>>19^y>>>10^y<<15^y<<13)+m+r|0;K=m+K+(x>>>6^x>>>11^x>>>25^x<<26^x<<21^x<<7)+(C^x&(M^C))+0x78a5636f|0;P=P+K|0;K=K+(U&S^E&(U^S))+(U>>>2^U>>>13^U>>>22^U<<30^U<<19^U<<10)|0;g=(w>>>7^w>>>18^w>>>3^w<<25^w<<14)+(b>>>17^b>>>19^b>>>10^b<<15^b<<13)+g+d|0;C=g+C+(P>>>6^P>>>11^P>>>25^P<<26^P<<21^P<<7)+(M^P&(x^M))+0x84c87814|0;E=E+C|0;C=C+(K&U^S&(K^U))+(K>>>2^K>>>13^K>>>22^K<<30^K<<19^K<<10)|0;w=(_>>>7^_>>>18^_>>>3^_<<25^_<<14)+(m>>>17^m>>>19^m>>>10^m<<15^m<<13)+w+l|0;M=w+M+(E>>>6^E>>>11^E>>>25^E<<26^E<<21^E<<7)+(x^E&(P^x))+0x8cc70208|0;S=S+M|0;M=M+(C&K^U&(C^K))+(C>>>2^C>>>13^C>>>22^C<<30^C<<19^C<<10)|0;_=(v>>>7^v>>>18^v>>>3^v<<25^v<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+_+h|0;x=_+x+(S>>>6^S>>>11^S>>>25^S<<26^S<<21^S<<7)+(P^S&(E^P))+0x90befffa|0;U=U+x|0;x=x+(M&C^K&(M^C))+(M>>>2^M>>>13^M>>>22^M<<30^M<<19^M<<10)|0;v=(k>>>7^k>>>18^k>>>3^k<<25^k<<14)+(w>>>17^w>>>19^w>>>10^w<<15^w<<13)+v+p|0;P=v+P+(U>>>6^U>>>11^U>>>25^U<<26^U<<21^U<<7)+(E^U&(S^E))+0xa4506ceb|0;K=K+P|0;P=P+(x&M^C&(x^M))+(x>>>2^x>>>13^x>>>22^x<<30^x<<19^x<<10)|0;k=(A>>>7^A>>>18^A>>>3^A<<25^A<<14)+(_>>>17^_>>>19^_>>>10^_<<15^_<<13)+k+y|0;E=k+E+(K>>>6^K>>>11^K>>>25^K<<26^K<<21^K<<7)+(S^K&(U^S))+0xbef9a3f7|0;C=C+E|0;E=E+(P&x^M&(P^x))+(P>>>2^P>>>13^P>>>22^P<<30^P<<19^P<<10)|0;A=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(v>>>17^v>>>19^v>>>10^v<<15^v<<13)+A+b|0;S=A+S+(C>>>6^C>>>11^C>>>25^C<<26^C<<21^C<<7)+(U^C&(K^U))+0xc67178f2|0;M=M+S|0;S=S+(E&P^x&(E^P))+(E>>>2^E>>>13^E>>>22^E<<30^E<<19^E<<10)|0;n=n+S|0;i=i+E|0;a=a+P|0;s=s+x|0;o=o+M|0;u=u+C|0;c=c+K|0;f=f+U|0}function U(e){e=e|0;K(C[e|0]<<24|C[e|1]<<16|C[e|2]<<8|C[e|3],C[e|4]<<24|C[e|5]<<16|C[e|6]<<8|C[e|7],C[e|8]<<24|C[e|9]<<16|C[e|10]<<8|C[e|11],C[e|12]<<24|C[e|13]<<16|C[e|14]<<8|C[e|15],C[e|16]<<24|C[e|17]<<16|C[e|18]<<8|C[e|19],C[e|20]<<24|C[e|21]<<16|C[e|22]<<8|C[e|23],C[e|24]<<24|C[e|25]<<16|C[e|26]<<8|C[e|27],C[e|28]<<24|C[e|29]<<16|C[e|30]<<8|C[e|31],C[e|32]<<24|C[e|33]<<16|C[e|34]<<8|C[e|35],C[e|36]<<24|C[e|37]<<16|C[e|38]<<8|C[e|39],C[e|40]<<24|C[e|41]<<16|C[e|42]<<8|C[e|43],C[e|44]<<24|C[e|45]<<16|C[e|46]<<8|C[e|47],C[e|48]<<24|C[e|49]<<16|C[e|50]<<8|C[e|51],C[e|52]<<24|C[e|53]<<16|C[e|54]<<8|C[e|55],C[e|56]<<24|C[e|57]<<16|C[e|58]<<8|C[e|59],C[e|60]<<24|C[e|61]<<16|C[e|62]<<8|C[e|63])}function R(e){e=e|0;C[e|0]=n>>>24;C[e|1]=n>>>16&255;C[e|2]=n>>>8&255;C[e|3]=n&255;C[e|4]=i>>>24;C[e|5]=i>>>16&255;C[e|6]=i>>>8&255;C[e|7]=i&255;C[e|8]=a>>>24;C[e|9]=a>>>16&255;C[e|10]=a>>>8&255;C[e|11]=a&255;C[e|12]=s>>>24;C[e|13]=s>>>16&255;C[e|14]=s>>>8&255;C[e|15]=s&255;C[e|16]=o>>>24;C[e|17]=o>>>16&255;C[e|18]=o>>>8&255;C[e|19]=o&255;C[e|20]=u>>>24;C[e|21]=u>>>16&255;C[e|22]=u>>>8&255;C[e|23]=u&255;C[e|24]=c>>>24;C[e|25]=c>>>16&255;C[e|26]=c>>>8&255;C[e|27]=c&255;C[e|28]=f>>>24;C[e|29]=f>>>16&255;C[e|30]=f>>>8&255;C[e|31]=f&255}function B(){n=0x6a09e667;i=0xbb67ae85;a=0x3c6ef372;s=0xa54ff53a;o=0x510e527f;u=0x9b05688c;c=0x1f83d9ab;f=0x5be0cd19;d=l=0}function j(e,t,r,h,p,y,b,m,g,w){e=e|0;t=t|0;r=r|0;h=h|0;p=p|0;y=y|0;b=b|0;m=m|0;g=g|0;w=w|0;n=e;i=t;a=r;s=h;o=p;u=y;c=b;f=m;d=g;l=w}function T(e,t){e=e|0;t=t|0;var r=0;if(e&63)return-1;while((t|0)>=64){U(e);e=e+64|0;t=t-64|0;r=r+64|0}d=d+r|0;if(d>>>0>>0)l=l+1|0;return r|0}function I(e,t,r){e=e|0;t=t|0;r=r|0;var n=0,i=0;if(e&63)return-1;if(~r)if(r&31)return-1;if((t|0)>=64){n=T(e,t)|0;if((n|0)==-1)return-1;e=e+n|0;t=t-n|0}n=n+t|0;d=d+t|0;if(d>>>0>>0)l=l+1|0;C[e|t]=0x80;if((t|0)>=56){for(i=t+1|0;(i|0)<64;i=i+1|0)C[e|i]=0x00;U(e);t=0;C[e|0]=0}for(i=t+1|0;(i|0)<59;i=i+1|0)C[e|i]=0;C[e|56]=l>>>21&255;C[e|57]=l>>>13&255;C[e|58]=l>>>5&255;C[e|59]=l<<3&255|d>>>29;C[e|60]=d>>>21&255;C[e|61]=d>>>13&255;C[e|62]=d>>>5&255;C[e|63]=d<<3&255;U(e);if(~r)R(r);return n|0}function O(){n=h;i=p;a=y;s=b;o=m;u=g;c=w;f=_;d=64;l=0}function z(){n=v;i=k;a=A;s=S;o=E;u=P;c=x;f=M;d=64;l=0}function D(e,t,r,C,U,R,j,T,I,O,z,D,q,N,F,L){e=e|0;t=t|0;r=r|0;C=C|0;U=U|0;R=R|0;j=j|0;T=T|0;I=I|0;O=O|0;z=z|0;D=D|0;q=q|0;N=N|0;F=F|0;L=L|0;B();K(e^0x5c5c5c5c,t^0x5c5c5c5c,r^0x5c5c5c5c,C^0x5c5c5c5c,U^0x5c5c5c5c,R^0x5c5c5c5c,j^0x5c5c5c5c,T^0x5c5c5c5c,I^0x5c5c5c5c,O^0x5c5c5c5c,z^0x5c5c5c5c,D^0x5c5c5c5c,q^0x5c5c5c5c,N^0x5c5c5c5c,F^0x5c5c5c5c,L^0x5c5c5c5c);v=n;k=i;A=a;S=s;E=o;P=u;x=c;M=f;B();K(e^0x36363636,t^0x36363636,r^0x36363636,C^0x36363636,U^0x36363636,R^0x36363636,j^0x36363636,T^0x36363636,I^0x36363636,O^0x36363636,z^0x36363636,D^0x36363636,q^0x36363636,N^0x36363636,F^0x36363636,L^0x36363636);h=n;p=i;y=a;b=s;m=o;g=u;w=c;_=f;d=64;l=0}function q(e,t,r){e=e|0;t=t|0;r=r|0;var d=0,l=0,h=0,p=0,y=0,b=0,m=0,g=0,w=0;if(e&63)return-1;if(~r)if(r&31)return-1;w=I(e,t,-1)|0;d=n,l=i,h=a,p=s,y=o,b=u,m=c,g=f;z();K(d,l,h,p,y,b,m,g,0x80000000,0,0,0,0,0,0,768);if(~r)R(r);return w|0}function N(e,t,r,d,l){e=e|0;t=t|0;r=r|0;d=d|0;l=l|0;var h=0,p=0,y=0,b=0,m=0,g=0,w=0,_=0,v=0,k=0,A=0,S=0,E=0,P=0,x=0,M=0;if(e&63)return-1;if(~l)if(l&31)return-1;C[e+t|0]=r>>>24;C[e+t+1|0]=r>>>16&255;C[e+t+2|0]=r>>>8&255;C[e+t+3|0]=r&255;q(e,t+4|0,-1)|0;h=v=n,p=k=i,y=A=a,b=S=s,m=E=o,g=P=u,w=x=c,_=M=f;d=d-1|0;while((d|0)>0){O();K(v,k,A,S,E,P,x,M,0x80000000,0,0,0,0,0,0,768);v=n,k=i,A=a,S=s,E=o,P=u,x=c,M=f;z();K(v,k,A,S,E,P,x,M,0x80000000,0,0,0,0,0,0,768);v=n,k=i,A=a,S=s,E=o,P=u,x=c,M=f;h=h^n;p=p^i;y=y^a;b=b^s;m=m^o;g=g^u;w=w^c;_=_^f;d=d-1|0}n=h;i=p;a=y;s=b;o=m;u=g;c=w;f=_;if(~l)R(l);return 0}return{reset:B,init:j,process:T,finish:I,hmac_reset:O,hmac_init:D,hmac_finish:q,pbkdf2_generate_block:N}}},{}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Sha256=r._sha256_hash_size=r._sha256_block_size=void 0;var n,i=e("./sha256.asm"),a=e("../hash"),s=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=r._sha256_block_size=64,u=r._sha256_hash_size=32,c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.NAME="sha256",t.BLOCK_SIZE=o,t.HASH_SIZE=u,t}return s(t,e),t.bytes=function(e){return(new t).process(e).finish().result},t.NAME="sha256",t.heap_pool=[],t.asm_pool=[],t.asm_function=i.sha256_asm,t}(a.Hash);r.Sha256=c},{"../hash":9,"./sha256.asm":12}],14:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=function(e){function t(){for(var t=[],r=0;r>1),n=0;n>1]=parseInt(e.substr(n,2),16);return r},r.base64_to_bytes=function(e){return a(n(e))},r.bytes_to_string=s,r.bytes_to_hex=function(e){for(var t="",r=0;r>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+=1},r.is_number=function(e){return"number"==typeof e},r.is_string=function(e){return"string"==typeof e},r.is_buffer=function(e){return e instanceof ArrayBuffer},r.is_bytes=function(e){return e instanceof Uint8Array},r.is_typed_array=function(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array},r._heap_init=function(e,t){var r=e?e.byteLength:t||65536;if(4095&r||r<=0)throw new Error("heap size must be a positive integer and a multiple of 4096");return e=e||new Uint8Array(new ArrayBuffer(r))},r._heap_write=function(e,t,r,n,i){var a=e.length-t,s=a=r)throw new Error("Malformed string, low surrogate expected at position "+i);s=(55296^s)<<10|65536|56320^e.charCodeAt(i)}else if(!t&&s>>>8)throw new Error("Wide characters are not allowed.");!t||s<=127?n[a++]=s:s<=2047?(n[a++]=192|s>>6,n[a++]=128|63&s):s<=65535?(n[a++]=224|s>>12,n[a++]=128|s>>6&63,n[a++]=128|63&s):(n[a++]=240|s>>18,n[a++]=128|s>>12&63,n[a++]=128|s>>6&63,n[a++]=128|63&s)}return n.subarray(0,a)}function s(e,t){void 0===t&&(t=!1);for(var r=e.length,n=new Array(r),i=0,a=0;i=192&&s<224&&i+1=224&&s<240&&i+2=240&&s<248&&i+3>10,n[a++]=56320|1023&o)}}var u="";for(i=0;i=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function u(e,t,r,n){for(var i=0,a=Math.min(e.length,r),s=t;s=49?o-49+10:o>=17?o-17+10:o}return i}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=s<>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=6)i=o(e,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==t&&(i=o(e,t,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var a=e.length-r,s=a%n,o=Math.min(a,a-s)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],a=0|t.words[0],s=i*a,o=67108863&s,u=s/67108864|0;r.words[0]=o;for(var c=1;c>>26,d=67108863&u,l=Math.min(c,t.length-1),h=Math.max(0,c-e.length+1);h<=l;h++){var p=c-h|0;f+=(s=(i=0|e.words[p])*(a=0|t.words[h])+d)/67108864|0,d=67108863&s}r.words[c]=0|d,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,a=0,s=0;s>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?y+r:c[l-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return n(void 0!==s),this.toArrayLike(s,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var s,o,u="le"===t,c=new e(a),f=this.clone();if(u){for(o=0;!f.isZero();o++)s=f.andln(255),f.iushrn(8),c[o]=s;for(;o=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ae.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var a=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==a&&s>26,this.words[s]=67108863&t;if(0===a&&s>>13,h=0|s[1],p=8191&h,y=h>>>13,b=0|s[2],m=8191&b,g=b>>>13,w=0|s[3],_=8191&w,v=w>>>13,k=0|s[4],A=8191&k,S=k>>>13,E=0|s[5],P=8191&E,x=E>>>13,M=0|s[6],C=8191&M,K=M>>>13,U=0|s[7],R=8191&U,B=U>>>13,j=0|s[8],T=8191&j,I=j>>>13,O=0|s[9],z=8191&O,D=O>>>13,q=0|o[0],N=8191&q,F=q>>>13,L=0|o[1],H=8191&L,W=L>>>13,G=0|o[2],Z=8191&G,V=G>>>13,Y=0|o[3],$=8191&Y,J=Y>>>13,X=0|o[4],Q=8191&X,ee=X>>>13,te=0|o[5],re=8191&te,ne=te>>>13,ie=0|o[6],ae=8191&ie,se=ie>>>13,oe=0|o[7],ue=8191&oe,ce=oe>>>13,fe=0|o[8],de=8191&fe,le=fe>>>13,he=0|o[9],pe=8191&he,ye=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(c+(n=Math.imul(d,N))|0)+((8191&(i=(i=Math.imul(d,F))+Math.imul(l,N)|0))<<13)|0;c=((a=Math.imul(l,F))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,N),i=(i=Math.imul(p,F))+Math.imul(y,N)|0,a=Math.imul(y,F);var me=(c+(n=n+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,W)|0)+Math.imul(l,H)|0))<<13)|0;c=((a=a+Math.imul(l,W)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,N),i=(i=Math.imul(m,F))+Math.imul(g,N)|0,a=Math.imul(g,F),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(y,H)|0,a=a+Math.imul(y,W)|0;var ge=(c+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(l,Z)|0))<<13)|0;c=((a=a+Math.imul(l,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(_,N),i=(i=Math.imul(_,F))+Math.imul(v,N)|0,a=Math.imul(v,F),n=n+Math.imul(m,H)|0,i=(i=i+Math.imul(m,W)|0)+Math.imul(g,H)|0,a=a+Math.imul(g,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,Z)|0,a=a+Math.imul(y,V)|0;var we=(c+(n=n+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,J)|0)+Math.imul(l,$)|0))<<13)|0;c=((a=a+Math.imul(l,J)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(A,N),i=(i=Math.imul(A,F))+Math.imul(S,N)|0,a=Math.imul(S,F),n=n+Math.imul(_,H)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(v,H)|0,a=a+Math.imul(v,W)|0,n=n+Math.imul(m,Z)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(g,Z)|0,a=a+Math.imul(g,V)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,J)|0;var _e=(c+(n=n+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(l,Q)|0))<<13)|0;c=((a=a+Math.imul(l,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(P,N),i=(i=Math.imul(P,F))+Math.imul(x,N)|0,a=Math.imul(x,F),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(S,H)|0,a=a+Math.imul(S,W)|0,n=n+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(v,Z)|0,a=a+Math.imul(v,V)|0,n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,J)|0)+Math.imul(g,$)|0,a=a+Math.imul(g,J)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,ee)|0;var ve=(c+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(l,re)|0))<<13)|0;c=((a=a+Math.imul(l,ne)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(C,N),i=(i=Math.imul(C,F))+Math.imul(K,N)|0,a=Math.imul(K,F),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(x,H)|0,a=a+Math.imul(x,W)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(S,Z)|0,a=a+Math.imul(S,V)|0,n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(v,$)|0,a=a+Math.imul(v,J)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(y,re)|0,a=a+Math.imul(y,ne)|0;var ke=(c+(n=n+Math.imul(d,ae)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(l,ae)|0))<<13)|0;c=((a=a+Math.imul(l,se)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(R,N),i=(i=Math.imul(R,F))+Math.imul(B,N)|0,a=Math.imul(B,F),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(K,H)|0,a=a+Math.imul(K,W)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,V)|0)+Math.imul(x,Z)|0,a=a+Math.imul(x,V)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,J)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,J)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(v,Q)|0,a=a+Math.imul(v,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(p,ae)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(y,ae)|0,a=a+Math.imul(y,se)|0;var Ae=(c+(n=n+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(l,ue)|0))<<13)|0;c=((a=a+Math.imul(l,ce)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(T,N),i=(i=Math.imul(T,F))+Math.imul(I,N)|0,a=Math.imul(I,F),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(B,H)|0,a=a+Math.imul(B,W)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(K,Z)|0,a=a+Math.imul(K,V)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(x,$)|0,a=a+Math.imul(x,J)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(v,re)|0,a=a+Math.imul(v,ne)|0,n=n+Math.imul(m,ae)|0,i=(i=i+Math.imul(m,se)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,se)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(y,ue)|0,a=a+Math.imul(y,ce)|0;var Se=(c+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(l,de)|0))<<13)|0;c=((a=a+Math.imul(l,le)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(z,N),i=(i=Math.imul(z,F))+Math.imul(D,N)|0,a=Math.imul(D,F),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(I,H)|0,a=a+Math.imul(I,W)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(B,Z)|0,a=a+Math.imul(B,V)|0,n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(K,$)|0,a=a+Math.imul(K,J)|0,n=n+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(x,Q)|0,a=a+Math.imul(x,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(S,re)|0,a=a+Math.imul(S,ne)|0,n=n+Math.imul(_,ae)|0,i=(i=i+Math.imul(_,se)|0)+Math.imul(v,ae)|0,a=a+Math.imul(v,se)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,ce)|0)+Math.imul(g,ue)|0,a=a+Math.imul(g,ce)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(y,de)|0,a=a+Math.imul(y,le)|0;var Ee=(c+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ye)|0)+Math.imul(l,pe)|0))<<13)|0;c=((a=a+Math.imul(l,ye)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(z,H),i=(i=Math.imul(z,W))+Math.imul(D,H)|0,a=Math.imul(D,W),n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,Z)|0,a=a+Math.imul(I,V)|0,n=n+Math.imul(R,$)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(B,$)|0,a=a+Math.imul(B,J)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(K,Q)|0,a=a+Math.imul(K,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(x,re)|0,a=a+Math.imul(x,ne)|0,n=n+Math.imul(A,ae)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(S,ae)|0,a=a+Math.imul(S,se)|0,n=n+Math.imul(_,ue)|0,i=(i=i+Math.imul(_,ce)|0)+Math.imul(v,ue)|0,a=a+Math.imul(v,ce)|0,n=n+Math.imul(m,de)|0,i=(i=i+Math.imul(m,le)|0)+Math.imul(g,de)|0,a=a+Math.imul(g,le)|0;var Pe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;c=((a=a+Math.imul(y,ye)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(z,Z),i=(i=Math.imul(z,V))+Math.imul(D,Z)|0,a=Math.imul(D,V),n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,J)|0)+Math.imul(I,$)|0,a=a+Math.imul(I,J)|0,n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(B,Q)|0,a=a+Math.imul(B,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(K,re)|0,a=a+Math.imul(K,ne)|0,n=n+Math.imul(P,ae)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(x,ae)|0,a=a+Math.imul(x,se)|0,n=n+Math.imul(A,ue)|0,i=(i=i+Math.imul(A,ce)|0)+Math.imul(S,ue)|0,a=a+Math.imul(S,ce)|0,n=n+Math.imul(_,de)|0,i=(i=i+Math.imul(_,le)|0)+Math.imul(v,de)|0,a=a+Math.imul(v,le)|0;var xe=(c+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,ye)|0)+Math.imul(g,pe)|0))<<13)|0;c=((a=a+Math.imul(g,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(z,$),i=(i=Math.imul(z,J))+Math.imul(D,$)|0,a=Math.imul(D,J),n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(I,Q)|0,a=a+Math.imul(I,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(B,re)|0,a=a+Math.imul(B,ne)|0,n=n+Math.imul(C,ae)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(K,ae)|0,a=a+Math.imul(K,se)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(x,ue)|0,a=a+Math.imul(x,ce)|0,n=n+Math.imul(A,de)|0,i=(i=i+Math.imul(A,le)|0)+Math.imul(S,de)|0,a=a+Math.imul(S,le)|0;var Me=(c+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,ye)|0)+Math.imul(v,pe)|0))<<13)|0;c=((a=a+Math.imul(v,ye)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(z,Q),i=(i=Math.imul(z,ee))+Math.imul(D,Q)|0,a=Math.imul(D,ee),n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(I,re)|0,a=a+Math.imul(I,ne)|0,n=n+Math.imul(R,ae)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(B,ae)|0,a=a+Math.imul(B,se)|0,n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(K,ue)|0,a=a+Math.imul(K,ce)|0,n=n+Math.imul(P,de)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(x,de)|0,a=a+Math.imul(x,le)|0;var Ce=(c+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ye)|0)+Math.imul(S,pe)|0))<<13)|0;c=((a=a+Math.imul(S,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(z,re),i=(i=Math.imul(z,ne))+Math.imul(D,re)|0,a=Math.imul(D,ne),n=n+Math.imul(T,ae)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(I,ae)|0,a=a+Math.imul(I,se)|0,n=n+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,ce)|0)+Math.imul(B,ue)|0,a=a+Math.imul(B,ce)|0,n=n+Math.imul(C,de)|0,i=(i=i+Math.imul(C,le)|0)+Math.imul(K,de)|0,a=a+Math.imul(K,le)|0;var Ke=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,ye)|0)+Math.imul(x,pe)|0))<<13)|0;c=((a=a+Math.imul(x,ye)|0)+(i>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,n=Math.imul(z,ae),i=(i=Math.imul(z,se))+Math.imul(D,ae)|0,a=Math.imul(D,se),n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,ce)|0)+Math.imul(I,ue)|0,a=a+Math.imul(I,ce)|0,n=n+Math.imul(R,de)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(B,de)|0,a=a+Math.imul(B,le)|0;var Ue=(c+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(K,pe)|0))<<13)|0;c=((a=a+Math.imul(K,ye)|0)+(i>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,n=Math.imul(z,ue),i=(i=Math.imul(z,ce))+Math.imul(D,ue)|0,a=Math.imul(D,ce),n=n+Math.imul(T,de)|0,i=(i=i+Math.imul(T,le)|0)+Math.imul(I,de)|0,a=a+Math.imul(I,le)|0;var Re=(c+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,ye)|0)+Math.imul(B,pe)|0))<<13)|0;c=((a=a+Math.imul(B,ye)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(z,de),i=(i=Math.imul(z,le))+Math.imul(D,de)|0,a=Math.imul(D,le);var Be=(c+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,ye)|0)+Math.imul(I,pe)|0))<<13)|0;c=((a=a+Math.imul(I,ye)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var je=(c+(n=Math.imul(z,pe))|0)+((8191&(i=(i=Math.imul(z,ye))+Math.imul(D,pe)|0))<<13)|0;return c=((a=Math.imul(D,ye))+(i>>>13)|0)+(je>>>26)|0,je&=67108863,u[0]=be,u[1]=me,u[2]=ge,u[3]=we,u[4]=_e,u[5]=ve,u[6]=ke,u[7]=Ae,u[8]=Se,u[9]=Ee,u[10]=Pe,u[11]=xe,u[12]=Me,u[13]=Ce,u[14]=Ke,u[15]=Ue,u[16]=Re,u[17]=Be,u[18]=je,0!==c&&(u[19]=c,r.length++),r};function p(e,t,r){return(new y).mulp(e,t,r)}function y(e,t){this.x=e,this.y=t}Math.imul||(h=l),a.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):r<63?l(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,a=0;a>>26)|0)>>>26,s&=67108863}r.words[a]=o,n=s,s=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,e,t):p(this,e,t)},y.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,n=0;n>=1;return n},y.prototype.permute=function(e,t,r,n,i,a){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&a,a>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=a>>>26,this.words[r]=67108863&a}return 0!==t&&(this.words[r]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new a(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var a=e%26,s=Math.min((e-a)/26,this.length),o=67108863^67108863>>>a<s)for(this.length-=s,c=0;c=0&&(0!==f||c>=i);c--){var d=0|this.words[c];this.words[c]=f<<26-a|d>>>a,f=d&o}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===o)return this.strip();for(n(-1===o),o=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var o,u=n.length-i.length;if("mod"!==t){(o=new a(null)).length=u+1,o.words=new Array(o.length);for(var c=0;c=0;d--){var l=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(l=Math.min(l/s|0,67108863),n._ishlnsubmul(i,l,d);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);o&&(o.words[d]=l)}return o&&o.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:o||null,mod:n}},a.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(i=o.div.neg()),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(i=o.div.neg()),{div:i,mod:o.mod}):0!=(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(s=o.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:o.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,o},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},a.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new a(1),s=new a(0),o=new a(0),u=new a(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var f=r.clone(),d=t.clone();!t.isZero();){for(var l=0,h=1;0==(t.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(t.iushrn(l);l-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(f),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(o.isOdd()||u.isOdd())&&(o.iadd(f),u.isub(d)),o.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(o),s.isub(u)):(r.isub(t),o.isub(i),u.isub(s))}return{a:o,b:u,gcd:r.iushln(c)}},a.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new a(1),o=new a(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var d=0,l=1;0==(r.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(r.iushrn(d);d-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(o)):(r.isub(t),o.isub(s))}return(i=0===t.cmpn(1)?s:o).cmpn(0)<0&&i.iadd(e),i},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,o&=67108863,this.words[s]=o}return 0!==a&&(this.words[s]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new k(e)},a.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function m(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){k.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}m.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):r.strip(),r},m.prototype.split=function(e,t){e.iushrn(this.n,0,t)},m.prototype.imulK=function(e){return e.imul(this.k)},i(g,m),g.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n>>22,i=a}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},g.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new g;else if("p224"===e)t=new w;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new v}return b[e]=t,t},k.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},k.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},k.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},k.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},k.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},k.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},k.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},k.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},k.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},k.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},k.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},k.prototype.isqr=function(e){return this.imul(e,e.clone())},k.prototype.sqr=function(e){return this.mul(e,e)},k.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var o=new a(1).toRed(this),u=o.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new a(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var d=this.pow(f,i),l=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(o);){for(var y=h,b=0;0!==y.cmp(o);b++)y=y.redSqr();n(b=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var d=c>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++o||0===n&&0===f)&&(i=this.mul(i,r[s]),o=0,s=0)):o=0}u=26}return i},k.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},k.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new A(e)},i(A,k),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:"buffer"}],17:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},t.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(e,t){this.curve=e,this.type=t,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){o(e.precomputed);var r=e._getDoubles(),n=a(t,1),i=(1<=u;t--)c=(c<<1)+n[t];s.push(c)}for(var f=this.jpoint(null,null,null),d=this.jpoint(null,null,null),l=i;l>0;l--){for(u=0;u=0;c--){for(t=0;c>=0&&0===s[c];c--)t++;if(c>=0&&t++,u=u.dblp(t),c<0)break;var f=s[c];o(0!==f),u="affine"===e.type?f>0?u.mixedAdd(i[f-1>>1]):u.mixedAdd(i[-f-1>>1].neg()):f>0?u.add(i[f-1>>1]):u.add(i[-f-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,u=this._wnafT2,c=this._wnafT3,f=0,d=0;d=1;d-=2){var h=d-1,p=d;if(1===o[h]&&1===o[p]){var y=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(y[1]=t[h].add(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].add(t[p].neg())):(y[1]=t[h].toJ().mixedAdd(t[p]),y[2]=t[h].toJ().mixedAdd(t[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],m=s(r[h],r[p]);f=Math.max(m[0].length,f),c[h]=new Array(f),c[p]=new Array(f);for(var g=0;g=0;d--){for(var A=0;d>=0;){var S=!0;for(g=0;g=0&&A++,v=v.dblp(A),d<0)break;for(g=0;g0?E=u[g][P-1>>1]:P<0&&(E=u[g][-P-1>>1].neg()),v="affine"===E.type?v.mixedAdd(E):v.add(E))}}for(d=0;d=Math.ceil((e.bitLength()+1)/t.step)},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=n.redAdd(t),s=a.redSub(r),o=n.redSub(t),u=i.redMul(s),c=a.redMul(o),f=i.redMul(o),d=s.redMul(a);return this.curve.point(u,c,d,f)},c.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),a=this.y.redSqr();if(this.curve.twisted){var s=(c=this.curve._mulA(i)).redAdd(a);if(this.zOne)e=n.redSub(i).redSub(a).redMul(s.redSub(this.curve.two)),t=s.redMul(c.redSub(a)),r=s.redSqr().redSub(s).redSub(s);else{var o=this.z.redSqr(),u=s.redSub(o).redISub(o);e=n.redSub(i).redISub(a).redMul(u),t=s.redMul(c.redSub(a)),r=s.redMul(u)}}else{var c=i.redAdd(a);o=this.curve._mulC(this.z).redSqr(),u=c.redSub(o).redSub(o);e=this.curve._mulC(n.redISub(c)).redMul(u),t=this.curve._mulC(c).redMul(i.redISub(a)),r=c.redMul(u)}return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),s=i.redSub(n),o=i.redAdd(n),u=r.redAdd(t),c=a.redMul(s),f=o.redMul(u),d=a.redMul(u),l=s.redMul(o);return this.curve.point(c,f,l,d)},c.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),a=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(a).redMul(s),u=i.redSub(o),c=i.redAdd(o),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(s),d=n.redMul(u).redMul(f);return this.curve.twisted?(t=n.redMul(c).redMul(s.redSub(this.curve._mulA(a))),r=u.redMul(c)):(t=n.redMul(c).redMul(s.redSub(a)),r=this.curve._mulC(u).redMul(c)),this.curve.point(d,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},{"../utils":32,"./base":19,"bn.js":16,inherits:47}],21:[function(e,t,r){"use strict";var n=r;n.base=e("./base"),n.short=e("./short"),n.mont=e("./mont"),n.edwards=e("./edwards")},{"./base":19,"./edwards":20,"./mont":22,"./short":23}],22:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("inherits"),a=e("./base"),s=e("../utils");function o(e){a.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(o,a),t.exports=o,o.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(u,a.BasePoint),o.prototype.decodePoint=function(e,t){if(33===(e=s.toArray(e,t)).length&&64===e[0]&&(e=e.slice(1,33).reverse()),32!==e.length)throw new Error("Unknown point compression format");return this.point(e,1)},o.prototype.point=function(e,t){return new u(this,e,t)},o.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(e){var t=this.curve.p.byteLength();return e?[64].concat(this.getX().toArray("le",t)):this.getX().toArray("be",t)},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(r),s=i.redMul(n),o=t.z.redMul(a.redAdd(s).redSqr()),u=t.x.redMul(a.redISub(s).redSqr());return this.curve.point(o,u)},u.prototype.mul=function(e){for(var t=(e=new n(e,16)).clone(),r=this,i=this.curve.point(null,null),a=[];0!==t.cmpn(0);t.iushrn(1))a.push(t.andln(1));for(var s=a.length-1;s>=0;s--)0===a[s]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":32,"./base":19,"bn.js":16,inherits:47}],23:[function(e,t,r){"use strict";var n=e("../utils"),i=e("bn.js"),a=e("inherits"),s=e("./base"),o=n.assert;function u(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(e,t,r,n){s.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(e,t,r,n){s.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(u,s),t.exports=u,u.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],o(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new i(e.a,16),b:new i(e.b,16)}}):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),a=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(a).fromRed(),n.redSub(a).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,a,s,o,u,c,f,d=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,h=this.n.clone(),p=new i(1),y=new i(0),b=new i(0),m=new i(1),g=0;0!==l.cmpn(0);){var w=h.div(l);c=h.sub(w.mul(l)),f=b.sub(w.mul(p));var _=m.sub(w.mul(y));if(!n&&c.cmp(d)<0)t=u.neg(),r=p,n=c.neg(),a=f;else if(n&&2==++g)break;u=c,h=l,l=c,b=p,p=f,m=y,y=_}s=c.neg(),o=f;var v=n.sqr().add(a.sqr());return s.sqr().add(o.sqr()).cmp(v)>=0&&(s=t,o=r),n.negative&&(n=n.neg(),a=a.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:n,b:a},{a:s,b:o}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),o=a.mul(n.a),u=i.mul(r.b),c=a.mul(n.b);return{k1:e.sub(s).sub(o),k2:u.add(c).neg()}},u.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,a=0;a":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),a=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,s)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(f,s.BasePoint),u.prototype.jpoint=function(e,t,r){return new f(this,e,t,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),o=n.redSub(i),u=a.redSub(s);if(0===o.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),f=c.redMul(o),d=n.redMul(c),l=u.redSqr().redIAdd(f).redISub(d).redISub(d),h=u.redMul(d.redISub(l)).redISub(a.redMul(f)),p=this.z.redMul(e.z).redMul(o);return this.curve.jpoint(l,h,p)},f.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,a=e.y.redMul(t).redMul(this.z),s=r.redSub(n),o=i.redSub(a);if(0===s.cmpn(0))return 0!==o.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),f=r.redMul(u),d=o.redSqr().redIAdd(c).redISub(f).redISub(f),l=o.redMul(f.redISub(d)).redISub(i.redMul(c)),h=this.z.redMul(s);return this.curve.jpoint(d,l,h)},f.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":32,"./base":19,"bn.js":16,inherits:47}],24:[function(e,t,r){"use strict";var n,i=r,a=e("hash.js"),s=e("./curve"),o=e("./utils").assert;function u(e){if("short"===e.type)this.curve=new s.short(e);else if("edwards"===e.type)this.curve=new s.edwards(e);else{if("mont"!==e.type)throw new Error("Unknown curve type.");this.curve=new s.mont(e)}this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, n*G != O")}function c(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",cofactor:"8",hash:a.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",cofactor:"8",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]}),c("brainpoolP256r1",{type:"short",prime:null,p:"A9FB57DB A1EEA9BC 3E660A90 9D838D72 6E3BF623 D5262028 2013481D 1F6E5377",a:"7D5A0975 FC2C3057 EEF67530 417AFFE7 FB8055C1 26DC5C6C E94A4B44 F330B5D9",b:"26DC5C6C E94A4B44 F330B5D9 BBD77CBF 95841629 5CF7E1CE 6BCCDC18 FF8C07B6",n:"A9FB57DB A1EEA9BC 3E660A90 9D838D71 8C397AA3 B561A6F7 901E0E82 974856A7",hash:a.sha256,gRed:!1,g:["8BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262","547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997"]}),c("brainpoolP384r1",{type:"short",prime:null,p:"8CB91E82 A3386D28 0F5D6F7E 50E641DF 152F7109 ED5456B4 12B1DA19 7FB71123ACD3A729 901D1A71 87470013 3107EC53",a:"7BC382C6 3D8C150C 3C72080A CE05AFA0 C2BEA28E 4FB22787 139165EF BA91F90F8AA5814A 503AD4EB 04A8C7DD 22CE2826",b:"04A8C7DD 22CE2826 8B39B554 16F0447C 2FB77DE1 07DCD2A6 2E880EA5 3EEB62D57CB43902 95DBC994 3AB78696 FA504C11",n:"8CB91E82 A3386D28 0F5D6F7E 50E641DF 152F7109 ED5456B3 1F166E6C AC0425A7CF3AB6AF 6B7FC310 3B883202 E9046565",hash:a.sha384,gRed:!1,g:["1D1C64F068CF45FFA2A63A81B7C13F6B8847A3E77EF14FE3DB7FCAFE0CBD10E8E826E03436D646AAEF87B2E247D4AF1E","8ABE1D7520F9C2A45CB1EB8E95CFD55262B70B29FEEC5864E19C054FF99129280E4646217791811142820341263C5315"]}),c("brainpoolP512r1",{type:"short",prime:null,p:"AADD9DB8 DBE9C48B 3FD4E6AE 33C9FC07 CB308DB3 B3C9D20E D6639CCA 703308717D4D9B00 9BC66842 AECDA12A E6A380E6 2881FF2F 2D82C685 28AA6056 583A48F3",a:"7830A331 8B603B89 E2327145 AC234CC5 94CBDD8D 3DF91610 A83441CA EA9863BC2DED5D5A A8253AA1 0A2EF1C9 8B9AC8B5 7F1117A7 2BF2C7B9 E7C1AC4D 77FC94CA",b:"3DF91610 A83441CA EA9863BC 2DED5D5A A8253AA1 0A2EF1C9 8B9AC8B5 7F1117A72BF2C7B9 E7C1AC4D 77FC94CA DC083E67 984050B7 5EBAE5DD 2809BD63 8016F723",n:"AADD9DB8 DBE9C48B 3FD4E6AE 33C9FC07 CB308DB3 B3C9D20E D6639CCA 70330870553E5C41 4CA92619 41866119 7FAC1047 1DB1D381 085DDADD B5879682 9CA90069",hash:a.sha512,gRed:!1,g:["81AEE4BDD82ED9645A21322E9C4C6A9385ED9F70B5D916C1B43B62EEF4D0098EFF3B1F78E2D0D48D50D1687B93B97D5F7C6D5047406A5E688B352209BCB9F822","7DDE385D566332ECC0EABFA9CF7822FDF209F70024A57B1AA000C55B881F8111B2DCDE494A5F485E5BCA4BD88A2763AED1CA2B2FA8F0540678CD1E0F3AD80892"]});try{n=e("./precomputed/secp256k1")}catch(f){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":21,"./precomputed/secp256k1":31,"./utils":32,"hash.js":34}],25:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("hmac-drbg"),a=e("../utils"),s=e("../curves"),o=e("brorand"),u=a.assert,c=e("./key"),f=e("./signature");function d(e){if(!(this instanceof d))return new d(e);"string"==typeof e&&(u(s.hasOwnProperty(e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}t.exports=d,d.prototype.keyPair=function(e){return new c(this,e)},d.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},d.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},d.prototype.genKeyPair=function(e){e||(e={});var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()});if("mont"===this.curve.type){var r=new n(t.generate(32));return this.keyFromPrivate(r)}for(var a=this.n.byteLength(),s=this.n.sub(new n(2));;){if(!((r=new n(t.generate(a))).cmp(s)>0))return r.iaddn(1),this.keyFromPrivate(r)}},d.prototype._truncateToN=function(e,t,r){var n=(r=r||8*e.byteLength())-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},d.prototype.truncateMsg=function(e){var t;return e instanceof Uint8Array?(t=8*e.byteLength,e=this._truncateToN(new n(e,16),!1,t)):"string"==typeof e?(t=4*e.length,e=this._truncateToN(new n(e,16),!1,t)):e=this._truncateToN(new n(e,16)),e},d.prototype.sign=function(e,t,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),t=this.keyFromPrivate(t,r),e=this.truncateMsg(e);for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),u=e.toArray("be",s),c=new i({hash:this.hash,entropy:o,nonce:u,pers:a.pers,persEnc:a.persEnc||"utf8"}),d=this.n.sub(new n(1)),l=0;;l++){var h=a.k?a.k(l):new n(c.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var y=p.getX(),b=y.umod(this.n);if(0!==b.cmpn(0)){var m=h.invm(this.n).mul(b.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var g=(p.getY().isOdd()?1:0)|(0!==y.cmp(b)?2:0);return a.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new f({r:b,s:m,recoveryParam:g})}}}}}},d.prototype.verify=function(e,t,r,i){return r=this.keyFromPublic(r,i),t=new f(t,"hex"),this._verify(this.truncateMsg(e),t,r)||this._verify(this._truncateToN(new n(e,16)),t,r)},d.prototype._verify=function(e,t,r){var n=t.r,i=t.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0)return!1;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var a,s=i.invm(this.n),o=s.mul(e).umod(this.n),u=s.mul(n).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(o,r.getPublic(),u)).isInfinity()&&a.eqXToP(n):!(a=this.g.mulAdd(o,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(n)},d.prototype.recoverPubKey=function(e,t,r,i){u((3&r)===r,"The recovery param is more than two bits"),t=new f(t,i);var a=this.n,s=new n(e),o=t.r,c=t.s,d=1&r,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");o=l?this.curve.pointFromX(o.add(this.curve.n),d):this.curve.pointFromX(o,d);var h=t.r.invm(a),p=a.sub(s).mul(h).umod(a),y=c.mul(h).umod(a);return this.g.mulAdd(p,o,y)},d.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new f(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch(e){continue}if(a.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":24,"../utils":32,"./key":26,"./signature":27,"bn.js":16,brorand:17,"hmac-drbg":46}],26:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils").assert;function a(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}t.exports=a,a.fromPublic=function(e,t,r){return t instanceof a?t:new a(e,{pub:t,pubEnc:r})},a.fromPrivate=function(e,t,r){return t instanceof a?t:new a(e,{priv:t,privEnc:r})},a.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function(e,t){return this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},a.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function(e,t){if(this.priv=new n(e,t||16),"mont"===this.ec.curve.type){var r=this.ec.curve.one,i=r.ushln(252).sub(r).ushln(3);this.priv=this.priv.or(r.ushln(254)),this.priv=this.priv.and(i)}else this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},a.prototype.derive=function(e){return e.mul(this.priv).getX()},a.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},a.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},a.prototype.inspect=function(){return""}},{"../utils":32,"bn.js":16}],27:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils"),a=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(a(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function o(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,a=0,s=t.place;a>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}t.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new o;if(48!==e[r.place++])return!1;if(u(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var a=u(e,r),s=e.slice(r.place,a+r.place);if(r.place+=a,2!==e[r.place++])return!1;var c=u(e,r);if(e.length!==c+r.place)return!1;var f=e.slice(r.place,c+r.place);return 0===s[0]&&128&s[1]&&(s=s.slice(1)),0===f[0]&&128&f[1]&&(f=f.slice(1)),this.r=new n(s),this.s=new n(f),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=c(t),r=c(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,t.length),(n=n.concat(t)).push(2),f(n,r.length);var a=n.concat(r),s=[48];return f(s,a.length),s=s.concat(a),i.encode(s,e)}},{"../utils":32,"bn.js":16}],28:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("hmac-drbg"),a=e("brorand"),s=e("../curves"),o=e("../utils"),u=o.assert,c=o.parseBytes,f=e("./key"),d=e("./signature");function l(e){if(u("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=s[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}t.exports=l,l.prototype.sign=function(e,t){e=c(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),a=this.encodePoint(i),s=this.hashInt(a,r.pubBytes(),e).mul(r.priv()),o=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:o,Rencoded:a})},l.prototype.verify=function(e,t,r){e=c(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(a)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=0;){var a;if(i.isOdd()){var s=i.andln(n-1);a=s>(n>>1)-1?(n>>1)-s:s,i.isubn(a)}else a=0;r.push(a);for(var o=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;u0||t.cmpn(-i)>0;){var a,s,o,u=e.andln(3)+n&3,c=t.andln(3)+i&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!=(o=e.andln(7)+n&7)&&5!==o||2!==c?u:-u,r[0].push(a),s=0==(1&c)?0:3!=(o=t.andln(7)+i&7)&&5!==o||2!==u?c:-c,r[1].push(s),2*n===a+1&&(n=1-n),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},{"bn.js":16,"minimalistic-assert":48,"minimalistic-crypto-utils":49}],33:[function(e,t,r){"use strict";!function(e){function r(e){function t(){return Ae0&&(t.semantic=" "),t}}function b(e,t){return function(){var n,a,o,c,f;for(c=r(),n=s("star"),o=0,f=void 0===t?0:t;null!==(a=e());)o+=1,u(n,a);return o>=f?n:(i(c),null)}}function m(e){return e.charCodeAt(0)>=128}function g(){return o("cr",f("\r")())}function w(){return o("crlf",d(g,k)())}function _(){return o("dquote",f('"')())}function v(){return o("htab",f("\t")())}function k(){return o("lf",f("\n")())}function A(){return o("sp",f(" ")())}function S(){return o("vchar",c(function(t){var r=t.charCodeAt(0),n=33<=r&&r<=126;return e.rfc6532&&(n=n||m(t)),n}))}function E(){return o("wsp",l(A,v)())}function P(){var e=o("quoted-pair",l(d(f("\\"),l(S,E)),ne)());return null===e?null:(e.semantic=e.semantic[1],e)}function x(){return o("fws",l(ae,d(h(d(b(E),p(w))),b(E,1)))())}function M(){return o("ctext",l(function(){return c(function(t){var r=t.charCodeAt(0),n=33<=r&&r<=39||42<=r&&r<=91||93<=r&&r<=126;return e.rfc6532&&(n=n||m(t)),n})},te)())}function C(){return o("ccontent",l(M,P,K)())}function K(){return o("comment",d(f("("),b(d(h(x),C)),h(x),f(")"))())}function U(){return o("cfws",l(d(b(d(h(x),K),1),h(x)),x)())}function R(){return o("atext",c(function(t){var r="a"<=t&&t<="z"||"A"<=t&&t<="Z"||"0"<=t&&t<="9"||["!","#","$","%","&","'","*","+","-","/","=","?","^","_","`","{","|","}","~"].indexOf(t)>=0;return e.rfc6532&&(r=r||m(t)),r}))}function B(){return o("atom",d(y(h(U)),b(R,1),y(h(U)))())}function j(){var e,t;return null===(e=o("dot-atom-text",b(R,1)()))?e:(null!==(t=b(d(f("."),b(R,1)))())&&u(e,t),e)}function T(){return o("dot-atom",d(p(h(U)),j,p(h(U)))())}function I(){return o("qtext",l(function(){return c(function(t){var r=t.charCodeAt(0),n=33===r||35<=r&&r<=91||93<=r&&r<=126;return e.rfc6532&&(n=n||m(t)),n})},re)())}function O(){return o("qcontent",l(I,P)())}function z(){return o("quoted-string",d(p(h(U)),p(_),b(d(h(y(x)),O)),h(p(x)),p(_),p(h(U)))())}function D(){return o("word",l(B,z)())}function q(){return o("address",l(N,H)())}function N(){return o("mailbox",l(F,Q)())}function F(){return o("name-addr",d(h(W),L)())}function L(){return o("angle-addr",l(d(p(h(U)),f("<"),Q,f(">"),p(h(U))),se)())}function H(){return o("group",d(W,f(":"),h(V),f(";"),p(h(U)))())}function W(){return o("display-name",(null!==(e=o("phrase",l(ie,b(D,1))()))&&(e.semantic=e.semantic.replace(/([ \t]|\r\n)+/g," ").replace(/^\s*/,"").replace(/\s*$/,"")),e));var e}function G(){return o("mailbox-list",l(d(N,b(d(f(","),N))),ce)())}function Z(){return o("address-list",l(d(q,b(d(f(","),q))),fe)())}function V(){return o("group-list",l(G,p(U),de)())}function Y(){return o("local-part",l(le,T,z)())}function $(){return o("dtext",l(function(){return c(function(t){var r=t.charCodeAt(0),n=33<=r&&r<=90||94<=r&&r<=126;return e.rfc6532&&(n=n||m(t)),n})},pe)())}function J(){return o("domain-literal",d(p(h(U)),f("["),b(d(h(x),$)),h(x),f("]"),p(h(U)))())}function X(){return o("domain",(t=l(he,T,J)(),e.rejectTLD&&t&&t.semantic&&t.semantic.indexOf(".")<0?null:(t&&(t.semantic=t.semantic.replace(/\s+/g,"")),t)));var t}function Q(){return o("addr-spec",d(Y,f("@"),X)())}function ee(){return e.strict?null:o("obs-NO-WS-CTL",c(function(e){var t=e.charCodeAt(0);return 1<=t&&t<=8||11===t||12===t||14<=t&&t<=31||127===t}))}function te(){return e.strict?null:o("obs-ctext",ee())}function re(){return e.strict?null:o("obs-qtext",ee())}function ne(){return e.strict?null:o("obs-qp",d(f("\\"),l(f("\0"),ee,k,g))())}function ie(){return e.strict?null:e.atInDisplayName?o("obs-phrase",d(D,b(l(D,f("."),f("@"),y(U))))()):o("obs-phrase",d(D,b(l(D,f("."),y(U))))())}function ae(){return e.strict?null:o("obs-FWS",b(d(p(h(w)),E),1)())}function se(){return e.strict?null:o("obs-angle-addr",d(p(h(U)),f("<"),oe,Q,f(">"),p(h(U)))())}function oe(){return e.strict?null:o("obs-route",d(ue,f(":"))())}function ue(){return e.strict?null:o("obs-domain-list",d(b(l(p(U),f(","))),f("@"),X,b(d(f(","),p(h(U)),h(d(f("@"),X)))))())}function ce(){return e.strict?null:o("obs-mbox-list",d(b(d(p(h(U)),f(","))),N,b(d(f(","),h(d(N,p(U))))))())}function fe(){return e.strict?null:o("obs-addr-list",d(b(d(p(h(U)),f(","))),q,b(d(f(","),h(d(q,p(U))))))())}function de(){return e.strict?null:o("obs-group-list",d(b(d(p(h(U)),f(",")),1),p(h(U)))())}function le(){return e.strict?null:o("obs-local-part",d(D,b(d(f("."),D)))())}function he(){return e.strict?null:o("obs-domain",d(B,b(d(f("."),B)))())}function pe(){return e.strict?null:o("obs-dtext",l(ee,P)())}function ye(e,t){var r,n,i;if(null==t)return null;for(n=[t];n.length>0;){if((i=n.pop()).name===e)return i;for(r=i.children.length-1;r>=0;r-=1)n.push(i.children[r])}return null}function be(e,t){var r,n,i,a,s;if(null==t)return null;for(n=[t],a=[],s={},r=0;r0;)if((i=n.pop()).name in s)a.push(i);else for(r=i.children.length-1;r>=0;r-=1)n.push(i.children[r]);return a}function me(t){var r,n,i,a,s;if(null===t)return null;for(r=[],n=be(["group","mailbox"],t),i=0;i1)return null;return t.addresses&&t.addresses[0]}(s):e.simple?s&&s.addresses:s}function ge(e){var t,r=ye("display-name",e),n=[],i=be(["mailbox"],e);for(t=0;t0;)for((i=n.pop()).name===e&&a.push(i),r=i.children.length-1;r>=0;r-=1)n.push(i.children[r]);return a}("cfws",e),i=be(["comment"],e),a=ye("local-part",r),s=ye("domain",r);return{node:e,parts:{name:t,address:r,local:a,domain:s,comments:n},type:e.name,name:_e(t),address:_e(r),local:_e(a),domain:_e(s),comments:ve(i),groupName:_e(e.groupName)}}function _e(e){return null!=e?e.semantic:null}function ve(e){var t="";if(e)for(var r=0;r=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,a=8;athis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":45}],45:[function(e,t,r){"use strict";var n=e("minimalistic-assert"),i=e("inherits");function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function o(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}r.inherits=i,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>8,s=255&i;a?r.push(a,s):r.push(s)}else for(n=0;n>>0}return s},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=a>>>16&255,r[i+2]=a>>>8&255,r[i+3]=255&a):(r[i+3]=a>>>24,r[i+2]=a>>>16&255,r[i+1]=a>>>8&255,r[i]=255&a)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],a=n+e[t+1]>>>0,s=(a>>0,e[t+1]=a},r.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,a,s,o){var u=0,c=t;return u+=(c=c+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(e,t,r,n,i,a,s,o){return t+n+a+o>>>0},r.sum64_5_hi=function(e,t,r,n,i,a,s,o,u,c){var f=0,d=t;return f+=(d=d+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(e,t,r,n,i,a,s,o,u,c){return t+n+a+o+c>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:47,"minimalistic-assert":48}],46:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("minimalistic-crypto-utils"),a=e("minimalistic-assert");function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}t.exports=s,s.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},s.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var a=[];a.length>8,s=255&i;a?r.push(a,s):r.push(s)}return r},n.zero2=i,n.toHex=a,n.encode=function(e,t){return"hex"===t?a(e):e}},{}],50:[function(e,t,r){"use strict";var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":51,"./lib/inflate":52,"./lib/utils/common":53,"./lib/zlib/constants":56}],51:[function(e,t,r){"use strict";var n=e("./zlib/deflate"),i=e("./utils/common"),a=e("./utils/strings"),s=e("./zlib/messages"),o=e("./zlib/zstream"),u=Object.prototype.toString,c=0,f=-1,d=0,l=8;function h(e){if(!(this instanceof h))return new h(e);this.options=i.assign({level:f,method:l,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var r=n.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==c)throw new Error(s[r]);if(t.header&&n.deflateSetHeader(this.strm,t.header),t.dictionary){var p;if(p="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=n.deflateSetDictionary(this.strm,p))!==c)throw new Error(s[r]);this._dict_set=!0}}function p(e,t){var r=new h(t);if(r.push(e,!0),r.err)throw r.msg||s[r.err];return r.result}h.prototype.push=function(e,t){var r,s,o=this.strm,f=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:!0===t?4:0,"string"==typeof e?o.input=a.string2buf(e):"[object ArrayBuffer]"===u.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(0===o.avail_out&&(o.output=new i.Buf8(f),o.next_out=0,o.avail_out=f),1!==(r=n.deflate(o,s))&&r!==c)return this.onEnd(r),this.ended=!0,!1;0!==o.avail_out&&(0!==o.avail_in||4!==s&&2!==s)||("string"===this.options.to?this.onData(a.buf2binstring(i.shrinkBuf(o.output,o.next_out))):this.onData(i.shrinkBuf(o.output,o.next_out)))}while((o.avail_in>0||0===o.avail_out)&&1!==r);return 4===s?(r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===c):2!==s||(this.onEnd(c),o.avail_out=0,!0)},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===c&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=h,r.deflate=p,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,p(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,p(e,t)}},{"./utils/common":53,"./utils/strings":54,"./zlib/deflate":58,"./zlib/messages":63,"./zlib/zstream":65}],52:[function(e,t,r){"use strict";var n=e("./zlib/inflate"),i=e("./utils/common"),a=e("./utils/strings"),s=e("./zlib/constants"),o=e("./zlib/messages"),u=e("./zlib/zstream"),c=e("./zlib/gzheader"),f=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,t.windowBits);if(r!==s.Z_OK)throw new Error(o[r]);this.header=new c,n.inflateGetHeader(this.strm,this.header)}function l(e,t){var r=new d(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}d.prototype.push=function(e,t){var r,o,u,c,d,l,h=this.strm,p=this.options.chunkSize,y=this.options.dictionary,b=!1;if(this.ended)return!1;o=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?h.input=a.binstring2buf(e):"[object ArrayBuffer]"===f.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(p),h.next_out=0,h.avail_out=p),(r=n.inflate(h,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&y&&(l="string"==typeof y?a.string2buf(y):"[object ArrayBuffer]"===f.call(y)?new Uint8Array(y):y,r=n.inflateSetDictionary(this.strm,l)),r===s.Z_BUF_ERROR&&!0===b&&(r=s.Z_OK,b=!1),r!==s.Z_STREAM_END&&r!==s.Z_OK)return this.onEnd(r),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&r!==s.Z_STREAM_END&&(0!==h.avail_in||o!==s.Z_FINISH&&o!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(u=a.utf8border(h.output,h.next_out),c=h.next_out-u,d=a.buf2string(h.output,u),h.next_out=c,h.avail_out=p-c,c&&i.arraySet(h.output,h.output,u,c,0),this.onData(d)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(b=!0)}while((h.avail_in>0||0===h.avail_out)&&r!==s.Z_STREAM_END);return r===s.Z_STREAM_END&&(o=s.Z_FINISH),o===s.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.Z_OK):o!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),h.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=d,r.inflate=l,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,l(e,t)},r.ungzip=l},{"./utils/common":53,"./utils/strings":54,"./zlib/constants":56,"./zlib/gzheader":59,"./zlib/inflate":61,"./zlib/messages":63,"./zlib/zstream":65}],53:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(e[n]=r[n])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var a={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var a=0;a=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;function u(e,t){if(t<65537&&(e.subarray&&a||!e.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var r="",s=0;s>>6,t[s++]=128|63&r):r<65536?(t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|63&r):(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|63&r);return t},r.buf2binstring=function(e){return u(e,e.length)},r.binstring2buf=function(e){for(var t=new n.Buf8(e.length),r=0,i=t.length;r4)c[n++]=65533,r+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&r1?c[n++]=65533:i<65536?c[n++]=i:(i-=65536,c[n++]=55296|i>>10&1023,c[n++]=56320|1023&i)}return u(c,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+s[e[r]]>t?r:t}},{"./common":53}],55:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){for(var i=65535&e|0,a=e>>>16&65535|0,s=0;0!==r;){r-=s=r>2e3?2e3:r;do{a=a+(i=i+t[n++]|0)|0}while(--s);i%=65521,a%=65521}return i|a<<16|0}},{}],56:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],57:[function(e,t,r){"use strict";var n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,i){var a=n,s=i+r;e^=-1;for(var o=i;o>>8^a[255&(e^t[o])];return-1^e}},{}],58:[function(e,t,r){"use strict";var n,i=e("../utils/common"),a=e("./trees"),s=e("./adler32"),o=e("./crc32"),u=e("./messages"),c=0,f=1,d=3,l=4,h=5,p=0,y=1,b=-2,m=-3,g=-5,w=-1,_=1,v=2,k=3,A=4,S=0,E=2,P=8,x=9,M=15,C=8,K=286,U=30,R=19,B=2*K+1,j=15,T=3,I=258,O=I+T+1,z=32,D=42,q=69,N=73,F=91,L=103,H=113,W=666,G=1,Z=2,V=3,Y=4,$=3;function J(e,t){return e.msg=u[t],t}function X(e){return(e<<1)-(e>4?9:0)}function Q(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(i.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function te(e,t){a._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function re(e,t){e.pending_buf[e.pending++]=t}function ne(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ie(e,t){var r,n,i=e.max_chain_length,a=e.strstart,s=e.prev_length,o=e.nice_match,u=e.strstart>e.w_size-O?e.strstart-(e.w_size-O):0,c=e.window,f=e.w_mask,d=e.prev,l=e.strstart+I,h=c[a+s-1],p=c[a+s];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(c[(r=t)+s]===p&&c[r+s-1]===h&&c[r]===c[a]&&c[++r]===c[a+1]){a+=2,r++;do{}while(c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&as){if(e.match_start=t,s=n,n>=o)break;h=c[a+s-1],p=c[a+s]}}}while((t=d[t&f])>u&&0!=--i);return s<=e.lookahead?s:e.lookahead}function ae(e){var t,r,n,a,u,c,f,d,l,h,p=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-O)){i.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=p?n-p:0}while(--r);t=r=p;do{n=e.prev[--t],e.prev[t]=n>=p?n-p:0}while(--r);a+=p}if(0===e.strm.avail_in)break;if(c=e.strm,f=e.window,d=e.strstart+e.lookahead,l=a,h=void 0,(h=c.avail_in)>l&&(h=l),r=0===h?0:(c.avail_in-=h,i.arraySet(f,c.input,c.next_in,h,d),1===c.state.wrap?c.adler=s(c.adler,f,h,d):2===c.state.wrap&&(c.adler=o(c.adler,f,h,d)),c.next_in+=h,c.total_in+=h,h),e.lookahead+=r,e.lookahead+e.insert>=T)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=T&&(e.ins_h=(e.ins_h<=T)if(n=a._tr_tally(e,e.strstart-e.match_start,e.match_length-T),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=T){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=T&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=T-1)),e.prev_length>=T&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-T,n=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-T),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<15&&(o=2,n-=16),a<1||a>x||r!==P||n<8||n>15||t<0||t>9||s<0||s>A)return J(e,b);8===n&&(n=9);var u=new ce;return e.state=u,u.strm=e,u.wrap=o,u.gzhead=null,u.w_bits=n,u.w_size=1<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ae(e),0===e.lookahead&&t===c)return G;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,te(e,!1),0===e.strm.avail_out))return G;if(e.strstart-e.block_start>=e.w_size-O&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===l?(te(e,!0),0===e.strm.avail_out?V:Y):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),G)}),new ue(4,4,8,4,se),new ue(4,5,16,8,se),new ue(4,6,32,32,se),new ue(4,4,16,16,oe),new ue(8,16,32,32,oe),new ue(8,16,128,128,oe),new ue(8,32,128,256,oe),new ue(32,128,258,1024,oe),new ue(32,258,258,4096,oe)],r.deflateInit=function(e,t){return le(e,t,P,M,C,S)},r.deflateInit2=le,r.deflateReset=de,r.deflateResetKeep=fe,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?b:(e.state.gzhead=t,p):b},r.deflate=function(e,t){var r,i,s,u;if(!e||!e.state||t>h||t<0)return e?J(e,b):b;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===W&&t!==l)return J(e,0===e.avail_out?g:b);if(i.strm=e,r=i.last_flush,i.last_flush=t,i.status===D)if(2===i.wrap)e.adler=0,re(i,31),re(i,139),re(i,8),i.gzhead?(re(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),re(i,255&i.gzhead.time),re(i,i.gzhead.time>>8&255),re(i,i.gzhead.time>>16&255),re(i,i.gzhead.time>>24&255),re(i,9===i.level?2:i.strategy>=v||i.level<2?4:0),re(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(re(i,255&i.gzhead.extra.length),re(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=o(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=q):(re(i,0),re(i,0),re(i,0),re(i,0),re(i,0),re(i,9===i.level?2:i.strategy>=v||i.level<2?4:0),re(i,$),i.status=H);else{var m=P+(i.w_bits-8<<4)<<8;m|=(i.strategy>=v||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=z),m+=31-m%31,i.status=H,ne(i,m),0!==i.strstart&&(ne(i,e.adler>>>16),ne(i,65535&e.adler)),e.adler=1}if(i.status===q)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=o(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending!==i.pending_buf_size));)re(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=o(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=N)}else i.status=N;if(i.status===N)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=o(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexs&&(e.adler=o(e.adler,i.pending_buf,i.pending-s,s)),0===u&&(i.gzindex=0,i.status=F)}else i.status=F;if(i.status===F)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=o(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexs&&(e.adler=o(e.adler,i.pending_buf,i.pending-s,s)),0===u&&(i.status=L)}else i.status=L;if(i.status===L&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ee(e),i.pending+2<=i.pending_buf_size&&(re(i,255&e.adler),re(i,e.adler>>8&255),e.adler=0,i.status=H)):i.status=H),0!==i.pending){if(ee(e),0===e.avail_out)return i.last_flush=-1,p}else if(0===e.avail_in&&X(t)<=X(r)&&t!==l)return J(e,g);if(i.status===W&&0!==e.avail_in)return J(e,g);if(0!==e.avail_in||0!==i.lookahead||t!==c&&i.status!==W){var w=i.strategy===v?function(e,t){for(var r;;){if(0===e.lookahead&&(ae(e),0===e.lookahead)){if(t===c)return G;break}if(e.match_length=0,r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===l?(te(e,!0),0===e.strm.avail_out?V:Y):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:Z}(i,t):i.strategy===k?function(e,t){for(var r,n,i,s,o=e.window;;){if(e.lookahead<=I){if(ae(e),e.lookahead<=I&&t===c)return G;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=T&&e.strstart>0&&(n=o[i=e.strstart-1])===o[++i]&&n===o[++i]&&n===o[++i]){s=e.strstart+I;do{}while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=T?(r=a._tr_tally(e,1,e.match_length-T),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(te(e,!1),0===e.strm.avail_out))return G}return e.insert=0,t===l?(te(e,!0),0===e.strm.avail_out?V:Y):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?G:Z}(i,t):n[i.level].func(i,t);if(w!==V&&w!==Y||(i.status=W),w===G||w===V)return 0===e.avail_out&&(i.last_flush=-1),p;if(w===Z&&(t===f?a._tr_align(i):t!==h&&(a._tr_stored_block(i,0,0,!1),t===d&&(Q(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ee(e),0===e.avail_out))return i.last_flush=-1,p}return t!==l?p:i.wrap<=0?y:(2===i.wrap?(re(i,255&e.adler),re(i,e.adler>>8&255),re(i,e.adler>>16&255),re(i,e.adler>>24&255),re(i,255&e.total_in),re(i,e.total_in>>8&255),re(i,e.total_in>>16&255),re(i,e.total_in>>24&255)):(ne(i,e.adler>>>16),ne(i,65535&e.adler)),ee(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?p:y)},r.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==D&&t!==q&&t!==N&&t!==F&&t!==L&&t!==H&&t!==W?J(e,b):(e.state=null,t===H?J(e,m):p):b},r.deflateSetDictionary=function(e,t){var r,n,a,o,u,c,f,d,l=t.length;if(!e||!e.state)return b;if(2===(o=(r=e.state).wrap)||1===o&&r.status!==D||r.lookahead)return b;for(1===o&&(e.adler=s(e.adler,t,l,0)),r.wrap=0,l>=r.w_size&&(0===o&&(Q(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new i.Buf8(r.w_size),i.arraySet(d,t,l-r.w_size,r.w_size,0),t=d,l=r.w_size),u=e.avail_in,c=e.next_in,f=e.input,e.avail_in=l,e.next_in=0,e.input=t,ae(r);r.lookahead>=T;){n=r.strstart,a=r.lookahead-(T-1);do{r.ins_h=(r.ins_h<>>=_=w>>>24,p-=_,0===(_=w>>>16&255))P[a++]=65535&w;else{if(!(16&_)){if(0==(64&_)){w=y[(65535&w)+(h&(1<<_)-1)];continue t}if(32&_){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}v=65535&w,(_&=15)&&(p<_&&(h+=E[n++]<>>=_,p-=_),p<15&&(h+=E[n++]<>>=_=w>>>24,p-=_,!(16&(_=w>>>16&255))){if(0==(64&_)){w=b[(65535&w)+(h&(1<<_)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(k=65535&w,p<(_&=15)&&(h+=E[n++]<u){e.msg="invalid distance too far back",r.mode=30;break e}if(h>>>=_,p-=_,k>(_=a-s)){if((_=k-_)>f&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(A=0,S=l,0===d){if(A+=c-_,_2;)P[a++]=S[A++],P[a++]=S[A++],P[a++]=S[A++],v-=3;v&&(P[a++]=S[A++],v>1&&(P[a++]=S[A++]))}else{A=a-k;do{P[a++]=P[A++],P[a++]=P[A++],P[a++]=P[A++],v-=3}while(v>2);v&&(P[a++]=P[A++],v>1&&(P[a++]=P[A++]))}break}}break}}while(n>3,h&=(1<<(p-=v<<3))-1,e.next_in=n,e.next_out=a,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ie(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ae(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=k,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(ee),t.distcode=t.distdyn=new n.Buf32(te),t.sane=1,t.back=-1,p):m}function se(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ae(e)):m}function oe(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?m:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,se(e))):m}function ue(e,t){var r,n;return e?(n=new ie,e.state=n,n.window=null,(r=oe(e,t))!==p&&(e.state=null),r):m}var ce,fe,de=!0;function le(e){if(de){var t;for(ce=new n.Buf32(512),fe=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(o(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;o(f,e.lens,0,32,fe,0,e.work,{bits:5}),de=!1}e.lencode=ce,e.lenbits=9,e.distcode=fe,e.distbits=5}function he(e,t,r,i){var a,s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(n.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((a=s.wsize-s.wnext)>i&&(a=i),n.arraySet(s.window,t,r-i,a,s.wnext),(i-=a)?(n.arraySet(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=a,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=a(r.check,xe,2,0),oe=0,ue=0,r.mode=A;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&oe)<<8)+(oe>>8))%31){e.msg="incorrect header check",r.mode=J;break}if((15&oe)!==v){e.msg="unknown compression method",r.mode=J;break}if(ue-=4,ke=8+(15&(oe>>>=4)),0===r.wbits)r.wbits=ke;else if(ke>r.wbits){e.msg="invalid window size",r.mode=J;break}r.dmax=1<>8&1),512&r.flags&&(xe[0]=255&oe,xe[1]=oe>>>8&255,r.check=a(r.check,xe,2,0)),oe=0,ue=0,r.mode=S;case S:for(;ue<32;){if(0===ae)break e;ae--,oe+=ee[re++]<>>8&255,xe[2]=oe>>>16&255,xe[3]=oe>>>24&255,r.check=a(r.check,xe,4,0)),oe=0,ue=0,r.mode=E;case E:for(;ue<16;){if(0===ae)break e;ae--,oe+=ee[re++]<>8),512&r.flags&&(xe[0]=255&oe,xe[1]=oe>>>8&255,r.check=a(r.check,xe,2,0)),oe=0,ue=0,r.mode=P;case P:if(1024&r.flags){for(;ue<16;){if(0===ae)break e;ae--,oe+=ee[re++]<>>8&255,r.check=a(r.check,xe,2,0)),oe=0,ue=0}else r.head&&(r.head.extra=null);r.mode=x;case x:if(1024&r.flags&&((de=r.length)>ae&&(de=ae),de&&(r.head&&(ke=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,ee,re,de,ke)),512&r.flags&&(r.check=a(r.check,ee,de,re)),ae-=de,re+=de,r.length-=de),r.length))break e;r.length=0,r.mode=M;case M:if(2048&r.flags){if(0===ae)break e;de=0;do{ke=ee[re+de++],r.head&&ke&&r.length<65536&&(r.head.name+=String.fromCharCode(ke))}while(ke&&de>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=B;break;case U:for(;ue<32;){if(0===ae)break e;ae--,oe+=ee[re++]<>>=7&ue,ue-=7&ue,r.mode=V;break}for(;ue<3;){if(0===ae)break e;ae--,oe+=ee[re++]<>>=1)){case 0:r.mode=T;break;case 1:if(le(r),r.mode=N,t===h){oe>>>=2,ue-=2;break e}break;case 2:r.mode=z;break;case 3:e.msg="invalid block type",r.mode=J}oe>>>=2,ue-=2;break;case T:for(oe>>>=7&ue,ue-=7&ue;ue<32;){if(0===ae)break e;ae--,oe+=ee[re++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=J;break}if(r.length=65535&oe,oe=0,ue=0,r.mode=I,t===h)break e;case I:r.mode=O;case O:if(de=r.length){if(de>ae&&(de=ae),de>se&&(de=se),0===de)break e;n.arraySet(te,ee,re,de,ie),ae-=de,re+=de,se-=de,ie+=de,r.length-=de;break}r.mode=B;break;case z:for(;ue<14;){if(0===ae)break e;ae--,oe+=ee[re++]<>>=5,ue-=5,r.ndist=1+(31&oe),oe>>>=5,ue-=5,r.ncode=4+(15&oe),oe>>>=4,ue-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=J;break}r.have=0,r.mode=D;case D:for(;r.have>>=3,ue-=3}for(;r.have<19;)r.lens[Me[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,Se={bits:r.lenbits},Ae=o(u,r.lens,0,19,r.lencode,0,r.work,Se),r.lenbits=Se.bits,Ae){e.msg="invalid code lengths set",r.mode=J;break}r.have=0,r.mode=q;case q:for(;r.have>>16&255,ge=65535&Pe,!((be=Pe>>>24)<=ue);){if(0===ae)break e;ae--,oe+=ee[re++]<>>=be,ue-=be,r.lens[r.have++]=ge;else{if(16===ge){for(Ee=be+2;ue>>=be,ue-=be,0===r.have){e.msg="invalid bit length repeat",r.mode=J;break}ke=r.lens[r.have-1],de=3+(3&oe),oe>>>=2,ue-=2}else if(17===ge){for(Ee=be+3;ue>>=be)),oe>>>=3,ue-=3}else{for(Ee=be+7;ue>>=be)),oe>>>=7,ue-=7}if(r.have+de>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=J;break}for(;de--;)r.lens[r.have++]=ke}}if(r.mode===J)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=J;break}if(r.lenbits=9,Se={bits:r.lenbits},Ae=o(c,r.lens,0,r.nlen,r.lencode,0,r.work,Se),r.lenbits=Se.bits,Ae){e.msg="invalid literal/lengths set",r.mode=J;break}if(r.distbits=6,r.distcode=r.distdyn,Se={bits:r.distbits},Ae=o(f,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,Se),r.distbits=Se.bits,Ae){e.msg="invalid distances set",r.mode=J;break}if(r.mode=N,t===h)break e;case N:r.mode=F;case F:if(ae>=6&&se>=258){e.next_out=ie,e.avail_out=se,e.next_in=re,e.avail_in=ae,r.hold=oe,r.bits=ue,s(e,fe),ie=e.next_out,te=e.output,se=e.avail_out,re=e.next_in,ee=e.input,ae=e.avail_in,oe=r.hold,ue=r.bits,r.mode===B&&(r.back=-1);break}for(r.back=0;me=(Pe=r.lencode[oe&(1<>>16&255,ge=65535&Pe,!((be=Pe>>>24)<=ue);){if(0===ae)break e;ae--,oe+=ee[re++]<>we)])>>>16&255,ge=65535&Pe,!(we+(be=Pe>>>24)<=ue);){if(0===ae)break e;ae--,oe+=ee[re++]<>>=we,ue-=we,r.back+=we}if(oe>>>=be,ue-=be,r.back+=be,r.length=ge,0===me){r.mode=Z;break}if(32&me){r.back=-1,r.mode=B;break}if(64&me){e.msg="invalid literal/length code",r.mode=J;break}r.extra=15&me,r.mode=L;case L:if(r.extra){for(Ee=r.extra;ue>>=r.extra,ue-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=H;case H:for(;me=(Pe=r.distcode[oe&(1<>>16&255,ge=65535&Pe,!((be=Pe>>>24)<=ue);){if(0===ae)break e;ae--,oe+=ee[re++]<>we)])>>>16&255,ge=65535&Pe,!(we+(be=Pe>>>24)<=ue);){if(0===ae)break e;ae--,oe+=ee[re++]<>>=we,ue-=we,r.back+=we}if(oe>>>=be,ue-=be,r.back+=be,64&me){e.msg="invalid distance code",r.mode=J;break}r.offset=ge,r.extra=15&me,r.mode=W;case W:if(r.extra){for(Ee=r.extra;ue>>=r.extra,ue-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=J;break}r.mode=G;case G:if(0===se)break e;if(de=fe-se,r.offset>de){if((de=r.offset-de)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=J;break}de>r.wnext?(de-=r.wnext,pe=r.wsize-de):pe=r.wnext-de,de>r.length&&(de=r.length),ye=r.window}else ye=te,pe=ie-r.offset,de=r.length;de>se&&(de=se),se-=de,r.length-=de;do{te[ie++]=ye[pe++]}while(--de);0===r.length&&(r.mode=F);break;case Z:if(0===se)break e;te[ie++]=r.length,se--,r.mode=F;break;case V:if(r.wrap){for(;ue<32;){if(0===ae)break e;ae--,oe|=ee[re++]<=1&&0===T[P];P--);if(x>P&&(x=P),0===P)return c[f++]=20971520,c[f++]=20971520,l.bits=1,0;for(E=1;E0&&(0===e||1!==P))return-1;for(I[1]=0,A=1;A<15;A++)I[A+1]=I[A]+T[A];for(S=0;S852||2===e&&U>592)return 1;for(;;){w=A-C,d[S]g?(_=O[z+d[S]],v=B[j+d[S]]):(_=96,v=0),h=1<>C)+(p-=h)]=w<<24|_<<16|v|0}while(0!==p);for(h=1<>=1;if(0!==h?(R&=h-1,R+=h):R=0,S++,0==--T[A]){if(A===P)break;A=t[r+d[S]]}if(A>x&&(R&b)!==y){for(0===C&&(C=x),m+=E,K=1<<(M=A-C);M+C852||2===e&&U>592)return 1;c[y=R&b]=x<<24|M<<16|m-f|0}}return 0!==R&&(c[m+R]=A-C<<24|64<<16|0),l.bits=x,0}},{"../utils/common":53}],63:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],64:[function(e,t,r){"use strict";var n=e("../utils/common"),i=4,a=0,s=1,o=2;function u(e){for(var t=e.length;--t>=0;)e[t]=0}var c=0,f=1,d=2,l=29,h=256,p=h+1+l,y=30,b=19,m=2*p+1,g=15,w=16,_=7,v=256,k=16,A=17,S=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],P=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],C=new Array(2*(p+2));u(C);var K=new Array(2*y);u(K);var U=new Array(512);u(U);var R=new Array(256);u(R);var B=new Array(l);u(B);var j,T,I,O=new Array(y);function z(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function D(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function q(e){return e<256?U[e]:U[256+(e>>>7)]}function N(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function F(e,t,r){e.bi_valid>w-r?(e.bi_buf|=t<>w-e.bi_valid,e.bi_valid+=r-w):(e.bi_buf|=t<>>=1,r<<=1}while(--t>0);return r>>>1}function W(e,t,r){var n,i,a=new Array(g+1),s=0;for(n=1;n<=g;n++)a[n]=s=s+r[n-1]<<1;for(i=0;i<=t;i++){var o=e[2*i+1];0!==o&&(e[2*i]=H(a[o]++,o))}}function G(e){var t;for(t=0;t8?N(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function V(e,t,r,n){var i=2*t,a=2*r;return e[i]>1;r>=1;r--)Y(e,a,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Y(e,a,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,a[2*i]=a[2*r]+a[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,a[2*r+1]=a[2*n+1]=i,e.heap[1]=i++,Y(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,a,s,o,u=t.dyn_tree,c=t.max_code,f=t.stat_desc.static_tree,d=t.stat_desc.has_stree,l=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,p=t.stat_desc.max_length,y=0;for(a=0;a<=g;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;rp&&(a=p,y++),u[2*n+1]=a,n>c||(e.bl_count[a]++,s=0,n>=h&&(s=l[n-h]),o=u[2*n],e.opt_len+=o*(a+s),d&&(e.static_len+=o*(f[2*n+1]+s)));if(0!==y){do{for(a=p-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[p]--,y-=2}while(y>0);for(a=p;0!==a;a--)for(n=e.bl_count[a];0!==n;)(i=e.heap[--r])>c||(u[2*i+1]!==a&&(e.opt_len+=(a-u[2*i+1])*u[2*i],u[2*i+1]=a),n--)}}(e,t),W(a,c,e.bl_count)}function X(e,t,r){var n,i,a=-1,s=t[1],o=0,u=7,c=4;for(0===s&&(u=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=s,s=t[2*(n+1)+1],++o>=7;n0?(e.strm.data_type===o&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return a;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t=3&&0===e.bl_tree[2*M[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),u=e.opt_len+3+7>>>3,(c=e.static_len+3+7>>>3)<=u&&(u=c)):u=c=r+5,r+4<=u&&-1!==t?te(e,t,r,n):e.strategy===i||c===u?(F(e,(f<<1)+(n?1:0),3),$(e,C,K)):(F(e,(d<<1)+(n?1:0),3),function(e,t,r,n){var i;for(F(e,t-257,5),F(e,r-1,5),F(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(R[r]+h+1)]++,e.dyn_dtree[2*q(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){F(e,f<<1,3),L(e,v,C),function(e){16===e.bi_valid?(N(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":53}],65:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],66:[function(e,t,r){var n,i,a=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var c,f=[],d=!1,l=-1;function h(){d&&c&&(d=!1,c.length?f=c.concat(f):l=-1,f.length&&p())}function p(){if(!d){var e=u(h);d=!0;for(var t=f.length;t;){for(c=f,f=[];++l1)for(var r=1;r0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=n[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var i=r-e;t|=(this.curByte&n[e]<>i,this.bitOffset+=e,e=0}}return t},i.prototype.seek=function(e){var t=e%8,r=(e-t)/8;this.bitOffset=t,this.stream.seek(r),this.hasByte=!1},i.prototype.pi=function(){var e,t=new Uint8Array(6);for(e=0;e("00"+e.toString(16)).slice(-2)).join("")}(t)},t.exports=i},{}],68:[function(e,t,r){"use strict";var n;t.exports=(n=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]),function(){var e=4294967295;this.getCRC=function(){return~e>>>0},this.updateCRC=function(t){e=e<<8^n[255&(e>>>24^t)]},this.updateCRCRun=function(t,r){for(;r-- >0;)e=e<<8^n[255&(e>>>24^t)]}})},{}],69:[function(e,t,r){"use strict";var n=e("./bitreader"),i=e("./stream"),a=e("./crc32"),s=function(e,t){var r,n=e[t];for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=n,n},o={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},u={};u[o.LAST_BLOCK]="Bad file checksum",u[o.NOT_BZIP_DATA]="Not bzip data",u[o.UNEXPECTED_INPUT_EOF]="Unexpected input EOF",u[o.UNEXPECTED_OUTPUT_EOF]="Unexpected output EOF",u[o.DATA_ERROR]="Data error",u[o.OUT_OF_MEMORY]="Out of memory",u[o.OBSOLETE_INPUT]="Obsolete (pre 0.9.5) bzip format not supported.";var c=function(e,t){var r=u[e]||"unknown error";t&&(r+=": "+t);var n=new TypeError(r);throw n.errorCode=e,n},f=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};f.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new a,!0):(this.writeCount=-1,!1)},f.prototype._start_bunzip=function(e,t){var r=new Uint8Array(4);4===e.read(r,0,4)&&"BZh"===String.fromCharCode(r[0],r[1],r[2])||c(o.NOT_BZIP_DATA,"bad magic");var i=r[3]-48;(i<1||i>9)&&c(o.NOT_BZIP_DATA,"level out of range"),this.reader=new n(e),this.dbufSize=1e5*i,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},f.prototype._get_next_block=function(){var e,t,r,n=this.reader,i=n.pi();if("177245385090"===i)return!1;"314159265359"!==i&&c(o.NOT_BZIP_DATA),this.targetBlockCRC=n.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,n.read(1)&&c(o.OBSOLETE_INPUT);var a=n.read(24);a>this.dbufSize&&c(o.DATA_ERROR,"initial position out of bounds");var u=n.read(16),f=new Uint8Array(256),d=0;for(e=0;e<16;e++)if(u&1<<15-e){var l=16*e;for(r=n.read(16),t=0;t<16;t++)r&1<<15-t&&(f[d++]=l+t)}var h=n.read(3);(h<2||h>6)&&c(o.DATA_ERROR);var p=n.read(15);0===p&&c(o.DATA_ERROR);var y=new Uint8Array(256);for(e=0;e=h&&c(o.DATA_ERROR);b[e]=s(y,t)}var m,g=d+2,w=[];for(t=0;t20)&&c(o.DATA_ERROR),n.read(1);)n.read(1)?u--:u++;k[e]=u}for(_=v=k[0],e=1;ev?v=k[e]:k[e]<_&&(_=k[e]);m={},w.push(m),m.permute=new Uint16Array(258),m.limit=new Uint32Array(22),m.base=new Uint32Array(21),m.minLen=_,m.maxLen=v;var S=0;for(e=_;e<=v;e++)for(A[e]=m.limit[e]=0,u=0;u=p&&c(o.DATA_ERROR),m=w[b[C++]]),e=m.minLen,t=n.read(e);e>m.maxLen&&c(o.DATA_ERROR),!(t<=m.limit[e]);e++)t=t<<1|n.read(1);((t-=m.base[e])<0||t>=258)&&c(o.DATA_ERROR);var U=m.permute[t];if(0!==U&&1!==U){if(x)for(x=0,M+u>this.dbufSize&&c(o.DATA_ERROR),E[P=f[y[0]]]+=u;u--;)K[M++]=P;if(U>d)break;M>=this.dbufSize&&c(o.DATA_ERROR),E[P=f[P=s(y,e=U-1)]]++,K[M++]=P}else x||(x=1,u=0),u+=0===U?x:2*x,x<<=1}for((a<0||a>=M)&&c(o.DATA_ERROR),t=0,e=0;e<256;e++)r=t+E[e],E[e]=t,t=r;for(e=0;e>=8,j=-1),this.writePos=R,this.writeCurrent=B,this.writeCount=M,this.writeRun=j,!0},f.prototype._read_bunzip=function(e,t){var r,n,i;if(this.writeCount<0)return 0;for(var a=this.dbuf,s=this.writePos,u=this.writeCurrent,f=this.writeCount,d=(this.outputsize,this.writeRun);f;){for(f--,n=u,u=255&(s=a[s]),s>>=8,3==d++?(r=u,i=n,u=-1):(r=1,i=u),this.blockCRC.updateCRCRun(i,r);r--;)this.outputStream.writeByte(i),this.nextoutput++;u!=n&&(d=0)}return this.writeCount=f,this.blockCRC.getCRC()!==this.targetBlockCRC&&c(o.DATA_ERROR,"Bad block CRC (got "+this.blockCRC.getCRC().toString(16)+" expected "+this.targetBlockCRC.toString(16)+")"),this.nextoutput};var d=function(e){if("readByte"in e)return e;var t=new i;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(e){this.pos=e},t.eof=function(){return this.pos>=e.length},t},l=function(e){var t=new i,r=!0;if(e)if("number"==typeof e)t.buffer=new Uint8Array(e),r=!1;else{if("writeByte"in e)return e;t.buffer=e,r=!1}else t.buffer=new Uint8Array(16384);return t.pos=0,t.writeByte=function(e){if(r&&this.pos>=this.buffer.length){var t=new Uint8Array(2*this.buffer.length);t.set(this.buffer),this.buffer=t}this.buffer[this.pos++]=e},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!r)throw new TypeError("outputsize does not match decoded input");var e=new Uint8Array(this.pos);e.set(this.buffer.subarray(0,this.pos)),this.buffer=e}return this.buffer},t._coerced=!0,t};f.Err=o,f.decode=function(e,t,r){for(var n=d(e),i=l(t),a=new f(n,i);!("eof"in n&&n.eof());)if(a._init_block())a._read_bunzip();else{var s=a.reader.read(32)>>>0;if(s!==a.streamCRC&&c(o.DATA_ERROR,"Bad stream CRC (got "+a.streamCRC.toString(16)+" expected "+s.toString(16)+")"),!(r&&"eof"in n)||n.eof())break;a._start_bunzip(n,i)}if("getBuffer"in i)return i.getBuffer()},f.decodeBlock=function(e,t,r){var n=d(e),i=l(r),s=new f(n,i);if(s.reader.seek(t),s._get_next_block()&&(s.blockCRC=new a,s.writeCopies=0,s._read_bunzip()),"getBuffer"in i)return i.getBuffer()},f.table=function(e,t,r){var n=new i;n.delegate=d(e),n.pos=0,n.readByte=function(){return this.pos++,this.delegate.readByte()},n.delegate.eof&&(n.eof=n.delegate.eof.bind(n.delegate));var a=new i;a.pos=0,a.writeByte=function(){this.pos++};for(var s=new f(n,a),o=s.dbufSize;!("eof"in n&&n.eof());){var u=8*n.pos+s.reader.bitOffset;if(s.reader.hasByte&&(u-=8),s._init_block()){var c=a.pos;s._read_bunzip(),t(u,a.pos-c)}else{s.reader.read(32);if(!(r&&"eof"in n)||n.eof())break;s._start_bunzip(n,a),console.assert(s.dbufSize===o,"shouldn't change block size within multistream file")}}},f.Stream=i,t.exports=f},{"./bitreader":67,"./crc32":68,"./stream":70}],70:[function(e,t,r){"use strict";var n=function(){};n.prototype.readByte=function(){throw new Error("abstract method readByte() not implemented")},n.prototype.read=function(e,t,r){for(var n=0;n>6*r)+i];r>0;){var u=t>>6*(r-1);s.push(128|63&u),r-=1}return s}}f.prototype={decode:function(e,t){var r;r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=i(t),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(t.stream);for(var n,a=new s(r),u=[];!a.endOfStream()&&(n=this._decoder.handler(a,a.read()))!==o;)null!==n&&(Array.isArray(n)?u.push.apply(u,n):u.push(n));if(!this._streaming){do{if((n=this._decoder.handler(a,a.read()))===o)break;null!==n&&(Array.isArray(n)?u.push.apply(u,n):u.push(n))}while(!a.endOfStream());this._decoder=null}return u.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===u[0]?(this._BOMseen=!0,u.shift()):this._BOMseen=!0)),function(e){for(var t="",r=0;r>10),56320+(1023&n)))}return t}(u)}},d.prototype={encode:function(e,t){e=e?String(e):"",t=i(t),this._streaming||(this._encoder=new h(this._options)),this._streaming=Boolean(t.stream);for(var r,n=[],a=new s(function(e){for(var t=String(e),r=t.length,n=0,i=[];n57343)i.push(a);else if(56320<=a&&a<=57343)i.push(65533);else if(55296<=a&&a<=56319)if(n===r-1)i.push(65533);else{var s=e.charCodeAt(n+1);if(56320<=s&&s<=57343){var o=1023&a,u=1023&s;i.push(65536+(o<<10)+u),n+=1}else i.push(65533)}n+=1}return i}(e));!a.endOfStream()&&(r=this._encoder.handler(a,a.read()))!==o;)Array.isArray(r)?n.push.apply(n,r):n.push(r);if(!this._streaming){for(;(r=this._encoder.handler(a,a.read()))!==o;)Array.isArray(r)?n.push.apply(n,r):n.push(r);this._encoder=null}return new Uint8Array(n)}},r.TextEncoder=d,r.TextDecoder=f},{}],72:[function(e,t,r){!function(t){"use strict";var r=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>>8)-1}(e,t,r,n,32)}function p(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function y(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function b(e,t,r){for(var n,i=~(r-1),a=0;a<16;a++)n=i&(e[a]^t[a]),e[a]^=n,t[a]^=n}function m(e,t){var n,i,a,s=r(),o=r();for(n=0;n<16;n++)o[n]=t[n];for(y(o),y(o),y(o),i=0;i<2;i++){for(s[0]=o[0]-65517,n=1;n<15;n++)s[n]=o[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),a=s[15]>>16&1,s[14]&=65535,b(o,s,1-a)}for(n=0;n<16;n++)e[2*n]=255&o[n],e[2*n+1]=o[n]>>8}function g(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return m(r,e),m(n,t),h(r,0,n,0)}function w(e){var t=new Uint8Array(32);return m(t,e),1&t[0]}function _(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function v(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function k(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function A(e,t,r){var n,i,a=0,s=0,o=0,u=0,c=0,f=0,d=0,l=0,h=0,p=0,y=0,b=0,m=0,g=0,w=0,_=0,v=0,k=0,A=0,S=0,E=0,P=0,x=0,M=0,C=0,K=0,U=0,R=0,B=0,j=0,T=0,I=r[0],O=r[1],z=r[2],D=r[3],q=r[4],N=r[5],F=r[6],L=r[7],H=r[8],W=r[9],G=r[10],Z=r[11],V=r[12],Y=r[13],$=r[14],J=r[15];a+=(n=t[0])*I,s+=n*O,o+=n*z,u+=n*D,c+=n*q,f+=n*N,d+=n*F,l+=n*L,h+=n*H,p+=n*W,y+=n*G,b+=n*Z,m+=n*V,g+=n*Y,w+=n*$,_+=n*J,s+=(n=t[1])*I,o+=n*O,u+=n*z,c+=n*D,f+=n*q,d+=n*N,l+=n*F,h+=n*L,p+=n*H,y+=n*W,b+=n*G,m+=n*Z,g+=n*V,w+=n*Y,_+=n*$,v+=n*J,o+=(n=t[2])*I,u+=n*O,c+=n*z,f+=n*D,d+=n*q,l+=n*N,h+=n*F,p+=n*L,y+=n*H,b+=n*W,m+=n*G,g+=n*Z,w+=n*V,_+=n*Y,v+=n*$,k+=n*J,u+=(n=t[3])*I,c+=n*O,f+=n*z,d+=n*D,l+=n*q,h+=n*N,p+=n*F,y+=n*L,b+=n*H,m+=n*W,g+=n*G,w+=n*Z,_+=n*V,v+=n*Y,k+=n*$,A+=n*J,c+=(n=t[4])*I,f+=n*O,d+=n*z,l+=n*D,h+=n*q,p+=n*N,y+=n*F,b+=n*L,m+=n*H,g+=n*W,w+=n*G,_+=n*Z,v+=n*V,k+=n*Y,A+=n*$,S+=n*J,f+=(n=t[5])*I,d+=n*O,l+=n*z,h+=n*D,p+=n*q,y+=n*N,b+=n*F,m+=n*L,g+=n*H,w+=n*W,_+=n*G,v+=n*Z,k+=n*V,A+=n*Y,S+=n*$,E+=n*J,d+=(n=t[6])*I,l+=n*O,h+=n*z,p+=n*D,y+=n*q,b+=n*N,m+=n*F,g+=n*L,w+=n*H,_+=n*W,v+=n*G,k+=n*Z,A+=n*V,S+=n*Y,E+=n*$,P+=n*J,l+=(n=t[7])*I,h+=n*O,p+=n*z,y+=n*D,b+=n*q,m+=n*N,g+=n*F,w+=n*L,_+=n*H,v+=n*W,k+=n*G,A+=n*Z,S+=n*V,E+=n*Y,P+=n*$,x+=n*J,h+=(n=t[8])*I,p+=n*O,y+=n*z,b+=n*D,m+=n*q,g+=n*N,w+=n*F,_+=n*L,v+=n*H,k+=n*W,A+=n*G,S+=n*Z,E+=n*V,P+=n*Y,x+=n*$,M+=n*J,p+=(n=t[9])*I,y+=n*O,b+=n*z,m+=n*D,g+=n*q,w+=n*N,_+=n*F,v+=n*L,k+=n*H,A+=n*W,S+=n*G,E+=n*Z,P+=n*V,x+=n*Y,M+=n*$,C+=n*J,y+=(n=t[10])*I,b+=n*O,m+=n*z,g+=n*D,w+=n*q,_+=n*N,v+=n*F,k+=n*L,A+=n*H,S+=n*W,E+=n*G,P+=n*Z,x+=n*V,M+=n*Y,C+=n*$,K+=n*J,b+=(n=t[11])*I,m+=n*O,g+=n*z,w+=n*D,_+=n*q,v+=n*N,k+=n*F,A+=n*L,S+=n*H,E+=n*W,P+=n*G,x+=n*Z,M+=n*V,C+=n*Y,K+=n*$,U+=n*J,m+=(n=t[12])*I,g+=n*O,w+=n*z,_+=n*D,v+=n*q,k+=n*N,A+=n*F,S+=n*L,E+=n*H,P+=n*W,x+=n*G,M+=n*Z,C+=n*V,K+=n*Y,U+=n*$,R+=n*J,g+=(n=t[13])*I,w+=n*O,_+=n*z,v+=n*D,k+=n*q,A+=n*N,S+=n*F,E+=n*L,P+=n*H,x+=n*W,M+=n*G,C+=n*Z,K+=n*V,U+=n*Y,R+=n*$,B+=n*J,w+=(n=t[14])*I,_+=n*O,v+=n*z,k+=n*D,A+=n*q,S+=n*N,E+=n*F,P+=n*L,x+=n*H,M+=n*W,C+=n*G,K+=n*Z,U+=n*V,R+=n*Y,B+=n*$,j+=n*J,_+=(n=t[15])*I,s+=38*(k+=n*z),o+=38*(A+=n*D),u+=38*(S+=n*q),c+=38*(E+=n*N),f+=38*(P+=n*F),d+=38*(x+=n*L),l+=38*(M+=n*H),h+=38*(C+=n*W),p+=38*(K+=n*G),y+=38*(U+=n*Z),b+=38*(R+=n*V),m+=38*(B+=n*Y),g+=38*(j+=n*$),w+=38*(T+=n*J),a=(n=(a+=38*(v+=n*O))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=(a+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),a+=i-1+37*(i-1),e[0]=a,e[1]=s,e[2]=o,e[3]=u,e[4]=c,e[5]=f,e[6]=d,e[7]=l,e[8]=h,e[9]=p,e[10]=y,e[11]=b,e[12]=m,e[13]=g,e[14]=w,e[15]=_}function S(e,t){A(e,t,t)}function E(e,t){var n,i=r();for(n=0;n<16;n++)i[n]=t[n];for(n=253;n>=0;n--)S(i,i),2!==n&&4!==n&&A(i,i,t);for(n=0;n<16;n++)e[n]=i[n]}function P(e,t,n){var i,a,s=new Uint8Array(32),u=new Float64Array(80),c=r(),f=r(),d=r(),l=r(),h=r(),p=r();for(a=0;a<31;a++)s[a]=t[a];for(s[31]=127&t[31]|64,s[0]&=248,_(u,n),a=0;a<16;a++)f[a]=u[a],l[a]=c[a]=d[a]=0;for(c[0]=l[0]=1,a=254;a>=0;--a)b(c,f,i=s[a>>>3]>>>(7&a)&1),b(d,l,i),v(h,c,d),k(c,c,d),v(d,f,l),k(f,f,l),S(l,h),S(p,c),A(c,d,c),A(d,f,h),v(h,c,d),k(c,c,d),S(f,c),k(d,l,p),A(c,d,o),v(c,c,l),A(d,d,c),A(c,l,p),A(l,f,u),S(f,h),b(c,f,i),b(d,l,i);for(a=0;a<16;a++)u[a+16]=c[a],u[a+32]=d[a],u[a+48]=f[a],u[a+64]=l[a];var y=u.subarray(32),g=u.subarray(16);return E(y,y),A(g,g,y),m(e,g),0}function x(e,t){return P(e,t,i)}function M(e,t){var n=r(),i=r(),a=r(),s=r(),o=r(),u=r(),f=r(),d=r(),l=r();k(n,e[1],e[0]),k(l,t[1],t[0]),A(n,n,l),v(i,e[0],e[1]),v(l,t[0],t[1]),A(i,i,l),A(a,e[3],t[3]),A(a,a,c),A(s,e[2],t[2]),v(s,s,s),k(o,i,n),k(u,s,a),v(f,s,a),v(d,i,n),A(e[0],o,u),A(e[1],d,f),A(e[2],f,u),A(e[3],o,d)}function C(e,t,r){var n;for(n=0;n<4;n++)b(e[n],t[n],r)}function K(e,t){var n=r(),i=r(),a=r();E(a,t[2]),A(n,t[0],a),A(i,t[1],a),m(e,i),e[31]^=w(n)<<7}function U(e,t,r){var n,i;for(p(e[0],a),p(e[1],s),p(e[2],s),p(e[3],a),i=255;i>=0;--i)C(e,t,n=r[i/8|0]>>(7&i)&1),M(t,e),M(e,e),C(e,t,n)}function R(e,t){var n=[r(),r(),r(),r()];p(n[0],f),p(n[1],d),p(n[2],s),A(n[3],f,d),U(e,n,t)}function B(e,i,a){var s,o,u=[r(),r(),r(),r()];for(a||n(i,32),(s=t.hash(i.subarray(0,32)))[0]&=248,s[31]&=127,s[31]|=64,R(u,s),K(e,u),o=0;o<32;o++)i[o+32]=e[o];return 0}var j=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function T(e,t){var r,n,i,a;for(n=63;n>=32;--n){for(r=0,i=n-32,a=n-12;i>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;i++)t[i]+=r-(t[31]>>4)*j[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*j[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function I(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;T(e,r)}function O(e,t){var n=r(),i=r(),o=r(),c=r(),f=r(),d=r(),h=r();return p(e[2],s),_(e[1],t),S(o,e[1]),A(c,o,u),k(o,o,e[2]),v(c,e[2],c),S(f,c),S(d,f),A(h,d,f),A(n,h,o),A(n,n,c),function(e,t){var n,i=r();for(n=0;n<16;n++)i[n]=t[n];for(n=250;n>=0;n--)S(i,i),1!==n&&A(i,i,t);for(n=0;n<16;n++)e[n]=i[n]}(n,n),A(n,n,o),A(n,n,c),A(n,n,c),A(e[0],n,c),S(i,e[0]),A(i,i,c),g(i,o)&&A(e[0],e[0],l),S(i,e[0]),A(i,i,c),g(i,o)?-1:(w(e[0])===t[31]>>7&&k(e[0],a,e[0]),A(e[3],e[0],e[1]),0)}function z(){for(var e=0;e=0},t.sign.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(64);return B(e,t),{publicKey:e,secretKey:t}},t.sign.keyPair.fromSecretKey=function(e){if(z(e),64!==e.length)throw new Error("bad secret key size");for(var t=new Uint8Array(32),r=0;r{t.enqueue(r),e.pause()}),e.on("end",()=>t.close()),e.on("error",e=>t.error(e))},pull(){e.resume()},cancel(t){if(e.pause(),e.cancel)return e.cancel(t)}})};class e extends o{constructor(e,t){super(t),this._webStream=e,this._reader=s.default.getReader(e),this._reading=!1,this._doneReadingPromise=Promise.resolve(),this._cancelling=!1}_read(e){if(this._reading||this._cancelling)return;this._reading=!0;this._doneReadingPromise=(async()=>{try{for(;;){var e=await this._reader.read();const t=e.done,r=e.value;if(t){this.push(null);break}if(!this.push(r)||this._cancelling){this._reading=!1;break}}}catch(t){this.emit("error",t)}})()}async cancel(e){return this._cancelling=!0,await this._doneReadingPromise,this._reader.releaseLock(),this._webStream.cancel(e)}}r.webToNode=c=function(t){return new e(t)}}r.nodeToWeb=u,r.webToNode=c},{"./streams":75,"./util":76,stream:"stream"}],74:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.externalBuffer=r.Reader=void 0;var n,i=e("./streams"),a=(n=i)&&n.__esModule?n:{default:n};const s=new WeakSet,o=Symbol("externalBuffer");function u(e){this.stream=e,e[o]&&(this[o]=e[o].slice());let t=a.default.isStream(e);if("node"===t&&(e=a.default.nodeToWeb(e)),t){const t=e.getReader();return this._read=t.read.bind(t),void(this._releaseLock=(()=>{t.closed.catch(function(){}),t.releaseLock()}))}let r=!1;this._read=(async()=>r||s.has(e)?{value:void 0,done:!0}:(r=!0,{value:e,done:!1})),this._releaseLock=(()=>{if(r)try{s.add(e)}catch(t){}})}u.prototype.read=async function(){if(this[o]&&this[o].length){return{done:!1,value:this[o].shift()}}return this._read()},u.prototype.releaseLock=function(){this[o]&&(this.stream[o]=this[o]),this._releaseLock()},u.prototype.readLine=async function(){let e,t=[];for(;!e;){var r=await this.read();let n=r.done,i=r.value;if(i+="",n)return t.length?a.default.concat(t):void 0;const s=i.indexOf("\n")+1;s&&(e=a.default.concat(t.concat(i.substr(0,s))),t=[]),s!==i.length&&t.push(i.substr(s))}return this.unshift(...t),e},u.prototype.readByte=async function(){var e=await this.read();const t=e.done,r=e.value;if(t)return;const n=r[0];return this.unshift(a.default.slice(r,1)),n},u.prototype.readBytes=async function(e){const t=[];let r=0;for(;;){var n=await this.read();const i=n.done,s=n.value;if(i)return t.length?a.default.concat(t):void 0;if(t.push(s),(r+=s.length)>=e){const r=a.default.concat(t);return this.unshift(a.default.slice(r,e)),a.default.slice(r,0,e)}}},u.prototype.peekBytes=async function(e){const t=await this.readBytes(e);return this.unshift(t),t},u.prototype.unshift=function(...e){this[o]||(this[o]=[]),this[o].unshift(...e.filter(e=>e&&e.length))},u.prototype.readToEnd=async function(e=a.default.concat){const t=[];for(;;){var r=await this.read();const e=r.done,n=r.value;if(e)break;t.push(n)}return e(t)},r.Reader=u,r.externalBuffer=o},{"./streams":75}],75:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./util"),i=e("./node-conversions"),a=e("./reader");const s=n.isNode&&e("buffer").Buffer;function o(e){let t=(0,n.isStream)(e);return"node"===t?(0,i.nodeToWeb)(e):t?e:new ReadableStream({start(t){t.enqueue(e),t.close()}})}function u(e){return e.some(n.isStream)?c(e):"string"==typeof e[0]?e.join(""):s&&s.isBuffer(e[0])?s.concat(e):(0,n.concatUint8Array)(e)}function c(e){e=e.map(o);const t=p(async function(e){await Promise.all(n.map(t=>_(t,e)))});let r=Promise.resolve();const n=e.map((n,i)=>b(n,(n,a)=>r=r.then(()=>l(n,t.writable,{preventClose:i!==e.length-1}))));return t.readable}function f(e){return new a.Reader(e)}function d(e){const t=e.getWriter(),r=t.releaseLock;return t.releaseLock=(()=>{t.closed.catch(function(){}),r.call(t)}),t}async function l(e,t,r){e=o(e);try{if(e[a.externalBuffer]){const r=d(t);for(let t=0;t{t=e}),t=null)},close:r.close.bind(r),abort:r.error.bind(r)})}}function y(e,t=(()=>void 0),r=(()=>void 0)){if((0,n.isStream)(e))return h(e,{async transform(e,r){try{const i=await t(e);void 0!==i&&r.enqueue(i)}catch(n){r.error(n)}},async flush(e){try{const n=await r();void 0!==n&&e.enqueue(n)}catch(t){e.error(t)}}});const i=t(e),a=r();return void 0!==i&&void 0!==a?u([i,a]):void 0!==i?i:a}function b(e,t){let r;const n=new TransformStream({start(e){r=e}}),i=l(e,n.writable),a=p(async function(){r.error(new Error("Readable side was canceled.")),await i,await new Promise(setTimeout)});return t(n.readable,a.writable),a.readable}function m(e,t){Object.entries(Object.getOwnPropertyDescriptors(ReadableStream.prototype)).forEach(([r,n])=>{"constructor"!==r&&(n.value?n.value=n.value.bind(t):n.get=n.get.bind(t),Object.defineProperty(e,r,n))})}function g(e,t=0,r=1/0){if((0,n.isStream)(e)){if(t>=0&&r>=0){let n=0;return h(e,{transform(e,i){n=t&&i.enqueue(g(e,Math.max(t-n,0),r-n)),n+=e.length):i.terminate()}})}if(t<0&&(r<0||r===1/0)){let n=[];return y(e,e=>{e.length>=-t?n=[e]:n.push(e)},()=>g(u(n),t,r))}if(0===t&&r<0){let n;return y(e,e=>{const i=n?u([n,e]):e;if(i.length>=-r)return n=g(i,r),g(i,t,r);n=i})}return console.warn(`stream.slice(input, ${t}, ${r}) not implemented efficiently.`),v(async()=>g(await w(e),t,r))}return e[a.externalBuffer]&&(e=u(e[a.externalBuffer].concat([e]))),!(0,n.isUint8Array)(e)||s&&s.isBuffer(e)?e.slice(t,r):(r===1/0&&(r=e.length),e.subarray(t,r))}async function w(e,t){return(0,n.isStream)(e)?f(e).readToEnd(t):e}async function _(e,t){if((0,n.isStream)(e)&&e.cancel)return e.cancel(t)}function v(e){return new ReadableStream({pull:async t=>{try{t.enqueue(await e()),t.close()}catch(r){t.error(r)}}})}r.default={isStream:n.isStream,isUint8Array:n.isUint8Array,toStream:o,concatUint8Array:n.concatUint8Array,concatStream:c,concat:u,getReader:f,getWriter:d,pipe:l,transformRaw:h,transform:y,transformPair:b,parse:function(e,t){let r;const n=b(e,(e,i)=>{const a=f(e);a.remainder=(()=>(a.releaseLock(),l(e,i),n)),r=t(a)});return r},clone:function(e){if((0,n.isStream)(e)){const t=function(e){if((0,n.isStream)(e)){const t=o(e).tee();return t[0][a.externalBuffer]=t[1][a.externalBuffer]=e[a.externalBuffer],t}return[g(e),g(e)]}(e);return m(e,t[0]),t[1]}return g(e)},passiveClone:function(e){return(0,n.isStream)(e)?new ReadableStream({start(t){const r=b(e,async(e,r)=>{const n=f(e),i=d(r);try{for(;;){await i.ready;var a=await n.read();const e=a.done,r=a.value;if(e){try{t.close()}catch(s){}return void(await i.close())}try{t.enqueue(r)}catch(s){}await i.write(r)}}catch(s){t.error(s),await i.abort(s)}});m(e,r)}}):g(e)},slice:g,readToEnd:w,cancel:_,fromAsync:v,nodeToWeb:i.nodeToWeb,webToNode:i.webToNode}}).call(this,e("_process"))},{"./node-conversions":73,"./reader":74,"./util":76,_process:66,buffer:"buffer"}],76:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n="object"==typeof t.process&&"object"==typeof t.process.versions,i=n&&e("stream").Readable;function a(e){return Uint8Array.prototype.isPrototypeOf(e)}r.isNode=n,r.isStream=function(e){return ReadableStream.prototype.isPrototypeOf(e)?"web":!(!i||!i.prototype.isPrototypeOf(e))&&"node"},r.isUint8Array=a,r.concatUint8Array=function(e){if(1===e.length)return e[0];let t=0;for(let i=0;it=>e.hashAlgorithm===t;for(let n=0;n=0;--n)for(let e=f-1;e>=0;--e)d[1]=f*n+(e+1),l[0]=u[0]^d[0],l[1]=u[1]^d[1],l[2]=c[2*e],l[3]=c[2*e+1],u=(l=s(r.decrypt(o(l)))).subarray(0,2),c[2*e]=l[2],c[2*e+1]=l[3];if(u[0]===i[0]&&u[1]===i[1])return o(c);throw new Error("Key Data Integrity failed")}}},{"../util":158,"./cipher":86}],81:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("asmcrypto.js/dist_es5/aes/cfb"),i=u(e("web-stream-tools")),a=u(e("./cipher")),s=u(e("../config")),o=u(e("../util"));function u(e){return e&&e.__esModule?e:{default:e}}const c=o.default.getWebCrypto(),f=o.default.getNodeCrypto(),d=o.default.getNodeBuffer(),l=f?f.getCiphers():[],h={idea:l.includes("idea-cfb")?"idea-cfb":void 0,"3des":l.includes("des-ede3-cfb")?"des-ede3-cfb":void 0,tripledes:l.includes("des-ede3-cfb")?"des-ede3-cfb":void 0,cast5:l.includes("cast5-cfb")?"cast5-cfb":void 0,blowfish:l.includes("bf-cfb")?"bf-cfb":void 0,aes128:l.includes("aes-128-cfb")?"aes-128-cfb":void 0,aes192:l.includes("aes-192-cfb")?"aes-192-cfb":void 0,aes256:l.includes("aes-256-cfb")?"aes-256-cfb":void 0};r.default={encrypt:function(e,t,r,u){if(o.default.getNodeCrypto()&&h[e])return function(e,t,r,n){t=d.from(t),n=d.from(n);const a=new f.createCipheriv(h[e],t,n);return i.default.transform(r,e=>new Uint8Array(a.update(d.from(e))))}(e,t,r,u);if("aes"===e.substr(0,3))return function(e,t,r,u){if(o.default.getWebCrypto()&&24!==t.length&&!o.default.isStream(r)&&r.length>=3e3*s.default.min_bytes_for_web_crypto)return async function(e,t,r,n){const i=await c.importKey("raw",t,{name:"AES-CBC"},!1,["encrypt"]),s=a.default[e].blockSize,u=o.default.concatUint8Array([new Uint8Array(s),r]),f=new Uint8Array(await c.encrypt({name:"AES-CBC",iv:n},i,u)).subarray(0,r.length);return function(e,t){for(let r=0;rf.AES_Encrypt_process(e),()=>f.AES_Encrypt_finish())}(e,t,r,u);const l=new a.default[e](t),p=l.blockSize,y=u.slice();let b=new Uint8Array;const m=e=>{e&&(b=o.default.concatUint8Array([b,e]));const t=new Uint8Array(b.length);let r,n=0;for(;e?b.length>=p:b.length;){const e=l.encrypt(y);for(r=0;rnew Uint8Array(a.update(d.from(e))))}(e,t,r,s);if("aes"===e.substr(0,3))return function(e,t,r,a){if(o.default.isStream(r)){const e=new n.AES_CFB(t,a);return i.default.transform(r,t=>e.AES_Decrypt_process(t),()=>e.AES_Decrypt_finish())}return n.AES_CFB.decrypt(r,t,a)}(0,t,r,s);const u=new a.default[e](t),c=u.blockSize;let l=s,p=new Uint8Array;const y=e=>{e&&(p=o.default.concatUint8Array([p,e]));const t=new Uint8Array(p.length);let r,n=0;for(;e?p.length>=c:p.length;){const e=u.encrypt(l);for(l=p,r=0;r>>=8),i=255&(e>>>=8),a=255&(e>>>=8);return t=this.sboxes[0][a]+this.sboxes[1][i],t^=this.sboxes[2][n],t+=this.sboxes[3][r]},n.prototype._encrypt_block=function(e){let t,r=e[0],n=e[1];for(t=0;t>>24-8*t&255,i[t+n]=r[1]>>>24-8*t&255;return i},n.prototype._decrypt_block=function(e){let t,r=e[0],n=e[1];for(t=this.NN+1;t>1;--t){const e=r^=this.parray[t];r=n=this._F(r)^n,n=e}r^=this.parray[1],n^=this.parray[0],e[0]=this._clean(n),e[1]=this._clean(r)},n.prototype.init=function(e){let t,r=0;for(this.parray=[],t=0;t=e.length&&(r=0);this.parray[t]=this.PARRAY[t]^n}for(this.sboxes=[],t=0;t<4;++t)for(this.sboxes[t]=[],r=0;r<256;++r)this.sboxes[t][r]=this.SBOXES[t][r];const n=[0,0];for(t=0;t>>24&255,t[a+1]=u>>>16&255,t[a+2]=u>>>8&255,t[a+3]=255&u,t[a+4]=o>>>24&255,t[a+5]=o>>>16&255,t[a+6]=o>>>8&255,t[a+7]=255&o}return t},this.decrypt=function(e){const t=new Array(e.length);for(let a=0;a>>24&255,t[a+1]=u>>>16&255,t[a+2]=u>>>8&255,t[a+3]=255&u,t[a+4]=o>>>24&255,t[a+5]=o>>16&255,t[a+6]=o>>8&255,t[a+7]=255&o}return t};const e=new Array(4);e[0]=new Array(4),e[0][0]=[4,0,13,15,12,14,8],e[0][1]=[5,2,16,18,17,19,10],e[0][2]=[6,3,23,22,21,20,9],e[0][3]=[7,1,26,25,27,24,11],e[1]=new Array(4),e[1][0]=[0,6,21,23,20,22,16],e[1][1]=[1,4,0,2,1,3,18],e[1][2]=[2,5,7,6,5,4,17],e[1][3]=[3,7,10,9,11,8,19],e[2]=new Array(4),e[2][0]=[4,0,13,15,12,14,8],e[2][1]=[5,2,16,18,17,19,10],e[2][2]=[6,3,23,22,21,20,9],e[2][3]=[7,1,26,25,27,24,11],e[3]=new Array(4),e[3][0]=[0,6,21,23,20,22,16],e[3][1]=[1,4,0,2,1,3,18],e[3][2]=[2,5,7,6,5,4,17],e[3][3]=[3,7,10,9,11,8,19];const t=new Array(4);function r(e,t,r){const n=t+e,i=n<>>32-r;return(a[0][i>>>24]^a[1][i>>>16&255])-a[2][i>>>8&255]+a[3][255&i]}function n(e,t,r){const n=t^e,i=n<>>32-r;return a[0][i>>>24]-a[1][i>>>16&255]+a[2][i>>>8&255]^a[3][255&i]}function i(e,t,r){const n=t-e,i=n<>>32-r;return(a[0][i>>>24]+a[1][i>>>16&255]^a[2][i>>>8&255])-a[3][255&i]}t[0]=new Array(4),t[0][0]=[24,25,23,22,18],t[0][1]=[26,27,21,20,22],t[0][2]=[28,29,19,18,25],t[0][3]=[30,31,17,16,28],t[1]=new Array(4),t[1][0]=[3,2,12,13,8],t[1][1]=[1,0,14,15,13],t[1][2]=[7,6,8,9,3],t[1][3]=[5,4,10,11,7],t[2]=new Array(4),t[2][0]=[19,18,28,29,25],t[2][1]=[17,16,30,31,28],t[2][2]=[23,22,24,25,18],t[2][3]=[21,20,26,27,22],t[3]=new Array(4),t[3][0]=[8,9,7,6,3],t[3][1]=[10,11,5,4,7],t[3][2]=[12,13,3,2,8],t[3][3]=[14,15,1,0,13],this.keySchedule=function(r){const n=new Array(8),i=new Array(32);let s;for(let e=0;e<4;e++)s=4*e,n[e]=r[s]<<24|r[s+1]<<16|r[s+2]<<8|r[s+3];const o=[6,7,4,5];let u,c=0;for(let f=0;f<2;f++)for(let r=0;r<4;r++){for(s=0;s<4;s++){const t=e[r][s];u=n[t[1]],u^=a[4][n[t[2]>>>2]>>>24-8*(3&t[2])&255],u^=a[5][n[t[3]>>>2]>>>24-8*(3&t[3])&255],u^=a[6][n[t[4]>>>2]>>>24-8*(3&t[4])&255],u^=a[7][n[t[5]>>>2]>>>24-8*(3&t[5])&255],u^=a[o[s]][n[t[6]>>>2]>>>24-8*(3&t[6])&255],n[t[0]]=u}for(s=0;s<4;s++){const e=t[r][s];u=a[4][n[e[0]>>>2]>>>24-8*(3&e[0])&255],u^=a[5][n[e[1]>>>2]>>>24-8*(3&e[1])&255],u^=a[6][n[e[2]>>>2]>>>24-8*(3&e[2])&255],u^=a[7][n[e[3]>>>2]>>>24-8*(3&e[3])&255],u^=a[4+s][n[e[4]>>>2]>>>24-8*(3&e[4])&255],i[c]=u,c++}}for(let e=0;e<16;e++)this.masking[e]=i[e],this.rotate[e]=31&i[16+e]};const a=new Array(8);a[0]=[821772500,2678128395,1810681135,1059425402,505495343,2617265619,1610868032,3483355465,3218386727,2294005173,3791863952,2563806837,1852023008,365126098,3269944861,584384398,677919599,3229601881,4280515016,2002735330,1136869587,3744433750,2289869850,2731719981,2714362070,879511577,1639411079,575934255,717107937,2857637483,576097850,2731753936,1725645e3,2810460463,5111599,767152862,2543075244,1251459544,1383482551,3052681127,3089939183,3612463449,1878520045,1510570527,2189125840,2431448366,582008916,3163445557,1265446783,1354458274,3529918736,3202711853,3073581712,3912963487,3029263377,1275016285,4249207360,2905708351,3304509486,1442611557,3585198765,2712415662,2731849581,3248163920,2283946226,208555832,2766454743,1331405426,1447828783,3315356441,3108627284,2957404670,2981538698,3339933917,1669711173,286233437,1465092821,1782121619,3862771680,710211251,980974943,1651941557,430374111,2051154026,704238805,4128970897,3144820574,2857402727,948965521,3333752299,2227686284,718756367,2269778983,2731643755,718440111,2857816721,3616097120,1113355533,2478022182,410092745,1811985197,1944238868,2696854588,1415722873,1682284203,1060277122,1998114690,1503841958,82706478,2315155686,1068173648,845149890,2167947013,1768146376,1993038550,3566826697,3390574031,940016341,3355073782,2328040721,904371731,1205506512,4094660742,2816623006,825647681,85914773,2857843460,1249926541,1417871568,3287612,3211054559,3126306446,1975924523,1353700161,2814456437,2438597621,1800716203,722146342,2873936343,1151126914,4160483941,2877670899,458611604,2866078500,3483680063,770352098,2652916994,3367839148,3940505011,3585973912,3809620402,718646636,2504206814,2914927912,3631288169,2857486607,2860018678,575749918,2857478043,718488780,2069512688,3548183469,453416197,1106044049,3032691430,52586708,3378514636,3459808877,3211506028,1785789304,218356169,3571399134,3759170522,1194783844,1523787992,3007827094,1975193539,2555452411,1341901877,3045838698,3776907964,3217423946,2802510864,2889438986,1057244207,1636348243,3761863214,1462225785,2632663439,481089165,718503062,24497053,3332243209,3344655856,3655024856,3960371065,1195698900,2971415156,3710176158,2115785917,4027663609,3525578417,2524296189,2745972565,3564906415,1372086093,1452307862,2780501478,1476592880,3389271281,18495466,2378148571,901398090,891748256,3279637769,3157290713,2560960102,1447622437,4284372637,216884176,2086908623,1879786977,3588903153,2242455666,2938092967,3559082096,2810645491,758861177,1121993112,215018983,642190776,4169236812,1196255959,2081185372,3508738393,941322904,4124243163,2877523539,1848581667,2205260958,3180453958,2589345134,3694731276,550028657,2519456284,3789985535,2973870856,2093648313,443148163,46942275,2734146937,1117713533,1115362972,1523183689,3717140224,1551984063],a[1]=[522195092,4010518363,1776537470,960447360,4267822970,4005896314,1435016340,1929119313,2913464185,1310552629,3579470798,3724818106,2579771631,1594623892,417127293,2715217907,2696228731,1508390405,3994398868,3925858569,3695444102,4019471449,3129199795,3770928635,3520741761,990456497,4187484609,2783367035,21106139,3840405339,631373633,3783325702,532942976,396095098,3548038825,4267192484,2564721535,2011709262,2039648873,620404603,3776170075,2898526339,3612357925,4159332703,1645490516,223693667,1567101217,3362177881,1029951347,3470931136,3570957959,1550265121,119497089,972513919,907948164,3840628539,1613718692,3594177948,465323573,2659255085,654439692,2575596212,2699288441,3127702412,277098644,624404830,4100943870,2717858591,546110314,2403699828,3655377447,1321679412,4236791657,1045293279,4010672264,895050893,2319792268,494945126,1914543101,2777056443,3894764339,2219737618,311263384,4275257268,3458730721,669096869,3584475730,3835122877,3319158237,3949359204,2005142349,2713102337,2228954793,3769984788,569394103,3855636576,1425027204,108000370,2736431443,3671869269,3043122623,1750473702,2211081108,762237499,3972989403,2798899386,3061857628,2943854345,867476300,964413654,1591880597,1594774276,2179821409,552026980,3026064248,3726140315,2283577634,3110545105,2152310760,582474363,1582640421,1383256631,2043843868,3322775884,1217180674,463797851,2763038571,480777679,2718707717,2289164131,3118346187,214354409,200212307,3810608407,3025414197,2674075964,3997296425,1847405948,1342460550,510035443,4080271814,815934613,833030224,1620250387,1945732119,2703661145,3966000196,1388869545,3456054182,2687178561,2092620194,562037615,1356438536,3409922145,3261847397,1688467115,2150901366,631725691,3840332284,549916902,3455104640,394546491,837744717,2114462948,751520235,2221554606,2415360136,3999097078,2063029875,803036379,2702586305,821456707,3019566164,360699898,4018502092,3511869016,3677355358,2402471449,812317050,49299192,2570164949,3259169295,2816732080,3331213574,3101303564,2156015656,3705598920,3546263921,143268808,3200304480,1638124008,3165189453,3341807610,578956953,2193977524,3638120073,2333881532,807278310,658237817,2969561766,1641658566,11683945,3086995007,148645947,1138423386,4158756760,1981396783,2401016740,3699783584,380097457,2680394679,2803068651,3334260286,441530178,4016580796,1375954390,761952171,891809099,2183123478,157052462,3683840763,1592404427,341349109,2438483839,1417898363,644327628,2233032776,2353769706,2201510100,220455161,1815641738,182899273,2995019788,3627381533,3702638151,2890684138,1052606899,588164016,1681439879,4038439418,2405343923,4229449282,167996282,1336969661,1688053129,2739224926,1543734051,1046297529,1138201970,2121126012,115334942,1819067631,1902159161,1941945968,2206692869,1159982321],a[2]=[2381300288,637164959,3952098751,3893414151,1197506559,916448331,2350892612,2932787856,3199334847,4009478890,3905886544,1373570990,2450425862,4037870920,3778841987,2456817877,286293407,124026297,3001279700,1028597854,3115296800,4208886496,2691114635,2188540206,1430237888,1218109995,3572471700,308166588,570424558,2187009021,2455094765,307733056,1310360322,3135275007,1384269543,2388071438,863238079,2359263624,2801553128,3380786597,2831162807,1470087780,1728663345,4072488799,1090516929,532123132,2389430977,1132193179,2578464191,3051079243,1670234342,1434557849,2711078940,1241591150,3314043432,3435360113,3091448339,1812415473,2198440252,267246943,796911696,3619716990,38830015,1526438404,2806502096,374413614,2943401790,1489179520,1603809326,1920779204,168801282,260042626,2358705581,1563175598,2397674057,1356499128,2217211040,514611088,2037363785,2186468373,4022173083,2792511869,2913485016,1173701892,4200428547,3896427269,1334932762,2455136706,602925377,2835607854,1613172210,41346230,2499634548,2457437618,2188827595,41386358,4172255629,1313404830,2405527007,3801973774,2217704835,873260488,2528884354,2478092616,4012915883,2555359016,2006953883,2463913485,575479328,2218240648,2099895446,660001756,2341502190,3038761536,3888151779,3848713377,3286851934,1022894237,1620365795,3449594689,1551255054,15374395,3570825345,4249311020,4151111129,3181912732,310226346,1133119310,530038928,136043402,2476768958,3107506709,2544909567,1036173560,2367337196,1681395281,1758231547,3641649032,306774401,1575354324,3716085866,1990386196,3114533736,2455606671,1262092282,3124342505,2768229131,4210529083,1833535011,423410938,660763973,2187129978,1639812e3,3508421329,3467445492,310289298,272797111,2188552562,2456863912,310240523,677093832,1013118031,901835429,3892695601,1116285435,3036471170,1337354835,243122523,520626091,277223598,4244441197,4194248841,1766575121,594173102,316590669,742362309,3536858622,4176435350,3838792410,2501204839,1229605004,3115755532,1552908988,2312334149,979407927,3959474601,1148277331,176638793,3614686272,2083809052,40992502,1340822838,2731552767,3535757508,3560899520,1354035053,122129617,7215240,2732932949,3118912700,2718203926,2539075635,3609230695,3725561661,1928887091,2882293555,1988674909,2063640240,2491088897,1459647954,4189817080,2302804382,1113892351,2237858528,1927010603,4002880361,1856122846,1594404395,2944033133,3855189863,3474975698,1643104450,4054590833,3431086530,1730235576,2984608721,3084664418,2131803598,4178205752,267404349,1617849798,1616132681,1462223176,736725533,2327058232,551665188,2945899023,1749386277,2575514597,1611482493,674206544,2201269090,3642560800,728599968,1680547377,2620414464,1388111496,453204106,4156223445,1094905244,2754698257,2201108165,3757000246,2704524545,3922940700,3996465027],a[3]=[2645754912,532081118,2814278639,3530793624,1246723035,1689095255,2236679235,4194438865,2116582143,3859789411,157234593,2045505824,4245003587,1687664561,4083425123,605965023,672431967,1336064205,3376611392,214114848,4258466608,3232053071,489488601,605322005,3998028058,264917351,1912574028,756637694,436560991,202637054,135989450,85393697,2152923392,3896401662,2895836408,2145855233,3535335007,115294817,3147733898,1922296357,3464822751,4117858305,1037454084,2725193275,2127856640,1417604070,1148013728,1827919605,642362335,2929772533,909348033,1346338451,3547799649,297154785,1917849091,4161712827,2883604526,3968694238,1469521537,3780077382,3375584256,1763717519,136166297,4290970789,1295325189,2134727907,2798151366,1566297257,3672928234,2677174161,2672173615,965822077,2780786062,289653839,1133871874,3491843819,35685304,1068898316,418943774,672553190,642281022,2346158704,1954014401,3037126780,4079815205,2030668546,3840588673,672283427,1776201016,359975446,3750173538,555499703,2769985273,1324923,69110472,152125443,3176785106,3822147285,1340634837,798073664,1434183902,15393959,216384236,1303690150,3881221631,3711134124,3960975413,106373927,2578434224,1455997841,1801814300,1578393881,1854262133,3188178946,3258078583,2302670060,1539295533,3505142565,3078625975,2372746020,549938159,3278284284,2620926080,181285381,2865321098,3970029511,68876850,488006234,1728155692,2608167508,836007927,2435231793,919367643,3339422534,3655756360,1457871481,40520939,1380155135,797931188,234455205,2255801827,3990488299,397000196,739833055,3077865373,2871719860,4022553888,772369276,390177364,3853951029,557662966,740064294,1640166671,1699928825,3535942136,622006121,3625353122,68743880,1742502,219489963,1664179233,1577743084,1236991741,410585305,2366487942,823226535,1050371084,3426619607,3586839478,212779912,4147118561,1819446015,1911218849,530248558,3486241071,3252585495,2886188651,3410272728,2342195030,20547779,2982490058,3032363469,3631753222,312714466,1870521650,1493008054,3491686656,615382978,4103671749,2534517445,1932181,2196105170,278426614,6369430,3274544417,2913018367,697336853,2143000447,2946413531,701099306,1558357093,2805003052,3500818408,2321334417,3567135975,216290473,3591032198,23009561,1996984579,3735042806,2024298078,3739440863,569400510,2339758983,3016033873,3097871343,3639523026,3844324983,3256173865,795471839,2951117563,4101031090,4091603803,3603732598,971261452,534414648,428311343,3389027175,2844869880,694888862,1227866773,2456207019,3043454569,2614353370,3749578031,3676663836,459166190,4132644070,1794958188,51825668,2252611902,3084671440,2036672799,3436641603,1099053433,2469121526,3059204941,1323291266,2061838604,1018778475,2233344254,2553501054,334295216,3556750194,1065731521,183467730],a[4]=[2127105028,745436345,2601412319,2788391185,3093987327,500390133,1155374404,389092991,150729210,3891597772,3523549952,1935325696,716645080,946045387,2901812282,1774124410,3869435775,4039581901,3293136918,3438657920,948246080,363898952,3867875531,1286266623,1598556673,68334250,630723836,1104211938,1312863373,613332731,2377784574,1101634306,441780740,3129959883,1917973735,2510624549,3238456535,2544211978,3308894634,1299840618,4076074851,1756332096,3977027158,297047435,3790297736,2265573040,3621810518,1311375015,1667687725,47300608,3299642885,2474112369,201668394,1468347890,576830978,3594690761,3742605952,1958042578,1747032512,3558991340,1408974056,3366841779,682131401,1033214337,1545599232,4265137049,206503691,103024618,2855227313,1337551222,2428998917,2963842932,4015366655,3852247746,2796956967,3865723491,3747938335,247794022,3755824572,702416469,2434691994,397379957,851939612,2314769512,218229120,1380406772,62274761,214451378,3170103466,2276210409,3845813286,28563499,446592073,1693330814,3453727194,29968656,3093872512,220656637,2470637031,77972100,1667708854,1358280214,4064765667,2395616961,325977563,4277240721,4220025399,3605526484,3355147721,811859167,3069544926,3962126810,652502677,3075892249,4132761541,3498924215,1217549313,3250244479,3858715919,3053989961,1538642152,2279026266,2875879137,574252750,3324769229,2651358713,1758150215,141295887,2719868960,3515574750,4093007735,4194485238,1082055363,3417560400,395511885,2966884026,179534037,3646028556,3738688086,1092926436,2496269142,257381841,3772900718,1636087230,1477059743,2499234752,3811018894,2675660129,3285975680,90732309,1684827095,1150307763,1723134115,3237045386,1769919919,1240018934,815675215,750138730,2239792499,1234303040,1995484674,138143821,675421338,1145607174,1936608440,3238603024,2345230278,2105974004,323969391,779555213,3004902369,2861610098,1017501463,2098600890,2628620304,2940611490,2682542546,1171473753,3656571411,3687208071,4091869518,393037935,159126506,1662887367,1147106178,391545844,3452332695,1891500680,3016609650,1851642611,546529401,1167818917,3194020571,2848076033,3953471836,575554290,475796850,4134673196,450035699,2351251534,844027695,1080539133,86184846,1554234488,3692025454,1972511363,2018339607,1491841390,1141460869,1061690759,4244549243,2008416118,2351104703,2868147542,1598468138,722020353,1027143159,212344630,1387219594,1725294528,3745187956,2500153616,458938280,4129215917,1828119673,544571780,3503225445,2297937496,1241802790,267843827,2694610800,1397140384,1558801448,3782667683,1806446719,929573330,2234912681,400817706,616011623,4121520928,3603768725,1761550015,1968522284,4053731006,4192232858,4005120285,872482584,3140537016,3894607381,2287405443,1963876937,3663887957,1584857e3,2975024454,1833426440,4025083860],a[5]=[4143615901,749497569,1285769319,3795025788,2514159847,23610292,3974978748,844452780,3214870880,3751928557,2213566365,1676510905,448177848,3730751033,4086298418,2307502392,871450977,3222878141,4110862042,3831651966,2735270553,1310974780,2043402188,1218528103,2736035353,4274605013,2702448458,3936360550,2693061421,162023535,2827510090,687910808,23484817,3784910947,3371371616,779677500,3503626546,3473927188,4157212626,3500679282,4248902014,2466621104,3899384794,1958663117,925738300,1283408968,3669349440,1840910019,137959847,2679828185,1239142320,1315376211,1547541505,1690155329,739140458,3128809933,3933172616,3876308834,905091803,1548541325,4040461708,3095483362,144808038,451078856,676114313,2861728291,2469707347,993665471,373509091,2599041286,4025009006,4170239449,2149739950,3275793571,3749616649,2794760199,1534877388,572371878,2590613551,1753320020,3467782511,1405125690,4270405205,633333386,3026356924,3475123903,632057672,2846462855,1404951397,3882875879,3915906424,195638627,2385783745,3902872553,1233155085,3355999740,2380578713,2702246304,2144565621,3663341248,3894384975,2502479241,4248018925,3094885567,1594115437,572884632,3385116731,767645374,1331858858,1475698373,3793881790,3532746431,1321687957,619889600,1121017241,3440213920,2070816767,2833025776,1933951238,4095615791,890643334,3874130214,859025556,360630002,925594799,1764062180,3920222280,4078305929,979562269,2810700344,4087740022,1949714515,546639971,1165388173,3069891591,1495988560,922170659,1291546247,2107952832,1813327274,3406010024,3306028637,4241950635,153207855,2313154747,1608695416,1150242611,1967526857,721801357,1220138373,3691287617,3356069787,2112743302,3281662835,1111556101,1778980689,250857638,2298507990,673216130,2846488510,3207751581,3562756981,3008625920,3417367384,2198807050,529510932,3547516680,3426503187,2364944742,102533054,2294910856,1617093527,1204784762,3066581635,1019391227,1069574518,1317995090,1691889997,3661132003,510022745,3238594800,1362108837,1817929911,2184153760,805817662,1953603311,3699844737,120799444,2118332377,207536705,2282301548,4120041617,145305846,2508124933,3086745533,3261524335,1877257368,2977164480,3160454186,2503252186,4221677074,759945014,254147243,2767453419,3801518371,629083197,2471014217,907280572,3900796746,940896768,2751021123,2625262786,3161476951,3661752313,3260732218,1425318020,2977912069,1496677566,3988592072,2140652971,3126511541,3069632175,977771578,1392695845,1698528874,1411812681,1369733098,1343739227,3620887944,1142123638,67414216,3102056737,3088749194,1626167401,2546293654,3941374235,697522451,33404913,143560186,2595682037,994885535,1247667115,3859094837,2699155541,3547024625,4114935275,2968073508,3199963069,2732024527,1237921620,951448369,1898488916,1211705605,2790989240,2233243581,3598044975],a[6]=[2246066201,858518887,1714274303,3485882003,713916271,2879113490,3730835617,539548191,36158695,1298409750,419087104,1358007170,749914897,2989680476,1261868530,2995193822,2690628854,3443622377,3780124940,3796824509,2976433025,4259637129,1551479e3,512490819,1296650241,951993153,2436689437,2460458047,144139966,3136204276,310820559,3068840729,643875328,1969602020,1680088954,2185813161,3283332454,672358534,198762408,896343282,276269502,3014846926,84060815,197145886,376173866,3943890818,3813173521,3545068822,1316698879,1598252827,2633424951,1233235075,859989710,2358460855,3503838400,3409603720,1203513385,1193654839,2792018475,2060853022,207403770,1144516871,3068631394,1121114134,177607304,3785736302,326409831,1929119770,2983279095,4183308101,3474579288,3200513878,3228482096,119610148,1170376745,3378393471,3163473169,951863017,3337026068,3135789130,2907618374,1183797387,2015970143,4045674555,2182986399,2952138740,3928772205,384012900,2454997643,10178499,2879818989,2596892536,111523738,2995089006,451689641,3196290696,235406569,1441906262,3890558523,3013735005,4158569349,1644036924,376726067,1006849064,3664579700,2041234796,1021632941,1374734338,2566452058,371631263,4007144233,490221539,206551450,3140638584,1053219195,1853335209,3412429660,3562156231,735133835,1623211703,3104214392,2738312436,4096837757,3366392578,3110964274,3956598718,3196820781,2038037254,3877786376,2339753847,300912036,3766732888,2372630639,1516443558,4200396704,1574567987,4069441456,4122592016,2699739776,146372218,2748961456,2043888151,35287437,2596680554,655490400,1132482787,110692520,1031794116,2188192751,1324057718,1217253157,919197030,686247489,3261139658,1028237775,3135486431,3059715558,2460921700,986174950,2661811465,4062904701,2752986992,3709736643,367056889,1353824391,731860949,1650113154,1778481506,784341916,357075625,3608602432,1074092588,2480052770,3811426202,92751289,877911070,3600361838,1231880047,480201094,3756190983,3094495953,434011822,87971354,363687820,1717726236,1901380172,3926403882,2481662265,400339184,1490350766,2661455099,1389319756,2558787174,784598401,1983468483,30828846,3550527752,2716276238,3841122214,1765724805,1955612312,1277890269,1333098070,1564029816,2704417615,1026694237,3287671188,1260819201,3349086767,1016692350,1582273796,1073413053,1995943182,694588404,1025494639,3323872702,3551898420,4146854327,453260480,1316140391,1435673405,3038941953,3486689407,1622062951,403978347,817677117,950059133,4246079218,3278066075,1486738320,1417279718,481875527,2549965225,3933690356,760697757,1452955855,3897451437,1177426808,1702951038,4085348628,2447005172,1084371187,3516436277,3068336338,1073369276,1027665953,3284188590,1230553676,1368340146,2226246512,267243139,2274220762,4070734279,2497715176,2423353163,2504755875],a[7]=[3793104909,3151888380,2817252029,895778965,2005530807,3871412763,237245952,86829237,296341424,3851759377,3974600970,2475086196,709006108,1994621201,2972577594,937287164,3734691505,168608556,3189338153,2225080640,3139713551,3033610191,3025041904,77524477,185966941,1208824168,2344345178,1721625922,3354191921,1066374631,1927223579,1971335949,2483503697,1551748602,2881383779,2856329572,3003241482,48746954,1398218158,2050065058,313056748,4255789917,393167848,1912293076,940740642,3465845460,3091687853,2522601570,2197016661,1727764327,364383054,492521376,1291706479,3264136376,1474851438,1685747964,2575719748,1619776915,1814040067,970743798,1561002147,2925768690,2123093554,1880132620,3151188041,697884420,2550985770,2607674513,2659114323,110200136,1489731079,997519150,1378877361,3527870668,478029773,2766872923,1022481122,431258168,1112503832,897933369,2635587303,669726182,3383752315,918222264,163866573,3246985393,3776823163,114105080,1903216136,761148244,3571337562,1690750982,3166750252,1037045171,1888456500,2010454850,642736655,616092351,365016990,1185228132,4174898510,1043824992,2023083429,2241598885,3863320456,3279669087,3674716684,108438443,2132974366,830746235,606445527,4173263986,2204105912,1844756978,2532684181,4245352700,2969441100,3796921661,1335562986,4061524517,2720232303,2679424040,634407289,885462008,3294724487,3933892248,2094100220,339117932,4048830727,3202280980,1458155303,2689246273,1022871705,2464987878,3714515309,353796843,2822958815,4256850100,4052777845,551748367,618185374,3778635579,4020649912,1904685140,3069366075,2670879810,3407193292,2954511620,4058283405,2219449317,3135758300,1120655984,3447565834,1474845562,3577699062,550456716,3466908712,2043752612,881257467,869518812,2005220179,938474677,3305539448,3850417126,1315485940,3318264702,226533026,965733244,321539988,1136104718,804158748,573969341,3708209826,937399083,3290727049,2901666755,1461057207,4013193437,4066861423,3242773476,2421326174,1581322155,3028952165,786071460,3900391652,3918438532,1485433313,4023619836,3708277595,3678951060,953673138,1467089153,1930354364,1533292819,2492563023,1346121658,1685000834,1965281866,3765933717,4190206607,2052792609,3515332758,690371149,3125873887,2180283551,2903598061,3933952357,436236910,289419410,14314871,1242357089,2904507907,1616633776,2666382180,585885352,3471299210,2699507360,1432659641,277164553,3354103607,770115018,2303809295,3741942315,3177781868,2853364978,2269453327,3774259834,987383833,1290892879,225909803,1741533526,890078084,1496906255,1111072499,916028167,243534141,1252605537,2204162171,531204876,290011180,3916834213,102027703,237315147,209093447,1486785922,220223953,2758195998,4175039106,82940208,3127791296,2569425252,518464269,1353887104,3941492737,2377294467,3935040926]}function i(e){this.cast5=new n,this.cast5.setKey(e),this.encrypt=function(e){return this.cast5.encrypt(e)}}Object.defineProperty(r,"__esModule",{value:!0}),i.blockSize=i.prototype.blockSize=8,i.keySize=i.prototype.keySize=16,r.default=i},{}],85:[function(e,t,r){"use strict";function n(e,t,r,n,i,a){const s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],o=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],u=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],f=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],d=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];let p,y,b,m,g,w,_,v,k,A,S,E,P,x,M=0,C=t.length;const K=32===e.length?3:9;v=3===K?r?[0,32,2]:[30,-2,-2]:r?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2],r&&(C=(t=function(e,t){const r=8-e.length%8;let n;if(2===t&&r<8)n=" ".charCodeAt(0);else if(1===t)n=r;else{if(t||!(r<8)){if(8===r)return e;throw new Error("des: invalid padding")}n=0}const i=new Uint8Array(e.length+r);for(let a=0;a>>4^_))<<4,w^=(b=65535&(w>>>16^(_^=b)))<<16,w^=b=858993459&((_^=b)>>>2^w),w^=b=16711935&((_^=b<<2)>>>8^w),w=(w^=(b=1431655765&(w>>>1^(_^=b<<8)))<<1)<<1|w>>>31,_=(_^=b)<<1|_>>>31,y=0;y>>4|_<<28)^e[p+1],b=w,w=_,_=b^(o[m>>>24&63]|c[m>>>16&63]|d[m>>>8&63]|h[63&m]|s[g>>>24&63]|u[g>>>16&63]|f[g>>>8&63]|l[63&g]);b=w,w=_,_=b}_=_>>>1|_<<31,_^=b=1431655765&((w=w>>>1|w<<31)>>>1^_),_^=(b=16711935&(_>>>8^(w^=b<<1)))<<8,_^=(b=858993459&(_>>>2^(w^=b)))<<2,_^=b=65535&((w^=b)>>>16^_),_^=b=252645135&((w^=b<<16)>>>4^_),w^=b<<4,1===n&&(r?(k=w,S=_):(w^=A,_^=E)),U[R++]=w>>>24,U[R++]=w>>>16&255,U[R++]=w>>>8&255,U[R++]=255&w,U[R++]=_>>>24,U[R++]=_>>>16&255,U[R++]=_>>>8&255,U[R++]=255&_}return r||(U=function(e,t){let r,n=null;if(2===t)r=" ".charCodeAt(0);else if(1===t)n=e[e.length-1];else{if(t)throw new Error("des: invalid padding");r=0}if(!n){for(n=1;e[e.length-n]===r;)n++;n--}return e.subarray(0,e.length-n)}(U,a)),U}function i(e){const t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],l=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],h=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],p=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length>8?3:1,b=new Array(32*y),m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0];let g,w,_,v=0,k=0;for(let A=0;A>>4^A))<<4,y^=_=65535&((A^=_)>>>-16^y),y^=(_=858993459&(y>>>2^(A^=_<<-16)))<<2,y^=_=65535&((A^=_)>>>-16^y),y^=(_=1431655765&(y>>>1^(A^=_<<-16)))<<1,y^=_=16711935&((A^=_)>>>8^y),_=(y^=(_=1431655765&(y>>>1^(A^=_<<8)))<<1)<<8|(A^=_)>>>20&240,y=A<<24|A<<8&16711680|A>>>8&65280|A>>>24&240,A=_;for(let e=0;e>>26,A=A<<2|A>>>26):(y=y<<1|y>>>27,A=A<<1|A>>>27),_=65535&((w=u[(A&=-15)>>>28]|c[A>>>24&15]|f[A>>>20&15]|d[A>>>16&15]|l[A>>>12&15]|h[A>>>8&15]|p[A>>>4&15])>>>16^(g=t[(y&=-15)>>>28]|r[y>>>24&15]|n[y>>>20&15]|i[y>>>16&15]|a[y>>>12&15]|s[y>>>8&15]|o[y>>>4&15])),b[k++]=g^_,b[k++]=w^_<<16}return b}function a(e){this.key=[];for(let t=0;t<3;t++)this.key.push(new Uint8Array(e.subarray(8*t,8*t+8)));this.encrypt=function(e){return n(i(this.key[2]),n(i(this.key[1]),n(i(this.key[0]),e,!0,0,null,null),!1,0,null,null),!0,0,null,null)}}Object.defineProperty(r,"__esModule",{value:!0}),a.keySize=a.prototype.keySize=24,a.blockSize=a.prototype.blockSize=8,r.default={DES:function(e){this.key=e,this.encrypt=function(e,t){return n(i(this.key),e,!0,0,null,t)},this.decrypt=function(e,t){return n(i(this.key),e,!1,0,null,t)}},TripleDES:a}},{}],86:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("./aes")),i=u(e("./des.js")),a=u(e("./cast5")),s=u(e("./twofish")),o=u(e("./blowfish"));function u(e){return e&&e.__esModule?e:{default:e}}r.default={aes128:(0,n.default)(128),aes192:(0,n.default)(192),aes256:(0,n.default)(256),des:i.default.DES,tripledes:i.default.TripleDES,"3des":i.default.TripleDES,cast5:a.default,twofish:s.default,blowfish:o.default,idea:function(){throw new Error("IDEA symmetric-key algorithm not implemented")}}},{"./aes":82,"./blowfish":83,"./cast5":84,"./des.js":85,"./twofish":87}],87:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=4294967295;function i(e,t){return(e<>>32-t)&n}function a(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function s(e,t,r){e.splice(t,4,255&r,r>>>8&255,r>>>16&255,r>>>24&255)}function o(e,t){return e>>>8*t&255}function u(e){this.tf=function(){let e=null,t=null,r=-1,u=[],c=[[],[],[],[]];function f(e){return c[0][o(e,0)]^c[1][o(e,1)]^c[2][o(e,2)]^c[3][o(e,3)]}function d(e){return c[0][o(e,3)]^c[1][o(e,0)]^c[2][o(e,1)]^c[3][o(e,2)]}function l(e,t){let r=f(t[0]),a=d(t[1]);t[2]=i(t[2]^r+a+u[4*e+8]&n,31),t[3]=i(t[3],1)^r+2*a+u[4*e+9]&n,r=f(t[2]),a=d(t[3]),t[0]=i(t[0]^r+a+u[4*e+10]&n,31),t[1]=i(t[1],1)^r+2*a+u[4*e+11]&n}function h(e,t){let r=f(t[0]),a=d(t[1]);t[2]=i(t[2],1)^r+a+u[4*e+10]&n,t[3]=i(t[3]^r+2*a+u[4*e+11]&n,31),r=f(t[2]),a=d(t[3]),t[0]=i(t[0],1)^r+a+u[4*e+8]&n,t[1]=i(t[1]^r+2*a+u[4*e+9]&n,31)}return{name:"twofish",blocksize:16,open:function(t){let r,s,f,d,l;const h=[],p=[],y=[];let b;const m=[];let g,w,_;const v=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],k=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],A=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],S=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],E=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],P=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,7],x=[[],[]],M=[[],[],[],[]];function C(e){return e^e>>2^[0,90,180,238][3&e]}function K(e){return e^e>>1^e>>2^[0,238,180,90][3&e]}function U(e,t){let r,i,a;for(r=0;r<8;r++)i=t>>>24,t=t<<8&n|e>>>24,e=e<<8&n,a=i<<1,128&i&&(a^=333),t^=i^a<<16,a^=i>>>1,1&i&&(a^=166),t^=a<<24|a<<8;return t}function R(e,t){const r=t>>4,n=15&t,i=v[e][r^n],a=k[e][E[n]^P[r]];return S[e][E[a]^P[i]]<<4|A[e][i^a]}function B(e,t){let r=o(e,0),n=o(e,1),i=o(e,2),a=o(e,3);switch(b){case 4:r=x[1][r]^o(t[3],0),n=x[0][n]^o(t[3],1),i=x[0][i]^o(t[3],2),a=x[1][a]^o(t[3],3);case 3:r=x[1][r]^o(t[2],0),n=x[1][n]^o(t[2],1),i=x[0][i]^o(t[2],2),a=x[0][a]^o(t[2],3);case 2:r=x[0][x[0][r]^o(t[1],0)]^o(t[0],0),n=x[0][x[1][n]^o(t[1],1)]^o(t[0],1),i=x[1][x[0][i]^o(t[1],2)]^o(t[0],2),a=x[1][x[1][a]^o(t[1],3)]^o(t[0],3)}return M[0][r]^M[1][n]^M[2][i]^M[3][a]}for(r=(e=(e=t).slice(0,32)).length;16!==r&&24!==r&&32!==r;)e[r++]=0;for(r=0;r>2]=a(e,r);for(r=0;r<256;r++)x[0][r]=R(0,r),x[1][r]=R(1,r);for(r=0;r<256;r++)w=C(g=x[1][r]),_=K(g),M[0][r]=g+(w<<8)+(_<<16)+(_<<24),M[2][r]=w+(_<<8)+(g<<16)+(_<<24),w=C(g=x[0][r]),_=K(g),M[1][r]=_+(_<<8)+(w<<16)+(g<<24),M[3][r]=w+(g<<8)+(_<<16)+(w<<24);for(b=y.length/2,r=0;r=0;t--)h(t,i);s(t,r,i[2]^u[0]),s(t,r+4,i[3]^u[1]),s(t,r+8,i[0]^u[2]),s(t,r+12,i[1]^u[3]),r+=16},finalize:function(){return t}}}(),this.tf.open(Array.from(e),0),this.encrypt=function(e){return this.tf.encrypt(Array.from(e),0)}}u.keySize=u.prototype.keySize=32,u.blockSize=u.prototype.blockSize=16,r.default=u},{}],88:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("asmcrypto.js/dist_es5/aes/cbc"),a=e("../util"),s=(n=a)&&n.__esModule?n:{default:n};const o=s.default.getWebCrypto(),u=s.default.getNodeCrypto(),c=s.default.getNodeBuffer(),f=16;function d(e,t){const r=e.length-f;for(let n=0;n{r.update(b.from(e))},()=>new Uint8Array(r.digest()))}}function g(e,t){return async function(r){if(!l.default.isStream(r)&&p&&t&&r.length>=d.default.min_bytes_for_web_crypto)return new Uint8Array(await p.digest(t,r));const n=e();return c.default.transform(r,e=>{n.update(e)},()=>new Uint8Array(n.digest()))}}function w(e,t){return async function(r){if(l.default.isStream(r)){const t=new e;return c.default.transform(r,e=>{t.process(e)},()=>t.finish().result)}return p&&t&&r.length>=d.default.min_bytes_for_web_crypto?new Uint8Array(await p.digest(t,r)):e.bytes(r)}}let _;_=y?{md5:m("md5"),sha1:m("sha1"),sha224:m("sha224"),sha256:m("sha256"),sha384:m("sha384"),sha512:m("sha512"),ripemd:m("ripemd160")}:{md5:f.default,sha1:w(n.Sha1,-1===navigator.userAgent.indexOf("Edge")&&"SHA-1"),sha224:g(a.default),sha256:w(i.Sha256,"SHA-256"),sha384:g(s.default,"SHA-384"),sha512:g(o.default,"SHA-512"),ripemd:g(u.ripemd160)},r.default={md5:_.md5,sha1:_.sha1,sha224:_.sha224,sha256:_.sha256,sha384:_.sha384,sha512:_.sha512,ripemd:_.ripemd,digest:function(e,t){switch(e){case 1:return this.md5(t);case 2:return this.sha1(t);case 3:return this.ripemd(t);case 8:return this.sha256(t);case 9:return this.sha384(t);case 10:return this.sha512(t);case 11:return this.sha224(t);default:throw new Error("Invalid hash function.")}},getHashByteLength:function(e){switch(e){case 1:return 16;case 2:case 3:return 20;case 8:return 32;case 9:return 48;case 10:return 64;case 11:return 28;default:throw new Error("Invalid hash algorithm.")}}}},{"../../config":79,"../../util":158,"./md5":93,"asmcrypto.js/dist_es5/hash/sha1/sha1":11,"asmcrypto.js/dist_es5/hash/sha256/sha256":13,"hash.js/lib/hash/ripemd":37,"hash.js/lib/hash/sha/224":40,"hash.js/lib/hash/sha/384":42,"hash.js/lib/hash/sha/512":43,"web-stream-tools":75}],93:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../../util"),a=(n=i)&&n.__esModule?n:{default:n};function s(e,t){let r=e[0],n=e[1],i=e[2],a=e[3];r=u(r,n,i,a,t[0],7,-680876936),a=u(a,r,n,i,t[1],12,-389564586),i=u(i,a,r,n,t[2],17,606105819),n=u(n,i,a,r,t[3],22,-1044525330),r=u(r,n,i,a,t[4],7,-176418897),a=u(a,r,n,i,t[5],12,1200080426),i=u(i,a,r,n,t[6],17,-1473231341),n=u(n,i,a,r,t[7],22,-45705983),r=u(r,n,i,a,t[8],7,1770035416),a=u(a,r,n,i,t[9],12,-1958414417),i=u(i,a,r,n,t[10],17,-42063),n=u(n,i,a,r,t[11],22,-1990404162),r=u(r,n,i,a,t[12],7,1804603682),a=u(a,r,n,i,t[13],12,-40341101),i=u(i,a,r,n,t[14],17,-1502002290),r=c(r,n=u(n,i,a,r,t[15],22,1236535329),i,a,t[1],5,-165796510),a=c(a,r,n,i,t[6],9,-1069501632),i=c(i,a,r,n,t[11],14,643717713),n=c(n,i,a,r,t[0],20,-373897302),r=c(r,n,i,a,t[5],5,-701558691),a=c(a,r,n,i,t[10],9,38016083),i=c(i,a,r,n,t[15],14,-660478335),n=c(n,i,a,r,t[4],20,-405537848),r=c(r,n,i,a,t[9],5,568446438),a=c(a,r,n,i,t[14],9,-1019803690),i=c(i,a,r,n,t[3],14,-187363961),n=c(n,i,a,r,t[8],20,1163531501),r=c(r,n,i,a,t[13],5,-1444681467),a=c(a,r,n,i,t[2],9,-51403784),i=c(i,a,r,n,t[7],14,1735328473),r=f(r,n=c(n,i,a,r,t[12],20,-1926607734),i,a,t[5],4,-378558),a=f(a,r,n,i,t[8],11,-2022574463),i=f(i,a,r,n,t[11],16,1839030562),n=f(n,i,a,r,t[14],23,-35309556),r=f(r,n,i,a,t[1],4,-1530992060),a=f(a,r,n,i,t[4],11,1272893353),i=f(i,a,r,n,t[7],16,-155497632),n=f(n,i,a,r,t[10],23,-1094730640),r=f(r,n,i,a,t[13],4,681279174),a=f(a,r,n,i,t[0],11,-358537222),i=f(i,a,r,n,t[3],16,-722521979),n=f(n,i,a,r,t[6],23,76029189),r=f(r,n,i,a,t[9],4,-640364487),a=f(a,r,n,i,t[12],11,-421815835),i=f(i,a,r,n,t[15],16,530742520),r=d(r,n=f(n,i,a,r,t[2],23,-995338651),i,a,t[0],6,-198630844),a=d(a,r,n,i,t[7],10,1126891415),i=d(i,a,r,n,t[14],15,-1416354905),n=d(n,i,a,r,t[5],21,-57434055),r=d(r,n,i,a,t[12],6,1700485571),a=d(a,r,n,i,t[3],10,-1894986606),i=d(i,a,r,n,t[10],15,-1051523),n=d(n,i,a,r,t[1],21,-2054922799),r=d(r,n,i,a,t[8],6,1873313359),a=d(a,r,n,i,t[15],10,-30611744),i=d(i,a,r,n,t[6],15,-1560198380),n=d(n,i,a,r,t[13],21,1309151649),r=d(r,n,i,a,t[4],6,-145523070),a=d(a,r,n,i,t[11],10,-1120210379),i=d(i,a,r,n,t[2],15,718787259),n=d(n,i,a,r,t[9],21,-343485551),e[0]=y(r,e[0]),e[1]=y(n,e[1]),e[2]=y(i,e[2]),e[3]=y(a,e[3])}function o(e,t,r,n,i,a){return t=y(y(t,e),y(n,a)),y(t<>>32-i,r)}function u(e,t,r,n,i,a,s){return o(t&r|~t&n,e,t,i,a,s)}function c(e,t,r,n,i,a,s){return o(t&n|r&~n,e,t,i,a,s)}function f(e,t,r,n,i,a,s){return o(t^r^n,e,t,i,a,s)}function d(e,t,r,n,i,a,s){return o(r^(t|~n),e,t,i,a,s)}function l(e){const t=[];let r;for(r=0;r<64;r+=4)t[r>>2]=e.charCodeAt(r)+(e.charCodeAt(r+1)<<8)+(e.charCodeAt(r+2)<<16)+(e.charCodeAt(r+3)<<24);return t}const h="0123456789abcdef".split("");function p(e){let t="",r=0;for(;r<4;r++)t+=h[e>>8*r+4&15]+h[e>>8*r&15];return t}function y(e,t){return e+t&4294967295}r.default=async function(e){const t=function(e){const t=e.length,r=[1732584193,-271733879,-1732584194,271733878];let n;for(n=64;n<=e.length;n+=64)s(r,l(e.substring(n-64,n)));e=e.substring(n-64);const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(n=0;n>2]|=e.charCodeAt(n)<<(n%4<<3);if(i[n>>2]|=128<<(n%4<<3),n>55)for(s(r,i),n=0;n<16;n++)i[n]=0;return i[14]=8*t,s(r,i),r}(a.default.Uint8Array_to_str(e));return a.default.hex_to_Uint8Array(function(e){for(let t=0;t>3),17+(g>>3)),8-(7&g)).subarray(1),k=new Uint8Array(s),A=new Uint8Array(t.length+u);let S,E=0;for(S=0;St-11)throw new Error("Message too long");const i=await async function(e){let t="";for(;t.length=8&&0===a)return e.substr(n);throw new Error("Decryption error")},u.encode=async function(e,t,r){let n;const s=a.default.Uint8Array_to_str(t);if(s.length!==i.default.getHashByteLength(e))throw new Error("Invalid hash length");let o="";for(n=0;n0){const r=e.charCodeAt(t-1);if(r>=1&&e.substr(t-r)===String.fromCharCode(r).repeat(r))return e.substr(0,t-r)}throw new Error("Invalid padding")}}},{}],98:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=o(e("bn.js")),i=o(e("../random")),a=o(e("../../util")),s=o(e("./prime"));function o(e){return e&&e.__esModule?e:{default:e}}const u=new n.default(1),c=new n.default(0);r.default={sign:async function(e,t,r,a,s,o){let f,d,l,h;const p=new n.default.red(a),y=new n.default.red(s),b=r.toRed(p),m=o.toRed(y),g=new n.default(t.subarray(0,s.byteLength())).toRed(y);for(;f=await i.default.getRandomBN(u,s),d=b.redPow(f).fromRed().toRed(y),0===c.cmp(d)||(h=g.redAdd(m.redMul(d)),l=f.toRed(y).redInvm().redMul(h),0===c.cmp(l)););return{r:d.toArrayLike(Uint8Array,"be",s.byteLength()),s:l.toArrayLike(Uint8Array,"be",s.byteLength())}},verify:async function(e,t,r,i,s,o,u,f){if(c.ucmp(t)>=0||t.ucmp(u)>=0||c.ucmp(r)>=0||r.ucmp(u)>=0)return a.default.print_debug("invalid DSA Signature"),null;const d=new n.default.red(o),l=new n.default.red(u),h=new n.default(i.subarray(0,u.byteLength())),p=r.toRed(l).redInvm();if(0===c.cmp(p))return a.default.print_debug("invalid DSA Signature"),null;const y=h.toRed(l).redMul(p),b=t.toRed(l).redMul(p),m=s.toRed(d).redPow(y.fromRed()),g=f.toRed(d).redPow(b.fromRed());return 0===m.redMul(g).fromRed().mod(u).cmp(t)},validateParams:async function(e,t,r,a,o){e=new n.default(e),t=new n.default(t),r=new n.default(r),a=new n.default(a);const u=new n.default(1);if(r.lte(u)||r.gte(e))return!1;if(!e.sub(u).mod(t).isZero())return!1;const c=new n.default.red(e),f=r.toRed(c);if(!f.redPow(t).eq(u))return!1;const d=t.bitLength();if(d<150||!(await s.default.isProbablePrime(t,null,32)))return!1;o=new n.default(o);const l=await i.default.getRandomBN(new n.default(2).shln(d-1),new n.default(2).shln(d)),h=t.mul(l).add(o);return!!a.eq(f.redPow(h))}}},{"../../util":158,"../random":109,"./prime":107,"bn.js":16}],99:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("bn.js")),i=a(e("../random"));function a(e){return e&&e.__esModule?e:{default:e}}const s=new n.default(0);r.default={encrypt:async function(e,t,r,a){const o=new n.default.red(t),u=e.toRed(o),c=r.toRed(o),f=a.toRed(o),d=await i.default.getRandomBN(s,t);return{c1:c.redPow(d).fromRed(),c2:f.redPow(d).redMul(u).fromRed()}},decrypt:async function(e,t,r,i){const a=new n.default.red(r),s=e.toRed(a),o=t.toRed(a);return s.redPow(i).redInvm().redMul(o).fromRed()},validateParams:async function(e,t,r,a){e=new n.default(e),t=new n.default(t),r=new n.default(r);const s=new n.default(1);if(t.lte(s)||t.gte(e))return!1;const o=e.subn(1).bitLength();if(o<1023)return!1;const u=new n.default.red(e),c=t.toRed(u);if(!c.redPow(e.subn(1)).eq(s))return!1;let f=t;const d=new n.default(1),l=new n.default(2).shln(17);for(;d.lt(l);){if((f=f.mul(t).mod(e)).eqn(1))return!1;d.iaddn(1)}a=new n.default(a);const h=await i.default.getRandomBN(new n.default(2).shln(o-1),new n.default(2).shln(o)),p=e.subn(1).mul(h).add(a);return!!r.eq(c.redPow(p))}}},{"../random":109,"bn.js":16}],100:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateStandardParams=r.privateToJwk=r.rawPublicToJwk=r.jwkToRawPublic=r.getPreferredHashAlgo=r.generate=r.nodeCurves=r.webCurves=r.curves=void 0;var n=f(e("bn.js")),i=f(e("tweetnacl/nacl-fast-light.js")),a=f(e("../../random")),s=f(e("../../../enums")),o=f(e("../../../util")),u=f(e("../../../type/oid")),c=e("./indutnyKey");function f(e){return e&&e.__esModule?e:{default:e}}const d=o.default.getWebCrypto(),l=o.default.getNodeCrypto(),h={p256:"P-256",p384:"P-384",p521:"P-521"},p=l?l.getCurves():[],y=l?{secp256k1:p.includes("secp256k1")?"secp256k1":void 0,p256:p.includes("prime256v1")?"prime256v1":void 0,p384:p.includes("secp384r1")?"secp384r1":void 0,p521:p.includes("secp521r1")?"secp521r1":void 0,ed25519:p.includes("ED25519")?"ED25519":void 0,curve25519:p.includes("X25519")?"X25519":void 0,brainpoolP256r1:p.includes("brainpoolP256r1")?"brainpoolP256r1":void 0,brainpoolP384r1:p.includes("brainpoolP384r1")?"brainpoolP384r1":void 0,brainpoolP512r1:p.includes("brainpoolP512r1")?"brainpoolP512r1":void 0}:{},b={p256:{oid:[6,8,42,134,72,206,61,3,1,7],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha256,cipher:s.default.symmetric.aes128,node:y.p256,web:h.p256,payloadSize:32,sharedSize:256},p384:{oid:[6,5,43,129,4,0,34],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha384,cipher:s.default.symmetric.aes192,node:y.p384,web:h.p384,payloadSize:48,sharedSize:384},p521:{oid:[6,5,43,129,4,0,35],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha512,cipher:s.default.symmetric.aes256,node:y.p521,web:h.p521,payloadSize:66,sharedSize:528},secp256k1:{oid:[6,5,43,129,4,0,10],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha256,cipher:s.default.symmetric.aes128,node:y.secp256k1,payloadSize:32},ed25519:{oid:[6,9,43,6,1,4,1,218,71,15,1],keyType:s.default.publicKey.eddsa,hash:s.default.hash.sha512,node:!1,payloadSize:32},curve25519:{oid:[6,10,43,6,1,4,1,151,85,1,5,1],keyType:s.default.publicKey.ecdh,hash:s.default.hash.sha256,cipher:s.default.symmetric.aes128,node:!1,payloadSize:32},brainpoolP256r1:{oid:[6,9,43,36,3,3,2,8,1,1,7],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha256,cipher:s.default.symmetric.aes128,node:y.brainpoolP256r1,payloadSize:32},brainpoolP384r1:{oid:[6,9,43,36,3,3,2,8,1,1,11],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha384,cipher:s.default.symmetric.aes192,node:y.brainpoolP384r1,payloadSize:48},brainpoolP512r1:{oid:[6,9,43,36,3,3,2,8,1,1,13],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha512,cipher:s.default.symmetric.aes256,node:y.brainpoolP512r1,payloadSize:64}};function m(e,t){try{(o.default.isArray(e)||o.default.isUint8Array(e))&&(e=new u.default(e)),e instanceof u.default&&(e=e.getName()),this.name=s.default.write(s.default.curve,e)}catch(r){throw new Error("Not valid curve")}t=t||b[this.name],this.keyType=t.keyType,this.oid=t.oid,this.hash=t.hash,this.cipher=t.cipher,this.node=t.node&&b[this.name],this.web=t.web&&b[this.name],this.payloadSize=t.payloadSize,this.web&&o.default.getWebCrypto()?this.type="web":this.node&&o.default.getNodeCrypto()?this.type="node":"curve25519"===this.name?this.type="curve25519":"ed25519"===this.name&&(this.type="ed25519")}function g(e){const t=o.default.b64_to_Uint8Array(e.x),r=o.default.b64_to_Uint8Array(e.y),n=new Uint8Array(t.length+r.length+1);return n[0]=4,n.set(t,1),n.set(r,t.length+1),n}function w(e,t,r){const n=e,i=r.slice(1,n+1),a=r.slice(n+1,2*n+1);return{kty:"EC",crv:t,x:o.default.Uint8Array_to_b64(i,!0),y:o.default.Uint8Array_to_b64(a,!0),ext:!0}}m.prototype.genKeyPair=async function(){let e;switch(this.type){case"web":try{return await async function(e){const t=await d.generateKey({name:"ECDSA",namedCurve:h[e]},!0,["sign","verify"]),r=await d.exportKey("jwk",t.privateKey);return{publicKey:g(await d.exportKey("jwk",t.publicKey)),privateKey:o.default.b64_to_Uint8Array(r.d,!0)}}(this.name)}catch(r){o.default.print_debug_error("Browser did not support generating ec key "+r.message);break}case"node":return async function(e){const t=l.createECDH(y[e]);return await t.generateKeys(),{publicKey:new Uint8Array(t.getPublicKey()),privateKey:new Uint8Array(t.getPrivateKey())}}(this.name);case"curve25519":{const t=await a.default.getRandomBytes(32);t[0]=127&t[0]|64,t[31]&=248;const r=t.slice().reverse();return e=i.default.box.keyPair.fromSecretKey(r),{publicKey:o.default.concatUint8Array([new Uint8Array([64]),e.publicKey]),privateKey:t}}case"ed25519":{const e=await a.default.getRandomBytes(32),t=i.default.sign.keyPair.fromSeed(e);return{publicKey:o.default.concatUint8Array([new Uint8Array([64]),t.publicKey]),privateKey:e}}}const t=await(0,c.getIndutnyCurve)(this.name);return e=await t.genKeyPair({entropy:o.default.Uint8Array_to_str(await a.default.getRandomBytes(32))}),{publicKey:new Uint8Array(e.getPublic("array",!1)),privateKey:e.getPrivate().toArrayLike(Uint8Array)}},r.default=m,r.curves=b,r.webCurves=h,r.nodeCurves=y,r.generate=async function(e){e=new m(e);const t=await e.genKeyPair();return{oid:e.oid,Q:new n.default(t.publicKey),d:new n.default(t.privateKey),hash:e.hash,cipher:e.cipher}},r.getPreferredHashAlgo=function(e){return b[s.default.write(s.default.curve,e.toHex())].hash},r.jwkToRawPublic=g,r.rawPublicToJwk=w,r.privateToJwk=function(e,t,r,n){const i=w(e,t,r);return i.d=o.default.Uint8Array_to_b64(n,!0),i},r.validateStandardParams=async function(e,t,r,a){const u={p256:!0,p384:!0,p521:!0,secp256k1:!0,curve25519:e===s.default.publicKey.ecdh,brainpoolP256r1:!0,brainpoolP384r1:!0,brainpoolP512r1:!0},f=t.getName();if(!u[f])return!1;if("curve25519"===f){a=a.slice().reverse();const e=i.default.box.keyPair.fromSecretKey(a).publicKey;r=new Uint8Array(r);const t=new Uint8Array([64,...e]);return!!o.default.equalsUint8Array(t,r)}const d=await(0,c.getIndutnyCurve)(f);try{r=(0,c.keyFromPublic)(d,r).getPublic()}catch(l){return!1}return a=new n.default(a),!!(0,c.keyFromPrivate)(d,a).getPublic().eq(r)}},{"../../../enums":113,"../../../type/oid":156,"../../../util":158,"../../random":109,"./indutnyKey":105,"bn.js":16,"tweetnacl/nacl-fast-light.js":72}],101:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(u){i=!0,a=u}finally{try{!n&&o.return&&o.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=y(e("bn.js")),a=y(e("tweetnacl/nacl-fast-light.js")),s=e("./curves"),o=y(s),u=y(e("../../aes_kw")),c=y(e("../../cipher")),f=y(e("../../random")),d=y(e("../../hash")),l=y(e("../../../enums")),h=y(e("../../../util")),p=e("./indutnyKey");function y(e){return e&&e.__esModule?e:{default:e}}const b=h.default.getWebCrypto(),m=h.default.getNodeCrypto();function g(e,t,r,n){return h.default.concatUint8Array([t.write(),new Uint8Array([e]),r.write(),h.default.str_to_Uint8Array("Anonymous Sender "),n.subarray(0,20)])}async function w(e,t,r,n,i=!1,a=!1){let s;if(i){for(s=0;s=0&&0===t[s];s--);t=t.subarray(0,s+1)}return(await d.default.digest(e,h.default.concatUint8Array([new Uint8Array([0,0,0,1]),t,n]))).subarray(0,r)}async function _(e,t){switch(e.type){case"curve25519":{const n=await f.default.getRandomBytes(32);var r=await v(e,t,null,n);const i=r.secretKey,s=r.sharedKey;let o=a.default.box.keyPair.fromSecretKey(i).publicKey;return{publicKey:o=h.default.concatUint8Array([new Uint8Array([64]),o]),sharedKey:s}}case"web":if(e.web&&h.default.getWebCrypto())try{return await A(e,t)}catch(n){h.default.print_debug_error(n)}break;case"node":return x(e,t)}return E(e,t)}async function v(e,t,r,n){if(n.length!==e.payloadSize){const t=new Uint8Array(e.payloadSize);t.set(n,e.payloadSize-n.length),n=t}switch(e.type){case"curve25519":{const e=n.slice().reverse();return{secretKey:e,sharedKey:a.default.scalarMult(e,t.subarray(1))}}case"web":if(e.web&&h.default.getWebCrypto())try{return await k(e,t,r,n)}catch(i){h.default.print_debug_error(i)}break;case"node":return P(e,t,n)}return S(e,t,n)}async function k(e,t,r,i){const a=(0,s.privateToJwk)(e.payloadSize,e.web.web,r,i);let o=b.importKey("jwk",a,{name:"ECDH",namedCurve:e.web.web},!0,["deriveKey","deriveBits"]);const u=(0,s.rawPublicToJwk)(e.payloadSize,e.web.web,t);let c=b.importKey("jwk",u,{name:"ECDH",namedCurve:e.web.web},!0,[]);var f=await Promise.all([o,c]),d=n(f,2);o=d[0],c=d[1];let l=b.deriveBits({name:"ECDH",namedCurve:e.web.web,public:c},o,e.web.sharedSize),p=b.exportKey("jwk",o);var y=await Promise.all([l,p]),m=n(y,2);l=m[0],p=m[1];const g=new Uint8Array(l);return{secretKey:h.default.b64_to_Uint8Array(p.d,!0),sharedKey:g}}async function A(e,t){const r=(0,s.rawPublicToJwk)(e.payloadSize,e.web.web,t);let i=b.generateKey({name:"ECDH",namedCurve:e.web.web},!0,["deriveKey","deriveBits"]),a=b.importKey("jwk",r,{name:"ECDH",namedCurve:e.web.web},!1,[]);var o=await Promise.all([i,a]),u=n(o,2);i=u[0],a=u[1];let c=b.deriveBits({name:"ECDH",namedCurve:e.web.web,public:a},i.privateKey,e.web.sharedSize),f=b.exportKey("jwk",i.publicKey);var d=await Promise.all([c,f]),l=n(d,2);c=l[0],f=l[1];const h=new Uint8Array(c);return{publicKey:new Uint8Array((0,s.jwkToRawPublic)(f)),sharedKey:h}}async function S(e,t,r){const n=await(0,p.getIndutnyCurve)(e.name);t=(0,p.keyFromPublic)(n,t),r=(0,p.keyFromPrivate)(n,r);const i=new Uint8Array(r.getPrivate()),a=r.derive(t.getPublic()),s=n.curve.p.byteLength();return{secretKey:i,sharedKey:a.toArrayLike(Uint8Array,"be",s)}}async function E(e,t){const r=await(0,p.getIndutnyCurve)(e.name),n=await e.genKeyPair();t=(0,p.keyFromPublic)(r,t);const i=(0,p.keyFromPrivate)(r,n.privateKey),a=n.publicKey,s=i.derive(t.getPublic()),o=r.curve.p.byteLength();return{publicKey:a,sharedKey:s.toArrayLike(Uint8Array,"be",o)}}async function P(e,t,r){const n=m.createECDH(e.node.node);n.setPrivateKey(r);const i=new Uint8Array(n.computeSecret(t));return{secretKey:new Uint8Array(n.getPrivateKey()),sharedKey:i}}async function x(e,t){const r=m.createECDH(e.node.node);r.generateKeys();const n=new Uint8Array(r.computeSecret(t));return{publicKey:new Uint8Array(r.getPublicKey()),sharedKey:n}}r.default={encrypt:async function(e,t,r,n,i){const a=new o.default(e);var s=await _(a,n);const f=s.publicKey,d=s.sharedKey,h=g(l.default.publicKey.ecdh,e,t,i),p=l.default.read(l.default.symmetric,t.cipher),y=await w(t.hash,d,c.default[p].keySize,h);return{publicKey:f,wrappedKey:u.default.wrap(y,r.toString())}},decrypt:async function(e,t,r,n,a,s,f){const d=new o.default(e),h=(await v(d,r,a,s)).sharedKey,p=g(l.default.publicKey.ecdh,e,t,f),y=l.default.read(l.default.symmetric,t.cipher);let b;for(let o=0;o<3;o++)try{const e=await w(t.hash,h,c.default[y].keySize,p,1===o,2===o);return new i.default(u.default.unwrap(e,n))}catch(m){b=m}throw b},genPublicEphemeralKey:_,genPrivateEphemeralKey:v,buildEcdhParam:g,kdf:w,webPublicEphemeralKey:A,webPrivateEphemeralKey:k,ellipticPublicEphemeralKey:E,ellipticPrivateEphemeralKey:S,nodePublicEphemeralKey:x,nodePrivateEphemeralKey:P,validateParams:async function(e,t,r){return(0,s.validateStandardParams)(l.default.publicKey.ecdh,e,t,r)},parseParams:function(e){if(e.length<3||e.length>4)throw new Error("Unexpected number of parameters");const t=e[0],r=new o.default(t),n={oid:t};return n.Q=e[1].toUint8Array(),n.kdfParams=e[2],4===e.length&&(n.d=e[3].toUint8Array("be",r.payloadSize)),n}}},{"../../../enums":113,"../../../util":158,"../../aes_kw":80,"../../cipher":86,"../../hash":92,"../../random":109,"./curves":100,"./indutnyKey":105,"bn.js":16,"tweetnacl/nacl-fast-light.js":72}],102:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=d(e("bn.js")),i=d(e("../../../enums")),a=d(e("../../../util")),s=d(e("../../random")),o=d(e("../../hash")),u=e("./curves"),c=d(u),f=e("./indutnyKey");function d(e){return e&&e.__esModule?e:{default:e}}const l=a.default.getWebCrypto(),h=a.default.getNodeCrypto();async function p(e,t,r,n,s,o){const f=new c.default(e);if(r&&!a.default.isStream(r)){const e={publicKey:n,privateKey:s};switch(f.type){case"web":try{return await async function(e,t,r,n){const a=e.payloadSize,s=(0,u.privateToJwk)(e.payloadSize,u.webCurves[e.name],n.publicKey,n.privateKey),o=await l.importKey("jwk",s,{name:"ECDSA",namedCurve:u.webCurves[e.name],hash:{name:i.default.read(i.default.webHash,e.hash)}},!1,["sign"]),c=new Uint8Array(await l.sign({name:"ECDSA",namedCurve:u.webCurves[e.name],hash:{name:i.default.read(i.default.webHash,t)}},o,r));return{r:c.slice(0,a),s:c.slice(a,a<<1)}}(f,t,r,e)}catch(d){if("p521"!==f.name&&("DataError"===d.name||"OperationError"===d.name))throw d;a.default.print_debug_error("Browser did not support verifying: "+d.message)}break;case"node":{const n=await async function(e,t,r,n){const a=h.createSign(i.default.read(i.default.hash,t));a.write(r),a.end();const s=_.encode({version:1,parameters:e.oid,privateKey:Array.from(n.privateKey),publicKey:{unused:0,data:Array.from(n.publicKey)}},"pem",{label:"EC PRIVATE KEY"});return w.decode(a.sign(s),"der")}(f,t,r,e);return{r:n.r.toArrayLike(Uint8Array),s:n.s.toArrayLike(Uint8Array)}}}}return b(f,o,s)}async function y(e,t,r,s,o,f){const d=new c.default(e);if(s&&!a.default.isStream(s))switch(d.type){case"web":try{return await async function(e,t,{r:r,s:n},s,o){const c=e.payloadSize,f=(0,u.rawPublicToJwk)(e.payloadSize,u.webCurves[e.name],o),d=await l.importKey("jwk",f,{name:"ECDSA",namedCurve:u.webCurves[e.name],hash:{name:i.default.read(i.default.webHash,e.hash)}},!1,["verify"]),h=a.default.concatUint8Array([new Uint8Array(c-r.length),r,new Uint8Array(c-n.length),n]).buffer;return l.verify({name:"ECDSA",namedCurve:u.webCurves[e.name],hash:{name:i.default.read(i.default.webHash,t)}},d,h,s)}(d,t,r,s,o)}catch(p){if("p521"!==d.name&&("DataError"===p.name||"OperationError"===p.name))throw p;a.default.print_debug_error("Browser did not support verifying: "+p.message)}break;case"node":return async function(e,t,{r:r,s:a},s,o){const u=h.createVerify(i.default.read(i.default.hash,t));u.write(s),u.end();const c=k.encode({algorithm:{algorithm:[1,2,840,10045,2,1],parameters:e.oid},subjectPublicKey:{unused:0,data:Array.from(o)}},"pem",{label:"PUBLIC KEY"}),f=w.encode({r:new n.default(r),s:new n.default(a)},"der");try{return u.verify(c,f)}catch(p){return!1}}(d,t,r,s,o)}return m(d,r,void 0===t?s:f,o)}async function b(e,t,r){const n=await(0,f.getIndutnyCurve)(e.name),i=(0,f.keyFromPrivate)(n,r).sign(t);return{r:i.r.toArrayLike(Uint8Array),s:i.s.toArrayLike(Uint8Array)}}async function m(e,t,r,n){const i=await(0,f.getIndutnyCurve)(e.name);return(0,f.keyFromPublic)(i,n).verify(r,t)}r.default={sign:p,verify:y,ellipticVerify:m,ellipticSign:b,validateParams:async function(e,t,r){const n=new c.default(e);if(n.keyType!==i.default.publicKey.ecdsa)return!1;switch(n.type){case"web":case"node":{const n=await s.default.getRandomBytes(8),u=i.default.hash.sha256,c=await o.default.digest(u,n);try{const i=await p(e,u,n,t,r,c);return await y(e,u,i,n,t,c)}catch(a){return!1}}default:return(0,u.validateStandardParams)(i.default.publicKey.ecdsa,e,t,r)}},parseParams:function(e){if(e.length<2||e.length>3)throw new Error("Unexpected number of parameters");const t=e[0],r=new c.default(t),n={oid:t};return n.Q=e[1].toUint8Array(),3===e.length&&(n.d=e[2].toUint8Array("be",r.payloadSize)),n}};const g=h?e("asn1.js"):void 0,w=h?g.define("ECDSASignature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}):void 0,_=h?g.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().any(),this.key("publicKey").explicit(1).optional().bitstr())}):void 0,v=h?g.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}):void 0,k=h?g.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(v),this.key("subjectPublicKey").bitstr())}):void 0},{"../../../enums":113,"../../../util":158,"../../hash":92,"../../random":109,"./curves":100,"./indutnyKey":105,"asn1.js":"asn1.js","bn.js":16}],103:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=s(e("hash.js/lib/hash/sha/512")),i=s(e("tweetnacl/nacl-fast-light.js")),a=s(e("../../../util"));function s(e){return e&&e.__esModule?e:{default:e}}i.default.hash=(e=>new Uint8Array((0,n.default)().update(e).digest())),r.default={sign:async function(e,t,r,n,s,o){const u=a.default.concatUint8Array([s,n.subarray(1)]),c=i.default.sign.detached(o,u);return{R:c.subarray(0,32),S:c.subarray(32)}},verify:async function(e,t,{R:r,S:n},s,o,u){const c=a.default.concatUint8Array([r,n]);return i.default.sign.detached.verify(u,c,o.subarray(1))},validateParams:async function(e,t,r){if("ed25519"!==e.getName())return!1;const n=i.default.sign.keyPair.fromSeed(r).publicKey,s=new Uint8Array([64,...n]);return a.default.equalsUint8Array(t,s)},parseParams:function(e){if(e.length<2||e.length>3)throw new Error("Unexpected number of parameters");const t={oid:e[0],Q:e[1].toUint8Array("be",33)};return 3===e.length&&(t.seed=e[2].toUint8Array("be",32)),t}}},{"../../../util":158,"hash.js/lib/hash/sha/512":43,"tweetnacl/nacl-fast-light.js":72}],104:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./curves"),i=u(n),a=u(e("./ecdsa")),s=u(e("./eddsa")),o=u(e("./ecdh"));function u(e){return e&&e.__esModule?e:{default:e}}r.default={Curve:i.default,ecdh:o.default,ecdsa:a.default,eddsa:s.default,generate:n.generate,getPreferredHashAlgo:n.getPreferredHashAlgo}},{"./curves":100,"./ecdh":101,"./ecdsa":102,"./eddsa":103}],105:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.keyFromPrivate=function(e,t){return e.keyPair({priv:t})},r.keyFromPublic=function(e,t){const r=e.keyPair({pub:t});if(!0!==r.validate().result)throw new Error("Invalid elliptic public key");return r},r.getIndutnyCurve=async function(r){if(!i.default.use_indutny_elliptic)throw new Error("This curve is only supported in the full build of OpenPGP.js");return new((await function(){if(!i.default.external_indutny_elliptic)return e("elliptic");if(a.default.detectNode())return e(i.default.indutny_elliptic_path);o||(o=async function(){const e=i.default.indutny_elliptic_path,r=i.default.indutny_elliptic_fetch_options,a=(0,n.dl)(e,r).catch(()=>(0,n.dl)(e,r)),s=await a,o=URL.createObjectURL(new Blob([s],{type:"text/javascript"}));if(await(0,n.loadScript)(o),URL.revokeObjectURL(o),!t.openpgp.elliptic)throw new Error("Elliptic library failed to load correctly");return t.openpgp.elliptic}().catch(e=>{throw o=void 0,e}));return o}()).ec)(r)};var n=e("../../../lightweight_helper"),i=s(e("../../../config")),a=s(e("../../../util"));function s(e){return e&&e.__esModule?e:{default:e}}let o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../../config":79,"../../../lightweight_helper":125,"../../../util":158,elliptic:18}],106:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("tweetnacl/nacl-fast-light.js")),i=u(e("./rsa")),a=u(e("./elgamal")),s=u(e("./elliptic")),o=u(e("./dsa"));function u(e){return e&&e.__esModule?e:{default:e}}r.default={rsa:i.default,elgamal:a.default,elliptic:s.default,dsa:o.default,nacl:n.default}},{"./dsa":98,"./elgamal":99,"./elliptic":104,"./rsa":108,"tweetnacl/nacl-fast-light.js":72}],107:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("bn.js")),i=a(e("../random"));function a(e){return e&&e.__esModule?e:{default:e}}async function s(e,t,r){return!(t&&!e.subn(1).gcd(t).eqn(1))&&(!!u(e)&&(!!o(e)&&!!(await f(e,r))))}function o(e,t){return 0===(t=t||new n.default(2)).toRed(n.default.mont(e)).redPow(e.subn(1)).fromRed().cmpn(1)}function u(e){return c.every(t=>0!==e.modn(t))}r.default={randomProbablePrime:async function(e,t,r){const a=new n.default(1).shln(e-1),o=new n.default(30),u=[1,6,5,4,3,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,2];let c=await i.default.getRandomBN(a,a.shln(1)),f=c.mod(o).toNumber();do{c.iaddn(u[f]),f=(f+u[f])%u.length,c.bitLength()>e&&(c=c.mod(a.shln(1)).iadd(a),f=c.mod(o).toNumber())}while(!(await s(c,t,r)));return c},isProbablePrime:s,fermat:o,millerRabin:f,divisionTest:u};const c=[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,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999];async function f(e,t,r){const a=e.bitLength(),s=n.default.mont(e),o=new n.default(1).toRed(s);t||(t=Math.max(1,a/48|0));const u=e.subn(1),c=u.toRed(s);let f=0;for(;!u.testn(f);)f++;const d=e.shrn(f);for(;t>0;t--){let e,t=(r?r():await i.default.getRandomBN(new n.default(2),u)).toRed(s).redPow(d);if(!t.eq(o)&&!t.eq(c)){for(e=1;eh.generateKeyPair("rsa",t,(t,n,i)=>{t?r(t):e(b.decode(i,"der"))}));return{n:n.modulus,e:n.publicExponent,d:n.privateExponent,p:n.prime2,q:n.prime1,u:n.coefficient}}let s=await i.default.randomProbablePrime(e-(e>>1),r,40),u=await i.default.randomProbablePrime(e>>1,r,40);if(s.cmp(u)<0){var c=[s,u];u=c[0],s=c[1]}const f=u.subn(1).mul(s.subn(1));return{n:u.mul(s),e:r,d:r.invm(f),p:u,q:s,u:u.invm(s)}},validateParams:async function(e,t,r,i,s,o){if(e=new n.default(e),i=new n.default(i),s=new n.default(s),!i.mul(s).eq(e))return!1;const u=new n.default(1),c=new n.default(2);if(o=new n.default(o),!i.mul(o).umod(s).eq(u))return!1;t=new n.default(t),r=new n.default(r);const f=await a.default.getRandomBN(c,c.shln(e.bitLength()/3)),d=f.mul(r).mul(t);return!(!d.umod(i.sub(u)).eq(f)||!d.umod(s.sub(u)).eq(f))},bnSign:async function(e,t,r,i){t=new n.default(t);const a=new n.default(await u.default.emsa.encode(e,i,t.byteLength()),16);if(r=new n.default(r),t.cmp(a)<=0)throw new Error("Message size cannot exceed modulus size");const s=new n.default.red(t);return a.toRed(s).redPow(r).toArrayLike(Uint8Array,"be",t.byteLength())},webSign:async function(e,t,r,i,a,s,u,c){const f=function(e,t,r,i,a,s){const u=new n.default(i),c=new n.default(a),f=new n.default(r);let d=f.mod(c.subn(1)),l=f.mod(u.subn(1));return l=l.toArrayLike(Uint8Array),d=d.toArrayLike(Uint8Array),{kty:"RSA",n:o.default.Uint8Array_to_b64(e,!0),e:o.default.Uint8Array_to_b64(t,!0),d:o.default.Uint8Array_to_b64(r,!0),p:o.default.Uint8Array_to_b64(a,!0),q:o.default.Uint8Array_to_b64(i,!0),dp:o.default.Uint8Array_to_b64(d,!0),dq:o.default.Uint8Array_to_b64(l,!0),qi:o.default.Uint8Array_to_b64(s,!0),ext:!0}}(r,i,a,s,u,c),d={name:"RSASSA-PKCS1-v1_5",hash:{name:e}},h=await l.importKey("jwk",f,d,!1,["sign"]);return new Uint8Array(await l.sign({name:"RSASSA-PKCS1-v1_5",hash:e},h,t))},nodeSign:async function(e,t,r,i,a,s,o,u){const f=new n.default(s),d=new n.default(o),l=new n.default(a),p=l.mod(d.subn(1)),y=l.mod(f.subn(1)),m=h.createSign(c.default.read(c.default.hash,e));m.write(t),m.end();const g={version:0,modulus:new n.default(r),publicExponent:new n.default(i),privateExponent:new n.default(a),prime1:new n.default(o),prime2:new n.default(s),exponent1:p,exponent2:y,coefficient:new n.default(u)};if(void 0!==h.createPrivateKey){const e=b.encode(g,"der");return new Uint8Array(m.sign({key:e,format:"der",type:"pkcs1"}))}const w=b.encode(g,"pem",{label:"RSA PRIVATE KEY"});return new Uint8Array(m.sign(w))},bnVerify:async function(e,t,r,i,a){if(r=new n.default(r),t=new n.default(t),i=new n.default(i),r.cmp(t)<=0)throw new Error("Signature size cannot exceed modulus size");const s=new n.default.red(r),c=t.toRed(s).redPow(i).toArrayLike(Uint8Array,"be",r.byteLength()),f=await u.default.emsa.encode(e,a,r.byteLength());return o.default.Uint8Array_to_hex(c)===f},webVerify:async function(e,t,r,n,i){const a=function(e,t){return{kty:"RSA",n:o.default.Uint8Array_to_b64(e,!0),e:o.default.Uint8Array_to_b64(t,!0),ext:!0}}(n,i),s=await l.importKey("jwk",a,{name:"RSASSA-PKCS1-v1_5",hash:{name:e}},!1,["verify"]);return l.verify({name:"RSASSA-PKCS1-v1_5",hash:e},s,r,t)},nodeVerify:async function(e,t,r,i,a){const s=h.createVerify(c.default.read(c.default.hash,e));s.write(t),s.end();const o={modulus:new n.default(i),publicExponent:new n.default(a)};let u;if(void 0!==h.createPrivateKey){u={key:m.encode(o,"der"),format:"der",type:"pkcs1"}}else u=m.encode(o,"pem",{label:"RSA PUBLIC KEY"});try{return await s.verify(u,r)}catch(f){return!1}},nodeEncrypt:async function(e,t,r){const i={modulus:new n.default(t),publicExponent:new n.default(r)};let a;if(void 0!==h.createPrivateKey){a={key:m.encode(i,"der"),format:"der",type:"pkcs1",padding:h.constants.RSA_PKCS1_PADDING}}else{a={key:m.encode(i,"pem",{label:"RSA PUBLIC KEY"}),padding:h.constants.RSA_PKCS1_PADDING}}return new Uint8Array(h.publicEncrypt(a,e))},bnEncrypt:async function(e,t,r){if(t=new n.default(t),e=(e=new f.default(await u.default.eme.encode(o.default.Uint8Array_to_str(e),t.byteLength()))).toBN(),r=new n.default(r),t.cmp(e)<=0)throw new Error("Message size cannot exceed modulus size");const i=new n.default.red(t);return e.toRed(i).redPow(r).toArrayLike(Uint8Array,"be",t.byteLength())},nodeDecrypt:function(e,t,r,i,a,s,u){const c=new n.default(a),f=new n.default(s),d=new n.default(i),l=d.mod(f.subn(1)),p=d.mod(c.subn(1)),y={version:0,modulus:new n.default(t),publicExponent:new n.default(r),privateExponent:new n.default(i),prime1:new n.default(s),prime2:new n.default(a),exponent1:l,exponent2:p,coefficient:new n.default(u)};let m;if(void 0!==h.createPrivateKey){m={key:b.encode(y,"der"),format:"der",type:"pkcs1",padding:h.constants.RSA_PKCS1_PADDING}}else{m={key:b.encode(y,"pem",{label:"RSA PRIVATE KEY"}),padding:h.constants.RSA_PKCS1_PADDING}}return o.default.Uint8Array_to_str(h.privateDecrypt(m,e))},bnDecrypt:async function(e,t,r,i,o,c,d){if(e=new n.default(e),t=new n.default(t),r=new n.default(r),i=new n.default(i),o=new n.default(o),c=new n.default(c),d=new n.default(d),t.cmp(e)<=0)throw new Error("Data too large.");const l=i.mod(c.subn(1)),h=i.mod(o.subn(1)),p=new n.default.red(o),y=new n.default.red(c),b=new n.default.red(t);let m,g;s.default.rsa_blinding&&(m=(g=(await a.default.getRandomBN(new n.default(2),t)).toRed(b)).redInvm().redPow(r),e=e.toRed(b).redMul(m).fromRed());const w=e.toRed(p).redPow(h),_=e.toRed(y).redPow(l).redSub(w.fromRed().toRed(y));let v=d.toRed(y).redMul(_).fromRed().mul(o).add(w).toRed(b);return s.default.rsa_blinding&&(v=v.redMul(g)),u.default.eme.decode(new f.default(v).toString())},prime:i.default}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../config":79,"../../enums":113,"../../type/mpi":155,"../../util":158,"../pkcs1":96,"../random":109,"./prime":107,"asn1.js":"asn1.js","bn.js":16}],109:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("bn.js"));function i(e){return e&&e.__esModule?e:{default:e}}const a=i(e("../util")).default.detectNode()&&e("crypto");function s(){this.buffer=null,this.size=null,this.callback=null}r.default={getRandomBytes:async function(e){const r=new Uint8Array(e);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(r);else if(void 0!==t&&"object"==typeof t.msCrypto&&"function"==typeof t.msCrypto.getRandomValues)t.msCrypto.getRandomValues(r);else if(a){const e=a.randomBytes(r.length);r.set(e)}else{if(!this.randomBuffer.buffer)throw new Error("No secure random number generator available.");await this.randomBuffer.get(r)}return r},getRandomBN:async function(e,t){if(t.cmp(e)<=0)throw new Error("Illegal parameter value: max <= min");const r=t.sub(e),i=r.byteLength();return new n.default(await this.getRandomBytes(i+8)).mod(r).add(e)},randomBuffer:new s},s.prototype.init=function(e,t){this.buffer=new Uint8Array(e),this.size=0,this.callback=t},s.prototype.set=function(e){if(!this.buffer)throw new Error("RandomBuffer is not initialized");if(!(e instanceof Uint8Array))throw new Error("Invalid type: buf not an Uint8Array");const t=this.buffer.length-this.size;e.length>t&&(e=e.subarray(0,t)),this.buffer.set(e,this.size),this.size+=e.length},s.prototype.get=async function(e){if(!this.buffer)throw new Error("RandomBuffer is not initialized");if(!(e instanceof Uint8Array))throw new Error("Invalid type: buf not an Uint8Array");if(this.size{const r=h?Math.floor(e.length/4):0,n=new Uint32Array(e.buffer,e.byteOffset,r);for(let i=0;i>24&255]^l[1][t>>16&255]^l[2][t>>8&255]^l[3][t>>0&255];for(let i=4*r;i>8^l[0][255&t^e[i]]},()=>new Uint8Array([t,t>>8,t>>16]))}(e);return i.default.encode(t)}const l=[new Array(255),new Array(255),new Array(255),new Array(255)];for(let b=0;b<=255;b++){let e=b<<16;for(let t=0;t<8;t++)e=e<<1^(0!=(8388608&e)?8801531:0);l[0][b]=(16711680&e)>>16|65280&e|(255&e)<<16}for(let b=0;b<=255;b++)l[1][b]=l[0][b]>>8^l[0][255&l[0][b]];for(let b=0;b<=255;b++)l[2][b]=l[1][b]>>8^l[0][255&l[1][b]];for(let b=0;b<=255;b++)l[3][b]=l[2][b]>>8^l[0][255&l[2][b]];const h=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,255,!0),255===new Int16Array(e)[0]}();function p(e){for(let t=0;t=0&&n!==e.length-1&&(t=e.slice(0,n),r=e.slice(n+1).substr(0,4)),{body:t,checksum:r}}r.default={encode:function(e,t,r,s,u){let c,l;e===a.default.armor.signed&&(c=t.text,l=t.hash,t=t.data);const h=n.default.passiveClone(t),p=[];switch(e){case a.default.armor.multipart_section:p.push("-----BEGIN PGP MESSAGE, PART "+r+"/"+s+"-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP MESSAGE, PART "+r+"/"+s+"-----\r\n");break;case a.default.armor.multipart_last:p.push("-----BEGIN PGP MESSAGE, PART "+r+"-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP MESSAGE, PART "+r+"-----\r\n");break;case a.default.armor.signed:p.push("\r\n-----BEGIN PGP SIGNED MESSAGE-----\r\n"),p.push("Hash: "+l+"\r\n\r\n"),p.push(c.replace(/^-/gm,"- -")),p.push("\r\n-----BEGIN PGP SIGNATURE-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP SIGNATURE-----\r\n");break;case a.default.armor.message:p.push("-----BEGIN PGP MESSAGE-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP MESSAGE-----\r\n");break;case a.default.armor.public_key:p.push("-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP PUBLIC KEY BLOCK-----\r\n");break;case a.default.armor.private_key:p.push("-----BEGIN PGP PRIVATE KEY BLOCK-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP PRIVATE KEY BLOCK-----\r\n");break;case a.default.armor.signature:p.push("-----BEGIN PGP SIGNATURE-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP SIGNATURE-----\r\n")}return o.default.concat(p)},decode:function(e){return new Promise(async(t,r)=>{try{const u=/^-----[^-]+-----$/m,f=/^[ \f\r\t\u00a0\u2000-\u200a\u202f\u205f\u3000]*$/;let l;const h=[];let b,m,g,w=h,_=[],v=i.default.decode(n.default.transformPair(e,async(e,i)=>{const a=n.default.getReader(e);try{for(;;){let e=await a.readLine();if(void 0===e)throw new Error("Misformed armored text");if(e=o.default.removeTrailingSpaces(e.replace(/[\r\n]/g,"")),l)if(b)m||2!==l||(u.test(e)?(_=_.join("\r\n"),m=!0,p(w),w=[],b=!1):_.push(e.replace(/^- /,"")));else if(u.test(e)&&r(new Error("Mandatory blank line missing between armor headers and armor data")),f.test(e)){if(p(w),b=!0,m||2!==l){t({text:_,data:v,headers:h,type:l});break}}else w.push(e);else u.test(e)&&(l=c(e))}}catch(k){return void r(k)}const s=n.default.getWriter(i);try{for(;;){await s.ready;var d=await a.read();const e=d.done,t=d.value;if(e)throw new Error("Misformed armored text");const r=t+"";if(-1!==r.indexOf("=")||-1!==r.indexOf("-")){let e=await a.readToEnd();e.length||(e=""),e=r+e;const t=(e=o.default.removeTrailingSpaces(e.replace(/\r/g,""))).split(u);if(1===t.length)throw new Error("Misformed armored text");const n=y(t[0].slice(0,-1));g=n.checksum,await s.write(n.body);break}await s.write(r)}await s.ready,await s.close()}catch(k){await s.abort(k)}}));v=n.default.transformPair(v,async(e,t)=>{const r=n.default.readToEnd(d(n.default.passiveClone(e)));r.catch(()=>{}),await n.default.pipe(e,t,{preventClose:!0});const i=n.default.getWriter(t);try{const e=(await r).replace("\r\n","");if(g!==e&&(g||s.default.checksum_required))throw new Error("Ascii armor integrity check on message failed: '"+g+"' should be '"+e+"'");await i.ready,await i.close()}catch(a){await i.abort(a)}})}catch(a){r(a)}})}}},{"../config":79,"../enums.js":113,"../util":158,"./base64.js":112,"web-stream-tools":75}],112:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("web-stream-tools")),i=a(e("../util"));function a(e){return e&&e.__esModule?e:{default:e}}const s=i.default.getNodeBuffer();let o,u;s?(o=(e=>s.from(e).toString("base64")),u=(e=>{const t=s.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)})):(o=(e=>btoa(i.default.Uint8Array_to_str(e))),u=(e=>i.default.str_to_Uint8Array(atob(e)))),r.default={encode:function(e){let t=new Uint8Array;return n.default.transform(e,e=>{t=i.default.concatUint8Array([t,e]);const r=[],n=Math.floor(t.length/45),a=45*n,s=o(t.subarray(0,a));for(let t=0;tt.length?o(t)+"\r\n":"")},decode:function(e){let t="";return n.default.transform(e,e=>{t+=e;let r=0;const n=[" ","\t","\r","\n"];for(let s=0;s0&&(i-r)%4!=0;i--)n.includes(t[i])&&r--;const a=u(t.substr(0,i));return t=t.substr(i),a},()=>u(t))}}},{"../util":158,"web-stream-tools":75}],113:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=Symbol("byValue");r.default={curve:{p256:"p256","P-256":"p256",secp256r1:"p256",prime256v1:"p256","1.2.840.10045.3.1.7":"p256","2a8648ce3d030107":"p256","2A8648CE3D030107":"p256",p384:"p384","P-384":"p384",secp384r1:"p384","1.3.132.0.34":"p384","2b81040022":"p384","2B81040022":"p384",p521:"p521","P-521":"p521",secp521r1:"p521","1.3.132.0.35":"p521","2b81040023":"p521","2B81040023":"p521",secp256k1:"secp256k1","1.3.132.0.10":"secp256k1","2b8104000a":"secp256k1","2B8104000A":"secp256k1",ED25519:"ed25519",ed25519:"ed25519",Ed25519:"ed25519","1.3.6.1.4.1.11591.15.1":"ed25519","2b06010401da470f01":"ed25519","2B06010401DA470F01":"ed25519",X25519:"curve25519",cv25519:"curve25519",curve25519:"curve25519",Curve25519:"curve25519","1.3.6.1.4.1.3029.1.5.1":"curve25519","2b060104019755010501":"curve25519","2B060104019755010501":"curve25519",brainpoolP256r1:"brainpoolP256r1","1.3.36.3.3.2.8.1.1.7":"brainpoolP256r1","2b2403030208010107":"brainpoolP256r1","2B2403030208010107":"brainpoolP256r1",brainpoolP384r1:"brainpoolP384r1","1.3.36.3.3.2.8.1.1.11":"brainpoolP384r1","2b240303020801010b":"brainpoolP384r1","2B240303020801010B":"brainpoolP384r1",brainpoolP512r1:"brainpoolP512r1","1.3.36.3.3.2.8.1.1.13":"brainpoolP512r1","2b240303020801010d":"brainpoolP512r1","2B240303020801010D":"brainpoolP512r1"},s2k:{simple:0,salted:1,iterated:3,gnu:101},publicKey:{rsa_encrypt_sign:1,rsa_encrypt:2,rsa_sign:3,elgamal:16,dsa:17,ecdh:18,ecdsa:19,eddsa:22,aedh:23,aedsa:24},symmetric:{plaintext:0,idea:1,"3des":2,tripledes:2,cast5:3,blowfish:4,aes128:7,aes192:8,aes256:9,twofish:10},compression:{uncompressed:0,zip:1,zlib:2,bzip2:3},hash:{md5:1,sha1:2,ripemd:3,sha256:8,sha384:9,sha512:10,sha224:11},webHash:{"SHA-1":2,"SHA-256":8,"SHA-384":9,"SHA-512":10},aead:{eax:1,ocb:2,experimental_gcm:100},packet:{publicKeyEncryptedSessionKey:1,signature:2,symEncryptedSessionKey:3,onePassSignature:4,secretKey:5,publicKey:6,secretSubkey:7,compressed:8,symmetricallyEncrypted:9,marker:10,literal:11,trust:12,userid:13,publicSubkey:14,userAttribute:17,symEncryptedIntegrityProtected:18,modificationDetectionCode:19,symEncryptedAEADProtected:20},literal:{binary:"b".charCodeAt(),text:"t".charCodeAt(),utf8:"u".charCodeAt(),mime:"m".charCodeAt()},signature:{binary:0,text:1,standalone:2,cert_generic:16,cert_persona:17,cert_casual:18,cert_positive:19,cert_revocation:48,subkey_binding:24,key_binding:25,key:31,key_revocation:32,subkey_revocation:40,timestamp:64,third_party:80},signatureSubpacket:{signature_creation_time:2,signature_expiration_time:3,exportable_certification:4,trust_signature:5,regular_expression:6,revocable:7,key_expiration_time:9,placeholder_backwards_compatibility:10,preferred_symmetric_algorithms:11,revocation_key:12,issuer:16,notation_data:20,preferred_hash_algorithms:21,preferred_compression_algorithms:22,key_server_preferences:23,preferred_key_server:24,primary_user_id:25,policy_uri:26,key_flags:27,signers_user_id:28,reason_for_revocation:29,features:30,signature_target:31,embedded_signature:32,issuer_fingerprint:33,preferred_aead_algorithms:34},keyFlags:{certify_keys:1,sign_data:2,encrypt_communication:4,encrypt_storage:8,split_private_key:16,authentication:32,shared_private_key:128},armor:{multipart_section:0,multipart_last:1,signed:2,message:3,public_key:4,private_key:5,signature:6},reasonForRevocation:{no_reason:0,key_superseded:1,key_compromised:2,key_retired:3,userid_invalid:32},features:{modification_detection:1,aead:2,v5_keys:4},write:function(e,t){if("number"==typeof t&&(t=this.read(e,t)),void 0!==e[t])return e[t];throw new Error("Invalid enum value.")},read:function(e,t){if(e[n]||(e[n]=[],Object.entries(e).forEach(([t,r])=>{e[n][r]=t})),void 0!==e[n][t])return e[n][t];throw new Error("Invalid enum value.")}}},{}],114:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("./config"),a=(n=i)&&n.__esModule?n:{default:n};function s(r){this._baseUrl=r||a.default.keyserver,this._fetch="function"==typeof t.fetch?t.fetch:e("node-fetch")}s.prototype.lookup=function(e){let t=this._baseUrl+"/pks/lookup?op=get&options=mr&search=";const r=this._fetch;if(e.keyId)t+="0x"+encodeURIComponent(e.keyId);else{if(!e.query)throw new Error("You must provide a query parameter!");t+=encodeURIComponent(e.query)}return r(t).then(function(e){if(200===e.status)return e.text()}).then(function(e){if(e&&!(e.indexOf("-----END PGP PUBLIC KEY BLOCK-----")<0))return e.trim()})},s.prototype.upload=function(e){const t=this._baseUrl+"/pks/add";return(0,this._fetch)(t,{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:"keytext="+encodeURIComponent(e)})},r.default=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./config":79,"node-fetch":"node-fetch"}],115:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.lightweight=r.WKD=r.HKP=r.AsyncProxy=r.Keyring=r.crypto=r.config=r.enums=r.armor=r.stream=r.OID=r.KDFParams=r.ECDHSymmetricKey=r.Keyid=r.S2K=r.MPI=r.packet=r.util=r.cleartext=r.message=r.signature=r.key=r.destroyWorker=r.getWorker=r.initWorker=r.decryptSessionKeys=r.encryptSessionKey=r.decryptKey=r.revokeKey=r.reformatKey=r.generateKey=r.verify=r.sign=r.decrypt=r.encrypt=void 0;var n=e("./openpgp");Object.defineProperty(r,"encrypt",{enumerable:!0,get:function(){return n.encrypt}}),Object.defineProperty(r,"decrypt",{enumerable:!0,get:function(){return n.decrypt}}),Object.defineProperty(r,"sign",{enumerable:!0,get:function(){return n.sign}}),Object.defineProperty(r,"verify",{enumerable:!0,get:function(){return n.verify}}),Object.defineProperty(r,"generateKey",{enumerable:!0,get:function(){return n.generateKey}}),Object.defineProperty(r,"reformatKey",{enumerable:!0,get:function(){return n.reformatKey}}),Object.defineProperty(r,"revokeKey",{enumerable:!0,get:function(){return n.revokeKey}}),Object.defineProperty(r,"decryptKey",{enumerable:!0,get:function(){return n.decryptKey}}),Object.defineProperty(r,"encryptSessionKey",{enumerable:!0,get:function(){return n.encryptSessionKey}}),Object.defineProperty(r,"decryptSessionKeys",{enumerable:!0,get:function(){return n.decryptSessionKeys}}),Object.defineProperty(r,"initWorker",{enumerable:!0,get:function(){return n.initWorker}}),Object.defineProperty(r,"getWorker",{enumerable:!0,get:function(){return n.getWorker}}),Object.defineProperty(r,"destroyWorker",{enumerable:!0,get:function(){return n.destroyWorker}});var i=e("./util");Object.defineProperty(r,"util",{enumerable:!0,get:function(){return M(i).default}});var a=e("./packet");Object.defineProperty(r,"packet",{enumerable:!0,get:function(){return M(a).default}});var s=e("./type/mpi");Object.defineProperty(r,"MPI",{enumerable:!0,get:function(){return M(s).default}});var o=e("./type/s2k");Object.defineProperty(r,"S2K",{enumerable:!0,get:function(){return M(o).default}});var u=e("./type/keyid");Object.defineProperty(r,"Keyid",{enumerable:!0,get:function(){return M(u).default}});var c=e("./type/ecdh_symkey");Object.defineProperty(r,"ECDHSymmetricKey",{enumerable:!0,get:function(){return M(c).default}});var f=e("./type/kdf_params");Object.defineProperty(r,"KDFParams",{enumerable:!0,get:function(){return M(f).default}});var d=e("./type/oid");Object.defineProperty(r,"OID",{enumerable:!0,get:function(){return M(d).default}});var l=e("web-stream-tools");Object.defineProperty(r,"stream",{enumerable:!0,get:function(){return M(l).default}});var h=e("./encoding/armor");Object.defineProperty(r,"armor",{enumerable:!0,get:function(){return M(h).default}});var p=e("./enums");Object.defineProperty(r,"enums",{enumerable:!0,get:function(){return M(p).default}});var y=e("./config/config");Object.defineProperty(r,"config",{enumerable:!0,get:function(){return M(y).default}});var b=e("./crypto");Object.defineProperty(r,"crypto",{enumerable:!0,get:function(){return M(b).default}});var m=e("./keyring");Object.defineProperty(r,"Keyring",{enumerable:!0,get:function(){return M(m).default}});var g=e("./worker/async_proxy");Object.defineProperty(r,"AsyncProxy",{enumerable:!0,get:function(){return M(g).default}});var w=e("./hkp");Object.defineProperty(r,"HKP",{enumerable:!0,get:function(){return M(w).default}});var _=e("./wkd");Object.defineProperty(r,"WKD",{enumerable:!0,get:function(){return M(_).default}});var v=x(n),k=x(e("./key")),A=x(e("./signature")),S=x(e("./message")),E=x(e("./cleartext")),P=x(e("./lightweight_helper"));function x(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 M(e){return e&&e.__esModule?e:{default:e}}r.default=v;r.key=k,r.signature=A,r.message=S,r.cleartext=E,r.lightweight=P},{"./cleartext":77,"./config/config":78,"./crypto":94,"./encoding/armor":111,"./enums":113,"./hkp":114,"./key":118,"./keyring":122,"./lightweight_helper":125,"./message":126,"./openpgp":127,"./packet":131,"./signature":151,"./type/ecdh_symkey":152,"./type/kdf_params":153,"./type/keyid":154,"./type/mpi":155,"./type/oid":156,"./type/s2k":157,"./util":158,"./wkd":159,"./worker/async_proxy":160,"web-stream-tools":75}],116:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.generate=async function(e){e.sign=!0,(e=a.sanitizeKeyOptions(e)).subkeys=e.subkeys.map(function(t,r){return a.sanitizeKeyOptions(e.subkeys[r],e)});let t=[a.generateSecretKey(e)];return t=t.concat(e.subkeys.map(a.generateSecretSubkey)),Promise.all(t).then(t=>d(t[0],t.slice(1),e))},r.reformat=async function(e){e=i(e);try{const t=e.privateKey.getKeys().every(e=>e.isDecrypted());t||await e.privateKey.decrypt()}catch(a){throw new Error("Key not decrypted")}const t=e.privateKey.toPacketlist();let r;const n=[];for(let o=0;o({sign:await e.privateKey.getSigningKey(t.getKeyId(),null).catch(()=>{})&&!(await e.privateKey.getEncryptionKey(t.getKeyId(),null).catch(()=>{}))}))));if(e.subkeys.length!==n.length)throw new Error("Number of subkey options does not match number of subkeys");return e.subkeys=e.subkeys.map(function(t,r){return i(e.subkeys[r],e)}),d(r,n,e);function i(e,t={}){return e.keyExpirationTime=e.keyExpirationTime||t.keyExpirationTime,e.passphrase=o.default.isString(e.passphrase)?e.passphrase:t.passphrase,e.date=e.date||t.date,e}},r.read=l,r.readArmored=async function(e){try{const r=await c.default.decode(e);if(r.type!==s.default.armor.public_key&&r.type!==s.default.armor.private_key)throw new Error("Armored text not of type key");return l(r.data)}catch(t){const e={keys:[],err:[]};return e.err.push(t),e}};var n=f(e("../packet")),i=f(e("./key")),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("./helper")),s=f(e("../enums")),o=f(e("../util")),u=f(e("../config")),c=f(e("../encoding/armor"));function f(e){return e&&e.__esModule?e:{default:e}}async function d(e,t,r){r.passphrase&&await e.encrypt(r.passphrase),await Promise.all(t.map(async function(e,t){const n=r.subkeys[t].passphrase;n&&await e.encrypt(n)}));const o=new n.default.List;o.push(e),await Promise.all(r.userIds.map(async function(t,i){function o(e,t){if(t){const r=e.indexOf(t);r>=1&&e.splice(r,1),0!==r&&e.unshift(t)}return e}const c=new n.default.Userid;c.format(t);const f={};f.userId=c,f.key=e;const d=new n.default.Signature(r.date);return d.signatureType=s.default.signature.cert_generic,d.publicKeyAlgorithm=e.algorithm,d.hashAlgorithm=await a.getPreferredHashAlgo(null,e),d.keyFlags=[s.default.keyFlags.certify_keys|s.default.keyFlags.sign_data],d.preferredSymmetricAlgorithms=o([s.default.symmetric.aes256,s.default.symmetric.aes128,s.default.symmetric.aes192,s.default.symmetric.cast5,s.default.symmetric.tripledes],u.default.encryption_cipher),u.default.aead_protect&&(d.preferredAeadAlgorithms=o([s.default.aead.eax,s.default.aead.ocb],u.default.aead_mode)),d.preferredHashAlgorithms=o([s.default.hash.sha256,s.default.hash.sha512,s.default.hash.sha1],u.default.prefer_hash_algorithm),d.preferredCompressionAlgorithms=o([s.default.compression.zlib,s.default.compression.zip,s.default.compression.uncompressed],u.default.compression),0===i&&(d.isPrimaryUserID=!0),u.default.integrity_protect&&(d.features=[0],d.features[0]|=s.default.features.modification_detection),u.default.aead_protect&&(d.features||(d.features=[0]),d.features[0]|=s.default.features.aead),u.default.v5_keys&&(d.features||(d.features=[0]),d.features[0]|=s.default.features.v5_keys),r.keyExpirationTime>0&&(d.keyExpirationTime=r.keyExpirationTime,d.keyNeverExpires=!1),await d.sign(e,f),{userIdPacket:c,signaturePacket:d}})).then(e=>{e.forEach(({userIdPacket:e,signaturePacket:t})=>{o.push(e),o.push(t)})}),await Promise.all(t.map(async function(t,n){const i=r.subkeys[n];return{secretSubkeyPacket:t,subkeySignaturePacket:await a.createBindingSignature(t,e,i)}})).then(e=>{e.forEach(({secretSubkeyPacket:e,subkeySignaturePacket:t})=>{o.push(e),o.push(t)})});const c={key:e};return o.push(await a.createSignaturePacket(c,null,e,{signatureType:s.default.signature.key_revocation,reasonForRevocationFlag:s.default.reasonForRevocation.no_reason,reasonForRevocationString:""},r.date)),r.passphrase&&e.clearPrivateParams(),await Promise.all(t.map(async function(e,t){r.subkeys[t].passphrase&&e.clearPrivateParams()})),new i.default(o)}async function l(e){const t={keys:[]},r=[];try{const o=new n.default.List;await o.read(e);const u=o.indexOfTag(s.default.packet.publicKey,s.default.packet.secretKey);if(0===u.length)throw new Error("No key packet found");for(let e=0;e=0;a--)try{s&&!(e[a].created>=s.created)||e[a].isExpired(i)||!e[a].verified&&!(await e[a].verify(t,r,n))||(s=e[a])}catch(c){o=c}if(!s)throw u.default.wrapError(`Could not find valid ${a.default.read(a.default.signature,r)} signature in key ${t.getKeyId().toHex()}`.replace("cert_generic ","self-").replace("_"," "),o);return s},r.isDataExpired=function(e,t,r=new Date){const n=u.default.normalizeDate(r);if(null!==n){const i=l(e,t);return!(e.created<=n&&n<=i)||t&&t.isExpired(r)}return!1},r.createBindingSignature=async function(e,t,r){const n={};n.key=t,n.bind=e;const s=new i.default.Signature(r.date);s.signatureType=a.default.signature.subkey_binding,s.publicKeyAlgorithm=t.algorithm,s.hashAlgorithm=await f(null,e),r.sign?(s.keyFlags=[a.default.keyFlags.sign_data],s.embeddedSignature=await d(n,null,e,{signatureType:a.default.signature.key_binding},r.date)):s.keyFlags=[a.default.keyFlags.encrypt_communication|a.default.keyFlags.encrypt_storage];r.keyExpirationTime>0&&(s.keyExpirationTime=r.keyExpirationTime,s.keyNeverExpires=!1);return await s.sign(t,n),s},r.getPreferredHashAlgo=f,r.getPreferredAlgo=async function(e,t,r=new Date,n=[]){const i="symmetric"===e?"preferredSymmetricAlgorithms":"preferredAeadAlgorithms",s="symmetric"===e?a.default.symmetric.aes128:a.default.aead.eax,o={};await Promise.all(t.map(async function(e,t){const a=await e.getPrimaryUser(r,n[t]);if(!a.selfCertification[i])return s;a.selfCertification[i].forEach(function(e,t){const r=o[e]||(o[e]={prio:0,count:0,algo:e});r.prio+=64>>t,r.count++})}));let u={prio:0,algo:s};return Object.values(o).forEach(({prio:r,count:n,algo:i})=>{try{i!==a.default[e].plaintext&&i!==a.default[e].idea&&a.default.read(a.default[e],i)&&n===t.length&&r>u.prio&&(u=o[i])}catch(s){}}),u.algo},r.createSignaturePacket=d,r.mergeSignatures=async function(e,t,r,n){(e=e[r])&&(t[r].length?await Promise.all(e.map(async function(e){e.isExpired()||n&&!(await n(e))||t[r].some(function(t){return u.default.equalsUint8Array(t.signature,e.signature)})||t[r].push(e)})):t[r]=e)},r.isDataRevoked=async function(e,t,r,n,i,a,o=new Date){a=a||e;const c=u.default.normalizeDate(o),f=[];if(await Promise.all(n.map(async function(e){try{i&&!e.issuerKeyId.equals(i.issuerKeyId)||s.default.revocations_expire&&e.isExpired(c)||!e.verified&&!(await e.verify(a,t,r))||f.push(e.issuerKeyId)}catch(n){}})),i)return i.revoked=!!f.some(e=>e.equals(i.issuerKeyId))||(i.revoked||!1),i.revoked;return f.length>0},r.getExpirationTime=l,r.isAeadSupported=async function(e,t=new Date,r=[]){let n=!0;return await Promise.all(e.map(async function(e,i){const s=await e.getPrimaryUser(t,r[i]);s.selfCertification.features&&s.selfCertification.features[0]&a.default.features.aead||(n=!1)})),n},r.sanitizeKeyOptions=function(e,t={}){if(e.curve=e.curve||t.curve,e.rsaBits=e.rsaBits||t.rsaBits,e.keyExpirationTime=void 0!==e.keyExpirationTime?e.keyExpirationTime:t.keyExpirationTime,e.passphrase=u.default.isString(e.passphrase)?e.passphrase:t.passphrase,e.date=e.date||t.date,e.sign=e.sign||!1,e.curve){try{e.curve=a.default.write(a.default.curve,e.curve)}catch(r){throw new Error("Not valid curve.")}e.curve!==a.default.curve.ed25519&&e.curve!==a.default.curve.curve25519||(e.curve=e.sign?a.default.curve.ed25519:a.default.curve.curve25519),e.sign?e.algorithm=e.curve===a.default.curve.ed25519?a.default.publicKey.eddsa:a.default.publicKey.ecdsa:e.algorithm=a.default.publicKey.ecdh}else{if(!e.rsaBits)throw new Error("Unrecognized key type");e.algorithm=a.default.publicKey.rsa_encrypt_sign}return e},r.isValidSigningKeyPacket=function(e,t){if(!t.verified||!1!==t.revoked)throw new Error("Signature not verified");return e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.rsa_encrypt)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.elgamal)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.ecdh)&&(!t.keyFlags||0!=(t.keyFlags[0]&a.default.keyFlags.sign_data))},r.isValidEncryptionKeyPacket=function(e,t){if(!t.verified||!1!==t.revoked)throw new Error("Signature not verified");return e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.dsa)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.rsa_sign)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.ecdsa)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.eddsa)&&(!t.keyFlags||0!=(t.keyFlags[0]&a.default.keyFlags.encrypt_communication)||0!=(t.keyFlags[0]&a.default.keyFlags.encrypt_storage))},r.isValidDecryptionKeyPacket=function(e){if(!e.verified)throw new Error("Signature not verified");if(s.default.allow_insecure_decryption_with_signing_keys)return!0;return!e.keyFlags||0!=(e.keyFlags[0]&a.default.keyFlags.encrypt_communication)||0!=(e.keyFlags[0]&a.default.keyFlags.encrypt_storage)};var i=c(e("../packet")),a=c(e("../enums")),s=c(e("../config")),o=c(e("../crypto")),u=c(e("../util"));function c(e){return e&&e.__esModule?e:{default:e}}async function f(e,t,r=new Date,a={}){let u=s.default.prefer_hash_algorithm,c=u;if(e){const t=await e.getPrimaryUser(r,a);if(t.selfCertification.preferredHashAlgorithms)c=n(t.selfCertification.preferredHashAlgorithms,1)[0],u=o.default.hash.getHashByteLength(u)<=o.default.hash.getHashByteLength(c)?c:u}switch(Object.getPrototypeOf(t)){case i.default.SecretKey.prototype:case i.default.PublicKey.prototype:case i.default.SecretSubkey.prototype:case i.default.PublicSubkey.prototype:switch(t.algorithm){case"ecdh":case"ecdsa":case"eddsa":c=o.default.publicKey.elliptic.getPreferredHashAlgo(t.params[0])}}return o.default.hash.getHashByteLength(u)<=o.default.hash.getHashByteLength(c)?c:u}async function d(e,t,r,n,a,s,o=!1,u=!1){if(!r.isDecrypted())throw new Error("Private key is not decrypted.");const c=new i.default.Signature(a);return Object.assign(c,n),c.publicKeyAlgorithm=r.algorithm,c.hashAlgorithm=await f(t,r,a,s),await c.sign(r,e,o,u),c}function l(e,t){let r;return!1===t.keyNeverExpires&&(r=e.created.getTime()+1e3*t.keyExpirationTime),r?new Date(r):1/0}},{"../config":79,"../crypto":94,"../enums":113,"../packet":131,"../util":158}],118:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Key=r.createSignaturePacket=r.getPreferredHashAlgo=r.isAeadSupported=r.getPreferredAlgo=r.reformat=r.read=r.generate=r.readArmored=void 0;var n,i=e("./factory"),a=e("./helper"),s=e("./key.js"),o=(n=s)&&n.__esModule?n:{default:n};r.readArmored=i.readArmored,r.generate=i.generate,r.read=i.read,r.reformat=i.reformat,r.getPreferredAlgo=a.getPreferredAlgo,r.isAeadSupported=a.isAeadSupported,r.getPreferredHashAlgo=a.getPreferredHashAlgo,r.createSignaturePacket=a.createSignaturePacket,r.Key=o.default},{"./factory":116,"./helper":117,"./key.js":119}],119:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=d;var n=f(e("../encoding/armor")),i=f(e("../packet")),a=f(e("../enums")),s=f(e("../util")),o=f(e("./user")),u=f(e("./subkey")),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("./helper"));function f(e){return e&&e.__esModule?e:{default:e}}function d(e){if(!(this instanceof d))return new d(e);if(this.keyPacket=null,this.revocationSignatures=[],this.directSignatures=[],this.users=[],this.subKeys=[],this.packetlist2structure(e),!this.keyPacket||!this.users.length)throw new Error("Invalid key: need at least key and user ID packet")}Object.defineProperty(d.prototype,"primaryKey",{get(){return this.keyPacket},configurable:!0,enumerable:!0}),d.prototype.packetlist2structure=function(e){let t,r,n;for(let i=0;ie.concat(t.toPacketlist())),this.subKeys.map(t=>e.concat(t.toPacketlist())),e},d.prototype.getSubkeys=function(e=null){const t=[];return this.subKeys.forEach(r=>{e&&!r.getKeyId().equals(e,!0)||t.push(r)}),t},d.prototype.getKeys=function(e=null){const t=[];return e&&!this.getKeyId().equals(e,!0)||t.push(this),t.concat(this.getSubkeys(e))},d.prototype.getKeyIds=function(){return this.getKeys().map(e=>e.getKeyId())},d.prototype.getUserIds=function(){return this.users.map(e=>e.userId?e.userId.userid:null).filter(e=>null!==e)},d.prototype.isPublic=function(){return this.keyPacket.tag===a.default.packet.publicKey},d.prototype.isPrivate=function(){return this.keyPacket.tag===a.default.packet.secretKey},d.prototype.toPublic=function(){const e=new i.default.List,t=this.toPacketlist();let r,n,s;for(let o=0;ot.keyPacket.created-e.keyPacket.created);let o;for(let s=0;st.keyPacket.created-e.keyPacket.created);let o;for(let s=0;s!0===e)},d.prototype.validate=async function(){if(!this.isPrivate())throw new Error("Cannot validate a public key");let e;if(this.primaryKey.isDummy()){const t=await this.getSigningKey(null,null);t&&!t.keyPacket.isDummy()&&(e=t.keyPacket)}else e=this.primaryKey;if(e)return e.validate();{const e=this.getKeys();if(e.map(e=>e.keyPacket.isDummy()).every(Boolean))throw new Error("Cannot validate an all-gnu-dummy key");return Promise.all(e.map(async e=>e.keyPacket.validate()))}},d.prototype.clearPrivateParams=function(){if(!this.isPrivate())throw new Error("Can't clear private parameters of a public key");this.getKeys().forEach(({keyPacket:e})=>{e.isDecrypted()&&e.clearPrivateParams()})},d.prototype.isRevoked=async function(e,t,r=new Date){return c.isDataRevoked(this.keyPacket,a.default.signature.key_revocation,{key:this.keyPacket},this.revocationSignatures,e,t,r)},d.prototype.verifyPrimaryKey=async function(e=new Date,t={}){const r=this.keyPacket;if(await this.isRevoked(null,null,e))throw new Error("Primary key is revoked");if(!this.users.some(e=>e.userId&&e.selfCertifications.length))throw new Error("No self-certifications");const n=(await this.getPrimaryUser(e,t)).selfCertification;if(c.isDataExpired(r,n,e))throw new Error("Primary key is expired")},d.prototype.getExpirationTime=async function(e,t,r){const n=(await this.getPrimaryUser(null,r)).selfCertification,i=c.getExpirationTime(this.keyPacket,n),a=n.getExpirationTime();let s=i{})||await this.getEncryptionKey(t,null,r).catch(()=>{});if(!e)return null;const n=await e.getExpirationTime(this.keyPacket);n{})||await this.getSigningKey(t,null,r).catch(()=>{});if(!e)return null;const n=await e.getExpirationTime(this.keyPacket);ne.subKeys.some(e=>t.hasSameFingerprintAs(e)))))throw new Error("Cannot update public key with private key if subkey mismatch");this.keyPacket=e.keyPacket}await c.mergeSignatures(e,this,"revocationSignatures",t=>c.isDataRevoked(this.keyPacket,a.default.signature.key_revocation,this,[t],null,e.keyPacket)),await c.mergeSignatures(e,this,"directSignatures"),await Promise.all(e.users.map(async e=>{let t=!1;await Promise.all(this.users.map(async r=>{(e.userId&&r.userId&&e.userId.userid===r.userId.userid||e.userAttribute&&e.userAttribute.equals(r.userAttribute))&&(await r.update(e,this.keyPacket),t=!0)})),t||this.users.push(e)})),await Promise.all(e.subKeys.map(async e=>{let t=!1;await Promise.all(this.subKeys.map(async r=>{r.hasSameFingerprintAs(e)&&(await r.update(e,this.keyPacket),t=!0)})),t||this.subKeys.push(e)}))},d.prototype.revoke=async function({flag:e=a.default.reasonForRevocation.no_reason,string:t=""}={},r=new Date){if(this.isPublic())throw new Error("Need private key for revoking");const n={key:this.keyPacket},i=new d(this.toPacketlist());return i.revocationSignatures.push(await c.createSignaturePacket(n,null,this.keyPacket,{signatureType:a.default.signature.key_revocation,reasonForRevocationFlag:a.default.write(a.default.reasonForRevocation,e),reasonForRevocationString:t},r)),i},d.prototype.getRevocationCertificate=async function(e=new Date){const t={key:this.keyPacket},r=await c.getLatestValidSignature(this.revocationSignatures,this.keyPacket,a.default.signature.key_revocation,t,e),s=new i.default.List;return s.push(r),n.default.encode(a.default.armor.public_key,s.write(),null,null,"This is a revocation certificate")},d.prototype.applyRevocationCertificate=async function(e){const t=await n.default.decode(e),r=new i.default.List;await r.read(t.data);const o=r.findPacket(a.default.packet.signature);if(!o||o.signatureType!==a.default.signature.key_revocation)throw new Error("Could not find revocation signature packet");if(!o.issuerKeyId.equals(this.getKeyId()))throw new Error("Revocation signature does not match key");if(o.isExpired())throw new Error("Revocation signature is expired");try{await o.verify(this.keyPacket,a.default.signature.key_revocation,{key:this.keyPacket})}catch(c){throw s.default.wrapError("Could not verify revocation signature",c)}const u=new d(this.toPacketlist());return u.revocationSignatures.push(o),u},d.prototype.signPrimaryUser=async function(e,t,r){var n=await this.getPrimaryUser(t,r);const i=n.index,a=n.user,s=await a.sign(this.keyPacket,e),o=new d(this.toPacketlist());return o.users[i]=s,o},d.prototype.signAllUsers=async function(e){const t=this,r=new d(this.toPacketlist());return r.users=await Promise.all(this.users.map(function(r){return r.sign(t.keyPacket,e)})),r},d.prototype.verifyPrimaryUser=async function(e,t,r){const n=this.keyPacket;const i=(await this.getPrimaryUser(t,r)).user;return e?await i.verifyAllCertifications(n,e):[{keyid:n.keyid,valid:await i.verify(n).catch(()=>!1)}]},d.prototype.verifyAllUsers=async function(e){const t=[],r=this.keyPacket;return await Promise.all(this.users.map(async function(n){(e?await n.verifyAllCertifications(r,e):[{keyid:r.keyid,valid:await n.verify(r).catch(()=>!1)}]).forEach(e=>{t.push({userid:n.userId.userid,keyid:e.keyid,valid:e.valid})})})),t},d.prototype.addSubkey=async function(e={}){if(!this.isPrivate())throw new Error("Cannot add a subkey to a public key");if(e.passphrase)throw new Error("Subkey could not be encrypted here, please encrypt whole key");if(s.default.getWebCryptoAll()&&e.rsaBits<2048)throw new Error("When using webCrypto rsaBits should be 2048 or 4096, found: "+e.rsaBits);const t=this.primaryKey;if(!t.isDecrypted())throw new Error("Key is not decrypted");const r=t.getAlgorithmInfo();e=c.sanitizeKeyOptions(e,r);const n=await c.generateSecretSubkey(e),i=await c.createBindingSignature(n,t,e),a=this.toPacketlist();return a.push(n),a.push(i),new d(a)},["getKeyId","getFingerprint","getAlgorithmInfo","getCreationTime","isDecrypted","hasSameFingerprintAs"].forEach(e=>{d.prototype[e]=u.default.prototype[e]})},{"../encoding/armor":111,"../enums":113,"../packet":131,"../util":158,"./helper":117,"./subkey":120,"./user":121}],120:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;var n=s(e("../enums")),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("./helper")),a=s(e("../packet"));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){if(!(this instanceof o))return new o(e);this.keyPacket=e,this.bindingSignatures=[],this.revocationSignatures=[]}o.prototype.toPacketlist=function(){const e=new a.default.List;return e.push(this.keyPacket),e.concat(this.revocationSignatures),e.concat(this.bindingSignatures),e},o.prototype.isRevoked=async function(e,t,r,a=new Date){return i.isDataRevoked(e,n.default.signature.subkey_revocation,{key:e,bind:this.keyPacket},this.revocationSignatures,t,r,a)},o.prototype.verify=async function(e,t=new Date){const r={key:e,bind:this.keyPacket},a=await i.getLatestValidSignature(this.bindingSignatures,e,n.default.signature.subkey_binding,r,t);if(a.revoked||await this.isRevoked(e,a,null,t))throw new Error("Subkey is revoked");if(i.isDataExpired(this.keyPacket,a,t))throw new Error("Subkey is expired")},o.prototype.getExpirationTime=async function(e,t=new Date){const r={key:e,bind:this.keyPacket};let a;try{a=await i.getLatestValidSignature(this.bindingSignatures,e,n.default.signature.subkey_binding,r,t)}catch(u){return null}const s=i.getExpirationTime(this.keyPacket,a),o=a.getExpirationTime();return sr.bindingSignatures[t].created&&(r.bindingSignatures[t]=e),!1;try{return e.verified||await e.verify(t,n.default.signature.subkey_binding,a)}catch(i){return!1}}),await i.mergeSignatures(e,this,"revocationSignatures",function(e){return i.isDataRevoked(t,n.default.signature.subkey_revocation,a,[e])})},o.prototype.revoke=async function(e,{flag:t=n.default.reasonForRevocation.no_reason,string:r=""}={},a=new Date){const s={key:e,bind:this.keyPacket},u=new o(this.keyPacket);return u.revocationSignatures.push(await i.createSignaturePacket(s,null,e,{signatureType:n.default.signature.subkey_revocation,reasonForRevocationFlag:n.default.write(n.default.reasonForRevocation,t),reasonForRevocationString:r},a)),await u.update(this,e),u},["getKeyId","getFingerprint","getAlgorithmInfo","getCreationTime","isDecrypted"].forEach(e=>{o.prototype[e]=function(){return this.keyPacket[e]()}}),o.prototype.hasSameFingerprintAs=function(e){return this.keyPacket.hasSameFingerprintAs(e.keyPacket||e)}},{"../enums":113,"../packet":131,"./helper":117}],121:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=u;var n=o(e("../enums")),i=o(e("../util")),a=o(e("../packet")),s=e("./helper");function o(e){return e&&e.__esModule?e:{default:e}}function u(e){if(!(this instanceof u))return new u(e);this.userId=e.tag===n.default.packet.userid?e:null,this.userAttribute=e.tag===n.default.packet.userAttribute?e:null,this.selfCertifications=[],this.otherCertifications=[],this.revocationSignatures=[]}u.prototype.toPacketlist=function(){const e=new a.default.List;return e.push(this.userId||this.userAttribute),e.concat(this.revocationSignatures),e.concat(this.selfCertifications),e.concat(this.otherCertifications),e},u.prototype.sign=async function(e,t){const r={userId:this.userId,userAttribute:this.userAttribute,key:e},i=new u(r.userId||r.userAttribute);return i.otherCertifications=await Promise.all(t.map(async function(t){if(t.isPublic())throw new Error("Need private key for signing");if(t.hasSameFingerprintAs(e))throw new Error("Not implemented for self signing");const i=await t.getSigningKey();return(0,s.createSignaturePacket)(r,t,i.keyPacket,{signatureType:n.default.signature.cert_generic,keyFlags:[n.default.keyFlags.certify_keys|n.default.keyFlags.sign_data]})})),await i.update(this,e),i},u.prototype.isRevoked=async function(e,t,r,i=new Date){return(0,s.isDataRevoked)(e,n.default.signature.cert_revocation,{key:e,userId:this.userId,userAttribute:this.userAttribute},this.revocationSignatures,t,r,i)},u.prototype.verifyCertificate=async function(e,t,r,a=new Date){const s=this,o=t.issuerKeyId,u={userId:this.userId,userAttribute:this.userAttribute,key:e};return(await Promise.all(r.map(async function(r){if(!r.getKeyIds().some(e=>e.equals(o)))return null;const c=await r.getSigningKey(o,a);if(t.revoked||await s.isRevoked(e,t,c.keyPacket,a))throw new Error("User certificate is revoked");try{t.verified||await t.verify(c.keyPacket,n.default.signature.cert_generic,u)}catch(f){throw i.default.wrapError("User certificate is invalid",f)}if(t.isExpired(a))throw new Error("User certificate is expired");return!0}))).find(e=>null!==e)||null},u.prototype.verifyAllCertifications=async function(e,t,r=new Date){const n=this,i=this.selfCertifications.concat(this.otherCertifications);return Promise.all(i.map(async function(i){return{keyid:i.issuerKeyId,valid:await n.verifyCertificate(e,i,t,r).catch(()=>!1)}}))},u.prototype.verify=async function(e,t=new Date){if(!this.selfCertifications.length)throw new Error("No self-certifications");const r=this,a={userId:this.userId,userAttribute:this.userAttribute,key:e};let s;for(let u=this.selfCertifications.length-1;u>=0;u--)try{const c=this.selfCertifications[u];if(c.revoked||await r.isRevoked(e,c,void 0,t))throw new Error("Self-certification is revoked");try{c.verified||await c.verify(e,n.default.signature.cert_generic,a)}catch(o){throw i.default.wrapError("Self-certification is invalid",o)}if(c.isExpired(t))throw new Error("Self-certification is expired");return!0}catch(o){s=o}throw s},u.prototype.update=async function(e,t){const r={userId:this.userId,userAttribute:this.userAttribute,key:t};await(0,s.mergeSignatures)(e,this,"selfCertifications",async function(e){try{return e.verified||e.verify(t,n.default.signature.cert_generic,r)}catch(i){return!1}}),await(0,s.mergeSignatures)(e,this,"otherCertifications"),await(0,s.mergeSignatures)(e,this,"revocationSignatures",function(e){return(0,s.isDataRevoked)(t,n.default.signature.cert_revocation,r,[e])})}},{"../enums":113,"../packet":131,"../util":158,"./helper":117}],122:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("./keyring.js")),i=a(e("./localstore.js"));function a(e){return e&&e.__esModule?e:{default:e}}n.default.localstore=i.default,r.default=n.default},{"./keyring.js":123,"./localstore.js":124}],123:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../key"),a=e("./localstore"),s=(n=a)&&n.__esModule?n:{default:n};function o(e){this.storeHandler=e||new s.default}function u(e){this.keys=e}function c(e,t){const r=(e=e.toLowerCase()).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("<"+r+">"),i=t.getUserIds();for(let a=0;an.default.readToEnd(e.armor())));e.setItem(t,JSON.stringify(i))}else e.removeItem(t)}u.prototype.publicKeysItem="public-keys",u.prototype.privateKeysItem="private-keys",u.prototype.loadPublic=async function(){return c(this.storage,this.publicKeysItem)},u.prototype.loadPrivate=async function(){return c(this.storage,this.privateKeysItem)},u.prototype.storePublic=async function(e){await f(this.storage,this.publicKeysItem,e)},u.prototype.storePrivate=async function(e){await f(this.storage,this.privateKeysItem,e)},r.default=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../config":79,"../key":118,"../util":158,"node-localstorage":"node-localstorage","web-stream-tools":75}],125:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.loadScript=(e=>"undefined"!=typeof importScripts?importScripts(e):new Promise((t,r)=>{const n=document.createElement("script");n.src=e,n.onload=(()=>t()),n.onerror=(e=>r(new Error(e.message))),document.head.appendChild(n)})),r.dl=async function(e,t){return(await fetch(e,t)).arrayBuffer()}},{}],126:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Message=p,r.encryptSessionKey=y,r.createSignaturePackets=b,r.createVerificationObjects=m,r.readArmored=async function(e){const t=c.default.isStream(e);"node"===t&&(e=n.default.nodeToWeb(e));return g((await i.default.decode(e)).data,t)},r.read=g,r.fromText=function(e,t,r=new Date,i="utf8"){const a=c.default.isStream(e);"node"===a&&(e=n.default.nodeToWeb(e));const s=new f.default.Literal(r);s.setText(e,i),void 0!==t&&s.setFilename(t);const o=new f.default.List;o.push(s);const u=new p(o);return u.fromStream=a,u},r.fromBinary=function(e,t,r=new Date,i="binary"){const a=c.default.isStream(e);if(!c.default.isUint8Array(e)&&!a)throw new Error("Data must be in the form of a Uint8Array or Stream");"node"===a&&(e=n.default.nodeToWeb(e));const s=new f.default.Literal(r);s.setBytes(e,i),void 0!==t&&s.setFilename(t);const o=new f.default.List;o.push(s);const u=new p(o);return u.fromStream=a,u};var n=h(e("web-stream-tools")),i=h(e("./encoding/armor")),a=h(e("./type/keyid")),s=h(e("./config")),o=h(e("./crypto")),u=h(e("./enums")),c=h(e("./util")),f=h(e("./packet")),d=e("./signature"),l=e("./key");function h(e){return e&&e.__esModule?e:{default:e}}function p(e){if(!(this instanceof p))return new p(e);this.packets=e||new f.default.List}async function y(e,t,r,n,i,o=!1,u=new Date,c=[]){const d=new f.default.List;if(n){const r=await Promise.all(n.map(async function(r){const n=await r.getEncryptionKey(void 0,u,c),i=new f.default.PublicKeyEncryptedSessionKey;return i.publicKeyId=o?a.default.wildcard():n.getKeyId(),i.publicKeyAlgorithm=n.keyPacket.algorithm,i.sessionKey=e,i.sessionKeyAlgorithm=t,await i.encrypt(n.keyPacket),delete i.sessionKey,i}));d.concat(r)}if(i){const n=async function(e,t){try{return await e.decrypt(t),1}catch(r){return 0}},a=(e,t)=>e+t,o=async function e(t,r,o,u){const c=new f.default.SymEncryptedSessionKey;if(c.sessionKey=t,c.sessionKeyAlgorithm=r,o&&(c.aeadAlgorithm=o),await c.encrypt(u),s.default.password_collision_check){if(1!==(await Promise.all(i.map(e=>n(c,e)))).reduce(a))return e(t,r,u)}return delete c.sessionKey,c},u=await Promise.all(i.map(n=>o(e,t,r,n)));d.concat(u)}return new p(d)}async function b(e,t,r=null,n=new Date,i=[],a=!1,s=!1){const o=new f.default.List,c=null===e.text?u.default.signature.binary:u.default.signature.text;if(await Promise.all(t.map(async(t,r)=>{const o=i[r];if(t.isPublic())throw new Error("Need private key for signing");const u=await t.getSigningKey(void 0,n,o);return(0,l.createSignaturePacket)(e,t,u.keyPacket,{signatureType:c},n,o,a,s)})).then(e=>{e.forEach(e=>o.push(e))}),r){const e=r.packets.filterByTag(u.default.packet.signature);o.concat(e)}return o}async function m(e,t,r,n=new Date,i=!1,a=!1){return Promise.all(e.filter(function(e){return["text","binary"].includes(u.default.read(u.default.signature,e.signatureType))}).map(async function(e){return async function(e,t,r,n=new Date,i=!1,a=!1){let s=null,o=null;await Promise.all(r.map(async function(t){try{o=await t.getSigningKey(e.issuerKeyId,null),s=t}catch(r){}}));const u=e.correspondingSig||e,c={keyid:e.issuerKeyId,verified:(async()=>{if(!o)return null;const r=await e.verify(o.keyPacket,e.signatureType,t[0],i,a),c=await u;if(c.isExpired(n)||!(c.created>=o.getCreationTime()&&c.created{const e=await u,t=new f.default.List;return t.push(e),new d.Signature(t)})()};return c.signature.catch(()=>{}),c.verified.catch(()=>{}),c}(e,t,r,n,i,a)}))}async function g(e,t=c.default.isStream(e)){"node"===c.default.isStream(e)&&(e=n.default.nodeToWeb(e));const r=new f.default.List;await r.read(e,t);const i=new p(r);return i.fromStream=t,i}p.prototype.getEncryptionKeyIds=function(){const e=[];return this.packets.filterByTag(u.default.packet.publicKeyEncryptedSessionKey).forEach(function(t){e.push(t.publicKeyId)}),e},p.prototype.getSigningKeyIds=function(){const e=[],t=this.unwrapCompressed();if(t.packets.filterByTag(u.default.packet.onePassSignature).forEach(function(t){e.push(t.issuerKeyId)}),!e.length){t.packets.filterByTag(u.default.packet.signature).forEach(function(t){e.push(t.issuerKeyId)})}return e},p.prototype.decrypt=async function(e,t,r,i){const a=r||await this.decryptSessionKeys(e,t),s=this.packets.filterByTag(u.default.packet.symmetricallyEncrypted,u.default.packet.symEncryptedIntegrityProtected,u.default.packet.symEncryptedAEADProtected);if(0===s.length)return this;const o=s[0];let d=null;const l=Promise.all(a.map(async e=>{if(!e||!c.default.isUint8Array(e.data)||!c.default.isString(e.algorithm))throw new Error("Invalid session key for decryption.");try{await o.decrypt(e.algorithm,e.data,i)}catch(t){c.default.print_debug_error(t),d=t}}));if(n.default.cancel(o.encrypted),o.encrypted=null,await l,!o.packets||!o.packets.length)throw d||new Error("Decryption failed.");const h=new p(o.packets);return o.packets=new f.default.List,h},p.prototype.decryptSessionKeys=async function(e,t){let r,i=[];if(t){const e=this.packets.filterByTag(u.default.packet.symEncryptedSessionKey);if(!e)throw new Error("No symmetrically encrypted session key packet found.");await Promise.all(t.map(async function(t,r){let n;r?(n=new f.default.List,await n.read(e.write())):n=e,await Promise.all(n.map(async function(e){try{await e.decrypt(t),i.push(e)}catch(r){c.default.print_debug_error(r)}}))}))}else{if(!e)throw new Error("No key or password specified.");{const t=this.packets.filterByTag(u.default.packet.publicKeyEncryptedSessionKey);if(!t)throw new Error("No public key encrypted session key packet found.");await Promise.all(t.map(async function(t){await Promise.all(e.map(async function(e){let n=[u.default.symmetric.aes256,u.default.symmetric.aes128,u.default.symmetric.tripledes,u.default.symmetric.cast5];try{const t=await e.getPrimaryUser();t.selfCertification.preferredSymmetricAlgorithms&&(n=n.concat(t.selfCertification.preferredSymmetricAlgorithms))}catch(s){}const a=(await e.getDecryptionKeys(t.publicKeyId,null)).map(e=>e.keyPacket);await Promise.all(a.map(async function(e){if(e){if(!e.isDecrypted())throw new Error("Private key is not decrypted.");try{if(await t.decrypt(e),!n.includes(u.default.write(u.default.symmetric,t.sessionKeyAlgorithm)))throw new Error("A non-preferred symmetric algorithm was used.");i.push(t)}catch(a){c.default.print_debug_error(a),r=a}}}))})),n.default.cancel(t.encrypted),t.encrypted=null}))}}if(i.length){if(i.length>1){const e={};i=i.filter(function(t){const r=t.sessionKeyAlgorithm+c.default.Uint8Array_to_str(t.sessionKey);return!e.hasOwnProperty(r)&&(e[r]=!0,!0)})}return i.map(e=>({data:e.sessionKey,algorithm:e.sessionKeyAlgorithm}))}throw r||new Error("Session key decryption failed.")},p.prototype.getLiteralData=function(){const e=this.unwrapCompressed().packets.findPacket(u.default.packet.literal);return e&&e.getBytes()||null},p.prototype.getFilename=function(){const e=this.unwrapCompressed().packets.findPacket(u.default.packet.literal);return e&&e.getFilename()||null},p.prototype.getText=function(){const e=this.unwrapCompressed().packets.findPacket(u.default.packet.literal);return e?e.getText():null},p.prototype.encrypt=async function(e,t,r,n=!1,i=new Date,a=[],d){let h,p,b;if(r){if(!c.default.isUint8Array(r.data)||!c.default.isString(r.algorithm))throw new Error("Invalid session key for encryption.");h=r.algorithm,p=r.aeadAlgorithm,r=r.data}else if(e&&e.length)h=u.default.read(u.default.symmetric,await(0,l.getPreferredAlgo)("symmetric",e,i,a)),s.default.aead_protect&&await(0,l.isAeadSupported)(e,i,a)&&(p=u.default.read(u.default.aead,await(0,l.getPreferredAlgo)("aead",e,i,a)));else{if(!t||!t.length)throw new Error("No keys, passwords, or session key provided.");h=u.default.read(u.default.symmetric,s.default.encryption_cipher),p=u.default.read(u.default.aead,s.default.aead_mode)}r||(r=await o.default.generateSessionKey(h));const m=await y(r,h,p,e,t,n,i,a);return s.default.aead_protect&&p?(b=new f.default.SymEncryptedAEADProtected).aeadAlgorithm=p:b=s.default.integrity_protect?new f.default.SymEncryptedIntegrityProtected:new f.default.SymmetricallyEncrypted,b.packets=this.packets,await b.encrypt(h,r,d),m.packets.push(b),b.packets=new f.default.List,{message:m,sessionKey:{data:r,algorithm:h,aeadAlgorithm:p}}},p.prototype.sign=async function(e=[],t=null,r=new Date,n=[],i=!1){const a=new f.default.List,s=this.packets.findPacket(u.default.packet.literal);if(!s)throw new Error("No literal data packet to sign.");let o,c;const d=null===s.text?u.default.signature.binary:u.default.signature.text;if(t)for(o=(c=t.packets.filterByTag(u.default.packet.signature)).length-1;o>=0;o--){const t=c[o],r=new f.default.OnePassSignature;r.signatureType=t.signatureType,r.hashAlgorithm=t.hashAlgorithm,r.publicKeyAlgorithm=t.publicKeyAlgorithm,r.issuerKeyId=t.issuerKeyId,e.length||0!==o||(r.flags=1),a.push(r)}return await Promise.all(Array.from(e).reverse().map(async function(t,i){if(t.isPublic())throw new Error("Need private key for signing");const a=await t.getSigningKey(void 0,r,n),s=new f.default.OnePassSignature;return s.signatureType=d,s.hashAlgorithm=await(0,l.getPreferredHashAlgo)(t,a.keyPacket,r,n),s.publicKeyAlgorithm=a.keyPacket.algorithm,s.issuerKeyId=a.getKeyId(),i===e.length-1&&(s.flags=1),s})).then(e=>{e.forEach(e=>a.push(e))}),a.push(s),a.concat(await b(s,e,t,r,n,!1,i)),new p(a)},p.prototype.compress=function(e){if(e===u.default.compression.uncompressed)return this;const t=new f.default.Compressed;t.packets=this.packets,t.algorithm=u.default.read(u.default.compression,e);const r=new f.default.List;return r.push(t),new p(r)},p.prototype.signDetached=async function(e=[],t=null,r=new Date,n=[],i=!1){const a=this.packets.findPacket(u.default.packet.literal);if(!a)throw new Error("No literal data packet to sign.");return new d.Signature(await b(a,e,t,r,n,!0,i))},p.prototype.verify=async function(e,t=new Date,r){const i=this.unwrapCompressed(),a=i.packets.filterByTag(u.default.packet.literal);if(1!==a.length)throw new Error("Can only verify message with one literal data packet.");r||i.packets.concat(await n.default.readToEnd(i.packets.stream,e=>e));const s=i.packets.filterByTag(u.default.packet.onePassSignature).reverse(),o=i.packets.filterByTag(u.default.packet.signature);return r&&s.length&&!o.length&&i.packets.stream?(await Promise.all(s.map(async e=>{e.correspondingSig=new Promise((t,r)=>{e.correspondingSigResolve=t,e.correspondingSigReject=r}),e.signatureData=n.default.fromAsync(async()=>(await e.correspondingSig).signatureData),e.hashed=n.default.readToEnd(await e.hash(e.signatureType,a[0],void 0,!1,r)),e.hashed.catch(()=>{})})),i.packets.stream=n.default.transformPair(i.packets.stream,async(e,t)=>{const r=n.default.getReader(e),i=n.default.getWriter(t);try{for(let e=0;e{e.correspondingSigReject(a)}),await i.abort(a)}}),m(s,a,e,t,!1,r)):m(o,a,e,t,!1,r)},p.prototype.verifyDetached=function(e,t,r=new Date){const n=this.unwrapCompressed().packets.filterByTag(u.default.packet.literal);if(1!==n.length)throw new Error("Can only verify message with one literal data packet.");return m(e.packets,n,t,r,!0)},p.prototype.unwrapCompressed=function(){const e=this.packets.filterByTag(u.default.packet.compressed);return e.length?new p(e[0].packets):this},p.prototype.appendSignature=async function(e){await this.packets.read(c.default.isUint8Array(e)?e:(await i.default.decode(e)).data)},p.prototype.armor=function(){return i.default.encode(u.default.armor.message,this.packets.write())}},{"./config":79,"./crypto":94,"./encoding/armor":111,"./enums":113,"./key":118,"./packet":131,"./signature":151,"./type/keyid":154,"./util":158,"web-stream-tools":75}],127:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.initWorker=async function({path:e="openpgp.worker.min.js",n:r=1,workers:n=[]}={}){if(n.length||void 0!==t&&t.Worker&&t.MessageChannel){const t=new f.default({path:e,n:r,workers:n,config:o.default}),i=await t.loaded();if(i)return l=t,!0}return!1},r.getWorker=function(){return l},r.destroyWorker=async function(){const e=l;l=void 0,e&&(await e.clearKeyCache(),e.terminate())},r.generateKey=function({userIds:e=[],passphrase:t="",numBits:r=2048,rsaBits:n=r,keyExpirationTime:i=0,curve:a="",date:o=new Date,subkeys:u=[{}]}){const f={userIds:e=y(e),passphrase:t,rsaBits:n,keyExpirationTime:i,curve:a,date:o,subkeys:u};if(c.default.getWebCryptoAll()&&n<2048)throw new Error("rsaBits should be 2048 or 4096, found: "+n);if(!c.default.getWebCryptoAll()&&l)return l.delegate("generateKey",f);return(0,s.generate)(f).then(async e=>{const t=await e.getRevocationCertificate(o);return e.revocationSignatures=[],m({key:e,privateKeyArmored:e.armor(),publicKeyArmored:e.toPublic().armor(),revocationCertificate:t})}).catch(_.bind(null,"Error generating keypair"))},r.reformatKey=function({privateKey:e,userIds:t=[],passphrase:r="",keyExpirationTime:n=0,date:i}){t=y(t);const a={privateKey:e,userIds:t,passphrase:r,keyExpirationTime:n,date:i};if(l)return l.delegate("reformatKey",a);return(0,s.reformat)(a).then(async e=>{const t=await e.getRevocationCertificate(i);return e.revocationSignatures=[],m({key:e,privateKeyArmored:e.armor(),publicKeyArmored:e.toPublic().armor(),revocationCertificate:t})}).catch(_.bind(null,"Error reformatting keypair"))},r.revokeKey=function({key:e,revocationCertificate:t,reasonForRevocation:r}={}){const n={key:e,revocationCertificate:t,reasonForRevocation:r};if(!c.default.getWebCryptoAll()&&l)return l.delegate("revokeKey",n);return Promise.resolve().then(()=>t?e.applyRevocationCertificate(t):e.revoke(r)).then(async e=>{if(await m(e),e.isPrivate()){const t=e.toPublic();return{privateKey:e,privateKeyArmored:e.armor(),publicKey:t,publicKeyArmored:t.armor()}}return{publicKey:e,publicKeyArmored:e.armor()}}).catch(_.bind(null,"Error revoking key"))},r.decryptKey=function({privateKey:e,passphrase:t}){if(l)return l.delegate("decryptKey",{privateKey:e,passphrase:t});return Promise.resolve().then(async function(){return await e.decrypt(t),{key:e}}).catch(_.bind(null,"Error decrypting private key"))},r.encryptKey=function({privateKey:e,passphrase:t}){if(l)return l.delegate("encryptKey",{privateKey:e,passphrase:t});return Promise.resolve().then(async function(){return await e.encrypt(t),{key:e}}).catch(_.bind(null,"Error decrypting private key"))},r.encrypt=function({message:e,publicKeys:t,privateKeys:r,passwords:n,sessionKey:i,compression:a=o.default.compression,armor:s=!0,streaming:u=e&&e.fromStream,detached:c=!1,signature:f=null,returnSessionKey:d=!1,wildcard:p=!1,date:b=new Date,fromUserIds:g=[],toUserIds:w=[]}){if(h(e),t=y(t),r=y(r),n=y(n),g=y(g),w=y(w),!v()&&l)return l.delegate("encrypt",{message:e,publicKeys:t,privateKeys:r,passwords:n,sessionKey:i,compression:a,armor:s,streaming:u,detached:c,signature:f,returnSessionKey:d,wildcard:p,date:b,fromUserIds:g,toUserIds:w});const k={};return Promise.resolve().then(async function(){if(r||(r=[]),r.length||f)if(c){const t=await e.signDetached(r,f,b,g,e.fromStream);k.signature=s?t.armor():t}else e=await e.sign(r,f,b,g,e.fromStream);return(e=e.compress(a)).encrypt(t,n,i,p,b,w,u)}).then(async e=>(s?k.data=e.message.armor():k.message=e.message,d&&(k.sessionKey=e.sessionKey),m(k,u,s?["signature","data"]:[]))).catch(_.bind(null,"Error encrypting message"))},r.decrypt=function({message:e,privateKeys:t,passwords:r,sessionKeys:n,publicKeys:i,format:a="utf8",streaming:s=e&&e.fromStream,signature:o=null,date:u=new Date}){if(h(e),i=y(i),t=y(t),r=y(r),n=y(n),!v()&&l)return l.delegate("decrypt",{message:e,privateKeys:t,passwords:r,sessionKeys:n,publicKeys:i,format:a,streaming:s,signature:o,date:u});return e.decrypt(t,r,n,s).then(async function(t){i||(i=[]);const r={};return r.signatures=o?await t.verifyDetached(o,i,u,s):await t.verify(i,u,s),r.data="binary"===a?t.getLiteralData():t.getText(),r.filename=t.getFilename(),s&&g(r,e),r.data=await b(r.data,s),s||await w(r.signatures),r}).catch(_.bind(null,"Error decrypting message"))},r.sign=function({message:e,privateKeys:t,armor:r=!0,streaming:i=e&&e.fromStream,detached:a=!1,date:s=new Date,fromUserIds:o=[]}){if(p(e),t=y(t),o=y(o),l)return l.delegate("sign",{message:e,privateKeys:t,armor:r,streaming:i,detached:a,date:s,fromUserIds:o});const u={};return Promise.resolve().then(async function(){if(a){const i=await e.signDetached(t,void 0,s,o,e.fromStream);u.signature=r?i.armor():i,e.packets&&(u.signature=n.default.transformPair(e.packets.write(),async(e,t)=>{await Promise.all([n.default.pipe(u.signature,t),n.default.readToEnd(e).catch(()=>{})])}))}else e=await e.sign(t,void 0,s,o,e.fromStream),r?u.data=e.armor():u.message=e;return m(u,i,r?["signature","data"]:[])}).catch(_.bind(null,"Error signing cleartext message"))},r.verify=function({message:e,publicKeys:t,streaming:r=e&&e.fromStream,signature:n=null,date:i=new Date}){if(p(e),t=y(t),l)return l.delegate("verify",{message:e,publicKeys:t,streaming:r,signature:n,date:i});return Promise.resolve().then(async function(){const s={};return s.signatures=n?await e.verifyDetached(n,t,i,r):await e.verify(t,i,r),s.data=e instanceof a.CleartextMessage?e.getText():e.getLiteralData(),r&&g(s,e),s.data=await b(s.data,r),r||await w(s.signatures),s}).catch(_.bind(null,"Error verifying cleartext signed message"))},r.encryptSessionKey=function({data:e,algorithm:t,aeadAlgorithm:r,publicKeys:n,passwords:a,wildcard:s=!1,date:o=new Date,toUserIds:u=[]}){if(function(e,t){if(!c.default.isUint8Array(e))throw new Error("Parameter ["+(t||"data")+"] must be of type Uint8Array")}(e),function(e,t){if(!c.default.isString(e))throw new Error("Parameter ["+(t||"data")+"] must be of type String")}(t,"algorithm"),n=y(n),a=y(a),u=y(u),l)return l.delegate("encryptSessionKey",{data:e,algorithm:t,aeadAlgorithm:r,publicKeys:n,passwords:a,wildcard:s,date:o,toUserIds:u});return Promise.resolve().then(async function(){return{message:await i.encryptSessionKey(e,t,r,n,a,s,o,u)}}).catch(_.bind(null,"Error encrypting session key"))},r.decryptSessionKeys=function({message:e,privateKeys:t,passwords:r}){if(h(e),t=y(t),r=y(r),l)return l.delegate("decryptSessionKeys",{message:e,privateKeys:t,passwords:r});return Promise.resolve().then(async function(){return e.decryptSessionKeys(t,r)}).catch(_.bind(null,"Error decrypting session keys"))};var n=d(e("web-stream-tools")),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("./message")),a=e("./cleartext"),s=e("./key"),o=d(e("./config/config")),u=d(e("./enums"));e("./polyfills");var c=d(e("./util")),f=d(e("./worker/async_proxy"));function d(e){return e&&e.__esModule?e:{default:e}}let l;function h(e){if(!(e instanceof i.Message))throw new Error("Parameter [message] needs to be of type Message")}function p(e){if(!(e instanceof a.CleartextMessage||e instanceof i.Message))throw new Error("Parameter [message] needs to be of type Message or CleartextMessage")}function y(e){return e&&!c.default.isArray(e)&&(e=[e]),e}async function b(e,t){return!t&&c.default.isStream(e)?n.default.readToEnd(e):(t&&!c.default.isStream(e)&&(e=new ReadableStream({start(t){t.enqueue(e),t.close()}})),"node"===t&&(e=n.default.webToNode(e)),e)}async function m(e,t,r=[]){return Object.prototype.isPrototypeOf(e)&&!Uint8Array.prototype.isPrototypeOf(e)&&await Promise.all(Object.entries(e).map(async([n,i])=>{c.default.isStream(i)||r.includes(n)?e[n]=await b(i,t):await m(e[n],t)})),e}function g(e,t){e.data=n.default.transformPair(t.packets.stream,async(t,r)=>{await n.default.pipe(e.data,r)})}async function w(e){await Promise.all(e.map(async e=>{e.signature=await e.signature;try{e.valid=await e.verified}catch(t){e.valid=!1,e.error=t,c.default.print_debug_error(t)}}))}function _(e,t){c.default.print_debug_error(t);try{t.message=e+": "+t.message}catch(r){}throw t}function v(){return o.default.aead_protect&&(o.default.aead_mode===u.default.aead.eax||o.default.aead_mode===u.default.aead.experimental_gcm)&&c.default.getWebCrypto()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./cleartext":77,"./config/config":78,"./enums":113,"./key":118,"./message":126,"./polyfills":150,"./util":158,"./worker/async_proxy":160,"web-stream-tools":75}],128:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Trust=r.Signature=r.SecretSubkey=r.Userid=r.SecretKey=r.OnePassSignature=r.UserAttribute=r.PublicSubkey=r.Marker=r.SymmetricallyEncrypted=r.PublicKey=r.Literal=r.SymEncryptedSessionKey=r.PublicKeyEncryptedSessionKey=r.SymEncryptedAEADProtected=r.SymEncryptedIntegrityProtected=r.Compressed=void 0;var n=e("./compressed.js");Object.defineProperty(r,"Compressed",{enumerable:!0,get:function(){return k(n).default}});var i=e("./sym_encrypted_integrity_protected.js");Object.defineProperty(r,"SymEncryptedIntegrityProtected",{enumerable:!0,get:function(){return k(i).default}});var a=e("./sym_encrypted_aead_protected.js");Object.defineProperty(r,"SymEncryptedAEADProtected",{enumerable:!0,get:function(){return k(a).default}});var s=e("./public_key_encrypted_session_key.js");Object.defineProperty(r,"PublicKeyEncryptedSessionKey",{enumerable:!0,get:function(){return k(s).default}});var o=e("./sym_encrypted_session_key.js");Object.defineProperty(r,"SymEncryptedSessionKey",{enumerable:!0,get:function(){return k(o).default}});var u=e("./literal.js");Object.defineProperty(r,"Literal",{enumerable:!0,get:function(){return k(u).default}});var c=e("./public_key.js");Object.defineProperty(r,"PublicKey",{enumerable:!0,get:function(){return k(c).default}});var f=e("./symmetrically_encrypted.js");Object.defineProperty(r,"SymmetricallyEncrypted",{enumerable:!0,get:function(){return k(f).default}});var d=e("./marker.js");Object.defineProperty(r,"Marker",{enumerable:!0,get:function(){return k(d).default}});var l=e("./public_subkey.js");Object.defineProperty(r,"PublicSubkey",{enumerable:!0,get:function(){return k(l).default}});var h=e("./user_attribute.js");Object.defineProperty(r,"UserAttribute",{enumerable:!0,get:function(){return k(h).default}});var p=e("./one_pass_signature.js");Object.defineProperty(r,"OnePassSignature",{enumerable:!0,get:function(){return k(p).default}});var y=e("./secret_key.js");Object.defineProperty(r,"SecretKey",{enumerable:!0,get:function(){return k(y).default}});var b=e("./userid.js");Object.defineProperty(r,"Userid",{enumerable:!0,get:function(){return k(b).default}});var m=e("./secret_subkey.js");Object.defineProperty(r,"SecretSubkey",{enumerable:!0,get:function(){return k(m).default}});var g=e("./signature.js");Object.defineProperty(r,"Signature",{enumerable:!0,get:function(){return k(g).default}});var w=e("./trust.js");Object.defineProperty(r,"Trust",{enumerable:!0,get:function(){return k(w).default}}),r.newPacketFromTag=A,r.fromStructuredClone=function(e){const t=A(_.default.read(_.default.packet,e.tag));Object.assign(t,e),t.postCloneTypeFix&&t.postCloneTypeFix();return t};var _=k(e("../enums.js")),v=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("./all_packets.js"));function k(e){return e&&e.__esModule?e:{default:e}}function A(e){return new(v[function(e){return e.substr(0,1).toUpperCase()+e.substr(1)}(e)])}},{"../enums.js":113,"./all_packets.js":128,"./compressed.js":130,"./literal.js":132,"./marker.js":133,"./one_pass_signature.js":134,"./public_key.js":137,"./public_key_encrypted_session_key.js":138,"./public_subkey.js":139,"./secret_key.js":140,"./secret_subkey.js":141,"./signature.js":142,"./sym_encrypted_aead_protected.js":143,"./sym_encrypted_integrity_protected.js":144,"./sym_encrypted_session_key.js":145,"./symmetrically_encrypted.js":146,"./trust.js":147,"./user_attribute.js":148,"./userid.js":149}],129:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.clonePackets=function(e){e.publicKeys&&(e.publicKeys=e.publicKeys.map(e=>e.toPacketlist()));e.privateKeys&&(e.privateKeys=e.privateKeys.map(e=>e.toPacketlist()));e.publicKey&&(e.publicKey=e.publicKey.toPacketlist());e.privateKey&&(e.privateKey=e.privateKey.toPacketlist());e.key&&(e.key=e.key.toPacketlist());e.message&&(e.message instanceof a.Message?e.message={packets:e.message.packets,fromStream:e.message.fromStream}:e.message instanceof s.CleartextMessage&&(e.message={text:e.message.text,signature:e.message.signature.packets}));e.signature&&e.signature instanceof o.Signature&&(e.signature=e.signature.packets);e.signatures&&e.signatures.forEach(l);return e},r.parseClonedPackets=function(e){e.publicKeys&&(e.publicKeys=e.publicKeys.map(h));e.privateKeys&&(e.privateKeys=e.privateKeys.map(h));e.publicKey&&(e.publicKey=h(e.publicKey));e.privateKey&&(e.privateKey=h(e.privateKey));e.key&&(e.key=h(e.key));e.message&&e.message.signature?e.message=function(e){const t=u.default.fromStructuredClone(e.signature);return new s.CleartextMessage(e.text,new o.Signature(t))}(e.message):e.message&&(e.message=function(e){const t=u.default.fromStructuredClone(e.packets),r=new a.Message(t);return r.fromStream=e.fromStream,r}(e.message));e.signatures&&(e.signatures=e.signatures.map(p));e.signature&&(e.signature=function(e){if(f.default.isString(e)||f.default.isStream(e))return e;const t=u.default.fromStructuredClone(e);return new o.Signature(t)}(e.signature));return e};var n=d(e("web-stream-tools")),i=e("../key"),a=e("../message"),s=e("../cleartext"),o=e("../signature"),u=d(e("./packetlist")),c=d(e("../type/keyid")),f=d(e("../util"));function d(e){return e&&e.__esModule?e:{default:e}}function l(e){const t=e.verified;if(e.verified=n.default.fromAsync(()=>t),e.signature instanceof Promise){const r=e.signature;e.signature=n.default.fromAsync(async()=>{const e=(await r).packets;try{await t}catch(n){}return e&&e[0]&&(delete e[0].signature,delete e[0].hashed),e})}else e.signature=e.signature.packets;return e.error&&(e.error=e.error.message),e}function h(e){const t=u.default.fromStructuredClone(e);return new i.Key(t)}function p(e){return e.keyid=c.default.fromClone(e.keyid),f.default.isStream(e.signature)?(e.signature=n.default.readToEnd(e.signature,([e])=>new o.Signature(u.default.fromStructuredClone(e))),e.signature.catch(()=>{})):e.signature=new o.Signature(u.default.fromStructuredClone(e.signature)),e.verified=n.default.readToEnd(e.verified,([e])=>e),e.verified.catch(()=>{}),e.error&&(e.error=new Error(e.error)),e}},{"../cleartext":77,"../key":118,"../message":126,"../signature":151,"../type/keyid":154,"../util":158,"./packetlist":136,"web-stream-tools":75}],130:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=c(e("pako")),i=c(e("seek-bzip")),a=c(e("web-stream-tools")),s=c(e("../config")),o=c(e("../enums")),u=c(e("../util"));function c(e){return e&&e.__esModule?e:{default:e}}function f(){this.tag=o.default.packet.compressed,this.packets=null,this.algorithm="zip",this.compressed=null}f.prototype.read=async function(e,t){await a.default.parse(e,async e=>{this.algorithm=o.default.read(o.default.compression,await e.readByte()),this.compressed=e.remainder(),await this.decompress(t)})},f.prototype.write=function(){return null===this.compressed&&this.compress(),u.default.concat([new Uint8Array([o.default.write(o.default.compression,this.algorithm)]),this.compressed])},f.prototype.decompress=async function(e){if(!m[this.algorithm])throw new Error(this.algorithm+" decompression not supported");await this.packets.read(m[this.algorithm](this.compressed),e)},f.prototype.compress=function(){if(!b[this.algorithm])throw new Error(this.algorithm+" compression not supported");this.compressed=b[this.algorithm](this.packets.write())},r.default=f;const d=u.default.getNodeZlib();function l(e){return e}function h(e,t={}){return function(r){return a.default.nodeToWeb(a.default.webToNode(r).pipe(e(t)))}}function p(e,t={}){return function(r){const i=new e(t);return a.default.transform(r,e=>{if(e.length)return i.push(e,n.default.Z_SYNC_FLUSH),i.result},()=>{if(e===n.default.Deflate)return i.push([],n.default.Z_FINISH),i.result})}}function y(e){return function(t){return a.default.fromAsync(async()=>e(await a.default.readToEnd(t)))}}let b,m;d?(b={zip:h(d.createDeflateRaw,{level:s.default.deflate_level}),zlib:h(d.createDeflate,{level:s.default.deflate_level})},m={uncompressed:l,zip:h(d.createInflateRaw),zlib:h(d.createInflate),bzip2:y(i.default.decode)}):(b={zip:p(n.default.Deflate,{raw:!0,level:s.default.deflate_level}),zlib:p(n.default.Deflate,{level:s.default.deflate_level})},m={uncompressed:l,zip:p(n.default.Inflate,{raw:!0}),zlib:p(n.default.Inflate),bzip2:y(i.default.decode)})},{"../config":79,"../enums":113,"../util":158,pako:50,"seek-bzip":69,"web-stream-tools":75}],131:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=o(e("./all_packets")),a=o(e("./clone")),s=e("./packetlist");function o(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}const u={List:((n=s)&&n.__esModule?n:{default:n}).default,clone:a};Object.assign(u,i),r.default=u},{"./all_packets":128,"./clone":129,"./packetlist":136}],132:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=s(e("web-stream-tools")),i=s(e("../enums")),a=s(e("../util"));function s(e){return e&&e.__esModule?e:{default:e}}function o(e=new Date){this.tag=i.default.packet.literal,this.format="utf8",this.date=a.default.normalizeDate(e),this.text=null,this.data=null,this.filename="msg.txt"}o.prototype.setText=function(e,t="utf8"){this.format=t,this.text=e,this.data=null},o.prototype.getText=function(e=!1){return(null===this.text||a.default.isStream(this.text))&&(this.text=a.default.decode_utf8(a.default.nativeEOL(this.getBytes(e)))),this.text},o.prototype.setBytes=function(e,t){this.format=t,this.data=e,this.text=null},o.prototype.getBytes=function(e=!1){return null===this.data&&(this.data=a.default.canonicalizeEOL(a.default.encode_utf8(this.text))),e?n.default.passiveClone(this.data):this.data},o.prototype.setFilename=function(e){this.filename=e},o.prototype.getFilename=function(){return this.filename},o.prototype.read=async function(e){await n.default.parse(e,async e=>{const t=i.default.read(i.default.literal,await e.readByte()),r=await e.readByte();this.filename=a.default.decode_utf8(await e.readBytes(r)),this.date=a.default.readDate(await e.readBytes(4));const n=e.remainder();this.setBytes(n,t)})},o.prototype.writeHeader=function(){const e=a.default.encode_utf8(this.filename),t=new Uint8Array([e.length]),r=new Uint8Array([i.default.write(i.default.literal,this.format)]),n=a.default.writeDate(this.date);return a.default.concatUint8Array([r,t,e,n])},o.prototype.write=function(){const e=this.writeHeader(),t=this.getBytes();return a.default.concat([e,t])},r.default=o},{"../enums":113,"../util":158,"web-stream-tools":75}],133:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../enums"),a=(n=i)&&n.__esModule?n:{default:n};function s(){this.tag=a.default.packet.marker}s.prototype.read=function(e){return 80===e[0]&&71===e[1]&&80===e[2]},r.default=s},{"../enums":113}],134:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("web-stream-tools")),i=u(e("./signature")),a=u(e("../type/keyid")),s=u(e("../enums")),o=u(e("../util"));function u(e){return e&&e.__esModule?e:{default:e}}function c(){this.tag=s.default.packet.onePassSignature,this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.issuerKeyId=null,this.flags=null}c.prototype.read=function(e){let t=0;return this.version=e[t++],this.signatureType=e[t++],this.hashAlgorithm=e[t++],this.publicKeyAlgorithm=e[t++],this.issuerKeyId=new a.default,this.issuerKeyId.read(e.subarray(t,t+8)),t+=8,this.flags=e[t++],this},c.prototype.write=function(){const e=new Uint8Array([3,s.default.write(s.default.signature,this.signatureType),s.default.write(s.default.hash,this.hashAlgorithm),s.default.write(s.default.publicKey,this.publicKeyAlgorithm)]),t=new Uint8Array([this.flags]);return o.default.concatUint8Array([e,this.issuerKeyId.write(),t])},c.prototype.postCloneTypeFix=function(){this.issuerKeyId=a.default.fromClone(this.issuerKeyId)},c.prototype.hash=i.default.prototype.hash,c.prototype.toHash=i.default.prototype.toHash,c.prototype.toSign=i.default.prototype.toSign,c.prototype.calculateTrailer=function(...e){return n.default.fromAsync(async()=>i.default.prototype.calculateTrailer.apply(await this.correspondingSig,e))},c.prototype.verify=async function(){const e=await this.correspondingSig;if(!e||e.tag!==s.default.packet.signature)throw new Error("Corresponding signature packet missing");if(e.signatureType!==this.signatureType||e.hashAlgorithm!==this.hashAlgorithm||e.publicKeyAlgorithm!==this.publicKeyAlgorithm||!e.issuerKeyId.equals(this.issuerKeyId))throw new Error("Corresponding signature packet does not match one-pass signature packet");return e.hashed=this.hashed,e.verify.apply(e,arguments)},r.default=c},{"../enums":113,"../type/keyid":154,"../util":158,"./signature":142,"web-stream-tools":75}],135:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(u){i=!0,a=u}finally{try{!n&&o.return&&o.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=o(e("web-stream-tools")),a=o(e("../enums")),s=o(e("../util"));function o(e){return e&&e.__esModule?e:{default:e}}r.default={readSimpleLength:function(e){let t,r=0;const i=e[0];i<192?(r=n(e,1)[0],t=1):i<255?(r=(e[0]-192<<8)+e[1]+192,t=2):255===i&&(r=s.default.readNumber(e.subarray(1,5)),t=5);return{len:r,offset:t}},writeSimpleLength:function(e){return e<192?new Uint8Array([e]):e>191&&e<8384?new Uint8Array([192+(e-192>>8),e-192&255]):s.default.concatUint8Array([new Uint8Array([255]),s.default.writeNumber(e,4)])},writePartialLength:function(e){if(e<0||e>30)throw new Error("Partial Length power must be between 1 and 30");return new Uint8Array([224+e])},writeTag:function(e){return new Uint8Array([192|e])},writeHeader:function(e,t){return s.default.concatUint8Array([this.writeTag(e),this.writeSimpleLength(t)])},supportsStreaming:function(e){return[a.default.packet.literal,a.default.packet.compressed,a.default.packet.symmetricallyEncrypted,a.default.packet.symEncryptedIntegrityProtected,a.default.packet.symEncryptedAEADProtected].includes(e)},read:async function(e,t,r){const n=i.default.getReader(e);let a,o;try{const e=await n.peekBytes(2);if(!e||e.length<2||0==(128&e[0]))throw new Error("Error during parsing. This message / key probably does not conform to a valid OpenPGP format.");const f=await n.readByte();let d,l,h=-1,p=-1;p=0,0!=(64&f)&&(p=1),p?h=63&f:(h=(63&f)>>2,l=3&f);const y=this.supportsStreaming(h);let b,m=null;if(t&&y){const e=new TransformStream;a=i.default.getWriter(e.writable),o=r({tag:h,packet:m=e.readable})}else m=[];do{if(p){const e=await n.readByte();if(b=!1,e<192)d=e;else if(e>=192&&e<224)d=(e-192<<8)+await n.readByte()+192;else if(e>223&&e<255){if(d=1<<(31&e),b=!0,!y)throw new TypeError("This packet type does not support partial lengths.")}else d=await n.readByte()<<24|await n.readByte()<<16|await n.readByte()<<8|await n.readByte()}else switch(l){case 0:d=await n.readByte();break;case 1:d=await n.readByte()<<8|await n.readByte();break;case 2:d=await n.readByte()<<24|await n.readByte()<<16|await n.readByte()<<8|await n.readByte();break;default:d=1/0}if(d>0){let e=0;for(;;){a&&await a.ready;var u=await n.read();const t=u.done,r=u.value;if(t){if(d===1/0)break;throw new Error("Unexpected end of packet")}const i=d===1/0?r:r.subarray(0,d-e);if(a?await a.write(i):m.push(i),(e+=r.length)>=d){n.unshift(r.subarray(d-e+r.length));break}}}}while(b);const g=await n.peekBytes(y?1/0:2);return a?(await a.ready,await a.close()):(m=s.default.concatUint8Array(m),await r({tag:h,packet:m})),!g||!g.length}catch(c){if(a)return await a.abort(c),!0;throw c}finally{a&&await o,n.releaseLock()}}}},{"../enums":113,"../util":158,"web-stream-tools":75}],136:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=c(e("web-stream-tools")),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("./all_packets")),a=c(e("./packet")),s=c(e("../config")),o=c(e("../enums")),u=c(e("../util"));function c(e){return e&&e.__esModule?e:{default:e}}function f(){this.length=0}f.prototype=[],f.prototype.read=async function(e,t){this.stream=n.default.transformPair(e,async(e,r)=>{const c=n.default.getWriter(r);try{for(;;){if(await c.ready,await a.default.read(e,t,async e=>{try{const n=o.default.read(o.default.packet,e.tag),d=i.newPacketFromTag(n);d.packets=new f,d.fromStream=u.default.isStream(e.packet),await d.read(e.packet,t),await c.write(d)}catch(r){s.default.tolerant&&!a.default.supportsStreaming(e.tag)||await c.abort(r),u.default.print_debug_error(r)}}))return await c.ready,void(await c.close())}}catch(d){await c.abort(d)}});const r=n.default.getReader(this.stream);for(;;){var c=await r.read();const e=c.done,t=c.value;if(e?this.stream=null:this.push(t),e||a.default.supportsStreaming(t.tag))break}r.releaseLock()},f.prototype.write=function(){const e=[];for(let t=0;t{if(i.push(e),(s+=e.length)>=o){const e=Math.min(Math.log(s)/Math.LN2|0,30),t=2**e,r=u.default.concat([a.default.writePartialLength(e)].concat(i));return i=[r.subarray(1+t)],s=i[0].length,r.subarray(0,1+t)}},()=>u.default.concat([a.default.writeSimpleLength(s)].concat(i))))}else{if(u.default.isStream(r)){let i=0;e.push(n.default.transform(n.default.clone(r),e=>{i+=e.length},()=>a.default.writeHeader(this[t].tag,i)))}else e.push(a.default.writeHeader(this[t].tag,r.length));e.push(r)}}return u.default.concat(e)},f.prototype.push=function(e){e&&(e.packets=e.packets||new f,this[this.length]=e,this.length++)},f.prototype.filterByTag=function(...e){const t=new f,r=e=>t=>e===t;for(let n=0;nt.tag===e)},f.prototype.indexOfTag=function(...e){const t=[],r=this,n=e=>t=>e===t;for(let i=0;ii.fromStructuredClone(e))),t},r.default=f},{"../config":79,"../enums":113,"../util":158,"./all_packets":128,"./packet":135,"web-stream-tools":75}],137:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("asmcrypto.js/dist_es5/hash/sha1/sha1"),i=e("asmcrypto.js/dist_es5/hash/sha256/sha256"),a=d(e("../type/keyid")),s=d(e("../type/mpi")),o=d(e("../config")),u=d(e("../crypto")),c=d(e("../enums")),f=d(e("../util"));function d(e){return e&&e.__esModule?e:{default:e}}function l(e=new Date){this.tag=c.default.packet.publicKey,this.version=o.default.v5_keys?5:4,this.created=f.default.normalizeDate(e),this.algorithm=null,this.params=[],this.expirationTimeV3=0,this.fingerprint=null,this.keyid=null}l.prototype.read=function(e){let t=0;if(this.version=e[t++],4===this.version||5===this.version){this.created=f.default.readDate(e.subarray(t,t+4)),t+=4,this.algorithm=c.default.read(c.default.publicKey,e[t++]);const r=c.default.write(c.default.publicKey,this.algorithm);5===this.version&&(t+=4);const n=u.default.getPubKeyParamTypes(r);this.params=u.default.constructParams(n);for(let i=0;ie.length)throw new Error("Error reading MPI @:"+t);return t}throw new Error("Version "+this.version+" of the key packet is unsupported.")},l.prototype.readPublicKey=l.prototype.read,l.prototype.write=function(){const e=[];e.push(new Uint8Array([this.version])),e.push(f.default.writeDate(this.created));const t=c.default.write(c.default.publicKey,this.algorithm);e.push(new Uint8Array([t]));const r=u.default.getPubKeyParamTypes(t).length,n=f.default.concatUint8Array(this.params.slice(0,r).map(e=>e.write()));return 5===this.version&&e.push(f.default.writeNumber(n.length,4)),e.push(n),f.default.concatUint8Array(e)},l.prototype.writePublicKey=l.prototype.write,l.prototype.writeForHash=function(e){const t=this.writePublicKey();return 5===e?f.default.concatUint8Array([new Uint8Array([154]),f.default.writeNumber(t.length,4),t]):f.default.concatUint8Array([new Uint8Array([153]),f.default.writeNumber(t.length,2),t])},l.prototype.isDecrypted=function(){return null},l.prototype.getCreationTime=function(){return this.created},l.prototype.getKeyId=function(){return this.keyid?this.keyid:(this.keyid=new a.default,5===this.version?this.keyid.read(f.default.hex_to_Uint8Array(this.getFingerprint()).subarray(0,8)):4===this.version&&this.keyid.read(f.default.hex_to_Uint8Array(this.getFingerprint()).subarray(12,20)),this.keyid)},l.prototype.getFingerprintBytes=function(){if(this.fingerprint)return this.fingerprint;const e=this.writeForHash(this.version);return 5===this.version?this.fingerprint=i.Sha256.bytes(e):4===this.version&&(this.fingerprint=n.Sha1.bytes(e)),this.fingerprint},l.prototype.getFingerprint=function(){return f.default.Uint8Array_to_hex(this.getFingerprintBytes())},l.prototype.hasSameFingerprintAs=function(e){return this.version===e.version&&f.default.equalsUint8Array(this.writePublicKey(),e.writePublicKey())},l.prototype.getAlgorithmInfo=function(){const e={};return e.algorithm=this.algorithm,this.params[0]instanceof s.default?(e.rsaBits=8*this.params[0].byteLength(),e.bits=e.rsaBits):e.curve=this.params[0].getName(),e},l.prototype.postCloneTypeFix=function(){const e=c.default.write(c.default.publicKey,this.algorithm),t=u.default.getPubKeyParamTypes(e);for(let r=0;re.length)throw new Error("Error reading param @:"+a);return i}function l(e,t){const r=[],n=o.default.write(o.default.publicKey,t);for(let i=s.default.getPubKeyParamTypes(n).length;i{e.data.fill(0)}),this.params.length=t,this.isEncrypted=!0},f.prototype.postCloneTypeFix=function(){const e=o.default.write(o.default.publicKey,this.algorithm),t=[].concat(s.default.getPubKeyParamTypes(e),s.default.getPrivKeyParamTypes(e));for(let r=0;ro.default.signature.sign(s,f,p,l,await n.default.readToEnd(h));return i?this.signature=n.default.fromAsync(y):(this.signature=await y(),this.verified=!0),!0},l.prototype.write_hashed_sub_packets=function(){const e=u.default.signatureSubpacket,t=[];let r;null!==this.created&&t.push(h(e.signature_creation_time,c.default.writeDate(this.created))),null!==this.signatureExpirationTime&&t.push(h(e.signature_expiration_time,c.default.writeNumber(this.signatureExpirationTime,4))),null!==this.exportable&&t.push(h(e.exportable_certification,new Uint8Array([this.exportable?1:0]))),null!==this.trustLevel&&(r=new Uint8Array([this.trustLevel,this.trustAmount]),t.push(h(e.trust_signature,r))),null!==this.regularExpression&&t.push(h(e.regular_expression,this.regularExpression)),null!==this.revocable&&t.push(h(e.revocable,new Uint8Array([this.revocable?1:0]))),null!==this.keyExpirationTime&&t.push(h(e.key_expiration_time,c.default.writeNumber(this.keyExpirationTime,4))),null!==this.preferredSymmetricAlgorithms&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.preferredSymmetricAlgorithms)),t.push(h(e.preferred_symmetric_algorithms,r))),null!==this.revocationKeyClass&&(r=new Uint8Array([this.revocationKeyClass,this.revocationKeyAlgorithm]),r=c.default.concat([r,this.revocationKeyFingerprint]),t.push(h(e.revocation_key,r))),this.rawNotations.forEach(([{name:n,value:i,humanReadable:a}])=>{(r=[new Uint8Array([a?128:0,0,0,0])]).push(c.default.writeNumber(n.length,2)),r.push(c.default.writeNumber(i.length,2)),r.push(c.default.str_to_Uint8Array(n)),r.push(i),r=c.default.concat(r),t.push(h(e.notation_data,r))}),null!==this.preferredHashAlgorithms&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.preferredHashAlgorithms)),t.push(h(e.preferred_hash_algorithms,r))),null!==this.preferredCompressionAlgorithms&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.preferredCompressionAlgorithms)),t.push(h(e.preferred_compression_algorithms,r))),null!==this.keyServerPreferences&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.keyServerPreferences)),t.push(h(e.key_server_preferences,r))),null!==this.preferredKeyServer&&t.push(h(e.preferred_key_server,c.default.str_to_Uint8Array(this.preferredKeyServer))),null!==this.isPrimaryUserID&&t.push(h(e.primary_user_id,new Uint8Array([this.isPrimaryUserID?1:0]))),null!==this.policyURI&&t.push(h(e.policy_uri,c.default.str_to_Uint8Array(this.policyURI))),null!==this.keyFlags&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.keyFlags)),t.push(h(e.key_flags,r))),null!==this.signersUserId&&t.push(h(e.signers_user_id,c.default.str_to_Uint8Array(this.signersUserId))),null!==this.reasonForRevocationFlag&&(r=c.default.str_to_Uint8Array(String.fromCharCode(this.reasonForRevocationFlag)+this.reasonForRevocationString),t.push(h(e.reason_for_revocation,r))),null!==this.features&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.features)),t.push(h(e.features,r))),null!==this.signatureTargetPublicKeyAlgorithm&&((r=[new Uint8Array([this.signatureTargetPublicKeyAlgorithm,this.signatureTargetHashAlgorithm])]).push(c.default.str_to_Uint8Array(this.signatureTargetHash)),r=c.default.concat(r),t.push(h(e.signature_target,r))),null!==this.preferredAeadAlgorithms&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.preferredAeadAlgorithms)),t.push(h(e.preferred_aead_algorithms,r)));const n=c.default.concat(t),i=c.default.writeNumber(n.length,2);return c.default.concat([i,n])},l.prototype.write_unhashed_sub_packets=function(){const e=u.default.signatureSubpacket,t=[];let r;this.issuerKeyId.isNull()||5===this.issuerKeyVersion||t.push(h(e.issuer,this.issuerKeyId.write())),null!==this.embeddedSignature&&t.push(h(e.embedded_signature,this.embeddedSignature.write())),null!==this.issuerFingerprint&&(r=[new Uint8Array([this.issuerKeyVersion]),this.issuerFingerprint],r=c.default.concat(r),t.push(h(e.issuer_fingerprint,r))),this.unhashedSubpackets.forEach(e=>{t.push(i.default.writeSimpleLength(e.length)),t.push(e)});const n=c.default.concat(t),a=c.default.writeNumber(n.length,2);return c.default.concat([a,n])},l.prototype.read_sub_packet=function(e,t=!0){let r=0;const n=(e,t)=>{this[e]=[];for(let r=0;r{r+=e.length},()=>{const n=[];return 5!==this.version||this.signatureType!==u.default.signature.binary&&this.signatureType!==u.default.signature.text||(t?n.push(new Uint8Array(6)):n.push(e.writeHeader())),n.push(new Uint8Array([this.version,255])),5===this.version&&n.push(new Uint8Array(4)),n.push(c.default.writeNumber(r,4)),c.default.concat(n)})},l.prototype.toHash=function(e,t,r=!1){const n=this.toSign(e,t);return c.default.concat([n,this.signatureData,this.calculateTrailer(t,r)])},l.prototype.hash=async function(e,t,r,i=!1,a=!0){const s=u.default.write(u.default.hash,this.hashAlgorithm);return r||(r=this.toHash(e,t,i)),!a&&c.default.isStream(r)?n.default.fromAsync(async()=>this.hash(e,t,await n.default.readToEnd(r),i)):o.default.hash.digest(s,r)},l.prototype.verify=async function(e,t,r,i=!1,a=!1){const c=u.default.write(u.default.publicKey,this.publicKeyAlgorithm),d=u.default.write(u.default.hash,this.hashAlgorithm);if(c!==u.default.write(u.default.publicKey,e.algorithm))throw new Error("Public key algorithm used to sign signature does not match issuer key algorithm.");let l,h;if(this.hashed?h=await this.hashed:(l=this.toHash(t,r,i),a||(l=await n.default.readToEnd(l)),h=await this.hash(t,r,l)),h=await n.default.readToEnd(h),this.signedHashValue[0]!==h[0]||this.signedHashValue[1]!==h[1])throw new Error("Message digest did not match");let p=0;c>0&&c<4?p=1:c!==u.default.publicKey.dsa&&c!==u.default.publicKey.ecdsa&&c!==u.default.publicKey.eddsa||(p=2);const y=c===u.default.publicKey.eddsa?"le":"be",b=[];let m=0;this.signature=await n.default.readToEnd(this.signature);for(let n=0;n{if(await e.readByte()!==c)throw new Error("Invalid packet version.");this.cipherAlgo=await e.readByte(),this.aeadAlgo=await e.readByte(),this.chunkSizeByte=await e.readByte();const t=a.default[s.default.read(s.default.aead,this.aeadAlgo)];this.iv=await e.readBytes(t.ivLength),this.encrypted=e.remainder()})},f.prototype.write=function(){return o.default.concat([new Uint8Array([this.version,this.cipherAlgo,this.aeadAlgo,this.chunkSizeByte]),this.iv,this.encrypted])},f.prototype.decrypt=async function(e,t,r){return await this.packets.read(await this.crypt("decrypt",t,n.default.clone(this.encrypted),r),r),!0},f.prototype.encrypt=async function(e,t,r){this.cipherAlgo=s.default.write(s.default.symmetric,e),this.aeadAlgo=s.default.write(s.default.aead,this.aeadAlgorithm);const n=a.default[s.default.read(s.default.aead,this.aeadAlgo)];this.iv=await a.default.random.getRandomBytes(n.ivLength),this.chunkSizeByte=i.default.aead_chunk_size_byte;const o=this.packets.write();this.encrypted=await this.crypt("encrypt",t,o,r)},f.prototype.crypt=async function(e,t,r,i){const u=s.default.read(s.default.symmetric,this.cipherAlgo),c=a.default[s.default.read(s.default.aead,this.aeadAlgo)],f=await c(u,t),d="decrypt"===e?c.tagLength:0,l="encrypt"===e?c.tagLength:0,h=2**(this.chunkSizeByte+6)+d,p=new ArrayBuffer(21),y=new Uint8Array(p,0,13),b=new Uint8Array(p),m=new DataView(p),g=new Uint8Array(p,5,8);y.set([192|this.tag,this.version,this.cipherAlgo,this.aeadAlgo,this.chunkSizeByte],0);let w=0,_=Promise.resolve(),v=0,k=0;const A=this.iv;return n.default.transformPair(r,async(t,r)=>{const a=n.default.getReader(t),s=new TransformStream({},{highWaterMark:i?o.default.getHardwareConcurrency()*2**(this.chunkSizeByte+6):1/0,size:e=>e.length});n.default.pipe(s.readable,r);const u=n.default.getWriter(s.writable);try{for(;;){let t=await a.readBytes(h+d)||new Uint8Array;const r=t.subarray(t.length-d);let n,i;if(t=t.subarray(0,t.length-d),!w||t.length?(a.unshift(r),n=f[e](t,c.getNonce(A,g),y),k+=t.length-d+l):(m.setInt32(17,v),n=f[e](r,c.getNonce(A,g),b),k+=l,i=!0),v+=t.length-d,_=_.then(()=>n).then(async e=>{await u.ready,await u.write(e),k-=e.length}).catch(e=>u.abort(e)),(i||k>u.desiredSize)&&await _,i){await u.close();break}m.setInt32(9,++w)}}catch(p){await u.abort(p)}})}},{"../config":79,"../crypto":94,"../enums":113,"../util":158,"web-stream-tools":75}],144:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("web-stream-tools")),i=u(e("../config")),a=u(e("../crypto")),s=u(e("../enums")),o=u(e("../util"));function u(e){return e&&e.__esModule?e:{default:e}}const c=1;function f(){this.tag=s.default.packet.symEncryptedIntegrityProtected,this.version=c,this.encrypted=null,this.modification=!1,this.packets=null}f.prototype.read=async function(e){await n.default.parse(e,async e=>{if(await e.readByte()!==c)throw new Error("Invalid packet version.");this.encrypted=e.remainder()})},f.prototype.write=function(){return o.default.concat([new Uint8Array([c]),this.encrypted])},f.prototype.encrypt=async function(e,t,r){let i=this.packets.write();r||(i=await n.default.readToEnd(i));const s=await a.default.getPrefixRandom(e),u=new Uint8Array([211,20]),c=o.default.concat([s,i,u]),f=await a.default.hash.sha1(n.default.passiveClone(c)),d=o.default.concat([c,f]);return this.encrypted=await a.default.cfb.encrypt(e,t,d,new Uint8Array(a.default.cipher[e].blockSize)),!0},f.prototype.decrypt=async function(e,t,r){let s=n.default.clone(this.encrypted);r||(s=await n.default.readToEnd(s));const u=await a.default.cfb.decrypt(e,t,s,new Uint8Array(a.default.cipher[e].blockSize)),c=n.default.slice(n.default.passiveClone(u),-20),f=n.default.slice(u,0,-20),d=Promise.all([n.default.readToEnd(await a.default.hash.sha1(n.default.passiveClone(f))),n.default.readToEnd(c)]).then(([e,t])=>{if(!o.default.equalsUint8Array(e,t))throw new Error("Modification detected.");return new Uint8Array}),l=n.default.slice(f,a.default.cipher[e].blockSize+2);let h=n.default.slice(l,0,-2);return h=n.default.concat([h,n.default.fromAsync(()=>d)]),o.default.isStream(s)&&i.default.allow_unauthenticated_stream||(h=await n.default.readToEnd(h)),await this.packets.read(h,r),!0},r.default=f},{"../config":79,"../crypto":94,"../enums":113,"../util":158,"web-stream-tools":75}],145:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("../type/s2k")),i=u(e("../config")),a=u(e("../crypto")),s=u(e("../enums")),o=u(e("../util"));function u(e){return e&&e.__esModule?e:{default:e}}function c(){this.tag=s.default.packet.symEncryptedSessionKey,this.version=i.default.aead_protect?5:4,this.sessionKey=null,this.sessionKeyEncryptionAlgorithm=null,this.sessionKeyAlgorithm="aes256",this.aeadAlgorithm=s.default.read(s.default.aead,i.default.aead_mode),this.encrypted=null,this.s2k=null,this.iv=null}c.prototype.read=function(e){let t=0;this.version=e[t++];const r=s.default.read(s.default.symmetric,e[t++]);if(5===this.version&&(this.aeadAlgorithm=s.default.read(s.default.aead,e[t++])),this.s2k=new n.default,t+=this.s2k.read(e.subarray(t,e.length)),5===this.version){const r=a.default[this.aeadAlgorithm];this.iv=e.subarray(t,t+=r.ivLength)}5===this.version||t=1){const t=e[0];if(e.length>=1+t)return this.data=e.subarray(1,1+t),1+this.data.length}throw new Error("Invalid symmetric key")},s.prototype.write=function(){return a.default.concatUint8Array([new Uint8Array([this.data.length]),this.data])},s.fromClone=function(e){return new s(e.data)},r.default=s},{"../util":158}],153:[function(e,t,r){"use strict";function n(e){if(e){const t=e.hash,r=e.cipher;this.hash=t,this.cipher=r}else this.hash=null,this.cipher=null}Object.defineProperty(r,"__esModule",{value:!0}),n.prototype.read=function(e){if(e.length<4||3!==e[0]||1!==e[1])throw new Error("Cannot read KDFParams");return this.hash=e[2],this.cipher=e[3],4},n.prototype.write=function(){return new Uint8Array([3,1,this.hash,this.cipher])},n.fromClone=function(e){return new n({hash:e.hash,cipher:e.cipher})},r.default=n},{}],154:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../util.js"),a=(n=i)&&n.__esModule?n:{default:n};function s(){this.bytes=""}s.prototype.read=function(e){this.bytes=a.default.Uint8Array_to_str(e.subarray(0,8))},s.prototype.write=function(){return a.default.str_to_Uint8Array(this.bytes)},s.prototype.toHex=function(){return a.default.str_to_hex(this.bytes)},s.prototype.equals=function(e,t=!1){return t&&(e.isWildcard()||this.isWildcard())||this.bytes===e.bytes},s.prototype.isNull=function(){return""===this.bytes},s.prototype.isWildcard=function(){return/^0+$/.test(this.toHex())},s.mapToHex=function(e){return e.toHex()},s.fromClone=function(e){const t=new s;return t.bytes=e.bytes,t},s.fromId=function(e){const t=new s;return t.read(a.default.hex_to_Uint8Array(e)),t},s.wildcard=function(){const e=new s;return e.read(new Uint8Array(8)),e},r.default=s},{"../util.js":158}],155:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("bn.js")),i=a(e("../util"));function a(e){return e&&e.__esModule?e:{default:e}}function s(e){e instanceof s?this.data=e.data:n.default.isBN(e)?this.fromBN(e):i.default.isUint8Array(e)?this.fromUint8Array(e):i.default.isString(e)?this.fromString(e):this.data=null}s.prototype.read=function(e,t="be"){i.default.isString(e)&&(e=i.default.str_to_Uint8Array(e));const r=(e[0]<<8|e[1])+7>>>3,n=e.subarray(2,2+r);return this.fromUint8Array(n,t),2+r},s.prototype.write=function(e,t){return i.default.Uint8Array_to_MPI(this.toUint8Array(e,t))},s.prototype.bitLength=function(){return 8*(this.data.length-1)+i.default.nbits(this.data[0])},s.prototype.byteLength=function(){return this.data.length},s.prototype.toUint8Array=function(e,t){e=e||"be",t=t||this.data.length;const r=new Uint8Array(t),n="le"===e?0:t-this.data.length;return r.set(this.data,n),"le"===e&&r.reverse(),r},s.prototype.fromUint8Array=function(e,t="be"){this.data=new Uint8Array(e.length),this.data.set(e),"le"===t&&this.data.reverse()},s.prototype.toString=function(){return i.default.Uint8Array_to_str(this.toUint8Array())},s.prototype.fromString=function(e,t="be"){this.fromUint8Array(i.default.str_to_Uint8Array(e),t)},s.prototype.toBN=function(){return new n.default(this.toUint8Array())},s.prototype.fromBN=function(e){this.data=e.toArrayLike(Uint8Array)},s.fromClone=function(e){return new s(e.data)},r.default=s},{"../util":158,"bn.js":16}],156:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("../util")),i=a(e("../enums"));function a(e){return e&&e.__esModule?e:{default:e}}function s(e){if(e instanceof s)this.oid=e.oid;else if(n.default.isArray(e)||n.default.isUint8Array(e)){if(6===(e=new Uint8Array(e))[0]){if(e[1]!==e.length-2)throw new Error("Length mismatch in DER encoded oid");e=e.subarray(2)}this.oid=e}else this.oid=""}s.prototype.read=function(e){if(e.length>=1){const t=e[0];if(e.length>=1+t)return this.oid=e.subarray(1,1+t),1+this.oid.length}throw new Error("Invalid oid")},s.prototype.write=function(){return n.default.concatUint8Array([new Uint8Array([this.oid.length]),this.oid])},s.prototype.toHex=function(){return n.default.Uint8Array_to_hex(this.oid)},s.prototype.getName=function(){const e=this.toHex();if(i.default.curve[e])return i.default.write(i.default.curve,e);throw new Error("Unknown curve object identifier.")},s.fromClone=function(e){return new s(e.oid)},r.default=s},{"../enums":113,"../util":158}],157:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=o(e("../config")),i=o(e("../crypto")),a=o(e("../enums.js")),s=o(e("../util.js"));function o(e){return e&&e.__esModule?e:{default:e}}function u(){this.algorithm="sha256",this.type="iterated",this.c=n.default.s2k_iteration_count_byte,this.salt=null}u.prototype.get_count=function(){return 16+(15&this.c)<<6+(this.c>>4)},u.prototype.read=function(e){let t=0;switch(this.type=a.default.read(a.default.s2k,e[t++]),this.algorithm=e[t++],"gnu"!==this.type&&(this.algorithm=a.default.read(a.default.hash,this.algorithm)),this.type){case"simple":break;case"salted":this.salt=e.subarray(t,t+8),t+=8;break;case"iterated":this.salt=e.subarray(t,t+8),t+=8,this.c=e[t++];break;case"gnu":if("GNU"!==s.default.Uint8Array_to_str(e.subarray(t,t+3)))throw new Error("Unknown s2k type.");if(t+=3,1001!==1e3+e[t++])throw new Error("Unknown s2k gnu protection mode.");this.type="gnu-dummy";break;default:throw new Error("Unknown s2k type.")}return t},u.prototype.write=function(){if("gnu-dummy"===this.type)return new Uint8Array([101,0,...s.default.str_to_Uint8Array("GNU"),1]);const e=[new Uint8Array([a.default.write(a.default.s2k,this.type),a.default.write(a.default.hash,this.algorithm)])];switch(this.type){case"simple":break;case"salted":e.push(this.salt);break;case"iterated":e.push(this.salt),e.push(new Uint8Array([this.c]));break;case"gnu":throw new Error("GNU s2k type not supported.");default:throw new Error("Unknown s2k type.")}return s.default.concatUint8Array(e)},u.prototype.produce_key=async function(e,t){e=s.default.encode_utf8(e);const r=a.default.write(a.default.hash,this.algorithm),n=[];let o=0,u=0;for(;o{if(s.default.isStream(a))if(a.locked)e[n]=null;else{const r=i.default.transformPair(a,async a=>{const o=i.default.getReader(a);var u=new MessageChannel;const c=u.port1,f=u.port2;c.onmessage=async function({data:{action:e}}){if("read"===e)try{const e=await o.read();c.postMessage(e,s.default.getTransferables(e))}catch(t){c.postMessage({error:t.message})}else"cancel"===e&&(await r.cancel(),c.postMessage())},e[n]=f,t.push(f)})}else{if("[object MessagePort]"===Object.prototype.toString.call(a))throw new Error("Can't transfer the same stream twice.");s.default.collectTransferables(a,t,r)}}))},restoreStreams:function(e){return Object.prototype.isPrototypeOf(e)&&!Uint8Array.prototype.isPrototypeOf(e)&&Object.entries(e).forEach(([t,r])=>{"[object MessagePort]"!==Object.prototype.toString.call(r)?s.default.restoreStreams(r):e[t]=new ReadableStream({pull:e=>new Promise(t=>{r.onmessage=(r=>{var n=r.data;const i=n.done,a=n.value,s=n.error;s?e.error(new Error(s)):i?e.close():e.enqueue(a),t()}),r.postMessage({action:"read"})}),cancel:()=>new Promise(e=>{r.onmessage=e,r.postMessage({action:"cancel"})})},{highWaterMark:0})}),e},readNumber:function(e){let t=0;for(let r=0;r>8*(t-n-1)&255;return r},readDate:function(e){const t=s.default.readNumber(e);return new Date(1e3*t)},writeDate:function(e){const t=Math.floor(e.getTime()/1e3);return s.default.writeNumber(t,4)},normalizeDate:function(e=Date.now()){return null===e||e===1/0?e:new Date(1e3*Math.floor(+e/1e3))},str_to_hex:function(e){if(null===e)return"";const t=[],r=e.length;let n,i=0;for(;i>8,255&t]);return s.default.concatUint8Array([r,e])},b64_to_Uint8Array:function(e){return o.default.decode(e.replace(/-/g,"+").replace(/_/g,"/"))},Uint8Array_to_b64:function(e,t){let r=o.default.encode(e).replace(/[\r\n]/g,"");return t&&(r=r.replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")),r},hex_to_Uint8Array:function(e){const t=new Uint8Array(e.length>>1);for(let r=0;r>1;r++)t[r]=parseInt(e.substr(r<<1,2),16);return t},Uint8Array_to_hex:function(e){const t=[],r=e.length;let n,i=0;for(;i{if(!s.default.isString(e))throw new Error("str_to_Uint8Array: Data must be in the form of a string");const t=new Uint8Array(e.length);for(let r=0;rr("",!0))},decode_utf8:function(e){const t=new TextDecoder("utf-8");function r(e,r=!1){return t.decode(e,{stream:!r})}return i.default.transform(e,r,()=>r(new Uint8Array,!0))},concat:i.default.concat,concatUint8Array:i.default.concatUint8Array,equalsUint8Array:function(e,t){if(!s.default.isUint8Array(e)||!s.default.isUint8Array(t))throw new Error("Data must be in the form of a Uint8Array");if(e.length!==t.length)return!1;for(let r=0;r{console.log(e+": ",t)})},nbits:function(e){let t=1,r=e>>>16;return 0!==r&&(e=r,t+=16),0!==(r=e>>8)&&(e=r,t+=8),0!==(r=e>>4)&&(e=r,t+=4),0!==(r=e>>2)&&(e=r,t+=2),0!==(r=e>>1)&&(e=r,t+=1),t},double:function(e){const t=new Uint8Array(e.length),r=e.length-1;for(let n=0;n>7;return t[r]=e[r]<<1^135*(e[0]>>7),t},shiftRight:function(e,t){if(t)for(let r=e.length-1;r>=0;r--)e[r]>>=t,r>0&&(e[r]|=e[r-1]<<8-t);return e},getWebCrypto:function(){if(a.default.use_native)return void 0!==t&&t.crypto&&t.crypto.subtle},getWebCryptoAll:function(){if(a.default.use_native&&void 0!==t){if(t.crypto)return t.crypto.subtle||t.crypto.webkitSubtle;if(t.msCrypto)return t.msCrypto.subtle}},detectNode:function(){return"object"==typeof t.process&&"object"==typeof t.process.versions},nodeRequire:function(t){if(s.default.detectNode())return e(t)},getNodeCrypto:function(){if(a.default.use_native)return s.default.nodeRequire("crypto")},getNodeZlib:function(){if(a.default.use_native)return s.default.nodeRequire("zlib")},getNodeBuffer:function(){return(s.default.nodeRequire("buffer")||{}).Buffer},getNodeStream:function(){return(s.default.nodeRequire("stream")||{}).Readable},getHardwareConcurrency:function(){if(s.default.detectNode()){return s.default.nodeRequire("os").cpus().length}return navigator.hardwareConcurrency||1},isEmailAddress:function(e){if(!s.default.isString(e))return!1;return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}|xn--[a-zA-Z\-0-9]+)))$/.test(e)},formatUserId:function(e){if(e.name&&!s.default.isString(e.name)||e.email&&!s.default.isEmailAddress(e.email)||e.comment&&!s.default.isString(e.comment))throw new Error("Invalid user id format");const t=[];return e.name&&t.push(e.name),e.comment&&t.push(`(${e.comment})`),e.email&&t.push(`<${e.email}>`),t.join(" ")},parseUserId:function(e){if(e.length>a.default.max_userid_length)throw new Error("User id string is too long");try{var t=n.default.parseOneAddress({input:e,atInDisplayName:!0});return{name:t.name,email:t.address,comment:t.comments.replace(/^\(|\)$/g,"")}}catch(r){throw new Error("Invalid user id format")}},canonicalizeEOL:function(e){let t=!1;return i.default.transform(e,e=>{let r;t&&(e=s.default.concatUint8Array([new Uint8Array([13]),e])),13===e[e.length-1]?(t=!0,e=e.subarray(0,-1)):t=!1;const n=[];for(let t=0;r=e.indexOf(10,t)+1;t=r)13!==e[r-2]&&n.push(r);if(!n.length)return e;const i=new Uint8Array(e.length+n.length);let a=0;for(let t=0;tt?new Uint8Array([13]):void 0)},nativeEOL:function(e){let t=!1;return i.default.transform(e,e=>{let r;13===(e=t&&10!==e[0]?s.default.concatUint8Array([new Uint8Array([13]),e]):new Uint8Array(e))[e.length-1]?(t=!0,e=e.subarray(0,-1)):t=!1;let n=0;for(let t=0;t!==e.length;t=r){(r=e.indexOf(13,t)+1)||(r=e.length);const i=r-(10===e[r]?1:0);t&&e.copyWithin(n,t,i),n+=i-t}return e.subarray(0,n)},()=>t?new Uint8Array([13]):void 0)},removeTrailingSpaces:function(e){return e.split("\n").map(e=>{let t=e.length-1;for(;t>=0&&(" "===e[t]||"\t"===e[t]);t--);return e.substr(0,t+1)}).join("\n")},encodeZBase32:function(e){if(0===e.length)return"";let t=e[0],r=1,n=8,i="";for(;n>0||r>(n-=5)]}return i},wrapError:function(e,t){if(!t)return new Error(e);try{t.message=e+": "+t.message}catch(r){}return t}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./config":79,"./encoding/base64":112,"./util":158,"email-addresses":33,"web-stream-tools":75}],159:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(u){i=!0,a=u}finally{try{!n&&o.return&&o.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=o(e("./util")),a=o(e("./crypto")),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("./key"));function o(e){return e&&e.__esModule?e:{default:e}}function u(){this._fetch=void 0!==t?t.fetch:e("node-fetch")}u.prototype.lookup=async function(e){const t=this._fetch;if(!e.email)throw new Error("You must provide an email parameter!");if(!i.default.isEmailAddress(e.email))throw new Error("Invalid e-mail address.");var r=/(.*)@(.*)/.exec(e.email),o=n(r,3);const u=o[1],c=o[2],f=i.default.encodeZBase32(await a.default.hash.sha1(i.default.str_to_Uint8Array(u.toLowerCase()))),d=`https://openpgpkey.${c}/.well-known/openpgpkey/${c}/hu/${f}`,l=`https://${c}/.well-known/openpgpkey/hu/${f}`;let h;try{if(200!==(h=await t(d)).status)throw new Error("Advanced WKD lookup failed: "+h.statusText)}catch(y){if(i.default.print_debug_error(y),200!==(h=await t(l)).status)throw new Error("Direct WKD lookup failed: "+h.statusText)}const p=new Uint8Array(await h.arrayBuffer());return e.rawBytes?p:s.read(p)},r.default=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./crypto":94,"./key":118,"./util":158,"node-fetch":"node-fetch"}],160:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=o(e("../util.js")),i=o(e("../config")),a=o(e("../crypto")),s=o(e("../packet"));function o(e){return e&&e.__esModule?e:{default:e}}function u({path:e="openpgp.worker.min.js",n:t=1,workers:r=[],config:n}={}){const i=e=>t=>{const r=t.data;switch(r.event){case"loaded":this.workers[e].loadedResolve(!0);break;case"method-return":if(r.err){const e=new Error(r.err);e.workerStack=r.stack,this.tasks[r.id].reject(e)}else this.tasks[r.id].resolve(r.data);delete this.tasks[r.id],this.workers[e].requests--;break;case"request-seed":this.seedRandom(e,r.amount);break;default:throw new Error("Unknown Worker Event.")}};if(r.length)this.workers=r;else for(this.workers=[];this.workers.length{e.loadedPromise=new Promise(t=>{e.loadedResolve=t}),e.requests=0,e.onmessage=i(a++),e.onerror=(t=>(e.loadedResolve(!1),console.error("Unhandled error in openpgp worker: "+t.message+" ("+t.filename+":"+t.lineno+")"),!1)),n&&e.postMessage({event:"configure",config:n})}),this.tasks={},this.currentID=0}u.prototype.loaded=async function(){return(await Promise.all(this.workers.map(e=>e.loadedPromise))).every(Boolean)},u.prototype.getID=function(){return this.currentID++},u.prototype.seedRandom=async function(e,t){const r=await a.default.random.getRandomBytes(t);this.workers[e].postMessage({event:"seed-random",buf:r},n.default.getTransferables(r,!0))},u.prototype.clearKeyCache=async function(){await Promise.all(this.workers.map(e=>new Promise((t,r)=>{const n=this.getID();e.postMessage({id:n,event:"clear-key-cache"}),this.tasks[n]={resolve:t,reject:r}})))},u.prototype.terminate=function(){this.workers.forEach(e=>{e.terminate()})},u.prototype.delegate=function(e,t){const r=this.getID(),a=this.workers.map(e=>e.requests),o=Math.min(...a);let u=0;for(;u{this.workers[u].postMessage({id:r,event:e,options:s.default.clone.clonePackets(t)},n.default.getTransferables(t,i.default.zero_copy)),this.workers[u].requests++,this.tasks[r]={resolve:t=>a(s.default.clone.parseClonedPackets(n.default.restoreStreams(t),e)),reject:o}})},r.default=u},{"../config":79,"../crypto":94,"../packet":131,"../util.js":158}]},{},[115])(115)}); \ No newline at end of file diff --git a/src/assets/js/sync.js b/src/assets/js/sync.js deleted file mode 100644 index cf8461a..0000000 --- a/src/assets/js/sync.js +++ /dev/null @@ -1,30 +0,0 @@ -function sync_by_filter_block(block, count, buf, bloom_blocktx, result_callback) { - for (let j = 0; j < count; j++) { - let w = new DataView(buf); - w.setInt32(4, j); - const r = new Uint8Array(buf); - bloom_blocktx.check(r).then(function(ok) { - if (ok) { - // console.debug('match in block' + block + ' tx ' + j); - result_callback(block, j); - } - }); - } -} - -function sync_by_filter(caller, lo, hi, bloom_block, bloom_blocktx, tx_count_getter, result_callback) { - for (let i = lo; i <= hi; i++) { - let a = new ArrayBuffer(8); - let w = new DataView(a); - w.setInt32(0, i); - const r = new Uint8Array(a.slice(0, 4)); - bloom_block.check(r).then(function(ok) { - if (ok) { - // console.debug('match in block ' + i); - tx_count_getter(i).then(function(n) { - sync_by_filter_block(i, n, a, bloom_blocktx, result_callback); - }); - } - }); - } -} diff --git a/src/assets/js/web3.min.js b/src/assets/js/web3.min.js deleted file mode 100644 index 1bcdc7d..0000000 --- a/src/assets/js/web3.min.js +++ /dev/null @@ -1 +0,0 @@ -!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).Web3=e()}}(function(){var define,module,exports;return function o(a,s,u){function c(t,e){if(!s[t]){if(!a[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(f)return f(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[t]={exports:{}};a[t][0].call(i.exports,function(e){return c(a[t][1][e]||e)},i,i.exports,o,a,s,u)}return s[t].exports}for(var f="function"==typeof require&&require,e=0;e>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function l(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(4>=8)a++;(i=new c(2+a))[0]=o,i[1]=128|a;s=1+a;for(var u=n.length;0>=8)i[s]=255&u;return this._createEncoderBuffer([i,n])},s.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"!==t)return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)?this._createEncoderBuffer(e):"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported");for(var r=new c(2*e.length),n=0;n>=7)i++}var a=new c(i),s=a.length-1;for(n=e.length-1;0<=n;n--){o=e[n];for(a[s--]=127&o;0<(o>>=7);)a[s--]=128|127&o}return this._createEncoderBuffer(a)},s.prototype._encodeTime=function(e,t){var r,n=new Date(e);return"gentime"===t?r=[u(n.getFullYear()),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[u(n.getFullYear()%100),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!c.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new c(r)}if(c.isBuffer(e)){var n=e.length;0===e.length&&n++;var i=new c(n);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var o=e;256<=o;o>>=8)n++;for(o=(i=new Array(n)).length-1;0<=o;o--)i[o]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new c(i))},s.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},s.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},s.prototype._skipDefault=function(e,t,r){var n,i=this._baseState;if(null===i.default)return!1;var o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n>16&255,o[a++]=t>>8&255,o[a++]=255&t;var c,f;2===i&&(t=l[e.charCodeAt(u)]<<2|l[e.charCodeAt(u+1)]>>4,o[a++]=255&t);1===i&&(t=l[e.charCodeAt(u)]<<10|l[e.charCodeAt(u+1)]<<4|l[e.charCodeAt(u+2)]>>2,o[a++]=t>>8&255,o[a++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,a=r-n;o>2]+s[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"="));return i.join("")};for(var s=[],l=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},{}],20:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}var i;function o(e){this.rand=e}if(t.exports=function(e){return i||(i=new o(null)),i.generate(e)},(t.exports.Rand=o).prototype.generate=function(e){return this._rand(e)},o.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^f[p>>>16&255]^l[b>>>8&255]^h[255&y]^t[m++],a=c[p>>>24]^f[b>>>16&255]^l[y>>>8&255]^h[255&d]^t[m++],s=c[b>>>24]^f[y>>>16&255]^l[d>>>8&255]^h[255&p]^t[m++],u=c[y>>>24]^f[d>>>16&255]^l[p>>>8&255]^h[255&b]^t[m++],d=o,p=a,b=s,y=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&y])^t[m++],a=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[y>>>8&255]<<8|n[255&d])^t[m++],s=(n[b>>>24]<<24|n[y>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^t[m++],u=(n[y>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^t[m++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var l=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99;var f=e[n[r[a]=c]=a],l=e[f],h=e[l],d=257*e[c]^16843008*c;i[0][a]=d<<24|d>>>8,i[1][a]=d<<16|d>>>16,i[2][a]=d<<8|d>>>24,i[3][a]=d,d=16843009*h^65537*l^257*f^16843008*a,o[0][c]=d<<24|d>>>8,o[1][c]=d<<16|d>>>16,o[2][c]=d<<8|d>>>24,o[3][c]=d,0===a?a=s=1:(a=f^e[e[e[h^f]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function s(e){this._key=o(e),this._reset()}s.blockSize=16,s.keySize=32,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o>>24,a=h.SBOX[a>>>24]<<24|h.SBOX[a>>>16&255]<<16|h.SBOX[a>>>8&255]<<8|h.SBOX[255&a],a^=l[o/t|0]<<24):6>>24]<<24|h.SBOX[a>>>16&255]<<16|h.SBOX[a>>>8&255]<<8|h.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],u=0;u>>24]]^h.INV_SUB_MIX[1][h.SBOX[f>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[f>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&f]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=s},s.prototype.encryptBlockRaw=function(e){return a(e=o(e),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},s.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},s.prototype.decryptBlock=function(e){var t=(e=o(e))[1];e[1]=e[3],e[3]=t;var r=a(e,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),n=i.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},s.prototype.scrub=function(){n(this._keySchedule),n(this._invKeySchedule),n(this._key)},t.exports.AES=s},{"safe-buffer":153}],23:[function(e,t,r){"use strict";var a=e("./aes"),c=e("safe-buffer").Buffer,s=e("cipher-base"),n=e("inherits"),f=e("./ghash"),i=e("buffer-xor"),l=e("./incr32");function o(e,t,r,n){s.call(this);var i=c.alloc(4,0);this._cipher=new a.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new f(o),r=function(e,t,r){if(12===t.length)return e._finID=c.concat([t,c.from([0,0,0,1])]),c.concat([t,c.from([0,0,0,2])]);var n=new f(r),i=t.length,o=i%16;n.update(t),o&&(o=16-o,n.update(c.alloc(o,0))),n.update(c.alloc(8,0));var a=8*i,s=c.alloc(8);s.writeUIntBE(a,0,8),n.update(s),e._finID=n.state;var u=c.from(e._finID);return l(u),u}(this,r,o),this._prev=c.from(r),this._cache=c.allocUnsafe(0),this._secCache=c.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}n(o,s),o.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=c.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=i(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=a(i)},o.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=o},{"safe-buffer":153}],28:[function(e,t,r){"use strict";t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],29:[function(e,t,r){"use strict";var i=e("buffer-xor");r.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},{"buffer-xor":49}],30:[function(e,t,r){"use strict";var o=e("safe-buffer").Buffer,a=e("buffer-xor");function s(e,t,r){var n=t.length,i=a(t,e._cache);return e._cache=e._cache.slice(n),e._prev=o.concat([e._prev,r?t:i]),i}r.encrypt=function(e,t,r){for(var n,i=o.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=o.allocUnsafe(0)),!(e._cache.length<=t.length)){i=o.concat([i,s(e,t,r)]);break}n=e._cache.length,i=o.concat([i,s(e,t.slice(0,n),r)]),t=t.slice(n)}return i}},{"buffer-xor":49,"safe-buffer":153}],31:[function(e,t,r){"use strict";var a=e("safe-buffer").Buffer;function s(e,t,r){for(var n,i,o=-1,a=0;++o<8;)n=t&1<<7-o?128:0,a+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>o%8,e._prev=u(e._prev,r?n:i);return a}function u(e,t){var r=e.length,n=-1,i=a.allocUnsafe(e.length);for(e=a.concat([e,a.from([t])]);++n>7;return i}r.encrypt=function(e,t,r){for(var n=t.length,i=a.allocUnsafe(n),o=-1;++o=t)throw new Error("invalid sig")}t.exports=function(e,t,r,n,i){var o=b(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=y[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new p(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,i=r.data.q,o=r.data.g,a=r.data.pub_key,s=b.signature.decode(e,"der"),u=s.s,c=s.r;m(u,i),m(c,i);var f=d.mont(n),l=u.invm(i);return 0===o.toRed(f).redPow(new d(t).mul(l).mod(i)).fromRed().mul(a.toRed(f).redPow(c.mul(l).mod(i)).fromRed()).mod(n).mod(i).cmp(c)}(e,t,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");t=h.concat([i,t]);for(var a=o.modulus.byteLength(),s=[1],u=0;t.length+s.length+2>>1;case"base64":return C(e).length;default:if(i)return n?-1:B(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,a=1,s=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;s/=a=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var f=-1;for(o=r;o>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return g(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",t=P.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),""},l.prototype.compare=function(e,t,r,n,i){if(N(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+h(e));if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,a,s,u,c,f,l,h,d,p=!1;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return h=t,d=r,R(B(e,(l=this).length-h),l,h,d);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return u=this,c=t,f=r,R(C(e),u,c,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=t,s=r,R(function(e,t){for(var r,n,i,o=[],a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,(o=this).length-a),o,a,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function k(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;ie.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(e,t,r,n,i){return t=+t,r>>>=0,i||j(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function O(e,t,r,n,i){return t=+t,r>>>=0,i||j(e,0,r,8),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||x(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||x(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(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},l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(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},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;0<=--o&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(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},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(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},l.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return O(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return O(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function C(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(t,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function R(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function N(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function U(e){return e!=e}}).call(this,e("buffer").Buffer)},{"base64-js":19,buffer:50,ieee754:103}],51:[function(e,t,r){"use strict";t.exports={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",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent 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 Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",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 Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],52:[function(e,t,r){"use strict";var i=e("safe-buffer").Buffer,n=e("stream").Transform,o=e("string_decoder").StringDecoder;function a(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}e("inherits")(a,n),a.prototype.update=function(e,t,r){"string"==typeof e&&(e=i.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},t.exports=a},{inherits:104,"safe-buffer":153,stream:162,string_decoder:182}],53:[function(e,t,n){(function(e){"use strict";function t(e){return(t="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})(e)}function r(e){return Object.prototype.toString.call(e)}n.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},n.isBoolean=function(e){return"boolean"==typeof e},n.isNull=function(e){return null===e},n.isNullOrUndefined=function(e){return null==e},n.isNumber=function(e){return"number"==typeof e},n.isString=function(e){return"string"==typeof e},n.isSymbol=function(e){return"symbol"===t(e)},n.isUndefined=function(e){return void 0===e},n.isRegExp=function(e){return"[object RegExp]"===r(e)},n.isObject=function(e){return"object"===t(e)&&null!==e},n.isDate=function(e){return"[object Date]"===r(e)},n.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},n.isFunction=function(e){return"function"==typeof e},n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"===t(e)||void 0===e},n.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":105}],54:[function(e,s,t){(function(o){"use strict";var t=e("elliptic"),n=e("bn.js");s.exports=function(e){return new i(e)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function i(e){this.curveType=r[e],this.curveType||(this.curveType={name:e}),this.curve=new t.ec(this.curveType.name),this.keys=void 0}function a(e,t,r){Array.isArray(e)||(e=e.toArray());var n=new o(e);if(r&&n.lengthr)?t=("rmd160"===e?new u:c(e)).update(t).digest():t.length>>1];r=h.r28shl(r,o),n=h.r28shl(n,o),h.pc2(r,n,e.keys,i)}},u.prototype._update=function(e,t,r,n){var i=this._desState,o=h.readUInt32BE(e,t),a=h.readUInt32BE(e,t+4);h.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],h.writeUInt32BE(r,o,n),h.writeUInt32BE(r,a,n+4)},u.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,o=l}h.rip(a,o,n,i)},u.prototype._decrypt=function(e,t,r,n,i){for(var o=r,a=t,s=e.keys.length-2;0<=s;s-=2){var u=e.keys[s],c=e.keys[s+1];h.expand(o,e.tmp,0),u^=e.tmp[0],c^=e.tmp[1];var f=h.substitute(u,c),l=o;o=(a^h.permute(f))>>>0,a=l}h.rip(o,a,n,i)}},{"../des":60,inherits:104,"minimalistic-assert":109}],64:[function(e,t,r){"use strict";var o=e("minimalistic-assert"),n=e("inherits"),i=e("../des"),a=i.Cipher,s=i.DES;function u(e,t){o.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:n}),s.create({type:"encrypt",key:i})]:[s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:r})]}function c(e){a.call(this,e);var t=new u(this.type,this.options.key);this._edeState=t}n(c,a),(t.exports=c).create=function(e){return new c(e)},c.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},c.prototype._pad=s.prototype._pad,c.prototype._unpad=s.prototype._unpad},{"../des":60,inherits:104,"minimalistic-assert":109}],65:[function(e,t,r){"use strict";r.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,n){for(var i=0,o=0,a=6;0<=a;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;0<=a;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},r.rip=function(e,t,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;0<=s;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;0<=s;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.pc1=function(e,t,r,n){for(var i=0,o=0,a=7;5<=a;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.r28shl=function(e,t){return e<>>28-t};var u=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,n){for(var i=0,o=0,a=u.length>>>1,s=0;s>>u[s]&1;for(s=a;s>>u[s]&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.expand=function(e,t,r){var n=0,i=0;n=(1&e)<<5|e>>>27;for(var o=23;15<=o;o-=4)n<<=6,n|=e>>>o&63;for(o=11;3<=o;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(t>>>18-6*n&63)]}return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>n[r]&1;return t>>>0},r.padSplit=function(e,t,r){for(var n=e.toString(2);n.lengthe;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(c),t.cmp(c)){if(!t.cmp(f))for(;r.mod(l).cmp(h);)r.iadd(p)}else for(;r.mod(a).cmp(d);)r.iadd(p);if(y(n=r.shrn(1))&&y(r)&&m(n)&&m(r)&&s.test(n)&&s.test(r))return r}}},{"bn.js":"BN","miller-rabin":108,randombytes:135}],69:[function(e,t,r){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],70:[function(e,t,r){"use strict";var n=r;n.version=e("../package.json").version,n.utils=e("./elliptic/utils"),n.rand=e("brorand"),n.curve=e("./elliptic/curve"),n.curves=e("./elliptic/curves"),n.ec=e("./elliptic/ec"),n.eddsa=e("./elliptic/eddsa")},{"../package.json":85,"./elliptic/curve":73,"./elliptic/curves":76,"./elliptic/ec":77,"./elliptic/eddsa":80,"./elliptic/utils":84,brorand:20}],71:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../../elliptic").utils,E=i.getNAF,x=i.getJSF,l=i.assert;function o(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||0>1]):a.mixedAdd(i[-u-1>>1].neg()):0>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},o.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,a=this._wnafT2,s=this._wnafT3,u=0,c=0;c>1]:A<0&&(S=a[y][-A-1>>1].neg()),g="affine"===S.type?g.mixedAdd(S):g.add(S))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},f.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},f.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),u=i.redMul(a),c=o.redMul(s),f=i.redMul(s),l=a.redMul(o);return this.curve.point(u,c,l,f)},f.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(c=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),t=a.redMul(c.redSub(o)),r=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);e=n.redSub(i).redISub(o).redMul(u),t=a.redMul(c.redSub(o)),r=a.redMul(u)}}else{var c=i.redAdd(o);s=this.curve._mulC(this.z).redSqr(),u=c.redSub(s).redSub(s);e=this.curve._mulC(n.redISub(c)).redMul(u),t=this.curve._mulC(c).redMul(i.redISub(o)),r=c.redMul(u)}return this.curve.point(e,t,r)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},f.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(t),c=o.redMul(a),f=s.redMul(u),l=o.redMul(u),h=a.redMul(s);return this.curve.point(c,f,h,l)},f.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),l=n.redMul(u).redMul(f);return r=this.curve.twisted?(t=n.redMul(c).redMul(a.redSub(this.curve._mulA(o))),u.redMul(c)):(t=n.redMul(c).redMul(a.redSub(o)),this.curve._mulC(u).redMul(c)),this.curve.point(l,t,r)},f.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},f.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},f.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},f.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},f.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()},f.prototype.getY=function(){return this.normalize(),this.y.fromRed()},f.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},f.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),0<=r.cmp(this.curve.p))return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},f.prototype.toP=f.prototype.normalize,f.prototype.mixedAdd=f.prototype.add},{"../../elliptic":70,"../curve":73,"bn.js":"BN",inherits:104}],73:[function(e,t,r){"use strict";var n=r;n.base=e("./base"),n.short=e("./short"),n.mont=e("./mont"),n.edwards=e("./edwards")},{"./base":71,"./edwards":72,"./mont":74,"./short":75}],74:[function(e,t,r){"use strict";var n=e("../curve"),i=e("bn.js"),o=e("inherits"),a=n.base,s=e("../../elliptic").utils;function u(e){a.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(u,a),(t.exports=u).prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(c,a.BasePoint),u.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},u.prototype.point=function(e,t){return new c(this,e,t)},u.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;0<=o;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":70,"../curve":73,"bn.js":"BN",inherits:104}],75:[function(e,t,r){"use strict";var n=e("../curve"),i=e("../../elliptic"),_=e("bn.js"),o=e("inherits"),a=n.base,s=i.utils.assert;function u(e){a.call(this,"short",e),this.a=new _(e.a,16).toRed(this.red),this.b=new _(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(e,t,r,n){a.BasePoint.call(this,e,"affine"),this.inf=null===t&&null===r?(this.x=null,!(this.y=null)):(this.x=new _(t,16),this.y=new _(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),!1)}function f(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),this.z=null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,new _(0)):(this.x=new _(t,16),this.y=new _(r,16),new _(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(t.exports=u).prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new _(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new _(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new _(e.a,16),b:new _(e.b,16)}}):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:_.mont(e),r=new _(2).toRed(t).redInvm(),n=r.redNeg(),i=new _(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,a,s,u,c,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,h=this.n.clone(),d=new _(1),p=new _(0),b=new _(0),y=new _(1),m=0;0!==l.cmpn(0);){var v=h.div(l);u=h.sub(v.mul(l)),c=b.sub(v.mul(d));var g=y.sub(v.mul(p));if(!n&&u.cmp(f)<0)t=s.neg(),r=d,n=u.neg(),i=c;else if(n&&2==++m)break;h=l,l=s=u,b=d,d=c,y=p,p=g}o=u.neg(),a=c;var w=n.sqr().add(i.sqr());return 0<=o.sqr().add(a.sqr()).cmp(w)&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(e,t){(e=new _(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new _(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new f(this,e,t,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),f=c.redMul(s),l=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(l).redISub(l),d=u.redMul(l.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,d,p)},f.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),f=r.redMul(u),l=s.redSqr().redIAdd(c).redISub(f).redISub(f),h=s.redMul(f.redISub(l)).redISub(i.redMul(c)),d=this.z.redMul(a);return this.curve.jpoint(l,h,d)},f.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":70,"../curve":73,"bn.js":"BN",inherits:104}],76:[function(e,t,r){"use strict";var n,i=r,o=e("hash.js"),a=e("../elliptic"),s=a.utils.assert;function u(e){"short"===e.type?this.curve=new a.curve.short(e):"edwards"===e.type?this.curve=new a.curve.edwards(e):this.curve=new a.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,r){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var e=new u(r);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:e}),e}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"../elliptic":70,"./precomputed/secp256k1":83,"hash.js":89}],77:[function(e,t,r){"use strict";function y(e){return(y="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})(e)}var m=e("bn.js"),v=e("hmac-drbg"),o=e("../../elliptic"),d=o.utils.assert,n=e("./key"),g=e("./signature");function i(e){if(!(this instanceof i))return new i(e);"string"==typeof e&&(d(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}(t.exports=i).prototype.keyPair=function(e){return new n(this,e)},i.prototype.keyFromPrivate=function(e,t){return n.fromPrivate(this,e,t)},i.prototype.keyFromPublic=function(e,t){return n.fromPublic(this,e,t)},i.prototype.genKeyPair=function(e){e||(e={});for(var t=new v({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new m(2));;){var i=new m(t.generate(r));if(!(0>1;if(0<=a.cmp(this.curve.p.umod(this.curve.n))&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=t.r.invm(i),l=i.sub(o).mul(f).umod(i),h=s.mul(f).umod(i);return this.g.mulAdd(l,a,h)},i.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new g(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":70,"./key":78,"./signature":79,"bn.js":"BN","hmac-drbg":101}],78:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../../elliptic").utils.assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}(t.exports=o).fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},{"../../elliptic":70,"bn.js":"BN"}],79:[function(e,t,r){"use strict";var s=e("bn.js"),u=e("../../elliptic").utils,n=u.assert;function i(e,t){if(e instanceof i)return e;this._importDER(e,t)||(n(e.r&&e.s,"Signature without r or s"),this.r=new s(e.r,16),this.s=new s(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function c(){this.place=0}function f(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,a=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}(t.exports=i).prototype._importDER=function(e,t){e=u.toArray(e,t);var r=new c;if(48!==e[r.place++])return!1;if(f(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=f(e,r),i=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=f(e,r);if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===a[0]&&128&a[1]&&(a=a.slice(1)),this.r=new s(i),this.s=new s(a),!(this.recoveryParam=null)},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=a(t),r=a(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];l(n,t.length),(n=n.concat(t)).push(2),l(n,r.length);var i=n.concat(r),o=[48];return l(o,i.length),o=o.concat(i),u.encode(o,e)}},{"../../elliptic":70,"bn.js":"BN"}],80:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("../../elliptic"),o=i.utils,a=o.assert,u=o.parseBytes,s=e("./key"),c=e("./signature");function f(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}(t.exports=f).prototype.sign=function(e,t){e=u(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},f.prototype.verify=function(e,t,r){e=u(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t>1)-1>1)-a:a,i.isubn(o)}else o=0;r.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;ui){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,"object"===("undefined"==typeof console?"undefined":u(console))&&console.warn&&console.warn("%s: %s",s.name,s.message)}}else a=o[t]=r,++e._eventsCount;return e}function d(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t=this._blockSize;){for(var i=this._blockOffset;i=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":100}],100:[function(e,t,r){"use strict";var c=e("minimalistic-assert"),n=e("inherits");function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function a(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}r.inherits=n,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r,n,i=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),a=0;a>6|192:(n=a,55296!=(64512&(r=e).charCodeAt(n))||n<0||n+1>=r.length||56320!=(64512&r.charCodeAt(n+1))?i[o++]=s>>12|224:(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++a)),i[o++]=s>>18|240,i[o++]=s>>12&63|128),s>>6&63|128),63&s|128)}else for(a=0;a>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},r.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,o,a,s){var u=0,c=t;return u+=(c=c+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},r.sum64_5_hi=function(e,t,r,n,i,o,a,s,u,c){var f=0,l=t;return f+=(l=l+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(e,t,r,n,i,o,a,s,u,c){return t+n+o+s+c>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:104,"minimalistic-assert":109}],101:[function(e,t,r){"use strict";var n=e("hash.js"),a=e("minimalistic-crypto-utils"),i=e("minimalistic-assert");function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=a.toArray(e.entropy,e.entropyEnc||"hex"),r=a.toArray(e.nonce,e.nonceEnc||"hex"),n=a.toArray(e.pers,e.persEnc||"hex");i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}(t.exports=o).prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=a.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length>1,f=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=s;0>=-f,f+=n;0>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),2<=(t+=1<=a+l?h/u:h*Math.pow(2,1-l))*u&&(a++,u/=2),f<=a+l?(s=0,a=f):1<=a+l?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));8<=i;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<>>32-t}function c(e,t,r,n,i,o,a){return u(e+(t&r|~t&n)+i+o|0,a)+t|0}function f(e,t,r,n,i,o,a){return u(e+(t&n|r&~n)+i+o|0,a)+t|0}function l(e,t,r,n,i,o,a){return u(e+(t^r^n)+i+o|0,a)+t|0}function h(e,t,r,n,i,o,a){return u(e+(r^(t|~n))+i+o|0,a)+t|0}n(s,i),s.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;n=h(n=h(n=h(n=h(n=l(n=l(n=l(n=l(n=f(n=f(n=f(n=f(n=c(n=c(n=c(n=c(n,i=c(i,o=c(o,r=c(r,n,i,o,e[0],3614090360,7),n,i,e[1],3905402710,12),r,n,e[2],606105819,17),o,r,e[3],3250441966,22),i=c(i,o=c(o,r=c(r,n,i,o,e[4],4118548399,7),n,i,e[5],1200080426,12),r,n,e[6],2821735955,17),o,r,e[7],4249261313,22),i=c(i,o=c(o,r=c(r,n,i,o,e[8],1770035416,7),n,i,e[9],2336552879,12),r,n,e[10],4294925233,17),o,r,e[11],2304563134,22),i=c(i,o=c(o,r=c(r,n,i,o,e[12],1804603682,7),n,i,e[13],4254626195,12),r,n,e[14],2792965006,17),o,r,e[15],1236535329,22),i=f(i,o=f(o,r=f(r,n,i,o,e[1],4129170786,5),n,i,e[6],3225465664,9),r,n,e[11],643717713,14),o,r,e[0],3921069994,20),i=f(i,o=f(o,r=f(r,n,i,o,e[5],3593408605,5),n,i,e[10],38016083,9),r,n,e[15],3634488961,14),o,r,e[4],3889429448,20),i=f(i,o=f(o,r=f(r,n,i,o,e[9],568446438,5),n,i,e[14],3275163606,9),r,n,e[3],4107603335,14),o,r,e[8],1163531501,20),i=f(i,o=f(o,r=f(r,n,i,o,e[13],2850285829,5),n,i,e[2],4243563512,9),r,n,e[7],1735328473,14),o,r,e[12],2368359562,20),i=l(i,o=l(o,r=l(r,n,i,o,e[5],4294588738,4),n,i,e[8],2272392833,11),r,n,e[11],1839030562,16),o,r,e[14],4259657740,23),i=l(i,o=l(o,r=l(r,n,i,o,e[1],2763975236,4),n,i,e[4],1272893353,11),r,n,e[7],4139469664,16),o,r,e[10],3200236656,23),i=l(i,o=l(o,r=l(r,n,i,o,e[13],681279174,4),n,i,e[0],3936430074,11),r,n,e[3],3572445317,16),o,r,e[6],76029189,23),i=l(i,o=l(o,r=l(r,n,i,o,e[9],3654602809,4),n,i,e[12],3873151461,11),r,n,e[15],530742520,16),o,r,e[2],3299628645,23),i=h(i,o=h(o,r=h(r,n,i,o,e[0],4096336452,6),n,i,e[7],1126891415,10),r,n,e[14],2878612391,15),o,r,e[5],4237533241,21),i=h(i,o=h(o,r=h(r,n,i,o,e[12],1700485571,6),n,i,e[3],2399980690,10),r,n,e[10],4293915773,15),o,r,e[1],2240044497,21),i=h(i,o=h(o,r=h(r,n,i,o,e[8],1873313359,6),n,i,e[15],4264355552,10),r,n,e[6],2734768916,15),o,r,e[13],1309151649,21),i=h(i,o=h(o,r=h(r,n,i,o,e[4],4149444226,6),n,i,e[11],3174756917,10),r,n,e[2],718787259,15),o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,56>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},{}],111:[function(e,t,r){"use strict";var u=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,n,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;oo?t=i(t):t.lengtha||0<=new c(t).cmp(o.modulus))throw new Error("decryption error");i=r?p(new c(t),o):h(t,o);var s=b.alloc(a-i.length);if(i=b.concat([s,i],a),4===n)return function(e,t){var r=e.modulus.byteLength(),n=d("sha1").update(b.alloc(0)).digest(),i=n.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=l(o,f(a,i)),u=l(a,f(s,r-i-1));if(function(e,t){e=b.from(e),t=b.from(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i=t.length){o++;break}var a=t.slice(2,i-1);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")}},{"./mgf":126,"./withPublic":129,"./xor":130,"bn.js":"BN","browserify-rsa":42,"create-hash":55,"parse-asn1":117,"safe-buffer":153}],128:[function(e,t,r){"use strict";var a=e("parse-asn1"),h=e("randombytes"),d=e("create-hash"),p=e("./mgf"),b=e("./xor"),y=e("bn.js"),s=e("./withPublic"),u=e("browserify-rsa"),m=e("safe-buffer").Buffer;t.exports=function(e,t,r){var n;n=e.padding?e.padding:r?1:4;var i,o=a(e);if(4===n)i=function(e,t){var r=e.modulus.byteLength(),n=t.length,i=d("sha1").update(m.alloc(0)).digest(),o=i.length,a=2*o;if(r-a-2= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=v-g,A=Math.floor,E=String.fromCharCode;function x(e){throw new RangeError(l[e])}function d(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function p(e,t){var r=e.split("@"),n="";return 1>>10&1023|55296),e=56320|1023&e),t+=E(e)}).join("")}function I(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function O(e,t,r){var n=0;for(e=r?A(e/s):e>>1,e+=A(e/t);h*w>>1A((m-p)/a))&&x("overflow"),p+=u*a,!(u<(c=s<=y?g:y+w<=s?w:s-y));s+=v)a>A(m/(f=v-c))&&x("overflow"),a*=f;y=O(p-o,t=h.length+1,0==o),A(p/t)>m-b&&x("overflow"),b+=A(p/t),p%=t,h.splice(p++,0,b)}return j(h)}function y(e){var t,r,n,i,o,a,s,u,c,f,l,h,d,p,b,y=[];for(h=(e=M(e)).length,t=k,o=_,a=r=0;aA((m-r)/(d=n+1))&&x("overflow"),r+=(s-t)*d,t=s,a=0;am&&x("overflow"),l==t){for(u=r,c=v;!(u<(f=c<=o?g:o+w<=c?w:c-o));c+=v)b=u-f,p=v-f,y.push(E(I(f+b%p,0))),u=A(b/p);y.push(E(I(u,0))),o=O(r,d,n==i),r=0,++n}++r,++t}return y.join("")}if(i={version:"1.4.1",ucs2:{decode:M,encode:j},decode:b,encode:y,toASCII:function(e){return p(e,function(e){return c.test(e)?"xn--"+y(e):e})},toUnicode:function(e){return p(e,function(e){return u.test(e)?b(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==B(define.amd)&&define.amd)define("punycode",function(){return i});else if(t&&r)if(C.exports==t)r.exports=i;else for(o in i)i.hasOwnProperty(o)&&(t[o]=i[o]);else e.punycode=i}(void 0)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],132:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s,u,c=e.length;0t.highWaterMark&&(t.highWaterMark=(b<=(r=e)?r=b:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(w("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?m.nextTick(S,e):S(e))}function S(e){w("emit readable"),e.emit("readable"),j(e)}function A(e,t){t.readingMore||(t.readingMore=!0,m.nextTick(E,e,t))}function E(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=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;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r).data=o.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 o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n).data=o.slice(a);break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function O(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return w("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):k(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&O(this),null;var n,i=t.needReadable;return w("need readable",i),(0===t.length||t.length-e>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,t.copy(r,n),a+=o.data.length,o=o.next;return i},e}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":153,util:21}],144:[function(e,t,r){"use strict";var o=e("process-nextick-args");function a(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):!e||this._writableState&&this._writableState.errorEmitted||o.nextTick(a,this,e):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(o.nextTick(a,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this},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":123}],145:[function(e,t,r){"use strict";t.exports=e("events").EventEmitter},{events:86}],146:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.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}};function o(e){var t;switch(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&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=f,this.end=l,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(1>>32-t}function A(e,t,r,n,i,o,a,s){return S(e+(t^r^n)+o+a|0,s)+i|0}function E(e,t,r,n,i,o,a,s){return S(e+(t&r|~t&n)+o+a|0,s)+i|0}function x(e,t,r,n,i,o,a,s){return S(e+((t|~r)^n)+o+a|0,s)+i|0}function M(e,t,r,n,i,o,a,s){return S(e+(t&n|r&~n)+o+a|0,s)+i|0}function j(e,t,r,n,i,o,a,s){return S(e+(t^(r|~n))+o+a|0,s)+i|0}i(a,o),a.prototype._update=function(){for(var e=y,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,c=0|this._c,f=0|this._d,l=0|this._e,h=0;h<80;h+=1){var d,p;p=h<16?(d=A(r,n,i,o,a,e[m[h]],_[0],g[h]),j(s,u,c,f,l,e[v[h]],k[0],w[h])):h<32?(d=E(r,n,i,o,a,e[m[h]],_[1],g[h]),M(s,u,c,f,l,e[v[h]],k[1],w[h])):h<48?(d=x(r,n,i,o,a,e[m[h]],_[2],g[h]),x(s,u,c,f,l,e[v[h]],k[2],w[h])):h<64?(d=M(r,n,i,o,a,e[m[h]],_[3],g[h]),E(s,u,c,f,l,e[v[h]],k[3],w[h])):(d=j(r,n,i,o,a,e[m[h]],_[4],g[h]),A(s,u,c,f,l,e[v[h]],k[4],w[h])),r=a,a=o,o=S(i,10),i=n,n=d,s=l,l=f,f=S(c,10),c=u,u=p}var b=this._b+i+f|0;this._b=this._c+o+l|0,this._c=this._d+a+s|0,this._d=this._e+r+u|0,this._e=this._a+n+c|0,this._a=b},a.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},{"safe-buffer":153}],155:[function(e,t,r){"use strict";var n=t.exports=function(e){e=e.toLowerCase();var t=n[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};n.sha=e("./sha"),n.sha1=e("./sha1"),n.sha224=e("./sha224"),n.sha256=e("./sha256"),n.sha384=e("./sha384"),n.sha512=e("./sha512")},{"./sha":156,"./sha1":157,"./sha224":158,"./sha256":159,"./sha384":160,"./sha512":161}],156:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,m=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s=this._w,u=0|this._a,c=0|this._b,f=0|this._c,l=0|this._d,h=0|this._e,d=0;d<16;++d)s[d]=e.readInt32BE(4*d);for(;d<80;++d)s[d]=s[d-3]^s[d-8]^s[d-14]^s[d-16];for(var p=0;p<80;++p){var b=~~(p/20),y=0|((a=u)<<5|a>>>27)+(n=c,i=f,o=l,0===(r=b)?n&i|~n&o:2===r?n&i|n&o|i&o:n^i^o)+h+s[p]+m[b];h=l,l=f,f=(t=c)<<30|t>>>2,c=u,u=y}this._a=u+this._a|0,this._b=c+this._b|0,this._c=f+this._c|0,this._d=l+this._d|0,this._e=h+this._e|0},s.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=s},{"./hash":154,inherits:104,"safe-buffer":153}],157:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,v=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u=this._w,c=0|this._a,f=0|this._b,l=0|this._c,h=0|this._d,d=0|this._e,p=0;p<16;++p)u[p]=e.readInt32BE(4*p);for(;p<80;++p)u[p]=(t=u[p-3]^u[p-8]^u[p-14]^u[p-16])<<1|t>>>31;for(var b=0;b<80;++b){var y=~~(b/20),m=0|((s=c)<<5|s>>>27)+(i=f,o=l,a=h,0===(n=y)?i&o|~i&a:2===n?i&o|i&a|o&a:i^o^a)+d+u[b]+v[y];d=h,h=l,l=(r=f)<<30|r>>>2,f=c,c=m}this._a=c+this._a|0,this._b=f+this._b|0,this._c=l+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0},s.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=s},{"./hash":154,inherits:104,"safe-buffer":153}],158:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./sha256"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=u},{"./hash":154,"./sha256":159,inherits:104,"safe-buffer":153}],159:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function s(){this.init(),this._w=a,i.call(this,64,56)}n(s,i),s.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u=this._w,c=0|this._a,f=0|this._b,l=0|this._c,h=0|this._d,d=0|this._e,p=0|this._f,b=0|this._g,y=0|this._h,m=0;m<16;++m)u[m]=e.readInt32BE(4*m);for(;m<64;++m)u[m]=0|(((r=u[m-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)+u[m-7]+(((t=u[m-15])>>>7|t<<25)^(t>>>18|t<<14)^t>>>3)+u[m-16];for(var v=0;v<64;++v){var g=y+(((s=d)>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+((a=b)^d&(p^a))+_[v]+u[v]|0,w=0|(((o=c)>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+((n=c)&(i=f)|l&(n|i));y=b,b=p,p=d,d=h+g|0,h=l,l=f,f=c,c=g+w|0}this._a=c+this._a|0,this._b=f+this._b|0,this._c=l+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=y+this._h|0},s.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=s},{"./hash":154,inherits:104,"safe-buffer":153}],160:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./sha512"),o=e("./hash"),a=e("safe-buffer").Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var n=a.allocUnsafe(48);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),n},t.exports=u},{"./hash":154,"./sha512":161,inherits:104,"safe-buffer":153}],161:[function(e,t,r){"use strict";var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,ee=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function s(){this.init(),this._w=a,i.call(this,128,112)}function te(e,t,r){return r^e&(t^r)}function re(e,t,r){return e&t|r&(e|t)}function ne(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function ie(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function oe(e,t){return e>>>0>>0?1:0}n(s,i),s.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},s.prototype._update=function(e){for(var t,r,n,i,o,a,s,u,c=this._w,f=0|this._ah,l=0|this._bh,h=0|this._ch,d=0|this._dh,p=0|this._eh,b=0|this._fh,y=0|this._gh,m=0|this._hh,v=0|this._al,g=0|this._bl,w=0|this._cl,_=0|this._dl,k=0|this._el,S=0|this._fl,A=0|this._gl,E=0|this._hl,x=0;x<32;x+=2)c[x]=e.readInt32BE(4*x),c[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var M=c[x-30],j=c[x-30+1],I=((s=M)>>>1|(u=j)<<31)^(s>>>8|u<<24)^s>>>7,O=((o=j)>>>1|(a=M)<<31)^(o>>>8|a<<24)^(o>>>7|a<<25);M=c[x-4],j=c[x-4+1];var T=((n=M)>>>19|(i=j)<<13)^(i>>>29|n<<3)^n>>>6,B=((t=j)>>>19|(r=M)<<13)^(r>>>29|t<<3)^(t>>>6|r<<26),C=c[x-14],R=c[x-14+1],N=c[x-32],U=c[x-32+1],P=O+R|0,L=I+C+oe(P,O)|0;L=(L=L+T+oe(P=P+B|0,B)|0)+N+oe(P=P+U|0,U)|0,c[x]=L,c[x+1]=P}for(var F=0;F<160;F+=2){L=c[F],P=c[F+1];var D=re(f,l,h),q=re(v,g,w),z=ne(f,v),H=ne(v,f),K=ie(p,k),V=ie(k,p),W=ee[F],G=ee[F+1],Y=te(p,b,y),X=te(k,S,A),J=E+V|0,Z=m+K+oe(J,E)|0;Z=(Z=(Z=Z+Y+oe(J=J+X|0,X)|0)+W+oe(J=J+G|0,G)|0)+L+oe(J=J+P|0,P)|0;var $=H+q|0,Q=z+D+oe($,H)|0;m=y,E=A,y=b,A=S,b=p,S=k,p=d+Z+oe(k=_+J|0,_)|0,d=h,_=w,h=l,w=g,l=f,g=v,f=Z+Q+oe(v=J+$|0,J)|0}this._al=this._al+v|0,this._bl=this._bl+g|0,this._cl=this._cl+w|0,this._dl=this._dl+_|0,this._el=this._el+k|0,this._fl=this._fl+S|0,this._gl=this._gl+A|0,this._hl=this._hl+E|0,this._ah=this._ah+f+oe(this._al,v)|0,this._bh=this._bh+l+oe(this._bl,g)|0,this._ch=this._ch+h+oe(this._cl,w)|0,this._dh=this._dh+d+oe(this._dl,_)|0,this._eh=this._eh+p+oe(this._el,k)|0,this._fh=this._fh+b+oe(this._fl,S)|0,this._gh=this._gh+y+oe(this._gl,A)|0,this._hh=this._hh+m+oe(this._hl,E)|0},s.prototype._hash=function(){var n=o.allocUnsafe(64);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),n},t.exports=s},{"./hash":154,inherits:104,"safe-buffer":153}],162:[function(e,t,r){"use strict";t.exports=n;var f=e("events").EventEmitter;function n(){f.call(this)}e("inherits")(n,f),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).prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",i),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",s));var o=!1;function a(){o||(o=!0,t.end())}function s(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function u(e){if(c(),0===f.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",u),t.on("error",u),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:86,inherits:104,"readable-stream/duplex.js":137,"readable-stream/passthrough.js":147,"readable-stream/readable.js":148,"readable-stream/transform.js":149,"readable-stream/writable.js":150}],163:[function(r,e,i){(function(u){"use strict";var c=r("./lib/request"),e=r("./lib/response"),f=r("xtend"),t=r("builtin-status-codes"),l=r("url"),n=i;n.request=function(e,t){e="string"==typeof e?l.parse(e):f(e);var r=-1===u.location.protocol.search(/^https?:$/)?"http:":"",n=e.protocol||r,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new c(e);return t&&s.on("response",t),s},n.get=function(e,t){var r=n.request(e,t);return r.end(),r},n.ClientRequest=c,n.IncomingMessage=e.IncomingMessage,n.Agent=function(){},n.Agent.defaultMaxSockets=4,n.globalAgent=new n.Agent,n.STATUS_CODES=t,n.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":165,"./lib/response":166,"builtin-status-codes":51,url:185,xtend:189}],164:[function(e,t,o){(function(e){"use strict";var t;function r(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function n(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function i(e){return"function"==typeof e}o.fetch=i(e.fetch)&&i(e.ReadableStream),o.writableStream=i(e.WritableStream),o.abortController=i(e.AbortController),o.arraybuffer=o.fetch||n("arraybuffer"),o.msstream=!o.fetch&&n("ms-stream"),o.mozchunkedarraybuffer=!o.fetch&&n("moz-chunked-arraybuffer"),o.overrideMimeType=o.fetch||!!r()&&i(r().overrideMimeType),t=null}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],165:[function(o,h,e){(function(u,c,a){"use strict";var f=o("./capability"),e=o("inherits"),t=o("./response"),s=o("readable-stream"),r=t.IncomingMessage,l=t.readyStates;var n=h.exports=function(t){var e,r=this;s.Writable.call(r),r._opts=t,r._body=[],r._headers={},t.auth&&r.setHeader("Authorization","Basic "+a.from(t.auth).toString("base64")),Object.keys(t.headers).forEach(function(e){r.setHeader(e,t.headers[e])});var n,i,o=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!f.abortController)e=!(o=!1);else if("prefer-streaming"===t.mode)e=!1;else if("allow-wrong-content-type"===t.mode)e=!f.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");e=!0}r._mode=(n=e,i=o,f.fetch&&i?"fetch":f.mozchunkedarraybuffer?"moz-chunked-arraybuffer":f.msstream?"ms-stream":f.arraybuffer&&n?"arraybuffer":"text"),r._fetchTimer=null,r.on("finish",function(){r._onFinish()})};e(n,s.Writable),n.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===i.indexOf(r)&&(this._headers[r]={name:e,value:t})},n.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},n.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},n.prototype._onFinish=function(){var t=this;if(!t._destroyed){var e=t._opts,n=t._headers,r=null;"GET"!==e.method&&"HEAD"!==e.method&&(r=new Blob(t._body,{type:(n["content-type"]||{}).value||""}));var i=[];if(Object.keys(n).forEach(function(e){var t=n[e].name,r=n[e].value;Array.isArray(r)?r.forEach(function(e){i.push([t,e])}):i.push([t,r])}),"fetch"===t._mode){var o=null;if(f.abortController){var a=new AbortController;o=a.signal,t._fetchAbortController=a,"requestTimeout"in e&&0!==e.requestTimeout&&(t._fetchTimer=c.setTimeout(function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()},e.requestTimeout))}c.fetch(t._opts.url,{method:t._opts.method,headers:i,body:r||void 0,mode:"cors",credentials:e.withCredentials?"include":"same-origin",signal:o}).then(function(e){t._fetchResponse=e,t._connect()},function(e){c.clearTimeout(t._fetchTimer),t._destroyed||t.emit("error",e)})}else{var s=t._xhr=new c.XMLHttpRequest;try{s.open(t._opts.method,t._opts.url,!0)}catch(e){return void u.nextTick(function(){t.emit("error",e)})}"responseType"in s&&(s.responseType=t._mode),"withCredentials"in s&&(s.withCredentials=!!e.withCredentials),"text"===t._mode&&"overrideMimeType"in s&&s.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in e&&(s.timeout=e.requestTimeout,s.ontimeout=function(){t.emit("requestTimeout")}),i.forEach(function(e){s.setRequestHeader(e[0],e[1])}),t._response=null,s.onreadystatechange=function(){switch(s.readyState){case l.LOADING:case l.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(s.onprogress=function(){t._onXHRProgress()}),s.onerror=function(){t._destroyed||t.emit("error",new Error("XHR error"))};try{s.send(r)}catch(e){return void u.nextTick(function(){t.emit("error",e)})}}}},n.prototype._onXHRProgress=function(){(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},n.prototype._connect=function(){var t=this;t._destroyed||(t._response=new r(t._xhr,t._fetchResponse,t._mode,t._fetchTimer),t._response.on("error",function(e){t.emit("error",e)}),t.emit("response",t._response))},n.prototype._write=function(e,t,r){this._body.push(e),r()},n.prototype.abort=n.prototype.destroy=function(){this._destroyed=!0,c.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},n.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),s.Writable.prototype.end.call(this,e,t,r)},n.prototype.flushHeaders=function(){},n.prototype.setTimeout=function(){},n.prototype.setNoDelay=function(){},n.prototype.setSocketKeepAlive=function(){};var i=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this,o("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},o("buffer").Buffer)},{"./capability":164,"./response":166,_process:124,buffer:50,inherits:104,"readable-stream":181}],166:[function(r,e,n){(function(c,f,l){"use strict";var h=r("./capability"),e=r("inherits"),d=r("readable-stream"),s=n.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},t=n.IncomingMessage=function(e,t,r,n){var i=this;if(d.Readable.call(i),i._mode=r,i.headers={},i.rawHeaders=[],i.trailers={},i.rawTrailers=[],i.on("end",function(){c.nextTick(function(){i.emit("close")})}),"fetch"===r){if(i._fetchResponse=t,i.url=t.url,i.statusCode=t.status,i.statusMessage=t.statusText,t.headers.forEach(function(e,t){i.headers[t.toLowerCase()]=e,i.rawHeaders.push(t,e)}),h.writableStream){var o=new WritableStream({write:function(r){return new Promise(function(e,t){i._destroyed?t():i.push(l.from(r))?e():i._resumeFetch=e})},close:function(){f.clearTimeout(n),i._destroyed||i.push(null)},abort:function(e){i._destroyed||i.emit("error",e)}});try{return void t.body.pipeTo(o).catch(function(e){f.clearTimeout(n),i._destroyed||i.emit("error",e)})}catch(e){}}var a=t.body.getReader();!function t(){a.read().then(function(e){if(!i._destroyed){if(e.done)return f.clearTimeout(n),void i.push(null);i.push(l.from(e.value)),t()}}).catch(function(e){f.clearTimeout(n),i._destroyed||i.emit("error",e)})}()}else{if(i._xhr=e,i._pos=0,i.url=e.responseURL,i.statusCode=e.status,i.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===i.headers[r]&&(i.headers[r]=[]),i.headers[r].push(t[2])):void 0!==i.headers[r]?i.headers[r]+=", "+t[2]:i.headers[r]=t[2],i.rawHeaders.push(t[1],t[2])}}),i._charset="x-user-defined",!h.overrideMimeType){var s=i.rawHeaders["mime-type"];if(s){var u=s.match(/;\s*charset=([^;])(;|$)/);u&&(i._charset=u[1].toLowerCase())}i._charset||(i._charset="utf-8")}}};e(t,d.Readable),t.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},t.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case"text":if((r=t.responseText).length>e._pos){var n=r.substr(e._pos);if("x-user-defined"===e._charset){for(var i=l.alloc(n.length),o=0;oe._pos&&(e.push(l.from(new Uint8Array(a.result.slice(e._pos)))),e._pos=a.result.byteLength)},a.onload=function(){e.push(null)},a.readAsArrayBuffer(r)}e._xhr.readyState===s.DONE&&"ms-stream"!==e._mode&&e.push(null)}}).call(this,r("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r("buffer").Buffer)},{"./capability":164,_process:124,buffer:50,inherits:104,"readable-stream":181}],167:[function(e,t,r){"use strict";function p(e){return(p="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})(e)}var n={};function i(e,s,t){t||(t=Error);var r=function(a){var e,t;function r(e,t,r){return a.call(this,(n=e,i=t,o=r,"string"==typeof s?s:s(n,i,o)))||this;var n,i,o}return t=a,(e=r).prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t,r}(t);r.prototype.name=t.name,r.prototype.code=e,n[e]=r}function b(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(e){return String(e)}),2f.length)&&(h=f.length),f.substring(h-l.length,h)===l)a="The ".concat(e," ").concat(n," ").concat(b(t,"type"));else{var d=("number"!=typeof c&&(c=0),c+(u=".").length>(s=e).length||-1===s.indexOf(u,c)?"argument":"property");a='The "'.concat(e,'" ').concat(d," ").concat(n," ").concat(b(t,"type"))}return a+=". Received type ".concat(p(r))},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],168:[function(e,t,r){(function(r){"use strict";var n=new Set;t.exports.emitExperimentalWarning=r.emitWarning?function(e){if(!n.has(e)){var t=e+" is an experimental feature. This feature could change at any time";n.add(e),r.emitWarning(t,"ExperimentalWarning")}}:function(){}}).call(this,e("_process"))},{_process:124}],169:[function(f,l,e){(function(e){"use strict";var t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};l.exports=s;var r=f("./_stream_readable"),n=f("./_stream_writable");f("inherits")(s,r);for(var i=t(n.prototype),o=0;ot.highWaterMark&&(t.highWaterMark=(E<=(r=e)?r=E:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function M(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(m("emitReadable",t.flowing),t.emittedReadable=!0,b.nextTick(j,e))}function j(e){var t=e._readableState;m("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||e.emit("readable"),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,R(e)}function I(e,t){t.readingMore||(t.readingMore=!0,b.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function U(e){var t=e._readableState;m("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,b.nextTick(P,t,e))}function P(e,t){m("endReadableNT",e.endEmitted,e.length),e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var r=0,n=e.length;r=t.highWaterMark:0>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,s.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i},t.consume=function(e,t){var r;return ei.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0===(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t).data=i.slice(o);break}++r}return this.length-=r,n},t._getBuffer=function(e){var t=s.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r).data=i.slice(o);break}++n}return this.length-=n,t},t[i]=function(e,t){return n(this,function(i){for(var e=1;e",'"',"`"," ","\r","\n","\t"]),L=["'"].concat(i),F=["%","/","?",";","#"].concat(L),D=["/","?","#"],q=/^[+a-z0-9A-Z_-]{0,63}$/,z=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,H={javascript:!0,"javascript:":!0},K={javascript:!0,"javascript:":!0},V={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},W=e("querystring");function o(e,t,r){if(e&&N.isObject(e)&&e instanceof M)return e;var n=new M;return n.parse(e,t,r),n}M.prototype.parse=function(e,t,r){if(!N.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+C(e));var n=e.indexOf("?"),i=-1!==n&&n>6|192);else{if(55295>18|240),r+=t(i>>12&63|128)}else r+=t(i>>12|224);r+=t(i>>6&63|128)}r+=t(63&i|128)}}return r},toString:function(e){for(var t="",r=0,n=a(e);r>10|55296),t+=String.fromCharCode(1023&i|56320)}}return t},fromNumber:function(e){var t=e.toString(16);return t.length%2==0?"0x"+t:"0x0"+t},toNumber:function(e){return parseInt(e.slice(2),16)},fromNat:function(e){return"0x0"===e?"0x":e.length%2==0?e:"0x0"+e.slice(2)},toNat:function(e){return"0"===e[2]?"0x"+e.slice(3):e},fromArray:n,toArray:r,fromUint8Array:function(e){return n([].slice.call(e,0))},toUint8Array:function(e){return new Uint8Array(r(e))}}},{"./array.js":191}],193:[function(e,t,r){"use strict";var p="0123456789abcdef".split(""),b=[1,256,65536,16777216],y=[0,8,16,24],fe=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=function(e){var t,r,n,i,o,a,s,u,c,f,l,h,d,p,b,y,m,v,g,w,_,k,S,A,E,x,M,j,I,O,T,B,C,R,N,U,P,L,F,D,q,z,H,K,V,W,G,Y,X,J,Z,$,Q,ee,te,re,ne,ie,oe,ae,se,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|l>>>31),r=s^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(h<<1|d>>>31),r=c^(d<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,N=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,U=e[14]<<6|e[15]>>>26,P=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,C=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,E=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,M=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=b^~m&g,e[10]=A^~x&j,e[11]=E^~M&I,e[20]=R^~U&L,e[21]=N^~P&F,e[30]=K^~W&Y,e[31]=V^~G&X,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=y^~v&w,e[3]=m^~g&_,e[12]=x^~j&O,e[13]=M^~I&T,e[22]=U^~L&D,e[23]=P^~F&q,e[32]=W^~Y&J,e[33]=G^~X&Z,e[42]=re^~ie&ae,e[43]=ne^~oe&se,e[4]=v^~w&k,e[5]=g^~_&S,e[14]=j^~O&B,e[15]=I^~T&C,e[24]=L^~D&z,e[25]=F^~q&H,e[34]=Y^~J&$,e[35]=X^~Z&Q,e[44]=ie^~ae&ue,e[45]=oe^~se&ce,e[6]=w^~k&p,e[7]=_^~S&b,e[16]=O^~B&A,e[17]=T^~C&E,e[26]=D^~z&R,e[27]=q^~H&N,e[36]=J^~$&K,e[37]=Z^~Q&V,e[46]=ae^~ue&ee,e[47]=se^~ce&te,e[8]=k^~p&y,e[9]=S^~b&m,e[18]=B^~A&x,e[19]=C^~E&M,e[28]=z^~R&U,e[29]=H^~N&P,e[38]=$^~K&W,e[39]=Q^~V&G,e[48]=ue^~ee&re,e[49]=ce^~te&ne,e[0]^=fe[n],e[1]^=fe[n+1]},n=function(a){return function(e){var t,r,n;if("0x"===e.slice(0,2)){t=[];for(var i=2,o=e.length;i>2]|=t[c]<>2]|=r<>2]|=(192|r>>6)<>2]|=(224|r>>12)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=b[3&h],e.lastByteIndex===o)for(i[0]=i[a],h=1;h>4&15]+p[15&f]+p[f>>12&15]+p[f>>8&15]+p[f>>20&15]+p[f>>16&15]+p[f>>28&15]+p[f>>24&15];d%a==0&&(m(u),h=0)}return"0x"+l}({blocks:[],reset:!0,block:0,start:0,blockCount:1600-((r=a)<<1)>>5,outputBlocks:r>>5,s:(n=[0,0,0,0,0,0,0,0,0,0],[].concat(n,n,n,n,n))},t)}};t.exports={keccak256:n(256),keccak512:n(512),keccak256s:n(256),keccak512s:n(512)}},{}],194:[function(e,r,t){(function(e){"use strict";var t;t="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},r.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],195:[function(e,t,r){"use strict";t.exports=function(e){var t=n.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var n=Object.prototype.toString},{}],196:[function(e,t,r){arguments[4][111][0].apply(r,arguments)},{dup:111}],197:[function(e,t,r){"use strict";var c=function(e){return e.replace(/^\s+|\s+$/g,"")};t.exports=function(e){if(!e)return{};for(var t,r={},n=c(e).split("\n"),i=0;i":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],205:[function(e,t,r){"use strict";t.exports=function(e,t){if(t){t=(t=t.trim().replace(/^(\?|#|&)/,""))?"?"+t:t;var r=e.split(/[\?\#]/),n=r[0];t&&/\:\/\/[^\/]*$/.test(n)&&(n+="/");var i=e.match(/(\#.*)$/);e=n+t,i&&(e+=i[0])}return e}},{}],206:[function(e,t,r){"use strict";var s=e("query-string"),u=e("url-set-query"),c=e("object-assign"),f=e("./lib/ensure-header.js"),l=e("./lib/request.js"),h="application/json",d=function(){};t.exports=function(e,t,r){if(!e||"string"!=typeof e)throw new TypeError("must specify a URL");"function"==typeof t&&(r=t,t={});if(r&&"function"!=typeof r)throw new TypeError("expected cb to be undefined or a function");r=r||d;var n=(t=t||{}).json?"json":"text",i=(t=c({responseType:n},t)).headers||{},o=(t.method||"GET").toUpperCase(),a=t.query;a&&("string"!=typeof a&&(a=s.stringify(a)),e=u(e,a));"json"===t.responseType&&f(i,"Accept",h);t.json&&"GET"!==o&&"HEAD"!==o&&(f(i,"Content-Type",h),t.body=JSON.stringify(t.body));return t.method=o,t.url=e,t.headers=i,delete t.query,delete t.json,l(t,r)}},{"./lib/ensure-header.js":207,"./lib/request.js":209,"object-assign":196,"query-string":198,"url-set-query":205}],207:[function(e,t,r){"use strict";t.exports=function(e,t,r){var n=t.toLowerCase();e[t]||e[n]||(e[t]=r)}},{}],208:[function(e,t,r){"use strict";t.exports=function(e,t){return t?{statusCode:t.statusCode,headers:t.headers,method:e.method,url:e.url,rawRequest:t.rawRequest?t.rawRequest:t}:null}},{}],209:[function(e,t,r){"use strict";var n=e("xhr"),s=e("./normalize-response"),u=function(){};t.exports=function(i,o){delete i.uri;var a=!1;"json"===i.responseType&&(i.responseType="text",a=!0);var t=n(i,function(t,e,r){if(a&&!t)try{var n=e.rawRequest.responseText;r=JSON.parse(n)}catch(e){t=e}e=s(i,e),o(t,t?null:r,e),o=u}),r=t.onabort;return t.onabort=function(){var e=r.apply(t,Array.prototype.slice.call(arguments));return o(new Error("XHR Aborted")),o=u,e},t}},{"./normalize-response":208,xhr:210}],210:[function(e,t,r){"use strict";var n=e("global/window"),i=e("is-function"),y=e("parse-headers"),o=e("xtend");function a(e,t,r){var n=e;return i(t)?(r=t,"string"==typeof e&&(n={uri:e})):n=o(t,{uri:e}),n.callback=r,n}function m(e,t,r){return s(t=a(e,t,r))}function s(n){if(void 0===n.callback)throw new Error("callback argument missing");var i=!1,o=function(e,t,r){i||(i=!0,n.callback(e,t,r))};function t(e){return clearTimeout(u),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,o(e,b)}function e(){if(!a){var e;clearTimeout(u),e=n.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var t=b,r=null;return 0!==e?(t={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),p)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:e,method:f,headers:{},url:c,rawRequest:s},s.getAllResponseHeaders&&(t.headers=y(s.getAllResponseHeaders()))):r=new Error("Internal XMLHttpRequest Error"),o(r,t,t.body)}}var r,a,s=n.xhr||null;s||(s=n.cors||n.useXDR?new m.XDomainRequest:new m.XMLHttpRequest);var u,c=s.url=n.uri||n.url,f=s.method=n.method||"GET",l=n.body||n.data,h=s.headers=n.headers||{},d=!!n.sync,p=!1,b={body:void 0,headers:{},statusCode:0,method:f,url:c,rawRequest:s};if("json"in n&&!1!==n.json&&(p=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==f&&"HEAD"!==f&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),l=JSON.stringify(!0===n.json?l:n.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(e,0)},s.onload=e,s.onerror=t,s.onprogress=function(){},s.onabort=function(){a=!0},s.ontimeout=t,s.open(f,c,!d,n.username,n.password),d||(s.withCredentials=!!n.withCredentials),!d&&0":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],214:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}t.exports={ErrorResponse:function(e){var t=e&&e.error&&e.error.message?e.error.message:JSON.stringify(e);return new Error("Returned error: "+t)},InvalidNumberOfParams:function(e,t,r){return new Error('Invalid number of parameters for "'+r+'". Got '+e+" expected "+t+"!")},InvalidConnection:function(e,t){return this.ConnectionError("CONNECTION ERROR: Couldn't connect to node "+e+".",t)},InvalidProvider:function(){return new Error("Provider not set or invalid")},InvalidResponse:function(e){var t=e&&e.error&&e.error.message?e.error.message:"Invalid JSON RPC response: "+JSON.stringify(e);return new Error(t)},ConnectionTimeout:function(e){return new Error("CONNECTION TIMEOUT: timeout of "+e+" ms achived")},ConnectionNotOpenError:function(e){return this.ConnectionError("connection not open on send()",e)},ConnectionCloseError:function(e){return"object"===n(e)&&e.code&&e.reason?this.ConnectionError("CONNECTION ERROR: The connection got closed with the close code `"+e.code+"` and the following reason string `"+e.reason+"`",e):new Error("CONNECTION ERROR: The connection closed unexpectedly")},MaxAttemptsReachedOnReconnectingError:function(){return new Error("Maximum number of reconnect attempts reached!")},PendingRequestsOnReconnectingError:function(){return new Error("CONNECTION ERROR: Provider started to reconnect before the response got received!")},ConnectionError:function(e,t){var r=new Error(e);return t&&(r.code=t.code,r.reason=t.reason),r},RevertInstructionError:function(e,t){var r=new Error("Your request got reverted with the following reason string: "+e);return r.reason=e,r.signature=t,r},TransactionRevertInstructionError:function(e,t,r){var n=new Error("Transaction has been reverted by the EVM:\n"+JSON.stringify(r,null,2));return n.reason=e,n.signature=t,n.receipt=r,n},TransactionError:function(e,t){var r=new Error(e);return r.receipt=t,r},NoContractAddressFoundError:function(e){return this.TransactionError("The transaction receipt didn't contain a contract address.",e)},ContractCodeNotStoredError:function(e){return this.TransactionError("The contract code couldn't be stored, please check your gas limit.",e)},TransactionRevertedWithoutReasonError:function(e){return this.TransactionError("Transaction has been reverted by the EVM:\n"+JSON.stringify(e,null,2),e)},TransactionOutOfGasError:function(e){return this.TransactionError("Transaction ran out of gas. Please provide more gas:\n"+JSON.stringify(e,null,2),e)},ResolverMethodMissingError:function(e,t){return new Error("The resolver at "+e+'does not implement requested method: "'+t+'".')}}},{}],215:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}var i=e("underscore"),o=e("web3-utils"),a=e("web3-eth-iban"),s=function(e){return o.toBN(e).toString(10)},u=function(e){var t;if(void 0!==e)return"latest"===(t=e)||"pending"===t||"earliest"===t?e:"genesis"===e?"0x0":o.isHexStrict(e)?i.isString(e)?e.toLowerCase():e:o.numberToHex(e)},c=function(t){if(t.to&&(t.to=h(t.to)),t.data&&t.input)throw new Error('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');if(!t.data&&t.input&&(t.data=t.input,delete t.input),t.data&&!o.isHex(t.data))throw new Error("The data field must be HEX encoded data.");return(t.gas||t.gasLimit)&&(t.gas=t.gas||t.gasLimit),["gasPrice","gas","value","nonce"].filter(function(e){return void 0!==t[e]}).forEach(function(e){t[e]=o.numberToHex(t[e])}),t},f=function(e){return null!==e.blockNumber&&(e.blockNumber=o.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=o.hexToNumber(e.transactionIndex)),e.nonce=o.hexToNumber(e.nonce),e.gas=o.hexToNumber(e.gas),e.gasPrice=s(e.gasPrice),e.value=s(e.value),e.to&&o.isAddress(e.to)?e.to=o.toChecksumAddress(e.to):e.to=null,e.from&&(e.from=o.toChecksumAddress(e.from)),e},l=function(e){if("string"==typeof e.blockHash&&"string"==typeof e.transactionHash&&"string"==typeof e.logIndex){var t=o.sha3(e.blockHash.replace("0x","")+e.transactionHash.replace("0x","")+e.logIndex.replace("0x",""));e.id="log_"+t.replace("0x","").substr(0,8)}else e.id||(e.id=null);return null!==e.blockNumber&&(e.blockNumber=o.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=o.hexToNumber(e.transactionIndex)),null!==e.logIndex&&(e.logIndex=o.hexToNumber(e.logIndex)),e.address&&(e.address=o.toChecksumAddress(e.address)),e},h=function(e){var t=new a(e);if(t.isValid()&&t.isDirect())return t.toAddress().toLowerCase();if(o.isAddress(e))return"0x"+e.toLowerCase().replace("0x","");throw new Error('Provided address "'+e+"\" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.")};t.exports={inputDefaultBlockNumberFormatter:function(e){return u(this&&null==e?this.defaultBlock:e)},inputBlockNumberFormatter:u,inputCallFormatter:function(e){var t=(e=c(e)).from||(this?this.defaultAccount:null);return t&&(e.from=h(t)),e},inputTransactionFormatter:function(e){if(e=c(e),!i.isNumber(e.from)&&!i.isObject(e.from)){if(e.from=e.from||(this?this.defaultAccount:null),!e.from&&!i.isNumber(e.from))throw new Error('The send transactions "from" field must be defined!');e.from=h(e.from)}return e},inputAddressFormatter:h,inputPostFormatter:function(e){return e.ttl&&(e.ttl=o.numberToHex(e.ttl)),e.workToProve&&(e.workToProve=o.numberToHex(e.workToProve)),e.priority&&(e.priority=o.numberToHex(e.priority)),i.isArray(e.topics)||(e.topics=e.topics?[e.topics]:[]),e.topics=e.topics.map(function(e){return 0===e.indexOf("0x")?e:o.fromUtf8(e)}),e},inputLogFormatter:function(e){var t=function(e){return null==e?null:0===(e=String(e)).indexOf("0x")?e:o.fromUtf8(e)};return(e.fromBlock||0===e.fromBlock)&&(e.fromBlock=u(e.fromBlock)),(e.toBlock||0===e.toBlock)&&(e.toBlock=u(e.toBlock)),e.topics=e.topics||[],e.topics=e.topics.map(function(e){return i.isArray(e)?e.map(t):t(e)}),t=null,e.address&&(e.address=i.isArray(e.address)?e.address.map(function(e){return h(e)}):h(e.address)),e},inputSignFormatter:function(e){return o.isHexStrict(e)?e:o.utf8ToHex(e)},inputStorageKeysFormatter:function(e){return e.map(o.numberToHex)},outputProofFormatter:function(e){return e.address=o.toChecksumAddress(e.address),e.nonce=o.hexToNumberString(e.nonce),e.balance=o.hexToNumberString(e.balance),e},outputBigNumberFormatter:s,outputTransactionFormatter:f,outputTransactionReceiptFormatter:function(e){if("object"!==n(e))throw new Error("Received receipt is invalid: "+e);return null!==e.blockNumber&&(e.blockNumber=o.hexToNumber(e.blockNumber)),null!==e.transactionIndex&&(e.transactionIndex=o.hexToNumber(e.transactionIndex)),e.cumulativeGasUsed=o.hexToNumber(e.cumulativeGasUsed),e.gasUsed=o.hexToNumber(e.gasUsed),i.isArray(e.logs)&&(e.logs=e.logs.map(l)),e.contractAddress&&(e.contractAddress=o.toChecksumAddress(e.contractAddress)),void 0!==e.status&&null!==e.status&&(e.status=Boolean(parseInt(e.status))),e},outputBlockFormatter:function(e){return e.gasLimit=o.hexToNumber(e.gasLimit),e.gasUsed=o.hexToNumber(e.gasUsed),e.size=o.hexToNumber(e.size),e.timestamp=o.hexToNumber(e.timestamp),null!==e.number&&(e.number=o.hexToNumber(e.number)),e.difficulty&&(e.difficulty=s(e.difficulty)),e.totalDifficulty&&(e.totalDifficulty=s(e.totalDifficulty)),i.isArray(e.transactions)&&e.transactions.forEach(function(e){if(!i.isString(e))return f(e)}),e.miner&&(e.miner=o.toChecksumAddress(e.miner)),e},outputLogFormatter:l,outputPostFormatter:function(e){return e.expiry=o.hexToNumber(e.expiry),e.sent=o.hexToNumber(e.sent),e.ttl=o.hexToNumber(e.ttl),e.workProved=o.hexToNumber(e.workProved),e.topics||(e.topics=[]),e.topics=e.topics.map(function(e){return o.toUtf8(e)}),e},outputSyncingFormatter:function(e){return e.startingBlock=o.hexToNumber(e.startingBlock),e.currentBlock=o.hexToNumber(e.currentBlock),e.highestBlock=o.hexToNumber(e.highestBlock),e.knownStates&&(e.knownStates=o.hexToNumber(e.knownStates),e.pulledStates=o.hexToNumber(e.pulledStates)),e}}},{underscore:213,"web3-eth-iban":519,"web3-utils":559}],216:[function(e,t,r){"use strict";var n=e("./errors"),i=e("./formatters");t.exports={errors:n,formatters:i}},{"./errors":214,"./formatters":215}],217:[function(e,Z,$){(function(X){"use strict";function J(e){return(J="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})(e)}!function(){var e="object"==("undefined"==typeof self?"undefined":J(self))&&self.self===self&&self||"object"==(void 0===X?"undefined":J(X))&&X.global===X&&X||this||{},t=e._,n=Array.prototype,a=Object.prototype,l="undefined"!=typeof Symbol?Symbol.prototype:null,i=n.push,u=n.slice,h=a.toString,o=a.hasOwnProperty,r=Array.isArray,s=Object.keys,c=Object.create,f=function(){},d=function e(t){return t instanceof e?t:this instanceof e?void(this._wrapped=t):new e(t)};void 0===$||$.nodeType?e._=d:(void 0!==Z&&!Z.nodeType&&Z.exports&&($=Z.exports=d),$._=d),d.VERSION="1.9.1";var p,b=function(i,o,e){if(void 0===o)return i;switch(null==e?3:e){case 1:return function(e){return i.call(o,e)};case 3:return function(e,t,r){return i.call(o,e,t,r)};case 4:return function(e,t,r,n){return i.call(o,e,t,r,n)}}return function(){return i.apply(o,arguments)}},y=function(e,t,r){return d.iteratee!==p?d.iteratee(e,t):null==e?d.identity:d.isFunction(e)?b(e,t,r):d.isObject(e)&&!d.isArray(e)?d.matcher(e):d.property(e)};d.iteratee=p=function(e,t){return y(e,t,1/0)};var m=function(i,o){return o=null==o?i.length-1:+o,function(){for(var e=Math.max(arguments.length-o,0),t=Array(e),r=0;r":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],218:[function(e,t,r){"use strict";function u(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function g(s){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=s.apply(e,a);function i(e){u(n,t,r,i,o,"next",e)}function o(e){u(n,t,r,i,o,"throw",e)}i(void 0)})}}var w=e("underscore"),_=e("web3-core-helpers").errors,k=e("web3-core-helpers").formatters,S=e("web3-utils"),A=e("web3-core-promievent"),i=e("web3-core-subscriptions").subscriptions,E=function(e){if(!e.call||!e.name)throw new Error('When creating a method you need to provide at least the "name" and "call" property.');this.name=e.name,this.call=e.call,this.params=e.params||0,this.inputFormatter=e.inputFormatter,this.outputFormatter=e.outputFormatter,this.transformPayload=e.transformPayload,this.extraFormatters=e.extraFormatters,this.abiCoder=e.abiCoder,this.requestManager=e.requestManager,this.accounts=e.accounts,this.defaultBlock=e.defaultBlock||"latest",this.defaultAccount=e.defaultAccount||null,this.transactionBlockTimeout=e.transactionBlockTimeout||50,this.transactionConfirmationBlocks=e.transactionConfirmationBlocks||24,this.transactionPollingTimeout=e.transactionPollingTimeout||750,this.defaultCommon=e.defaultCommon,this.defaultChain=e.defaultChain,this.defaultHardfork=e.defaultHardfork,this.handleRevert=e.handleRevert};E.prototype.setRequestManager=function(e,t){this.requestManager=e,t&&(this.accounts=t)},E.prototype.createFunction=function(e,t){var r=this.buildCall();return r.call=this.call,this.setRequestManager(e||this.requestManager,t||this.accounts),r},E.prototype.attachToObject=function(e){var t=this.buildCall();t.call=this.call;var r=this.name.split(".");1=u.transactionPollingTimeout&&(o.unsubscribe(),c=!0,S._fireError(_.TransactionError("Transaction was not mined within "+u.transactionPollingTimeout+" seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!"),a.eventEmitter,a.reject)):l-1>=u.transactionBlockTimeout&&(o.unsubscribe(),c=!0,S._fireError(_.TransactionError("Transaction was not mined within "+u.transactionBlockTimeout+" blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!"),a.eventEmitter,a.reject))});o.unsubscribe(),c=!0,S._fireError({message:"Failed to subscribe to new newBlockHeaders to confirm the transaction receipts.",data:e},a.eventEmitter,a.reject)},n=function(e){w.isFunction(this.requestManager.provider.on)?v.subscribe("newBlockHeaders",t.bind(null,e,!1)):d=setInterval(t.bind(null,e,!0),1e3)}.bind(this);v.getTransactionReceipt(r).then(function(e){e&&e.blockHash?(0":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],222:[function(e,t,r){"use strict";var i=e("./jsonrpc"),o=e("web3-core-helpers").errors,n=function(e){this.requestManager=e,this.requests=[]};n.prototype.add=function(e){this.requests.push(e)},n.prototype.execute=function(){var n=this.requests;this.requestManager.sendBatch(n,function(e,r){r=r||[],n.map(function(e,t){return r[t]||{}}).forEach(function(e,t){if(n[t].callback){if(e&&e.error)return n[t].callback(o.ErrorResponse(e));if(!i.isValidResponse(e))return n[t].callback(o.InvalidResponse(e));try{n[t].callback(null,n[t].format?n[t].format(e.result):e.result)}catch(e){n[t].callback(e)}}})})},t.exports=n},{"./jsonrpc":225,"web3-core-helpers":216}],223:[function(e,t,r){"use strict";var n,i=null;try{n=Function("return this")()}catch(e){n=window}void 0!==n.ethereumProvider?i=n.ethereumProvider:void 0!==n.web3&&n.web3.currentProvider&&(n.web3.currentProvider.sendAsync&&(n.web3.currentProvider.send=n.web3.currentProvider.sendAsync,delete n.web3.currentProvider.sendAsync),!n.web3.currentProvider.on&&n.web3.currentProvider.connection&&"ipcProviderWrapper"===n.web3.currentProvider.connection.constructor.name&&(n.web3.currentProvider.on=function(e,r){if("function"!=typeof r)throw new Error("The second parameter callback must be a function.");switch(e){case"data":this.connection.on("data",function(t){var e="";t=t.toString();try{e=JSON.parse(t)}catch(e){return r(new Error("Couldn't parse response data"+t))}e.id||-1===e.method.indexOf("_subscription")||r(null,e)});break;default:this.connection.on(e,r)}}),i=n.web3.currentProvider),t.exports=i},{}],224:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}var i=e("underscore"),o=e("web3-core-helpers").errors,a=e("./jsonrpc.js"),s=e("./batch.js"),u=e("./givenProvider.js"),c=function e(t,r){this.provider=null,this.providers=e.providers,this.setProvider(t,r),this.subscriptions=new Map};c.givenProvider=u,c.providers={WebsocketProvider:e("web3-providers-ws"),HttpProvider:e("web3-providers-http"),IpcProvider:e("web3-providers-ipc")},c.prototype.setProvider=function(e,t){var r=this;if(e&&"string"==typeof e&&this.providers)if(/^http(s)?:\/\//i.test(e))e=new this.providers.HttpProvider(e);else if(/^ws(s)?:\/\//i.test(e))e=new this.providers.WebsocketProvider(e);else if(e&&"object"===n(t)&&"function"==typeof t.connect)e=new this.providers.IpcProvider(e,t);else if(e)throw new Error("Can't autodetect provider for \""+e+'"');this.provider&&this.provider.connected&&this.clearSubscriptions(),this.provider=e||null,this.provider&&this.provider.on&&(this.provider.on("data",function(e,t){(e=e||t).method&&r.subscriptions.has(e.params.subscription)&&r.subscriptions.get(e.params.subscription).callback(null,e.params.result)}),this.provider.on("connect",function(){r.subscriptions.forEach(function(e){e.subscription.resubscribe()})}),this.provider.on("error",function(t){r.subscriptions.forEach(function(e){e.callback(t)})}),this.provider.on("close",function(t){r._isCleanCloseEvent(t)&&!r._isIpcCloseError(t)||(r.subscriptions.forEach(function(e){e.callback(o.ConnectionCloseError(t)),r.subscriptions.delete(e.subscription.id)}),r.provider&&r.provider.emit&&r.provider.emit("error",o.ConnectionCloseError(t))),r.provider&&r.provider.emit&&r.provider.emit("end",t)}))},c.prototype.send=function(e,r){if(r=r||function(){},!this.provider)return r(o.InvalidProvider());var n=a.toPayload(e.method,e.params);this.provider[this.provider.sendAsync?"sendAsync":"send"](n,function(e,t){return t&&t.id&&n.id!==t.id?r(new Error('Wrong response id "'+t.id+'" (expected: "'+n.id+'") in '+JSON.stringify(n))):e?r(e):t&&t.error?r(o.ErrorResponse(t)):a.isValidResponse(t)?void r(null,t.result):r(o.InvalidResponse(t))})},c.prototype.sendBatch=function(e,r){if(!this.provider)return r(o.InvalidProvider());var t=a.toBatchPayload(e);this.provider[this.provider.sendAsync?"sendAsync":"send"](t,function(e,t){return e?r(e):i.isArray(t)?void r(null,t):r(o.InvalidResponse(t))})},c.prototype.addSubscription=function(e,t){if(!this.provider.on)throw new Error("The provider doesn't support subscriptions: "+this.provider.constructor.name);this.subscriptions.set(e.id,{callback:t,subscription:e})},c.prototype.removeSubscription=function(e,t){if(this.subscriptions.has(e)){var r=this.subscriptions.get(e).subscription.options.type;return this.subscriptions.delete(e),void this.send({method:r+"_unsubscribe",params:[e]},t)}"function"==typeof t&&t(null)},c.prototype.clearSubscriptions=function(r){var n=this;0":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],228:[function(e,t,r){"use strict";var n=e("./subscription.js"),i=function(e){this.name=e.name,this.type=e.type,this.subscriptions=e.subscriptions||{},this.requestManager=null};i.prototype.setRequestManager=function(e){this.requestManager=e},i.prototype.attachToObject=function(e){var t=this.buildCall(),r=this.name.split(".");1this.wordSize&&u.throwError("value out-of-bounds",a.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=n.concat([this._padding.slice(t.length%this.wordSize),t])),t},e.prototype.writeValue=function(e){return this._writeData(this._getValue(e))},e.prototype.writeUpdatableValue=function(){var t=this,r=this.length;return this.writeValue(0),function(e){t._data.set(t._getValue(e),r)}},e}();r.Writer=f;var l=function(){function r(e,t,r){o.defineReadOnly(this,"_data",n.arrayify(e)),o.defineReadOnly(this,"wordSize",t||32),o.defineReadOnly(this,"_coerceFunc",r),this._offset=0}return Object.defineProperty(r.prototype,"data",{get:function(){return n.hexlify(this._data)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"consumed",{get:function(){return this._offset},enumerable:!0,configurable:!0}),r.coerce=function(e,t){var r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t},r.prototype.coerce=function(e,t){return this._coerceFunc?this._coerceFunc(e,t):r.coerce(e,t)},r.prototype._peekBytes=function(e,t){var r=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&u.throwError("data out-of-bounds",a.Logger.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r}),this._data.slice(this._offset,this._offset+r)},r.prototype.subReader=function(e){return new r(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc)},r.prototype.readBytes=function(e){var t=this._peekBytes(0,e);return this._offset+=t.length,t.slice(0,e)},r.prototype.readValue=function(){return i.BigNumber.from(this.readBytes(this.wordSize))},r}();r.Reader=l},{"../_version":232,"@ethersproject/bignumber":253,"@ethersproject/bytes":255,"@ethersproject/logger":261,"@ethersproject/properties":263}],235:[function(e,t,r){"use strict";var n,i=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=e("@ethersproject/address"),a=e("@ethersproject/bytes"),s=function(t){function e(e){return t.call(this,"address","address",e,!1)||this}return i(e,t),e.prototype.encode=function(e,t){try{o.getAddress(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)},e.prototype.decode=function(e){return o.getAddress(a.hexZeroPad(e.readValue().toHexString(),20))},e}(e("./abstract-coder").Coder);r.AddressCoder=s},{"./abstract-coder":234,"@ethersproject/address":249,"@ethersproject/bytes":255}],236:[function(e,t,r){"use strict";var n,i=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o=function(r){function e(e){var t=r.call(this,e.name,e.type,void 0,e.dynamic)||this;return t.coder=e,t}return i(e,r),e.prototype.encode=function(e,t){return this.coder.encode(e,t)},e.prototype.decode=function(e){return this.coder.decode(e)},e}(e("./abstract-coder").Coder);r.AnonymousCoder=o},{"./abstract-coder":234}],237:[function(e,t,r){"use strict";function i(e){return(i="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})(e)}var n,o=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var u=e("@ethersproject/logger"),a=e("../_version"),c=new u.Logger(a.version),f=e("./abstract-coder"),s=e("./anonymous");function l(e,t,o){if(Array.isArray(o));else if(o&&"object"===i(o)){var r=[];t.forEach(function(e){r.push(o[e.localName])}),o=r}else c.throwArgumentError("invalid tuple value","tuple",o);t.length!==o.length&&c.throwArgumentError("types/value length mismatch","tuple",o);var a=new f.Writer(e.wordSize),s=new f.Writer(e.wordSize),u=[];t.forEach(function(e,t){var r=o[t];if(e.dynamic){var n=s.length;e.encode(s,r);var i=a.writeUpdatableValue();u.push(function(e){i(e+n)})}else e.encode(a,r)}),u.forEach(function(e){e(a.length)});var n=e.writeBytes(a.data);return n+=e.writeBytes(s.data)}function h(i,e){var o=[],a=i.subReader(0),s=0;e.forEach(function(t){var r=null;if(t.dynamic){var e=i.readValue(),n=a.subReader(e.toNumber());try{r=t.decode(n)}catch(e){if(e.code===u.Logger.errors.BUFFER_OVERRUN)throw e;(r=e).baseType=t.name,r.name=t.localName,r.type=t.type}s+=n.consumed}else try{r=t.decode(i)}catch(e){if(e.code===u.Logger.errors.BUFFER_OVERRUN)throw e;(r=e).baseType=t.name,r.name=t.localName,r.type=t.type}null!=r&&o.push(r)}),i.readBytes(s),e.forEach(function(e,t){var r=e.localName;if(r&&("length"===r&&(r="_length"),null==o[r])){var n=o[t];n instanceof Error?Object.defineProperty(o,r,{get:function(){throw n}}):o[r]=n}});for(var t=function(e){var t=o[e];t instanceof Error&&Object.defineProperty(o,e,{get:function(){throw t}})},r=0;rn.inputs.length&&m.throwError("too many arguments for "+n.format(),y.Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});var i=[];n.anonymous||i.push(this.getEventTopic(n));var o=function(e,t){return"string"===e.type?u.id(t):"bytes"===e.type?c.keccak256(p.hexlify(t)):("address"===e.type&&r._abiCoder.encode(["address"],[t]),p.hexZeroPad(p.hexlify(t),32))};for(e.forEach(function(e,t){var r=n.inputs[t];r.indexed?null==e?i.push(null):"array"===r.baseType||"tuple"===r.baseType?m.throwArgumentError("filtering with tuples or arrays not supported","contract."+r.name,e):Array.isArray(e)?i.push(e.map(function(e){return o(r,e)})):i.push(o(r,e)):null!=e&&m.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+r.name,e)});i.length&&null===i[i.length-1];)i.pop();return i},i.prototype.encodeEventLog=function(e,n){var i=this;"string"==typeof e&&(e=this.getEvent(e));var o=[],a=[],s=[];return e.anonymous||o.push(this.getEventTopic(e)),n.length!==e.inputs.length&&m.throwArgumentError("event arguments/values mismatch","values",n),e.inputs.forEach(function(e,t){var r=n[t];if(e.indexed)if("string"===e.type)o.push(u.id(r));else if("bytes"===e.type)o.push(c.keccak256(r));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");o.push(i._abiCoder.encode([e.type],[r]))}else a.push(e),s.push(r)}),{data:this._abiCoder.encode(a,s),topics:o}},i.prototype.decodeEventLog=function(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){var n=this.getEventTopic(e);p.isHexString(r[0],32)&&r[0].toLowerCase()===n||m.throwError("fragment/topic mismatch",y.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var i=[],o=[],a=[];e.inputs.forEach(function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(i.push(b.ParamType.fromObject({type:"bytes32",name:e.name})),a.push(!0)):(i.push(e),a.push(!1)):(o.push(e),a.push(!1))});var s=null!=r?this._abiCoder.decode(i,p.concat(r)):null,u=this._abiCoder.decode(o,t),c=[],f=0,l=0;e.inputs.forEach(function(e,t){if(e.indexed)if(null==s)c[t]=new g({_isIndexed:!0,hash:null});else if(a[t])c[t]=new g({_isIndexed:!0,hash:s[l++]});else try{c[t]=s[l++]}catch(e){c[t]=e}else try{c[t]=u[f++]}catch(e){c[t]=e}if(e.name&&null==c[e.name]){var r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{get:function(){throw w("property "+JSON.stringify(e.name),r)}}):c[e.name]=r}});for(var h=function(e){var t=c[e];t instanceof Error&&Object.defineProperty(c,e,{get:function(){throw w("index "+e,t)}})},d=0;d>1]>>4&&(t[n]=t[n].toUpperCase()),8<=(15&i[n>>1])&&(t[n+1]=t[n+1].toUpperCase());return"0x"+t.join("")}for(var h={},d=0;d<10;d++)h[String(d)]=String(d);for(d=0;d<26;d++)h[String.fromCharCode(65+d)]=String(10+d);var p,b=Math.floor((p=9007199254740991,Math.log10?Math.log10(p):Math.log(p)/Math.LN10));function y(e){for(var t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(function(e){return h[e]}).join("");t.length>=b;){var r=t.substring(0,b);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function m(e){var t=null;if("string"!=typeof e&&f.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=l(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&f.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==y(e)&&f.throwArgumentError("bad icap checksum","address",e),t=new n.BN(e.substring(4),36).toString(16);t.length<40;)t="0"+t;t=l("0x"+t)}else f.throwArgumentError("invalid address","address",e);return t}r.getAddress=m,r.isAddress=function(e){try{return m(e),!0}catch(e){}return!1},r.getIcapAddress=function(e){for(var t=new n.BN(m(e).substring(2),16).toString(36).toUpperCase();t.length<30;)t="0"+t;return"XE"+y("XE00"+t)+t},r.getContractAddress=function(t){var e=null;try{e=m(t.from)}catch(e){f.throwArgumentError("missing from address","transaction",t)}var r=o.stripZeros(o.arrayify(i.BigNumber.from(t.nonce).toHexString()));return m(o.hexDataSlice(a.keccak256(s.encode([e,r])),12))},r.getCreate2Address=function(e,t,r){return 32!==o.hexDataLength(t)&&f.throwArgumentError("salt must be 32 bytes","salt",t),32!==o.hexDataLength(r)&&f.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),m(o.hexDataSlice(a.keccak256(o.concat(["0xff",m(e),t,r])),12))}},{"./_version":248,"@ethersproject/bignumber":253,"@ethersproject/bytes":255,"@ethersproject/keccak256":259,"@ethersproject/logger":261,"@ethersproject/rlp":265,"bn.js":271}],250:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="bignumber/5.0.0-beta.138"},{}],251:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("bn.js"),o=e("@ethersproject/bytes"),a=e("@ethersproject/logger"),n=e("./_version"),s=new a.Logger(n.version),u={},c=9007199254740991;r.isBigNumberish=function(e){return null!=e&&(f.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||o.isHexString(e)||"bigint"==typeof e||o.isBytes(e))};var f=function(){function n(e,t){var r=this.constructor;s.checkNew(r,n),e!==u&&s.throwError("cannot call constructor directly; use BigNumber.from",a.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}return n.prototype.fromTwos=function(e){return h(d(this).fromTwos(e))},n.prototype.toTwos=function(e){return h(d(this).toTwos(e))},n.prototype.abs=function(){return"-"===this._hex[0]?n.from(this._hex.substring(1)):this},n.prototype.add=function(e){return h(d(this).add(d(e)))},n.prototype.sub=function(e){return h(d(this).sub(d(e)))},n.prototype.div=function(e){return n.from(e).isZero()&&p("division by zero","div"),h(d(this).div(d(e)))},n.prototype.mul=function(e){return h(d(this).mul(d(e)))},n.prototype.mod=function(e){var t=d(e);return t.isNeg()&&p("cannot modulo negative values","mod"),h(d(this).umod(t))},n.prototype.pow=function(e){return h(d(this).pow(d(e)))},n.prototype.and=function(e){var t=d(e);return(this.isNegative()||t.isNeg())&&p("cannot 'and' negative values","and"),h(d(this).and(t))},n.prototype.or=function(e){var t=d(e);return(this.isNegative()||t.isNeg())&&p("cannot 'or' negative values","or"),h(d(this).or(t))},n.prototype.xor=function(e){var t=d(e);return(this.isNegative()||t.isNeg())&&p("cannot 'xor' negative values","xor"),h(d(this).xor(t))},n.prototype.mask=function(e){return(this.isNegative()||e<0)&&p("cannot mask negative values","mask"),h(d(this).maskn(e))},n.prototype.shl=function(e){return(this.isNegative()||e<0)&&p("cannot shift negative values","shl"),h(d(this).shln(e))},n.prototype.shr=function(e){return(this.isNegative()||e<0)&&p("cannot shift negative values","shr"),h(d(this).shrn(e))},n.prototype.eq=function(e){return d(this).eq(d(e))},n.prototype.lt=function(e){return d(this).lt(d(e))},n.prototype.lte=function(e){return d(this).lte(d(e))},n.prototype.gt=function(e){return d(this).gt(d(e))},n.prototype.gte=function(e){return d(this).gte(d(e))},n.prototype.isNegative=function(){return"-"===this._hex[0]},n.prototype.isZero=function(){return d(this).isZero()},n.prototype.toNumber=function(){try{return d(this).toNumber()}catch(e){p("overflow","toNumber",this.toString())}return null},n.prototype.toString=function(){return 0!==arguments.length&&s.throwError("bigNumber.toString does not accept parameters",a.Logger.errors.UNEXPECTED_ARGUMENT,{}),d(this).toString(10)},n.prototype.toHexString=function(){return this._hex},n.from=function(e){return e instanceof n?e:"string"==typeof e?e.match(/-?0x[0-9a-f]+/i)?new n(u,l(e)):e.match(/^-?[0-9]+$/)?new n(u,l(new i.BN(e))):s.throwArgumentError("invalid BigNumber string","value",e):"number"==typeof e?(e%1&&p("underflow","BigNumber.from",e),(c<=e||e<=-c)&&p("overflow","BigNumber.from",e),n.from(String(e))):"bigint"==typeof e?n.from(e.toString()):o.isBytes(e)?n.from(o.hexlify(e)):e._hex&&o.isHexString(e._hex)?n.from(e._hex):e.toHexString&&"string"==typeof(e=e.toHexString())?n.from(e):s.throwArgumentError("invalid BigNumber value","value",e)},n.isBigNumber=function(e){return!(!e||!e._isBigNumber)},n}();function l(e){if("string"!=typeof e)return l(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&s.throwArgumentError("invalid hex","value",e),"0x00"===(e=l(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));4r.length-1&&p("fractional component exceeds decimals","underflow","parseFixed");a.lengthr.width/8)throw new Error("overflow");var n=l.BigNumber.from(e);r.signed&&(n=n.fromTwos(r.width));var i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=y(n,r.decimals);return new a(c,i,o,r)},a.from=function(e,t){if("string"==typeof e)return a.fromString(e,t);if(u.isBytes(e))return a.fromBytes(e,t);try{return a.fromValue(e,0,t)}catch(e){if(e.code!==o.Logger.errors.INVALID_ARGUMENT)throw e}return f.throwArgumentError("invalid FixedNumber value","value",e)},a.isFixedNumber=function(e){return!(!e||!e._isFixedNumber)},a}();r.FixedNumber=a},{"./_version":250,"./bignumber":251,"@ethersproject/bytes":255,"@ethersproject/logger":261}],253:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./bignumber");r.BigNumber=n.BigNumber;var i=e("./fixednumber");r.formatFixed=i.formatFixed,r.FixedFormat=i.FixedFormat,r.FixedNumber=i.FixedNumber,r.parseFixed=i.parseFixed},{"./bignumber":251,"./fixednumber":252}],254:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="bytes/5.0.0-beta.137"},{}],255:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("@ethersproject/logger"),i=e("./_version"),u=new n.Logger(i.version);function a(e){return!!e.toHexString}function o(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function c(e){return d(e)&&!(e.length%2)||s(e)}function s(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(null==e.length)return!1;for(var t=0;tt&&u.throwArgumentError("value out of range","value",arguments[0]);var r=new Uint8Array(t);return r.set(e,t-e.length),o(r)}function d(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}r.isBytesLike=c,r.isBytes=s,r.arrayify=f,r.concat=l,r.stripZeros=function(e){var t=f(e);if(0===t.length)return t;for(var r=0;r>4]+p[15&o]}return n}return u.throwArgumentError("invalid hexlify value","value",e)}function y(e){"string"!=typeof e&&(e=b(e)),d(e)||u.throwArgumentError("invalid hex string","value",e),e=e.substring(2);for(var t=0;t2*t+2&&u.throwArgumentError("value out of range","value",t);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function v(e){var t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(c(e)){var r=f(e);65!==r.length&&u.throwArgumentError("invalid signature string; must be 65 bytes","signature",e),t.r=b(r.slice(0,32)),t.s=b(r.slice(32,64)),t.v=r[64],t.recoveryParam=1-t.v%2,t.v<27&&(0===t.v||1===t.v?t.v+=27:u.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam&&(r[32]|=128),t._vs=b(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){var n=h(f(t._vs),32);t._vs=b(n);var i=128<=n[0]?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&u.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;var o=b(n);null==t.s?t.s=o:t.s!==o&&u.throwArgumentError("signature v mismatch _vs","signature",e)}null==t.recoveryParam?null==t.v?u.throwArgumentError("signature missing v and recoveryParam","signature",e):t.recoveryParam=1-t.v%2:null==t.v?t.v=27+t.recoveryParam:t.recoveryParam!==1-t.v%2&&u.throwArgumentError("signature recoveryParam mismatch v","signature",e),null!=t.r&&d(t.r)?t.r=m(t.r,32):u.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&d(t.s)?t.s=m(t.s,32):u.throwArgumentError("signature missing or invalid s","signature",e);var a=f(t.s);128<=a[0]&&u.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(a[0]|=128);var s=b(a);t._vs&&(d(t._vs)||u.throwArgumentError("signature invalid _vs","signature",e),t._vs=m(t._vs,32)),null==t._vs?t._vs=s:t._vs!==s&&u.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t}r.hexlify=b,r.hexDataLength=function(e){if("string"!=typeof e)e=b(e);else if(!d(e)||e.length%2)return null;return(e.length-2)/2},r.hexDataSlice=function(e,t,r){return"string"!=typeof e?e=b(e):(!d(e)||e.length%2)&&u.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)},r.hexConcat=function(e){var t="0x";return e.forEach(function(e){t+=b(e).substring(2)}),t},r.hexValue=function(e){var t=y(b(e,{hexPad:"left"}));return"0x"===t?"0x0":t},r.hexStripZeros=y,r.hexZeroPad=m,r.splitSignature=v,r.joinSignature=function(e){return b(l([(e=v(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},{"./_version":254,"@ethersproject/logger":261}],256:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("@ethersproject/bignumber");r.AddressZero="0x0000000000000000000000000000000000000000";r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000";r.EtherSymbol="Ξ";var i=n.BigNumber.from(-1);r.NegativeOne=i;var o=n.BigNumber.from(0);r.Zero=o;var a=n.BigNumber.from(1);r.One=a;var s=n.BigNumber.from(2);r.Two=s;var u=n.BigNumber.from("1000000000000000000");r.WeiPerEther=u;var c=n.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");r.MaxUint256=c},{"@ethersproject/bignumber":253}],257:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="hash/5.0.0-beta.133"},{}],258:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("@ethersproject/bytes"),o=e("@ethersproject/strings"),a=e("@ethersproject/keccak256"),n=e("@ethersproject/logger"),s=e("./_version"),u=new n.Logger(s.version),c=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),f=new RegExp("^((.*)\\.)?([^.]+)$");r.isValidName=function(e){try{for(var t=e.split("."),r=0;ra[0]&&t[1]>=8;return t}function f(e,t,r){for(var n=0,i=0;ie.length&&c.throwError("data short segment too short",u.Logger.errors.BUFFER_OVERRUN,{});var r=f(e,t+1,i);return t+1+i+r>e.length&&c.throwError("data long segment too short",u.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1+i,i+r)}if(192<=e[t]){var n=e[t]-192;return t+1+n>e.length&&c.throwError("data array too short",u.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1,n)}if(184<=e[t]){var i;t+1+(i=e[t]-183)>e.length&&c.throwError("data array too short",u.Logger.errors.BUFFER_OVERRUN,{});var o=f(e,t+1,i);return t+1+i+o>e.length&&c.throwError("data array too short",u.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+i+o,result:s.hexlify(e.slice(t+1+i,t+1+i+o))}}if(128<=e[t]){var a=e[t]-128;return t+1+a>e.length&&c.throwError("data too short",u.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+a,result:s.hexlify(e.slice(t+1,t+1+a))}}return{consumed:1,result:s.hexlify(e[t])}}r.encode=function(e){return s.hexlify(function t(e){if(Array.isArray(e)){var r=[];if(e.forEach(function(e){r=r.concat(t(e))}),r.length<=55)return r.unshift(192+r.length),r;var n=a(r.length);return n.unshift(247+n.length),n.concat(r)}s.isBytesLike(e)||c.throwArgumentError("RLP object must be BytesLike","object",e);var i=Array.prototype.slice.call(s.arrayify(e));if(1===i.length&&i[0]<=127)return i;if(i.length<=55)return i.unshift(128+i.length),i;var o=a(i.length);return o.unshift(183+o.length),o.concat(i)}(e))},r.decode=function(e){var t=s.arrayify(e),r=h(t,0);return r.consumed!==t.length&&c.throwArgumentError("invalid rlp data","data",e),r.result}},{"./_version":264,"@ethersproject/bytes":255,"@ethersproject/logger":261}],266:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version="strings/5.0.0-beta.136"},{}],267:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("@ethersproject/constants"),i=e("@ethersproject/bytes"),o=e("./utf8");r.formatBytes32String=function(e){var t=o.toUtf8Bytes(e);if(31>6==2;a++)o++;return o}function c(e,t){null==t&&(t=f.Utf8ErrorFuncs.error),e=h.arrayify(e);for(var r=[],n=0;n>7!=0){var o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?l.UNEXPECTED_CONTINUE:l.BAD_PREFIX,n-1,e,r);continue}o=3,a=65535}if(n-1+o>=e.length)n+=t(l.OVERRUN,n-1,e,r);else{for(var s=i&(1<<8-o-1)-1,u=0;u>6|192),r.push(63&i|128);else if(55296==(64512&i)){n++;var o=e.charCodeAt(n);if(n>=e.length||56320!=(64512&o))throw new Error("invalid utf-8 string");var a=65536+((1023&i)<<10)+(1023&o);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return h.arrayify(r)}function p(e){var t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function b(e){return e.map(function(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))}).join("")}(r=s=f.UnicodeNormalizationForm||(f.UnicodeNormalizationForm={})).current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD",(n=l=f.Utf8ErrorReason||(f.Utf8ErrorReason={})).UNEXPECTED_CONTINUE="unexpected continuation byte",n.BAD_PREFIX="bad codepoint prefix",n.OVERRUN="string overrun",n.MISSING_CONTINUE="missing continuation byte",n.OUT_OF_RANGE="out of UTF-8 range",n.UTF16_SURROGATE="UTF-16 surrogate",n.OVERLONG="overlong representation",f.Utf8ErrorFuncs=Object.freeze({error:function(e,t,r,n,i){return u.throwArgumentError("invalid codepoint at offset "+t+"; "+e,"bytes",r)},ignore:a,replace:function(e,t,r,n,i){return e===l.OVERLONG?(n.push(i),0):(n.push(65533),a(e,t,r))}}),f.toUtf8Bytes=d,f._toEscapedUtf8String=function(e,t){return'"'+c(e,t).map(function(e){if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(32<=e&&e<127)return String.fromCharCode(e)}return e<=65535?p(e):p(55296+((e-=65536)>>10&1023))+p(56320+(1023&e))}).join("")+'"'},f._toUtf8String=b,f.toUtf8String=function(e,t){return b(c(e,t))},f.toUtf8CodePoints=function(e,t){return void 0===t&&(t=s.current),c(d(e,t))}},{"./_version":266,"@ethersproject/bytes":255,"@ethersproject/logger":261}],271:[function(S,e,t){"use strict";function A(e){return(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})(e)}!function(e,t){function y(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function m(e,t,r){if(m.isBN(e))return e;this.negative=0,this.words=null,this.length=0,(this.red=null)!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var n;"object"===A(e)?e.exports=m:(void 0).BN=m,(m.BN=m).wordSize=26;try{n=S("buffer").Buffer}catch(e){}function a(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);else if("le"===r)for(i=n=0;n>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);return this.strip()},m.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},m.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,c=r;c"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;n=(r.length=n)-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[d])+l)/67108864|0,l=67108863&a}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}m.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&2<=e&&e<=36){var u=d[e],c=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var l=f.modn(c).toString(e);r=(f=f.idivn(c)).isZero()?l+r:h[u-l.length]+l+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}y(!1,"Base should be between 2 and 36")},m.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=t&&(r+=7,t>>>=7),8<=t&&(r+=4,t>>>=4),2<=t&&(r+=2,t>>>=2),r+t},m.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},m.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},m.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},m.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},m.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},m.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},m.prototype.iuxor=function(e){var t,r;r=this.length>e.length?(t=this,e):(t=e,this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},m.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},m.prototype.inotn=function(e){y("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},m.prototype.notn=function(e){return this.clone().inotn(e)},m.prototype.setn=function(e,t){y("number"==typeof e&&0<=e);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,e):(r=e,this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},m.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;n=0>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,b=d>>>13,y=0|a[2],m=8191&y,v=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,k=0|a[4],S=8191&k,A=k>>>13,E=0|a[5],x=8191&E,M=E>>>13,j=0|a[6],I=8191&j,O=j>>>13,T=0|a[7],B=8191&T,C=T>>>13,R=0|a[8],N=8191&R,U=R>>>13,P=0|a[9],L=8191&P,F=P>>>13,D=0|s[0],q=8191&D,z=D>>>13,H=0|s[1],K=8191&H,V=H>>>13,W=0|s[2],G=8191&W,Y=W>>>13,X=0|s[3],J=8191&X,Z=X>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,fe=0|s[8],le=8191&fe,he=fe>>>13,de=0|s[9],pe=8191&de,be=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(h,q)|0))<<13)|0;c=((o=Math.imul(h,z))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(b,q)|0,o=Math.imul(b,z);var me=(c+(n=n+Math.imul(l,K)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,K)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,q),i=(i=Math.imul(m,z))+Math.imul(v,q)|0,o=Math.imul(v,z),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0;var ve=(c+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,Y)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,o=Math.imul(_,z),n=n+Math.imul(m,K)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Y)|0;var ge=(c+(n=n+Math.imul(l,J)|0)|0)+((8191&(i=(i=i+Math.imul(l,Z)|0)+Math.imul(h,J)|0))<<13)|0;c=((o=o+Math.imul(h,Z)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(A,q)|0,o=Math.imul(A,z),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0;var we=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(M,q)|0,o=Math.imul(M,z),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var _e=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(O,q)|0,o=Math.imul(O,z),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var ke=(c+(n=n+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(C,q)|0,o=Math.imul(C,z),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0;var Se=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,z))+Math.imul(U,q)|0,o=Math.imul(U,z),n=n+Math.imul(B,K)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,V)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0;var Ae=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(F,q)|0,o=Math.imul(F,z),n=n+Math.imul(N,K)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,V)|0,n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(b,le)|0,o=o+Math.imul(b,he)|0;var Ee=(c+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,be)|0)+Math.imul(h,pe)|0))<<13)|0;c=((o=o+Math.imul(h,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,V))+Math.imul(F,K)|0,o=Math.imul(F,V),n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(U,G)|0,o=o+Math.imul(U,Y)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(m,le)|0,i=(i=i+Math.imul(m,he)|0)+Math.imul(v,le)|0,o=o+Math.imul(v,he)|0;var xe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(L,G),i=(i=Math.imul(L,Y))+Math.imul(F,G)|0,o=Math.imul(F,Y),n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,Z)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,n=n+Math.imul(S,ue)|0,i=(i=i+Math.imul(S,ce)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,ce)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(_,le)|0,o=o+Math.imul(_,he)|0;var Me=(c+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,be)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,J),i=(i=Math.imul(L,Z))+Math.imul(F,J)|0,o=Math.imul(F,Z),n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,ee)|0,n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,n=n+Math.imul(S,le)|0,i=(i=i+Math.imul(S,he)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,he)|0;var je=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,be)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,ee))+Math.imul(F,Q)|0,o=Math.imul(F,ee),n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(U,re)|0,o=o+Math.imul(U,ne)|0,n=n+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,n=n+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,he)|0;var Ie=(c+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,be)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(F,re)|0,o=Math.imul(F,ne),n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(U,oe)|0,o=o+Math.imul(U,ae)|0,n=n+Math.imul(B,ue)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(I,le)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,he)|0;var Oe=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,be)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,oe),i=(i=Math.imul(L,ae))+Math.imul(F,oe)|0,o=Math.imul(F,ae),n=n+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,ce)|0)+Math.imul(U,ue)|0,o=o+Math.imul(U,ce)|0,n=n+Math.imul(B,le)|0,i=(i=i+Math.imul(B,he)|0)+Math.imul(C,le)|0,o=o+Math.imul(C,he)|0;var Te=(c+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,be)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,ue),i=(i=Math.imul(L,ce))+Math.imul(F,ue)|0,o=Math.imul(F,ce),n=n+Math.imul(N,le)|0,i=(i=i+Math.imul(N,he)|0)+Math.imul(U,le)|0,o=o+Math.imul(U,he)|0;var Be=(c+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,be)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(L,le),i=(i=Math.imul(L,he))+Math.imul(F,le)|0,o=Math.imul(F,he);var Ce=(c+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,be)|0)+Math.imul(U,pe)|0))<<13)|0;c=((o=o+Math.imul(U,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Re=(c+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,be))+Math.imul(F,pe)|0))<<13)|0;return c=((o=Math.imul(F,be))+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,u[0]=ye,u[1]=me,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=ke,u[7]=Se,u[8]=Ae,u[9]=Ee,u[10]=xe,u[11]=Me,u[12]=je,u[13]=Ie,u[14]=Oe,u[15]=Te,u[16]=Be,u[17]=Ce,u[18]=Re,0!==c&&(u[19]=c,r.length++),r};function s(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}Math.imul||(o=i),m.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?i(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):s(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=m.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},m.prototype.muln=function(e){return this.clone().imuln(e)},m.prototype.sqr=function(){return this.mul(this)},m.prototype.isqr=function(){return this.imul(this.clone())},m.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new m(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;0<=t;t--)this.words[t+n]=this.words[t];for(t=0;t>>i<o)for(this.length-=o,u=0;u>>i,c=f&a}return s&&0!==c&&(s.words[s.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},m.prototype.ishrn=function(e,t,r){return y(0===this.negative),this.iushrn(e,t,r)},m.prototype.shln=function(e){return this.clone().ishln(e)},m.prototype.ushln=function(e){return this.clone().iushln(e)},m.prototype.shrn=function(e){return this.clone().ishrn(e)},m.prototype.ushrn=function(e){return this.clone().iushrn(e)},m.prototype.testn=function(e){y("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,n=1<>>t<>26)-(s/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===a)return this.strip();for(y(-1===a),n=a=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},m.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,s=n.length-i.length;if("mod"!==t){(a=new m(null)).length=s+1,a.words=new Array(a.length);for(var u=0;uthis.length||this.cmp(e)<0?{div:new m(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new m(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new m(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,o},m.prototype.div=function(e){return this.divmod(e,"div",!1).div},m.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},m.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},m.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},m.prototype.modn=function(e){y(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;0<=n;n--)r=(t*r+(0|this.words[n]))%e;return r},m.prototype.idivn=function(e){y(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},m.prototype.divn=function(e){return this.clone().idivn(e)},m.prototype.egcd=function(e){y(0===e.negative),y(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new m(1),i=new m(0),o=new m(0),a=new m(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var u=r.clone(),c=t.clone();!t.isZero();){for(var f=0,l=1;0==(t.words[0]&l)&&f<26;++f,l<<=1);if(0>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},m.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},m.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1e.length)return 1;if(this.lengththis.n;);var n=t>>22,i=o}i>>>=22,0===(e.words[n-10]=i)&&10>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},m._prime=function(e){if(c[e])return c[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new g;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return c[e]=t},_.prototype._verify1=function(e){y(0===e.negative,"red works only with positives"),y(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){y(0==(e.negative|t.negative),"red works only with positives"),y(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(y(t%2==1),3===t){var r=this.m.add(new m(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);y(!n.isZero());var o=new m(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new m(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var c=this.pow(u,n),f=this.pow(e,n.addn(1).iushrn(1)),l=this.pow(e,n),h=i;0!==l.cmp(o);){for(var d=l,p=0;0!==d.cmp(o);p++)d=d.redSqr();y(p>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[o]),o=a=0)):a=0}s=26}return i},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},m.mont=function(e){return new k(e)},r(k,_),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new m(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e)},{buffer:21}],272:[function(e,k,t){(function(g,w){"use strict";function _(e){return(_="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})(e)}!function(){var e="object"===("undefined"==typeof window?"undefined":_(window))?window:{};!e.JS_SHA3_NO_NODE_JS&&"object"===(void 0===g?"undefined":_(g))&&g.versions&&g.versions.node&&(e=w);for(var t=!e.JS_SHA3_NO_COMMON_JS&&"object"===(void 0===k?"undefined":_(k))&&k.exports,u="0123456789abcdef".split(""),f=[0,8,16,24],fe=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],r=[224,256,384,512],o=["hex","buffer","arrayBuffer","array"],a=function(t,r,n){return function(e){return new m(t,r,t).update(e)[n]()}},s=function(r,n,i){return function(e,t){return new m(r,n,t).update(e)[i]()}},n=function(e,t){var r=a(e,t,"hex");r.create=function(){return new m(e,t,e)},r.update=function(e){return r.create().update(e)};for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}m.prototype.update=function(e){var t="string"!=typeof e;t&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e));for(var r,n,i=e.length,o=this.blocks,a=this.byteCount,s=this.blockCount,u=0,c=this.s;u>2]|=e[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(224|n>>12)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];a%t==0&&(v(r),o=0)}return i&&(e=r[o],0>4&15]+u[15&e]),1>12&15]+u[e>>8&15]),2>20&15]+u[e>>16&15])),s},m.prototype.buffer=m.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r==0&&v(n)}return o&&(e=s<<2,t=n[a],0>8&255),2>16&255)),u};var v=function(e){var t,r,n,i,o,a,s,u,c,f,l,h,d,p,b,y,m,v,g,w,_,k,S,A,E,x,M,j,I,O,T,B,C,R,N,U,P,L,F,D,q,z,H,K,V,W,G,Y,X,J,Z,$,Q,ee,te,re,ne,ie,oe,ae,se,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|l>>>31),r=s^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(h<<1|d>>>31),r=c^(d<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,N=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,U=e[14]<<6|e[15]>>>26,P=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,C=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,E=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,M=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=b^~m&g,e[10]=A^~x&j,e[11]=E^~M&I,e[20]=R^~U&L,e[21]=N^~P&F,e[30]=K^~W&Y,e[31]=V^~G&X,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=y^~v&w,e[3]=m^~g&_,e[12]=x^~j&O,e[13]=M^~I&T,e[22]=U^~L&D,e[23]=P^~F&q,e[32]=W^~Y&J,e[33]=G^~X&Z,e[42]=re^~ie&ae,e[43]=ne^~oe&se,e[4]=v^~w&k,e[5]=g^~_&S,e[14]=j^~O&B,e[15]=I^~T&C,e[24]=L^~D&z,e[25]=F^~q&H,e[34]=Y^~J&$,e[35]=X^~Z&Q,e[44]=ie^~ae&ue,e[45]=oe^~se&ce,e[6]=w^~k&p,e[7]=_^~S&b,e[16]=O^~B&A,e[17]=T^~C&E,e[26]=D^~z&R,e[27]=q^~H&N,e[36]=J^~$&K,e[37]=Z^~Q&V,e[46]=ae^~ue&ee,e[47]=se^~ce&te,e[8]=k^~p&y,e[9]=S^~b&m,e[18]=B^~A&x,e[19]=C^~E&M,e[28]=z^~R&U,e[29]=H^~N&P,e[38]=$^~K&W,e[39]=Q^~V&G,e[48]=ue^~ee&re,e[49]=ce^~te&ne,e[0]^=fe[n],e[1]^=fe[n+1]};if(t)k.exports=c;else for(h=0;h":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],274:[function(e,t,r){"use strict";function o(e){return(o="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})(e)}var l=e("buffer").Buffer,f=e("underscore"),h=e("web3-utils"),n=e("@ethersproject/abi").AbiCoder,a=e("@ethersproject/abi").ParamType,d=new n(function(e,t){return!e.match(/^u?int/)||f.isArray(t)||f.isObject(t)&&"BN"===t.constructor.name?t:t.toString()});function p(){}var i=function(){};i.prototype.encodeFunctionSignature=function(e){return f.isObject(e)&&(e=h._jsonInterfaceMethodToString(e)),h.sha3(e).slice(0,10)},i.prototype.encodeEventSignature=function(e){return f.isObject(e)&&(e=h._jsonInterfaceMethodToString(e)),h.sha3(e)},i.prototype.encodeParameter=function(e,t){return this.encodeParameters([e],[t])},i.prototype.encodeParameters=function(n,e){var s=new RegExp(/^bytes([0-9]*)$/),u=new RegExp(/^bytes([0-9]*)\[\]$/),c=new RegExp(/^(u?int)([0-9]*)$/),f=new RegExp(/^(u?int)([0-9]*)\[\]$/);return e=e.map(function(e,t){var r=n[t];if("object"===o(r)&&r.type&&(r=r.type),h.isBN(e)||h.isBigNumber(e))return e.toString(10);var i=function t(r,e){if(r.match(u)||r.match(f))return e.map(function(e){return t(r.replace("[]",""),e)});var n=r.match(c);if(n){var i=parseInt(n[2]||"256");i/8=e.length)return!1;if(2!==e[4+t])return!1;var r=e[5+t];return!(0===r||6+t+r!==e.length||128&e[4]||1=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var r=e[5+t];if(0===r)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(1=t)throw new Error("invalid sig")}t.exports=function(e,t,r,n,i){var o=b(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=y[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new p(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,i=r.data.q,o=r.data.g,a=r.data.pub_key,s=b.signature.decode(e,"der"),u=s.s,c=s.r;m(u,i),m(c,i);var f=d.mont(n),l=u.invm(i);return 0===o.toRed(f).redPow(new d(t).mul(l).mod(i)).fromRed().mul(a.toRed(f).redPow(c.mul(l).mod(i)).fromRed()).mod(n).mod(i).cmp(c)}(e,t,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");t=h.concat([i,t]);for(var a=o.modulus.byteLength(),s=[1],u=0;t.length+s.length+2>>1];r=h.r28shl(r,o),n=h.r28shl(n,o),h.pc2(r,n,e.keys,i)}},s.prototype._update=function(e,t,r,n){var i=this._desState,o=h.readUInt32BE(e,t),a=h.readUInt32BE(e,t+4);h.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],h.writeUInt32BE(r,o,n),h.writeUInt32BE(r,a,n+4)},s.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,o=l}h.rip(a,o,n,i)},s.prototype._decrypt=function(e,t,r,n,i){for(var o=r,a=t,s=e.keys.length-2;0<=s;s-=2){var u=e.keys[s],c=e.keys[s+1];h.expand(o,e.tmp,0),u^=e.tmp[0],c^=e.tmp[1];var f=h.substitute(u,c),l=o;o=(a^h.permute(f))>>>0,a=l}h.rip(o,a,n,i)}},{"./cipher":330,"./utils":333,inherits:404,"minimalistic-assert":414}],332:[function(e,t,r){"use strict";var o=e("minimalistic-assert"),n=e("inherits"),i=e("./cipher"),a=e("./des");function s(e,t){o.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:n}),a.create({type:"encrypt",key:i})]:[a.create({type:"decrypt",key:i}),a.create({type:"encrypt",key:n}),a.create({type:"decrypt",key:r})]}function u(e){i.call(this,e);var t=new s(this.type,this.options.key);this._edeState=t}n(u,i),(t.exports=u).create=function(e){return new u(e)},u.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},u.prototype._pad=a.prototype._pad,u.prototype._unpad=a.prototype._unpad},{"./cipher":330,"./des":331,inherits:404,"minimalistic-assert":414}],333:[function(e,t,r){arguments[4][65][0].apply(r,arguments)},{dup:65}],334:[function(e,t,r){(function(o){"use strict";var a=e("./lib/generatePrime"),n=e("./lib/primes.json"),s=e("./lib/dh");var u={binary:!0,hex:!0,base64:!0};r.DiffieHellmanGroup=r.createDiffieHellmanGroup=r.getDiffieHellman=function(e){var t=new o(n[e].prime,"hex"),r=new o(n[e].gen,"hex");return new s(t,r)},r.createDiffieHellman=r.DiffieHellman=function e(t,r,n,i){return o.isBuffer(r)||void 0===u[r]?e(t,"binary",r,n):(r=r||"binary",i=i||"binary",n=n||new o([2]),o.isBuffer(n)||(n=new o(n,i)),"number"==typeof t?new s(a(t,n),n,!0):(o.isBuffer(t)||(t=new o(t,r)),new s(t,n,!0)))}}).call(this,e("buffer").Buffer)},{"./lib/dh":335,"./lib/generatePrime":336,"./lib/primes.json":337,buffer:50}],335:[function(b,y,e){(function(o){"use strict";var a=b("bn.js"),s=new(b("miller-rabin")),u=new a(24),c=new a(11),f=new a(10),l=new a(3),h=new a(7),d=b("./generatePrime"),e=b("randombytes");function n(e,t){return t=t||"utf8",o.isBuffer(e)||(e=new o(e,t)),this._pub=new a(e),this}function i(e,t){return t=t||"utf8",o.isBuffer(e)||(e=new o(e,t)),this._priv=new a(e),this}y.exports=t;var p={};function t(e,t,r){this.setGenerator(t),this.__prime=new a(e),this._prime=a.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=n,this.setPrivateKey=i):this._primeCode=8}function r(e,t){var r=new o(e.toArray());return t?r.toString(t):r}Object.defineProperty(t.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,t){var r=t.toString("hex"),n=[r,e.toString(16)].join("_");if(n in p)return p[n];var i,o=0;if(e.isEven()||!d.simpleSieve||!d.fermatTest(e)||!s.test(e))return o+=1,o+="02"===r||"05"===r?8:4,p[n]=o;switch(s.test(e.shrn(1))||(o+=2),r){case"02":e.mod(u).cmp(c)&&(o+=8);break;case"05":(i=e.mod(f)).cmp(l)&&i.cmp(h)&&(o+=8);break;default:o+=4}return p[n]=o}(this.__prime,this.__gen)),this._primeCode}}),t.prototype.generateKeys=function(){return this._priv||(this._priv=new a(e(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},t.prototype.computeSecret=function(e){var t=(e=(e=new a(e)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new o(t.toArray()),n=this.getPrime();if(r.length>1]):a.mixedAdd(i[-u-1>>1].neg()):0>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},o.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,a=this._wnafT2,s=this._wnafT3,u=0,c=0;c>1]:A<0&&(S=a[y][-A-1>>1].neg()),g="affine"===S.type?g.mixedAdd(S):g.add(S))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step)},a.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),u=i.redMul(a),c=o.redMul(s),f=i.redMul(s),l=a.redMul(o);return this.curve.point(u,c,l,f)},c.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(c=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),t=a.redMul(c.redSub(o)),r=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);e=n.redSub(i).redISub(o).redMul(u),t=a.redMul(c.redSub(o)),r=a.redMul(u)}}else{var c=i.redAdd(o);s=this.curve._mulC(this.z).redSqr(),u=c.redSub(s).redSub(s);e=this.curve._mulC(n.redISub(c)).redMul(u),t=this.curve._mulC(c).redMul(i.redISub(o)),r=c.redMul(u)}return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(t),c=o.redMul(a),f=s.redMul(u),l=o.redMul(u),h=a.redMul(s);return this.curve.point(c,f,h,l)},c.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),l=n.redMul(u).redMul(f);return r=this.curve.twisted?(t=n.redMul(c).redMul(a.redSub(this.curve._mulA(o))),u.redMul(c)):(t=n.redMul(c).redMul(a.redSub(o)),this.curve._mulC(u).redMul(c)),this.curve.point(l,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),0<=r.cmp(this.curve.p))return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},{"../utils":352,"./base":339,"bn.js":291,inherits:404}],341:[function(e,t,r){arguments[4][73][0].apply(r,arguments)},{"./base":339,"./edwards":340,"./mont":342,"./short":343,dup:73}],342:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("inherits"),o=e("./base"),a=e("../utils");function s(e){o.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),(t.exports=s).prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},s.prototype.point=function(e,t){return new u(this,e,t)},s.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;0<=o;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../utils":352,"./base":339,"bn.js":291,inherits:404}],343:[function(e,t,r){"use strict";var n=e("../utils"),_=e("bn.js"),i=e("inherits"),o=e("./base"),a=n.assert;function s(e){o.call(this,"short",e),this.a=new _(e.a,16).toRed(this.red),this.b=new _(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,n){o.BasePoint.call(this,e,"affine"),this.inf=null===t&&null===r?(this.x=null,!(this.y=null)):(this.x=new _(t,16),this.y=new _(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),!1)}function c(e,t,r,n){o.BasePoint.call(this,e,"jacobian"),this.z=null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,new _(0)):(this.x=new _(t,16),this.y=new _(r,16),new _(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}i(s,o),(t.exports=s).prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new _(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new _(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new _(e.a,16),b:new _(e.b,16)}}):this._getEndoBasis(r)}}},s.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:_.mont(e),r=new _(2).toRed(t).redInvm(),n=r.redNeg(),i=new _(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},s.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,a,s,u,c,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,h=this.n.clone(),d=new _(1),p=new _(0),b=new _(0),y=new _(1),m=0;0!==l.cmpn(0);){var v=h.div(l);u=h.sub(v.mul(l)),c=b.sub(v.mul(d));var g=y.sub(v.mul(p));if(!n&&u.cmp(f)<0)t=s.neg(),r=d,n=u.neg(),i=c;else if(n&&2==++m)break;h=l,l=s=u,b=d,d=c,y=p,p=g}o=u.neg(),a=c;var w=n.sqr().add(i.sqr());return 0<=o.sqr().add(a.sqr()).cmp(w)&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},s.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:u.add(c).neg()}},s.prototype.pointFromX=function(e,t){(e=new _(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},s.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},s.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new _(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},i(c,o.BasePoint),s.prototype.jpoint=function(e,t,r){return new c(this,e,t,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),f=c.redMul(s),l=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(l).redISub(l),d=u.redMul(l.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,d,p)},c.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),f=r.redMul(u),l=s.redSqr().redIAdd(c).redISub(f).redISub(f),h=s.redMul(f.redISub(l)).redISub(i.redMul(c)),d=this.z.redMul(a);return this.curve.jpoint(l,h,d)},c.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":352,"./base":339,"bn.js":291,inherits:404}],344:[function(e,t,r){"use strict";var n,i=r,o=e("hash.js"),a=e("./curve"),s=e("./utils").assert;function u(e){"short"===e.type?this.curve=new a.short(e):"edwards"===e.type?this.curve=new a.edwards(e):this.curve=new a.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,r){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var e=new u(r);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:e}),e}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":341,"./precomputed/secp256k1":351,"./utils":352,"hash.js":391}],345:[function(e,t,r){"use strict";function y(e){return(y="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})(e)}var m=e("bn.js"),v=e("hmac-drbg"),n=e("../utils"),i=e("../curves"),o=e("brorand"),d=n.assert,a=e("./key"),g=e("./signature");function s(e){if(!(this instanceof s))return new s(e);"string"==typeof e&&(d(i.hasOwnProperty(e),"Unknown curve "+e),e=i[e]),e instanceof i.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}(t.exports=s).prototype.keyPair=function(e){return new a(this,e)},s.prototype.keyFromPrivate=function(e,t){return a.fromPrivate(this,e,t)},s.prototype.keyFromPublic=function(e,t){return a.fromPublic(this,e,t)},s.prototype.genKeyPair=function(e){e||(e={});for(var t=new v({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new m(2));;){var i=new m(t.generate(r));if(!(0>1;if(0<=a.cmp(this.curve.p.umod(this.curve.n))&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=t.r.invm(i),l=i.sub(o).mul(f).umod(i),h=s.mul(f).umod(i);return this.g.mulAdd(l,a,h)},s.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new g(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":344,"../utils":352,"./key":346,"./signature":347,"bn.js":291,brorand:292,"hmac-drbg":403}],346:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("../utils").assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}(t.exports=o).fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},{"../utils":352,"bn.js":291}],347:[function(e,t,r){"use strict";var s=e("bn.js"),u=e("../utils"),n=u.assert;function i(e,t){if(e instanceof i)return e;this._importDER(e,t)||(n(e.r&&e.s,"Signature without r or s"),this.r=new s(e.r,16),this.s=new s(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function c(){this.place=0}function f(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,a=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}(t.exports=i).prototype._importDER=function(e,t){e=u.toArray(e,t);var r=new c;if(48!==e[r.place++])return!1;if(f(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=f(e,r),i=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=f(e,r);if(e.length!==o+r.place)return!1;var a=e.slice(r.place,o+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===a[0]&&128&a[1]&&(a=a.slice(1)),this.r=new s(i),this.s=new s(a),!(this.recoveryParam=null)},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=a(t),r=a(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];l(n,t.length),(n=n.concat(t)).push(2),l(n,r.length);var i=n.concat(r),o=[48];return l(o,i.length),o=o.concat(i),u.encode(o,e)}},{"../utils":352,"bn.js":291}],348:[function(e,t,r){"use strict";var n=e("hash.js"),i=e("../curves"),o=e("../utils"),a=o.assert,u=o.parseBytes,s=e("./key"),c=e("./signature");function f(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);e=i[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}(t.exports=f).prototype.sign=function(e,t){e=u(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},f.prototype.verify=function(e,t,r){e=u(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t>1)-1>1)-u:u,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n=0,i=0;0>6|192);else{if(55295>18|240),r+=t(i>>12&63|128)}else r+=t(i>>12|224);r+=t(i>>6&63|128)}r+=t(63&i|128)}}return r},toString:function(e){for(var t="",r=0,n=a(e);r>10|55296),t+=String.fromCharCode(1023&i|56320)}}return t},fromNumber:function(e){var t=e.toString(16);return t.length%2==0?"0x"+t:"0x0"+t},toNumber:function(e){return parseInt(e.slice(2),16)},fromNat:function(e){return"0x0"===e?"0x":e.length%2==0?e:"0x0"+e.slice(2)},toNat:function(e){return"0"===e[2]?"0x"+e.slice(3):e},fromArray:n,toArray:r,fromUint8Array:function(e){return n([].slice.call(e,0))},toUint8Array:function(e){return new Uint8Array(r(e))}}},{"./array.js":355}],357:[function(e,t,r){"use strict";var p="0123456789abcdef".split(""),b=[1,256,65536,16777216],y=[0,8,16,24],fe=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],m=function(e){var t,r,n,i,o,a,s,u,c,f,l,h,d,p,b,y,m,v,g,w,_,k,S,A,E,x,M,j,I,O,T,B,C,R,N,U,P,L,F,D,q,z,H,K,V,W,G,Y,X,J,Z,$,Q,ee,te,re,ne,ie,oe,ae,se,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|l>>>31),r=s^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(h<<1|d>>>31),r=c^(d<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,N=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,U=e[14]<<6|e[15]>>>26,P=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,C=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,E=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,M=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=b^~m&g,e[10]=A^~x&j,e[11]=E^~M&I,e[20]=R^~U&L,e[21]=N^~P&F,e[30]=K^~W&Y,e[31]=V^~G&X,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=y^~v&w,e[3]=m^~g&_,e[12]=x^~j&O,e[13]=M^~I&T,e[22]=U^~L&D,e[23]=P^~F&q,e[32]=W^~Y&J,e[33]=G^~X&Z,e[42]=re^~ie&ae,e[43]=ne^~oe&se,e[4]=v^~w&k,e[5]=g^~_&S,e[14]=j^~O&B,e[15]=I^~T&C,e[24]=L^~D&z,e[25]=F^~q&H,e[34]=Y^~J&$,e[35]=X^~Z&Q,e[44]=ie^~ae&ue,e[45]=oe^~se&ce,e[6]=w^~k&p,e[7]=_^~S&b,e[16]=O^~B&A,e[17]=T^~C&E,e[26]=D^~z&R,e[27]=q^~H&N,e[36]=J^~$&K,e[37]=Z^~Q&V,e[46]=ae^~ue&ee,e[47]=se^~ce&te,e[8]=k^~p&y,e[9]=S^~b&m,e[18]=B^~A&x,e[19]=C^~E&M,e[28]=z^~R&U,e[29]=H^~N&P,e[38]=$^~K&W,e[39]=Q^~V&G,e[48]=ue^~ee&re,e[49]=ce^~te&ne,e[0]^=fe[n],e[1]^=fe[n+1]},n=function(a){return function(e){var t,r,n;if("0x"===e.slice(0,2)){t=[];for(var i=2,o=e.length;i>2]|=t[c]<>2]|=r<>2]|=(192|r>>6)<>2]|=(224|r>>12)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=b[3&h],e.lastByteIndex===o)for(i[0]=i[a],h=1;h>4&15]+p[15&f]+p[f>>12&15]+p[f>>8&15]+p[f>>20&15]+p[f>>16&15]+p[f>>28&15]+p[f>>24&15];d%a==0&&(m(u),h=0)}return"0x"+l}({blocks:[],reset:!0,block:0,start:0,blockCount:1600-((r=a)<<1)>>5,outputBlocks:r>>5,s:(n=[0,0,0,0,0,0,0,0,0,0],[].concat(n,n,n,n,n))},t)}};t.exports={keccak256:n(256),keccak512:n(512),keccak256s:n(256),keccak512s:n(512)}},{}],358:[function(e,t,r){"use strict";var n=e("bn.js"),i=e("./bytes"),o=function(e){return new n(e.slice(2),16)},a=function(e){var t="0x"+("0x"===e.slice(0,2)?new n(e.slice(2),16):new n(e,10)).toString("hex");return"0x0"===t?"0x":t},s=function(e){return"string"==typeof e?/^0x/.test(e)?e:"0x"+e:"0x"+new n(e).toString("hex")},u=function(e){return o(e).toNumber()},c=function(r){return function(e,t){return"0x"+o(e)[r](o(t)).toString("hex")}},f=c("add"),l=c("mul"),h=c("div"),d=c("sub");t.exports={toString:function(e){return o(e).toString(10)},fromString:a,toNumber:u,fromNumber:s,toEther:function(e){return u(h(e,a("10000000000")))/1e8},fromEther:function(e){return l(s(Math.floor(1e8*e)),a("10000000000"))},toUint256:function(e){return i.pad(32,e)},add:f,mul:l,div:h,sub:d}},{"./bytes":356,"bn.js":291}],359:[function(e,t,r){"use strict";t.exports={encode:function(e){var r=function(e){return(t=e.toString(16)).length%2==0?t:"0"+t;var t},i=function(e,t){return e<56?r(t+e):r(t+r(e).length/2+55)+r(e)};return"0x"+function e(t){if("string"==typeof t){var r=t.slice(2);return(2!=r.length||"80"<=r?i(r.length/2,128):"")+r}var n=t.map(e).join("");return i(n.length/2,192)+n}(e)},decode:function(t){var r=2,n=function(){if(r>=t.length)throw"";var e=t.slice(r,r+2);return e<"80"?(r+=2,"0x"+e):e<"c0"?o():a()},i=function(){var e=parseInt(t.slice(r,r+=2),16)%64;return e<56?e:parseInt(t.slice(r,r+=2*(e-55)),16)},o=function(){var e=i();return"0x"+t.slice(r,r+=2*e)},a=function(){for(var e=2*i()+r,t=[];r=2*this.getChainId()+35&&this._common.gteHardfork("spuriousDragon");this._senderPubKey=o.ecrecover(e,t,this.r,this.s,r?this.getChainId():void 0)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function(e){this.v=new s.Buffer([]),this.s=new s.Buffer([]),this.r=new s.Buffer([]);var t=this.hash(!1),r=o.ecsign(t,e);this._implementsEIP155()&&(r.v+=2*this.getChainId()+8),Object.assign(this,r)},e.prototype.getDataFee=function(){for(var e=this.raw[5],t=new o.BN(0),r=0;r=e.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===e.length||!t.length||a(t.length===e.length,"The field "+t.name+" must have byte length of "+t.length),i.raw[r]=e}i._fields.push(t.name),Object.defineProperty(i,t.name,{enumerable:!0,configurable:!0,get:e,set:n}),t.default&&(i[t.name]=t.default),t.alias&&Object.defineProperty(i,t.alias,{enumerable:!1,configurable:!0,set:n,get:e})}),t)if("string"==typeof t&&(t=o.from(s.stripHexPrefix(t),"hex")),o.isBuffer(t)&&(t=u.decode(t)),Array.isArray(t)){if(t.length>i._fields.length)throw new Error("wrong number of fields in data");t.forEach(function(e,t){i[i._fields[t]]=c.toBuffer(e)})}else{if("object"!==n(t))throw new Error("invalid data");var r=Object.keys(t);e.forEach(function(e){-1!==r.indexOf(e.name)&&(i[e.name]=t[e.name]),-1!==r.indexOf(e.alias)&&(i[e.alias]=t[e.alias])})}}}).call(this,e("buffer").Buffer)},{"./bytes":382,assert:15,buffer:50,"ethjs-util":388,rlp:435}],387:[function(e,t,n){(function(u){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var c=e("secp256k1"),f=e("bn.js"),l=e("./bytes"),r=e("./hash");function h(e,t){return t?e-(2*t+35):e-27}function d(e){return 0===e||1===e}n.ecsign=function(e,t,r){var n=c.sign(e,t),i=n.recovery;return{r:n.signature.slice(0,32),s:n.signature.slice(32,64),v:r?i+(2*r+35):i+27}},n.ecrecover=function(e,t,r,n,i){var o=u.concat([l.setLength(r,32),l.setLength(n,32)],64),a=h(t,i);if(!d(a))throw new Error("Invalid signature v value");var s=c.recover(e,o,a);return c.publicKeyConvert(s,!1).slice(1)},n.toRpcSig=function(e,t,r,n){if(!d(h(e,n)))throw new Error("Invalid signature v value");return l.bufferToHex(u.concat([l.setLengthLeft(t,32),l.setLengthLeft(r,32),l.toBuffer(e)]))},n.fromRpcSig=function(e){var t=l.toBuffer(e);if(65!==t.length)throw new Error("Invalid signature length");var r=t[64];return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},n.isValidSignature=function(e,t,r,n,i){void 0===n&&(n=!0);var o=new f("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),a=new f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!d(h(e,i)))return!1;var s=new f(t),u=new f(r);return!(s.isZero()||s.gt(a)||u.isZero()||u.gt(a))&&(!n||1!==u.cmp(o))},n.hashPersonalMessage=function(e){var t=u.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return r.keccak(u.concat([t,e]))}}).call(this,e("buffer").Buffer)},{"./bytes":382,"./hash":384,"bn.js":291,buffer:50,secp256k1:441}],388:[function(o,s,e){(function(r){"use strict";function a(e){return(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})(e)}var e=o("is-hex-prefixed"),t=o("strip-hex-prefix");function n(e){var t=e;if("string"!=typeof t)throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+a(t)+", while padToEven.");return t.length%2&&(t="0"+t),t}function i(e){return"0x"+e.toString(16)}s.exports={arrayContainsArray:function(t,e,r){if(!0!==Array.isArray(t))throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+a(t)+"'");if(!0!==Array.isArray(e))throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+a(e)+"'");return e[Boolean(r)?"some":"every"](function(e){return 0<=t.indexOf(e)})},intToBuffer:function(e){var t=i(e);return new r(n(t.slice(2)),"hex")},getBinarySize:function(e){if("string"!=typeof e)throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+a(e)+"'.");return r.byteLength(e,"utf8")},isHexPrefixed:e,stripHexPrefix:t,padToEven:n,intToHex:i,fromAscii:function(e){for(var t="",r=0;r>>31),d=l^(o<<1|i>>>31),p=e[0]^h,b=e[1]^d,y=e[10]^h,m=e[11]^d,v=e[20]^h,g=e[21]^d,w=e[30]^h,_=e[31]^d,k=e[40]^h,S=e[41]^d;h=r^(a<<1|s>>>31),d=n^(s<<1|a>>>31);var A=e[2]^h,E=e[3]^d,x=e[12]^h,M=e[13]^d,j=e[22]^h,I=e[23]^d,O=e[32]^h,T=e[33]^d,B=e[42]^h,C=e[43]^d;h=i^(u<<1|c>>>31),d=o^(c<<1|u>>>31);var R=e[4]^h,N=e[5]^d,U=e[14]^h,P=e[15]^d,L=e[24]^h,F=e[25]^d,D=e[34]^h,q=e[35]^d,z=e[44]^h,H=e[45]^d;h=a^(f<<1|l>>>31),d=s^(l<<1|f>>>31);var K=e[6]^h,V=e[7]^d,W=e[16]^h,G=e[17]^d,Y=e[26]^h,X=e[27]^d,J=e[36]^h,Z=e[37]^d,$=e[46]^h,Q=e[47]^d;h=u^(r<<1|n>>>31),d=c^(n<<1|r>>>31);var ee=e[8]^h,te=e[9]^d,re=e[18]^h,ne=e[19]^d,ie=e[28]^h,oe=e[29]^d,ae=e[38]^h,se=e[39]^d,ue=e[48]^h,ce=e[49]^d,fe=p,le=b,he=m<<4|y>>>28,de=y<<4|m>>>28,pe=v<<3|g>>>29,be=g<<3|v>>>29,ye=_<<9|w>>>23,me=w<<9|_>>>23,ve=k<<18|S>>>14,ge=S<<18|k>>>14,we=A<<1|E>>>31,_e=E<<1|A>>>31,ke=M<<12|x>>>20,Se=x<<12|M>>>20,Ae=j<<10|I>>>22,Ee=I<<10|j>>>22,xe=T<<13|O>>>19,Me=O<<13|T>>>19,je=B<<2|C>>>30,Ie=C<<2|B>>>30,Oe=N<<30|R>>>2,Te=R<<30|N>>>2,Be=U<<6|P>>>26,Ce=P<<6|U>>>26,Re=F<<11|L>>>21,Ne=L<<11|F>>>21,Ue=D<<15|q>>>17,Pe=q<<15|D>>>17,Le=H<<29|z>>>3,Fe=z<<29|H>>>3,De=K<<28|V>>>4,qe=V<<28|K>>>4,ze=G<<23|W>>>9,He=W<<23|G>>>9,Ke=Y<<25|X>>>7,Ve=X<<25|Y>>>7,We=J<<21|Z>>>11,Ge=Z<<21|J>>>11,Ye=Q<<24|$>>>8,Xe=$<<24|Q>>>8,Je=ee<<27|te>>>5,Ze=te<<27|ee>>>5,$e=re<<20|ne>>>12,Qe=ne<<20|re>>>12,et=oe<<7|ie>>>25,tt=ie<<7|oe>>>25,rt=ae<<8|se>>>24,nt=se<<8|ae>>>24,it=ue<<14|ce>>>18,ot=ce<<14|ue>>>18;e[0]=fe^~ke&Re,e[1]=le^~Se&Ne,e[10]=De^~$e&pe,e[11]=qe^~Qe&be,e[20]=we^~Be&Ke,e[21]=_e^~Ce&Ve,e[30]=Je^~he&Ae,e[31]=Ze^~de&Ee,e[40]=Oe^~ze&et,e[41]=Te^~He&tt,e[2]=ke^~Re&We,e[3]=Se^~Ne&Ge,e[12]=$e^~pe&xe,e[13]=Qe^~be&Me,e[22]=Be^~Ke&rt,e[23]=Ce^~Ve&nt,e[32]=he^~Ae&Ue,e[33]=de^~Ee&Pe,e[42]=ze^~et&ye,e[43]=He^~tt&me,e[4]=Re^~We&it,e[5]=Ne^~Ge&ot,e[14]=pe^~xe&Le,e[15]=be^~Me&Fe,e[24]=Ke^~rt&ve,e[25]=Ve^~nt&ge,e[34]=Ae^~Ue&Ye,e[35]=Ee^~Pe&Xe,e[44]=et^~ye&je,e[45]=tt^~me&Ie,e[6]=We^~it&fe,e[7]=Ge^~ot&le,e[16]=xe^~Le&De,e[17]=Me^~Fe&qe,e[26]=rt^~ve&we,e[27]=nt^~ge&_e,e[36]=Ue^~Ye&Je,e[37]=Pe^~Xe&Ze,e[46]=ye^~je&Oe,e[47]=me^~Ie&Te,e[8]=it^~fe&ke,e[9]=ot^~le&Se,e[18]=Le^~De&$e,e[19]=Fe^~qe&Qe,e[28]=ve^~we&Be,e[29]=ge^~_e&Ce,e[38]=Ye^~Je&he,e[39]=Xe^~Ze&de,e[48]=je^~Oe&ze,e[49]=Ie^~Te&He,e[0]^=at[2*t],e[1]^=at[2*t+1]}}},{}],411:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=e("./keccak-state-unroll");function o(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}o.prototype.initialize=function(e,t){for(var r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},o.prototype.absorb=function(e){for(var t=0;t>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(i.p1600(this.state),this.count=0);return t},o.prototype.copy=function(e){for(var t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},t.exports=o},{"./keccak-state-unroll":410,"safe-buffer":436}],412:[function(e,t,r){arguments[4][107][0].apply(r,arguments)},{dup:107,"hash-base":390,inherits:404,"safe-buffer":436}],413:[function(e,t,r){arguments[4][108][0].apply(r,arguments)},{"bn.js":291,brorand:292,dup:108}],414:[function(e,t,r){arguments[4][109][0].apply(r,arguments)},{dup:109}],415:[function(e,t,r){arguments[4][110][0].apply(r,arguments)},{dup:110}],416:[function(e,t,r){arguments[4][113][0].apply(r,arguments)},{dup:113}],417:[function(e,t,r){arguments[4][114][0].apply(r,arguments)},{"./certificate":418,"asn1.js":276,dup:114}],418:[function(e,t,r){arguments[4][115][0].apply(r,arguments)},{"asn1.js":276,dup:115}],419:[function(e,t,r){arguments[4][116][0].apply(r,arguments)},{"browserify-aes":295,dup:116,evp_bytestokey:389,"safe-buffer":436}],420:[function(e,t,r){arguments[4][117][0].apply(r,arguments)},{"./aesid.json":416,"./asn1":417,"./fixProc":419,"browserify-aes":295,dup:117,pbkdf2:421,"safe-buffer":436}],421:[function(e,t,r){arguments[4][118][0].apply(r,arguments)},{"./lib/async":422,"./lib/sync":425,dup:118}],422:[function(e,t,r){(function(c,f){"use strict";var l,h=e("./precondition"),d=e("./default-encoding"),p=e("./sync"),b=e("safe-buffer").Buffer,y=f.crypto&&f.crypto.subtle,m={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},v=[];function g(e,t,r,n,i){return y.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(e){return y.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:i}},e,n<<3)}).then(function(e){return b.from(e)})}t.exports=function(t,r,n,i,o,a){"function"==typeof o&&(a=o,o=void 0);var e,s,u=m[(o=o||"sha1").toLowerCase()];if(!u||"function"!=typeof f.Promise)return c.nextTick(function(){var e;try{e=p(t,r,n,i,o)}catch(e){return a(e)}a(null,e)});if(h(t,r,n,i),"function"!=typeof a)throw new Error("No callback provided to pbkdf2");b.isBuffer(t)||(t=b.from(t,d)),b.isBuffer(r)||(r=b.from(r,d)),e=function(e){if(f.process&&!f.process.browser)return Promise.resolve(!1);if(!y||!y.importKey||!y.deriveBits)return Promise.resolve(!1);if(void 0!==v[e])return v[e];var t=g(l=l||b.alloc(8),l,10,128,e).then(function(){return!0}).catch(function(){return!1});return v[e]=t}(u).then(function(e){return e?g(t,r,n,i,u):p(t,r,n,i,o)}),s=a,e.then(function(e){c.nextTick(function(){s(null,e)})},function(e){c.nextTick(function(){s(e)})})}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-encoding":423,"./precondition":424,"./sync":425,_process:124,"safe-buffer":436}],423:[function(e,r,t){(function(e){"use strict";var t;e.browser?t="utf-8":t=6<=parseInt(e.version.split(".")[0].slice(1),10)?"utf-8":"binary";r.exports=t}).call(this,e("_process"))},{_process:124}],424:[function(e,t,r){(function(r){"use strict";var i=Math.pow(2,30)-1;function o(e,t){if("string"!=typeof e&&!r.isBuffer(e))throw new TypeError(t+" must be a buffer or string")}t.exports=function(e,t,r,n){if(o(e,"Password"),o(t,"Salt"),"number"!=typeof r)throw new TypeError("Iterations not a number");if(r<0)throw new TypeError("Bad iterations");if("number"!=typeof n)throw new TypeError("Key length not a number");if(n<0||it.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(o=t.slice(n,c)).length)throw new Error("invalid rlp, List has a invalid length");for(;o.length;)a=e(o),s.push(a.data),o=a.remainder;return{data:s,remainder:t.slice(c)}}(u(e));if(t)return r;if(0!==r.remainder.length)throw new Error("invalid remainder");return r.data},r.getLength=function(e){if(!e||0===e.length)return f.from([]);var t=u(e),r=t[0];if(r<=127)return t.length;if(r<=183)return r-127;if(r<=191)return r-182;if(r<=247)return r-191;var n=r-246;return n+l(t.slice(1,n).toString("hex"),16)}}).call(this,e("buffer").Buffer)},{"bn.js":291,buffer:50}],436:[function(e,t,r){arguments[4][183][0].apply(r,arguments)},{buffer:50,dup:183}],437:[function(e,t,r){"use strict";var n=e("./scryptSync");n.async=e("./scrypt"),t.exports=n},{"./scrypt":438,"./scryptSync":439}],438:[function(e,t,r){"use strict";function u(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}var v=e("crypto"),n=e("./utils"),g=n.checkAndInit,w=n.smix;function c(){var s;return s=regeneratorRuntime.mark(function e(t,r,n,i,o,a,s,u){var c,f,l,h,d,p,b,y,m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:c=g(t,r,n,i,o,a,s),f=c.XY,l=c.V,h=c.B32,d=c.x,p=c._X,b=c.B,y=c.tickCallback,m=0;case 2:if(m>>32-t}function c(e,t,r){var n;for(n=0;n<16;n++)t[n]=(255&e[4*n+0])<<0,t[n]|=(255&e[4*n+1])<<8,t[n]|=(255&e[4*n+2])<<16,t[n]|=(255&e[4*n+3])<<24;for(f(t,0,r,0,16),n=8;0>0&255,e[i+1]=t[n]>>8&255,e[i+2]=t[n]>>16&255,e[i+3]=t[n]>>24&255}}function _(e,t,r,n,i){for(var o=0;o 0 and a power of 2");if(2147483647/128/n":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],457:[function(e,t,r){"use strict";var n=e("./v1"),i=e("./v4"),o=i;o.v1=n,o.v4=i,t.exports=o},{"./v1":460,"./v4":461}],458:[function(e,t,r){"use strict";for(var i=[],n=0;n<256;++n)i[n]=(n+256).toString(16).substr(1);t.exports=function(e,t){var r=t||0,n=i;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}},{}],459:[function(e,t,r){"use strict";var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var i=new Uint8Array(16);t.exports=function(){return n(i),i}}else{var o=new Array(16);t.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},{}],460:[function(e,t,r){"use strict";var p,b,y=e("./lib/rng"),m=e("./lib/bytesToUuid"),v=0,g=0;t.exports=function(e,t,r){var n=t&&r||0,i=t||[],o=(e=e||{}).node||p,a=void 0!==e.clockseq?e.clockseq:b;if(null==o||null==a){var s=y();null==o&&(o=p=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=b=16383&(s[6]<<8|s[7]))}var u=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:g+1,f=u-v+(c-g)/1e4;if(f<0&&void 0===e.clockseq&&(a=a+1&16383),(f<0||v>>24&255,i[n++]=l>>>16&255,i[n++]=l>>>8&255,i[n++]=255&l;var h=u/4294967296*1e4&268435455;i[n++]=h>>>8&255,i[n++]=255&h,i[n++]=h>>>24&15|16,i[n++]=h>>>16&255,i[n++]=a>>>8|128,i[n++]=255&a;for(var d=0;d<6;++d)i[n+d]=o[d];return t||m(i)}},{"./lib/bytesToUuid":458,"./lib/rng":459}],461:[function(e,t,r){"use strict";var a=e("./lib/rng"),s=e("./lib/bytesToUuid");t.exports=function(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||a)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var o=0;o<16;++o)t[n+o]=i[o];return t||s(i)}},{"./lib/bytesToUuid":458,"./lib/rng":459}],462:[function(a,l,e){(function(e,h){"use strict";var d=a("underscore"),r=a("web3-core"),n=a("web3-core-method"),s=a("eth-lib/lib/account"),u=a("eth-lib/lib/hash"),c=a("eth-lib/lib/rlp"),f=a("eth-lib/lib/bytes"),p=a(void 0===e?"crypto-browserify":"crypto"),b=a("@web3-js/scrypt-shim"),y=a("uuid"),m=a("web3-utils"),v=a("web3-core-helpers"),g=a("ethereumjs-tx").Transaction,w=a("ethereumjs-common").default,i=function(e){return d.isUndefined(e)||d.isNull(e)},t=function(){var t=this;r.packageInit(this,arguments),delete this.BatchRequest,delete this.extend;var e=[new n({name:"getNetworkId",call:"net_version",params:0,outputFormatter:parseInt}),new n({name:"getChainId",call:"eth_chainId",params:0,outputFormatter:m.hexToNumber}),new n({name:"getGasPrice",call:"eth_gasPrice",params:0}),new n({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[function(e){if(m.isAddress(e))return e;throw new Error("Address "+e+' is not a valid address to get the "transactionCount".')},function(){return"latest"}]})];this._ethereumCall={},d.each(e,function(e){e.attachToObject(t._ethereumCall),e.setRequestManager(t._requestManager)}),this.wallet=new o(this)};function o(e){this._accounts=e,this.length=0,this.defaultKeyName="web3js_wallet"}t.prototype._addAccountFunctions=function(r){var n=this;return r.signTransaction=function(e,t){return n.signTransaction(e,r.privateKey,t)},r.sign=function(e){return n.sign(e,r.privateKey)},r.encrypt=function(e,t){return n.encrypt(r.privateKey,e,t)},r},t.prototype.create=function(e){return this._addAccountFunctions(s.create(e||m.randomHex(32)))},t.prototype.privateKeyToAccount=function(e,t){if(e.startsWith("0x")||(e="0x"+e),!t&&66!==e.length)throw new Error("Private key must be 32 bytes long");return this._addAccountFunctions(s.fromPrivate(e))},t.prototype.signTransaction=function(t,s,u){var c=!1,f={},l=!(!t||!(t.chain&&t.hardfork||t.common));if(u=u||function(){},!t)return c=new Error("No transaction object given!"),u(c),Promise.reject(c);function r(e){if(e.common&&e.chain&&e.hardfork&&(c=new Error("Please provide the ethereumjs-common object or the chain and hardfork property but not all together.")),(e.chain&&!e.hardfork||e.hardfork&&!e.chain)&&(c=new Error('When specifying chain and hardfork, both values must be defined. Received "chain": '+e.chain+', "hardfork": '+e.hardfork)),e.gas||e.gasLimit||(c=new Error('"gas" is missing')),(e.nonce<0||e.gas<0||e.gasPrice<0||e.chainId<0)&&(c=new Error("Gas, gasPrice, nonce or chainId is lower than 0")),c)return u(c),Promise.reject(c);try{var t=v.formatters.inputCallFormatter(d.clone(e));t.to=t.to||"0x",t.data=t.data||"0x",t.value=t.value||"0x",t.chainId=m.numberToHex(t.chainId),l?(t.common&&(f.common=w.forCustomChain(t.common.baseChain||"mainnet",{name:t.common.customChain.name||"custom-network",networkId:t.common.customChain.networkId,chainId:t.common.customChain.chainId},t.common.hardfork||"petersburg"),delete t.common),t.chain&&(f.chain=t.chain,delete t.chain),t.hardfork&&(f.hardfork=t.hardfork,delete t.hardfork)):(f.common=w.forCustomChain("mainnet",{name:"custom-network",networkId:t.networkId,chainId:t.chainId},"petersburg"),delete t.networkId),s.startsWith("0x")&&(s=s.substring(2));var r=new g(t,f);r.sign(h.from(s,"hex"));var n=r.validate(!0);if(""!==n)throw new Error("Signer Error: "+n);var i="0x"+r.serialize().toString("hex"),o=m.keccak256(i),a={messageHash:"0x"+h.from(r.hash(!1)).toString("hex"),v:"0x"+h.from(r.v).toString("hex"),r:"0x"+h.from(r.r).toString("hex"),s:"0x"+h.from(r.s).toString("hex"),rawTransaction:i,transactionHash:o};return u(null,a),a}catch(e){return u(e),Promise.reject(e)}}return void 0!==t.nonce&&void 0!==t.chainId&&void 0!==t.gasPrice&&l?Promise.resolve(r(t)):Promise.all([i(t.chainId)?this._ethereumCall.getChainId():t.chainId,i(t.gasPrice)?this._ethereumCall.getGasPrice():t.gasPrice,i(t.nonce)?this._ethereumCall.getTransactionCount(this.privateKeyToAccount(s).address):t.nonce,i(l)?this._ethereumCall.getNetworkId():1]).then(function(e){if(i(e[0])||i(e[1])||i(e[2])||i(e[3]))throw new Error('One of the values "chainId", "networkId", "gasPrice", or "nonce" couldn\'t be fetched: '+JSON.stringify(e));return r(d.extend(t,{chainId:e[0],gasPrice:e[1],nonce:e[2],networkId:e[3]}))})},t.prototype.recoverTransaction=function(e){var t=c.decode(e),r=s.encodeSignature(t.slice(6,9)),n=f.toNumber(t[6]),i=n<35?[]:[f.fromNumber(n-35>>1),"0x","0x"],o=t.slice(0,6).concat(i),a=c.encode(o);return s.recover(u.keccak256(a),r)},t.prototype.hashMessage=function(e){var t=m.isHexStrict(e)?m.hexToBytes(e):e,r=h.from(t),n="Ethereum Signed Message:\n"+t.length,i=h.from(n),o=h.concat([i,r]);return u.keccak256s(o)},t.prototype.sign=function(e,t){if(t.startsWith("0x")||(t="0x"+t),66!==t.length)throw new Error("Private key must be 32 bytes long");var r=this.hashMessage(e),n=s.sign(r,t),i=s.decodeSignature(n);return{message:e,messageHash:r,v:i[0],r:i[1],s:i[2],signature:n}},t.prototype.recover=function(e,t,r){var n=[].slice.apply(arguments);return d.isObject(e)?this.recover(e.messageHash,s.encodeSignature([e.v,e.r,e.s]),!0):(r||(e=this.hashMessage(e)),4<=n.length?(r=n.slice(-1)[0],r=!!d.isBoolean(r)&&!!r,this.recover(e,s.encodeSignature(n.slice(1,4)),r)):s.recover(e,t))},t.prototype.decrypt=function(e,t,r){if(!d.isString(t))throw new Error("No password given.");var n,i,o=d.isObject(e)?e:JSON.parse(r?e.toLowerCase():e);if(3!==o.version)throw new Error("Not a valid V3 wallet");if("scrypt"===o.crypto.kdf)i=o.crypto.kdfparams,n=b(h.from(t),h.from(i.salt,"hex"),i.n,i.r,i.p,i.dklen);else{if("pbkdf2"!==o.crypto.kdf)throw new Error("Unsupported key derivation scheme");if("hmac-sha256"!==(i=o.crypto.kdfparams).prf)throw new Error("Unsupported parameters to PBKDF2");n=p.pbkdf2Sync(h.from(t),h.from(i.salt,"hex"),i.c,i.dklen,"sha256")}var a=h.from(o.crypto.ciphertext,"hex");if(m.sha3(h.concat([n.slice(16,32),a])).replace("0x","")!==o.crypto.mac)throw new Error("Key derivation failed - possibly wrong password");var s=p.createDecipheriv(o.crypto.cipher,n.slice(0,16),h.from(o.crypto.cipherparams.iv,"hex")),u="0x"+h.concat([s.update(a),s.final()]).toString("hex");return this.privateKeyToAccount(u,!0)},t.prototype.encrypt=function(e,t,r){var n,i=this.privateKeyToAccount(e,!0),o=(r=r||{}).salt||p.randomBytes(32),a=r.iv||p.randomBytes(16),s=r.kdf||"scrypt",u={dklen:r.dklen||32,salt:o.toString("hex")};if("pbkdf2"===s)u.c=r.c||262144,u.prf="hmac-sha256",n=p.pbkdf2Sync(h.from(t),h.from(u.salt,"hex"),u.c,u.dklen,"sha256");else{if("scrypt"!==s)throw new Error("Unsupported kdf");u.n=r.n||8192,u.r=r.r||8,u.p=r.p||1,n=b(h.from(t),h.from(u.salt,"hex"),u.n,u.r,u.p,u.dklen)}var c=p.createCipheriv(r.cipher||"aes-128-ctr",n.slice(0,16),a);if(!c)throw new Error("Unsupported cipher");var f=h.concat([c.update(h.from(i.privateKey.replace("0x",""),"hex")),c.final()]),l=m.sha3(h.concat([n.slice(16,32),h.from(f,"hex")])).replace("0x","");return{version:3,id:y.v4({random:r.uuid||p.randomBytes(16)}),address:i.address.toLowerCase().replace("0x",""),crypto:{ciphertext:f.toString("hex"),cipherparams:{iv:a.toString("hex")},cipher:r.cipher||"aes-128-ctr",kdf:s,kdfparams:u,mac:l.toString("hex")}}},o.prototype._findSafeIndex=function(e){return e=e||0,d.has(this,e)?this._findSafeIndex(e+1):e},o.prototype._currentIndexes=function(){return Object.keys(this).map(function(e){return parseInt(e)}).filter(function(e){return e<9e20})},o.prototype.create=function(e,t){for(var r=0;r":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],464:[function(e,t,r){"use strict";var c=e("underscore"),f=e("web3-core"),a=e("web3-core-method"),l=e("web3-utils"),n=e("web3-core-subscriptions").subscription,h=e("web3-core-helpers").formatters,i=e("web3-core-helpers").errors,s=e("web3-core-promievent"),d=e("web3-eth-abi"),o=function e(t,r,n){var o=this,i=Array.prototype.slice.call(arguments);if(!(this instanceof e))throw new Error('Please use the "new" keyword to instantiate a web3.eth.Contract() object!');if(this.setProvider=function(){f.packageInit(o,arguments),o.clearSubscriptions=o._requestManager.clearSubscriptions},f.packageInit(this,[this.constructor]),this.clearSubscriptions=this._requestManager.clearSubscriptions,!t||!Array.isArray(t))throw new Error("You must provide the json interface of the contract when instantiating a contract object.");this.options={};var a=i[i.length-1];c.isObject(a)&&!c.isArray(a)&&(n=a,this.options=c.extend(this.options,this._getOrSetDefaultOptions(n)),c.isObject(r)&&(r=null)),Object.defineProperty(this.options,"address",{set:function(e){e&&(o._address=l.toChecksumAddress(h.inputAddressFormatter(e)))},get:function(){return o._address},enumerable:!0}),Object.defineProperty(this.options,"jsonInterface",{set:function(e){return o.methods={},o.events={},o._jsonInterface=e.map(function(e){var t,r;if(e.constant="view"===e.stateMutability||"pure"===e.stateMutability||e.constant,e.payable="payable"===e.stateMutability||e.payable,e.name&&(r=l._jsonInterfaceMethodToString(e)),"function"===e.type){if(e.signature=d.encodeFunctionSignature(r),t=o._createTxObject.bind({method:e,parent:o}),o.methods[e.name]){var n=o._createTxObject.bind({method:e,parent:o,nextMethod:o.methods[e.name]});o.methods[e.name]=n}else o.methods[e.name]=t;o.methods[e.signature]=t,o.methods[r]=t}else if("event"===e.type){e.signature=d.encodeEventSignature(r);var i=o._on.bind(o,e.signature);o.events[e.name]&&"bound "!==o.events[e.name].name||(o.events[e.name]=i),o.events[e.signature]=i,o.events[r]=i}return e}),o.events.allEvents=o._on.bind(o,"allevents"),o._jsonInterface},get:function(){return o._jsonInterface},enumerable:!0});var s=this.constructor.defaultAccount,u=this.constructor.defaultBlock||"latest";Object.defineProperty(this,"handleRevert",{get:function(){return!1===o.options.handleRevert||!0===o.options.handleRevert?o.options.handleRevert:this.constructor.handleRevert},set:function(e){o.options.handleRevert=e},enumerable:!0}),Object.defineProperty(this,"defaultCommon",{get:function(){return o.options.common||this.constructor.defaultCommon},set:function(e){o.options.common=e},enumerable:!0}),Object.defineProperty(this,"defaultHardfork",{get:function(){return o.options.hardfork||this.constructor.defaultHardfork},set:function(e){o.options.hardfork=e},enumerable:!0}),Object.defineProperty(this,"defaultChain",{get:function(){return o.options.chain||this.constructor.defaultChain},set:function(e){o.options.chain=e},enumerable:!0}),Object.defineProperty(this,"transactionPollingTimeout",{get:function(){return 0===o.options.transactionPollingTimeout?o.options.transactionPollingTimeout:o.options.transactionPollingTimeout||this.constructor.transactionPollingTimeout},set:function(e){o.options.transactionPollingTimeout=e},enumerable:!0}),Object.defineProperty(this,"transactionConfirmationBlocks",{get:function(){return 0===o.options.transactionConfirmationBlocks?o.options.transactionConfirmationBlocks:o.options.transactionConfirmationBlocks||this.constructor.transactionConfirmationBlocks},set:function(e){o.options.transactionConfirmationBlocks=e},enumerable:!0}),Object.defineProperty(this,"transactionBlockTimeout",{get:function(){return 0===o.options.transactionBlockTimeout?o.options.transactionBlockTimeout:o.options.transactionBlockTimeout||this.constructor.transactionBlockTimeout},set:function(e){o.options.transactionBlockTimeout=e},enumerable:!0}),Object.defineProperty(this,"defaultAccount",{get:function(){return s},set:function(e){return e&&(s=l.toChecksumAddress(h.inputAddressFormatter(e))),e},enumerable:!0}),Object.defineProperty(this,"defaultBlock",{get:function(){return u},set:function(e){return u=e},enumerable:!0}),this.methods={},this.events={},this._address=null,this._jsonInterface=[],this.options.address=r,this.options.jsonInterface=t};o.setProvider=function(e,t){f.packageInit(this,[e]),this._ethAccounts=t},o.prototype._getCallback=function(e){if(e&&c.isFunction(e[e.length-1]))return e.pop()},o.prototype._checkListener=function(e,t){if(t===e)throw new Error('The event "'+e+"\" is a reserved event name, you can't use it.")},o.prototype._getOrSetDefaultOptions=function(e){var t=e.gasPrice?String(e.gasPrice):null,r=e.from?l.toChecksumAddress(h.inputAddressFormatter(e.from)):null;return e.data=e.data||this.options.data,e.from=r||this.options.from,e.gasPrice=t||this.options.gasPrice,e.gas=e.gas||e.gasLimit||this.options.gas,delete e.gasLimit,e},o.prototype._encodeEventABI=function(e,t){var r=(t=t||{}).filter||{},n={};if(["fromBlock","toBlock"].filter(function(e){return void 0!==t[e]}).forEach(function(e){n[e]=h.inputBlockNumberFormatter(t[e])}),c.isArray(t.topics))n.topics=t.topics;else{if(n.topics=[],e&&!e.anonymous&&"ALLEVENTS"!==e.name&&n.topics.push(e.signature),"ALLEVENTS"!==e.name){var i=e.inputs.filter(function(e){return!0===e.indexed}).map(function(t){var e=r[t.name];return e?c.isArray(e)?e.map(function(e){return d.encodeParameter(t.type,e)}):d.encodeParameter(t.type,e):null});n.topics=n.topics.concat(i)}n.topics.length||delete n.topics}return this.options.address&&(n.address=this.options.address.toLowerCase()),n},o.prototype._decodeEventABI=function(t){var e=this;t.data=t.data||"",t.topics=t.topics||[];var r=h.outputLogFormatter(t);if("ALLEVENTS"===e.name&&(e=e.jsonInterface.find(function(e){return e.signature===t.topics[0]})||{anonymous:!0}),e.inputs=e.inputs||[],!e.anonymous){var n=0;e.inputs.forEach(function(e){return e.indexed?n++:null}),0>>0,o=new Uint8Array(i);e[t];){var a=d[e.charCodeAt(t)];if(255===a)return;for(var s=0,u=i-1;(0!==a||s>>0,o[u]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");n=s,t++}if(" "!==e[t]){for(var c=i-n;c!==i&&0===o[c];)c++;var f=v.allocUnsafe(r+(i-c));f.fill(0,0,r);for(var l=r;c!==i;)f[l++]=o[c++];return f}}}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=v.from(e)),!v.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var t=0,r=0,n=0,i=e.length;n!==i&&0===e[n];)n++,t++;for(var o=(i-n)*m+1>>>0,a=new Uint8Array(o);n!==i;){for(var s=e[n],u=0,c=o-1;(0!==s||u>>0,a[c]=s%p>>>0,s=s/p>>>0;if(0!==s)throw new Error("Non-zero carry");r=u,n++}for(var f=o-r;f!==o&&0===a[f];)f++;for(var l=b.repeat(t);f\\$%@ءؤة\"'^|~⦅⦆・ゥャ¢£¬¦¥₩│←↑→↓■○𐐨𐐩𐐪𐐫𐐬𐐭𐐮𐐯𐐰𐐱𐐲𐐳𐐴𐐵𐐶𐐷𐐸𐐹𐐺𐐻𐐼𐐽𐐾𐐿𐑀𐑁𐑂𐑃𐑄𐑅𐑆𐑇𐑈𐑉𐑊𐑋𐑌𐑍𐑎𐑏𐓘𐓙𐓚𐓛𐓜𐓝𐓞𐓟𐓠𐓡𐓢𐓣𐓤𐓥𐓦𐓧𐓨𐓩𐓪𐓫𐓬𐓭𐓮𐓯𐓰𐓱𐓲𐓳𐓴𐓵𐓶𐓷𐓸𐓹𐓺𐓻𐳀𐳁𐳂𐳃𐳄𐳅𐳆𐳇𐳈𐳉𐳊𐳋𐳌𐳍𐳎𐳏𐳐𐳑𐳒𐳓𐳔𐳕𐳖𐳗𐳘𐳙𐳚𐳛𐳜𐳝𐳞𐳟𐳠𐳡𐳢𐳣𐳤𐳥𐳦𐳧𐳨𐳩𐳪𐳫𐳬𐳭𐳮𐳯𐳰𐳱𐳲𑣀𑣁𑣂𑣃𑣄𑣅𑣆𑣇𑣈𑣉𑣊𑣋𑣌𑣍𑣎𑣏𑣐𑣑𑣒𑣓𑣔𑣕𑣖𑣗𑣘𑣙𑣚𑣛𑣜𑣝𑣞𑣟ıȷ∇∂𞤢𞤣𞤤𞤥𞤦𞤧𞤨𞤩𞤪𞤫𞤬𞤭𞤮𞤯𞤰𞤱𞤲𞤳𞤴𞤵𞤶𞤷𞤸𞤹𞤺𞤻𞤼𞤽𞤾𞤿𞥀𞥁𞥂𞥃ٮڡٯ字双多解交映無前後再新初終販声吹演投捕遊指禁空合満申割営配得可丽丸乁𠄢你侻倂偺備像㒞𠘺兔兤具𠔜㒹內𠕋冗冤仌冬𩇟刃㓟刻剆剷㔕包匆卉博即卽卿𠨬灰及叟𠭣叫叱吆咞吸呈周咢哶唐啓啣善喫喳嗂圖圗噑噴壮城埴堍型堲報墬𡓤売壷夆夢奢𡚨𡛪姬娛娧姘婦㛮嬈嬾𡧈寃寘寳𡬘寿将㞁屠峀岍𡷤嵃𡷦嵮嵫嵼巡巢㠯巽帨帽幩㡢𢆃㡼庰庳庶𪎒𢌱舁弢㣇𣊸𦇚形彫㣣徚忍志忹悁㤺㤜𢛔惇慈慌慺憲憤憯懞戛扝抱拔捐𢬌挽拼捨掃揤𢯱搢揅掩㨮摩摾撝摷㩬敬𣀊旣書晉㬙㬈㫤冒冕最暜肭䏙朡杞杓𣏃㭉柺枅桒𣑭梎栟椔楂榣槪檨𣚣櫛㰘次𣢧歔㱎歲殟殻𣪍𡴋𣫺汎𣲼沿泍汧洖派浩浸涅𣴞洴港湮㴳滇𣻑淹潮𣽞𣾎濆瀹瀛㶖灊災灷炭𠔥煅𤉣熜爨牐𤘈犀犕𤜵𤠔獺王㺬玥㺸瑇瑜璅瓊㼛甤𤰶甾𤲒𢆟瘐𤾡𤾸𥁄㿼䀈𥃳𥃲𥄙𥄳眞真瞋䁆䂖𥐝硎䃣𥘦𥚚𥛅秫䄯穊穏𥥼𥪧䈂𥮫篆築䈧𥲀糒䊠糨糣紀𥾆絣䌁緇縂繅䌴𦈨𦉇䍙𦋙罺𦌾羕翺𦓚𦔣聠𦖨聰𣍟䏕育脃䐋脾媵𦞧𦞵𣎓𣎜舄辞䑫芑芋芝劳花芳芽苦𦬼茝荣莭茣莽菧荓菊菌菜𦰶𦵫𦳕䔫蓱蓳蔖𧏊蕤𦼬䕝䕡𦾱𧃒䕫虐虧虩蚩蚈蜎蛢蜨蝫螆蟡蠁䗹衠𧙧裗裞䘵裺㒻𧢮𧥦䚾䛇誠𧲨貫賁贛起𧼯𠠄跋趼跰𠣞軔𨗒𨗭邔郱鄑𨜮鄛鈸鋗鋘鉼鏹鐕𨯺開䦕閷𨵷䧦雃嶲霣𩅅𩈚䩮䩶韠𩐊䪲𩒖頩𩖶飢䬳餩馧駂駾䯎𩬰鱀鳽䳎䳭鵧𪃎䳸𪄅𪈎𪊑䵖黾鼅鼏鼖𪘀",mapChar:function(e){return 196608<=e?917760<=e&&e<=917999?18874368:0:t[r[e>>4]][15&e]}}},"function"==typeof define&&define.amd?define([],function(){return i()}):"object"===(void 0===r?"undefined":n(r))?t.exports=i():(void 0).uts46_map=i()},{}],481:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}var i;i=function(p,b){function i(e,t,r){for(var n=[],i=p.ucs2.decode(e),o=0;o>23,f=u>>21&3,l=u>>5&65535,h=31&u,d=b.mapStr.substr(l,h);if(0===f||t&&1&c)throw new Error("Illegal char "+s);1===f?n.push(d):2===f?n.push(r?d:s):3===f&&n.push(s)}return n.join("").normalize("NFC")}function c(e,t,r){void 0===r&&(r=!1);var n=i(e,r,t).split(".");return(n=n.map(function(e){return e.startsWith("xn--")?o(e=p.decode(e.substring(4)),r,!1):o(e,r,t),e})).join(".")}function o(e,t,r){if("-"===e[2]&&"-"===e[3])throw new Error("Failed to validate "+e);if(e.startsWith("-")||e.endsWith("-"))throw new Error("Failed to validate "+e);if(e.includes("."))throw new Error("Failed to validate "+e);if(i(e,t,r)!==e)throw new Error("Failed to validate "+e);var n=e.codePointAt(0);if(b.mapChar(n)&2<<23)throw new Error("Label contains illegal character: "+n)}return{toUnicode:function(e,t){return void 0===t&&(t={}),c(e,!1,"useStd3ASCII"in t&&t.useStd3ASCII)},toAscii:function(e,t){void 0===t&&(t={});var r,n=!("transitional"in t)||t.transitional,i="useStd3ASCII"in t&&t.useStd3ASCII,o="verifyDnsLength"in t&&t.verifyDnsLength,a=c(e,n,i).split(".").map(p.toASCII),s=a.join(".");if(o){if(s.length<1||253>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}m.prototype.update=function(e){var t="string"!=typeof e;t&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e));for(var r,n,i=e.length,o=this.blocks,a=this.byteCount,s=this.blockCount,u=0,c=this.s;u>2]|=e[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(224|n>>12)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];a%t==0&&(v(r),o=0)}return i&&(e=r[o],0>4&15]+u[15&e]),1>12&15]+u[e>>8&15]),2>20&15]+u[e>>16&15])),s},m.prototype.buffer=m.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r==0&&v(n)}return o&&(e=s<<2,t=n[a],0>8&255),2>16&255)),u};var v=function(e){var t,r,n,i,o,a,s,u,c,f,l,h,d,p,b,y,m,v,g,w,_,k,S,A,E,x,M,j,I,O,T,B,C,R,N,U,P,L,F,D,q,z,H,K,V,W,G,Y,X,J,Z,$,Q,ee,te,re,ne,ie,oe,ae,se,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|l>>>31),r=s^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(h<<1|d>>>31),r=c^(d<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,N=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,U=e[14]<<6|e[15]>>>26,P=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,C=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,E=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,M=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=b^~m&g,e[10]=A^~x&j,e[11]=E^~M&I,e[20]=R^~U&L,e[21]=N^~P&F,e[30]=K^~W&Y,e[31]=V^~G&X,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=y^~v&w,e[3]=m^~g&_,e[12]=x^~j&O,e[13]=M^~I&T,e[22]=U^~L&D,e[23]=P^~F&q,e[32]=W^~Y&J,e[33]=G^~X&Z,e[42]=re^~ie&ae,e[43]=ne^~oe&se,e[4]=v^~w&k,e[5]=g^~_&S,e[14]=j^~O&B,e[15]=I^~T&C,e[24]=L^~D&z,e[25]=F^~q&H,e[34]=Y^~J&$,e[35]=X^~Z&Q,e[44]=ie^~ae&ue,e[45]=oe^~se&ce,e[6]=w^~k&p,e[7]=_^~S&b,e[16]=O^~B&A,e[17]=T^~C&E,e[26]=D^~z&R,e[27]=q^~H&N,e[36]=J^~$&K,e[37]=Z^~Q&V,e[46]=ae^~ue&ee,e[47]=se^~ce&te,e[8]=k^~p&y,e[9]=S^~b&m,e[18]=B^~A&x,e[19]=C^~E&M,e[28]=z^~R&U,e[29]=H^~N&P,e[38]=$^~K&W,e[39]=Q^~V&G,e[48]=ue^~ee&re,e[49]=ce^~te&ne,e[0]^=fe[n],e[1]^=fe[n+1]};if(t)k.exports=c;else for(h=0;h>>o-5&31],o-=5;if(0>>n-8&255,n-=8);return a.buffer}(e,s)}}}},{}],486:[function(e,t,r){"use strict";var u=e("buffer").Buffer;t.exports=function(s){var n=-1 2 bytes.");var t=a.decode(e);if(!i.isValidCode(t))throw new Error("multihash unknown function code: 0x".concat(t.toString(16)));e=e.slice(a.decode.bytes);var r=a.decode(e);if(r<0)throw new Error("multihash invalid length: ".concat(r));if((e=e.slice(a.decode.bytes)).length!==r)throw new Error("multihash length inconsistent: 0x".concat(e.toString("hex")));return{code:t,name:n.codes[t],length:r,digest:e}},i.encode=function(e,t,r){if(!e||void 0===t)throw new Error("multihash encode requires at least two args: digest, code");var n=i.coerceCode(t);if(!o.isBuffer(e))throw new Error("digest should be a Buffer");if(null==r&&(r=e.length),r&&e.length!==r)throw new Error("digest length should be equal to specified length.");return o.concat([o.from(a.encode(n)),o.from(a.encode(r)),e])},i.coerceCode=function(e){var t=e;if("string"==typeof e){if(void 0===n.names[e])throw new Error("Unrecognized hash function named: ".concat(e));t=n.names[e]}if("number"!=typeof t)throw new Error("Hash function code should be a number. Got: ".concat(t));if(void 0===n.codes[t]&&!i.isAppCode(t))throw new Error("Unrecognized function code: ".concat(t));return t},i.isAppCode=function(e){return 0":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],506:[function(e,t,r){"use strict";t.exports=function e(t,r){var n,i=0,r=r||0,o=0,a=r,s=t.length;do{if(s<=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[a++],i+=o<28?(n&c)<>>=7;r[n]=0|t;e.bytes=n-i+1;return r};var o=128,a=-128,s=Math.pow(2,31)},{}],508:[function(e,t,r){"use strict";t.exports={encode:e("./encode.js"),decode:e("./decode.js"),encodingLength:e("./length.js")}},{"./decode.js":506,"./encode.js":507,"./length.js":509}],509:[function(e,t,r){"use strict";var n=Math.pow(2,7),i=Math.pow(2,14),o=Math.pow(2,21),a=Math.pow(2,28),s=Math.pow(2,35),u=Math.pow(2,42),c=Math.pow(2,49),f=Math.pow(2,56),l=Math.pow(2,63);t.exports=function(e){return e":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],522:[function(e,t,r){"use strict";var i=e("underscore");t.exports=function(r){var n,t=this;return this.net.getId().then(function(e){return n=e,t.getBlock(0)}).then(function(e){var t="private";return"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"===e.hash&&1===n&&(t="main"),"0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303"===e.hash&&2===n&&(t="morden"),"0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"===e.hash&&3===n&&(t="ropsten"),"0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177"===e.hash&&4===n&&(t="rinkeby"),"0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a"===e.hash&&5===n&&(t="goerli"),"0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9"===e.hash&&42===n&&(t="kovan"),i.isFunction(r)&&r(null,t),t}).catch(function(e){if(!i.isFunction(r))throw e;r(e)})}},{underscore:521}],523:[function(e,t,r){"use strict";var b=e("underscore"),y=e("web3-core"),n=e("web3-core-helpers"),m=e("web3-core-subscriptions").subscriptions,v=e("web3-core-method"),g=e("web3-utils"),w=e("web3-net"),_=e("web3-eth-ens"),k=e("web3-eth-personal"),S=e("web3-eth-contract"),A=e("web3-eth-iban"),E=e("web3-eth-accounts"),x=e("web3-eth-abi"),M=e("./getNetworkType.js"),j=n.formatters,I=function(e){return b.isString(e[0])&&0===e[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},O=function(e){return b.isString(e[0])&&0===e[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},T=function(e){return b.isString(e[0])&&0===e[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},B=function(e){return b.isString(e[0])&&0===e[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},C=function(e){return b.isString(e[0])&&0===e[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"},i=function(){var t=this;y.packageInit(this,arguments);var r=this.setRequestManager;this.setRequestManager=function(e){return r(e),t.net.setRequestManager(e),t.personal.setRequestManager(e),t.accounts.setRequestManager(e),t.Contract._requestManager=t._requestManager,t.Contract.currentProvider=t._provider,!0};var n,i,o,e=this.setProvider,a=!(this.setProvider=function(){e.apply(t,arguments),t.setRequestManager(t._requestManager),t.ens._detectedAddress=null,t.ens._lastSyncCheck=null}),s=null,u="latest",c=50,f=24,l=750;Object.defineProperty(this,"handleRevert",{get:function(){return a},set:function(e){a=e,t.Contract.handleRevert=a,p.forEach(function(e){e.handleRevert=a})},enumerable:!0}),Object.defineProperty(this,"defaultCommon",{get:function(){return o},set:function(e){o=e,t.Contract.defaultCommon=o,p.forEach(function(e){e.defaultCommon=o})},enumerable:!0}),Object.defineProperty(this,"defaultHardfork",{get:function(){return i},set:function(e){i=e,t.Contract.defaultHardfork=i,p.forEach(function(e){e.defaultHardfork=i})},enumerable:!0}),Object.defineProperty(this,"defaultChain",{get:function(){return n},set:function(e){n=e,t.Contract.defaultChain=n,p.forEach(function(e){e.defaultChain=n})},enumerable:!0}),Object.defineProperty(this,"transactionPollingTimeout",{get:function(){return l},set:function(e){l=e,t.Contract.transactionPollingTimeout=l,p.forEach(function(e){e.transactionPollingTimeout=l})},enumerable:!0}),Object.defineProperty(this,"transactionConfirmationBlocks",{get:function(){return f},set:function(e){f=e,t.Contract.transactionConfirmationBlocks=f,p.forEach(function(e){e.transactionConfirmationBlocks=f})},enumerable:!0}),Object.defineProperty(this,"transactionBlockTimeout",{get:function(){return c},set:function(e){c=e,t.Contract.transactionBlockTimeout=c,p.forEach(function(e){e.transactionBlockTimeout=c})},enumerable:!0}),Object.defineProperty(this,"defaultAccount",{get:function(){return s},set:function(e){return e&&(s=g.toChecksumAddress(j.inputAddressFormatter(e))),t.Contract.defaultAccount=s,t.personal.defaultAccount=s,p.forEach(function(e){e.defaultAccount=s}),e},enumerable:!0}),Object.defineProperty(this,"defaultBlock",{get:function(){return u},set:function(e){return u=e,t.Contract.defaultBlock=u,t.personal.defaultBlock=u,p.forEach(function(e){e.defaultBlock=u}),e},enumerable:!0}),this.clearSubscriptions=t._requestManager.clearSubscriptions,this.net=new w(this),this.net.getNetworkType=M.bind(this),this.accounts=new E(this),this.personal=new k(this),this.personal.defaultAccount=this.defaultAccount;var h=this,d=function(){S.apply(this,arguments);var e=this,t=h.setProvider;h.setProvider=function(){t.apply(h,arguments),y.packageInit(e,[h])}};d.setProvider=function(){S.setProvider.apply(this,arguments)},(d.prototype=Object.create(S.prototype)).constructor=d,this.Contract=d,this.Contract.defaultAccount=this.defaultAccount,this.Contract.defaultBlock=this.defaultBlock,this.Contract.transactionBlockTimeout=this.transactionBlockTimeout,this.Contract.transactionConfirmationBlocks=this.transactionConfirmationBlocks,this.Contract.transactionPollingTimeout=this.transactionPollingTimeout,this.Contract.handleRevert=this.handleRevert,this.Contract._requestManager=this._requestManager,this.Contract._ethAccounts=this.accounts,this.Contract.currentProvider=this._requestManager.provider,this.Iban=A,this.abi=x,this.ens=new _(this);var p=[new v({name:"getNodeInfo",call:"web3_clientVersion"}),new v({name:"getProtocolVersion",call:"eth_protocolVersion",params:0}),new v({name:"getCoinbase",call:"eth_coinbase",params:0}),new v({name:"isMining",call:"eth_mining",params:0}),new v({name:"getHashrate",call:"eth_hashrate",params:0,outputFormatter:g.hexToNumber}),new v({name:"isSyncing",call:"eth_syncing",params:0,outputFormatter:j.outputSyncingFormatter}),new v({name:"getGasPrice",call:"eth_gasPrice",params:0,outputFormatter:j.outputBigNumberFormatter}),new v({name:"getAccounts",call:"eth_accounts",params:0,outputFormatter:g.toChecksumAddress}),new v({name:"getBlockNumber",call:"eth_blockNumber",params:0,outputFormatter:g.hexToNumber}),new v({name:"getBalance",call:"eth_getBalance",params:2,inputFormatter:[j.inputAddressFormatter,j.inputDefaultBlockNumberFormatter],outputFormatter:j.outputBigNumberFormatter}),new v({name:"getStorageAt",call:"eth_getStorageAt",params:3,inputFormatter:[j.inputAddressFormatter,g.numberToHex,j.inputDefaultBlockNumberFormatter]}),new v({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[j.inputAddressFormatter,j.inputDefaultBlockNumberFormatter]}),new v({name:"getBlock",call:I,params:2,inputFormatter:[j.inputBlockNumberFormatter,function(e){return!!e}],outputFormatter:j.outputBlockFormatter}),new v({name:"getUncle",call:T,params:2,inputFormatter:[j.inputBlockNumberFormatter,g.numberToHex],outputFormatter:j.outputBlockFormatter}),new v({name:"getBlockTransactionCount",call:B,params:1,inputFormatter:[j.inputBlockNumberFormatter],outputFormatter:g.hexToNumber}),new v({name:"getBlockUncleCount",call:C,params:1,inputFormatter:[j.inputBlockNumberFormatter],outputFormatter:g.hexToNumber}),new v({name:"getTransaction",call:"eth_getTransactionByHash",params:1,inputFormatter:[null],outputFormatter:j.outputTransactionFormatter}),new v({name:"getTransactionFromBlock",call:O,params:2,inputFormatter:[j.inputBlockNumberFormatter,g.numberToHex],outputFormatter:j.outputTransactionFormatter}),new v({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,inputFormatter:[null],outputFormatter:j.outputTransactionReceiptFormatter}),new v({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[j.inputAddressFormatter,j.inputDefaultBlockNumberFormatter],outputFormatter:g.hexToNumber}),new v({name:"sendSignedTransaction",call:"eth_sendRawTransaction",params:1,inputFormatter:[null],abiCoder:x}),new v({name:"signTransaction",call:"eth_signTransaction",params:1,inputFormatter:[j.inputTransactionFormatter]}),new v({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[j.inputTransactionFormatter],abiCoder:x}),new v({name:"sign",call:"eth_sign",params:2,inputFormatter:[j.inputSignFormatter,j.inputAddressFormatter],transformPayload:function(e){return e.params.reverse(),e}}),new v({name:"call",call:"eth_call",params:2,inputFormatter:[j.inputCallFormatter,j.inputDefaultBlockNumberFormatter],abiCoder:x}),new v({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[j.inputCallFormatter],outputFormatter:g.hexToNumber}),new v({name:"submitWork",call:"eth_submitWork",params:3}),new v({name:"getWork",call:"eth_getWork",params:0}),new v({name:"getPastLogs",call:"eth_getLogs",params:1,inputFormatter:[j.inputLogFormatter],outputFormatter:j.outputLogFormatter}),new v({name:"getChainId",call:"eth_chainId",params:0,outputFormatter:g.hexToNumber}),new v({name:"requestAccounts",call:"eth_requestAccounts",params:0,outputFormatter:g.toChecksumAddress}),new v({name:"getProof",call:"eth_getProof",params:3,inputFormatter:[j.inputAddressFormatter,j.inputStorageKeysFormatter,j.inputDefaultBlockNumberFormatter],outputFormatter:j.outputProofFormatter}),new v({name:"getPendingTransactions",call:"eth_pendingTransactions",params:0,outputFormatter:j.outputTransactionFormatter}),new m({name:"subscribe",type:"eth",subscriptions:{newBlockHeaders:{subscriptionName:"newHeads",params:0,outputFormatter:j.outputBlockFormatter},pendingTransactions:{subscriptionName:"newPendingTransactions",params:0},logs:{params:1,inputFormatter:[j.inputLogFormatter],outputFormatter:j.outputLogFormatter,subscriptionHandler:function(e){e.removed?this.emit("changed",e):this.emit("data",e),b.isFunction(this.callback)&&this.callback(null,e,this)}},syncing:{params:0,outputFormatter:j.outputSyncingFormatter,subscriptionHandler:function(e){var t=this;!0!==this._isSyncing?(this._isSyncing=!0,this.emit("changed",t._isSyncing),b.isFunction(this.callback)&&this.callback(null,t._isSyncing,this),setTimeout(function(){t.emit("data",e),b.isFunction(t.callback)&&t.callback(null,e,t)},0)):(this.emit("data",e),b.isFunction(t.callback)&&this.callback(null,e,this),clearTimeout(this._isSyncingTimeout),this._isSyncingTimeout=setTimeout(function(){e.currentBlock>e.highestBlock-200&&(t._isSyncing=!1,t.emit("changed",t._isSyncing),b.isFunction(t.callback)&&t.callback(null,t._isSyncing,t))},500))}}}})];p.forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager,t.accounts),e.defaultBlock=t.defaultBlock,e.defaultAccount=t.defaultAccount,e.transactionBlockTimeout=t.transactionBlockTimeout,e.transactionConfirmationBlocks=t.transactionConfirmationBlocks,e.transactionPollingTimeout=t.transactionPollingTimeout,e.handleRevert=t.handleRevert})};y.addProviders(i),t.exports=i},{"./getNetworkType.js":522,underscore:521,"web3-core":231,"web3-core-helpers":216,"web3-core-method":218,"web3-core-subscriptions":228,"web3-eth-abi":274,"web3-eth-accounts":462,"web3-eth-contract":464,"web3-eth-ens":513,"web3-eth-iban":519,"web3-eth-personal":520,"web3-net":524,"web3-utils":559}],524:[function(e,t,r){"use strict";var n=e("web3-core"),i=e("web3-core-method"),o=e("web3-utils"),a=function(){var t=this;n.packageInit(this,arguments),[new i({name:"getId",call:"net_version",params:0,outputFormatter:parseInt}),new i({name:"isListening",call:"net_listening",params:0}),new i({name:"getPeerCount",call:"net_peerCount",params:0,outputFormatter:o.hexToNumber})].forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)})};n.addProviders(a),t.exports=a},{"web3-core":231,"web3-core-method":218,"web3-utils":559}],525:[function(e,t,r){"use strict";!function(){function i(e,t,r,n){return this instanceof i?(this.domain=e||void 0,this.path=t||"/",this.secure=!!r,this.script=!!n,this):new i(e,t,r,n)}function u(e,t,r){return e instanceof u?e:this instanceof u?(this.name=null,this.value=null,this.expiration_date=1/0,this.path=String(r||"/"),this.explicit_path=!1,this.domain=t||null,this.explicit_domain=!1,this.secure=!1,this.noscript=!1,e&&this.parse(e,t,r),this):new u(e,t,r)}i.All=Object.freeze(Object.create(null)),r.CookieAccessInfo=i,(r.Cookie=u).prototype.toString=function(){var e=[this.name+"="+this.value];return this.expiration_date!==1/0&&e.push("expires="+new Date(this.expiration_date).toGMTString()),this.domain&&e.push("domain="+this.domain),this.path&&e.push("path="+this.path),this.secure&&e.push("secure"),this.noscript&&e.push("httponly"),e.join("; ")},u.prototype.toValueString=function(){return this.name+"="+this.value};var a=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;function e(){var o,a;return this instanceof e?(o=Object.create(null),this.setCookie=function(e,t,r){var n,i;if(n=(e=new u(e,t,r)).expiration_date<=Date.now(),void 0===o[e.name])return!n&&(o[e.name]=[e],o[e.name]);for(a=o[e.name],i=0;il&&(W("Max buffer length exceeded: textNode"),i=Math.max(i,R.length)),N.length>l&&(W("Max buffer length exceeded: numberNode"),i=Math.max(i,N.length)),C=l-i+H);var i}),e(se).on(function(){if(L==d)return c({}),f(),void(P=!0);L===p&&0===z||W("Unexpected end");R!==X&&(c(R),f(),R=X);P=!0})}var e,t,o,C,R,N,U,P,L,F,D,q=(e=d(function(e){return e.unshift(/^/),(t=RegExp(e.map(n("source")).join(""))).exec.bind(t);var t}),C=e(t=/(\$?)/,/([\w-_]+|\*)/,o=/(?:{([\w ]*?)})?/),R=e(t,/\["([^"]+)"\]/,o),N=e(t,/\[(\d+|\*)\]/,o),U=e(t,/()/,/{([\w ]*?)}/),P=e(/\.\./),L=e(/\./),F=e(t,/!/),D=e(/$/),function(e){return e(m(C,R,N,U),P,L,F,D)});function z(e,t){return{key:e,node:t}}var H=n("key"),K=n("node"),V={};function W(e){var i=e($).emit,t=e(Q).emit,u=e(ie).emit,r=e(ne).emit;function c(e,t,r){K(M(e))[t]=r}function f(e,t,r){e&&c(e,t,r);var n=x(z(t,r),e);return i(n),n}var n={};return n[fe]=function(e,t){if(!e)return u(t),f(e,V,t);var r,n,i,o=(n=t,i=K(M(r=e)),_(l,i)?f(r,k(i),n):r),a=j(o),s=H(M(o));return c(a,s,t),x(z(s,t),a)},n[le]=function(e){return t(e),j(e)||r(K(M(e)))},n[ce]=f,n}var G=q(function(e,t,r,n,i){var o=y(H,M),a=y(K,M);function s(e,t){return!!t[1]?v(e,M):e}function u(e){if(e==w)return w;return v(function(e){return o(e)!=V},y(e,j))}function c(){return function(e){return o(e)==V}}function f(e,t,r,n,i){var o,a=e(r);if(a){var s=(o=a,T(function(e,t){return t(e,o)},n,t));return i(r.substr(k(a[0])),s)}}function l(e,t){return b(f,e,t)}var h=m(l(e,O(s,function(e,t){var r=t[3];return r?v(y(b(E,I(r.split(/\W+/))),a),e):e},function(e,t){var r=t[2];return v(r&&"*"!=r?function(e){return o(e)==r}:w,e)},u)),l(t,O(function(e){if(e==w)return w;var t=c(),r=e,n=u(function(e){return i(e)}),i=m(t,r,n);return i})),l(r,O()),l(n,O(s,c)),l(i,O(function(r){return function(e){var t=r(e);return!0===t?M(e):t}})),function(e){throw Y('"'+e+'" could not be tokenised')});function d(e,t){return t}function p(e,t){return h(e,t,e?p:d)}return function(t){try{return p(t,w)}catch(e){throw Y('Could not compile "'+t+'" because '+e.message)}}});function J(n,i,r){var o,a;function s(t){return function(e){return e.id==t}}return{on:function(e,t){var r={listener:e,id:t||e};return i&&i.emit(n,e,r.id),o=x(r,o),a=x(e,a),this},emit:function(){!function e(t,r){t&&(M(t).apply(null,r),e(j(t),r))}(a,arguments)},un:function(e){var t;o=f(o,s(e),function(e){t=e}),t&&(a=f(a,function(e){return e==t.listener}),r&&r.emit(n,t.listener,t.id))},listeners:function(){return a},hasListener:function(e){return A(function e(t,r){return r&&(t(M(r))?M(r):e(t,j(r)))}(e?s(e):w,o))}}}var Z=1,$=Z++,Q=Z++,ee=Z++,te=Z++,re="fail",ne=Z++,ie=Z++,oe="start",ae="data",se="end",ue=Z++,ce=Z++,fe=Z++,le=Z++;function he(e,t,r){try{var n=u.parse(t)}catch(e){}return{statusCode:e,body:t,jsonBody:n,thrown:r}}function de(n,i){var o={node:n(Q),path:n($)};function a(t,r,o){var a=n(t).emit;r.on(function(e){var t,r,n,i=o(e);!1!==i&&(t=a,r=K(i),n=B(e),t(r,s(j(c(H,n))),s(c(K,n))))},t),n("removeListener").on(function(e){e==t&&(n(e).listeners()||r.un(t))})}n("newListener").on(function(e){var t=/(node|path):(.*)/.exec(e);if(t){var r=o[t[1]];r.hasListener(e)||a(e,r,i(t[2]))}})}function pe(o,e){var i,a=/^(node|path):./,s=o(ne),u=o(te).emit,c=o(ee).emit,t=d(function(e,t){if(i[e])h(t,i[e]);else{var r=o(e),n=t[0];a.test(e)?f(r,n):r.on(n)}return i});function f(t,e,r){r=r||e;var n=l(e);return t.on(function(){var e=!1;i.forget=function(){e=!0},h(arguments,n),delete i.forget,e&&t.un(r)},r),i}function l(e){return function(){try{return e.apply(i,arguments)}catch(e){setTimeout(function(){throw new Y(e.message)})}}}function n(e,t,r){var n,i;n="node"==e?(i=r,function(){var e=i.apply(this,arguments);A(e)&&(e==me.drop?u():c(e))}):r,f(o(e+":"+t),n,r)}function r(e,t,r){return S(t)?n(e,t,r):function(e,t){for(var r in t)n(e,r,t[r])}(e,t),i}return o(ie).on(function(e){var t;i.root=(t=e,function(){return t})}),o(oe).on(function(e,t){i.header=function(e){return e?t[e]:t}}),i={on:t,addListener:t,removeListener:function(e,t,r){if("done"==e)s.un(t);else if("node"==e||"path"==e)o.un(e+":"+t,r);else{var n=t;o(e).un(n)}return i},emit:o.emit,node:b(r,"node"),path:b(r,"path"),done:b(f,s),start:b(function(e,t){return o(e).on(l(t),t),i},oe),fail:o(re).on,abort:o(ue).emit,header:g,root:g,source:e}}function be(e,t,r,n,i){var o=function(){var t={},r=i("newListener"),n=i("removeListener");function i(e){return t[e]=J(e,r,n)}function o(e){return t[e]||i(e)}return["emit","on","un"].forEach(function(r){o[r]=d(function(e,t){h(t,o(e)[r])})}),o}();return t&&function(t,n,e,r,i,o,a){var s,u=t(ae).emit,c=t(re).emit,f=0,l=!0;function h(){var e=n.responseText,t=e.substr(f);t&&u(t),f=k(e)}t(ue).on(function(){n.onreadystatechange=null,n.abort()}),"onprogress"in n&&(n.onprogress=h),n.onreadystatechange=function(){function e(){try{l&&t(oe).emit(n.status,(e=n.getAllResponseHeaders(),r={},e&&e.split("\r\n").forEach(function(e){var t=e.indexOf(": ");r[e.substring(0,t)]=e.substring(t+2)}),r)),l=!1}catch(e){}var e,r}switch(n.readyState){case 2:case 3:return e();case 4:e(),2==String(n.status)[0]?(h(),t(se).emit()):c(he(n.status,n.responseText))}};try{for(var d in n.open(e,r,!0),o)n.setRequestHeader(d,o[d]);(function(t,e){function r(e){return e.port||{"http:":80,"https:":443}[e.protocol||t.protocol]}return!!(e.protocol&&e.protocol!=t.protocol||e.host&&e.host!=t.host||e.host&&r(e)!=r(t))})(p.location,{protocol:(s=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(r)||[])[1]||"",host:s[2]||"",port:s[3]||""})||n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.withCredentials=a,n.send(i)}catch(e){p.setTimeout(b(c,he(X,X,e)),0)}}(o,new XMLHttpRequest,e,t,r,n,i),a(o),function(t,r){var i,n={};function e(t){return function(e){i=t(i,e)}}for(var o in r)t(o).on(e(r[o]),n);t(ee).on(function(e){var t=M(i),r=H(t),n=j(i);n&&(K(M(n))[r]=e)}),t(te).on(function(){var e=M(i),t=H(e),r=j(i);r&&delete K(M(r))[t]}),t(ue).on(function(){for(var e in r)t(e).un(n)})}(o,W(o)),de(o,G),pe(o,t)}function ye(e,t,r,n,i,o,a){return i=i?u.parse(u.stringify(i)):{},n?(S(n)||(n=u.stringify(n),i["Content-Type"]=i["Content-Type"]||"application/json"),i["Content-Length"]=i["Content-Length"]||n.length):n=null,e(r||"GET",(s=t,!1===a&&(-1==s.indexOf("?")?s+="?":s+="&",s+="_="+(new Date).getTime()),s),n,i,o||!1);var s}function me(e){var t=O("resume","pause","pipe"),r=b(E,t);return e?r(e)||S(e)?ye(be,e):ye(be,e.url,e.method,e.body,e.headers,e.withCredentials,e.cached):be()}me.drop=function(){return me.drop},"function"==typeof define&&define.amd?define("oboe",[],function(){return me}):"object"===(void 0===ge?"undefined":we(ge))?ve.exports=me:p.oboe=me}(function(){try{return window}catch(e){return self}}(),Object,Array,Error,JSON)},{}],534:[function(e,Z,$){(function(X){"use strict";function J(e){return(J="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})(e)}!function(){var e="object"==("undefined"==typeof self?"undefined":J(self))&&self.self===self&&self||"object"==(void 0===X?"undefined":J(X))&&X.global===X&&X||this||{},t=e._,n=Array.prototype,a=Object.prototype,l="undefined"!=typeof Symbol?Symbol.prototype:null,i=n.push,u=n.slice,h=a.toString,o=a.hasOwnProperty,r=Array.isArray,s=Object.keys,c=Object.create,f=function(){},d=function e(t){return t instanceof e?t:this instanceof e?void(this._wrapped=t):new e(t)};void 0===$||$.nodeType?e._=d:(void 0!==Z&&!Z.nodeType&&Z.exports&&($=Z.exports=d),$._=d),d.VERSION="1.9.1";var p,b=function(i,o,e){if(void 0===o)return i;switch(null==e?3:e){case 1:return function(e){return i.call(o,e)};case 3:return function(e,t,r){return i.call(o,e,t,r)};case 4:return function(e,t,r,n){return i.call(o,e,t,r,n)}}return function(){return i.apply(o,arguments)}},y=function(e,t,r){return d.iteratee!==p?d.iteratee(e,t):null==e?d.identity:d.isFunction(e)?b(e,t,r):d.isObject(e)&&!d.isArray(e)?d.matcher(e):d.property(e)};d.iteratee=p=function(e,t){return y(e,t,1/0)};var m=function(i,o){return o=null==o?i.length-1:+o,function(){for(var e=Math.max(arguments.length-o,0),t=Array(e),r=0;r":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],535:[function(e,t,r){"use strict";var i=e("underscore"),o=e("web3-core-helpers").errors,a=e("oboe"),n=function(e,t){var n=this;this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,this.connected=!1,this.connection=t.connect({path:this.path}),this.addDefaultEvents();var r=function(t){var r=null;i.isArray(t)?t.forEach(function(e){n.responseCallbacks[e.id]&&(r=e.id)}):r=t.id,r||-1===t.method.indexOf("_subscription")?n.responseCallbacks[r]&&(n.responseCallbacks[r](null,t),delete n.responseCallbacks[r]):n.notificationCallbacks.forEach(function(e){i.isFunction(e)&&e(t)})};"Socket"===t.constructor.name?a(this.connection).done(r):this.connection.on("data",function(e){n._parseResponse(e.toString()).forEach(r)})};n.prototype.addDefaultEvents=function(){var e=this;this.connection.on("connect",function(){e.connected=!0}),this.connection.on("close",function(){e.connected=!1}),this.connection.on("error",function(){e._timeout()}),this.connection.on("end",function(){e._timeout()}),this.connection.on("timeout",function(){e._timeout()})},n.prototype._parseResponse=function(e){var r=this,n=[];return e.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(t){r.lastChunk&&(t=r.lastChunk+t);var e=null;try{e=JSON.parse(t)}catch(e){return r.lastChunk=t,clearTimeout(r.lastChunkTimeout),void(r.lastChunkTimeout=setTimeout(function(){throw r._timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(r.lastChunkTimeout),r.lastChunk=null,e&&n.push(e)}),n},n.prototype._addResponseCallback=function(e,t){var r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n},n.prototype._timeout=function(){for(var e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](o.InvalidConnection("on IPC")),delete this.responseCallbacks[e])},n.prototype.reconnect=function(){this.connection.connect({path:this.path})},n.prototype.send=function(e,t){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(e)),this._addResponseCallback(e,t)},n.prototype.on=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");switch(e){case"data":this.notificationCallbacks.push(t);break;default:this.connection.on(e,t)}},n.prototype.once=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");this.connection.once(e,t)},n.prototype.removeListener=function(e,r){var n=this;switch(e){case"data":this.notificationCallbacks.forEach(function(e,t){e===r&&n.notificationCallbacks.splice(t,1)});break;default:this.connection.removeListener(e,r)}},n.prototype.removeAllListeners=function(e){switch(e){case"data":this.notificationCallbacks=[];break;default:this.connection.removeAllListeners(e)}},n.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.connection.removeAllListeners("error"),this.connection.removeAllListeners("end"),this.connection.removeAllListeners("timeout"),this.addDefaultEvents()},n.prototype.supportsSubscriptions=function(){return!0},t.exports=n},{oboe:533,underscore:534,"web3-core-helpers":216}],536:[function(e,t,r){"use strict";var n;try{n=e("es5-ext/global")}catch(e){}finally{if(n||"undefined"==typeof window||(n=window),!n)throw new Error("Could not determine global this")}var i=n.WebSocket||n.MozWebSocket,o=e("./version");function a(e,t){return t?new i(e,t):new i(e)}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(e){Object.defineProperty(a,e,{get:function(){return i[e]}})}),t.exports={w3cwebsocket:i?a:null,version:o}},{"./version":537,"es5-ext/global":539}],537:[function(e,t,r){"use strict";t.exports=e("../package.json").version},{"../package.json":538}],538:[function(e,t,r){t.exports={_args:[["@web3-js/websocket@1.0.30","/Users/ryanghods/dev/web3.js/packages/web3-providers-ws"]],_from:"@web3-js/websocket@1.0.30",_id:"@web3-js/websocket@1.0.30",_inBundle:!1,_integrity:"sha512-fDwrD47MiDrzcJdSeTLF75aCcxVVt8B1N74rA+vh2XCAvFy4tEWJjtnUtj2QG7/zlQ6g9cQ88bZFBxwd9/FmtA==",_location:"/@web3-js/websocket",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"@web3-js/websocket@1.0.30",name:"@web3-js/websocket",escapedName:"@web3-js%2fwebsocket",scope:"@web3-js",rawSpec:"1.0.30",saveSpec:null,fetchSpec:"1.0.30"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/@web3-js/websocket/-/websocket-1.0.30.tgz",_spec:"1.0.30",_where:"/Users/ryanghods/dev/web3.js/packages/web3-providers-ws",author:{name:"Brian McKelvey",email:"theturtle32@gmail.com",url:"https://github.com/theturtle32"},browser:"lib/browser.js",bugs:{url:"https://github.com/web3-js/WebSocket-Node/issues"},config:{verbose:!1},contributors:[{name:"Iñaki Baz Castillo",email:"ibc@aliax.net",url:"http://dev.sipdoc.net"}],dependencies:{debug:"^2.2.0","es5-ext":"^0.10.50",nan:"^2.14.0","typedarray-to-buffer":"^3.1.5",yaeti:"^0.0.6"},description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",devDependencies:{"buffer-equal":"^1.0.0",faucet:"^0.0.1",gulp:"^4.0.2","gulp-jshint":"^2.0.4",jshint:"^2.0.0","jshint-stylish":"^2.2.1",tape:"^4.9.1"},directories:{lib:"./lib"},engines:{node:">=0.10.0"},homepage:"https://github.com/web3-js/WebSocket-Node",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],license:"Apache-2.0",main:"index",name:"@web3-js/websocket",repository:{type:"git",url:"git+https://github.com/web3-js/WebSocket-Node.git"},scripts:{gulp:"gulp",install:"(node-gyp rebuild 2> builderror.log) || (exit 0)",test:"faucet test/unit"},version:"1.0.30"}},{}],539:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}var i=function(){if("object"===("undefined"==typeof self?"undefined":n(self))&&self)return self;if("object"===("undefined"==typeof window?"undefined":n(window))&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;if("object"===("undefined"==typeof globalThis?"undefined":n(globalThis))&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return i()}try{return __global__||i()}finally{delete Object.prototype.__global__}}()},{}],540:[function(e,t,r){arguments[4][219][0].apply(r,arguments)},{dup:219}],541:[function(a,s,e){(function(e,t){"use strict";var r=null,n=null;if("[object process]"===Object.prototype.toString.call(void 0!==e?e:0)){r=function(e){return t.from(e).toString("base64")};var i=a("url");if(i.URL){var o=i.URL;n=function(e){return new o(e)}}else n=a("url").parse}else r=btoa.bind(window),n=function(e){return new URL(e)};s.exports={parseURL:n,btoa:r}}).call(this,a("_process"),a("buffer").Buffer)},{_process:124,buffer:50,url:185}],542:[function(e,t,r){"use strict";var n=e("eventemitter3"),i=e("./helpers.js"),o=e("web3-core-helpers").errors,a=e("@web3-js/websocket").w3cwebsocket,s=function(e,t){n.call(this),t=t||{},this.url=e,this._customTimeout=t.timeout||15e3,this.headers=t.headers||{},this.protocol=t.protocol||void 0,this.reconnectOptions=Object.assign({auto:!1,delay:5e3,maxAttempts:!1,onTimeout:!1},t.reconnect),this.clientConfig=t.clientConfig||void 0,this.requestOptions=t.requestOptions||void 0,this.DATA="data",this.CLOSE="close",this.ERROR="error",this.CONNECT="connect",this.RECONNECT="reconnect",this.connection=null,this.requestQueue=new Map,this.responseQueue=new Map,this.reconnectAttempts=0,this.reconnecting=!1;var r=i.parseURL(e);r.username&&r.password&&(this.headers.authorization="Basic "+i.btoa(r.username+":"+r.password)),r.auth&&(this.headers.authorization="Basic "+i.btoa(r.auth)),Object.defineProperty(this,"connected",{get:function(){return this.connection&&this.connection.readyState===this.connection.OPEN},enumerable:!0}),this.connect()};((s.prototype=Object.create(n.prototype)).constructor=s).prototype.connect=function(){this.connection=new a(this.url,this.protocol,void 0,this.headers,this.requestOptions,this.clientConfig),this._addSocketListeners()},s.prototype._onMessage=function(e){var r=this;this._parseResponse("string"==typeof e.data?e.data:"").forEach(function(e){if(e.method&&-1!==e.method.indexOf("_subscription"))r.emit(r.DATA,e);else{var t=e.id;Array.isArray(e)&&(t=e[0].id),r.responseQueue.has(t)&&(r.responseQueue.get(t).callback(!1,e),r.responseQueue.delete(t))}})},s.prototype._onConnect=function(){if(this.emit(this.CONNECT),this.reconnectAttempts=0,this.reconnecting=!1,0>>4).toString(16)),t.push((15&e[r]).toString(16));return"0x".concat(t.join("").replace(/^0+/,""))},r.toByteArray=i},{"js-sha3":551}],548:[function(e,t,r){"use strict";function n(e){return(n="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})(e)}var f=e("bn.js"),l=e("number-to-bn"),h=new f(0),d=new f(-1),p={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"};function b(e){var t=e?e.toLowerCase():"ether",r=p[t];if("string"!=typeof r)throw new Error("[ethjs-unit] the unit provided "+e+" doesn't exists, please use the one of the following units "+JSON.stringify(p,null,2));return new f(r,10)}function y(e){if("string"==typeof e){if(!e.match(/^-?[0-9.]+$/))throw new Error("while converting number to string, invalid number value '"+e+"', should be a number matching (^-?[0-9.]+).");return e}if("number"==typeof e)return String(e);if("object"===n(e)&&e.toString&&(e.toTwos||e.dividedToIntegerBy))return e.toPrecision?String(e.toPrecision()):e.toString(10);throw new Error("while converting number to string, invalid number value '"+e+"' type "+n(e)+".")}t.exports={unitMap:p,numberToString:y,getValueOfUnit:b,fromWei:function(e,t,r){var n=l(e),i=n.lt(h),o=b(t),a=p[t].length-1||1,s=r||{};i&&(n=n.mul(d));for(var u=n.mod(o).toString(10);u.lengthi)throw new Error("[ethjs-unit] while converting number "+e+" to wei, too many decimal places");for(;u.length>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);else if("le"===r)for(i=n=0;n>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);return this.strip()},m.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==t&&(i=a(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},m.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,c=r;c"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;n=(r.length=n)-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var c=1;c>>26,l=67108863&u,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[d])+l)/67108864|0,l=67108863&a}r.words[c]=0|l,u=0|f}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}m.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?h[6-s.length]+s+r:s+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&2<=e&&e<=36){var u=d[e],c=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var l=f.modn(c).toString(e);r=(f=f.idivn(c)).isZero()?l+r:h[u-l.length]+l+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}y(!1,"Base should be between 2 and 36")},m.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=t&&(r+=7,t>>>=7),8<=t&&(r+=4,t>>>=4),2<=t&&(r+=2,t>>>=2),r+t},m.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},m.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},m.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},m.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},m.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},m.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},m.prototype.iuxor=function(e){var t,r;r=this.length>e.length?(t=this,e):(t=e,this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},m.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},m.prototype.inotn=function(e){y("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},m.prototype.notn=function(e){return this.clone().inotn(e)},m.prototype.setn=function(e,t){y("number"==typeof e&&0<=e);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,e):(r=e,this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},m.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;n=0>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,b=d>>>13,y=0|a[2],m=8191&y,v=y>>>13,g=0|a[3],w=8191&g,_=g>>>13,k=0|a[4],S=8191&k,A=k>>>13,E=0|a[5],x=8191&E,M=E>>>13,j=0|a[6],I=8191&j,O=j>>>13,T=0|a[7],B=8191&T,C=T>>>13,R=0|a[8],N=8191&R,U=R>>>13,P=0|a[9],L=8191&P,F=P>>>13,D=0|s[0],q=8191&D,z=D>>>13,H=0|s[1],K=8191&H,V=H>>>13,W=0|s[2],G=8191&W,Y=W>>>13,X=0|s[3],J=8191&X,Z=X>>>13,$=0|s[4],Q=8191&$,ee=$>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,fe=0|s[8],le=8191&fe,he=fe>>>13,de=0|s[9],pe=8191&de,be=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(n=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(h,q)|0))<<13)|0;c=((o=Math.imul(h,z))+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(b,q)|0,o=Math.imul(b,z);var me=(c+(n=n+Math.imul(l,K)|0)|0)+((8191&(i=(i=i+Math.imul(l,V)|0)+Math.imul(h,K)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,q),i=(i=Math.imul(m,z))+Math.imul(v,q)|0,o=Math.imul(v,z),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0;var ve=(c+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,Y)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,o=Math.imul(_,z),n=n+Math.imul(m,K)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,Y)|0;var ge=(c+(n=n+Math.imul(l,J)|0)|0)+((8191&(i=(i=i+Math.imul(l,Z)|0)+Math.imul(h,J)|0))<<13)|0;c=((o=o+Math.imul(h,Z)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(S,q),i=(i=Math.imul(S,z))+Math.imul(A,q)|0,o=Math.imul(A,z),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,Y)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,Z)|0;var we=(c+(n=n+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(M,q)|0,o=Math.imul(M,z),n=n+Math.imul(S,K)|0,i=(i=i+Math.imul(S,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var _e=(c+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,z))+Math.imul(O,q)|0,o=Math.imul(O,z),n=n+Math.imul(x,K)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,Y)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var ke=(c+(n=n+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(C,q)|0,o=Math.imul(C,z),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0;var Se=(c+(n=n+Math.imul(l,ue)|0)|0)+((8191&(i=(i=i+Math.imul(l,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(N,q),i=(i=Math.imul(N,z))+Math.imul(U,q)|0,o=Math.imul(U,z),n=n+Math.imul(B,K)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,V)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,Z)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Z)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(m,oe)|0,i=(i=i+Math.imul(m,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0;var Ae=(c+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,z))+Math.imul(F,q)|0,o=Math.imul(F,z),n=n+Math.imul(N,K)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(U,K)|0,o=o+Math.imul(U,V)|0,n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(m,ue)|0,i=(i=i+Math.imul(m,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(b,le)|0,o=o+Math.imul(b,he)|0;var Ee=(c+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,be)|0)+Math.imul(h,pe)|0))<<13)|0;c=((o=o+Math.imul(h,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,K),i=(i=Math.imul(L,V))+Math.imul(F,K)|0,o=Math.imul(F,V),n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(U,G)|0,o=o+Math.imul(U,Y)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Z)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,Z)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(m,le)|0,i=(i=i+Math.imul(m,he)|0)+Math.imul(v,le)|0,o=o+Math.imul(v,he)|0;var xe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(L,G),i=(i=Math.imul(L,Y))+Math.imul(F,G)|0,o=Math.imul(F,Y),n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,Z)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,n=n+Math.imul(S,ue)|0,i=(i=i+Math.imul(S,ce)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,ce)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(_,le)|0,o=o+Math.imul(_,he)|0;var Me=(c+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,be)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,J),i=(i=Math.imul(L,Z))+Math.imul(F,J)|0,o=Math.imul(F,Z),n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(U,Q)|0,o=o+Math.imul(U,ee)|0,n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,n=n+Math.imul(S,le)|0,i=(i=i+Math.imul(S,he)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,he)|0;var je=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,be)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,ee))+Math.imul(F,Q)|0,o=Math.imul(F,ee),n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(U,re)|0,o=o+Math.imul(U,ne)|0,n=n+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,n=n+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,he)|0;var Ie=(c+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,be)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(F,re)|0,o=Math.imul(F,ne),n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(U,oe)|0,o=o+Math.imul(U,ae)|0,n=n+Math.imul(B,ue)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(I,le)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,he)|0;var Oe=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,be)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,oe),i=(i=Math.imul(L,ae))+Math.imul(F,oe)|0,o=Math.imul(F,ae),n=n+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,ce)|0)+Math.imul(U,ue)|0,o=o+Math.imul(U,ce)|0,n=n+Math.imul(B,le)|0,i=(i=i+Math.imul(B,he)|0)+Math.imul(C,le)|0,o=o+Math.imul(C,he)|0;var Te=(c+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,be)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,ue),i=(i=Math.imul(L,ce))+Math.imul(F,ue)|0,o=Math.imul(F,ce),n=n+Math.imul(N,le)|0,i=(i=i+Math.imul(N,he)|0)+Math.imul(U,le)|0,o=o+Math.imul(U,he)|0;var Be=(c+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,be)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(L,le),i=(i=Math.imul(L,he))+Math.imul(F,le)|0,o=Math.imul(F,he);var Ce=(c+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,be)|0)+Math.imul(U,pe)|0))<<13)|0;c=((o=o+Math.imul(U,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Re=(c+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,be))+Math.imul(F,pe)|0))<<13)|0;return c=((o=Math.imul(F,be))+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,u[0]=ye,u[1]=me,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=ke,u[7]=Se,u[8]=Ae,u[9]=Ee,u[10]=xe,u[11]=Me,u[12]=je,u[13]=Ie,u[14]=Oe,u[15]=Te,u[16]=Be,u[17]=Ce,u[18]=Re,0!==c&&(u[19]=c,r.length++),r};function s(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}Math.imul||(o=i),m.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?i(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):s(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=m.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},m.prototype.muln=function(e){return this.clone().imuln(e)},m.prototype.sqr=function(){return this.mul(this)},m.prototype.isqr=function(){return this.imul(this.clone())},m.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new m(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;0<=t;t--)this.words[t+n]=this.words[t];for(t=0;t>>i<o)for(this.length-=o,u=0;u>>i,c=f&a}return s&&0!==c&&(s.words[s.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},m.prototype.ishrn=function(e,t,r){return y(0===this.negative),this.iushrn(e,t,r)},m.prototype.shln=function(e){return this.clone().ishln(e)},m.prototype.ushln=function(e){return this.clone().iushln(e)},m.prototype.shrn=function(e){return this.clone().ishrn(e)},m.prototype.ushrn=function(e){return this.clone().iushrn(e)},m.prototype.testn=function(e){y("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,n=1<>>t<>26)-(s/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===a)return this.strip();for(y(-1===a),n=a=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},m.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,s=n.length-i.length;if("mod"!==t){(a=new m(null)).length=s+1,a.words=new Array(a.length);for(var u=0;uthis.length||this.cmp(e)<0?{div:new m(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new m(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new m(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,o},m.prototype.div=function(e){return this.divmod(e,"div",!1).div},m.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},m.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},m.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},m.prototype.modn=function(e){y(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;0<=n;n--)r=(t*r+(0|this.words[n]))%e;return r},m.prototype.idivn=function(e){y(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},m.prototype.divn=function(e){return this.clone().idivn(e)},m.prototype.egcd=function(e){y(0===e.negative),y(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new m(1),i=new m(0),o=new m(0),a=new m(1),s=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++s;for(var u=r.clone(),c=t.clone();!t.isZero();){for(var f=0,l=1;0==(t.words[0]&l)&&f<26;++f,l<<=1);if(0>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},m.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},m.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1e.length)return 1;if(this.lengththis.n;);var n=t>>22,i=o}i>>>=22,0===(e.words[n-10]=i)&&10>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},m._prime=function(e){if(c[e])return c[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new g;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return c[e]=t},_.prototype._verify1=function(e){y(0===e.negative,"red works only with positives"),y(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){y(0==(e.negative|t.negative),"red works only with positives"),y(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(y(t%2==1),3===t){var r=this.m.add(new m(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);y(!n.isZero());var o=new m(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new m(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var c=this.pow(u,n),f=this.pow(e,n.addn(1).iushrn(1)),l=this.pow(e,n),h=i;0!==l.cmp(o);){for(var d=l,p=0;0!==d.cmp(o);p++)d=d.redSqr();y(p>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[o]),o=a=0)):a=0}s=26}return i},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},m.mont=function(e){return new k(e)},r(k,_),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new m(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e)},{}],550:[function(e,t,r){arguments[4][405][0].apply(r,arguments)},{dup:405}],551:[function(e,N,t){(function(B,C){"use strict";function R(e){return(R="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})(e)}!function(){var l="input is invalid type",e="object"===("undefined"==typeof window?"undefined":R(window)),t=e?window:{};t.JS_SHA3_NO_WINDOW&&(e=!1);var r=!e&&"object"===("undefined"==typeof self?"undefined":R(self));!t.JS_SHA3_NO_NODE_JS&&"object"===(void 0===B?"undefined":R(B))&&B.versions&&B.versions.node?t=C:r&&(t=self);var n=!t.JS_SHA3_NO_COMMON_JS&&"object"===(void 0===N?"undefined":R(N))&&N.exports,i="function"==typeof define&&define.amd,h=!t.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,u="0123456789abcdef".split(""),o=[4,1024,262144,67108864],d=[0,8,16,24],fe=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],a=[224,256,384,512],s=[128,256],c=["hex","buffer","arrayBuffer","array","digest"],f={128:168,256:136};!t.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!h||!t.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===R(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(t,r,n){return function(e){return new I(t,r,t).update(e)[n]()}},b=function(r,n,i){return function(e,t){return new I(r,n,t).update(e)[i]()}},y=function(i,e,o){return function(e,t,r,n){return _["cshake"+i].update(e,t,r,n)[o]()}},m=function(i,e,o){return function(e,t,r,n){return _["kmac"+i].update(e,t,r,n)[o]()}},v=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function O(e,t,r){I.call(this,e,t,r)}I.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=R(e);if("string"!==r){if("object"!==r)throw new Error(l);if(null===e)throw new Error(l);if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||h&&ArrayBuffer.isView(e)))throw new Error(l);t=!0}for(var n,i,o=this.blocks,a=this.byteCount,s=e.length,u=this.blockCount,c=0,f=this.s;c>2]|=e[c]<>2]|=i<>2]|=(192|i>>6)<>2]|=(224|i>>12)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>=8);0>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},I.prototype.encodeString=function(e){var t,r=R(e);if("string"!==r){if("object"!==r)throw new Error(l);if(null===e)throw new Error(l);if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||h&&ArrayBuffer.isView(e)))throw new Error(l);t=!0}var n=0,i=e.length;if(t)n=i;else for(var o=0;o>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];a%t==0&&(T(r),o=0)}return i&&(e=r[o],s+=u[e>>4&15]+u[15&e],1>12&15]+u[e>>8&15]),2>20&15]+u[e>>16&15])),s},I.prototype.buffer=I.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r==0&&T(n)}return o&&(e=s<<2,t=n[a],u[e]=255&t,1>8&255),2>16&255)),u},(O.prototype=new I).finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var T=function(e){var t,r,n,i,o,a,s,u,c,f,l,h,d,p,b,y,m,v,g,w,_,k,S,A,E,x,M,j,I,O,T,B,C,R,N,U,P,L,F,D,q,z,H,K,V,W,G,Y,X,J,Z,$,Q,ee,te,re,ne,ie,oe,ae,se,ue,ce;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],l=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|c>>>31),r=o^(c<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|l>>>31),r=s^(l<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(h<<1|d>>>31),r=c^(d<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=l^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],W=e[11]<<4|e[10]>>>28,G=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,I=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,N=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,T=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,ce=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,U=e[14]<<6|e[15]>>>26,P=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,C=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,E=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,L=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,M=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,k=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=b^~m&g,e[10]=A^~x&j,e[11]=E^~M&I,e[20]=R^~U&L,e[21]=N^~P&F,e[30]=K^~W&Y,e[31]=V^~G&X,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=y^~v&w,e[3]=m^~g&_,e[12]=x^~j&O,e[13]=M^~I&T,e[22]=U^~L&D,e[23]=P^~F&q,e[32]=W^~Y&J,e[33]=G^~X&Z,e[42]=re^~ie&ae,e[43]=ne^~oe&se,e[4]=v^~w&k,e[5]=g^~_&S,e[14]=j^~O&B,e[15]=I^~T&C,e[24]=L^~D&z,e[25]=F^~q&H,e[34]=Y^~J&$,e[35]=X^~Z&Q,e[44]=ie^~ae&ue,e[45]=oe^~se&ce,e[6]=w^~k&p,e[7]=_^~S&b,e[16]=O^~B&A,e[17]=T^~C&E,e[26]=D^~z&R,e[27]=q^~H&N,e[36]=J^~$&K,e[37]=Z^~Q&V,e[46]=ae^~ue&ee,e[47]=se^~ce&te,e[8]=k^~p&y,e[9]=S^~b&m,e[18]=B^~A&x,e[19]=C^~E&M,e[28]=z^~R&U,e[29]=H^~N&P,e[38]=$^~K&W,e[39]=Q^~V&G,e[48]=ue^~ee&re,e[49]=ce^~te&ne,e[0]^=fe[n],e[1]^=fe[n+1]};if(n)N.exports=_;else{for(S=0;S":">",'"':""","'":"'","`":"`"},q=d.invert(D),z=function(t){var r=function(e){return t[e]},e="(?:"+d.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};d.escape=z(D),d.unescape=z(q),d.result=function(e,t,r){d.isArray(t)||(t=[t]);var n=t.length;if(!n)return d.isFunction(r)?r.call(e):r;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,V={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},W=/\\|'|\r|\n|\u2028|\u2029/g,G=function(e){return"\\"+V[e]};d.template=function(o,e,t){!e&&t&&(e=t),e=d.defaults({},e,d.templateSettings);var r,n=RegExp([(e.escape||K).source,(e.interpolate||K).source,(e.evaluate||K).source].join("|")+"|$","g"),a=0,s="__p+='";o.replace(n,function(e,t,r,n,i){return s+=o.slice(a,i).replace(W,G),a=i+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(s+="';\n"+n+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{r=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var i=function(e){return r.call(this,e,d)},u=e.variable||"obj";return i.source="function("+u+"){\n"+s+"}",i},d.chain=function(e){var t=d(e);return t._chain=!0,t};var Y=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(r){return d.each(d.functions(r),function(e){var t=d[e]=r[e];d.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),Y(this,t.apply(d,e))}}),d},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];d.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],Y(this,e)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return Y(this,t.apply(this._wrapped,arguments))}}),d.prototype.valueOf=d.prototype.toJSON=d.prototype.value=function(){return this._wrapped},d.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return d})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],558:[function(e,t,r){"use strict";!function(e){var n,i,o,a=String.fromCharCode;function s(e){for(var t,r,n=[],i=0,o=e.length;i>t&63|128)}function c(e){if(0==(4294967168&e))return a(e);var t="";return 0==(4294965248&e)?t=a(e>>6&31|192):0==(4294901760&e)?(r(e),t=a(e>>12&15|224),t+=u(e,6)):0==(4292870144&e)&&(t=a(e>>18&7|240),t+=u(e,12),t+=u(e,6)),t+=a(63&e|128)}function f(){if(i<=o)throw Error("Invalid byte index");var e=255&n[o];if(o++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(){var e,t;if(i>>10&1023|55296),t=56320|1023&t),i+=a(t);return i}(r)}}(void 0===r?(void 0).utf8={}:r)},{}],559:[function(e,t,r){"use strict";function s(e){return(s="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})(e)}var u=e("underscore"),n=e("ethjs-unit"),o=e("./utils.js"),i=e("./soliditySha3.js"),a=e("randombytes"),c=function i(o,e){var a=[];return e.forEach(function(e){if("object"===s(e.components)){if("tuple"!==e.type.substring(0,5))throw new Error("components found but type is not tuple; report on GitHub");var t="",r=e.type.indexOf("[");0<=r&&(t=e.type.substring(r));var n=i(o,e.components);u.isArray(n)&&o?a.push("tuple("+n.join(",")+")"+t):o?a.push("("+n+")"):a.push("("+n.join(",")+")"+t)}else a.push(e.type)}),a},f=function(e){if(!o.isHexStrict(e))throw new Error("The parameter must be a valid HEX string.");var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);rn)throw new Error("Supplied uint exceeds width: "+n+" vs "+i.bitLength());if(i.lt(new s(0)))throw new Error("Supplied uint "+i.toString()+" is negative");return n?u.leftPad(i.toString("hex"),n/8*2):i}if(e.startsWith("int")){if(n%8||n<8||256n)throw new Error("Supplied int exceeds width: "+n+" vs "+i.bitLength());return i.lt(new s(0))?i.toTwos(n).toString("hex"):n?u.leftPad(i.toString("hex"),n/8*2):i}throw new Error("Unsupported or invalid type: "+e)},i=function(e){if(o.isArray(e))throw new Error("Autodetection of array types is not supported.");var t,r,n,i="";if(o.isObject(e)&&(e.hasOwnProperty("v")||e.hasOwnProperty("t")||e.hasOwnProperty("value")||e.hasOwnProperty("type"))?(t=e.hasOwnProperty("t")?e.t:e.type,i=e.hasOwnProperty("v")?e.v:e.value):(t=u.toHex(e,!0),i=u.toHex(e),t.startsWith("int")||t.startsWith("uint")||(t="bytes")),!t.startsWith("int")&&!t.startsWith("uint")||"string"!=typeof i||/^(-)?0x/i.test(i)||(i=new s(i)),o.isArray(i)){if(n=/^\D+\d*\[(\d+)\]$/.exec(t),(r=n?parseInt(n[1],10):null)&&i.length!==r)throw new Error(t+" is not matching the given array "+JSON.stringify(i));r=i.length}return o.isArray(i)?i.map(function(e){return a(t,e,r).toString("hex").replace("0x","")}).join(""):a(t,i,r).toString("hex").replace("0x","")};t.exports={soliditySha3:function(){var e=Array.prototype.slice.call(arguments),t=o.map(e,i);return u.sha3("0x"+t.join(""))},soliditySha3Raw:function(){return u.sha3Raw("0x"+o.map(Array.prototype.slice.call(arguments),i).join(""))}}},{"./utils.js":561,"bn.js":544,underscore:557}],561:[function(v,g,e){(function(r){"use strict";var n=v("underscore"),i=v("bn.js"),e=v("number-to-bn"),o=v("utf8"),a=v("eth-lib/lib/hash"),s=v("ethereum-bloom-filters"),u=function(e){return i.isBN(e)},c=function(e){return e&&e.constructor&&"BigNumber"===e.constructor.name},f=function(t){try{return e.apply(null,arguments)}catch(e){throw new Error(e+' Given value: "'+t+'"')}},l=function(e){return!!/^(0x)?[0-9a-f]{40}$/i.test(e)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(e)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(e))||t(e))},t=function(e){e=e.replace(/^0x/i,"");for(var t=m(e.toLowerCase()).replace(/^0x/i,""),r=0;r<40;r++)if(7>>4).toString(16)),t.push((15&e[r]).toString(16));return"0x"+t.join("")},isHex:function(e){return(n.isString(e)||n.isNumber(e))&&/^(-0x|0x)?[0-9a-f]*$/i.test(e)},isHexStrict:b,leftPad:function(e,t,r){var n=/^0x/i.test(e)||"number"==typeof e,i=0<=t-(e=e.toString(16).replace(/^0x/i,"")).length+1?t-e.length+1:0;return(n?"0x":"")+new Array(i).join(r||"0")+e},rightPad:function(e,t,r){var n=/^0x/i.test(e)||"number"==typeof e,i=0<=t-(e=e.toString(16).replace(/^0x/i,"")).length+1?t-e.length+1:0;return(n?"0x":"")+e+new Array(i).join(r||"0")},toTwosComplement:function(e){return"0x"+f(e).toTwos(256).toString(16,64)},sha3:m,sha3Raw:function(e){return null===(e=m(e))?y:e}}}).call(this,{isBuffer:v("../../../node_modules/is-buffer/index.js")})},{"../../../node_modules/is-buffer/index.js":105,"bn.js":544,"eth-lib/lib/hash":545,"ethereum-bloom-filters":546,"number-to-bn":553,underscore:557,utf8:558}],562:[function(e,t,r){t.exports={name:"web3",version:"1.2.8",description:"Ethereum JavaScript API",repository:"https://github.com/ethereum/web3.js",license:"LGPL-3.0",engines:{node:">=8.0.0"},main:"src/index.js",bugs:{url:"https://github.com/ethereum/web3.js/issues"},keywords:["Ethereum","JavaScript","API"],author:"ethereum.org",types:"types/index.d.ts",scripts:{dtslint:"dtslint --localTs node_modules/typescript/lib types",postinstall:"node angular-patch.js"},authors:[{name:"Fabian Vogelsteller",email:"fabian@ethereum.org",homepage:"http://frozeman.de"},{name:"Marek Kotewicz",email:"marek@parity.io",url:"https://github.com/debris"},{name:"Marian Oancea",url:"https://github.com/cubedro"},{name:"Gav Wood",email:"g@parity.io",homepage:"http://gavwood.com"},{name:"Jeffery Wilcke",email:"jeffrey.wilcke@ethereum.org",url:"https://github.com/obscuren"}],dependencies:{"web3-bzz":"1.2.8","web3-core":"1.2.8","web3-eth":"1.2.8","web3-eth-personal":"1.2.8","web3-net":"1.2.8","web3-shh":"1.2.8","web3-utils":"1.2.8"},devDependencies:{"@types/node":"^12.12.34",dtslint:"^3.4.1",typescript:"latest"}}},{}],BN:[function(e,t,r){arguments[4][271][0].apply(r,arguments)},{buffer:21,dup:271}],Web3:[function(e,t,r){"use strict";var i=e("../package.json").version,o=e("web3-core"),a=e("web3-eth"),n=e("web3-net"),s=e("web3-eth-personal"),u=e("web3-shh"),c=e("web3-bzz"),f=e("web3-utils"),l=function(){var r=this;o.packageInit(this,arguments),this.version=i,this.utils=f,this.eth=new a(this),this.shh=new u(this),this.bzz=new c(this);var n=this.setProvider;this.setProvider=function(e,t){return n.apply(r,arguments),r.eth.setRequestManager(r._requestManager),r.shh.setRequestManager(r._requestManager),r.bzz.setProvider(e),!0}};l.version=i,l.utils=f,l.modules={Eth:a,Net:n,Personal:s,Shh:u,Bzz:c},o.addProviders(l),t.exports=l},{"../package.json":562,"web3-bzz":212,"web3-core":231,"web3-eth":523,"web3-eth-personal":520,"web3-net":524,"web3-shh":543,"web3-utils":559}]},{},[151,"Web3"])("Web3")}); \ No newline at end of file diff --git a/src/assets/js/worker.js b/src/assets/js/worker.js deleted file mode 100644 index c6ce309..0000000 --- a/src/assets/js/worker.js +++ /dev/null @@ -1,63 +0,0 @@ -let window = self; - -importScripts('moolb.js'); -importScripts('sync.js'); -importScripts('web3.min.js'); - -let s = undefined; - -// TODO: as worker has its own scope we don't need the object -function Driver(messager, provider, lo, filters, syncer) { - this.w3 = new Web3(provider); - this.lo = lo; - this.hi = lo; - this.filters = filters; - this.syncer = syncer; - this.messager = messager; -} - -Driver.prototype.start = function(hi) { - let self = this; - if (hi !== undefined) { - self.sync(hi); - return; - } - s.w3.eth.getBlockNumber().then(function(n) { - self.sync(n); - }); -}; - -Driver.prototype.sync = function(n) { - this.hi = n; - this.syncer(this, this.lo, this.hi, this.filters[0], this.filters[1], this.getCount, this.process); -}; - - -Driver.prototype.process = function(b, t) { - s.w3.eth.getTransactionFromBlock(b, t).then((t) => { - s.w3.eth.getTransactionReceipt(t.hash).then((r) => { - this.postMessage(r); - }); - }).catch(function(e) { - //this.postMessage(['failed getTransactionFromBlock(' + b + ', ' + t + ')']); - console.error('failed getTransactionFromBlock(' + b + ', ' + t + ')'); - }); -} - -Driver.prototype.getCount = async function (b) { - const n = s.w3.eth.getBlockTransactionCount(b); - return n; -}; - -onmessage = function(o) { - const filters = [ - bloomFromBytes(o.data.filters[0], o.data.filter_rounds), - bloomFromBytes(o.data.filters[1], o.data.filter_rounds), - ]; - s = new Driver(postMessage, o.data.w3_provider, o.data.lo, filters, sync_by_filter); - let hi = undefined; - if (o.data.hi > 0) { - hi = o.data.hi; - } - s.start(hi); -}; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3b95f04..cd57751 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -9,5 +9,6 @@ export const environment = { cicUssdUrl: 'http://localhost:63315', cicEthUrl: 'http://localhost:63314', contractAddress: '0xd0097a901AF4ac2E63A5b6E86be8Ad91f10b05d7', - registryAddress: '0xf374d7B507767101a4bf3bA2a6B99AC737A44f6d' + registryAddress: '0xf374d7B507767101a4bf3bA2a6B99AC737A44f6d', + trustedDeclaratorAddress: '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C' }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index e4bdb64..310a3c1 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -13,7 +13,8 @@ export const environment = { cicUssdUrl: 'http://localhost:63315', cicEthUrl: 'http://localhost:63314', contractAddress: '0xd0097a901AF4ac2E63A5b6E86be8Ad91f10b05d7', - registryAddress: '0xf374d7B507767101a4bf3bA2a6B99AC737A44f6d' + registryAddress: '0xf374d7B507767101a4bf3bA2a6B99AC737A44f6d', + trustedDeclaratorAddress: '0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C' }; /* diff --git a/src/index.html b/src/index.html index 6e7f582..c070004 100644 --- a/src/index.html +++ b/src/index.html @@ -18,6 +18,5 @@ -